Received: by 10.192.165.148 with SMTP id m20csp4284616imm; Mon, 23 Apr 2018 23:28:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx49eZpjLgBdbA8PhzNcuixELnWmFoZwgK3JQ22ScxHA1B97s8idQFELxLvnFIr2BQSDF5nYu X-Received: by 10.99.158.2 with SMTP id s2mr19637627pgd.48.1524551328197; Mon, 23 Apr 2018 23:28:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524551328; cv=none; d=google.com; s=arc-20160816; b=DevikKKKAMxZMBg/4/q+TcjfVdtkofihvr2rmlXh1s6enqEqgl053nR4+lEJHoXxeD LRH6ht2ool+Kvi+rLedZNNnheB7InOrloIqJLgZ+u4CkV7Kae/WxUrbQJMovJ/WSwttF Ern1qY/XBTMIZOnTbs9EFSdIBsx0oOI7Sja5pOd3U3FertzKepNB2kHtWwOsyiqWGibX 4Z9+m/04itjxwTtPstq7Sw7KFO9KjHkBhm/7eJpHc1fbw2pS3gTj9GOc1t70Taiz6lA+ Cu2MuebSA6e1+qpfciE8ccvK7dY1TcyLqiM1e7UXM6bj7oMoAucNXrF9Vm2FWjSBOu00 U8pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:content-transfer-encoding:date :message-id:in-reply-to:cc:to:from:reply-to:subject:mime-version :dkim-signature:dkim-filter:arc-authentication-results; bh=Z9M9CX6fxSPUyIf6jo/epiirB/urNfnoLaotBcyWX8k=; b=opj1P2jTfie1Y/ERwLxjd+S8Jnq+abH111/K3w3IotSa/1hlIZ58Ex+PJDMyPL7W25 btIBEw/pAWdkKY/SmYyGKzAThdcZ/OTmvsxNj7P+y07JN4gFtt1XMRkWfGUrYJJco827 5+hc8Cqj7UL0+6tsvE8egwmo3gNKsLmvd7eN/HKLAVJb6rb3zR/tKZc8RpnrNTF+zMus SOYbxF8bgZDKynbOoK1t4JwhczM+VH2D23FcHxEEznxUceWtv92zW4snGs+3FWfFVOOM Mjgnt3Yy04TIoO0xDvTaF55d+EqteDRk7TZPX6zdAdiIS2XadPyxX8SvYePBAdCVxpz3 OUVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=dlQCxbe6; 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=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h4-v6si12549895pls.502.2018.04.23.23.28.33; Mon, 23 Apr 2018 23:28:48 -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=@samsung.com header.s=mail20170921 header.b=dlQCxbe6; 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=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756257AbeDXGPH (ORCPT + 99 others); Tue, 24 Apr 2018 02:15:07 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:48145 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756013AbeDXGPD (ORCPT ); Tue, 24 Apr 2018 02:15:03 -0400 Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20180424061501epoutp0285dee8aaeabb98a824fdbe8ca27d9612~oSpqWJvLK1978719787epoutp02B for ; Tue, 24 Apr 2018 06:15:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20180424061501epoutp0285dee8aaeabb98a824fdbe8ca27d9612~oSpqWJvLK1978719787epoutp02B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1524550501; bh=Z9M9CX6fxSPUyIf6jo/epiirB/urNfnoLaotBcyWX8k=; h=Subject:Reply-To:From:To:CC:In-Reply-To:Date:References:From; b=dlQCxbe60/M1f/i16Xul7gxQZ6sVpuA/i+IHFQtKCQovhrup6xlp8WQNYBcUg6639 6YNv1KnB8nWqFyAj2E0Jd0A0mThY7yALnARYXw9be6dF8WFLcG05bU33I9JYgRaa3S BmIapJYpmfUnLwZhyKJxvHvedEXma3ajauGjTLik= Received: from epcpmgr01 (u28.gpu120.samsung.co.kr [203.254.230.28]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20180424061501epcas1p1997005ac18ead8ce2adf9a4ede267b67~oSpp3A2Rc2402724027epcas1p1_; Tue, 24 Apr 2018 06:15:01 +0000 (GMT) Mime-Version: 1.0 Subject: RE: Re: [PATCH 1/3] PM / devfreq: Actually support providing freq_table Reply-To: myungjoo.ham@samsung.com From: MyungJoo Ham To: Bjorn Andersson , Chanwoo Choi CC: 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 X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20180424052916.GD2052@tuxbook-pro> X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <529236451.01524550500717.JavaMail.epsvc@epcpmgr01> Date: Tue, 24 Apr 2018 15:09:14 +0900 X-CMS-MailID: 20180424060914epcms1p5de3ed78a6b2300bf143e214ad8e2d2c0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-CPGSPASS: Y X-CPGSPASS: Y X-MTR: 20180424060914epcms1p5de3ed78a6b2300bf143e214ad8e2d2c0 X-Hop-Count: 3 X-CMS-RootMailID: 20180424002041epcas5p11439bec6de910c2a465c5cf3acb45a3b X-RootMTR: 20180424002041epcas5p11439bec6de910c2a465c5cf3acb45a3b References: <20180424052916.GD2052@tuxbook-pro> <20180424002016.9205-1-bjorn.andersson@linaro.org> <20180424002016.9205-2-bjorn.andersson@linaro.org> <5ADE9AE6.9090601@samsung.com> 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. Could you please check if the bug suffering you gets resolved by replacing 0 with ULONG_MAX in the function find_available_max_freq? - max_freq = 0; + max_freq = ULONG_MAX; Even if you are not using OPP, these functions should provide somewhat "compatible" values. Cheers, MyungJoo > >Thanks, >Bjorn >