Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2241074pxb; Thu, 11 Feb 2021 07:44:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJwOWKDZMbqM0p3sHyneTS8RvY6LF1efunwKzUxmtDav7qtw+KRFoNf0YtQZE9ax5x4w064z X-Received: by 2002:a05:6402:19bd:: with SMTP id o29mr8803294edz.161.1613058286513; Thu, 11 Feb 2021 07:44:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613058286; cv=none; d=google.com; s=arc-20160816; b=Fsw4jJ7E99rycXgaKgSXc0PLMv9omj0e1JNS8Wn3vXoq71odn8lAILL+bGTA5uRI+x Dl9+9Nsxgypnrfr4ai+j020e3fu8gD9R4XufQNtL0W7ktKhp43u5LDJXtc9ifeFobvCD tVyGf0iNKZkmLyjw/44cIrlbAkdwZX1ashUEWdIsi7I3IacZpemGboOD4PbkfG53s+vz 3ZFXEHGKoBT3btTG2aqXyTKEtdVcpgz3XqRjVz2hSl4KHMk1E6klD5exRjiviJCuBdew SF8OWHq9mhu4MNdoRVMeUiDkey00P9W8p3c02/dfA6o8tz/ZeNdONswttKWRWFOy6UVd kVGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=u18KV83OfWt6q3SbWlN3ng08dzsjQzq83TtlUVXQKXM=; b=ChLuJL8mBXGepPg0Ebppyn3D7gp9RHxohuPYZ/jdzaAIEIvuJcsU3YeG1gHUrnf7FE qKkSeUkissIfGUvQv1Zx/pAv5ZCcoc5+5EBRMeSld5gKkUjbYj/buY0UZiok2gc7D4S3 9Anm6khwqlUoGirbjCkw9tnd8sYvzqXarW59+aP2a2S7a8at6uxONCejyBBZzH9vSFcC 2wUyfpfzGgJ24LGuRxA4CUbKCBWfE+8sJNtUKICISFKXVA+MqynMR6RNvVWN/mi7JMP4 a6d0zQdz5lVB1RicuSfJSBkNvy3JsLokAdlz2hMe6ArK6AeaSnv6XIakpkQNApwKM85e V4Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="S45x/Nfr"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o18si4081212edq.587.2021.02.11.07.44.16; Thu, 11 Feb 2021 07:44:46 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="S45x/Nfr"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231578AbhBKPn1 (ORCPT + 99 others); Thu, 11 Feb 2021 10:43:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:52062 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230020AbhBKPNT (ORCPT ); Thu, 11 Feb 2021 10:13:19 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 643A564EE6; Thu, 11 Feb 2021 15:04:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613055871; bh=V1IKRSGnn4ywBLad9z5xEwHymTivz5c2ZXpmKsej1yA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S45x/NfrM+tX4q+rqipFZITwVYzmZyRl2Hr8aci5/C61pazHWZnXh7alouED0AFwA Kt6WuF6mN0MRjDELWI9BK1kduvAC+dRAs5mTwuBo7wctkNSvI37DmCybnKnmaZWtln wmt2ZbFnkm8aHJ87h1jBMq0qJRygoPQHci2CMR5I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qii Wang , Wolfram Sang , Sasha Levin Subject: [PATCH 5.10 41/54] i2c: mediatek: Move suspend and resume handling to NOIRQ phase Date: Thu, 11 Feb 2021 16:02:25 +0100 Message-Id: <20210211150154.666016631@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210211150152.885701259@linuxfoundation.org> References: <20210211150152.885701259@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Qii Wang [ Upstream commit de96c3943f591018727b862f51953c1b6c55bcc3 ] 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 Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- 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 0818d3e507347..2ffd2f354d0ae 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 = { -- 2.27.0