aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/atmel_mxt_ts.c
diff options
context:
space:
mode:
authorIiro Valkonen <iiro.valkonen@atmel.com>2011-07-04 06:08:25 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2011-07-04 06:19:11 -0400
commit81c88a711aef5552375c4296bb473fdf9b12273c (patch)
tree194272f97ac8dfd1cd37b99e04e29249aaf814d0 /drivers/input/touchscreen/atmel_mxt_ts.c
parentc7b4a5d58bffdf3aa7f923319643af0ebf925515 (diff)
Input: atmel_mxt_ts - update object list
Update the object list to include new objects, and add unique identifiers so we can distinguish between old & new generation of the same object. Signed-off-by: Iiro Valkonen <iiro.valkonen@atmel.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/touchscreen/atmel_mxt_ts.c')
-rw-r--r--drivers/input/touchscreen/atmel_mxt_ts.c184
1 files changed, 102 insertions, 82 deletions
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 1e61387c73ca..5d71e4475934 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -48,41 +48,47 @@
48#define MXT_OBJECT_SIZE 6 48#define MXT_OBJECT_SIZE 6
49 49
50/* Object types */ 50/* Object types */
51#define MXT_DEBUG_DIAGNOSTIC 37 51#define MXT_DEBUG_DIAGNOSTIC_T37 37
52#define MXT_GEN_MESSAGE 5 52#define MXT_GEN_MESSAGE_T5 5
53#define MXT_GEN_COMMAND 6 53#define MXT_GEN_COMMAND_T6 6
54#define MXT_GEN_POWER 7 54#define MXT_GEN_POWER_T7 7
55#define MXT_GEN_ACQUIRE 8 55#define MXT_GEN_ACQUIRE_T8 8
56#define MXT_TOUCH_MULTI 9 56#define MXT_GEN_DATASOURCE_T53 53
57#define MXT_TOUCH_KEYARRAY 15 57#define MXT_TOUCH_MULTI_T9 9
58#define MXT_TOUCH_PROXIMITY 23 58#define MXT_TOUCH_KEYARRAY_T15 15
59#define MXT_PROCI_GRIPFACE 20 59#define MXT_TOUCH_PROXIMITY_T23 23
60#define MXT_PROCG_NOISE 22 60#define MXT_TOUCH_PROXKEY_T52 52
61#define MXT_PROCI_ONETOUCH 24 61#define MXT_PROCI_GRIPFACE_T20 20
62#define MXT_PROCI_TWOTOUCH 27 62#define MXT_PROCG_NOISE_T22 22
63#define MXT_PROCI_GRIP 40 63#define MXT_PROCI_ONETOUCH_T24 24
64#define MXT_PROCI_PALM 41 64#define MXT_PROCI_TWOTOUCH_T27 27
65#define MXT_SPT_COMMSCONFIG 18 65#define MXT_PROCI_GRIP_T40 40
66#define MXT_SPT_GPIOPWM 19 66#define MXT_PROCI_PALM_T41 41
67#define MXT_SPT_SELFTEST 25 67#define MXT_PROCI_TOUCHSUPPRESSION_T42 42
68#define MXT_SPT_CTECONFIG 28 68#define MXT_PROCI_STYLUS_T47 47
69#define MXT_SPT_USERDATA 38 69#define MXT_PROCG_NOISESUPPRESSION_T48 48
70#define MXT_SPT_DIGITIZER 43 70#define MXT_SPT_COMMSCONFIG_T18 18
71#define MXT_SPT_MESSAGECOUNT 44 71#define MXT_SPT_GPIOPWM_T19 19
72 72#define MXT_SPT_SELFTEST_T25 25
73/* MXT_GEN_COMMAND field */ 73#define MXT_SPT_CTECONFIG_T28 28
74#define MXT_SPT_USERDATA_T38 38
75#define MXT_SPT_DIGITIZER_T43 43
76#define MXT_SPT_MESSAGECOUNT_T44 44
77#define MXT_SPT_CTECONFIG_T46 46
78
79/* MXT_GEN_COMMAND_T6 field */
74#define MXT_COMMAND_RESET 0 80#define MXT_COMMAND_RESET 0
75#define MXT_COMMAND_BACKUPNV 1 81#define MXT_COMMAND_BACKUPNV 1
76#define MXT_COMMAND_CALIBRATE 2 82#define MXT_COMMAND_CALIBRATE 2
77#define MXT_COMMAND_REPORTALL 3 83#define MXT_COMMAND_REPORTALL 3
78#define MXT_COMMAND_DIAGNOSTIC 5 84#define MXT_COMMAND_DIAGNOSTIC 5
79 85
80/* MXT_GEN_POWER field */ 86/* MXT_GEN_POWER_T7 field */
81#define MXT_POWER_IDLEACQINT 0 87#define MXT_POWER_IDLEACQINT 0
82#define MXT_POWER_ACTVACQINT 1 88#define MXT_POWER_ACTVACQINT 1
83#define MXT_POWER_ACTV2IDLETO 2 89#define MXT_POWER_ACTV2IDLETO 2
84 90
85/* MXT_GEN_ACQUIRE field */ 91/* MXT_GEN_ACQUIRE_T8 field */
86#define MXT_ACQUIRE_CHRGTIME 0 92#define MXT_ACQUIRE_CHRGTIME 0
87#define MXT_ACQUIRE_TCHDRIFT 2 93#define MXT_ACQUIRE_TCHDRIFT 2
88#define MXT_ACQUIRE_DRIFTST 3 94#define MXT_ACQUIRE_DRIFTST 3
@@ -91,7 +97,7 @@
91#define MXT_ACQUIRE_ATCHCALST 6 97#define MXT_ACQUIRE_ATCHCALST 6
92#define MXT_ACQUIRE_ATCHCALSTHR 7 98#define MXT_ACQUIRE_ATCHCALSTHR 7
93 99
94/* MXT_TOUCH_MULTI field */ 100/* MXT_TOUCH_MULTI_T9 field */
95#define MXT_TOUCH_CTRL 0 101#define MXT_TOUCH_CTRL 0
96#define MXT_TOUCH_XORIGIN 1 102#define MXT_TOUCH_XORIGIN 1
97#define MXT_TOUCH_YORIGIN 2 103#define MXT_TOUCH_YORIGIN 2
@@ -121,7 +127,7 @@
121#define MXT_TOUCH_YEDGEDIST 29 127#define MXT_TOUCH_YEDGEDIST 29
122#define MXT_TOUCH_JUMPLIMIT 30 128#define MXT_TOUCH_JUMPLIMIT 30
123 129
124/* MXT_PROCI_GRIPFACE field */ 130/* MXT_PROCI_GRIPFACE_T20 field */
125#define MXT_GRIPFACE_CTRL 0 131#define MXT_GRIPFACE_CTRL 0
126#define MXT_GRIPFACE_XLOGRIP 1 132#define MXT_GRIPFACE_XLOGRIP 1
127#define MXT_GRIPFACE_XHIGRIP 2 133#define MXT_GRIPFACE_XHIGRIP 2
@@ -151,11 +157,11 @@
151#define MXT_NOISE_FREQ4 15 157#define MXT_NOISE_FREQ4 15
152#define MXT_NOISE_IDLEGCAFVALID 16 158#define MXT_NOISE_IDLEGCAFVALID 16
153 159
154/* MXT_SPT_COMMSCONFIG */ 160/* MXT_SPT_COMMSCONFIG_T18 */
155#define MXT_COMMS_CTRL 0 161#define MXT_COMMS_CTRL 0
156#define MXT_COMMS_CMD 1 162#define MXT_COMMS_CMD 1
157 163
158/* MXT_SPT_CTECONFIG field */ 164/* MXT_SPT_CTECONFIG_T28 field */
159#define MXT_CTE_CTRL 0 165#define MXT_CTE_CTRL 0
160#define MXT_CTE_CMD 1 166#define MXT_CTE_CMD 1
161#define MXT_CTE_MODE 2 167#define MXT_CTE_MODE 2
@@ -166,7 +172,7 @@
166#define MXT_VOLTAGE_DEFAULT 2700000 172#define MXT_VOLTAGE_DEFAULT 2700000
167#define MXT_VOLTAGE_STEP 10000 173#define MXT_VOLTAGE_STEP 10000
168 174
169/* Define for MXT_GEN_COMMAND */ 175/* Define for MXT_GEN_COMMAND_T6 */
170#define MXT_BOOT_VALUE 0xa5 176#define MXT_BOOT_VALUE 0xa5
171#define MXT_BACKUP_VALUE 0x55 177#define MXT_BACKUP_VALUE 0x55
172#define MXT_BACKUP_TIME 25 /* msec */ 178#define MXT_BACKUP_TIME 25 /* msec */
@@ -256,24 +262,31 @@ struct mxt_data {
256static bool mxt_object_readable(unsigned int type) 262static bool mxt_object_readable(unsigned int type)
257{ 263{
258 switch (type) { 264 switch (type) {
259 case MXT_GEN_MESSAGE: 265 case MXT_GEN_MESSAGE_T5:
260 case MXT_GEN_COMMAND: 266 case MXT_GEN_COMMAND_T6:
261 case MXT_GEN_POWER: 267 case MXT_GEN_POWER_T7:
262 case MXT_GEN_ACQUIRE: 268 case MXT_GEN_ACQUIRE_T8:
263 case MXT_TOUCH_MULTI: 269 case MXT_GEN_DATASOURCE_T53:
264 case MXT_TOUCH_KEYARRAY: 270 case MXT_TOUCH_MULTI_T9:
265 case MXT_TOUCH_PROXIMITY: 271 case MXT_TOUCH_KEYARRAY_T15:
266 case MXT_PROCI_GRIPFACE: 272 case MXT_TOUCH_PROXIMITY_T23:
267 case MXT_PROCG_NOISE: 273 case MXT_TOUCH_PROXKEY_T52:
268 case MXT_PROCI_ONETOUCH: 274 case MXT_PROCI_GRIPFACE_T20:
269 case MXT_PROCI_TWOTOUCH: 275 case MXT_PROCG_NOISE_T22:
270 case MXT_PROCI_GRIP: 276 case MXT_PROCI_ONETOUCH_T24:
271 case MXT_PROCI_PALM: 277 case MXT_PROCI_TWOTOUCH_T27:
272 case MXT_SPT_COMMSCONFIG: 278 case MXT_PROCI_GRIP_T40:
273 case MXT_SPT_GPIOPWM: 279 case MXT_PROCI_PALM_T41:
274 case MXT_SPT_SELFTEST: 280 case MXT_PROCI_TOUCHSUPPRESSION_T42:
275 case MXT_SPT_CTECONFIG: 281 case MXT_PROCI_STYLUS_T47:
276 case MXT_SPT_USERDATA: 282 case MXT_PROCG_NOISESUPPRESSION_T48:
283 case MXT_SPT_COMMSCONFIG_T18:
284 case MXT_SPT_GPIOPWM_T19:
285 case MXT_SPT_SELFTEST_T25:
286 case MXT_SPT_CTECONFIG_T28:
287 case MXT_SPT_USERDATA_T38:
288 case MXT_SPT_DIGITIZER_T43:
289 case MXT_SPT_CTECONFIG_T46:
277 return true; 290 return true;
278 default: 291 default:
279 return false; 292 return false;
@@ -283,21 +296,28 @@ static bool mxt_object_readable(unsigned int type)
283static bool mxt_object_writable(unsigned int type) 296static bool mxt_object_writable(unsigned int type)
284{ 297{
285 switch (type) { 298 switch (type) {
286 case MXT_GEN_COMMAND: 299 case MXT_GEN_COMMAND_T6:
287 case MXT_GEN_POWER: 300 case MXT_GEN_POWER_T7:
288 case MXT_GEN_ACQUIRE: 301 case MXT_GEN_ACQUIRE_T8:
289 case MXT_TOUCH_MULTI: 302 case MXT_TOUCH_MULTI_T9:
290 case MXT_TOUCH_KEYARRAY: 303 case MXT_TOUCH_KEYARRAY_T15:
291 case MXT_TOUCH_PROXIMITY: 304 case MXT_TOUCH_PROXIMITY_T23:
292 case MXT_PROCI_GRIPFACE: 305 case MXT_TOUCH_PROXKEY_T52:
293 case MXT_PROCG_NOISE: 306 case MXT_PROCI_GRIPFACE_T20:
294 case MXT_PROCI_ONETOUCH: 307 case MXT_PROCG_NOISE_T22:
295 case MXT_PROCI_TWOTOUCH: 308 case MXT_PROCI_ONETOUCH_T24:
296 case MXT_PROCI_GRIP: 309 case MXT_PROCI_TWOTOUCH_T27:
297 case MXT_PROCI_PALM: 310 case MXT_PROCI_GRIP_T40:
298 case MXT_SPT_GPIOPWM: 311 case MXT_PROCI_PALM_T41:
299 case MXT_SPT_SELFTEST: 312 case MXT_PROCI_TOUCHSUPPRESSION_T42:
300 case MXT_SPT_CTECONFIG: 313 case MXT_PROCI_STYLUS_T47:
314 case MXT_PROCG_NOISESUPPRESSION_T48:
315 case MXT_SPT_COMMSCONFIG_T18:
316 case MXT_SPT_GPIOPWM_T19:
317 case MXT_SPT_SELFTEST_T25:
318 case MXT_SPT_CTECONFIG_T28:
319 case MXT_SPT_DIGITIZER_T43:
320 case MXT_SPT_CTECONFIG_T46:
301 return true; 321 return true;
302 default: 322 default:
303 return false; 323 return false;
@@ -455,7 +475,7 @@ static int mxt_read_message(struct mxt_data *data,
455 struct mxt_object *object; 475 struct mxt_object *object;
456 u16 reg; 476 u16 reg;
457 477
458 object = mxt_get_object(data, MXT_GEN_MESSAGE); 478 object = mxt_get_object(data, MXT_GEN_MESSAGE_T5);
459 if (!object) 479 if (!object)
460 return -EINVAL; 480 return -EINVAL;
461 481
@@ -597,8 +617,8 @@ static irqreturn_t mxt_interrupt(int irq, void *dev_id)
597 617
598 reportid = message.reportid; 618 reportid = message.reportid;
599 619
600 /* whether reportid is thing of MXT_TOUCH_MULTI */ 620 /* whether reportid is thing of MXT_TOUCH_MULTI_T9 */
601 object = mxt_get_object(data, MXT_TOUCH_MULTI); 621 object = mxt_get_object(data, MXT_TOUCH_MULTI_T9);
602 if (!object) 622 if (!object)
603 goto end; 623 goto end;
604 624
@@ -678,31 +698,31 @@ static void mxt_handle_pdata(struct mxt_data *data)
678 u8 voltage; 698 u8 voltage;
679 699
680 /* Set touchscreen lines */ 700 /* Set touchscreen lines */
681 mxt_write_object(data, MXT_TOUCH_MULTI, MXT_TOUCH_XSIZE, 701 mxt_write_object(data, MXT_TOUCH_MULTI_T9, MXT_TOUCH_XSIZE,
682 pdata->x_line); 702 pdata->x_line);
683 mxt_write_object(data, MXT_TOUCH_MULTI, MXT_TOUCH_YSIZE, 703 mxt_write_object(data, MXT_TOUCH_MULTI_T9, MXT_TOUCH_YSIZE,
684 pdata->y_line); 704 pdata->y_line);
685 705
686 /* Set touchscreen orient */ 706 /* Set touchscreen orient */
687 mxt_write_object(data, MXT_TOUCH_MULTI, MXT_TOUCH_ORIENT, 707 mxt_write_object(data, MXT_TOUCH_MULTI_T9, MXT_TOUCH_ORIENT,
688 pdata->orient); 708 pdata->orient);
689 709
690 /* Set touchscreen burst length */ 710 /* Set touchscreen burst length */
691 mxt_write_object(data, MXT_TOUCH_MULTI, 711 mxt_write_object(data, MXT_TOUCH_MULTI_T9,
692 MXT_TOUCH_BLEN, pdata->blen); 712 MXT_TOUCH_BLEN, pdata->blen);
693 713
694 /* Set touchscreen threshold */ 714 /* Set touchscreen threshold */
695 mxt_write_object(data, MXT_TOUCH_MULTI, 715 mxt_write_object(data, MXT_TOUCH_MULTI_T9,
696 MXT_TOUCH_TCHTHR, pdata->threshold); 716 MXT_TOUCH_TCHTHR, pdata->threshold);
697 717
698 /* Set touchscreen resolution */ 718 /* Set touchscreen resolution */
699 mxt_write_object(data, MXT_TOUCH_MULTI, 719 mxt_write_object(data, MXT_TOUCH_MULTI_T9,
700 MXT_TOUCH_XRANGE_LSB, (pdata->x_size - 1) & 0xff); 720 MXT_TOUCH_XRANGE_LSB, (pdata->x_size - 1) & 0xff);
701 mxt_write_object(data, MXT_TOUCH_MULTI, 721 mxt_write_object(data, MXT_TOUCH_MULTI_T9,
702 MXT_TOUCH_XRANGE_MSB, (pdata->x_size - 1) >> 8); 722 MXT_TOUCH_XRANGE_MSB, (pdata->x_size - 1) >> 8);
703 mxt_write_object(data, MXT_TOUCH_MULTI, 723 mxt_write_object(data, MXT_TOUCH_MULTI_T9,
704 MXT_TOUCH_YRANGE_LSB, (pdata->y_size - 1) & 0xff); 724 MXT_TOUCH_YRANGE_LSB, (pdata->y_size - 1) & 0xff);
705 mxt_write_object(data, MXT_TOUCH_MULTI, 725 mxt_write_object(data, MXT_TOUCH_MULTI_T9,
706 MXT_TOUCH_YRANGE_MSB, (pdata->y_size - 1) >> 8); 726 MXT_TOUCH_YRANGE_MSB, (pdata->y_size - 1) >> 8);
707 727
708 /* Set touchscreen voltage */ 728 /* Set touchscreen voltage */
@@ -715,7 +735,7 @@ static void mxt_handle_pdata(struct mxt_data *data)
715 voltage = (pdata->voltage - MXT_VOLTAGE_DEFAULT) / 735 voltage = (pdata->voltage - MXT_VOLTAGE_DEFAULT) /
716 MXT_VOLTAGE_STEP; 736 MXT_VOLTAGE_STEP;
717 737
718 mxt_write_object(data, MXT_SPT_CTECONFIG, 738 mxt_write_object(data, MXT_SPT_CTECONFIG_T28,
719 MXT_CTE_VOLTAGE, voltage); 739 MXT_CTE_VOLTAGE, voltage);
720 } 740 }
721} 741}
@@ -819,13 +839,13 @@ static int mxt_initialize(struct mxt_data *data)
819 mxt_handle_pdata(data); 839 mxt_handle_pdata(data);
820 840
821 /* Backup to memory */ 841 /* Backup to memory */
822 mxt_write_object(data, MXT_GEN_COMMAND, 842 mxt_write_object(data, MXT_GEN_COMMAND_T6,
823 MXT_COMMAND_BACKUPNV, 843 MXT_COMMAND_BACKUPNV,
824 MXT_BACKUP_VALUE); 844 MXT_BACKUP_VALUE);
825 msleep(MXT_BACKUP_TIME); 845 msleep(MXT_BACKUP_TIME);
826 846
827 /* Soft reset */ 847 /* Soft reset */
828 mxt_write_object(data, MXT_GEN_COMMAND, 848 mxt_write_object(data, MXT_GEN_COMMAND_T6,
829 MXT_COMMAND_RESET, 1); 849 MXT_COMMAND_RESET, 1);
830 msleep(MXT_RESET_TIME); 850 msleep(MXT_RESET_TIME);
831 851
@@ -921,7 +941,7 @@ static int mxt_load_fw(struct device *dev, const char *fn)
921 } 941 }
922 942
923 /* Change to the bootloader mode */ 943 /* Change to the bootloader mode */
924 mxt_write_object(data, MXT_GEN_COMMAND, 944 mxt_write_object(data, MXT_GEN_COMMAND_T6,
925 MXT_COMMAND_RESET, MXT_BOOT_VALUE); 945 MXT_COMMAND_RESET, MXT_BOOT_VALUE);
926 msleep(MXT_RESET_TIME); 946 msleep(MXT_RESET_TIME);
927 947
@@ -1027,14 +1047,14 @@ static void mxt_start(struct mxt_data *data)
1027{ 1047{
1028 /* Touch enable */ 1048 /* Touch enable */
1029 mxt_write_object(data, 1049 mxt_write_object(data,
1030 MXT_TOUCH_MULTI, MXT_TOUCH_CTRL, 0x83); 1050 MXT_TOUCH_MULTI_T9, MXT_TOUCH_CTRL, 0x83);
1031} 1051}
1032 1052
1033static void mxt_stop(struct mxt_data *data) 1053static void mxt_stop(struct mxt_data *data)
1034{ 1054{
1035 /* Touch disable */ 1055 /* Touch disable */
1036 mxt_write_object(data, 1056 mxt_write_object(data,
1037 MXT_TOUCH_MULTI, MXT_TOUCH_CTRL, 0); 1057 MXT_TOUCH_MULTI_T9, MXT_TOUCH_CTRL, 0);
1038} 1058}
1039 1059
1040static int mxt_input_open(struct input_dev *dev) 1060static int mxt_input_open(struct input_dev *dev)
@@ -1182,7 +1202,7 @@ static int mxt_resume(struct device *dev)
1182 struct input_dev *input_dev = data->input_dev; 1202 struct input_dev *input_dev = data->input_dev;
1183 1203
1184 /* Soft reset */ 1204 /* Soft reset */
1185 mxt_write_object(data, MXT_GEN_COMMAND, 1205 mxt_write_object(data, MXT_GEN_COMMAND_T6,
1186 MXT_COMMAND_RESET, 1); 1206 MXT_COMMAND_RESET, 1);
1187 1207
1188 msleep(MXT_RESET_TIME); 1208 msleep(MXT_RESET_TIME);