From patchwork Fri Sep 11 12:02:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 53457 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by patches.linaro.org (Postfix) with ESMTPS id 8F076215BF for ; Fri, 11 Sep 2015 12:04:01 +0000 (UTC) Received: by lbbmp1 with SMTP id mp1sf23664111lbb.2 for ; Fri, 11 Sep 2015 05:04:00 -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=nOIcs3eRPtXdLl2hcRKFDTykKAzYalaL9UbXSi1PYaY=; b=dPdI4Pww7ZlULozDjiGSWQeTIbKQPkmiM2DMfe8tI8oU8y8jzCYQ/rLSV7/KwDW+BB fddisoITZGogLvuMAAGPLT6/DI8RX6PIqme3u/yJqePKCSSfAkR3LWz3sCvlZTv/RC/J zBavSDarKmVp7tvcdfxbCZvvPLLVSrlbfraFCr3EIG7Nz6kyMn/o+tFnGVsf4hIN39mz O3fnpPveIjOV5CCEXlWjMq920/dYK4DApWT4gL/Z9Yns5RYZHWfr+EJcz50UbuMkUDC2 OHs8TayE4hxiq/pjCh8M3+wrisxSGnFtymTMtsmm8rogkizYeuSX4e9uZ9ie24N1RRBh ax/Q== X-Gm-Message-State: ALoCoQl4B/DfZXPwCQG+IBoRhtIofrU6rEwGjRaXrwq2kCuNd6hg5ECsxF4py/dLSMlIpl5iYgpK X-Received: by 10.152.21.233 with SMTP id y9mr11216758lae.5.1441973040546; Fri, 11 Sep 2015 05:04:00 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.193 with SMTP id s1ls69344laj.62.gmail; Fri, 11 Sep 2015 05:04:00 -0700 (PDT) X-Received: by 10.152.1.226 with SMTP id 2mr41598285lap.116.1441973040366; Fri, 11 Sep 2015 05:04:00 -0700 (PDT) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id n10si7879laj.155.2015.09.11.05.04.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Sep 2015 05:04:00 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by lbcjc2 with SMTP id jc2so38338049lbc.0 for ; Fri, 11 Sep 2015 05:04:00 -0700 (PDT) X-Received: by 10.152.26.98 with SMTP id k2mr7780522lag.41.1441973039915; Fri, 11 Sep 2015 05:03:59 -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 w3csp1545672lbq; Fri, 11 Sep 2015 05:03:58 -0700 (PDT) X-Received: by 10.107.170.32 with SMTP id t32mr3052595ioe.173.1441973038307; Fri, 11 Sep 2015 05:03:58 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x3si173583igl.3.2015.09.11.05.03.57; Fri, 11 Sep 2015 05:03:58 -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 S1753183AbbIKMDm (ORCPT + 28 others); Fri, 11 Sep 2015 08:03:42 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:33597 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753130AbbIKMDj (ORCPT ); Fri, 11 Sep 2015 08:03:39 -0400 Received: by pacex6 with SMTP id ex6so73885076pac.0 for ; Fri, 11 Sep 2015 05:03:39 -0700 (PDT) X-Received: by 10.68.173.165 with SMTP id bl5mr95181213pbc.157.1441973019327; Fri, 11 Sep 2015 05:03:39 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id td5sm91344pab.1.2015.09.11.05.03.38 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 11 Sep 2015 05:03:38 -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 09/16] PM / OPP: Disable OPPs that aren't supported by the regulators Date: Fri, 11 Sep 2015 17:32:05 +0530 Message-Id: <2cd568e33356b2f409d6af81aaad4e2ee418b905.1441972771.git.viresh.kumar@linaro.org> 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.175 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: , Disable any OPPs where the connected regulators aren't able to provide the specified voltage. Signed-off-by: Viresh Kumar --- drivers/base/power/opp/core.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c index 42ea5a332ddc..04fe181b8132 100644 --- a/drivers/base/power/opp/core.c +++ b/drivers/base/power/opp/core.c @@ -834,6 +834,34 @@ static int _opp_add_v1(struct device *dev, unsigned long freq, long u_volt, return ret; } +static bool opp_supported_by_regulators(struct dev_pm_opp *opp, + struct device_opp *dev_opp) +{ + struct opp_supply *supply; + struct regulator *reg; + int count; + + for (count = 0; count < dev_opp->supply_count; count++) { + supply = opp->supplies + count; + reg = dev_opp->regulators[count]; + + /* Regulator may not be available for device */ + if (IS_ERR(reg)) + continue; + + if (!regulator_is_supported_voltage(reg, supply->u_volt_min, + supply->u_volt_max)) { + pr_warn("%s: OPP minuV: %lu maxuV: %lu, not supported by regulator: %s\n", + __func__, supply->u_volt_min, + supply->u_volt_max, + dev_opp->supply_names[count]); + return false; + } + } + + return true; +} + /* returns the number of entries used from microvolt */ static void opp_parse_single_supply(struct opp_supply *supply, bool triplet, u32 *microvolt, u32 *microamp) @@ -1016,6 +1044,12 @@ static int _opp_add_static_v2(struct device *dev, struct device_node *np, if (new_opp->clock_latency_ns > dev_opp->clock_latency_ns_max) dev_opp->clock_latency_ns_max = new_opp->clock_latency_ns; + if (!opp_supported_by_regulators(new_opp, dev_opp)) { + new_opp->available = false; + dev_warn(dev, "%s: OPP not supported by regulators (%lu)\n", + __func__, new_opp->rate); + } + mutex_unlock(&dev_opp_list_lock); supply = &new_opp->supplies[0];