All of lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND, V2] i2c: mediatek: Move suspend and resume handling to NOIRQ phase
@ 2021-01-09  8:29 ` qii.wang
  0 siblings, 0 replies; 9+ messages in thread
From: qii.wang @ 2021-01-09  8:29 UTC (permalink / raw)
  To: wsa
  Cc: matthias.bgg, linux-i2c, linux-arm-kernel, linux-kernel,
	linux-mediatek, srv_heupstream, leilk.liu, qii.wang

From: Qii Wang <qii.wang@mediatek.com>

Some i2c device driver indirectly uses I2C driver when it is now
being suspended. The i2c devices driver is suspended during the
NOIRQ phase and this cannot be changed due to other dependencies.
Therefore, we also need to move the suspend handling for the I2C
controller driver to the NOIRQ phase as well.

Signed-off-by: Qii Wang <qii.wang@mediatek.com>
---

Changes in v2:
        - Replied some comments
        - Fixed the wrong spelling medaitek to mediatek

 drivers/i2c/busses/i2c-mt65xx.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c
index 0818d3e..2ffd2f3 100644
--- a/drivers/i2c/busses/i2c-mt65xx.c
+++ b/drivers/i2c/busses/i2c-mt65xx.c
@@ -1275,7 +1275,8 @@ static int mtk_i2c_probe(struct platform_device *pdev)
 	mtk_i2c_clock_disable(i2c);
 
 	ret = devm_request_irq(&pdev->dev, irq, mtk_i2c_irq,
-			       IRQF_TRIGGER_NONE, I2C_DRV_NAME, i2c);
+			       IRQF_NO_SUSPEND | IRQF_TRIGGER_NONE,
+			       I2C_DRV_NAME, i2c);
 	if (ret < 0) {
 		dev_err(&pdev->dev,
 			"Request I2C IRQ %d fail\n", irq);
@@ -1302,7 +1303,16 @@ static int mtk_i2c_remove(struct platform_device *pdev)
 }
 
 #ifdef CONFIG_PM_SLEEP
-static int mtk_i2c_resume(struct device *dev)
+static int mtk_i2c_suspend_noirq(struct device *dev)
+{
+	struct mtk_i2c *i2c = dev_get_drvdata(dev);
+
+	i2c_mark_adapter_suspended(&i2c->adap);
+
+	return 0;
+}
+
+static int mtk_i2c_resume_noirq(struct device *dev)
 {
 	int ret;
 	struct mtk_i2c *i2c = dev_get_drvdata(dev);
@@ -1317,12 +1327,15 @@ static int mtk_i2c_resume(struct device *dev)
 
 	mtk_i2c_clock_disable(i2c);
 
+	i2c_mark_adapter_resumed(&i2c->adap);
+
 	return 0;
 }
 #endif
 
 static const struct dev_pm_ops mtk_i2c_pm = {
-	SET_SYSTEM_SLEEP_PM_OPS(NULL, mtk_i2c_resume)
+	SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mtk_i2c_suspend_noirq,
+				      mtk_i2c_resume_noirq)
 };
 
 static struct platform_driver mtk_i2c_driver = {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [RESEND, V2] i2c: mediatek: Move suspend and resume handling to NOIRQ phase
@ 2021-01-09  8:29 ` qii.wang
  0 siblings, 0 replies; 9+ messages in thread
From: qii.wang @ 2021-01-09  8:29 UTC (permalink / raw)
  To: wsa
  Cc: qii.wang, srv_heupstream, leilk.liu, linux-kernel,
	linux-mediatek, linux-i2c, matthias.bgg, linux-arm-kernel

From: Qii Wang <qii.wang@mediatek.com>

Some i2c device driver indirectly uses I2C driver when it is now
being suspended. The i2c devices driver is suspended during the
NOIRQ phase and this cannot be changed due to other dependencies.
Therefore, we also need to move the suspend handling for the I2C
controller driver to the NOIRQ phase as well.

Signed-off-by: Qii Wang <qii.wang@mediatek.com>
---

Changes in v2:
        - Replied some comments
        - Fixed the wrong spelling medaitek to mediatek

 drivers/i2c/busses/i2c-mt65xx.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c
