From: Stephan Gerhold <stephan@gerhold.net> Date: 2021-01-08 19:27:09
At the moment, the edt-ft5x06 driver can control a single regulator
("vcc"). However, some FocalTech touch controllers have an additional
IOVCC pin that should be supplied with the digital I/O voltage.
The I/O voltage might be provided by another regulator that should also
be kept on. Otherwise, the touchscreen can randomly stop functioning if
the regulator is turned off because no other components still require it.
Document (optional) support for controlling the regulator for IOVCC
using "iovcc-supply".
Cc: Ondrej Jirman <redacted>
Cc: Marco Felsch <redacted>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
.../devicetree/bindings/input/touchscreen/edt-ft5x06.yaml | 1 +
1 file changed, 1 insertion(+)
@@ -56,6 +56,7 @@ properties:wakeup-source:truevcc-supply:true+iovcc-supply:truegain:description:Allows setting the sensitivity in the range from 0 to 31.
From: Stephan Gerhold <stephan@gerhold.net> Date: 2021-01-08 19:27:09
At the moment, the edt-ft5x06 driver can control a single regulator
("vcc"). However, some FocalTech touch controllers have an additional
IOVCC pin that should be supplied with the digital I/O voltage.
The I/O voltage might be provided by another regulator that should also
be kept on. Otherwise, the touchscreen can randomly stop functioning if
the regulator is turned off because no other components still require it.
Implement (optional) support for also enabling an "iovcc-supply".
IOVCC is needed whenever VCC is needed, so switch to the regulator bulk
APIs to request/enable/disable both when appropriate.
Cc: Ondrej Jirman <redacted>
Cc: Marco Felsch <redacted>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
drivers/input/touchscreen/edt-ft5x06.c | 35 ++++++++++++++------------
1 file changed, 19 insertions(+), 16 deletions(-)
@@ -1098,18 +1098,19 @@ 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;-}+tsdata->regulators[0].supply="vcc";+tsdata->regulators[1].supply="iovcc";+error=devm_regulator_bulk_get(&client->dev,+ARRAY_SIZE(tsdata->regulators),+tsdata->regulators);+if(error)+returndev_err_probe(&client->dev,error,+"failed to request regulators\n");-error=regulator_enable(tsdata->vcc);+error=regulator_bulk_enable(ARRAY_SIZE(tsdata->regulators),+tsdata->regulators);if(error<0){-dev_err(&client->dev,"failed to enable vcc: %d\n",error);+dev_err(&client->dev,"failed to enable regulators: %d\n",error);returnerror;}
@@ -1286,9 +1287,10 @@ static int __maybe_unused edt_ft5x06_ts_suspend(struct device *dev)gpiod_set_value_cansleep(reset_gpio,1);usleep_range(1000,2000);-ret=regulator_disable(tsdata->vcc);+ret=regulator_bulk_disable(ARRAY_SIZE(tsdata->regulators),+tsdata->regulators);if(ret)-dev_warn(dev,"Failed to disable vcc\n");+dev_warn(dev,"Failed to disable regulators\n");return0;}
@@ -1319,9 +1321,10 @@ static int __maybe_unused edt_ft5x06_ts_resume(struct device *dev)gpiod_set_value_cansleep(reset_gpio,1);usleep_range(5000,6000);-ret=regulator_enable(tsdata->vcc);+ret=regulator_bulk_enable(ARRAY_SIZE(tsdata->regulators),+tsdata->regulators);if(ret){-dev_err(dev,"Failed to enable vcc\n");+dev_err(dev,"Failed to enable regulators\n");returnret;}
From: Marco Felsch <hidden> Date: 2021-01-11 08:36:58
Hi Stephan,
thanks for the patch :) Please see my inline comments.
On 21-01-08 20:23, Stephan Gerhold wrote:
quoted hunk
At the moment, the edt-ft5x06 driver can control a single regulator
("vcc"). However, some FocalTech touch controllers have an additional
IOVCC pin that should be supplied with the digital I/O voltage.
The I/O voltage might be provided by another regulator that should also
be kept on. Otherwise, the touchscreen can randomly stop functioning if
the regulator is turned off because no other components still require it.
Implement (optional) support for also enabling an "iovcc-supply".
IOVCC is needed whenever VCC is needed, so switch to the regulator bulk
APIs to request/enable/disable both when appropriate.
Cc: Ondrej Jirman <redacted>
Cc: Marco Felsch <redacted>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
drivers/input/touchscreen/edt-ft5x06.c | 35 ++++++++++++++------------
1 file changed, 19 insertions(+), 16 deletions(-)
From: Stephan Gerhold <stephan@gerhold.net> Date: 2021-01-11 09:29:45
Hi Marco,
thanks for the review!
On Mon, Jan 11, 2021 at 09:36:12AM +0100, Marco Felsch wrote:
Hi Stephan,
thanks for the patch :) Please see my inline comments.
On 21-01-08 20:23, Stephan Gerhold wrote:
quoted
At the moment, the edt-ft5x06 driver can control a single regulator
("vcc"). However, some FocalTech touch controllers have an additional
IOVCC pin that should be supplied with the digital I/O voltage.
The I/O voltage might be provided by another regulator that should also
be kept on. Otherwise, the touchscreen can randomly stop functioning if
the regulator is turned off because no other components still require it.
Implement (optional) support for also enabling an "iovcc-supply".
IOVCC is needed whenever VCC is needed, so switch to the regulator bulk
APIs to request/enable/disable both when appropriate.
Cc: Ondrej Jirman <redacted>
Cc: Marco Felsch <redacted>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
drivers/input/touchscreen/edt-ft5x06.c | 35 ++++++++++++++------------
1 file changed, 19 insertions(+), 16 deletions(-)
I don't know, sadly. The datasheets I was able to find do not mention
anything about this; the power-on sequence only includes the VDD line.
I tried several suspend/resume cycles with both regulators set up and it
worked fine, which could mean that I was lucky or that the order does
not matter. :)
What do you think?
From: Marco Felsch <hidden> Date: 2021-01-11 09:46:38
On 21-01-11 10:26, Stephan Gerhold wrote:
Hi Marco,
thanks for the review!
On Mon, Jan 11, 2021 at 09:36:12AM +0100, Marco Felsch wrote:
quoted
Hi Stephan,
thanks for the patch :) Please see my inline comments.
On 21-01-08 20:23, Stephan Gerhold wrote:
quoted
At the moment, the edt-ft5x06 driver can control a single regulator
("vcc"). However, some FocalTech touch controllers have an additional
IOVCC pin that should be supplied with the digital I/O voltage.
The I/O voltage might be provided by another regulator that should also
be kept on. Otherwise, the touchscreen can randomly stop functioning if
the regulator is turned off because no other components still require it.
Implement (optional) support for also enabling an "iovcc-supply".
IOVCC is needed whenever VCC is needed, so switch to the regulator bulk
APIs to request/enable/disable both when appropriate.
Cc: Ondrej Jirman <redacted>
Cc: Marco Felsch <redacted>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
drivers/input/touchscreen/edt-ft5x06.c | 35 ++++++++++++++------------
1 file changed, 19 insertions(+), 16 deletions(-)
I don't know, sadly. The datasheets I was able to find do not mention
anything about this; the power-on sequence only includes the VDD line.
I've goolged a bit :)
Check this: https://focuslcds.com/content/FT5X26.pdf, page 12 of 32
There it is mentioned that we need to enable it first and add a 10us
delay till we can enable the vdd line. So unfortunately the bulk_api
can't be used as it is today. Another solution could be to extended the
bulk api to respect on/off delays.
Regards,
Marco
I tried several suspend/resume cycles with both regulators set up and it
worked fine, which could mean that I was lucky or that the order does
not matter. :)
What do you think?
Thanks! I looked at several datasheets, that's probably one of the few I
did not look at. :(
There it is mentioned that we need to enable it first and add a 10us
delay till we can enable the vdd line. So unfortunately the bulk_api
can't be used as it is today. Another solution could be to extended the
bulk api to respect on/off delays.
I think for two regulators like here it's still manageable to
get/enable/disable/put them separately, so I will just revert the bulk
API change in v2.
Thanks again!
Stephan
Thanks! I looked at several datasheets, that's probably one of the few I
did not look at. :(
quoted
There it is mentioned that we need to enable it first and add a 10us
delay till we can enable the vdd line. So unfortunately the bulk_api
can't be used as it is today. Another solution could be to extended the
bulk api to respect on/off delays.
I think for two regulators like here it's still manageable to
get/enable/disable/put them separately, so I will just revert the bulk
API change in v2.
While implementing this I noticed that the power-up sequence in probe()
does not quite seem right. The power-up sequence implemented by Marco in
edt_ft5x06_ts_resume() seems to match the datasheet(s) but in probe() we
enable VCC before doing anything with the reset line.
So before I add the IOVCC regulator I will try to refactor the code a
bit to make this consistent. :)
Thanks,
Stephan
From: Rob Herring <robh@kernel.org> Date: 2021-01-13 15:26:02
On Fri, 08 Jan 2021 20:23:36 +0100, Stephan Gerhold wrote:
At the moment, the edt-ft5x06 driver can control a single regulator
("vcc"). However, some FocalTech touch controllers have an additional
IOVCC pin that should be supplied with the digital I/O voltage.
The I/O voltage might be provided by another regulator that should also
be kept on. Otherwise, the touchscreen can randomly stop functioning if
the regulator is turned off because no other components still require it.
Document (optional) support for controlling the regulator for IOVCC
using "iovcc-supply".
Cc: Ondrej Jirman <redacted>
Cc: Marco Felsch <redacted>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
.../devicetree/bindings/input/touchscreen/edt-ft5x06.yaml | 1 +
1 file changed, 1 insertion(+)