From patchwork Fri Sep 11 12:02:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 53461 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by patches.linaro.org (Postfix) with ESMTPS id 6C75A215BF for ; Fri, 11 Sep 2015 12:04:27 +0000 (UTC) Received: by lbbmp1 with SMTP id mp1sf23670207lbb.2 for ; Fri, 11 Sep 2015 05:04:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=d9xEdxyIECOkE46C7LL953+TLFFeLQJPmab73yL7XuE=; b=BqXCqaXv8Gwq5iMaEZ/Nvzc2DYxlqcIOhsb1BG9vVTDct+bOaSUdfnkG3hEI3YP1RM 5q7aFYOvhEDPn4jK0thrJpGSk3xY5ZlVJooaHJhLS+KZTEAi1UATKwrDHKLgDGBMO9Ut ziYr+htQ2ogZhzItvFYt9XqpZY63879Y/WJDcbF5QXBGXjlglixY7KCkISyFwtSaFD/o Miat2VoS4KtYTafO7TXcVn44HUj4E1CnJtnWgxFaf4DuWatiHVscP+tUD2B7yBRMHvG0 zBTJoQIaDIcvTCjPHB6Di4mQ9V31eLpW+cOSiIpETUXgWk+wu0b8x/7mg9GbFAXMU2QU ZqqA== X-Gm-Message-State: ALoCoQlQiwOh+ZhmHKSnhXa3oT6jYfhtsG60lpkD/Il7GuGye68Vj+DJpqVl2XGauq4HUK0+BqCa X-Received: by 10.180.35.132 with SMTP id h4mr2317649wij.5.1441973066370; Fri, 11 Sep 2015 05:04:26 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.2.129 with SMTP id 1ls276930lau.58.gmail; Fri, 11 Sep 2015 05:04:26 -0700 (PDT) X-Received: by 10.112.141.8 with SMTP id rk8mr40366217lbb.87.1441973066173; Fri, 11 Sep 2015 05:04:26 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id w8si1848lbb.172.2015.09.11.05.04.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Sep 2015 05:04:26 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by lbbmp1 with SMTP id mp1so38387595lbb.1 for ; Fri, 11 Sep 2015 05:04:26 -0700 (PDT) X-Received: by 10.152.22.133 with SMTP id d5mr41383898laf.112.1441973066066; Fri, 11 Sep 2015 05:04:26 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1545993lbq; Fri, 11 Sep 2015 05:04:25 -0700 (PDT) X-Received: by 10.107.158.18 with SMTP id h18mr3446640ioe.116.1441973064935; Fri, 11 Sep 2015 05:04:24 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t11si163685ioi.49.2015.09.11.05.04.24; Fri, 11 Sep 2015 05:04:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753305AbbIKMEO (ORCPT + 28 others); Fri, 11 Sep 2015 08:04:14 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:34579 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752168AbbIKMEK (ORCPT ); Fri, 11 Sep 2015 08:04:10 -0400 Received: by padhy16 with SMTP id hy16so73651264pad.1 for ; Fri, 11 Sep 2015 05:04:10 -0700 (PDT) X-Received: by 10.68.250.5 with SMTP id yy5mr94910614pbc.34.1441973050495; Fri, 11 Sep 2015 05:04:10 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id og5sm31120pbc.68.2015.09.11.05.04.09 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 11 Sep 2015 05:04:09 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , nm@ti.com, sboyd@codeaurora.org Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, rob.herring@linaro.org, lee.jones@linaro.org, Viresh Kumar , Bartlomiej Zolnierkiewicz , Dmitry Torokhov , Greg Kroah-Hartman , Len Brown , linux-kernel@vger.kernel.org (open list), Pavel Machek Subject: [PATCH 13/16] PM / OPP: Manage device clk as well Date: Fri, 11 Sep 2015 17:32:09 +0530 Message-Id: X-Mailer: git-send-email 2.4.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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(+) diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c index 9633f2fc3481..a04dcacb8a07 100644 --- a/drivers/base/power/opp/core.c +++ b/drivers/base/power/opp/core.c @@ -636,6 +636,11 @@ static struct device_opp *_add_device_opp(struct device *dev, int supply_count, if (supply_count == 1) *dev_opp->supply_names = dev_name(dev); + /* 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__); + srcu_init_notifier_head(&dev_opp->srcu_head); INIT_LIST_HEAD(&dev_opp->opp_list); @@ -669,6 +674,10 @@ static void _remove_device_opp(struct device_opp *dev_opp) if (!list_empty(&dev_opp->opp_list)) return; + /* Release clk */ + if (!IS_ERR(dev_opp->clk)) + clk_put(dev_opp->clk); + /* Release regulators */ for (count = dev_opp->supply_count - 1; count >= 0; count--) regulator_put(dev_opp->regulators[count]); diff --git a/drivers/base/power/opp/opp.h b/drivers/base/power/opp/opp.h index 55205cbe59dc..e36ee6296f1a 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 @@ -135,6 +136,7 @@ struct device_list_opp { * @dev_list: list of devices that share these OPPs * @opp_list: list of opps * @np: struct device_node pointer for opp's DT node. + * @clk: struct clk pointer * @supply_count: Number of power-supplies * @regulators: Array of regulators * @supply_names: Array of strings containing names of the power-supplies @@ -163,6 +165,7 @@ struct device_opp { struct device_node *np; unsigned long clock_latency_ns_max; + struct clk *clk; unsigned int supply_count; struct regulator **regulators; const char **supply_names;