Commit fdf804210f297b7a114fa7a216c2ab65b0f693da

Authored by Daniel Kurtz
Committed by Henrik Rydberg
1 parent 64464ae8e1

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>

Showing 1 changed file with 19 additions and 4 deletions Side-by-side Diff

drivers/input/touchscreen/atmel_mxt_ts.c
... ... @@ -248,6 +248,7 @@
248 248 unsigned int max_y;
249 249  
250 250 /* Cached parameters from object table */
  251 + u8 T6_reportid;
251 252 u8 T9_reportid_min;
252 253 u8 T9_reportid_max;
253 254 };
... ... @@ -549,6 +550,11 @@
549 550 }
550 551 }
551 552  
  553 +static unsigned mxt_extract_T6_csum(const u8 *csum)
  554 +{
  555 + return csum[0] | (csum[1] << 8) | (csum[2] << 16);
  556 +}
  557 +
552 558 static bool mxt_is_T9_message(struct mxt_data *data, struct mxt_message *msg)
553 559 {
554 560 u8 id = msg->reportid;
555 561  
... ... @@ -559,8 +565,8 @@
559 565 {
560 566 struct mxt_data *data = dev_id;
561 567 struct mxt_message message;
  568 + const u8 *payload = &message.message[0];
562 569 struct device *dev = &data->client->dev;
563   - int id;
564 570 u8 reportid;
565 571 bool update_input = false;
566 572  
... ... @@ -572,9 +578,13 @@
572 578  
573 579 reportid = message.reportid;
574 580  
575   - id = reportid - data->T9_reportid_min;
576   -
577   - if (mxt_is_T9_message(data, &message)) {
  581 + if (reportid == data->T6_reportid) {
  582 + u8 status = payload[0];
  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 588 mxt_input_touchevent(data, &message, id);
579 589 update_input = true;
580 590 } else {
... ... @@ -749,6 +759,9 @@
749 759 object->instances + 1, min_id, max_id);
750 760  
751 761 switch (object->type) {
  762 + case MXT_GEN_COMMAND_T6:
  763 + data->T6_reportid = min_id;
  764 + break;
752 765 case MXT_TOUCH_MULTI_T9:
753 766 data->T9_reportid_min = min_id;
754 767 data->T9_reportid_max = max_id;
755 768  
... ... @@ -763,8 +776,10 @@
763 776 {
764 777 kfree(data->object_table);
765 778 data->object_table = NULL;
  779 + data->T6_reportid = 0;
766 780 data->T9_reportid_min = 0;
767 781 data->T9_reportid_max = 0;
  782 +
768 783 }
769 784  
770 785 static int mxt_initialize(struct mxt_data *data)