Hello everyone,
This is a V4 of the patch series that adds touchscreen support
(FocalTech EDT-FT5x06 Polytouch) for TBS A711 (Allwinner sun8i-a83t SoC)
and add regulator support for this touchscreen.
Based on last master of linux-input tree.
Changes since v3:
- Created a new function to disable regulator via
devm_add_action_or_reset (Dmitry Torokhov's review)
- Moved regulator_enable/disable functions in device_may_wakeup
guard (Ondřej Jirman and Dmitry Torokhov's reviews)
- Added Rob Herring Reviewed-by on patch 01 (sorry again)
Changes since v2:
- Removed the check if regulator is NULL (Dmitry Torokhov's review)
- Added EPROBE_DEFER error not to print a error message (Lothar Waßmann's review)
- Added set wake/reset on suspend/resume.
Changes since v1:
- Removed patches 01 and 02 as Chen-Yu Tsai sent a similar patch:
https://patchwork.kernel.org/patch/10111431/
and it is merged on last next-20171222.
(See commit f066f46ce5a5 "ARM: dts: sun8i: a83t: Add I2C device nodes and pinmux settings")
- Updated regulator according to Dmitry Torokhov's review: removed "optional"
suffix while retrieving the regulator, renamed it into "vcc" instead of
"power" and added bindings documentation.
- Updated device tree according to Maxime Ripard's review: remove the
label and rename the node.
- Squashed patch 03 with patch 05 to add I2C0 and touchscreen's node
in one patch (see patch 02).
Patch 01: Add support for regulator in the FocalTech touchscreen driver
because A711 tablet is using a regulator to power-up the touchscreen.
Patch 02: Add a set wake/reset values on resume and suspend.
Patch 03: Add i2c0 and touchscreen's node for A711 TBS tablet.
Thank you in advance for any review.
Best regards,
Mylène
Mylène Josserand (3):
Input: edt-ft5x06 - Add support for regulator
Input: edt-ft5x06 - Set wake/reset values on resume/suspend
arm: dts: sun8i: a83t: a711: Add touchscreen node
.../bindings/input/touchscreen/edt-ft5x06.txt | 1 +
arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts | 16 +++++++
drivers/input/touchscreen/edt-ft5x06.c | 55 ++++++++++++++++++++++
3 files changed, 72 insertions(+)
--
2.11.0
Add the support of regulator to use it as VCC source.
Signed-off-by: Mylène Josserand <redacted>
Reviewed-by: Rob Herring <robh@kernel.org>
---
.../bindings/input/touchscreen/edt-ft5x06.txt | 1 +
drivers/input/touchscreen/edt-ft5x06.c | 43 ++++++++++++++++++++++
2 files changed, 44 insertions(+)
@@ -30,6 +30,7 @@ Required properties: Optional properties: - reset-gpios: GPIO specification for the RESET input - wake-gpios: GPIO specification for the WAKE input+ - vcc-supply: Regulator that supplies the touchscreen - pinctrl-names: should be "default" - pinctrl-0: a phandle pointing to the pin settings for the
Hi Mylène,
On Wed, Jul 25, 2018 at 09:34:08AM +0200, Mylène Josserand wrote:
quoted hunk
Add the support of regulator to use it as VCC source.
Signed-off-by: Mylène Josserand <redacted>
Reviewed-by: Rob Herring <robh@kernel.org>
---
.../bindings/input/touchscreen/edt-ft5x06.txt | 1 +
drivers/input/touchscreen/edt-ft5x06.c | 43 ++++++++++++++++++++++
2 files changed, 44 insertions(+)
@@ -30,6 +30,7 @@ Required properties: Optional properties: - reset-gpios: GPIO specification for the RESET input - wake-gpios: GPIO specification for the WAKE input+ - vcc-supply: Regulator that supplies the touchscreen - pinctrl-names: should be "default" - pinctrl-0: a phandle pointing to the pin settings for the
@@ -991,6 +1000,28 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,tsdata->max_support_points=chip_data->max_support_points;+tsdata->vcc=devm_regulator_get(&client->dev,"vcc");+if(IS_ERR(tsdata->vcc)){+error=PTR_ERR(tsdata->vcc);+if(error!=-EPROBE_DEFER)+dev_err(&client->dev,"failed to request regulator: %d\n",+error);+returnerror;+}++error=regulator_enable(tsdata->vcc);+if(error<0){+dev_err(&client->dev,"failed to enable vcc: %d\n",+error);+returnerror;+}
It is better to put the chip into reset and then power up the regulatori
and take it out of the reset, rather than power up and then toggle reset
on and off.
@@ -1130,9 +1164,18 @@ static int __maybe_unused edt_ft5x06_ts_suspend(struct device *dev) static int __maybe_unused edt_ft5x06_ts_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev);+ struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client);+ int ret; if (device_may_wakeup(dev)) disable_irq_wake(client->irq);+ else {+ ret = regulator_enable(tsdata->vcc);+ if (ret < 0) {+ dev_err(dev, "failed to enable vcc: %d\n", ret);+ return ret;+ }+ }
I believe I mentioned in other review that once you powered up the
device, you need to restore its settings, include switching to factory
mode, if it was in factory mode, and restoring threshold/gain/offset
settings.
Thanks.
--
Dmitry
Hello Dmitry,
Thank you again for the review.
On Wed, 25 Jul 2018 17:47:32 -0700
Dmitry Torokhov [off-list ref] wrote:
Hi Mylène,
On Wed, Jul 25, 2018 at 09:34:08AM +0200, Mylène Josserand wrote:
quoted
Add the support of regulator to use it as VCC source.
Signed-off-by: Mylène Josserand <redacted>
Reviewed-by: Rob Herring <robh@kernel.org>
---
.../bindings/input/touchscreen/edt-ft5x06.txt | 1 +
drivers/input/touchscreen/edt-ft5x06.c | 43 ++++++++++++++++++++++
2 files changed, 44 insertions(+)
@@ -30,6 +30,7 @@ Required properties: Optional properties: - reset-gpios: GPIO specification for the RESET input - wake-gpios: GPIO specification for the WAKE input+ - vcc-supply: Regulator that supplies the touchscreen - pinctrl-names: should be "default" - pinctrl-0: a phandle pointing to the pin settings for the
@@ -991,6 +1000,28 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,tsdata->max_support_points=chip_data->max_support_points;+tsdata->vcc=devm_regulator_get(&client->dev,"vcc");+if(IS_ERR(tsdata->vcc)){+error=PTR_ERR(tsdata->vcc);+if(error!=-EPROBE_DEFER)+dev_err(&client->dev,"failed to request regulator: %d\n",+error);+returnerror;+}++error=regulator_enable(tsdata->vcc);+if(error<0){+dev_err(&client->dev,"failed to enable vcc: %d\n",+error);+returnerror;+}
It is better to put the chip into reset and then power up the regulatori
and take it out of the reset, rather than power up and then toggle reset
on and off.
@@ -1130,9 +1164,18 @@ static int __maybe_unused edt_ft5x06_ts_suspend(struct device *dev) static int __maybe_unused edt_ft5x06_ts_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev);+ struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client);+ int ret; if (device_may_wakeup(dev)) disable_irq_wake(client->irq);+ else {+ ret = regulator_enable(tsdata->vcc);+ if (ret < 0) {+ dev_err(dev, "failed to enable vcc: %d\n", ret);+ return ret;+ }+ }
I believe I mentioned in other review that once you powered up the
device, you need to restore its settings, include switching to factory
mode, if it was in factory mode, and restoring threshold/gain/offset
settings.
Yes, I will update the driver with that but as I told you in a previous
mail, I can't test the suspend/resume :(
Best regards,
--
Mylène Josserand, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
On Tue, Aug 07, 2018 at 08:59:44AM +0200, Mylène Josserand wrote:
Hello Dmitry,
Thank you again for the review.
On Wed, 25 Jul 2018 17:47:32 -0700
Dmitry Torokhov [off-list ref] wrote:
quoted
Hi Mylène,
On Wed, Jul 25, 2018 at 09:34:08AM +0200, Mylène Josserand wrote:
quoted
Add the support of regulator to use it as VCC source.
Signed-off-by: Mylène Josserand <redacted>
Reviewed-by: Rob Herring <robh@kernel.org>
---
.../bindings/input/touchscreen/edt-ft5x06.txt | 1 +
drivers/input/touchscreen/edt-ft5x06.c | 43 ++++++++++++++++++++++
2 files changed, 44 insertions(+)
@@ -30,6 +30,7 @@ Required properties: Optional properties: - reset-gpios: GPIO specification for the RESET input - wake-gpios: GPIO specification for the WAKE input+ - vcc-supply: Regulator that supplies the touchscreen - pinctrl-names: should be "default" - pinctrl-0: a phandle pointing to the pin settings for the
@@ -991,6 +1000,28 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,tsdata->max_support_points=chip_data->max_support_points;+tsdata->vcc=devm_regulator_get(&client->dev,"vcc");+if(IS_ERR(tsdata->vcc)){+error=PTR_ERR(tsdata->vcc);+if(error!=-EPROBE_DEFER)+dev_err(&client->dev,"failed to request regulator: %d\n",+error);+returnerror;+}++error=regulator_enable(tsdata->vcc);+if(error<0){+dev_err(&client->dev,"failed to enable vcc: %d\n",+error);+returnerror;+}
It is better to put the chip into reset and then power up the regulatori
and take it out of the reset, rather than power up and then toggle reset
on and off.
@@ -1130,9 +1164,18 @@ static int __maybe_unused edt_ft5x06_ts_suspend(struct device *dev) static int __maybe_unused edt_ft5x06_ts_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev);+ struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client);+ int ret; if (device_may_wakeup(dev)) disable_irq_wake(client->irq);+ else {+ ret = regulator_enable(tsdata->vcc);+ if (ret < 0) {+ dev_err(dev, "failed to enable vcc: %d\n", ret);+ return ret;+ }+ }
I believe I mentioned in other review that once you powered up the
device, you need to restore its settings, include switching to factory
mode, if it was in factory mode, and restoring threshold/gain/offset
settings.
Yes, I will update the driver with that but as I told you in a previous
mail, I can't test the suspend/resume :(
I wonder if Simon or Lothar or Franklin could help us with it (CCed). If
not, then we'll have to go by review only.
Thanks.
--
Dmitry
Tha A711 tablet has a FocalTech EDT-FT5x06 Polytouch touchscreen.
It is connected via I2C0. The reset line is PD5, the interrupt
line is PL7 and the VCC supply is the ldo_io0 regulator.
Signed-off-by: Mylène Josserand <redacted>
---
arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
On resume and suspend, set the value of wake and reset gpios
to be sure that we are in a know state after suspending/resuming.
Signed-off-by: Mylène Josserand <redacted>
---
drivers/input/touchscreen/edt-ft5x06.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
Hi Mylène,
On Wed, Jul 25, 2018 at 09:34:09AM +0200, Mylène Josserand wrote:
quoted hunk
On resume and suspend, set the value of wake and reset gpios
to be sure that we are in a know state after suspending/resuming.
Signed-off-by: Mylène Josserand <redacted>
---
drivers/input/touchscreen/edt-ft5x06.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
@@ -1158,6 +1158,12 @@ static int __maybe_unused edt_ft5x06_ts_suspend(struct device *dev)elseregulator_disable(tsdata->vcc);+if(tsdata->wake_gpio)+gpiod_set_value(tsdata->wake_gpio,0);++if(tsdata->reset_gpio)+gpiod_set_value(tsdata->reset_gpio,1);
Ondřej mentioned in previous review that if you power off the controller
it will not be able to wake up the system, and you had to move call to
regulator_disable() into "else" branch of check whether the controller
is a wakeup device. Guess what happens if you unconditionally put the
device into reset state?
Thanks.
--
Dmitry