From patchwork Tue Jan 12 05:43:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 59599 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2535822lbb; Mon, 11 Jan 2016 21:43:19 -0800 (PST) X-Received: by 10.98.66.74 with SMTP id p71mr31820744pfa.105.1452577399721; Mon, 11 Jan 2016 21:43:19 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w76si1450944pfi.132.2016.01.11.21.43.19; Mon, 11 Jan 2016 21:43:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759397AbcALFnS (ORCPT + 11 others); Tue, 12 Jan 2016 00:43:18 -0500 Received: from mail-pa0-f42.google.com ([209.85.220.42]:32789 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759336AbcALFnR (ORCPT ); Tue, 12 Jan 2016 00:43:17 -0500 Received: by mail-pa0-f42.google.com with SMTP id cy9so333818541pac.0 for ; Mon, 11 Jan 2016 21:43:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=F77ndN0wT0/0UFppEMs4jd/WHQg7OtrH5t7EqeFEVBY=; b=bJ6b/tog6y+m/QCbrlSm5Y+luh8Dc8skimWmg2AHV8gfI1nPj3RDUFZbpQE9wejNCU nNE5VLOGizRb6Gvcxpn/ElR0smsl+DDSDFYkkxH1b2FRolnke5c3EjlrVL62XZwycwYp Qh2bBbc3086qZFX/jrZka4jzuOycz5P05vgJw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=F77ndN0wT0/0UFppEMs4jd/WHQg7OtrH5t7EqeFEVBY=; b=lCf8GU5EIZ7KMnnfYfRNydDVpay00xFSdszU9Lb8okOhEH21rJtXP5MPZQiR0RHGvM YhI4y8lmErJD466Pv3DfRtIzmOwwGRKLmbMNr1oPeUPN6YQEIU+4QpI7M58WhG5s5Uf0 ysAaAxYyPDV2NrX8Yra5Snk7uvWsbgwVwNUDGq70/dzdl9DGOlw8JDySpXfUTEvJzpfF UU9tcm4daf1xRyNb7+SNWJjkblP43RbP+ne8JgpEe3x+yHS1gp8xR/pBg+7XyEGaLJQW dS1BrneoKZ01D3OKGcyTX0yLi+KMwYmRcI2QrrrKLxSISfho2P/UNNAhuWQHSWeixhJd hw6Q== X-Gm-Message-State: ALoCoQnR/PzESMSzNLP10/bpYpx7qbW9N1Yobpr5JwnZt9yXBVPfAi5Jmskdi7UjtiXVELpH8ILn7I1SseKtcG4LB7S+Ne4B8Q== X-Received: by 10.66.232.74 with SMTP id tm10mr131818783pac.128.1452577396781; Mon, 11 Jan 2016 21:43:16 -0800 (PST) Received: from localhost ([122.172.46.246]) by smtp.gmail.com with ESMTPSA id m70sm27055207pfi.90.2016.01.11.21.43.15 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 11 Jan 2016 21:43:16 -0800 (PST) Date: Tue, 12 Jan 2016 11:13:13 +0530 From: Viresh Kumar To: Stephen Boyd Cc: Rafael Wysocki , linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, nm@ti.com Subject: Re: [PATCH 07/17] PM / OPP: Manage device clk Message-ID: <20160112054313.GM1084@ubuntu> References: <1cdc1e6a83974a3f1bb44c0af3cd32ef94542d81.1450777582.git.viresh.kumar@linaro.org> <20160112013205.GL22188@codeaurora.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160112013205.GL22188@codeaurora.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org On 11-01-16, 17:32, Stephen Boyd wrote: > > + * @clk: struct clk pointer > > Why tab? And perhaps it should say "clock handle" or "supply > clock" or something instead of rewording the type "struct clk *". -------------------------8<------------------------- Subject: [PATCH] PM / OPP: Manage device clk OPP core has got almost everything now to manage device's OPP transitions, the only thing left is device's clk. Get that as well. Signed-off-by: Viresh Kumar --- drivers/base/power/opp/core.c | 15 +++++++++++++++ drivers/base/power/opp/opp.h | 3 +++ 2 files changed, 18 insertions(+) -- viresh -- To unsubscribe from this list: send the line "unsubscribe linux-pm" 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/base/power/opp/core.c b/drivers/base/power/opp/core.c index 72d9fdf9ff0c..e7c9ae0c4c09 100644 --- a/drivers/base/power/opp/core.c +++ b/drivers/base/power/opp/core.c @@ -13,6 +13,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include #include #include #include @@ -570,6 +571,7 @@ static struct device_opp *_add_device_opp_reg(struct device *dev, struct device_opp *dev_opp; struct device_list_opp *list_dev; struct device_node *np; + int ret; /* * Allocate a new device OPP table. In the infrequent case where a new @@ -602,6 +604,15 @@ static struct device_opp *_add_device_opp_reg(struct device *dev, of_node_put(np); } + /* Find clk for the device */ + dev_opp->clk = clk_get(dev, NULL); + if (IS_ERR(dev_opp->clk)) { + ret = PTR_ERR(dev_opp->clk); + if (ret != -EPROBE_DEFER) + dev_dbg(dev, "%s: Couldn't find clock: %d\n", __func__, + ret); + } + dev_opp->regulator = regulator_get_optional(dev, name); if (IS_ERR(dev_opp->regulator)) dev_info(dev, "%s: no regulator (%s) found: %ld\n", __func__, @@ -669,6 +680,10 @@ static void _remove_device_opp(struct device_opp *dev_opp) if (dev_opp->regulator_set) return; + /* Release clk */ + if (!IS_ERR(dev_opp->clk)) + clk_put(dev_opp->clk); + regulator_put(dev_opp->regulator); list_dev = list_first_entry(&dev_opp->dev_list, struct device_list_opp, diff --git a/drivers/base/power/opp/opp.h b/drivers/base/power/opp/opp.h index d45570458f89..777ec70488bc 100644 --- a/drivers/base/power/opp/opp.h +++ b/drivers/base/power/opp/opp.h @@ -22,6 +22,7 @@ #include #include +struct clk; struct regulator; /* Lock to allow exclusive modification to the device and opp lists */ @@ -134,6 +135,7 @@ struct device_list_opp { * @supported_hw: Array of version number to support. * @supported_hw_count: Number of elements in supported_hw array. * @prop_name: A name to postfix to many DT properties, while parsing them. + * @clk: Device's clock handle * @regulator: Supply regulator * @regulator_set: Regulator's name is explicitly set by platform. * @dentry: debugfs dentry pointer of the real device directory (not links). @@ -169,6 +171,7 @@ struct device_opp { unsigned int *supported_hw; unsigned int supported_hw_count; const char *prop_name; + struct clk *clk; struct regulator *regulator; bool regulator_set;