Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp274839pxb; Wed, 18 Nov 2020 04:20:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJyNrbNSEY09rt73dng7bMmhzq+rYaN2GoGpoeT1NATEg3FIYfaWYH3MrloltnDy9s/gH3eO X-Received: by 2002:a17:906:17d1:: with SMTP id u17mr23491574eje.6.1605702032238; Wed, 18 Nov 2020 04:20:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605702032; cv=none; d=google.com; s=arc-20160816; b=jBrkXuDftHQVZrsaJoUcpPvLrADlj34Pmm2L1Y6EZbGpeha6apjVuQqkk4uMBbrIhb R0WjfUODXY1NMtUcocphN92pnFxZjJWQF0ieU+THtfKGrvmZvb9RSCYoUAFcoMkE57Vb vaM/Tn8VkFDiP2CVG1p49E+YMi8tKwmFeE9nwo+5CGf/HIIfYQhflgKMP04epwgQ2vR1 Rn15UsSYavC7yCGlfzb8wuJGybPMTA8FQmuZNlnYh2Ifuv1+75GRSyafuMnSs9xO+PxS WVTNBpPzpkD5H54J5g82suI53Vs9I4blv/b5W9OVfjZHrSdh0UdEo2RIqn+/FNWSMT43 kVKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=Olmzrw3j47dBYcK4FHztPMrUw3IIS817jEhTnmhDj0s=; b=jEUwJ9iDKhgwG8SY6KYxouC7Fzt1qyqKtE5bSgjtZHqq8uZUwNr/Nd4xHMpfA1HkfJ xgsj9U3/k/BKT/RfgXg/NT5LckPgSw0FIE/t4kSMZEzcWArKcUjQLuoXzboqjAueXcKg 2EiBX4zXDEP0Lq1LeGynPS37KglvMYK4u8J63jABpj8EPo38HLY8r+lzTBt8BeiIumxc N5ipEnnH5+GzoYDR4bHHAmujnB+Mg0okNvCj8/B/Y2F57QsNRAmR0nikM1zksLo3AplH aMHqPGBnqg9tJo6n6NfzNfYJsd4ZsijjgxljOqvAKu54ZEvfm2l83gS20wZca0AugN2S MO1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s4si15536745edy.473.2020.11.18.04.20.09; Wed, 18 Nov 2020 04:20:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727901AbgKRMSA (ORCPT + 99 others); Wed, 18 Nov 2020 07:18:00 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:50470 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726740AbgKRMSA (ORCPT ); Wed, 18 Nov 2020 07:18:00 -0500 X-UUID: 3cde5d8ece844de3bde8ac6e0bf150e1-20201118 X-UUID: 3cde5d8ece844de3bde8ac6e0bf150e1-20201118 Received: from mtkcas08.mediatek.inc [(172.21.101.126)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 107496916; Wed, 18 Nov 2020 20:17:55 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 18 Nov 2020 20:17:53 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 18 Nov 2020 20:17:53 +0800 From: To: CC: , , , , , , , Subject: [v2] i2c: mediatek: Move suspend and resume handling to NOIRQ phase Date: Wed, 18 Nov 2020 20:17:41 +0800 Message-ID: <1605701861-30800-1-git-send-email-qii.wang@mediatek.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Qii Wang 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 --- Changes in v2: - fix 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 33de99b..6f61595 100644 --- a/drivers/i2c/busses/i2c-mt65xx.c +++ b/drivers/i2c/busses/i2c-mt65xx.c @@ -1258,7 +1258,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); @@ -1285,7 +1286,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); @@ -1300,12 +1310,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