From patchwork Wed Mar 5 01:58:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenyou Yang X-Patchwork-Id: 3769861 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C15B0BF13A for ; Wed, 5 Mar 2014 02:08:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E1E0120225 for ; Wed, 5 Mar 2014 02:08:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 175BF20220 for ; Wed, 5 Mar 2014 02:08:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756640AbaCECIa (ORCPT ); Tue, 4 Mar 2014 21:08:30 -0500 Received: from nasmtp02.atmel.com ([204.2.163.16]:44455 "EHLO SJOEDG01.corp.atmel.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755628AbaCECI3 (ORCPT ); Tue, 4 Mar 2014 21:08:29 -0500 X-Greylist: delayed 308 seconds by postgrey-1.27 at vger.kernel.org; Tue, 04 Mar 2014 21:08:29 EST Received: from apsmtp01.atmel.com (10.168.254.31) by sjoedg01.corp.atmel.com (10.64.253.30) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 4 Mar 2014 18:03:20 -0800 Received: from shaarm01.corp.atmel.com (10.168.254.13) by apsmtp01.atmel.com (10.168.254.31) with Microsoft SMTP Server id 14.2.347.0; Wed, 5 Mar 2014 10:13:21 +0800 From: Wenyou Yang To: , , , , , , , , CC: , , , , Subject: [PATCH 1/2] spi: atmel: adopt pinctrl support Date: Wed, 5 Mar 2014 09:58:49 +0800 Message-ID: <1393984730-14828-2-git-send-email-wenyou.yang@atmel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1393984730-14828-1-git-send-email-wenyou.yang@atmel.com> References: <1393984730-14828-1-git-send-email-wenyou.yang@atmel.com> MIME-Version: 1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,KHOP_BIG_TO_CC, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Amend the spi atmel pin controller to optionally take a pin control handle and set the state of the pins to: - "default" on boot, resume and before performing an spitransfer - "sleep" on suspend() This should make it possible to optimize energy usage for the pins both for the suspend/resume cycle Signed-off-by: Wenyou Yang --- drivers/spi/spi-atmel.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index b0842f7..54b4436 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -26,6 +26,7 @@ #include #include +#include /* SPI register offsets */ #define SPI_CR 0x0000 @@ -1303,6 +1304,9 @@ static int atmel_spi_probe(struct platform_device *pdev) struct spi_master *master; struct atmel_spi *as; + /* Select default pin state */ + pinctrl_pm_select_default_state(&pdev->dev); + regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!regs) return -ENXIO; @@ -1457,6 +1461,9 @@ static int atmel_spi_suspend(struct device *dev) struct atmel_spi *as = spi_master_get_devdata(master); clk_disable_unprepare(as->clk); + + pinctrl_pm_select_sleep_state(dev); + return 0; } @@ -1465,6 +1472,8 @@ static int atmel_spi_resume(struct device *dev) struct spi_master *master = dev_get_drvdata(dev); struct atmel_spi *as = spi_master_get_devdata(master); + pinctrl_pm_select_default_state(dev); + clk_prepare_enable(as->clk); return 0; }