* [PATCH] Input: ilitek_ts_i2c: Use gpiod_set_value_cansleep()
@ 2024-05-15 14:49 Matthijs Kooijman
2024-05-15 23:19 ` Dmitry Torokhov
0 siblings, 1 reply; 2+ messages in thread
From: Matthijs Kooijman @ 2024-05-15 14:49 UTC (permalink / raw)
To: linux-input; +Cc: Dmitry Torokhov, Matthijs Kooijman
Use gpiod_set_value_cansleep in the ilitek_reset function (called only
from ilitek_ts_i2c_probe and ilitek_resume).
Without this change, the driver may print a warning if the reset pin is
connected to a GPIO chip which can sleep (e.g. a GPIO expander):
WARNING: CPU: 1 PID: 578 at gpiod_set_value+0x5c/0xd0
This commit is modeled after commit 7c977019c53ed (leds: lp55xx: Use
gpiod_set_value_cansleep(), 2023-09-18)
Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
---
drivers/input/touchscreen/ilitek_ts_i2c.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/input/touchscreen/ilitek_ts_i2c.c b/drivers/input/touchscreen/ilitek_ts_i2c.c
index fc4e39b6651a4..236c332de6cdc 100644
--- a/drivers/input/touchscreen/ilitek_ts_i2c.c
+++ b/drivers/input/touchscreen/ilitek_ts_i2c.c
@@ -391,9 +391,9 @@ static const struct ilitek_protocol_map ptl_func_map[] = {
static void ilitek_reset(struct ilitek_ts_data *ts, int delay)
{
if (ts->reset_gpio) {
- gpiod_set_value(ts->reset_gpio, 1);
+ gpiod_set_value_cansleep(ts->reset_gpio, 1);
mdelay(10);
- gpiod_set_value(ts->reset_gpio, 0);
+ gpiod_set_value_cansleep(ts->reset_gpio, 0);
mdelay(delay);
}
}
--
2.40.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Input: ilitek_ts_i2c: Use gpiod_set_value_cansleep()
2024-05-15 14:49 [PATCH] Input: ilitek_ts_i2c: Use gpiod_set_value_cansleep() Matthijs Kooijman
@ 2024-05-15 23:19 ` Dmitry Torokhov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2024-05-15 23:19 UTC (permalink / raw)
To: Matthijs Kooijman; +Cc: linux-input
Hi Matthijs,
On Wed, May 15, 2024 at 04:49:44PM +0200, Matthijs Kooijman wrote:
> Use gpiod_set_value_cansleep in the ilitek_reset function (called only
> from ilitek_ts_i2c_probe and ilitek_resume).
>
> Without this change, the driver may print a warning if the reset pin is
> connected to a GPIO chip which can sleep (e.g. a GPIO expander):
>
> WARNING: CPU: 1 PID: 578 at gpiod_set_value+0x5c/0xd0
>
> This commit is modeled after commit 7c977019c53ed (leds: lp55xx: Use
> gpiod_set_value_cansleep(), 2023-09-18)
>
> Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
> ---
> drivers/input/touchscreen/ilitek_ts_i2c.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/input/touchscreen/ilitek_ts_i2c.c b/drivers/input/touchscreen/ilitek_ts_i2c.c
> index fc4e39b6651a4..236c332de6cdc 100644
> --- a/drivers/input/touchscreen/ilitek_ts_i2c.c
> +++ b/drivers/input/touchscreen/ilitek_ts_i2c.c
> @@ -391,9 +391,9 @@ static const struct ilitek_protocol_map ptl_func_map[] = {
> static void ilitek_reset(struct ilitek_ts_data *ts, int delay)
> {
> if (ts->reset_gpio) {
> - gpiod_set_value(ts->reset_gpio, 1);
> + gpiod_set_value_cansleep(ts->reset_gpio, 1);
> mdelay(10);
> - gpiod_set_value(ts->reset_gpio, 0);
> + gpiod_set_value_cansleep(ts->reset_gpio, 0);
> mdelay(delay);
While we are changing GPIO to the sleeping variant we should also change
these mdelays to usleep_range() and msleep() respectively.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-05-15 23:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-15 14:49 [PATCH] Input: ilitek_ts_i2c: Use gpiod_set_value_cansleep() Matthijs Kooijman
2024-05-15 23:19 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).