Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp574308pxb; Tue, 15 Feb 2022 22:33:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJzFP/E/Y7b06LHSsNa/nvWpp7x0aVRHoXrrUOkvUyicxfQJA30TAQ4NyjUEFbkzzSr+qJKA X-Received: by 2002:aa7:8882:0:b0:4df:7b9e:1ccb with SMTP id z2-20020aa78882000000b004df7b9e1ccbmr1573211pfe.41.1644993189951; Tue, 15 Feb 2022 22:33:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644993189; cv=none; d=google.com; s=arc-20160816; b=XTgoXE6X/zizxj1gkgDEcj0c9w626ayoPyPN/JLjfMzRpVmYR0iDGLE0bJgeIh2IZS tUL8FrwfBI3UfC1vupTe8RbVpajV5GQKkI1RUaYRRmOgrf3/5h8XOFP2U2R7t7OFfK6y LFnzHVrrwivuz84faFBgayQgQH/yxZQL/72uHyUAT19We07ZfTUMF9pWNTUQVE1SEQhZ Pq/qfgydYApsAmoXCSzTnPRFuBCUiypBiu9sA5HNnyM/TCCicXXaC6pFKgpy4WsBnNYW K+8srLRMj6C9mtI9QeAUjqQFMIPFlHRkH09hrOVLz4NYbdLRTx16Lpd1Wwp9mK/1hDjO B2Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=4hPajIo+APgOcYpLPqcFReC8Hy8Cb2hAjxaMxQNgGQA=; b=a1ZQJC3DMhGSSBI/Y5jv17jiPdl186fVEaDyR4u1D6tEaYRTpVsbq+0r/qAr/E/JGj ryHSDTLr+ybgQmYaOAEXgUkO+aCKrQCJNHa57oylVKl6JJKzDpXj3DZDCC0z3n1m3C+S sO1B/XKXv9dq4XO1LKDnCov6mFQ++mbbnR1Qk031t9y04wOtkcbDaGH3NUzVSuqNphN6 PTcuMdUaGEkvY/BaPnc/PTNi2hkHE0bXf35vYt7rulyOdR6EbUgIY5gK6dLn5mw65Vwp 1SMpDvNOvnLs/UEgKn4RSSm+Z893xxX8eAL+dVxztuQnoizmm5LCauvkJt07gCWV3OaG 6qzg== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=rock-chips.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id q20si3897438plk.249.2022.02.15.22.33.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 22:33:09 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=rock-chips.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B065E1D9DE9; Tue, 15 Feb 2022 22:26:17 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245704AbiBPBlU (ORCPT + 99 others); Tue, 15 Feb 2022 20:41:20 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245577AbiBPBks (ORCPT ); Tue, 15 Feb 2022 20:40:48 -0500 Received: from mail-m17640.qiye.163.com (mail-m17640.qiye.163.com [59.111.176.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A98FF237CA; Tue, 15 Feb 2022 17:40:37 -0800 (PST) Received: from localhost.localdomain (unknown [58.22.7.114]) by mail-m17640.qiye.163.com (Hmail) with ESMTPA id ADA055402AF; Wed, 16 Feb 2022 09:40:35 +0800 (CST) From: Jon Lin To: broonie@kernel.org Cc: heiko@sntech.de, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, shengfei Xu , Jon Lin Subject: [PATCH v3 5/6] spi: rockchip: Suspend and resume the bus during NOIRQ_SYSTEM_SLEEP_PM ops Date: Wed, 16 Feb 2022 09:40:27 +0800 Message-Id: <20220216014028.8123-6-jon.lin@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220216014028.8123-1-jon.lin@rock-chips.com> References: <20220216014028.8123-1-jon.lin@rock-chips.com> X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgPGg8OCBgUHx5ZQUlOS1dZCBgUCR5ZQVlLVUtZV1 kWDxoPAgseWUFZKDYvK1lXWShZQUhPN1dZLVlBSVdZDwkaFQgSH1lBWRlCSUpWQhkeTRkfQk5CSE JMVRMBExYaEhckFA4PWVdZFhoPEhUdFFlBWVVLWQY+ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6KxA6FDo6DD5PNBYjLg8TGRQj OBhPCxhVSlVKTU9PQkxOTUhNSU9DVTMWGhIXVREUFVUXEhU7CRQYEFYYExILCFUYFBZFWVdZEgtZ QVlOQ1VJSVVMVUpKT1lXWQgBWUFISUlDNwY+ X-HM-Tid: 0a7f00303e18d995kuwsada055402af X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SORBS_WEB, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: shengfei Xu the wakeup interrupt handler which is guaranteed not to run while @resume noirq() is being executed. the patch can help to avoid the wakeup source try to access spi when the spi is in suspend mode. Signed-off-by: shengfei Xu Signed-off-by: Jon Lin --- Changes in v3: None Changes in v2: None Changes in v1: None drivers/spi/spi-rockchip.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index 83da8fdb3c02..8b4d56ee2193 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -964,14 +964,14 @@ static int rockchip_spi_suspend(struct device *dev) { int ret; struct spi_controller *ctlr = dev_get_drvdata(dev); + struct rockchip_spi *rs = spi_controller_get_devdata(ctlr); ret = spi_controller_suspend(ctlr); if (ret < 0) return ret; - ret = pm_runtime_force_suspend(dev); - if (ret < 0) - return ret; + clk_disable_unprepare(rs->spiclk); + clk_disable_unprepare(rs->apb_pclk); pinctrl_pm_select_sleep_state(dev); @@ -986,10 +986,14 @@ static int rockchip_spi_resume(struct device *dev) pinctrl_pm_select_default_state(dev); - ret = pm_runtime_force_resume(dev); + ret = clk_prepare_enable(rs->apb_pclk); if (ret < 0) return ret; + ret = clk_prepare_enable(rs->spiclk); + if (ret < 0) + clk_disable_unprepare(rs->apb_pclk); + ret = spi_controller_resume(ctlr); if (ret < 0) { clk_disable_unprepare(rs->spiclk); @@ -1031,7 +1035,7 @@ static int rockchip_spi_runtime_resume(struct device *dev) #endif /* CONFIG_PM */ static const struct dev_pm_ops rockchip_spi_pm = { - SET_SYSTEM_SLEEP_PM_OPS(rockchip_spi_suspend, rockchip_spi_resume) + SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(rockchip_spi_suspend, rockchip_spi_resume) SET_RUNTIME_PM_OPS(rockchip_spi_runtime_suspend, rockchip_spi_runtime_resume, NULL) }; -- 2.17.1