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: 9478761 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 B090D60830 for ; Sat, 17 Dec 2016 01:00:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A183C286B0 for ; Sat, 17 Dec 2016 01:00:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 965902870F; Sat, 17 Dec 2016 01:00:03 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13AB028724 for ; Sat, 17 Dec 2016 01:00:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761705AbcLQBAB (ORCPT ); Fri, 16 Dec 2016 20:00:01 -0500 Received: from mail-pg0-f50.google.com ([74.125.83.50]:33952 "EHLO mail-pg0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761675AbcLQA74 (ORCPT ); Fri, 16 Dec 2016 19:59:56 -0500 Received: by mail-pg0-f50.google.com with SMTP id a1so14732990pgf.1 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=VnO7700HBvehTk0zYEvVzVZFouZKnkzYpY0zNGah7O3Vp0Ss6a8cYDhzRCpv2cr3An EQni+Jk0GC1JzehKvELreEbbgg7Rug6nTn6nKq1ZOtguv7aajDj6xwnX0JalrTnK6I/m ClwZyATUvBlpK9SjPBeTHd7X5+/zpUbemnFJMfRbEiqaON7jVBPW4fomCyGSjAa9hoPV LQTzjbNeTExiOhupzFbq76occuzFU+yttg3MsHVHI5zNXr2Dio1u5415VUwawYcbCOTb LoZdcJBYMYrJBOg8bq6nWrJD93ODjclIibBCbrdgqzkBFrK+T/5oVOi7P1c0JCDbLGlP vPiw== X-Gm-Message-State: AKaTC01ZnLObCkBmIyuyijN0aZa8KuelHeAwm1/SxeRH5FjV/FQ0cqw1GOOw1lbNX/XsWDeL 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 Cc: linux-spi@vger.kernel.org, Caesar Wang , Brian Norris , linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, 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 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.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)