[PATCH v3 04/11] Input: ilitek_ts_i2c: fix warning with gpio controllers that sleep

Josua Mayer posted 11 patches 2 weeks ago
There is a newer version of this series
[PATCH v3 04/11] Input: ilitek_ts_i2c: fix warning with gpio controllers that sleep
Posted by Josua Mayer 2 weeks ago
The ilitek touchscreen driver uses the non-sleeping gpiod_set_value
function for reset.

Switch to using gpiod_set_value_cansleep() when controlling reset_gpio to
support GPIO providers that may sleep, such as I2C GPIO expanders.

This fixes noisy complaints in kernel log for gpio providers that do
sleep.

Signed-off-by: Josua Mayer <josua@solid-run.com>
---
 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 0dd632724a003..8c5a54b336816 100644
--- a/drivers/input/touchscreen/ilitek_ts_i2c.c
+++ b/drivers/input/touchscreen/ilitek_ts_i2c.c
@@ -396,9 +396,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.51.0
Re: [PATCH v3 04/11] Input: ilitek_ts_i2c: fix warning with gpio controllers that sleep
Posted by Dmitry Torokhov 1 week, 6 days ago
Hi Josua,

On Mon, Nov 17, 2025 at 01:28:46PM +0100, Josua Mayer wrote:
> The ilitek touchscreen driver uses the non-sleeping gpiod_set_value
> function for reset.
> 
> Switch to using gpiod_set_value_cansleep() when controlling reset_gpio to
> support GPIO providers that may sleep, such as I2C GPIO expanders.
> 
> This fixes noisy complaints in kernel log for gpio providers that do
> sleep.
> 
> Signed-off-by: Josua Mayer <josua@solid-run.com>
> ---
>  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 0dd632724a003..8c5a54b336816 100644
> --- a/drivers/input/touchscreen/ilitek_ts_i2c.c
> +++ b/drivers/input/touchscreen/ilitek_ts_i2c.c
> @@ -396,9 +396,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);

This (and below) should be usleep_range/msleep/fsleep.

> -		gpiod_set_value(ts->reset_gpio, 0);
> +		gpiod_set_value_cansleep(ts->reset_gpio, 0);
>  		mdelay(delay);
>  	}
>  }
> 

Thanks.

-- 
Dmitry
Re: [PATCH v3 04/11] Input: ilitek_ts_i2c: fix warning with gpio controllers that sleep
Posted by Josua Mayer 14 hours ago
Am 18.11.25 um 20:22 schrieb Dmitry Torokhov:
> Hi Josua,
>
> On Mon, Nov 17, 2025 at 01:28:46PM +0100, Josua Mayer wrote:
>> The ilitek touchscreen driver uses the non-sleeping gpiod_set_value
>> function for reset.
>>
>> Switch to using gpiod_set_value_cansleep() when controlling reset_gpio to
>> support GPIO providers that may sleep, such as I2C GPIO expanders.
>>
>> This fixes noisy complaints in kernel log for gpio providers that do
>> sleep.
>>
>> Signed-off-by: Josua Mayer <josua@solid-run.com>
>> ---
>>  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 0dd632724a003..8c5a54b336816 100644
>> --- a/drivers/input/touchscreen/ilitek_ts_i2c.c
>> +++ b/drivers/input/touchscreen/ilitek_ts_i2c.c
>> @@ -396,9 +396,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);
> This (and below) should be usleep_range/msleep/fsleep.

True ....

So I will change it since I am areadly changing the code next to it.

>
>> -		gpiod_set_value(ts->reset_gpio, 0);
>> +		gpiod_set_value_cansleep(ts->reset_gpio, 0);
>>  		mdelay(delay);
>>  	}
>>  }
>>
> Thanks.
>