Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp13881pxa; Thu, 13 Aug 2020 17:51:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzM4M3z4xbmwMyD6RAe8DOJRZqE04Eg+oKntxOdFXgEvJDXRvmfIhM606vIqUXDnK5j/BVn X-Received: by 2002:a05:6402:174d:: with SMTP id v13mr6969371edx.231.1597366271625; Thu, 13 Aug 2020 17:51:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597366271; cv=none; d=google.com; s=arc-20160816; b=ItiSWjk5OC3GICK855eG/M2iwueAFKnGFGMhl6rgSEVLeYZFFigLs0bHWJbIVRhpUm 0WeTz5lacofArJhWF2+Vod81lgs6UcURWT9MoKa9vYqYxBQBiyJYFSrvu/nb4F1dYDq1 dytPCSLR4mCvLsUH/jEg5RxrsQ35RC3C+rsudXrrk59YoXb9UygRDXGf5jrVQMdgOC7n 5lDw58AvP/n7bLXpCROIPmKJbkRPTucOGxqgW/69vXfU84S6rx098d95VvouXQ3p56q9 uQQMTv92cdzzF0iXLaMKTNAaguTwTwE6ysinO1oXgLjuYA/6CE7Xl0KFNs39IswiPKvN US2A== 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 :content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:organization:from:cc:to:subject :dkim-signature:dkim-filter; bh=e4Xon6lpxSkKHbuO67+S1JkH0bpnqs6utJMAst9eaWQ=; b=EAnDvYXdqBbc4WQKp1DqlqjtAkgXsLqY5Lu4f9Ol853mm+1D+cqnZ4L6JP7S1zuAXT ncjIH18GHDGda8KnmIr/vJFG0gZIuyn2A2kFeArdN1a/aY7Y5YnrMh/GLXZM5SsdXslN XsnfeVmpMyvwO1dvLGSPcvoLSPKyflUh79O9hp7bVPrxFAvlY12OVdTGVb0YJf07JFBv PyLVTVXKM6MptNZ7VFLBpyvSVtcJwH00LpJIi9DF4Gv04tIyugtYmF1NnyAE40buhzYa c/TtqUZPzXSK81qWBdcqYoMK1zhiGH6oRefS+efa5IlymYsR7+nrPA/wuhO1q+E/bPZv ZdVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=V83dDb2d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id m19si4321844edq.355.2020.08.13.17.50.47; Thu, 13 Aug 2020 17:51:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=V83dDb2d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726637AbgHNAsw (ORCPT + 99 others); Thu, 13 Aug 2020 20:48:52 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:50822 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726627AbgHNAsw (ORCPT ); Thu, 13 Aug 2020 20:48:52 -0400 Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20200814004847epoutp04a03873b0b5d7a358f762aad9a02841a9~q-Ae7Jykm1585915859epoutp04f for ; Fri, 14 Aug 2020 00:48:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20200814004847epoutp04a03873b0b5d7a358f762aad9a02841a9~q-Ae7Jykm1585915859epoutp04f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1597366128; bh=e4Xon6lpxSkKHbuO67+S1JkH0bpnqs6utJMAst9eaWQ=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=V83dDb2d69JHn7xuocrwp79il8KJhEnIrV4IBGMh+3b4LTwSgO27VDHzODIIaDAM/ tCQK0IJrXJMxp0mwO5pAb5ikB2W3disLYVyoXAB1YdRiykRvC3UI3KEa3KSFPeAKDm v/pLJtm9xY632E5wBJaIFXGajG6Y2vrB8Yb2ivIg= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20200814004847epcas1p202f4fea01ce691ab260db05de02f09b2~q-AedKpw52393723937epcas1p2v; Fri, 14 Aug 2020 00:48:47 +0000 (GMT) Received: from epsmges1p3.samsung.com (unknown [182.195.40.152]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4BSPvK1nW3zMqYkY; Fri, 14 Aug 2020 00:48:45 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmges1p3.samsung.com (Symantec Messaging Gateway) with SMTP id 96.06.29173.D6FD53F5; Fri, 14 Aug 2020 09:48:45 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200814004844epcas1p1b1a40e6e5106231df3abc92e5e5d5158~q-Ab9aMUX2057120571epcas1p1Y; Fri, 14 Aug 2020 00:48:44 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200814004844epsmtrp1d8e5fc0929ed11503a5c137a56580896~q-Ab8g-tE1694616946epsmtrp1C; Fri, 14 Aug 2020 00:48:44 +0000 (GMT) X-AuditID: b6c32a37-9cdff700000071f5-ca-5f35df6d4f8f Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id B7.47.08303.C6FD53F5; Fri, 14 Aug 2020 09:48:44 +0900 (KST) Received: from [10.113.221.102] (unknown [10.113.221.102]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200814004844epsmtip2e3561dec68fbdd0d219f8de608946601~q-AbqMUbS0941709417epsmtip2a; Fri, 14 Aug 2020 00:48:44 +0000 (GMT) Subject: Re: [PATCH v5 12/36] PM / devfreq: tegra20: Use MC timings for building OPP table To: Dmitry Osipenko , Thierry Reding , Jonathan Hunter , Georgi Djakov , Rob Herring , Michael Turquette , Stephen Boyd , Peter De Schrijver , MyungJoo Ham , Kyungmin Park , Mikko Perttunen Cc: linux-tegra@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org From: Chanwoo Choi Organization: Samsung Electronics Message-ID: <784f000f-17fd-550d-382c-1f9c11ce808b@samsung.com> Date: Fri, 14 Aug 2020 10:00:45 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:59.0) Gecko/20100101 Thunderbird/59.0 MIME-Version: 1.0 In-Reply-To: <20200814000621.8415-13-digetx@gmail.com> Content-Language: en-US Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJJsWRmVeSWpSXmKPExsWy7bCmvm7ufdN4g3eTOCzefXrKajH/yDlW i9UfHzNaXPn6ns1i+t5NbBYtsxaxWJxtesNucXnXHDaLz71HGC06v8xis7h4ytXiduMKNotJ a6cyWrTuPcJu8e/aRhaLn7vmsTgIeLy/0crusXPWXXaPS+f+MHtsWtXJ5nHn2h42j/vdx5k8 epvfsXn0bVnF6PF5k1wAZ1S2TUZqYkpqkUJqXnJ+SmZeuq2Sd3C8c7ypmYGhrqGlhbmSQl5i bqqtkotPgK5bZg7QG0oKZYk5pUChgMTiYiV9O5ui/NKSVIWM/OISW6XUgpScAssCveLE3OLS vHS95P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40e6e5106231df3abc92e5e5d5158 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20200814000944epcas1p4da08e1a6b03c80013a997fdc856a9486 References: <20200814000621.8415-1-digetx@gmail.com> <20200814000621.8415-13-digetx@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dmitry, On 8/14/20 9:05 AM, Dmitry Osipenko wrote: > The clk_round_rate() won't be usable for building OPP table once > interconnect support will be added to the EMC driver because that CLK API > function limits the rounded rate based on the clk rate that is imposed by > active clk-users, and thus, the rounding won't work as expected if > interconnect will set the minimum EMC clock rate before devfreq driver is > loaded. The struct tegra_mc contains memory timings which could be used by > the devfreq driver for building up OPP table instead of rounding clock > rate, this patch implements this idea. > > Signed-off-by: Dmitry Osipenko > --- > drivers/devfreq/tegra20-devfreq.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/drivers/devfreq/tegra20-devfreq.c b/drivers/devfreq/tegra20-devfreq.c > index 6469dc69c5e0..a985f24098f5 100644 > --- a/drivers/devfreq/tegra20-devfreq.c > +++ b/drivers/devfreq/tegra20-devfreq.c > @@ -123,8 +123,7 @@ static int tegra_devfreq_probe(struct platform_device *pdev) > { > struct tegra_devfreq *tegra; > struct tegra_mc *mc; > - unsigned long max_rate; > - unsigned long rate; > + unsigned int i; > int err; > > mc = tegra_get_memory_controller(); > @@ -135,6 +134,11 @@ static int tegra_devfreq_probe(struct platform_device *pdev) > return err; > } > > + if (!mc->num_timings) { > + dev_info(&pdev->dev, "memory controller has no timings\n"); > + return -ENODEV; > + } > + > tegra = devm_kzalloc(&pdev->dev, sizeof(*tegra), GFP_KERNEL); > if (!tegra) > return -ENOMEM; > @@ -151,12 +155,8 @@ static int tegra_devfreq_probe(struct platform_device *pdev) > > tegra->regs = mc->regs; > > - max_rate = clk_round_rate(tegra->emc_clock, ULONG_MAX); > - > - for (rate = 0; rate <= max_rate; rate++) { > - rate = clk_round_rate(tegra->emc_clock, rate); > - > - err = dev_pm_opp_add(&pdev->dev, rate, 0); > + for (i = 0; i < mc->num_timings; i++) { > + err = dev_pm_opp_add(&pdev->dev, mc->timings[i].rate, 0); > if (err) { > dev_err(&pdev->dev, "failed to add opp: %d\n", err); > goto remove_opps; > Ackded-by: Chanwoo Choi -- Best Regards, Chanwoo Choi Samsung Electronics