[PATCH] PCI/pwrctrl: tc9563: Use gpiod_set_value_cansleep() for RESX

Abel Vesa posted 1 patch 1 month ago
drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] PCI/pwrctrl: tc9563: Use gpiod_set_value_cansleep() for RESX
Posted by Abel Vesa 1 month ago
The RESX GPIO may be provided by a sleeping GPIO controller, such as an
I2C or SPI I/O expander. Calling gpiod_set_value() for such a GPIO
triggers the following warning:

  WARNING: ... drivers/gpio/gpiolib.c:4030 at gpiod_set_value()

The TC9563 power-on and power-off callbacks already sleep while enabling
or disabling regulators and while waiting for oscillator stabilization.
Use gpiod_set_value_cansleep() for RESX so it can be driven without
triggering the warning.

Fixes: 4c9c7be47310 ("PCI: pwrctrl: Add power control driver for TC9563")
Signed-off-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
---
 drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c b/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c
index fd53a7db9875..1b7718d07d15 100644
--- a/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c
+++ b/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c
@@ -481,7 +481,7 @@ static int tc9563_pwrctrl_power_off(struct pci_pwrctrl *pwrctrl)
 	struct tc9563_pwrctrl *tc9563 = container_of(pwrctrl,
 					    struct tc9563_pwrctrl, pwrctrl);
 
-	gpiod_set_value(tc9563->reset_gpio, 1);
+	gpiod_set_value_cansleep(tc9563->reset_gpio, 1);
 
 	regulator_bulk_disable(ARRAY_SIZE(tc9563->supplies), tc9563->supplies);
 
@@ -501,7 +501,7 @@ static int tc9563_pwrctrl_power_on(struct pci_pwrctrl *pwrctrl)
 	if (ret < 0)
 		return dev_err_probe(dev, ret, "cannot enable regulators\n");
 
-	gpiod_set_value(tc9563->reset_gpio, 0);
+	gpiod_set_value_cansleep(tc9563->reset_gpio, 0);
 
 	fsleep(TC9563_OSC_STAB_DELAY_US);
 

---
base-commit: 4b18edbd8e70f7e6860d56370f13244896d0f95c
change-id: 20260825-pci-pwrctl-tc9563-use-cansleep-for-resx-f6e1f65547fc

Best regards,
--  
Abel Vesa <abel.vesa@oss.qualcomm.com>
Re: [PATCH] PCI/pwrctrl: tc9563: Use gpiod_set_value_cansleep() for RESX
Posted by Bjorn Helgaas 3 weeks, 3 days ago
On Tue, Aug 25, 2026 at 02:41:31PM +0300, Abel Vesa wrote:
> The RESX GPIO may be provided by a sleeping GPIO controller, such as an
> I2C or SPI I/O expander. Calling gpiod_set_value() for such a GPIO
> triggers the following warning:
> 
>   WARNING: ... drivers/gpio/gpiolib.c:4030 at gpiod_set_value()
> 
> The TC9563 power-on and power-off callbacks already sleep while enabling
> or disabling regulators and while waiting for oscillator stabilization.
> Use gpiod_set_value_cansleep() for RESX so it can be driven without
> triggering the warning.
> 
> Fixes: 4c9c7be47310 ("PCI: pwrctrl: Add power control driver for TC9563")
> Signed-off-by: Abel Vesa <abel.vesa@oss.qualcomm.com>

Applied to pci/pwrctrl for v7.4 with subject line:

  PCI/pwrctrl: tc9563: Allow RESX reset assertion to sleep

to focus on the behavioral change.  Let me know if this doesn't
capture it correctly.

> ---
>  drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c b/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c
> index fd53a7db9875..1b7718d07d15 100644
> --- a/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c
> +++ b/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c
> @@ -481,7 +481,7 @@ static int tc9563_pwrctrl_power_off(struct pci_pwrctrl *pwrctrl)
>  	struct tc9563_pwrctrl *tc9563 = container_of(pwrctrl,
>  					    struct tc9563_pwrctrl, pwrctrl);
>  
> -	gpiod_set_value(tc9563->reset_gpio, 1);
> +	gpiod_set_value_cansleep(tc9563->reset_gpio, 1);
>  
>  	regulator_bulk_disable(ARRAY_SIZE(tc9563->supplies), tc9563->supplies);
>  
> @@ -501,7 +501,7 @@ static int tc9563_pwrctrl_power_on(struct pci_pwrctrl *pwrctrl)
>  	if (ret < 0)
>  		return dev_err_probe(dev, ret, "cannot enable regulators\n");
>  
> -	gpiod_set_value(tc9563->reset_gpio, 0);
> +	gpiod_set_value_cansleep(tc9563->reset_gpio, 0);
>  
>  	fsleep(TC9563_OSC_STAB_DELAY_US);
>  
> 
> ---
> base-commit: 4b18edbd8e70f7e6860d56370f13244896d0f95c
> change-id: 20260825-pci-pwrctl-tc9563-use-cansleep-for-resx-f6e1f65547fc
> 
> Best regards,
> --  
> Abel Vesa <abel.vesa@oss.qualcomm.com>
>
Re: [PATCH] PCI/pwrctrl: tc9563: Use gpiod_set_value_cansleep() for RESX
Posted by Manivannan Sadhasivam 3 weeks, 4 days ago
On Tue, Aug 25, 2026 at 02:41:31PM +0300, Abel Vesa wrote:
> The RESX GPIO may be provided by a sleeping GPIO controller, such as an
> I2C or SPI I/O expander. Calling gpiod_set_value() for such a GPIO
> triggers the following warning:
> 
>   WARNING: ... drivers/gpio/gpiolib.c:4030 at gpiod_set_value()
> 
> The TC9563 power-on and power-off callbacks already sleep while enabling
> or disabling regulators and while waiting for oscillator stabilization.
> Use gpiod_set_value_cansleep() for RESX so it can be driven without
> triggering the warning.
> 
> Fixes: 4c9c7be47310 ("PCI: pwrctrl: Add power control driver for TC9563")
> Signed-off-by: Abel Vesa <abel.vesa@oss.qualcomm.com>

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>

- Mani

-- 
மணிவண்ணன் சதாசிவம்
Re: [PATCH] PCI/pwrctrl: tc9563: Use gpiod_set_value_cansleep() for RESX
Posted by Bartosz Golaszewski 1 month ago
On Tue, 25 Aug 2026 13:41:31 +0200, Abel Vesa <abel.vesa@oss.qualcomm.com> said:
> The RESX GPIO may be provided by a sleeping GPIO controller, such as an
> I2C or SPI I/O expander. Calling gpiod_set_value() for such a GPIO
> triggers the following warning:
>
>   WARNING: ... drivers/gpio/gpiolib.c:4030 at gpiod_set_value()
>
> The TC9563 power-on and power-off callbacks already sleep while enabling
> or disabling regulators and while waiting for oscillator stabilization.
> Use gpiod_set_value_cansleep() for RESX so it can be driven without
> triggering the warning.
>
> Fixes: 4c9c7be47310 ("PCI: pwrctrl: Add power control driver for TC9563")
> Signed-off-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
> ---

Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>