@@ -118,6 +118,7 @@ struct t9_range {
/* MXT_SPT_COMMSCONFIG_T18 */
#define MXT_COMMS_CTRL 0
#define MXT_COMMS_CMD 1
+#define MXT_COMMS_RETRIGEN (1 << 6)
/* Define for MXT_GEN_COMMAND_T6 */
#define MXT_BOOT_VALUE 0xa5
@@ -213,6 +214,7 @@ struct mxt_data {
u8 num_touchids;
u8 num_stylusids;
unsigned long t15_keystatus;
+ bool use_retrigen_workaround;
/* Cached parameters from object table */
u16 T5_address;
@@ -224,6 +226,7 @@ struct mxt_data {
u8 T9_reportid_max;
u8 T15_reportid_min;
u8 T15_reportid_max;
+ u16 T18_address;
u8 T19_reportid;
u8 T42_reportid_min;
u8 T42_reportid_max;
@@ -1181,6 +1184,31 @@ static u32 mxt_calculate_crc(u8 *base, off_t start_off, off_t end_off)
return crc;
}
+static int mxt_check_retrigen(struct mxt_data *data)
+{
+ struct i2c_client *client = data->client;
+ int error;
+ int val;
+
+ if (data->pdata->irqflags & IRQF_TRIGGER_LOW)
+ return 0;
+
+ if (data->T18_address) {
+ error = __mxt_read_reg(client,
+ data->T18_address + MXT_COMMS_CTRL,
+ 1, &val);
+ if (error)
+ return error;
+
+ if (val & MXT_COMMS_RETRIGEN)
+ return 0;
+ }
+
+ dev_warn(&client->dev, "Enabling RETRIGEN workaround\n");
+ data->use_retrigen_workaround = true;
+ return 0;
+}
+
/*
* mxt_check_reg_init - download configuration to chip
*
@@ -1430,6 +1458,10 @@ static int mxt_check_reg_init(struct mxt_data *data)
mxt_update_crc(data, MXT_COMMAND_BACKUPNV, MXT_BACKUP_VALUE);
+ ret = mxt_check_retrigen(data);
+ if (ret)
+ goto release_mem;
+
ret = mxt_soft_reset(data);
if (ret)
goto release_mem;
@@ -1504,9 +1536,11 @@ static int mxt_acquire_irq(struct mxt_data *data)
enable_irq(data->irq);
- error = mxt_process_messages_until_invalid(data);
- if (error)
- return error;
+ if (data->use_retrigen_workaround) {
+ error = mxt_process_messages_until_invalid(data);
+ if (error)
+ return error;
+ }
return 0;
}
@@ -1528,6 +1562,7 @@ static void mxt_free_object_table(struct mxt_data *data)
data->T9_reportid_max = 0;
data->T15_reportid_min = 0;
data->T15_reportid_max = 0;
+ data->T18_address = 0;
data->T19_reportid = 0;
data->T42_reportid_min = 0;
data->T42_reportid_max = 0;
@@ -1598,6 +1633,9 @@ static int mxt_parse_object_table(struct mxt_data *data)
data->T15_reportid_min = min_id;
data->T15_reportid_max = max_id;
break;
+ case MXT_SPT_COMMSCONFIG_T18:
+ data->T18_address = object->start_address;
+ break;
case MXT_PROCI_TOUCHSUPPRESSION_T42:
data->T42_reportid_min = min_id;
data->T42_reportid_max = max_id;
@@ -1820,6 +1858,10 @@ retry_bootloader:
}
}
+ error = mxt_check_retrigen(data);
+ if (error)
+ goto err_free_object_table;
+
error = mxt_acquire_irq(data);
if (error)
goto err_free_object_table;