From patchwork Sat Dec 17 00:59:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 9478763 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B8ED460827 for ; Sat, 17 Dec 2016 01:00:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A93B2286B0 for ; Sat, 17 Dec 2016 01:00:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D1AF2871B; Sat, 17 Dec 2016 01:00:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 57BD3286B0 for ; Sat, 17 Dec 2016 01:00:24 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cI3MJ-0004I6-HY; Sat, 17 Dec 2016 01:00:19 +0000 Received: from mail-pg0-x234.google.com ([2607:f8b0:400e:c05::234]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cI3MH-0003JV-Lr for linux-rockchip@lists.infradead.org; Sat, 17 Dec 2016 01:00:18 +0000 Received: by mail-pg0-x234.google.com with SMTP id p66so37689992pga.2 for ; Fri, 16 Dec 2016 16:59:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=sGGfGjdArROFPRU01u/7wobbMbkLchd2E/0qrG+ky3w=; b=FhGycA/cfxD3NapXwW4klWFHFtOjEOWCv3BdCZuL29eFVTQjwfDPPvl8a8A3kh0lYr NGePKmqgmO3kkHAspC+IfgWwdzVifzItbw8z9gCmmEl+QGs3sGCpfqYPDqSObXZi8hdK bH3PG3Zr73QLgMz1S2fPnbXRpmDzWvshtrehM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=sGGfGjdArROFPRU01u/7wobbMbkLchd2E/0qrG+ky3w=; b=dkvWQgLZAVZRyk9oPe+RozQBsN9kyEnigUqWHaUAv0k4+mTzshu12nALUyswaU9BfM LesyzKYHseCHVfLjlwBzfTzFOfEtYicfMy7W9JDmGC4r+3Jw6Nk05q+5xENDLFB/FsSi Nj/ILvmdoWYFZE4rGEogawzfrMjGGK+xnqZp1jngy1g65hrl8lMnJGYWezsatJjgjFsV uBtT2dUB/KtP/EiIQQmb/pUvFXK3ekgzsZ6rkK69VsCJz62LDY1BHBzQXEnmSgQD+ZgB Cmlra8HscIUrnEFrlT3vjXVgccjcHiKucENStH9XxzvDPZp1zHM6toZD9/tIXi56iati FvkQ== X-Gm-Message-State: AKaTC03S2sj/AmmRf2uTIcpQ1wW5XcCotrK6SDnqwX8R14eNo4XfWrPT5hM+3OwXjsLt+9vV X-Received: by 10.84.216.80 with SMTP id f16mr12535373plj.91.1481936395939; Fri, 16 Dec 2016 16:59:55 -0800 (PST) Received: from ban.mtv.corp.google.com ([172.22.64.120]) by smtp.gmail.com with ESMTPSA id i124sm14482373pgd.15.2016.12.16.16.59.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 16 Dec 2016 16:59:55 -0800 (PST) From: Brian Norris To: Mark Brown Subject: [PATCH] spi: rockchip: support "sleep" pin configuration Date: Fri, 16 Dec 2016 16:59:16 -0800 Message-Id: <1481936356-76161-1-git-send-email-briannorris@chromium.org> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161216_170017_801109_F2ACC65F X-CRM114-Status: UNSURE ( 9.48 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Brian Norris , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-rockchip@lists.infradead.org, Caesar Wang MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP In the pattern of many other devices, support a system-sleep pin configuration. Signed-off-by: Brian Norris Reviewed-by: Douglas Anderson Tested-by: Caesar Wang Acked-by: Rob Herring --- Documentation/devicetree/bindings/spi/spi-rockchip.txt | 7 +++++++ drivers/spi/spi-rockchip.c | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/spi/spi-rockchip.txt b/Documentation/devicetree/bindings/spi/spi-rockchip.txt index d2ca153614f9..83da4931d832 100644 --- a/Documentation/devicetree/bindings/spi/spi-rockchip.txt +++ b/Documentation/devicetree/bindings/spi/spi-rockchip.txt @@ -31,6 +31,10 @@ Optional Properties: - rx-sample-delay-ns: nanoseconds to delay after the SCLK edge before sampling Rx data (may need to be fine tuned for high capacitance lines). No delay (0) by default. +- pinctrl-names: Names for the pin configuration(s); may be "default" or + "sleep", where the "sleep" configuration may describe the state + the pins should be in during system suspend. See also + pinctrl/pinctrl-bindings.txt. Example: @@ -46,4 +50,7 @@ Example: interrupts = ; clocks = <&cru SCLK_SPI0>, <&cru PCLK_SPI0>; clock-names = "spiclk", "apb_pclk"; + pinctrl-0 = <&spi1_pins>; + pinctrl-1 = <&spi1_sleep>; + pinctrl-names = "default", "sleep"; }; diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index 0f89c2169c24..acf31f36b898 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -843,6 +844,8 @@ static int rockchip_spi_suspend(struct device *dev) clk_disable_unprepare(rs->apb_pclk); } + pinctrl_pm_select_sleep_state(dev); + return ret; } @@ -852,6 +855,8 @@ static int rockchip_spi_resume(struct device *dev) struct spi_master *master = dev_get_drvdata(dev); struct rockchip_spi *rs = spi_master_get_devdata(master); + pinctrl_pm_select_default_state(dev); + if (!pm_runtime_suspended(dev)) { ret = clk_prepare_enable(rs->apb_pclk); if (ret < 0)