From patchwork Tue Dec 22 10:16:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 58850 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp3139687lbb; Tue, 22 Dec 2015 02:16:50 -0800 (PST) X-Received: by 10.98.80.147 with SMTP id g19mr21199053pfj.26.1450779410430; Tue, 22 Dec 2015 02:16:50 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id sw10si3585212pab.55.2015.12.22.02.16.50; Tue, 22 Dec 2015 02:16:50 -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 S932660AbbLVKQt (ORCPT + 11 others); Tue, 22 Dec 2015 05:16:49 -0500 Received: from mail-pf0-f178.google.com ([209.85.192.178]:34593 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932181AbbLVKQt (ORCPT ); Tue, 22 Dec 2015 05:16:49 -0500 Received: by mail-pf0-f178.google.com with SMTP id u7so57924652pfb.1 for ; Tue, 22 Dec 2015 02:16:48 -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=l0dPG9HkjORGa82pm3CFQvgvwSXmL4CM8qXf3lqnmFs=; b=NAWFIz8vVvgwM5TebyfYvhTY+WgZl45PM23TQG/usb8VXtFn6uNM2B9Hc4l/qldDZe cTVktZSOihXG3FampTQkyE4NvIMCpKA4W6Pen5yhhov4XWnl2PPPRW1p0dofjkEPIm2w dkj1VyAj3V2vKVLd1aF7oj6vtiSYeZTHHg1RE= 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=l0dPG9HkjORGa82pm3CFQvgvwSXmL4CM8qXf3lqnmFs=; b=ZaOYwxQJE4UjGefYtTa8at8WQ3t69GrT8Cu5uEiUrTyUYcOgSs05QLgc4DrfP00vmE v3T2gUWwf+yMOpBaMRDWtEGeJgIwO5CtAXSgUjPwTa6v2jHv7fzIUeJTT5Y1aOoWshDC aGVwLctT4o2odoxbWv46AsFowo+Z3xYZ4k0enIK5MUII0BNHSkqheyfk8W7vfSHs/F1W 51QYUTBByNI1v2C5d2Lvw+mDy2kQSNaQfuLm8JbGdbXmBJGOsZh9HGCFuOuQCyRgNLHi 2DC46qLdl4B+Q8i4Hfu32n86RHSAMcn75KsNCRDdFFmPiAfFhKjSudDmNhyjTtc/5XZl TphA== X-Gm-Message-State: ALoCoQms2wmpQM+hxtSExdK8LeJtbIt8K0PISUbDrh1epGX0rW3ZbUeHzKaBwEkaKNwvv2X5BdBchlpklnBeJvHG4Mfe9baWyw== X-Received: by 10.98.12.67 with SMTP id u64mr34513086pfi.31.1450779408571; Tue, 22 Dec 2015 02:16:48 -0800 (PST) Received: from localhost ([122.171.29.67]) by smtp.gmail.com with ESMTPSA id g88sm5572451pfj.91.2015.12.22.02.16.47 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 22 Dec 2015 02:16:48 -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 Subject: [PATCH 07/17] PM / OPP: Manage device clk Date: Tue, 22 Dec 2015 15:46:08 +0530 Message-Id: <1cdc1e6a83974a3f1bb44c0af3cd32ef94542d81.1450777582.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.7.0.rc1.186.g94414c4 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 --- drivers/base/power/opp/core.c | 9 +++++++++ drivers/base/power/opp/opp.h | 3 +++ 2 files changed, 12 insertions(+) -- 2.7.0.rc1.186.g94414c4 -- 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 1bb09138cdae..1d1b0faa825d 100644 --- a/drivers/base/power/opp/core.c +++ b/drivers/base/power/opp/core.c @@ -596,6 +596,11 @@ 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)) + dev_dbg(dev, "%s: Couldn't find clock\n", __func__); + 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__, @@ -663,6 +668,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 a39347d8693f..42759f025ef1 100644 --- a/drivers/base/power/opp/opp.h +++ b/drivers/base/power/opp/opp.h @@ -14,6 +14,7 @@ #ifndef __DRIVER_OPP_H__ #define __DRIVER_OPP_H__ +#include #include #include #include @@ -133,6 +134,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: struct clk pointer * @regulator: Supply Regulator * @regulator_set: Regulator's name is explicitly set by platform. * @@ -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;