Commit 4b3e910d authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: edt-ft5x06 - fix error handling for factory mode on non-M06

When attempting enter factory mode on firmware that does not support it,
we'd error out, but leave the device with interrupts disabled, and thus
touch not working. Fix it by moving the check before we disable
interrupts/allocate memory for debug buffers.

Fixes: fd335ab0 ("Input: edt-ft5x06 - add support for M09 firmware version")
Reviewed-by: default avatarAndi Shyti <andi@etezian.org>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent cba04cdf
...@@ -511,6 +511,12 @@ static int edt_ft5x06_factory_mode(struct edt_ft5x06_ts_data *tsdata) ...@@ -511,6 +511,12 @@ static int edt_ft5x06_factory_mode(struct edt_ft5x06_ts_data *tsdata)
int ret; int ret;
int error; int error;
if (tsdata->version != EDT_M06) {
dev_err(&client->dev,
"No factory mode support for non-M06 devices\n");
return -EINVAL;
}
disable_irq(client->irq); disable_irq(client->irq);
if (!tsdata->raw_buffer) { if (!tsdata->raw_buffer) {
...@@ -524,9 +530,6 @@ static int edt_ft5x06_factory_mode(struct edt_ft5x06_ts_data *tsdata) ...@@ -524,9 +530,6 @@ static int edt_ft5x06_factory_mode(struct edt_ft5x06_ts_data *tsdata)
} }
/* mode register is 0x3c when in the work mode */ /* mode register is 0x3c when in the work mode */
if (tsdata->version != EDT_M06)
goto m09_out;
error = edt_ft5x06_register_write(tsdata, WORK_REGISTER_OPMODE, 0x03); error = edt_ft5x06_register_write(tsdata, WORK_REGISTER_OPMODE, 0x03);
if (error) { if (error) {
dev_err(&client->dev, dev_err(&client->dev,
...@@ -559,11 +562,6 @@ static int edt_ft5x06_factory_mode(struct edt_ft5x06_ts_data *tsdata) ...@@ -559,11 +562,6 @@ static int edt_ft5x06_factory_mode(struct edt_ft5x06_ts_data *tsdata)
enable_irq(client->irq); enable_irq(client->irq);
return error; return error;
m09_out:
dev_err(&client->dev, "No factory mode support for M09/M12/GENERIC_FT\n");
return -EINVAL;
} }
static int edt_ft5x06_work_mode(struct edt_ft5x06_ts_data *tsdata) static int edt_ft5x06_work_mode(struct edt_ft5x06_ts_data *tsdata)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment