Message ID | 20191127120948.22251-5-m.felsch@pengutronix.de (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | EDT-FT5x06 improvements | expand |
On Wed, Nov 27, 2019 at 01:09:47PM +0100, Marco Felsch wrote: > Since day one the touch controller acts as wakeup-source. This seems to > be wrong since the device supports deep-sleep mechanism [1] which > requires a reset to leave it. Also some designs won't use the > touchscreen as wakeup-source. > > According discussion [2] we decided to break backward compatibility and > go the common way by using the 'wakeup-source' device-property. > > [1] https://www.newhavendisplay.com/appnotes/datasheets/touchpanel/FT5x26.pdf > [2] https://patchwork.kernel.org/patch/11149037/ > > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> > --- > v2: > - make use of common wakeup-source property > - adapt commit message > > drivers/input/touchscreen/edt-ft5x06.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c > index e1b31fd525e2..8d2ec7947f0e 100644 > --- a/drivers/input/touchscreen/edt-ft5x06.c > +++ b/drivers/input/touchscreen/edt-ft5x06.c > @@ -24,6 +24,7 @@ > #include <linux/irq.h> > #include <linux/kernel.h> > #include <linux/module.h> > +#include <linux/property.h> > #include <linux/ratelimit.h> > #include <linux/regulator/consumer.h> > #include <linux/slab.h> > @@ -1056,6 +1057,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, > unsigned long irq_flags; > int error; > char fw_version[EDT_NAME_LEN]; > + bool en_wakeup; > > dev_dbg(&client->dev, "probing for EDT FT5x06 I2C\n"); > > @@ -1114,6 +1116,8 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, > return error; > } > > + en_wakeup = device_property_present(&client->dev, "wakeup-source"); > + > if (tsdata->wake_gpio) { > usleep_range(5000, 6000); > gpiod_set_value_cansleep(tsdata->wake_gpio, 1); > @@ -1208,7 +1212,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, > return error; > > edt_ft5x06_ts_prepare_debugfs(tsdata, dev_driver_string(&client->dev)); > - device_init_wakeup(&client->dev, 1); > + device_init_wakeup(&client->dev, en_wakeup); I2C core already marks device as wakeup source if I2C_CLIEMT_WAKE is set (and the flag is specified when, among other things, device has "wakeup-source" property). So the only thing that is needed is to remove device_init_wakeup(&client->dev, 1); line. Thanks.
On 19-12-02 10:00, Dmitry Torokhov wrote: > On Wed, Nov 27, 2019 at 01:09:47PM +0100, Marco Felsch wrote: > > Since day one the touch controller acts as wakeup-source. This seems to > > be wrong since the device supports deep-sleep mechanism [1] which > > requires a reset to leave it. Also some designs won't use the > > touchscreen as wakeup-source. > > > > According discussion [2] we decided to break backward compatibility and > > go the common way by using the 'wakeup-source' device-property. > > > > [1] https://www.newhavendisplay.com/appnotes/datasheets/touchpanel/FT5x26.pdf > > [2] https://patchwork.kernel.org/patch/11149037/ > > > > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> > > --- > > v2: > > - make use of common wakeup-source property > > - adapt commit message > > > > drivers/input/touchscreen/edt-ft5x06.c | 6 +++++- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c > > index e1b31fd525e2..8d2ec7947f0e 100644 > > --- a/drivers/input/touchscreen/edt-ft5x06.c > > +++ b/drivers/input/touchscreen/edt-ft5x06.c > > @@ -24,6 +24,7 @@ > > #include <linux/irq.h> > > #include <linux/kernel.h> > > #include <linux/module.h> > > +#include <linux/property.h> > > #include <linux/ratelimit.h> > > #include <linux/regulator/consumer.h> > > #include <linux/slab.h> > > @@ -1056,6 +1057,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, > > unsigned long irq_flags; > > int error; > > char fw_version[EDT_NAME_LEN]; > > + bool en_wakeup; > > > > dev_dbg(&client->dev, "probing for EDT FT5x06 I2C\n"); > > > > @@ -1114,6 +1116,8 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, > > return error; > > } > > > > + en_wakeup = device_property_present(&client->dev, "wakeup-source"); > > + > > if (tsdata->wake_gpio) { > > usleep_range(5000, 6000); > > gpiod_set_value_cansleep(tsdata->wake_gpio, 1); > > @@ -1208,7 +1212,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, > > return error; > > > > edt_ft5x06_ts_prepare_debugfs(tsdata, dev_driver_string(&client->dev)); > > - device_init_wakeup(&client->dev, 1); > > + device_init_wakeup(&client->dev, en_wakeup); > > I2C core already marks device as wakeup source if I2C_CLIEMT_WAKE is set > (and the flag is specified when, among other things, device has > "wakeup-source" property). > > So the only thing that is needed is to remove > > device_init_wakeup(&client->dev, 1); > > line. You are right, thanks for covering that. Regards, Marco > > Thanks. > > -- > Dmitry >
diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index e1b31fd525e2..8d2ec7947f0e 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -24,6 +24,7 @@ #include <linux/irq.h> #include <linux/kernel.h> #include <linux/module.h> +#include <linux/property.h> #include <linux/ratelimit.h> #include <linux/regulator/consumer.h> #include <linux/slab.h> @@ -1056,6 +1057,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, unsigned long irq_flags; int error; char fw_version[EDT_NAME_LEN]; + bool en_wakeup; dev_dbg(&client->dev, "probing for EDT FT5x06 I2C\n"); @@ -1114,6 +1116,8 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, return error; } + en_wakeup = device_property_present(&client->dev, "wakeup-source"); + if (tsdata->wake_gpio) { usleep_range(5000, 6000); gpiod_set_value_cansleep(tsdata->wake_gpio, 1); @@ -1208,7 +1212,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, return error; edt_ft5x06_ts_prepare_debugfs(tsdata, dev_driver_string(&client->dev)); - device_init_wakeup(&client->dev, 1); + device_init_wakeup(&client->dev, en_wakeup); dev_dbg(&client->dev, "EDT FT5x06 initialized: IRQ %d, WAKE pin %d, Reset pin %d.\n",
Since day one the touch controller acts as wakeup-source. This seems to be wrong since the device supports deep-sleep mechanism [1] which requires a reset to leave it. Also some designs won't use the touchscreen as wakeup-source. According discussion [2] we decided to break backward compatibility and go the common way by using the 'wakeup-source' device-property. [1] https://www.newhavendisplay.com/appnotes/datasheets/touchpanel/FT5x26.pdf [2] https://patchwork.kernel.org/patch/11149037/ Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> --- v2: - make use of common wakeup-source property - adapt commit message drivers/input/touchscreen/edt-ft5x06.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)