From patchwork Tue Dec 17 20:44:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Gorski X-Patchwork-Id: 3365611 X-Patchwork-Delegate: broonie@sirena.org.uk 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 5D2ECC0D4A for ; Tue, 17 Dec 2013 20:46:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9A3702017A for ; Tue, 17 Dec 2013 20:46:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D8090203AD for ; Tue, 17 Dec 2013 20:46:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753910Ab3LQUpE (ORCPT ); Tue, 17 Dec 2013 15:45:04 -0500 Received: from arrakis.dune.hu ([78.24.191.176]:55048 "EHLO arrakis.dune.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753872Ab3LQUpD (ORCPT ); Tue, 17 Dec 2013 15:45:03 -0500 Received: from localhost (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 655962800A9; Tue, 17 Dec 2013 21:42:45 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Virus-Scanned: at arrakis.dune.hu Received: from shaker64.lan (dslb-088-073-137-004.pools.arcor-ip.net [88.73.137.4]) by arrakis.dune.hu (Postfix) with ESMTPSA id 7658F28146E; Tue, 17 Dec 2013 21:42:44 +0100 (CET) From: Jonas Gorski To: linux-spi@vger.kernel.org Cc: Mark Brown , Maxime Bizon , Florian Fainelli , Kevin Cernekee Subject: [PATCH 3/3] spi/bcm63xx-hsspi: fix pm sleep support Date: Tue, 17 Dec 2013 21:44:48 +0100 Message-Id: <1387313088-22493-4-git-send-email-jogo@openwrt.org> X-Mailer: git-send-email 1.8.5.1 In-Reply-To: <1387313088-22493-1-git-send-email-jogo@openwrt.org> References: <1387313088-22493-1-git-send-email-jogo@openwrt.org> 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 Use the right CONFIG symbol to guard, properly (un)preprare clocks on suspend/resume, and check the result of it. Signed-off-by: Jonas Gorski --- drivers/spi/spi-bcm63xx-hsspi.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/spi/spi-bcm63xx-hsspi.c b/drivers/spi/spi-bcm63xx-hsspi.c index 1721ea9..b528f9f 100644 --- a/drivers/spi/spi-bcm63xx-hsspi.c +++ b/drivers/spi/spi-bcm63xx-hsspi.c @@ -425,14 +425,14 @@ static int bcm63xx_hsspi_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM +#ifdef CONFIG_PM_SLEEP static int bcm63xx_hsspi_suspend(struct device *dev) { struct spi_master *master = dev_get_drvdata(dev); struct bcm63xx_hsspi *bs = spi_master_get_devdata(master); spi_master_suspend(master); - clk_disable(bs->clk); + clk_disable_unprepare(bs->clk); return 0; } @@ -441,30 +441,27 @@ static int bcm63xx_hsspi_resume(struct device *dev) { struct spi_master *master = dev_get_drvdata(dev); struct bcm63xx_hsspi *bs = spi_master_get_devdata(master); + int ret; + + ret = clk_prepare_enable(bs->clk); + if (ret) + return ret; - clk_enable(bs->clk); spi_master_resume(master); return 0; } +#endif static const struct dev_pm_ops bcm63xx_hsspi_pm_ops = { - .suspend = bcm63xx_hsspi_suspend, - .resume = bcm63xx_hsspi_resume, + SET_SYSTEM_SLEEP_PM_OPS(bcm63xx_hsspi_suspend, bcm63xx_hsspi_resume) }; -#define BCM63XX_HSSPI_PM_OPS (&bcm63xx_hsspi_pm_ops) -#else -#define BCM63XX_HSSPI_PM_OPS NULL -#endif - - - static struct platform_driver bcm63xx_hsspi_driver = { .driver = { .name = "bcm63xx-hsspi", .owner = THIS_MODULE, - .pm = BCM63XX_HSSPI_PM_OPS, + .pm = &bcm63xx_hsspi_pm_ops, }, .probe = bcm63xx_hsspi_probe, .remove = bcm63xx_hsspi_remove,