From patchwork Thu Jan 28 08:20:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 60687 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp333286lbb; Thu, 28 Jan 2016 00:26:08 -0800 (PST) X-Received: by 10.98.80.79 with SMTP id e76mr2723307pfb.126.1453969568701; Thu, 28 Jan 2016 00:26:08 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yo8si15399151pac.27.2016.01.28.00.26.08; Thu, 28 Jan 2016 00:26:08 -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 S966349AbcA1I0F (ORCPT + 11 others); Thu, 28 Jan 2016 03:26:05 -0500 Received: from mail-pa0-f43.google.com ([209.85.220.43]:36554 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965141AbcA1IVM (ORCPT ); Thu, 28 Jan 2016 03:21:12 -0500 Received: by mail-pa0-f43.google.com with SMTP id yy13so19450694pab.3 for ; Thu, 28 Jan 2016 00:21:12 -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 :in-reply-to:references; bh=/H0LGIpenrb0VQRCxFbqnR+aokioBNtge9MvKAxmI5w=; b=hfndhAsED/Py2ISPRi8FC+ARNW1X+PEBMj61JSaDd44WGcoRTJisWAj4pyxBxG+j7c C0A7B2ecNswaqme/FE6x8codvZc7qp/xPhlXOd0lz8ndwQ6U8F48DyZA8h57B2Oqm9pa TQ4JIpoK+rnIEswIQZRBK+4D3ID/vsqE1ZBwY= 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:in-reply-to:references; bh=/H0LGIpenrb0VQRCxFbqnR+aokioBNtge9MvKAxmI5w=; b=VVMObpgfowgm9wuL37ik/FR2X8ip+Pb8wgKy7T9ftY+IM9CM+kkbKq9luwKe/jewwa 88GwJiuCKL9KL/0h5LAaSSBiwVuLP2X0uLuNKX/2vs26I9wwEfDg/TuqHkPxMYrJlSlf SYyI9kmUOrOJ+ELwPWNQIUdiQcroSMPP9npxzYFaeLNT2jof0VRxZi+vGJ0/OAMj8iFJ aNBFJN68d/grjX5G3qUKPDtR6p5GDRyjpph0BILoFDR3Mhs9p8o+MZOJ7CsPTMMOCgJ4 BUsQS3KbygHJBh+Dz/AekgUUydrMntQFcBwrguPLlUSITIAhvLo6DEERF+pvSgdgNtM5 tJPg== X-Gm-Message-State: AG10YOQ+ml6bn/rpUrZMArHLt4ii+mTUQEYfTV3ig4XKD8ADZqFM2g7to970F6o83tZcLwPz X-Received: by 10.66.147.136 with SMTP id tk8mr2603652pab.157.1453969272123; Thu, 28 Jan 2016 00:21:12 -0800 (PST) Received: from localhost ([122.171.121.234]) by smtp.gmail.com with ESMTPSA id yl1sm14195542pac.35.2016.01.28.00.21.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jan 2016 00:21:11 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, Stephen Boyd , nm@ti.com, Viresh Kumar , Greg Kroah-Hartman , Len Brown , linux-kernel@vger.kernel.org (open list), Pavel Machek , Viresh Kumar Subject: [PATCH V2 06/16] PM / OPP: Manage device clk Date: Thu, 28 Jan 2016 13:50:35 +0530 Message-Id: X-Mailer: git-send-email 2.7.0.79.gdc08a19 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 Reviewed-by: Stephen Boyd --- drivers/base/power/opp/core.c | 15 +++++++++++++++ drivers/base/power/opp/opp.h | 3 +++ 2 files changed, 18 insertions(+) -- 2.7.0.79.gdc08a19 -- 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 4fafa733a1c7..7d7749ce1ce4 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 @@ -583,6 +584,7 @@ static struct device_opp *_add_device_opp(struct device *dev) struct device_opp *dev_opp; struct device_list_opp *list_dev; struct device_node *np; + int ret; /* Check for existing list for 'dev' first */ dev_opp = _find_device_opp(dev); @@ -620,6 +622,15 @@ static struct device_opp *_add_device_opp(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); + } + srcu_init_notifier_head(&dev_opp->srcu_head); INIT_LIST_HEAD(&dev_opp->opp_list); @@ -661,6 +672,10 @@ static void _remove_device_opp(struct device_opp *dev_opp) if (!IS_ERR_OR_NULL(dev_opp->regulator)) return; + /* Release clk */ + if (!IS_ERR(dev_opp->clk)) + clk_put(dev_opp->clk); + list_dev = list_first_entry(&dev_opp->dev_list, struct device_list_opp, node); diff --git a/drivers/base/power/opp/opp.h b/drivers/base/power/opp/opp.h index fe44beb404ba..4f1bdfc7da03 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 * @dentry: debugfs dentry pointer of the real device directory (not links). * @dentry_name: Name of the real dentry. @@ -168,6 +170,7 @@ struct device_opp { unsigned int *supported_hw; unsigned int supported_hw_count; const char *prop_name; + struct clk *clk; struct regulator *regulator; #ifdef CONFIG_DEBUG_FS