Received: by 10.192.165.148 with SMTP id m20csp4995351imm; Tue, 24 Apr 2018 11:50:15 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpCtl/ibjB4bwyaFXYKqMkFREKQj3iIL10cHPmWbXt0RMRyYbzcuMJCvCwR5VN5ZPyq4L4u X-Received: by 2002:a17:902:aa04:: with SMTP id be4-v6mr2317930plb.20.1524595815888; Tue, 24 Apr 2018 11:50:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524595815; cv=none; d=google.com; s=arc-20160816; b=ks47fANcFrIVrVhY42SkjH38AAW7KCuqwVZYGUpRvHgn2fqhJDWXeQUMSlKZoXwzBa 4OPqeVb6PipfV0hxDLnv9onDvTj+IrJf1pamjIbu0Th2r+LSR/80dlZJMzgWA9vL0dGB JMRHtZR0a4dHzErO4pN0E10cQeAC1wZHEbOAhO9a9V7aEBHed5HyKW4GD/t3ub4IwYNI DrABe7MLgcx1GL5nrQiL6sxgKF4GWCs+I4QUuM0FNbbTB1ExBQZWcY23/Wt2c7t9WWPW c5FEipU9dNjjOyrvtS+bWVq8mZPLHngD0ZTRdX07m1rMI4sAGz+Op9+Wp8bwmZqhmyVy lNdw== 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=0CG34JnXQamqOweymh6BTYbgTK6NuVvqriwYI0ch4lE=; b=LIOFDxEa3AzpELF4TQ3ZR2I5G7Ar25B7nIaB5fBDxJle66j2biwRaPEMhmH9ipsVRp +4MDDfIsyf+G6+uHRORcn32Ryt6B/6z4GywCPLL2Ezpv2IEpZqom/vi3jfpzmY9ZX5hs Q6u98x2KDok4+sFcp0qhGvyJRTEhdCF6FUOOtQnVudIZq7/qdKMqLeu+pujG+1DS92q+ usVFoWX+0l8rR3JR1JQTUdRfLa7FRUh2d5FFgqD5++AqAUXy0TArwF8qSjvNSjJR3ysE SKhPAcw2ZSjANV++A0vNeTNIGtQnFp0bMTox+HQWcmDTX0v3wHy9JCFfhEJOk6NRdPcD xu0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=euRuTKYN; 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 f64-v6si14907454plf.514.2018.04.24.11.50.01; Tue, 24 Apr 2018 11:50:15 -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=euRuTKYN; 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 S1752075AbeDXSso (ORCPT + 99 others); Tue, 24 Apr 2018 14:48:44 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:39027 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751740AbeDXSsm (ORCPT ); Tue, 24 Apr 2018 14:48:42 -0400 Received: by mail-pf0-f194.google.com with SMTP id z9so13019748pfe.6 for ; Tue, 24 Apr 2018 11:48:41 -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=0CG34JnXQamqOweymh6BTYbgTK6NuVvqriwYI0ch4lE=; b=euRuTKYNiKYcFtwyIdxMhoAIAczgWLaJUkdqWTpm5NZBVruOQdv+4wbQtRVmhlyQBC emZccxrocwI6EeSmACzwuJ8FV9U8EjCEuGEibGgKodEDtyWuFYNeGREUCyDkiTv7H54a RV1KEuZ8+WuEGr5B2DDgWnUg/Ucixuyv3i0dc= 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=0CG34JnXQamqOweymh6BTYbgTK6NuVvqriwYI0ch4lE=; b=RCjlwdKqwWu+JLJq52auFj5iy88LUnGNVu3pCo+K1pZfVZLnlRBIm7Vzq83l+pD+F0 VFlRNjrOuPGXNoWicrFvYPyOWpTK3djr8it9xIA3gRsFHZEoSm/fJh7JGe4U1tYga2qR 8VoBRemXKWJsxF7YGXsTl9v+1LyhSXoTszsIZfTT9lvw3o5T8rxAkf/EqHwemSm/O0mX DSu9m4CJH4txw/3tjRfxPag7C5EaJC/A7q2vPQx2j/seg8UXlHpHKOCqOy+PcewpLPAo qHXyyJ6KovUkLziYpHGId+1l24mEhzkVE5mwsd9AW7uMO2/6m/kxR03mrcxiemRNBWGo 1/9Q== X-Gm-Message-State: ALQs6tB3EyLxTnOHZEuvLQphqpIhi7bt0mAy9KUcczXNenIdaVIdOXXh WXP8pIAlC2/4cjvbWGBPVfxXLg== X-Received: by 10.101.91.73 with SMTP id y9mr20861760pgr.93.1524595721281; Tue, 24 Apr 2018 11:48:41 -0700 (PDT) Received: from minitux (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id k126sm33018030pfc.142.2018.04.24.11.48.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Apr 2018 11:48:40 -0700 (PDT) Date: Tue, 24 Apr 2018 11:48:38 -0700 From: Bjorn Andersson To: MyungJoo Ham Cc: Chanwoo Choi , 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: <20180424184838.GD18510@minitux> References: <20180424052916.GD2052@tuxbook-pro> <20180424002016.9205-1-bjorn.andersson@linaro.org> <20180424002016.9205-2-bjorn.andersson@linaro.org> <5ADE9AE6.9090601@samsung.com> <529236451.01524550500717.JavaMail.epsvc@epcpmgr01> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <529236451.01524550500717.JavaMail.epsvc@epcpmgr01> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 23 Apr 23:09 PDT 2018, MyungJoo Ham wrote: > >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. > I also need to make set_freq_table() handle the case where there is no opp table and change a min_freq of 0 from being treated as an error. With this I think we're back at supporting using devfreq without specifying any available frequencies. I am however uncertain if this should be considered valid use of devfreq. Regards, Bjorn