Received: by 10.192.165.148 with SMTP id m20csp4280330imm; Mon, 23 Apr 2018 23:23:06 -0700 (PDT) X-Google-Smtp-Source: AIpwx48WBZ+fTvORY07xLyRNJCNQN7EUFUP4tF4l1n0HtPzRObvvdpFmNv5tIiterF2MqVJNZp/Y X-Received: by 2002:a17:902:b604:: with SMTP id b4-v6mr24034086pls.109.1524550986496; Mon, 23 Apr 2018 23:23:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524550986; cv=none; d=google.com; s=arc-20160816; b=Wi5TsG259AaBJOkyFnoxIZ8odwbXgr2OpfUvkny11VI/2G10oSJr215eb1oMo5Qezp r4P9EtgCKhoLPo0F6IBr4K0FVaEL5c4R0xTSae1sKOc5mxTYA4h17m5NOzEzKO40vtRx qaPr8Ccy6/BbTemvu0xeI8Ng0KOWgY2+LQGPyakQQz7uF2fWJ9qJ7aPD5qT9f8AGkWZO reASwh6a271J8nXNba7gg6mEXnFC8RrTx8Z0IfPiEu06RmR2s6SYRjBbFTqPiaxaMX4I MgQLeGGL8qMvZjxcktd9fJ82KJ9WE+gyD8XaUh7fg/0jom7clmBMluc+0fT/Worrl8Lp yLOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=3j/QhaIqyQ+IZcTvdy7sTKvf4AloRqE6SzolHTSKR4U=; b=Ct6Fsowd2hWQzaw16gtt5szdt43vjuYh0shBdEfX3ajblxUypjl5pLoX1UPbTEZ+iu aTei+Dxws5pK/lHXEvpxYjfF+uqVp8Rho/dG3BgUbzK8O5lpjAIjusETUPEG0rBPAnK6 AsBZ3dSiGYrYBqmVrYSma6i3Pg0bO/fpRNH0VJkKs9kMZtu8r13DO1zQLnYd2Fof5WN8 f0CS+I5A67MaCID/ChaF0738ROj3NpEuIdbLGUWIWvcyvi1VmjuBtm9eGDsGl85cHFYR JySO5cvGGoYQcpONUJ9RKgF/z95Myg7BA9XRV14QA92YlGFG52cZ+8E5kME0fkqgP30L bDWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bv8T69Cf; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a15-v6si13373725pll.21.2018.04.23.23.22.52; Mon, 23 Apr 2018 23:23:06 -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=@linaro.org header.s=google header.b=bv8T69Cf; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755970AbeDXF2O (ORCPT + 99 others); Tue, 24 Apr 2018 01:28:14 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:46762 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754824AbeDXF2K (ORCPT ); Tue, 24 Apr 2018 01:28:10 -0400 Received: by mail-pg0-f67.google.com with SMTP id t12so9988516pgp.13 for ; Mon, 23 Apr 2018 22:28:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=3j/QhaIqyQ+IZcTvdy7sTKvf4AloRqE6SzolHTSKR4U=; b=bv8T69CfIjvJ5Uyv5oQ8DPC2ljGdBmDhVTnRsHgNg5t+LG1selE9beIiF8A8qnZJws NTIJZpioqTobrzWrnEtlbEwQ0N/Gxy4WpfFQ9uKbbs6CVawq/b6uherT01t/XZJj+6gl jIe1QIot38+pHwzor3lifWNWJi0fgOSQs0zeA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=3j/QhaIqyQ+IZcTvdy7sTKvf4AloRqE6SzolHTSKR4U=; b=RHrG4HuhBZtBpZ+LotDdm52mXrRVWGcVAt6BJq2w/6PK8O6EUWz/sPkYHtmvHj4C0D EfAs8xpgjU3nQnLV5Gn8yiUfK5gzRgky1AhqidEj4e7M/nNie1N0bk+7fZVt/fOnfiGt Xh74JCNg5F/LKgRXPHHbRlyKHyY04IAjsgJbOmidfOKJfpZASLaE1jObdX8F5fOWstqe WVSKdqC2znpsU9g8fg6YaHeWv5MCt81A871epf7/vu36UzwfiKripi5aTxyfJ4ciQpGZ Hi+FfTQfbIfdenRsyls//uxHqTsRAd/utRwdXm9y5g2WqtdZtG1DiGj9lAHAvnmSwc8w Avvg== X-Gm-Message-State: ALQs6tAB+ny8KoLpJFNVxOXebV1zxPl/zrJ7jeFwXy1PSyeMuHAxt4M1 whvxPiF+EjMMoIKKTEWBnK56+w== X-Received: by 2002:a17:902:f83:: with SMTP id 3-v6mr23447903plz.336.1524547690107; Mon, 23 Apr 2018 22:28:10 -0700 (PDT) Received: from tuxbook-pro (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id o9sm19493349pgv.74.2018.04.23.22.28.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Apr 2018 22:28:09 -0700 (PDT) Date: Mon, 23 Apr 2018 22:29:16 -0700 From: Bjorn Andersson To: Chanwoo Choi Cc: MyungJoo Ham , Kyungmin Park , Vinayak Holikatti , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vivek Gautam Subject: Re: [PATCH 1/3] PM / devfreq: Actually support providing freq_table Message-ID: <20180424052916.GD2052@tuxbook-pro> References: <20180424002016.9205-1-bjorn.andersson@linaro.org> <20180424002016.9205-2-bjorn.andersson@linaro.org> <5ADE9AE6.9090601@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5ADE9AE6.9090601@samsung.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 23 Apr 19:48 PDT 2018, Chanwoo Choi wrote: > Hi, > > On 2018??? 04??? 24??? 09:20, Bjorn Andersson wrote: > > The code in devfreq_add_device() handles the case where a freq_table is > > passed by the client, but then requests min and max frequences from > > the, in this case absent, opp tables. > > > > Read the min and max frequencies from the frequency table, which has > > been built from the opp table if one exists, instead of querying the > > opp table. > > > > Signed-off-by: Bjorn Andersson > > --- > > > > An alternative approach is to clarify in the devfreq code that it's not > > possible to pass a freq_table and then in patch 3 create an opp table for the > > device in runtime; although the error handling of this becomes non-trivial. > > > > Transitioning the UFSHCD to use opp tables directly is hindered by the fact > > that the Qualcomm UFS hardware has two different clocks that needs to be > > running at different rates, so we would need a way to describe the two rates in > > the opp table. (And would force us to change the DT binding) > > > > drivers/devfreq/devfreq.c | 22 ++++------------------ > > 1 file changed, 4 insertions(+), 18 deletions(-) > > > > diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c > > index fe2af6aa88fc..086ced50a13d 100644 > > --- a/drivers/devfreq/devfreq.c > > +++ b/drivers/devfreq/devfreq.c > > @@ -74,30 +74,16 @@ static struct devfreq *find_device_devfreq(struct device *dev) > > > > static unsigned long find_available_min_freq(struct devfreq *devfreq) > > { > > - struct dev_pm_opp *opp; > > - unsigned long min_freq = 0; > > - > > - opp = dev_pm_opp_find_freq_ceil(devfreq->dev.parent, &min_freq); > > - if (IS_ERR(opp)) > > - min_freq = 0; > > - else > > - dev_pm_opp_put(opp); > > + struct devfreq_dev_profile *profile = devfreq->profile; > > > > - return min_freq; > > + return profile->freq_table[0]; > > It is wrong. The thermal framework support the devfreq-cooling device > which uses the dev_pm_opp_enable/disable(). > Okay, that makes sense. So rather than registering a custom freq_table I should register the min and max frequency using dev_pm_opp_add(). > In order to find the correct available min frequency, > the devfreq have to use the OPP function instead of using the first entry > of the freq_table array. > Based on this there seems to be room for cleaning out the freq_table from devfreq, to reduce the confusion. I will review this further. Thanks, Bjorn