Re: [PATCH 3/7] input: atmel_mxt_ts: check mxt224 family before writing touchscreen voltage
From: Benson Leung <bleung@chromium.org>
Date: 2013-02-20 17:52:14
Hi Peter, Is the problem that the 224e is missing T28 object? This change seems extremely 224/224e specific. This driver, however, supports Atmel touch devices that are neither 224 or 224e, many have the SPT_CTECONFIG_T28 object. The driver does read out a supported object table from the device during initialize before handle_pdata. What sort of problem is there in trying to write the voltage to a non existent T28 object? If the object is missing, then mxt_write_object for voltage should simply return -EINVAL, and no harm should be done. On Thu, Feb 7, 2013 at 6:17 AM, Peter Meerwald [off-list ref] wrote:
quoted hunk ↗ jump to hunk
From: Peter Meerwald <redacted> only the mxt224 has a SPT_CTECONFIG_T28 object, the mxt224e doesn't Signed-off-by: Peter Meerwald <redacted> --- drivers/input/touchscreen/atmel_mxt_ts.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 63a82bb..17cc15a 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c@@ -41,6 +41,10 @@ #define MXT_OBJECT_NUM 0x06 #define MXT_OBJECT_START 0x07 +/* Family IDs */ +#define MXT224_ID 0x80 +#define MXT224E_ID 0x81 + #define MXT_OBJECT_SIZE 6 /* Object types */@@ -687,7 +691,7 @@ static void mxt_handle_pdata(struct mxt_data *data) MXT_TOUCH_YRANGE_MSB, (pdata->y_size - 1) >> 8); /* Set touchscreen voltage */ - if (pdata->voltage) { + if (pdata->voltage && data->info.family_id == MXT224_ID) {
As an alternative, could you not check for the existence of the voltage object in the table here using mxt_get_object rather than specifically switching on family ID number?
if (pdata->voltage < MXT_VOLTAGE_DEFAULT) {
voltage = (MXT_VOLTAGE_DEFAULT - pdata->voltage) /
MXT_VOLTAGE_STEP;
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.htmlThanks. -- Benson Leung Software Engineer, Chrom* OS bleung@chromium.org