index 0818d3e..2ffd2f3 100644
--- a/drivers/i2c/busses/i2c-mt65xx.c
+++ b/drivers/i2c/busses/i2c-mt65xx.c
@@ -1275,7 +1275,8 @@ static int mtk_i2c_probe(struct platform_device *pdev)
 	mtk_i2c_clock_disable(i2c);
 
 	ret = devm_request_irq(&pdev->dev, irq, mtk_i2c_irq,
-			       IRQF_TRIGGER_NONE, I2C_DRV_NAME, i2c);
+			       IRQF_NO_SUSPEND | IRQF_TRIGGER_NONE,
+			       I2C_DRV_NAME, i2c);
 	if (ret < 0) {
 		dev_err(&pdev->dev,
 			"Request I2C IRQ %d fail\n", irq);
@@ -1302,7 +1303,16 @@ static int mtk_i2c_remove(struct platform_device *pdev)
 }
 
 #ifdef CONFIG_PM_SLEEP
-static int mtk_i2c_resume(struct device *dev)
+static int mtk_i2c_suspend_noirq(struct device *dev)
+{
+	struct mtk_i2c *i2c = dev_get_drvdata(dev);
+
+	i2c_mark_adapter_suspended(&i2c->adap);
+
+	return 0;
+}
+
+static int mtk_i2c_resume_noirq(struct device *dev)
 {
 	int ret;
 	struct mtk_i2c *i2c = dev_get_drvdata(dev);
@@ -1317,12 +1327,15 @@ static int mtk_i2c_resume(struct device *dev)
 
 	mtk_i2c_clock_disable(i2c);
 
+	i2c_mark_adapter_resumed(&i2c->adap);
+
 	return 0;
 }
 #endif
 
 static const struct dev_pm_ops mtk_i2c_pm = {
-	SET_SYSTEM_SLEEP_PM_OPS(NULL, mtk_i2c_resume)
+	SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mtk_i2c_suspend_noirq,
+				      mtk_i2c_resume_noirq)
 };
 
 static struct platform_driver mtk_i2c_driver = {
-- 
1.9.1
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [RESEND, V2] i2c: mediatek: Move suspend and resume handling to NOIRQ phase
@ 2021-01-09  8:29 ` qii.wang
  0 siblings, 0 replies; 9+ messages in thread
From: qii.wang @ 2021-01-09  8:29 UTC (permalink / raw)
  To: wsa
  Cc: qii.wang, srv_heupstream, leilk.liu, linux-kernel,
	linux-mediatek, linux-i2c, matthias.bgg, linux-arm-kernel

From: Qii Wang <qii.wang@mediatek.com>

Some i2c device driver indirectly uses I2C driver when it is now
being suspended. The i2c devices driver is suspended during the
NOIRQ phase and this cannot be changed due to other dependencies.
Therefore, we also need to move the suspend handling for the I2C
controller driver to the NOIRQ phase as well.

Signed-off-by: Qii Wang <qii.wang@mediatek.com>
---

Changes in v2:
        - Replied some comments
        - Fixed the wrong spelling medaitek to mediatek

 drivers/i2c/busses/i2c-mt65xx.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c
index 0818d3e..2ffd2f3 100644
--- a/drivers/i2c/busses/i2c-mt65xx.c
+++ b/drivers/i2c/busses/i2c-mt65xx.c
@@ -1275,7 +1275,8 @@ static int mtk_i2c_probe(struct platform_device *pdev)
 	mtk_i2c_clock_disable(i2c);
 
 	ret = devm_request_irq(&pdev->dev, irq, mtk_i2c_irq,
-			       IRQF_TRIGGER_NONE, I2C_DRV_NAME, i2c);
+			       IRQF_NO_SUSPEND | IRQF_TRIGGER_NONE,
+			       I2C_DRV_NAME, i2c);
 	if (ret < 0) {
 		dev_err(&pdev->dev,
 			"Request I2C IRQ %d fail\n", irq);
@@ -1302,7 +1303,16 @@ static int mtk_i2c_remove(struct platform_device *pdev)
 }
 
 #ifdef CONFIG_PM_SLEEP
-static int mtk_i2c_resume(struct device *dev)
+static int mtk_i2c_suspend_noirq(struct device *dev)
+{
+	struct mtk_i2c *i2c = dev_get_drvdata(dev);
+
+	i2c_mark_adapter_suspended(&i2c->adap);
+
+	return 0;
+}
+
+static int mtk_i2c_resume_noirq(struct device *dev)
 {
 	int ret;
 	struct mtk_i2c *i2c = dev_get_drvdata(dev);
@@ -1317,12 +1327,15 @@ static int mtk_i2c_resume(struct device *dev)
 
 	mtk_i2c_clock_disable(i2c);
 
+	i2c_mark_adapter_resumed(&i2c->adap);
+
 	return 0;
 }
 #endif
 
 static const struct dev_pm_ops mtk_i2c_pm = {
-	SET_SYSTEM_SLEEP_PM_OPS(NULL, mtk_i2c_resume)
+	SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mtk_i2c_suspend_noirq,
+				      mtk_i2c_resume_noirq)
 };
 
 static struct platform_driver mtk_i2c_driver = {
-- 
1.9.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [RESEND, V2] i2c: mediatek: Move suspend and resume handling to NOIRQ phase
  2021-01-09  8:29 ` qii.wang
  (?)
@ 2021-01-26 11:37   ` Qii Wang
  -1 siblings, 0 replies; 9+ messages in thread
From: Qii Wang @ 2021-01-26 11:37 UTC (permalink / raw)
  To: wsa
  Cc: matthias.bgg, linux-i2c, linux-arm-kernel, linux-kernel,
	linux-mediatek, srv_heupstream, leilk.liu

Hi Wolfram,

On Sat, 2021-01-09 at 16:29 +0800, qii.wang@mediatek.com wrote:
> From: Qii Wang <qii.wang@mediatek.com>
> 
> Some i2c device driver indirectly uses I2C driver when it is now
> being suspended. The i2c devices driver is suspended during the
> NOIRQ phase and this cannot be changed due to other dependencies.
> Therefore, we also need to move the suspend handling for the I2C
> controller driver to the NOIRQ phase as well.
> 
> Signed-off-by: Qii Wang <qii.wang@mediatek.com>
> ---
> 
> Changes in v2:
>         - Replied some comments
>         - Fixed the wrong spelling medaitek to mediatek
> 
>  drivers/i2c/busses/i2c-mt65xx.c | 19 ++++++++++++++++---
>  1 file changed, 16 insertions(+), 3 deletions(-)
> 

I haven't seen any new comments, can it go into 5.11?

Thanks

	Qii

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RESEND, V2] i2c: mediatek: Move suspend and resume handling to NOIRQ phase
@ 2021-01-26 11:37   ` Qii Wang
  0 siblings, 0 replies; 9+ messages in thread
From: Qii Wang @ 2021-01-26 11:37 UTC (permalink / raw)
  To: wsa
  Cc: srv_heupstream, leilk.liu, linux-kernel, linux-mediatek,
	linux-i2c, matthias.bgg, linux-arm-kernel

Hi Wolfram,

On Sat, 2021-01-09 at 16:29 +0800, qii.wang@mediatek.com wrote:
> From: Qii Wang <qii.wang@mediatek.com>
> 
> Some i2c device driver indirectly uses I2C driver when it is now
> being suspended. The i2c devices driver is suspended during the
> NOIRQ phase and this cannot be changed due to other dependencies.
> Therefore, we also need to move the suspend handling for the I2C
> controller driver to the NOIRQ phase as well.
> 
> Signed-off-by: Qii Wang <qii.wang@mediatek.com>
> ---
> 
> Changes in v2:
>         - Replied some comments
>         - Fixed the wrong spelling medaitek to mediatek
> 
>  drivers/i2c/busses/i2c-mt65xx.c | 19 ++++++++++++++++---
>  1 file changed, 16 insertions(+), 3 deletions(-)
> 

I haven't seen any new comments, can it go into 5.11?

Thanks

	Qii
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RESEND, V2] i2c: mediatek: Move suspend and resume handling to NOIRQ phase
@ 2021-01-26 11:37   ` Qii Wang
  0 siblings, 0 replies; 9+ messages in thread
From: Qii Wang @ 2021-01-26 11:37 UTC (permalink / raw)
  To: wsa
  Cc: srv_heupstream, leilk.liu, linux-kernel, linux-mediatek,
	linux-i2c, matthias.bgg, linux-arm-kernel

Hi Wolfram,

On Sat, 2021-01-09 at 16:29 +0800, qii.wang@mediatek.com wrote:
> From: Qii Wang <qii.wang@mediatek.com>
> 
> Some i2c device driver indirectly uses I2C driver when it is now
> being suspended. The i2c devices driver is suspended during the
> NOIRQ phase and this cannot be changed due to other dependencies.
> Therefore, we also need to move the suspend handling for the I2C
> controller driver to the NOIRQ phase as well.
> 
> Signed-off-by: Qii Wang <qii.wang@mediatek.com>
> ---
> 
> Changes in v2:
>         - Replied some comments
>         - Fixed the wrong spelling medaitek to mediatek
> 
>  drivers/i2c/busses/i2c-mt65xx.c | 19 ++++++++++++++++---
>  1 file changed, 16 insertions(+), 3 deletions(-)
> 

I haven't seen any new comments, can it go into 5.11?

Thanks

	Qii
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RESEND, V2] i2c: mediatek: Move suspend and resume handling to NOIRQ phase
  2021-01-26 11:37   ` Qii Wang
  (?)
