2019-10-29 07:12:03

by Ondřej Jirman

[permalink] [raw]
Subject: [PATCH 0/3] Add touchscreen support for TBS A711 Tablet

This is a resurrection of https://lkml.org/lkml/2018/7/25/143

Compared to v4 of Mylène's series I've dropped all attempts to
power off the chip during suspend. This patch just enables the
regulator during probe and disables it on driver rmmod.

I've tested the driver with suspend/resume and touching the
panel resumes my soc.

Please take a look.

thank you and regards,
Ondrej Jirman


Changes since v4 of Mylène's series:
- slight whitespace improvements
- drop all modifications of suspend/resume hooks
- drop useless header include
- split the dt-bindings into a separate patch

Mylène Josserand (2):
input: edt-ft5x06: Add support for regulator
arm: dts: sun8i: a83t: a711: Add touchscreen node

Ondrej Jirman (1):
dt-bindings: input: edt-ft5x06: Add regulator support

.../bindings/input/touchscreen/edt-ft5x06.txt | 1 +
arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts | 16 ++++++++++
drivers/input/touchscreen/edt-ft5x06.c | 30 +++++++++++++++++++
3 files changed, 47 insertions(+)

--
2.23.0


2019-10-29 07:24:50

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH 0/3] Add touchscreen support for TBS A711 Tablet

On Tue, Oct 29, 2019 at 01:58:03AM +0100, Ondrej Jirman wrote:
> This is a resurrection of https://lkml.org/lkml/2018/7/25/143
>
> Compared to v4 of Myl?ne's series I've dropped all attempts to
> power off the chip during suspend. This patch just enables the
> regulator during probe and disables it on driver rmmod.
>
> I've tested the driver with suspend/resume and touching the
> panel resumes my soc.

OK, I guess we can revisit when someone really needs power savings in
suspend...

I folded bindings into the driver change and applied, dts changes should
go through respective tree.

Thanks.

--
Dmitry

2019-10-29 09:19:55

by Ondřej Jirman

[permalink] [raw]
Subject: [PATCH 3/3] arm: dts: sun8i: a83t: a711: Add touchscreen node

From: Mylène Josserand <[email protected]>

Enable a FocalTech EDT-FT5x06 Polytouch touchscreen.

Signed-off-by: Ondrej Jirman <[email protected]>
Signed-off-by: Mylène Josserand <[email protected]>
---
arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
index 568b90ece342..19f520252dc5 100644
--- a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
+++ b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
@@ -164,6 +164,22 @@
status = "okay";
};

+&i2c0 {
+ clock-frequency = <400000>;
+ status = "okay";
+
+ touchscreen@38 {
+ compatible = "edt,edt-ft5x06";
+ reg = <0x38>;
+ interrupt-parent = <&r_pio>;
+ interrupts = <0 7 IRQ_TYPE_EDGE_FALLING>; /* PL7 */
+ reset-gpios = <&pio 3 5 GPIO_ACTIVE_LOW>; /* PD5 */
+ vcc-supply = <&reg_ldo_io0>;
+ touchscreen-size-x = <1024>;
+ touchscreen-size-y = <600>;
+ };
+};
+
&i2c1 {
clock-frequency = <400000>;
status = "okay";
--
2.23.0

2019-10-29 09:19:57

by Ondřej Jirman

[permalink] [raw]
Subject: [PATCH 1/3] input: edt-ft5x06: Add support for regulator

From: Mylène Josserand <[email protected]>

Add the support for enabling optional regulator that may be used as VCC
source.

Signed-off-by: Ondrej Jirman <[email protected]>
Signed-off-by: Mylène Josserand <[email protected]>
---
drivers/input/touchscreen/edt-ft5x06.c | 30 ++++++++++++++++++++++++++
1 file changed, 30 insertions(+)

diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index 5525f1fb1526..d61731c0037d 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -28,6 +28,7 @@
#include <linux/input/mt.h>
#include <linux/input/touchscreen.h>
#include <asm/unaligned.h>
+#include <linux/regulator/consumer.h>

#define WORK_REGISTER_THRESHOLD 0x00
#define WORK_REGISTER_REPORT_RATE 0x08
@@ -88,6 +89,7 @@ struct edt_ft5x06_ts_data {
struct touchscreen_properties prop;
u16 num_x;
u16 num_y;
+ struct regulator *vcc;

struct gpio_desc *reset_gpio;
struct gpio_desc *wake_gpio;
@@ -1036,6 +1038,13 @@ edt_ft5x06_ts_set_regs(struct edt_ft5x06_ts_data *tsdata)
}
}

