summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Dyer <nick.dyer@itdev.co.uk>2015-04-23 11:02:55 +0100
committerNick Dyer <nick.dyer@itdev.co.uk>2015-04-23 16:54:02 +0100
commitd9a9f129fb1a4680605dad434216f8792327ee58 (patch)
treef9322bd25d9f78629d30ff7886619abb41eb1d44
parent7c09e1314d1f64cf02a3fdaaf5bf3ef56192f244 (diff)
downloadolio-linux-3.10-d9a9f129fb1a4680605dad434216f8792327ee58.tar.xz
olio-linux-3.10-d9a9f129fb1a4680605dad434216f8792327ee58.zip
Input: atmel_mxt_ts - config CRC may start at T71
On devices with the T71 object, the config CRC will start there, rather than at T7. Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
-rw-r--r--drivers/input/touchscreen/atmel_mxt_ts.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 7ca430aa599..4987f7a650b 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -71,6 +71,7 @@
#define MXT_SPT_MESSAGECOUNT_T44 44
#define MXT_SPT_CTECONFIG_T46 46
#define MXT_PROCI_ACTIVE_STYLUS_T63 63
+#define MXT_SPT_DYNAMICCONFIGURATIONCONTAINER_T71 71
#define MXT_TOUCH_MULTITOUCHSCREEN_T100 100
#define MXT_PROCI_ACTIVESTYLUS_T107 107
@@ -290,6 +291,7 @@ struct mxt_data {
u8 T6_reportid;
u16 T6_address;
u16 T7_address;
+ u16 T71_address;
u8 T9_reportid_min;
u8 T9_reportid_max;
u8 T15_reportid_min;
@@ -359,6 +361,7 @@ static bool mxt_object_readable(unsigned int type)
case MXT_SPT_USERDATA_T38:
case MXT_SPT_DIGITIZER_T43:
case MXT_SPT_CTECONFIG_T46:
+ case MXT_SPT_DYNAMICCONFIGURATIONCONTAINER_T71:
return true;
default:
return false;
@@ -1736,6 +1739,7 @@ static int mxt_update_cfg(struct mxt_data *data, const struct firmware *cfg)
u32 info_crc, config_crc, calculated_crc;
u8 *config_mem;
size_t config_mem_size;
+ u16 crc_start = 0;
mxt_update_crc(data, MXT_COMMAND_REPORTALL, 1);
@@ -1822,20 +1826,22 @@ static int mxt_update_cfg(struct mxt_data *data, const struct firmware *cfg)
goto release_mem;
/* Calculate crc of the received configs (not the raw config file) */
- if (data->T7_address < cfg_start_ofs) {
- dev_err(dev, "Bad T7 address, T7addr = %x, config offset %x\n",
- data->T7_address, cfg_start_ofs);
- ret = 0;
- goto release_mem;
- }
+ if (data->T71_address)
+ crc_start = data->T71_address;
+ else if (data->T7_address)
+ crc_start = data->T7_address;
+ else
+ dev_warn(dev, "Could not find CRC start\n");
- calculated_crc = mxt_calculate_crc(config_mem,
- data->T7_address - cfg_start_ofs,
- config_mem_size);
+ if (crc_start > cfg_start_ofs) {
+ calculated_crc = mxt_calculate_crc(config_mem,
+ crc_start - cfg_start_ofs,
+ config_mem_size);
- if (config_crc > 0 && config_crc != calculated_crc)
- dev_warn(dev, "Config CRC error, calculated=%06X, file=%06X\n",
- calculated_crc, config_crc);
+ if (config_crc > 0 && config_crc != calculated_crc)
+ dev_warn(dev, "Config CRC in file inconsistent, calculated=%06X, file=%06X\n",
+ calculated_crc, config_crc);
+ }
ret = mxt_upload_cfg_mem(data, cfg_start_ofs,
config_mem, config_mem_size);
@@ -1899,6 +1905,7 @@ static void mxt_free_object_table(struct mxt_data *data)
data->T5_msg_size = 0;
data->T6_reportid = 0;
data->T7_address = 0;
+ data->T71_address = 0;
data->T9_reportid_min = 0;
data->T9_reportid_max = 0;
data->T15_reportid_min = 0;
@@ -1972,6 +1979,9 @@ static int mxt_parse_object_table(struct mxt_data *data,
case MXT_GEN_POWER_T7:
data->T7_address = object->start_address;
break;
+ case MXT_SPT_DYNAMICCONFIGURATIONCONTAINER_T71:
+ data->T71_address = object->start_address;
+ break;
case MXT_TOUCH_MULTI_T9:
/* Only handle messages from first T9 instance */
data->T9_reportid_min = min_id;