@ 2021-01-28  9:54     ` Wolfram Sang
  -1 siblings, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2021-01-28  9:54 UTC (permalink / raw)
  To: Qii Wang
  Cc: matthias.bgg, linux-i2c, linux-arm-kernel, linux-kernel,
	linux-mediatek, srv_heupstream, leilk.liu

[-- Attachment #1: Type: text/plain, Size: 622 bytes --]

On Tue, Jan 26, 2021 at 07:37:00PM +0800, Qii Wang wrote:
> Hi Wolfram,
> 
> On Sat, 2021-01-09 at 16:29 +0800, qii.wang@mediatek.com wrote:
> > From: Qii Wang <qii.wang@mediatek.com>
> > 
> > Some i2c device driver indirectly uses I2C driver when it is now
> > being suspended. The i2c devices driver is suspended during the
> > NOIRQ phase and this cannot be changed due to other dependencies.
> > Therefore, we also need to move the suspend handling for the I2C
> > controller driver to the NOIRQ phase as well.
> > 
> > Signed-off-by: Qii Wang <qii.wang@mediatek.com>

Applied to for-current, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RESEND, V2] i2c: mediatek: Move suspend and resume handling to NOIRQ phase
@ 2021-01-28  9:54     ` Wolfram Sang
  0 siblings, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2021-01-28  9:54 UTC (permalink / raw)
  To: Qii Wang
  Cc: srv_heupstream, leilk.liu, linux-kernel, linux-mediatek,
	linux-i2c, matthias.bgg, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 622 bytes --]

On Tue, Jan 26, 2021 at 07:37:00PM +0800, Qii Wang wrote:
> Hi Wolfram,
> 
> On Sat, 2021-01-09 at 16:29 +0800, qii.wang@mediatek.com wrote:
> > From: Qii Wang <qii.wang@mediatek.com>
> > 
> > Some i2c device driver indirectly uses I2C driver when it is now
> > being suspended. The i2c devices driver is suspended during the
> > NOIRQ phase and this cannot be changed due to other dependencies.
> > Therefore, we also need to move the suspend handling for the I2C
> > controller driver to the NOIRQ phase as well.
> > 
> > Signed-off-by: Qii Wang <qii.wang@mediatek.com>

Applied to for-current, thanks!


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RESEND, V2] i2c: mediatek: Move suspend and resume handling to NOIRQ phase
@ 2021-01-28  9:54     ` Wolfram Sang
  0 siblings, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2021-01-28  9:54 UTC (permalink / raw)
  To: Qii Wang
  Cc: srv_heupstream, leilk.liu, linux-kernel, linux-mediatek,
	linux-i2c, matthias.bgg, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 622 bytes --]

On Tue, Jan 26, 2021 at 07:37:00PM +0800, Qii Wang wrote:
> Hi Wolfram,
> 
> On Sat, 2021-01-09 at 16:29 +0800, qii.wang@mediatek.com wrote:
> > From: Qii Wang <qii.wang@mediatek.com>
> > 
> > Some i2c device driver indirectly uses I2C driver when it is now
> > being suspended. The i2c devices driver is suspended during the
> > NOIRQ phase and this cannot be changed due to other dependencies.
> > Therefore, we also need to move the suspend handling for the I2C
> > controller driver to the NOIRQ phase as well.
> > 
> > Signed-off-by: Qii Wang <qii.wang@mediatek.com>

Applied to for-current, thanks!


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-01-28  9:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-09  8:29 [RESEND, V2] i2c: mediatek: Move suspend and resume handling to NOIRQ phase qii.wang
2021-01-09  8:29 ` qii.wang
2021-01-09  8:29 ` qii.wang
2021-01-26 11:37 ` Qii Wang
2021-01-26 11:37   ` Qii Wang
2021-01-26 11:37   ` Qii Wang
2021-01-28  9:54   ` Wolfram Sang
2021-01-28  9:54     ` Wolfram Sang
2021-01-28  9:54     ` Wolfram Sang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.