+static void edt_ft5x06_disable_regulator(void *arg)
+{
+ struct edt_ft5x06_ts_data *data = arg;
+
+ regulator_disable(data->vcc);
+}
+
static int edt_ft5x06_ts_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
@@ -1064,6 +1073,27 @@ 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);
+ return error;
+ }
+
+ error = regulator_enable(tsdata->vcc);
+ if (error < 0) {
+ dev_err(&client->dev, "failed to enable vcc: %d\n", error);
+ return error;
+ }
+
+ error = devm_add_action_or_reset(&client->dev,
+ edt_ft5x06_disable_regulator,
+ tsdata);
+ if (error)
+ return error;
+
tsdata->reset_gpio = devm_gpiod_get_optional(&client->dev,
"reset", GPIOD_OUT_HIGH);
if (IS_ERR(tsdata->reset_gpio)) {
--
2.23.0

2019-10-29 10:06:01

by Maxime Ripard

[permalink] [raw]
Subject: Re: [PATCH 3/3] arm: dts: sun8i: a83t: a711: Add touchscreen node

On Tue, Oct 29, 2019 at 01:58:06AM +0100, Ondrej Jirman wrote:
> From: Myl?ne Josserand <[email protected]>
>
> Enable a FocalTech EDT-FT5x06 Polytouch touchscreen.
>
> Signed-off-by: Ondrej Jirman <[email protected]>
> Signed-off-by: Myl?ne Josserand <[email protected]>

Applied, thanks


Attachments:
(No filename) (320.00 B)
signature.asc (235.00 B)
Download all attachments

2019-10-29 10:18:41

by Marco Felsch

[permalink] [raw]
Subject: Re: [PATCH 3/3] arm: dts: sun8i: a83t: a711: Add touchscreen node

Hi,

On 19-10-29 01:58, Ondrej Jirman wrote:
> From: Myl?ne Josserand <[email protected]>
>
> Enable a FocalTech EDT-FT5x06 Polytouch touchscreen.
>
> Signed-off-by: Ondrej Jirman <[email protected]>
> Signed-off-by: Myl?ne Josserand <[email protected]>
> ---
> arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
> index 568b90ece342..19f520252dc5 100644
> --- a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
> +++ b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
> @@ -164,6 +164,22 @@
> status = "okay";
> };
>
> +&i2c0 {
> + clock-frequency = <400000>;
> + status = "okay";
> +
> + touchscreen@38 {
> + compatible = "edt,edt-ft5x06";
> + reg = <0x38>;
> + interrupt-parent = <&r_pio>;
> + interrupts = <0 7 IRQ_TYPE_EDGE_FALLING>; /* PL7 */
> + reset-gpios = <&pio 3 5 GPIO_ACTIVE_LOW>; /* PD5 */
> + vcc-supply = <&reg_ldo_io0>;
> + touchscreen-size-x = <1024>;
> + touchscreen-size-y = <600>;

Do you want this touchscreen as wakeup-src? If so please add the
property here. I've send patches converting the driver from the default
behaviour: https://patchwork.kernel.org/cover/11149039/ and all agreed
to break backward compatibility.

Regards,
Marco

> + };
> +};
> +
> &i2c1 {
> clock-frequency = <400000>;
> status = "okay";
> --
> 2.23.0
>
>

--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |

2019-10-29 11:20:11

by Ondřej Jirman

[permalink] [raw]
Subject: Re: [PATCH 3/3] arm: dts: sun8i: a83t: a711: Add touchscreen node

Hello Marco,

On Tue, Oct 29, 2019 at 10:08:01AM +0100, Marco Felsch wrote:
> Hi,
>
> On 19-10-29 01:58, Ondrej Jirman wrote:
> > From: Myl?ne Josserand <[email protected]>
> >
> > Enable a FocalTech EDT-FT5x06 Polytouch touchscreen.
> >
> > Signed-off-by: Ondrej Jirman <[email protected]>
> > Signed-off-by: Myl?ne Josserand <[email protected]>
> > ---
> > arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts | 16 ++++++++++++++++
> > 1 file changed, 16 insertions(+)
> >
> > diff --git a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
> > index 568b90ece342..19f520252dc5 100644
> > --- a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
> > +++ b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
> > @@ -164,6 +164,22 @@
> > status = "okay";
> > };
> >
> > +&i2c0 {
> > + clock-frequency = <400000>;
> > + status = "okay";
> > +
> > + touchscreen@38 {
> > + compatible = "edt,edt-ft5x06";
> > + reg = <0x38>;
> > + interrupt-parent = <&r_pio>;
> > + interrupts = <0 7 IRQ_TYPE_EDGE_FALLING>; /* PL7 */
> > + reset-gpios = <&pio 3 5 GPIO_ACTIVE_LOW>; /* PD5 */
> > + vcc-supply = <&reg_ldo_io0>;
> > + touchscreen-size-x = <1024>;
> > + touchscreen-size-y = <600>;
>
> Do you want this touchscreen as wakeup-src? If so please add the
> property here. I've send patches converting the driver from the default
> behaviour: https://patchwork.kernel.org/cover/11149039/ and all agreed
> to break backward compatibility.

Not at this moment, thank you.

regards,
o.

> Regards,
> Marco
>
> > + };
> > +};
> > +
> > &i2c1 {
> > clock-frequency = <400000>;
> > status = "okay";
> > --
> > 2.23.0
> >
> >
>
> --
> Pengutronix e.K. | |
> Industrial Linux Solutions | http://www.pengutronix.de/ |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |

2019-10-29 11:23:25

by Ondřej Jirman

[permalink] [raw]
Subject: Re: [PATCH 1/3] input: edt-ft5x06: Add support for regulator

Hi Marco,

On Tue, Oct 29, 2019 at 09:55:45AM +0100, Marco Felsch wrote:
> Hi Dmitry,
>
> On 19-10-28 21:12, Dmitry Torokhov wrote:
> > On Tue, Oct 29, 2019 at 01:58:04AM +0100, Ondrej Jirman wrote:
> > > From: Myl?ne Josserand <[email protected]>
> > >
> > > Add the support for enabling optional regulator that may be used as VCC
> > > source.
> > >
> > > Signed-off-by: Ondrej Jirman <[email protected]>
> > > Signed-off-by: Myl?ne Josserand <[email protected]>
> >
> > Applied, thank you.
>
> What happens with my vdd patches?

Sorry for not noticing your patches, I was only aware of Myl?ne's older series.
It looks like you can just skip regulator enable support from your series, and
re-send the deep-sleep mechanism and wakeup source patches only.

I'll test it with my board, and give you a tested-by.

thank you and regards,
o.

> Regards,
> Marco
>
> >
> > > ---
> > > drivers/input/touchscreen/edt-ft5x06.c | 30 ++++++++++++++++++++++++++
> > > 1 file changed, 30 insertions(+)
> > >
> > > diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
> > > index 5525f1fb1526..d61731c0037d 100644
> > > --- a/drivers/input/touchscreen/edt-ft5x06.c
> > > +++ b/drivers/input/touchscreen/edt-ft5x06.c
> > > @@ -28,6 +28,7 @@
> > > #include <linux/input/mt.h>
> > > #include <linux/input/touchscreen.h>
> > > #include <asm/unaligned.h>
> > > +#include <linux/regulator/consumer.h>
> > >
> > > #define WORK_REGISTER_THRESHOLD 0x00
> > > #define WORK_REGISTER_REPORT_RATE 0x08
> > > @@ -88,6 +89,7 @@ struct edt_ft5x06_ts_data {
> > > struct touchscreen_properties prop;
> > > u16 num_x;
> > > u16 num_y;
> > > + struct regulator *vcc;
> > >
> > > struct gpio_desc *reset_gpio;
> > > struct gpio_desc *wake_gpio;
> > > @@ -1036,6 +1038,13 @@ edt_ft5x06_ts_set_regs(struct edt_ft5x06_ts_data *tsdata)
> > > }
> > > }
> > >
> > > +static void edt_ft5x06_disable_regulator(void *arg)
> > > +{
> > > + struct edt_ft5x06_ts_data *data = arg;
> > > +
> > > + regulator_disable(data->vcc);
> > > +}
> > > +
> > > static int edt_ft5x06_ts_probe(struct i2c_client *client,
> > > const struct i2c_device_id *id)
> > > {
> > > @@ -1064,6 +1073,27 @@ 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);
> > > + return error;
> > > + }
> > > +
> > > + error = regulator_enable(tsdata->vcc);
> > > + if (error < 0) {
> > > + dev_err(&client->dev, "failed to enable vcc: %d\n", error);
> > > + return error;
> > > + }
> > > +
> > > + error = devm_add_action_or_reset(&client->dev,
> > > + edt_ft5x06_disable_regulator,
> > > + tsdata);
> > > + if (error)
> > > + return error;
> > > +
> > > tsdata->reset_gpio = devm_gpiod_get_optional(&client->dev,
> > > "reset", GPIOD_OUT_HIGH);
> > > if (IS_ERR(tsdata->reset_gpio)) {
> > > --
> > > 2.23.0
> > >
> >
> > --
> > Dmitry
> >
>
> --
> Pengutronix e.K. | |
> Industrial Linux Solutions | http://www.pengutronix.de/ |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |

2019-10-29 11:34:06

by Marco Felsch

[permalink] [raw]
Subject: Re: [PATCH 1/3] input: edt-ft5x06: Add support for regulator

Hi Ondřej,

On 19-10-29 12:21, Ondřej Jirman wrote:
> Hi Marco,
>
> On Tue, Oct 29, 2019 at 09:55:45AM +0100, Marco Felsch wrote:
> > Hi Dmitry,
> >
> > On 19-10-28 21:12, Dmitry Torokhov wrote:
> > > On Tue, Oct 29, 2019 at 01:58:04AM +0100, Ondrej Jirman wrote:
> > > > From: Mylène Josserand <[email protected]>
> > > >
> > > > Add the support for enabling optional regulator that may be used as VCC
> > > > source.
> > > >
> > > > Signed-off-by: Ondrej Jirman <[email protected]>
> > > > Signed-off-by: Mylène Josserand <[email protected]>
> > >
> > > Applied, thank you.
> >
> > What happens with my vdd patches?
>
> Sorry for not noticing your patches, I was only aware of Mylène's older series.
> It looks like you can just skip regulator enable support from your series, and
> re-send the deep-sleep mechanism and wakeup source patches only.

No problems just wondered myself. Now I need to adapt the patches ^^

> I'll test it with my board, and give you a tested-by.

Thanks.

Regards,
Marco

> thank you and regards,
> o.
>
> > Regards,
> > Marco
> >
> > >
> > > > ---
> > > > drivers/input/touchscreen/edt-ft5x06.c | 30 ++++++++++++++++++++++++++
> > > > 1 file changed, 30 insertions(+)
> > > >
> > > > diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
> > > > index 5525f1fb1526..d61731c0037d 100644
> > > > --- a/drivers/input/touchscreen/edt-ft5x06.c
> > > > +++ b/drivers/input/touchscreen/edt-ft5x06.c
> > > > @@ -28,6 +28,7 @@
> > > > #include <linux/input/mt.h>
> > > > #include <linux/input/touchscreen.h>
> > > > #include <asm/unaligned.h>
> > > > +#include <linux/regulator/consumer.h>
> > > >
> > > > #define WORK_REGISTER_THRESHOLD 0x00
> > > > #define WORK_REGISTER_REPORT_RATE 0x08
> > > > @@ -88,6 +89,7 @@ struct edt_ft5x06_ts_data {
> > > > struct touchscreen_properties prop;
> > > > u16 num_x;
> > > > u16 num_y;
> > > > + struct regulator *vcc;
> > > >
> > > > struct gpio_desc *reset_gpio;
> > > > struct gpio_desc *wake_gpio;
> > > > @@ -1036,6 +1038,13 @@ edt_ft5x06_ts_set_regs(struct edt_ft5x06_ts_data *tsdata)
> > > > }
> > > > }
> > > >
> > > > +static void edt_ft5x06_disable_regulator(void *arg)
> > > > +{
> > > > + struct edt_ft5x06_ts_data *data = arg;
> > > > +
> > > > + regulator_disable(data->vcc);
> > > > +}
> > > > +
> > > > static int edt_ft5x06_ts_probe(struct i2c_client *client,
> > > > const struct i2c_device_id *id)
> > > > {
> > > > @@ -1064,6 +1073,27 @@ 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);
> > > > + return error;
> > > > + }
> > > > +
> > > > + error = regulator_enable(tsdata->vcc);
> > > > + if (error < 0) {
> > > > + dev_err(&client->dev, "failed to enable vcc: %d\n", error);
> > > > + return error;
> > > > + }
> > > > +
> > > > + error = devm_add_action_or_reset(&client->dev,
> > > > + edt_ft5x06_disable_regulator,
> > > > + tsdata);
> > > > + if (error)
> > > > + return error;
> > > > +
> > > > tsdata->reset_gpio = devm_gpiod_get_optional(&client->dev,
> > > > "reset", GPIOD_OUT_HIGH);
> > > > if (IS_ERR(tsdata->reset_gpio)) {
> > > > --
> > > > 2.23.0
> > > >
> > >
> > > --
> > > Dmitry
> > >
> >
> > --
> > Pengutronix e.K. | |
> > Industrial Linux Solutions | http://www.pengutronix.de/ |
> > Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
>

--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |

2019-10-29 17:42:31

by Marco Felsch

[permalink] [raw]
Subject: Re: [PATCH 0/3] Add touchscreen support for TBS A711 Tablet

Hi,

On 19-10-28 21:15, Dmitry Torokhov wrote:
> On Tue, Oct 29, 2019 at 01:58:03AM +0100, Ondrej Jirman wrote:
> > This is a resurrection of https://lkml.org/lkml/2018/7/25/143
> >
> > Compared to v4 of Myl?ne's series I've dropped all attempts to
> > power off the chip during suspend. This patch just enables the
> > regulator during probe and disables it on driver rmmod.
> >
> > I've tested the driver with suspend/resume and touching the
> > panel resumes my soc.
>
> OK, I guess we can revisit when someone really needs power savings in
> suspend...

Please have a look on https://patchwork.kernel.org/cover/11149039/. I've
already send patches for it.

Regards,
Marco

> I folded bindings into the driver change and applied, dts changes should
> go through respective tree.
>
> Thanks.
>
> --
> Dmitry
>

--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |