Taniya Das | 6f0884b | 2011-09-06 16:24:21 +0530 | [diff] [blame] | 1 | /** |
| 2 | * |
| 3 | * Synaptics RMI platform data definitions for use in board files. |
| 4 | * Copyright (c) 2007 - 2011, Synaptics Incorporated |
| 5 | * |
| 6 | */ |
| 7 | /* |
| 8 | * This file is licensed under the GPL2 license. |
| 9 | * |
| 10 | *############################################################################ |
| 11 | * GPL |
| 12 | * |
| 13 | * This program is free software; you can redistribute it and/or modify it |
| 14 | * under the terms of the GNU General Public License version 2 as published |
| 15 | * by the Free Software Foundation. |
| 16 | * |
| 17 | * This program is distributed in the hope that it will be useful, but |
| 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 19 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 20 | * for more details. |
| 21 | * |
| 22 | *############################################################################ |
| 23 | */ |
| 24 | |
| 25 | #if !defined(_RMI_PLATFORMDATA_H) |
| 26 | #define _RMI_PLATFORMDATA_H |
| 27 | |
| 28 | #define RMI_F01_INDEX 0x01 |
| 29 | #define RMI_F11_INDEX 0x11 |
| 30 | #define RMI_F19_INDEX 0x19 |
| 31 | #define RMI_F34_INDEX 0x34 |
| 32 | |
| 33 | |
| 34 | /* A couple of structs that are useful for frequently occuring constructs,such |
| 35 | * as coordinate origin offsets or coordinate clipping values. |
| 36 | */ |
| 37 | struct rmi_XY_pair { |
| 38 | int x; |
| 39 | int y; |
| 40 | }; |
| 41 | |
| 42 | struct rmi_range { |
| 43 | int min; |
| 44 | int max; |
| 45 | }; |
| 46 | |
| 47 | /* This contains sensor specific data that is not specialized to I2C or SPI. |
| 48 | */ |
| 49 | struct rmi_sensordata { |
| 50 | /* This will be called from rmi_register_sensor(). You can use it |
| 51 | * to set up gpios, IRQs, and other platform specific infrastructure. |
| 52 | */ |
| 53 | int (*rmi_sensor_setup)(void); |
| 54 | |
| 55 | /* This will be called when the sensor is unloaded. Use this to |
| 56 | * release gpios, IRQs, and other platform specific infrastructure. |
| 57 | */ |
| 58 | void (*rmi_sensor_teardown)(void); |
| 59 | |
| 60 | /* Use this to specify non-default settings on a per function basis. |
| 61 | */ |
| 62 | struct rmi_functiondata_list *perfunctiondata; |
| 63 | }; |
| 64 | |
| 65 | /* This contains the per-function customization for a given function.We store |
| 66 | * the data this way in order to avoid allocating a large sparse array |
| 67 | * typically |
| 68 | * only a few functions are present on a sensor, and even fewer will be have |
| 69 | * custom settings. There is a very small penalty paid for doing a linear |
| 70 | * search through the list to find a given function's data, but since the list |
| 71 | * is typically very short and is searched only at system boot time, this is |
| 72 | * considered acceptable. |
| 73 | * |
| 74 | * When adding new fields to a functiondata struct, please follow these rules: |
| 75 | * - Where possible, use 0 to indicate that the value should be defaulted. |
| 76 | * This works pretty well for bools, ints, and chars. |
| 77 | * - Where this is not practical (for example, in coordinate offsets or |
| 78 | * range clipping), use a pointer. Set that pointer to null to indicate |
| 79 | * that the value should be defaulted. |
| 80 | */ |
| 81 | struct rmi_functiondata { |
| 82 | unsigned char function_index; |
| 83 | void *data; |
| 84 | }; |
| 85 | |
| 86 | /* This can be included in the platformdata for SPI or I2C RMI4 devices to |
| 87 | * customize the settings of the functions on a given sensor. |
| 88 | */ |
| 89 | struct rmi_functiondata_list { |
| 90 | unsigned char count; /* Number of elements in the array */ |
| 91 | struct rmi_functiondata *functiondata; |
| 92 | }; |
| 93 | |
| 94 | struct rmi_f01_functiondata { |
| 95 | /* What this does is product specific. For most, but not all, RMI4 |
| 96 | * devices, you can set this to true in order to request the device |
| 97 | * report data at half the usual rate. This can be useful on slow |
| 98 | * CPUs that don't have the resources to process data at the usual |
| 99 | * rate. However, the meaning of this field is product specific, and |
| 100 | * you should consult the product spec for your sensor to find out |
| 101 | * what this will do. |
| 102 | */ |
| 103 | bool nonstandard_report_rate; |
| 104 | }; |
| 105 | |
| 106 | struct rmi_f11_functiondata { |
| 107 | bool swap_axes; |
| 108 | bool flipX; |
| 109 | bool flipY; |
| 110 | int button_height; |
| 111 | struct rmi_XY_pair *offset; |
| 112 | struct rmi_range *clipX; |
| 113 | struct rmi_range *clipY; |
| 114 | }; |
| 115 | |
| 116 | struct rmi_button_map { |
| 117 | unsigned char nbuttons; |
| 118 | unsigned char *map; |
| 119 | }; |
| 120 | |
| 121 | struct rmi_f19_functiondata { |
| 122 | struct rmi_button_map *button_map; |
| 123 | }; |
| 124 | |
| 125 | #endif |