From patchwork Fri Nov 4 12:59:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 9412595 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 2D5626022E for ; Fri, 4 Nov 2016 13:01:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 279D92974D for ; Fri, 4 Nov 2016 13:01:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C3B92AD52; Fri, 4 Nov 2016 13:01:49 +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 9B7E62974D for ; Fri, 4 Nov 2016 13:01:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934875AbcKDNBe (ORCPT ); Fri, 4 Nov 2016 09:01:34 -0400 Received: from mail-wm0-f48.google.com ([74.125.82.48]:36886 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756405AbcKDM7y (ORCPT ); Fri, 4 Nov 2016 08:59:54 -0400 Received: by mail-wm0-f48.google.com with SMTP id t79so48423207wmt.0 for ; Fri, 04 Nov 2016 05:59:53 -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:in-reply-to:references; bh=H98ppNWNQKYHOMg7GNoi35rtXuBu2iCguhfyYK6VJBc=; b=DV9cU+9f8OT1I2N3gSK7mHLuyviGG4XOEDqH1hdu2yTOhC1qDrTFaBMpJUM1UylSY3 DTtycXDVsOqxJxDfHvf3pxF29QL1nGKksf1RIIGJDcKn3YU2oB9HPnQ3fWrLo2LoZ5tw M6bi2YllVww4VkOrXbYWpkIOivOp/RaU2tQpo= 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=OPJTOBg1kDJDYEdRe5YGG8H4YzzPvhRK0K1E7ScR/BPa4gvdvIqmxUvEoPHsJpKFkF PhBE8b/s2O/Mei5+FFILA1tbhFjqt+PAmeVlFVG9TuxIHYP20D7B9RZHmcJYVW70kLu+ V1WKudGYyEFW2q4u6ESJFDXnJCip+67M1NZ0j5aWgcFFH+tOnIqBkBs7dkOo12hpJTaC hsPCZuzyoR12gRuzPRS//tjaqwAjFIjvWDKcArhaheRNorvVYbmlkUnPY09qerI8NuKu DGCA8/F+8otjiOXOd5yrUwQdPii9k58MwM94S/8el7FAlAJ5c0fBZRMWuPw6ZZmqd9oF c00Q== X-Gm-Message-State: ABUngve8U2+991d0ydgKE8znZjvCNBOjaQOvOKVZdP+N7Zg9VD4SUIQ9bez97rvLM5jSyvGY X-Received: by 10.28.45.198 with SMTP id t189mr3492328wmt.52.1478264392818; Fri, 04 Nov 2016 05:59:52 -0700 (PDT) Received: from localhost.localdomain (host-2-98-102-117.as13285.net. [2.98.102.117]) by smtp.gmail.com with ESMTPSA id e5sm4486220wma.10.2016.11.04.05.59.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 04 Nov 2016 05:59:52 -0700 (PDT) From: Srinivas Kandagatla To: svarbanov@mm-sol.com, Bjorn Helgaas , linux-pci@vger.kernel.org Cc: Rob Herring , Mark Rutland , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH v3 1/3] bus: simple-pm: add support to pm clocks Date: Fri, 4 Nov 2016 12:59:45 +0000 Message-Id: <1478264387-17914-2-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478264387-17914-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1478264387-17914-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, }, };