Received: by 10.192.165.148 with SMTP id m20csp4134656imm; Mon, 23 Apr 2018 20:03:13 -0700 (PDT) X-Google-Smtp-Source: AIpwx48vy2edL1TTzloAg4MJ8uZwwcPBKcCutMpbf8aIE3+kZbzet22yXWcKc5je0t9LeBtjOSAr X-Received: by 2002:a17:902:33a5:: with SMTP id b34-v6mr23375285plc.232.1524538993068; Mon, 23 Apr 2018 20:03:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524538993; cv=none; d=google.com; s=arc-20160816; b=o1fAGJ13Uqu7VcQ9eyxg7svxAfJH+Am6okd+HGkA1M6ecv9DJsg+SFLSP/kr2RsqLd nQEnkrZBx9HH2o9VcCSwIcz7Op+GnslnVKXEKtRe3Ph0rxWVG1BJA+cFaAiRRGNvcDkK 17Agd+mw2WAEb345m+EWY0w/KTdAiCU157CXHczP4+/w4KbRHYXSwrLyPV9HeUNUYuxg bWUzlmA7TI3I4Kboc3MB+HQ6vhIRSc9UHfyDTKM+Fws3YP/Y0pVIwYZYnH9Yg+0vlmPK EY6iys5Aat02qokMZxgtjSJiJBbklKM/G2w1yia0XsABeykDU7JpAeNkOx0iHNWrXydQ X42A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:dlp-filter:cms-type :in-reply-to:subject:cc:to:user-agent:organization:from:date :message-id:content-transfer-encoding:mime-version:dkim-signature :dkim-filter:arc-authentication-results; bh=6g9kJUG7P5+PXpBCUHoIBFubAN9xOOA84LQhVSSFQT8=; b=tWgP5d65Dhv8zPuR3FIXuXfmY2hzGIJ11Xs9qlCax/DnV0oIj6HoVtREFt9MTbynjL apxrUr5rmGJY7uPcEyzOP/d/eMTTS+ouApGIkZqxdfoVv1JmUrB2VdbnRtNI2swtIWii 8Q5uSjRLg1oHaSQns41m3LqHKsmBfddvXYzx6niWPXIj8wo2babWtHV5sNs0VIlVqen8 RTsvYozB6Um2lNABzL/65pePiSUhyroug4MlLdW75q/6xGYGOOhRBGvcm4hu0QxbPkCn +7zYQ/4q/bxJfE06+0Gl2uWu2MxBEHKHmqnxwMtnBpkCQLUhRJ40KyNYFiQsMq8NWJIg tDxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Amvt7eyx; 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 t1si10740390pgr.580.2018.04.23.20.02.58; Mon, 23 Apr 2018 20:03:13 -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=Amvt7eyx; 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 S932817AbeDXCsO (ORCPT + 99 others); Mon, 23 Apr 2018 22:48:14 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:51080 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932721AbeDXCsL (ORCPT ); Mon, 23 Apr 2018 22:48:11 -0400 Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20180424024808epoutp0140c66075eb74e2b114b80d4715ef8bc5~oP1B9qY_81831818318epoutp01a; Tue, 24 Apr 2018 02:48:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20180424024808epoutp0140c66075eb74e2b114b80d4715ef8bc5~oP1B9qY_81831818318epoutp01a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1524538088; bh=6g9kJUG7P5+PXpBCUHoIBFubAN9xOOA84LQhVSSFQT8=; h=Date:From:To:Cc:Subject:In-reply-to:References:From; b=Amvt7eyxoE6fJxefJWnu6ocLjmAiAsnhqkvMImGQjINXN6+ItvWQWfFBb7LICaNKp LPelLuXh6XmOybbyrPboy63lRsLNIQ1VDiwiz3pegBUk7ka+PjSo3lGpRQKK16MIRZ a7WlKgSKNVnorkxZldT1Jtk7ZFYXhv+tJpPCNkEQ= Received: from epsmges1p2.samsung.com (unknown [182.195.40.157]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20180424024807epcas1p3bd0d60adddf9dfa3cfa4116c3013311b~oP1AuQSfm2880728807epcas1p3T; Tue, 24 Apr 2018 02:48:07 +0000 (GMT) Received: from epcas1p4.samsung.com ( [182.195.41.48]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id D1.9E.04135.7EA9EDA5; Tue, 24 Apr 2018 11:48:07 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20180424024807epcas1p1f85806e5a4b8258fb1912420df94ca1a~oP1AgVOsK1182711827epcas1p19; Tue, 24 Apr 2018 02:48:07 +0000 (GMT) X-AuditID: b6c32a36-b6dff70000001027-c3-5ade9ae7d72d Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 86.CA.03822.7EA9EDA5; Tue, 24 Apr 2018 11:48:07 +0900 (KST) MIME-version: 1.0 Content-transfer-encoding: 8BIT Content-type: text/plain; charset="UTF-8" Received: from [10.113.63.77] by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P7O00L9L5469W50@mmp1.samsung.com>; Tue, 24 Apr 2018 11:48:07 +0900 (KST) Message-id: <5ADE9AE6.9090601@samsung.com> Date: Tue, 24 Apr 2018 11:48:06 +0900 From: Chanwoo Choi Organization: Samsung Electronics User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 To: Bjorn Andersson , MyungJoo Ham , Kyungmin Park Cc: 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 In-reply-to: <20180424002016.9205-2-bjorn.andersson@linaro.org> X-Brightmail-Tracker: H4sIAAAAAAAAA02SfUhTURjGObt3916r1WmpHSaZ3YhQcu1uTW+l2Rc1yj+MkGJRdtGbrtxH u1MqiMpMY6W5PhSW2ZSiWFCh5aa2rFXYp4TDilKLxPVBWSlmgVTbrlF/nee85/e857wPh8Lk NYSCMphsvNXEFdLEBLz5TqIq+Z2zT6/yjSnYR+2DOOt2mNgnJZ9I1tH+hGQDrbUEO1xxF7BH nnsJ9kLHLwn76sBFgvXW72Hv//RiSyfqApUVEl2Ls5fU9Ty7Qeje+Jtw3beBl7iu8pob6IYb 47NIPZ9WwHN5vDWBN+Wa8wym/HR67fqcFTnaFBWTzCxkU+kEE2fk0+mVmVnJqwyFoSfSCcVc YVGolMUJAj1/SZrVXGTjEwrMgi2d3sQwaiWjSlWq1aFVs3mRWhtCtvIF1Xa71DIcvevs8Wf4 ftAP7YCiEFyAXI2sHUyg5NAL0KGqUVzcjAL0uemN1A6iIlDXWBspHrQBVB24jYcPZHAq+nGi Dw93wuBMdLdrR7iMwUR0ve3KON8L0E3PMSDySehq8BER1jicg0YfjEQ0Eaq3v38R0VPgLNT9 oz/Cx8CNqOXs90ijaFgGUMlQDwhvMNgqQedd58jwzdNgJur8ZAkbomAGGjrtwcIMgr8JVFoz ND7CSvTuswOIehr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ZqakFqEUyWiYNTqoFRZXnwokKmvJSY+TZl UwTrC95srG0pyXJuYuBgWVwjuTEi7KPktpq9i7JWHl2pm/+iXuH8tBT+b4wnKn3Wufd2C1xZ 8+3eU2PTv29n65S/T5i/uuP8n8mrK7d2fDujfvXL3HaP5fq1fc9VE9buKV7F/lbQhOlW97Up YXGGpytn7c0095NQnhaoxFKckWioxVxUnAgAWPhWjI4CAAA= X-CMS-MailID: 20180424024807epcas1p1f85806e5a4b8258fb1912420df94ca1a X-Msg-Generator: CA CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20180424002041epcas5p11439bec6de910c2a465c5cf3acb45a3b X-RootMTR: 20180424002041epcas5p11439bec6de910c2a465c5cf3acb45a3b References: <20180424002016.9205-1-bjorn.andersson@linaro.org> <20180424002016.9205-2-bjorn.andersson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(). 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. > } > > static unsigned long find_available_max_freq(struct devfreq *devfreq) > { > - struct dev_pm_opp *opp; > - unsigned long max_freq = ULONG_MAX; > - > - opp = dev_pm_opp_find_freq_floor(devfreq->dev.parent, &max_freq); > - if (IS_ERR(opp)) > - max_freq = 0; > - else > - dev_pm_opp_put(opp); > + struct devfreq_dev_profile *profile = devfreq->profile; > > - return max_freq; > + return profile->freq_table[profile->max_state - 1]; > } ditto. > > /** > -- Best Regards, Chanwoo Choi Samsung Electronics