From patchwork Mon Nov 14 11:15:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 9427237 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8B7A66047D for ; Mon, 14 Nov 2016 11:16:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D8CE28697 for ; Mon, 14 Nov 2016 11:16:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 720D8286BB; Mon, 14 Nov 2016 11:16:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20BC328697 for ; Mon, 14 Nov 2016 11:16:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932211AbcKNLQM (ORCPT ); Mon, 14 Nov 2016 06:16:12 -0500 Received: from mail-wm0-f46.google.com ([74.125.82.46]:36400 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753242AbcKNLQK (ORCPT ); Mon, 14 Nov 2016 06:16:10 -0500 Received: by mail-wm0-f46.google.com with SMTP id g23so91575664wme.1 for ; Mon, 14 Nov 2016 03:16:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=H98ppNWNQKYHOMg7GNoi35rtXuBu2iCguhfyYK6VJBc=; b=eMnsNPcJpWaPVFVJgf7OuyuP+b1dY1HOncdJgvONaz26GUVEJecjb5GE+mgYS60KXh cv2yhnaJen02rnv2TBvvFMRN5SyZr19MAz0RtK122u4GVwYgUUuNhc1wiPvczxqlAU3S Gy4F3zyazwYTEGEmXS7SS2JdoSQOFnkamHMX4= 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:in-reply-to :references; bh=H98ppNWNQKYHOMg7GNoi35rtXuBu2iCguhfyYK6VJBc=; b=fHVLP7vfAXOmqPvk699D6OngxoJlH6IZ6jk8bdGp65nkZggheT4BrrHgTQBxAnh9T8 Vm8UWPar0OH67Whg8NGL+sQxiZhnXkuTfEmOBxIN8th+C9O4264mPVqA3llMohCUE3iK T1uYSvbAyRcpG7gKgRtzBzJu6/3RB5Rsz2xDf9teFGtHzBp3n2T/KweGKdmT8eAuGavL R1zupFIAIJMzpPCqI5X1ATUW7Hf0mvjODw3r59CXaf73so0b4w+WLKB4HIlFLbtcPPOS aukRsU5GbQA/4MADQ61vF/WSzAwNPo4sdr7jdiRdzmmSMokkqLVrLtkRAKNnswZooJD1 bnog== X-Gm-Message-State: ABUngvemprHiTwAp+b8dIJvtGd6D/izZBSXQBazZ4ik9GWA94iqnaU110FthuONE1vegl3N+ X-Received: by 10.28.52.76 with SMTP id b73mr10790118wma.8.1479122169133; Mon, 14 Nov 2016 03:16:09 -0800 (PST) Received: from localhost.localdomain (host-2-98-102-117.as13285.net. [2.98.102.117]) by smtp.gmail.com with ESMTPSA id gk6sm28069027wjc.21.2016.11.14.03.16.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 Nov 2016 03:16:08 -0800 (PST) From: Srinivas Kandagatla To: svarbanov@mm-sol.com, linux-pci@vger.kernel.org, bhelgaas@google.com Cc: robh+dt@kernel.org, linux-arm-msm@vger.kernel.org, srinivas.kandagatla@linaro.org, devicetree@vger.kernel.org Subject: [PATCH v4 1/3] bus: simple-pm: add support to pm clocks Date: Mon, 14 Nov 2016 11:15:53 +0000 Message-Id: <1479122155-13393-2-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1479122155-13393-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1479122155-13393-1-git-send-email-srinivas.kandagatla@linaro.org> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds support to pm clocks via device tree, so that the clocks can be turned on and off during runtime pm. This patch is required for Qualcomm msm8996 pcie controller which sits on a bus with its own power-domain and clocks. Without this patch the clock associated with the bus are never turned on. Signed-off-by: Srinivas Kandagatla --- drivers/bus/simple-pm-bus.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/bus/simple-pm-bus.c b/drivers/bus/simple-pm-bus.c index c5eb46c..63b7e8c 100644 --- a/drivers/bus/simple-pm-bus.c +++ b/drivers/bus/simple-pm-bus.c @@ -11,6 +11,7 @@ #include #include #include +#include #include @@ -22,17 +23,26 @@ static int simple_pm_bus_probe(struct platform_device *pdev) pm_runtime_enable(&pdev->dev); - if (np) + if (np) { + of_pm_clk_add_clks(&pdev->dev); of_platform_populate(np, NULL, NULL, &pdev->dev); + } return 0; } +static const struct dev_pm_ops simple_pm_bus_pm_ops = { + SET_RUNTIME_PM_OPS(pm_clk_suspend, + pm_clk_resume, NULL) +}; + static int simple_pm_bus_remove(struct platform_device *pdev) { dev_dbg(&pdev->dev, "%s\n", __func__); pm_runtime_disable(&pdev->dev); + pm_clk_destroy(&pdev->dev); + return 0; } @@ -48,6 +58,7 @@ static struct platform_driver simple_pm_bus_driver = { .driver = { .name = "simple-pm-bus", .of_match_table = simple_pm_bus_of_match, + .pm = &simple_pm_bus_pm_ops, }, };