From patchwork Tue Aug 18 21:06:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 7033681 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 F1620C05AC for ; Tue, 18 Aug 2015 21:08:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2DD0020528 for ; Tue, 18 Aug 2015 21:08:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 47073207EF for ; Tue, 18 Aug 2015 21:08:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753941AbbHRVI3 (ORCPT ); Tue, 18 Aug 2015 17:08:29 -0400 Received: from mail-wi0-f181.google.com ([209.85.212.181]:33710 "EHLO mail-wi0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753098AbbHRVI2 (ORCPT ); Tue, 18 Aug 2015 17:08:28 -0400 Received: by wijp15 with SMTP id p15so110662690wij.0; Tue, 18 Aug 2015 14:08:26 -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=FF8Aqhd5Yg3RU6IoB8BMs00WaqG21ykAUkv2Jswtnkw=; b=WeziY0sXF+tSlPha6p8jzPOuayOlxoJQw+hiyfstsX913eO8LT9KbWLYuCNAqlq3Iz m9tLhSV3RXpndX5jAGxmPMkJQiz26gCEGnx+KKrFMJRfGytvJKYbivJj4j4qoY6cFO4a lLoFxp4CjevRB47bzAMBLGRAELT9rjywQYTtRNL2pZWVzwoCvd6c6xDEHUYxdOR6R+hi 3Kjcu6VKJTAc5+2fRZ9WHcp1YQPOPdgupcVAPPdSQpqsXaq0XkdjM7THkbCpWCO/ZL8P 1v4NW1TBgHvB2ZEEm46RxxrOApIfam4WW8GZwkbYwnGw+1OzYIHynoVIMqsz1ukivfc9 mV9w== X-Received: by 10.194.142.237 with SMTP id rz13mr17487709wjb.48.1439932106862; Tue, 18 Aug 2015 14:08:26 -0700 (PDT) Received: from ?IPv6:2003:62:5f33:d300:704e:482e:50f5:2dd? (p200300625F33D300704E482E50F502DD.dip0.t-ipconnect.de. [2003:62:5f33:d300:704e:482e:50f5:2dd]) by smtp.googlemail.com with ESMTPSA id w8sm22998752wiy.10.2015.08.18.14.08.26 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 18 Aug 2015 14:08:26 -0700 (PDT) Message-ID: <55D39E41.8010908@gmail.com> Date: Tue, 18 Aug 2015 23:06:09 +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: linux-samsung-soc@vger.kernel.org CC: "linux-spi@vger.kernel.org" , Krzysztof Kozlowski Subject: [PATCH 2/3] spi: s3c64xx: fix runtime PM handling 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.2 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 The patch fixes / extends the runtime PM handling. - Currently the driver instructs the SPI core to use auto-suspend but doesn't configure it. Add the necessary calls and let it autosuspend after probe. - In case the driver registration fails runtime PM needs to be properly disabled. Signed-off-by: Heiner Kallweit --- drivers/spi/spi-s3c64xx.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index c4d3b06..15a6de1 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 */ @@ -1180,13 +1181,15 @@ 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(dev, AUTOSUSPEND_TIMEOUT); + pm_runtime_use_autosuspend(dev); pm_runtime_set_active(dev); pm_runtime_enable(dev); ret = devm_spi_register_master(dev, master); if (ret != 0) { dev_err(dev, "cannot register SPI master: %d\n", ret); - goto err3; + goto err4; } dev_dbg(dev, "Samsung SoC SPI Driver loaded for Bus SPI-%d with %d Slaves attached\n", @@ -1195,8 +1198,14 @@ 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(dev); + pm_runtime_autosuspend(dev); + return 0; +err4: + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); err3: clk_disable_unprepare(sdd->src_clk); err2: