Skip to content

Commit de96c39

Browse files
Qii Wangwsakernel
authored andcommitted
i2c: mediatek: Move suspend and resume handling to NOIRQ phase
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> Signed-off-by: Wolfram Sang <wsa@kernel.org>
1 parent 6ee1d74 commit de96c39

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

drivers/i2c/busses/i2c-mt65xx.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,7 +1275,8 @@ static int mtk_i2c_probe(struct platform_device *pdev)
12751275
mtk_i2c_clock_disable(i2c);
12761276

12771277
ret = devm_request_irq(&pdev->dev, irq, mtk_i2c_irq,
1278-
IRQF_TRIGGER_NONE, I2C_DRV_NAME, i2c);
1278+
IRQF_NO_SUSPEND | IRQF_TRIGGER_NONE,
1279+
I2C_DRV_NAME, i2c);
12791280
if (ret < 0) {
12801281
dev_err(&pdev->dev,
12811282
"Request I2C IRQ %d fail\n", irq);
@@ -1302,7 +1303,16 @@ static int mtk_i2c_remove(struct platform_device *pdev)
13021303
}
13031304

13041305
#ifdef CONFIG_PM_SLEEP
1305-
static int mtk_i2c_resume(struct device *dev)
1306+
static int mtk_i2c_suspend_noirq(struct device *dev)
1307+
{
1308+
struct mtk_i2c *i2c = dev_get_drvdata(dev);
1309+
1310+
i2c_mark_adapter_suspended(&i2c->adap);
1311+
1312+
return 0;
1313+
}
1314+
1315+
static int mtk_i2c_resume_noirq(struct device *dev)
13061316
{
13071317
int ret;
13081318
struct mtk_i2c *i2c = dev_get_drvdata(dev);
@@ -1317,12 +1327,15 @@ static int mtk_i2c_resume(struct device *dev)
13171327

13181328
mtk_i2c_clock_disable(i2c);
13191329

1330+
i2c_mark_adapter_resumed(&i2c->adap);
1331+
13201332
return 0;
13211333
}
13221334
#endif
13231335

13241336
static const struct dev_pm_ops mtk_i2c_pm = {
1325-
SET_SYSTEM_SLEEP_PM_OPS(NULL, mtk_i2c_resume)
1337+
SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mtk_i2c_suspend_noirq,
1338+
mtk_i2c_resume_noirq)
13261339
};
13271340

13281341
static struct platform_driver mtk_i2c_driver = {

0 commit comments

Comments
 (0)