RE: [PATCH 2/3] pinctrl: amd: Don't save/restore interrupt status and wake status bits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[Public]

> -----Original Message-----
> From: Natikar, Basavaraj <Basavaraj.Natikar@xxxxxxx>
> Sent: Monday, June 13, 2022 01:41
> To: linus.walleij@xxxxxxxxxx; linux-gpio@xxxxxxxxxxxxxxx; S-k, Shyam-sundar
> <Shyam-sundar.S-k@xxxxxxx>
> Cc: Limonciello, Mario <Mario.Limonciello@xxxxxxx>; Natikar, Basavaraj
> <Basavaraj.Natikar@xxxxxxx>
> Subject: [PATCH 2/3] pinctrl: amd: Don't save/restore interrupt status and wake
> status bits
> 
> Saving/restoring interrupt and wake status bits across suspend can
> cause the suspend to fail if an IRQ is serviced across the
> suspend cycle.
> 
> Signed-off-by: Mario Limonciello <mario.limonciello@xxxxxxx>
> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@xxxxxxx>

I think this should also pick up this tag:
Fixes: 79d2c8bede2c ("pinctrl/amd: save pin registers over suspend/resume")

> ---
>  drivers/pinctrl/pinctrl-amd.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c
> index ff3d0edbea48..40e23b5795b0 100644
> --- a/drivers/pinctrl/pinctrl-amd.c
> +++ b/drivers/pinctrl/pinctrl-amd.c
> @@ -917,6 +917,7 @@ static int amd_gpio_suspend(struct device *dev)
>  {
>  	struct amd_gpio *gpio_dev = dev_get_drvdata(dev);
>  	struct pinctrl_desc *desc = gpio_dev->pctrl->desc;
> +	unsigned long flags;
>  	int i;
> 
>  	for (i = 0; i < desc->npins; i++) {
> @@ -925,7 +926,9 @@ static int amd_gpio_suspend(struct device *dev)
>  		if (!amd_gpio_should_save(gpio_dev, pin))
>  			continue;
> 
> -		gpio_dev->saved_regs[i] = readl(gpio_dev->base + pin*4);
> +		raw_spin_lock_irqsave(&gpio_dev->lock, flags);
> +		gpio_dev->saved_regs[i] = readl(gpio_dev->base + pin * 4) &
> ~PIN_IRQ_PENDING;
> +		raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);
>  	}
> 
>  	return 0;
> @@ -935,6 +938,7 @@ static int amd_gpio_resume(struct device *dev)
>  {
>  	struct amd_gpio *gpio_dev = dev_get_drvdata(dev);
>  	struct pinctrl_desc *desc = gpio_dev->pctrl->desc;
> +	unsigned long flags;
>  	int i;
> 
>  	for (i = 0; i < desc->npins; i++) {
> @@ -943,7 +947,10 @@ static int amd_gpio_resume(struct device *dev)
>  		if (!amd_gpio_should_save(gpio_dev, pin))
>  			continue;
> 
> -		writel(gpio_dev->saved_regs[i], gpio_dev->base + pin*4);
> +		raw_spin_lock_irqsave(&gpio_dev->lock, flags);
> +		gpio_dev->saved_regs[i] |= readl(gpio_dev->base + pin * 4) &
> PIN_IRQ_PENDING;
> +		writel(gpio_dev->saved_regs[i], gpio_dev->base + pin * 4);
> +		raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);
>  	}
> 
>  	return 0;
> --
> 2.25.1




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux