From patchwork Tue Dec 22 10:16:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 58846 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp3139587lbb; Tue, 22 Dec 2015 02:16:37 -0800 (PST) X-Received: by 10.66.240.97 with SMTP id vz1mr34525343pac.29.1450779397074; Tue, 22 Dec 2015 02:16:37 -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.36; Tue, 22 Dec 2015 02:16:37 -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 S932653AbbLVKQg (ORCPT + 11 others); Tue, 22 Dec 2015 05:16:36 -0500 Received: from mail-pf0-f181.google.com ([209.85.192.181]:34488 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932181AbbLVKQf (ORCPT ); Tue, 22 Dec 2015 05:16:35 -0500 Received: by mail-pf0-f181.google.com with SMTP id u7so57921868pfb.1 for ; Tue, 22 Dec 2015 02:16:35 -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=VVUyQlN27u1kz54nVu20VWv4XDCl2PSDV/zGm81UtwQ=; b=hZrD0F8FRoU8bH+k59zjYidXag/+D2dSszTEkT+nSMDpUInnRTxFX57CABzqSRTLeE GZ65pUTHstIQsYfE9yMMaGrpi91kxX7zA2XQb6/i06jec03mmxDcv9VlEFIUKMhBRgbK iArW4MYYS/RKzGyy2Z47+df0ll/I+sYc1ZKa4= 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=VVUyQlN27u1kz54nVu20VWv4XDCl2PSDV/zGm81UtwQ=; b=cvcOzivCPZCdMh2jC1WgYhBgCWQEhEd3X6tnyVTA24cK0NUCaE5vl5KW5BslBQdjxL tg25WulON+wuStQBVV61pBPasQwwft2AO0ekSfqSl5EXTbnYqy5zso1BjLIpHJMHajE0 MvUT4jYAOPbeKF2H7p9xi55Mv6CiFTKsu5XhUfeHpbY0Sb4E2a8HwNrXTz5jSE4ACd5U 3SKgCdjpsutZkQwOZF4TSfbsfS/a/gMADxh06r8erZIjuj22jO/7W3jaOsSQ66zBPKWk ZtUEBEHBziJr8CTSE179asfsxLWf0LL5v+IhWb/QZJ9nqs3DT03LFiMdcxLCx/qhH5Y2 5GwA== X-Gm-Message-State: ALoCoQnMwtMleH4/9wB+PFMOV4RnOTpXpSEqd/xUU8cG0ylQWVuVheEUC2S2FBz1sV4tqeUtXquslID4bF7d2AR7ZObR6Kv8PQ== X-Received: by 10.98.13.84 with SMTP id v81mr33971794pfi.120.1450779395273; Tue, 22 Dec 2015 02:16:35 -0800 (PST) Received: from localhost ([122.171.29.67]) by smtp.gmail.com with ESMTPSA id w23sm17331277pfa.24.2015.12.22.02.16.34 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 22 Dec 2015 02:16:34 -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 03/17] PM / OPP: Disable OPPs that aren't supported by the regulator Date: Tue, 22 Dec 2015 15:46:04 +0530 Message-Id: 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 Disable any OPPs where the connected regulator isn't able to provide the specified voltage. Signed-off-by: Viresh Kumar --- drivers/base/power/opp/core.c | 22 ++++++++++++++++++++++ 1 file changed, 22 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 76232ee04cc6..12066d3def38 100644 --- a/drivers/base/power/opp/core.c +++ b/drivers/base/power/opp/core.c @@ -701,6 +701,22 @@ static struct dev_pm_opp *_allocate_opp(struct device *dev, return opp; } +static bool _opp_supported_by_regulators(struct dev_pm_opp *opp, + struct device_opp *dev_opp) +{ + struct regulator *reg = dev_opp->regulator; + + if (!IS_ERR(reg) && + !regulator_is_supported_voltage(reg, opp->u_volt_min, + opp->u_volt_max)) { + pr_warn("%s: OPP minuV: %lu maxuV: %lu, not supported by regulator\n", + __func__, opp->u_volt_min, opp->u_volt_max); + return false; + } + + return true; +} + static int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, struct device_opp *dev_opp) { @@ -742,6 +758,12 @@ static int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, dev_err(dev, "%s: Failed to register opp to debugfs (%d)\n", __func__, ret); + 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); + } + return 0; }