* [PATCH] i2c: ocores: Move system PM hooks to the NOIRQ phase
@ 2023-07-17 20:38 Samuel Holland
2023-07-27 0:35 ` Andi Shyti
2023-10-24 20:20 ` Andi Shyti
0 siblings, 2 replies; 5+ messages in thread
From: Samuel Holland @ 2023-07-17 20:38 UTC (permalink / raw)
To: Peter Korsgaard, Andrew Lunn
Cc: Samuel Holland, Andi Shyti, linux-i2c, linux-kernel
When an I2C device contains a wake IRQ subordinate to a regmap-irq chip,
the regmap-irq code must be able to perform I2C transactions during
suspend_device_irqs() and resume_device_irqs(). Therefore, the bus must
be suspended/resumed during the NOIRQ phase.
Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
---
drivers/i2c/busses/i2c-ocores.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
index 4ac77e57bbbf..b1f621d42910 100644
--- a/drivers/i2c/busses/i2c-ocores.c
+++ b/drivers/i2c/busses/i2c-ocores.c
@@ -743,7 +743,6 @@ static void ocores_i2c_remove(struct platform_device *pdev)
i2c_del_adapter(&i2c->adap);
}
-#ifdef CONFIG_PM_SLEEP
static int ocores_i2c_suspend(struct device *dev)
{
struct ocores_i2c *i2c = dev_get_drvdata(dev);
@@ -772,11 +771,9 @@ static int ocores_i2c_resume(struct device *dev)
return ocores_init(dev, i2c);
}
-static SIMPLE_DEV_PM_OPS(ocores_i2c_pm, ocores_i2c_suspend, ocores_i2c_resume);
-#define OCORES_I2C_PM (&ocores_i2c_pm)
-#else
-#define OCORES_I2C_PM NULL
-#endif
+static const struct dev_pm_ops ocores_i2c_pm_ops = {
+ NOIRQ_SYSTEM_SLEEP_PM_OPS(ocores_i2c_suspend, ocores_i2c_resume)
+};
static struct platform_driver ocores_i2c_driver = {
.probe = ocores_i2c_probe,
@@ -784,7 +781,7 @@ static struct platform_driver ocores_i2c_driver = {
.driver = {
.name = "ocores-i2c",
.of_match_table = ocores_i2c_match,
- .pm = OCORES_I2C_PM,
+ .pm = &ocores_i2c_pm_ops,
},
};
--
2.40.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: ocores: Move system PM hooks to the NOIRQ phase
2023-07-17 20:38 [PATCH] i2c: ocores: Move system PM hooks to the NOIRQ phase Samuel Holland
@ 2023-07-27 0:35 ` Andi Shyti
2023-08-05 1:20 ` Andi Shyti
2023-10-24 20:20 ` Andi Shyti
1 sibling, 1 reply; 5+ messages in thread
From: Andi Shyti @ 2023-07-27 0:35 UTC (permalink / raw)
To: Samuel Holland; +Cc: Peter Korsgaard, Andrew Lunn, linux-i2c, linux-kernel
Hi Samuel,
On Mon, Jul 17, 2023 at 01:38:57PM -0700, Samuel Holland wrote:
> When an I2C device contains a wake IRQ subordinate to a regmap-irq chip,
> the regmap-irq code must be able to perform I2C transactions during
> suspend_device_irqs() and resume_device_irqs(). Therefore, the bus must
> be suspended/resumed during the NOIRQ phase.
>
> Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
it's OK for me.
Peter, any comment on this?
Andi
> ---
>
> drivers/i2c/busses/i2c-ocores.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
> index 4ac77e57bbbf..b1f621d42910 100644
> --- a/drivers/i2c/busses/i2c-ocores.c
> +++ b/drivers/i2c/busses/i2c-ocores.c
> @@ -743,7 +743,6 @@ static void ocores_i2c_remove(struct platform_device *pdev)
> i2c_del_adapter(&i2c->adap);
> }
>
> -#ifdef CONFIG_PM_SLEEP
> static int ocores_i2c_suspend(struct device *dev)
> {
> struct ocores_i2c *i2c = dev_get_drvdata(dev);
> @@ -772,11 +771,9 @@ static int ocores_i2c_resume(struct device *dev)
> return ocores_init(dev, i2c);
> }
>
> -static SIMPLE_DEV_PM_OPS(ocores_i2c_pm, ocores_i2c_suspend, ocores_i2c_resume);
> -#define OCORES_I2C_PM (&ocores_i2c_pm)
> -#else
> -#define OCORES_I2C_PM NULL
> -#endif
> +static const struct dev_pm_ops ocores_i2c_pm_ops = {
> + NOIRQ_SYSTEM_SLEEP_PM_OPS(ocores_i2c_suspend, ocores_i2c_resume)
> +};
>
> static struct platform_driver ocores_i2c_driver = {
> .probe = ocores_i2c_probe,
> @@ -784,7 +781,7 @@ static struct platform_driver ocores_i2c_driver = {
> .driver = {
> .name = "ocores-i2c",
> .of_match_table = ocores_i2c_match,
> - .pm = OCORES_I2C_PM,
> + .pm = &ocores_i2c_pm_ops,
> },
> };
>
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: ocores: Move system PM hooks to the NOIRQ phase
2023-07-27 0:35 ` Andi Shyti
@ 2023-08-05 1:20 ` Andi Shyti
0 siblings, 0 replies; 5+ messages in thread
From: Andi Shyti @ 2023-08-05 1:20 UTC (permalink / raw)
To: Samuel Holland; +Cc: Peter Korsgaard, Andrew Lunn, linux-i2c, linux-kernel
Hi,
On Thu, Jul 27, 2023 at 02:35:51AM +0200, Andi Shyti wrote:
> Hi Samuel,
>
> On Mon, Jul 17, 2023 at 01:38:57PM -0700, Samuel Holland wrote:
> > When an I2C device contains a wake IRQ subordinate to a regmap-irq chip,
> > the regmap-irq code must be able to perform I2C transactions during
> > suspend_device_irqs() and resume_device_irqs(). Therefore, the bus must
> > be suspended/resumed during the NOIRQ phase.
> >
> > Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
>
> it's OK for me.
>
> Peter, any comment on this?
a kind ping...
Andi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: ocores: Move system PM hooks to the NOIRQ phase
2023-07-17 20:38 [PATCH] i2c: ocores: Move system PM hooks to the NOIRQ phase Samuel Holland
2023-07-27 0:35 ` Andi Shyti
@ 2023-10-24 20:20 ` Andi Shyti
2023-10-28 19:36 ` Wolfram Sang
1 sibling, 1 reply; 5+ messages in thread
From: Andi Shyti @ 2023-10-24 20:20 UTC (permalink / raw)
To: Samuel Holland; +Cc: Peter Korsgaard, Andrew Lunn, linux-i2c, linux-kernel
Hi Samuel,
On Mon, Jul 17, 2023 at 01:38:57PM -0700, Samuel Holland wrote:
> When an I2C device contains a wake IRQ subordinate to a regmap-irq chip,
> the regmap-irq code must be able to perform I2C transactions during
> suspend_device_irqs() and resume_device_irqs(). Therefore, the bus must
> be suspended/resumed during the NOIRQ phase.
>
> Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
I think this patch has failed to receive some comments, I'll go
ahead and give it my blessing:
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Thanks,
Andi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: ocores: Move system PM hooks to the NOIRQ phase
2023-10-24 20:20 ` Andi Shyti
@ 2023-10-28 19:36 ` Wolfram Sang
0 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2023-10-28 19:36 UTC (permalink / raw)
To: Andi Shyti
Cc: Samuel Holland, Peter Korsgaard, Andrew Lunn, linux-i2c, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 761 bytes --]
> > When an I2C device contains a wake IRQ subordinate to a regmap-irq chip,
> > the regmap-irq code must be able to perform I2C transactions during
> > suspend_device_irqs() and resume_device_irqs(). Therefore, the bus must
> > be suspended/resumed during the NOIRQ phase.
> >
> > Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
>
> I think this patch has failed to receive some comments, I'll go
> ahead and give it my blessing:
>
> Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
It needs to be rebased on top of 0ad93449b043 ("i2c: ocores: Remove
#ifdef guards for PM related functions"), though. This series did clean
this up for the whole subsystem. It also introduced using pm_sleep_ptr
which probably was missing here?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-10-28 19:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-17 20:38 [PATCH] i2c: ocores: Move system PM hooks to the NOIRQ phase Samuel Holland
2023-07-27 0:35 ` Andi Shyti
2023-08-05 1:20 ` Andi Shyti
2023-10-24 20:20 ` Andi Shyti
2023-10-28 19:36 ` Wolfram Sang
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).