From patchwork Wed Aug 19 19:54:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 7039151 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E3367C05AD for ; Wed, 19 Aug 2015 20:02:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0A078207BD for ; Wed, 19 Aug 2015 20:02:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 25D1A207C3 for ; Wed, 19 Aug 2015 20:02:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752118AbbHSUCU (ORCPT ); Wed, 19 Aug 2015 16:02:20 -0400 Received: from mail-wi0-f169.google.com ([209.85.212.169]:36148 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752102AbbHSUCT (ORCPT ); Wed, 19 Aug 2015 16:02:19 -0400 Received: by wicja10 with SMTP id ja10so128751459wic.1; Wed, 19 Aug 2015 13:02:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=XFN0gWuPo7CUvW2vqie7BbjWSt/F/7X//0ICfiT9ga4=; b=dCPXzGXk29iBES7P71/m4oQVZufBOynvpYGLXEx5vxNKzyE1PIqDf4Na8dd6BuVAyg TlrraAgaaglz5OwAizD7k0pYxKGGzXeXUyZ+peMODPKbtX7ueCzz0yX1KKAnigcvGqGb HdwZPMe/+fvVQFk2QKnwXjCjWEZqD0bo4FomXwLqhyt0pQhIalCh+Qpi9E+OB2tAIJCz WVZYA+rzUniynUXfgc6RYiR5LEcHGlmC1quDXjOdmKr/ZRfNoIWLyplKtFm3y6vZxPdu t/yyEPSmn+XhNKj4AeGnm5qaS4cx860EKxaUUXySpO5MBnbZLsJlM7zz2+qp3OEAM9Ja 5u7w== X-Received: by 10.180.103.132 with SMTP id fw4mr6406054wib.52.1440014537865; Wed, 19 Aug 2015 13:02:17 -0700 (PDT) Received: from ?IPv6:2003:62:5f33:d300:53:9625:5fd5:1dea? (p200300625F33D300005396255FD51DEA.dip0.t-ipconnect.de. [2003:62:5f33:d300:53:9625:5fd5:1dea]) by smtp.googlemail.com with ESMTPSA id gm20sm2426469wjc.17.2015.08.19.13.02.16 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 19 Aug 2015 13:02:17 -0700 (PDT) Message-ID: <55D4DF0C.8080104@gmail.com> Date: Wed, 19 Aug 2015 21:54:52 +0200 From: Heiner Kallweit User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Krzysztof Kozlowski CC: linux-samsung-soc@vger.kernel.org, "linux-spi@vger.kernel.org" Subject: [PATCH 2/3] spi: s3c64xx: extend driver to make full use of runtime PM autosuspend Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable 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 Extend the driver to make full use of runtime PM autosuspend. Before only the SPI core was instructed to use autosuspend by setting master->auto_runtime_pm. Nevertheless due to the missing pm_runtime_use_autosuspend call autosuspend wasn't active. Signed-off-by: Heiner Kallweit --- drivers/spi/spi-s3c64xx.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 8a6ab88..8365c88 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -32,6 +32,7 @@ #define MAX_SPI_PORTS 6 #define S3C64XX_SPI_QUIRK_POLL (1 << 0) #define S3C64XX_SPI_QUIRK_CS_AUTO (1 << 1) +#define AUTOSUSPEND_TIMEOUT 2000 /* Registers and bit-fields */ @@ -859,13 +860,15 @@ static int s3c64xx_spi_setup(struct spi_device *spi) } } - pm_runtime_put(&sdd->pdev->dev); + pm_runtime_mark_last_busy(&sdd->pdev->dev); + pm_runtime_put_autosuspend(&sdd->pdev->dev); if (!(sdd->port_conf->quirks & S3C64XX_SPI_QUIRK_CS_AUTO)) writel(S3C64XX_SPI_SLAVE_SIG_INACT, sdd->regs + S3C64XX_SPI_SLAVE_SEL); return 0; setup_exit: - pm_runtime_put(&sdd->pdev->dev); + pm_runtime_mark_last_busy(&sdd->pdev->dev); + pm_runtime_put_autosuspend(&sdd->pdev->dev); /* setup() returns with device de-selected */ if (!(sdd->port_conf->quirks & S3C64XX_SPI_QUIRK_CS_AUTO)) writel(S3C64XX_SPI_SLAVE_SIG_INACT, sdd->regs + S3C64XX_SPI_SLAVE_SEL); @@ -1180,6 +1183,8 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) S3C64XX_SPI_INT_TX_OVERRUN_EN | S3C64XX_SPI_INT_TX_UNDERRUN_EN, sdd->regs + S3C64XX_SPI_INT_EN); + pm_runtime_set_autosuspend_delay(&pdev->dev, AUTOSUSPEND_TIMEOUT); + pm_runtime_use_autosuspend(&pdev->dev); pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); @@ -1195,6 +1200,9 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) mem_res, (FIFO_LVL_MASK(sdd) >> 1) + 1, sdd->rx_dma.dmach, sdd->tx_dma.dmach); + pm_runtime_mark_last_busy(&pdev->dev); + pm_runtime_autosuspend(&pdev->dev); + return 0; err4: