From patchwork Mon May 2 12:14:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pramod Gurav X-Patchwork-Id: 67009 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp6569qge; Mon, 2 May 2016 05:14:29 -0700 (PDT) X-Received: by 10.66.180.111 with SMTP id dn15mr50531805pac.69.1462191269715; Mon, 02 May 2016 05:14:29 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h85si35015095pfj.72.2016.05.02.05.14.29; Mon, 02 May 2016 05:14:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-spi-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753213AbcEBMOU (ORCPT + 1 other); Mon, 2 May 2016 08:14:20 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:34004 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753145AbcEBMOR (ORCPT ); Mon, 2 May 2016 08:14:17 -0400 Received: by mail-pa0-f44.google.com with SMTP id r5so74751001pag.1 for ; Mon, 02 May 2016 05:14:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=n2EGj8znSY5XjBt67YT/NqEosvhBev/BuRA4mZ/cuvY=; b=WQlAbF9bOfst/dpFYLr+I6V7xeCi4nw5/SIEZhYBRQgxl+b+saINCambfwU7/mqhjQ ez/5de0TtZ+8bE0WEPR3FalnoNYKNiKHflQsrs+cGITjzMgdiaKsoFlqlJ5YtyewhYto oYWTTiQAaT6U5Fiu036+kazAuRqoLbxYmWDU4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=n2EGj8znSY5XjBt67YT/NqEosvhBev/BuRA4mZ/cuvY=; b=Luj+yy+wKJo4DgaJK8jAwc4IoTjCya3SYuSFxyHAlsqlA4HLcxePrnnjhA0XWYw5sQ fERuV+AUpaXVE5l5/bUTNGL4LqoXMcrabBF4cot4rAva9pA82HxhhIe1mn6HdLWZlpNQ vY4jps4tfN4w+GoQ7mdGAtN5RwYUP9rDGUlTI9rmDeBy8aptFM/dV29B0ODCgQhmQWIl q+2mFYj+J67jE3AbwkRjm/YalyXnh9QVObZsvGcJWQiXUNKUCXzf5ynjk8kqzDCcsQLP VI+NlZypaNLFBNeYkMIhuC713+ZpuNLczYzGMsUKfPz2PPc5NNJ2ZbSUKCZBoT1/dS+a F3FQ== X-Gm-Message-State: AOPr4FU7ArYqY5HZTQ0NtGbQTfwVgsagneeh+loAN5nO7831NU05bzlCQyLkvSb8giqwbyZR X-Received: by 10.66.72.198 with SMTP id f6mr52016243pav.60.1462191256533; Mon, 02 May 2016 05:14:16 -0700 (PDT) Received: from blr-ubuntu-56.ap.qualcomm.com ([202.46.23.61]) by smtp.gmail.com with ESMTPSA id z63sm44996392pfb.47.2016.05.02.05.14.12 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 May 2016 05:14:15 -0700 (PDT) From: Pramod Gurav To: broonie@kernel.org, rjw@rjwysocki.net, ulf.hansson@linaro.org, andy.gross@linaro.org Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Pramod Gurav Subject: [PATCH 1/2] spi: qup: Handle clocks in pm_runtime suspend and resume Date: Mon, 2 May 2016 17:44:03 +0530 Message-Id: <1462191244-30758-1-git-send-email-pramod.gurav@linaro.org> X-Mailer: git-send-email 1.8.2.1 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Clocks must ne disabled in pm_runtime to achieve some power saving. Enable the clocks when the device is runtime resumed during a transfer. Signed-off-by: Pramod Gurav --- drivers/spi/spi-qup.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 1.8.2.1 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c index 810a7fa..e42ff61 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c @@ -937,6 +937,10 @@ static int spi_qup_pm_suspend_runtime(struct device *device) config = readl(controller->base + QUP_CONFIG); config |= QUP_CONFIG_CLOCK_AUTO_GATE; writel_relaxed(config, controller->base + QUP_CONFIG); + + clk_disable_unprepare(controller->cclk); + clk_disable_unprepare(controller->iclk); + return 0; } @@ -945,6 +949,15 @@ static int spi_qup_pm_resume_runtime(struct device *device) struct spi_master *master = dev_get_drvdata(device); struct spi_qup *controller = spi_master_get_devdata(master); u32 config; + int ret; + + ret = clk_prepare_enable(controller->iclk); + if (ret) + return ret; + + ret = clk_prepare_enable(controller->cclk); + if (ret) + return ret; /* Disable clocks auto gaiting */ config = readl_relaxed(controller->base + QUP_CONFIG);