aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen
diff options
context:
space:
mode:
authorDaniel Kurtz <djkurtz@chromium.org>2012-06-28 09:08:24 -0400
committerHenrik Rydberg <rydberg@euromail.se>2012-06-29 09:58:07 -0400
commitfdf804210f297b7a114fa7a216c2ab65b0f693da (patch)
tree40a167a3f0b51713d4c4a7df305c0e4f013f9707 /drivers/input/touchscreen
parent64464ae8e1d64fc9f63d9686d5e40b56ffa77203 (diff)
Input: atmel_mxt_ts - parse T6 reports
The normal messages sent after boot or NVRAM update are T6 reports, containing a status, and the config memory checksum. Parse them and dump a useful info message. This patch tested on an MXT224E. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r--drivers/input/touchscreen/atmel_mxt_ts.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 4c9a06c7eae3..37190ab1f817 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -248,6 +248,7 @@ struct mxt_data {
248 unsigned int max_y; 248 unsigned int max_y;
249 249
250 /* Cached parameters from object table */ 250 /* Cached parameters from object table */
251 u8 T6_reportid;
251 u8 T9_reportid_min; 252 u8 T9_reportid_min;
252 u8 T9_reportid_max; 253 u8 T9_reportid_max;
253}; 254};
@@ -549,6 +550,11 @@ static void mxt_input_touchevent(struct mxt_data *data,
549 } 550 }
550} 551}
551 552
553static unsigned mxt_extract_T6_csum(const u8 *csum)
554{
555 return csum[0] | (csum[1] << 8) | (csum[2] << 16);
556}
557
552static bool mxt_is_T9_message(struct mxt_data *data, struct mxt_message *msg) 558static bool mxt_is_T9_message(struct mxt_data *data, struct mxt_message *msg)
553{ 559{
554 u8 id = msg->reportid; 560 u8 id = msg->reportid;
@@ -559,8 +565,8 @@ static irqreturn_t mxt_interrupt(int irq, void *dev_id)
559{ 565{
560 struct mxt_data *data = dev_id; 566 struct mxt_data *data = dev_id;
561 struct mxt_message message; 567 struct mxt_message message;
568 const u8 *payload = &message.message[0];
562 struct device *dev = &data->client->dev; 569 struct device *dev = &data->client->dev;
563 int id;
564 u8 reportid; 570 u8 reportid;
565 bool update_input = false; 571 bool update_input = false;
566 572
@@ -572,9 +578,13 @@ static irqreturn_t mxt_interrupt(int irq, void *dev_id)
572 578
573 reportid = message.reportid; 579 reportid = message.reportid;
574 580
575 id = reportid - data->T9_reportid_min; 581 if (reportid == data->T6_reportid) {
576 582 u8 status = payload[0];
577 if (mxt_is_T9_message(data, &message)) { 583 unsigned csum = mxt_extract_T6_csum(&payload[1]);
584 dev_dbg(dev, "Status: %02x Config Checksum: %06x\n",
585 status, csum);
586 } else if (mxt_is_T9_message(data, &message)) {
587 int id = reportid - data->T9_reportid_min;
578 mxt_input_touchevent(data, &message, id); 588 mxt_input_touchevent(data, &message, id);
579 update_input = true; 589 update_input = true;
580 } else { 590 } else {
@@ -749,6 +759,9 @@ static int mxt_get_object_table(struct mxt_data *data)
749 object->instances + 1, min_id, max_id); 759 object->instances + 1, min_id, max_id);
750 760
751 switch (object->type) { 761 switch (object->type) {
762 case MXT_GEN_COMMAND_T6:
763 data->T6_reportid = min_id;
764 break;
752 case MXT_TOUCH_MULTI_T9: 765 case MXT_TOUCH_MULTI_T9:
753 data->T9_reportid_min = min_id; 766 data->T9_reportid_min = min_id;
754 data->T9_reportid_max = max_id; 767 data->T9_reportid_max = max_id;
@@ -763,8 +776,10 @@ static void mxt_free_object_table(struct mxt_data *data)
763{ 776{
764 kfree(data->object_table); 777 kfree(data->object_table);
765 data->object_table = NULL; 778 data->object_table = NULL;
779 data->T6_reportid = 0;
766 data->T9_reportid_min = 0; 780 data->T9_reportid_min = 0;
767 data->T9_reportid_max = 0; 781 data->T9_reportid_max = 0;
782
768} 783}
769 784
770static int mxt_initialize(struct mxt_data *data) 785static int mxt_initialize(struct mxt_data *data)