Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8993221ybi; Tue, 23 Jul 2019 19:38:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqxqLt10mny9y7ocwq6iBwEghcnyZRN/CXDcbnw7MkEqQ7P4lWfbRgXnRmv15nSEaBU5jft5 X-Received: by 2002:a63:5a4b:: with SMTP id k11mr20057668pgm.143.1563935913468; Tue, 23 Jul 2019 19:38:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563935913; cv=none; d=google.com; s=arc-20160816; b=et8D27/ilonqQZgQJKF9TGoTtVjpAQxx8YBX3c7BLRKWVjZnP1tIFxpXVmjAG8QTGk dZHqyltHLTA/2Y6/ZhgDsN2w0ve7Of9Rw15+KlpJvF+KN6OOVav+FDgQS951NI3SDkO6 q81gjqglnjoeph/Oqe925LVCsWeaoy4C0/Q/SrzFVG1fXNQs+YS5at4Jga99XzUOww4I 18LbnGB3Y8LWfOJtt/Dz1CVTA5ulUFmnBZcvYAh1rJX54W53VfvCe5h/ZTdCCUp8K6n2 ZYWrJyrNWJku5gVSd7B9/aQ6ew/ieDDsfqI2Fu7antZA81jDeceqfZSLhFhnJegwHSpS 6mQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=tcec6G8mdYvC44AUiiZquxcEHQD3/poU4Cd0DIagRzY=; b=b1Vhf8Z3Bpy/RU9TbFgy3fuzAr+aPHGa0BlQEtxscACUHLeScfsjcaVlJYkyKgFd0k kWQatYn/XGlANuc3E3+zLE56w65aVfSWtD8Ofo1kywLdoueYRInTHswLLTN1OJgkkPiP 1lcDWHSZDqnrhJcC+Byouo8xajcF3PL4PtTHZCzOis0zEhuEN/V9uZxbFouampL00Gn2 qGTq1kdJ8kmTtCUVjnH/PMB0R/Fhqrj0MdD22xg7HpzgoQjufzvT1UP7avSLjtjjJ5gS 14+aIGlUaS5VE+nTL4V6OmKhrKESFdvtrBeIn6I6XlfSOsWpwWlZ+oXXw6bS/P+EmWUj XMLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=OjqB0ijO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a8si13467950ple.243.2019.07.23.19.38.19; Tue, 23 Jul 2019 19:38:33 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=OjqB0ijO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728569AbfGXBmr (ORCPT + 99 others); Tue, 23 Jul 2019 21:42:47 -0400 Received: from mail-pg1-f201.google.com ([209.85.215.201]:48167 "EHLO mail-pg1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728550AbfGXBmn (ORCPT ); Tue, 23 Jul 2019 21:42:43 -0400 Received: by mail-pg1-f201.google.com with SMTP id k20so27194969pgg.15 for ; Tue, 23 Jul 2019 18:42:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=tcec6G8mdYvC44AUiiZquxcEHQD3/poU4Cd0DIagRzY=; b=OjqB0ijOd5pzNZ1elvcBfW/VYQq9Xyi191z3lVRIEijGecmCpThtCaH7iAEAOQV6tt n1Ma7p9sAXcFTkGiDuRpVzqQGS9v541NtuMY6wTBEFaB3+mr4IX8M4w8OiWHQCvmubm8 Yju7NLSi4U7n/lTTOksPbc2XETeb5BvCiu5vo6wve7xyJW1gy/VAecz2XFeG0rLFAV/G zZ+mJdKhPjpQMlhvl95+iF1kVbre+8PnJY5WGzv4zkJmDfzAx29ovEXNLLGStTbDkEc+ NJ0im1qi8CZTIkUMjx+pxaVVsobC496FzzkLJtNZgBvfbrzOAV7JFut85IszWRP7WF0K 9S+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=tcec6G8mdYvC44AUiiZquxcEHQD3/poU4Cd0DIagRzY=; b=rh0AdCJ6dPLByfUK2xKZWG3FDFv+RzHSB+N1J0NbnZCsWKsATlK7MXG/IUhgDjeHqw dHVwj4iGYY/EA0hu5nclTDCp41mPCNNaCmqTo920c73sxW6Nx8WwIXsUNZ/80+IqYrOi UlqGe4hJAIQ5BXo42DjsWECNrxR88MfWrzk9V4hFLOEV3XXJr0QmR9RteNRB5ehnLdMA T9Hz/H1Q2ZUIH0025UqNi3f6VjwXmlIJuoKTShuUPsVpB+7YoKQeqeKUcdcXj0xldO51 H/VRRCWr5CWu5dKJxLsXLPonB69N7KA6DhEOPyNBBOXLTpszFjSy74BksTwdcE4ZzxqV 4T2g== X-Gm-Message-State: APjAAAWVy54chRQq21jp1TxMuSvjY93mV2fPrzKO0vsK83W1WV3fp7IJ wQ82jNT9dn4nO8eWIhu0fR/3Xlb4NREoWHI= X-Received: by 2002:a63:4404:: with SMTP id r4mr77919539pga.245.1563932561833; Tue, 23 Jul 2019 18:42:41 -0700 (PDT) Date: Tue, 23 Jul 2019 18:42:21 -0700 In-Reply-To: <20190724014222.110767-1-saravanak@google.com> Message-Id: <20190724014222.110767-6-saravanak@google.com> Mime-Version: 1.0 References: <20190724014222.110767-1-saravanak@google.com> X-Mailer: git-send-email 2.22.0.709.g102302147b-goog Subject: [PATCH v4 5/5] PM / devfreq: Add required OPPs support to passive governor From: Saravana Kannan To: MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Cc: Saravana Kannan , Sibi Sankar , kernel-team@android.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Look at the required OPPs of the "parent" device to determine the OPP that is required from the slave device managed by the passive governor. This allows having mappings between a parent device and a slave device even when they don't have the same number of OPPs. Signed-off-by: Saravana Kannan Acked-by: MyungJoo Ham Acked-by: Chanwoo Choi --- drivers/devfreq/governor_passive.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/devfreq/governor_passive.c b/drivers/devfreq/governor_passive.c index 58308948b863..14dc5bb58733 100644 --- a/drivers/devfreq/governor_passive.c +++ b/drivers/devfreq/governor_passive.c @@ -19,7 +19,7 @@ static int devfreq_passive_get_target_freq(struct devfreq *devfreq, = (struct devfreq_passive_data *)devfreq->data; struct devfreq *parent_devfreq = (struct devfreq *)p_data->parent; unsigned long child_freq = ULONG_MAX; - struct dev_pm_opp *opp; + struct dev_pm_opp *opp = NULL, *p_opp = NULL; int i, count, ret = 0; /* @@ -56,13 +56,20 @@ static int devfreq_passive_get_target_freq(struct devfreq *devfreq, * list of parent device. Because in this case, *freq is temporary * value which is decided by ondemand governor. */ - opp = devfreq_recommended_opp(parent_devfreq->dev.parent, freq, 0); - if (IS_ERR(opp)) { - ret = PTR_ERR(opp); + p_opp = devfreq_recommended_opp(parent_devfreq->dev.parent, freq, 0); + if (IS_ERR(p_opp)) { + ret = PTR_ERR(p_opp); goto out; } - dev_pm_opp_put(opp); + if (devfreq->opp_table && parent_devfreq->opp_table) + opp = dev_pm_opp_xlate_required_opp(parent_devfreq->opp_table, + devfreq->opp_table, p_opp); + if (opp) { + *freq = dev_pm_opp_get_freq(opp); + dev_pm_opp_put(opp); + goto out; + } /* * Get the OPP table's index of decided freqeuncy by governor @@ -89,6 +96,9 @@ static int devfreq_passive_get_target_freq(struct devfreq *devfreq, *freq = child_freq; out: + if (!IS_ERR_OR_NULL(opp)) + dev_pm_opp_put(p_opp); + return ret; } -- 2.22.0.709.g102302147b-goog