From 83a7bd267534e34b74493c7f1021606519d66ac0 Mon Sep 17 00:00:00 2001 From: Fei Mao Date: Wed, 2 Sep 2020 18:32:44 +0800 Subject: [PATCH 1/2] input: touchscreen: mxt: configure proper sleep state Configure proper sleep state and touch works correctly when device resume. Change-Id: I06fc1dfd281cfa297fb8698a5b350aa062d603b2 Signed-off-by: Fei Mao --- drivers/input/touchscreen/atmel_mxt_ts.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 9f08da6ad679..9b980ba78e57 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -3575,8 +3575,12 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) init_completion(&data->reset_completion); init_completion(&data->crc_completion); +#if defined(CONFIG_OF) && defined(CONFIG_DRM) + data->suspend_mode = MXT_SUSPEND_T9_CTRL; +#else data->suspend_mode = dmi_check_system(chromebook_T9_suspend_dmi) ? MXT_SUSPEND_T9_CTRL : MXT_SUSPEND_DEEP_SLEEP; +#endif error = mxt_parse_device_properties(data); if (error) From 6a44a5799f4526172f0aa261bced92b1247b81c1 Mon Sep 17 00:00:00 2001 From: Fei Mao Date: Mon, 7 Sep 2020 20:22:44 +0800 Subject: [PATCH 2/2] input: touchscreen: mxt: reset IC before read again After touch read is failed, reset touch IC and enable irq before try to read by I2C once again. Change-Id: I755ab9e41dcc953665f21df01ea03fe0f89b958d Signed-off-by: Fei Mao --- drivers/input/touchscreen/atmel_mxt_ts.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 9b980ba78e57..d8a90eaf7695 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -1279,7 +1279,7 @@ static int mxt_soft_reset(struct mxt_data *data) struct device *dev = &data->client->dev; int ret = 0; - dev_info(dev, "Resetting device\n"); + dev_dbg(dev, "Resetting device\n"); disable_irq(data->irq); @@ -2088,7 +2088,7 @@ static int mxt_regulator_configure(struct mxt_data *data, bool state) prop = of_find_property(np, "xvdd-supply", NULL); if (prop && (error == -EPROBE_DEFER)) return -EPROBE_DEFER; - dev_info(dev, "xvdd regulator is not used\n"); + dev_dbg(dev, "xvdd regulator is not used\n"); } else { if (regulator_count_voltages(data->reg_xvdd) > 0) { error = regulator_set_voltage(data->reg_xvdd, @@ -2446,6 +2446,7 @@ static int mxt_initialize(struct mxt_data *data) error = mxt_probe_bootloader(data, false); if (error) { dev_info(&client->dev, "Trying alternate bootloader address\n"); + mxt_soft_reset(data); error = mxt_probe_bootloader(data, true); if (error) { /* Chip is not in appmode or bootloader mode */ @@ -2992,6 +2993,7 @@ static int mxt_configure_objects(struct mxt_data *data, mxt_debug_init(data); + enable_irq(data->irq); return 0; } @@ -3586,6 +3588,10 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) if (error) return error; + error = mxt_pinctrl_init(data); + if (error) + dev_info(&client->dev, "No pinctrl support\n"); + data->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_LOW); data->irq_gpio = devm_gpiod_get_optional(&client->dev, @@ -3627,9 +3633,6 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) gpiod_set_value(data->reset_gpio, 1); msleep(MXT_RESET_INVALID_CHG); } - error = mxt_pinctrl_init(data); - if (error) - dev_info(&client->dev, "No pinctrl support\n"); error = mxt_gpio_enable(data, true); if (error)