Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1158988ybt; Wed, 1 Jul 2020 21:07:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZDUiY8wppIepbavPmnggSpkfVGghd0x+3EcVP0/cRdokLCnAfnZPOF2/6ffA7V1/S30u3 X-Received: by 2002:a17:906:414c:: with SMTP id l12mr4955733ejk.417.1593662871872; Wed, 01 Jul 2020 21:07:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593662871; cv=none; d=google.com; s=arc-20160816; b=cHic2RrV63K3doYl/ztYomjvsB6lYh8sthpqt2XtGYi1b0xOFunfSH1o+W4ft3a/Ze QTUY2WVLQILT5LRpLHhcGV6epm0XAaaY+7D6iN36yDoQ8iB5+Ry8+6/7kBI0k6HyL02Y mf8WArTS0ko8OBUO/iEQ3/xy2MZu+j2L0OTmlfQGljFZyj6NLbpkaSDQX3kHqXvT3klF eUG38jK2+g6w1sZ1YswtT7upVy9oq8eGkVa+GnZ4A53iyAQ1AMa5YYhdxuYUCk4WHejo ogEWtnJYf+ABeFey9Xldx1AbFjlJr8K6reEvdeDGNmt51+y752z487Hy/t9mMLzm50gO +8Cg== 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=nSBloLjBMkhEq6dBnL0Yut7t5IwUXxI09+5uuRC+GYI=; b=GC9TycmemRIsXPnJed0ZB0WjJa7J8u1KyavAUD1XhpLnFji8dFHCer1OgXzyN8Vp1+ keDCFfgY8/Zb12Iu3u9fQ5b0MWQIMay1ztvekaNLA5rqSGqHxzFmQN+jeg3n4bB2zGoY b/Z00N3OFYMvjncmDSbuxZzrK6+QpJ/hfZ9dd4vTni2l1O9OPxbGn9vdq1dh56uxFzu9 Lpf3sU8HM0DBEHgNYpZQ2VIUwD4ZuyUtMH8WHb7IvbGqZk9zF/km0/M39T/6fa9SMQ4T APUwreBHLNcczkIuw7FhP85v1UzUenvs5MXK2Pn3xiKetsyykt4EOrvtWwYpQtDk47+r SDrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=AnwkEP3H; 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 lk3si4854208ejb.653.2020.07.01.21.07.28; Wed, 01 Jul 2020 21:07:51 -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=AnwkEP3H; 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 S1726184AbgGBEHL (ORCPT + 99 others); Thu, 2 Jul 2020 00:07:11 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:19043 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725857AbgGBEHL (ORCPT ); Thu, 2 Jul 2020 00:07:11 -0400 Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20200702040706epoutp04c3ada092ca7bc3d8a6918de7878c24b5~d0_W1R5pV2029820298epoutp043 for ; Thu, 2 Jul 2020 04:07:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20200702040706epoutp04c3ada092ca7bc3d8a6918de7878c24b5~d0_W1R5pV2029820298epoutp043 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1593662826; bh=nSBloLjBMkhEq6dBnL0Yut7t5IwUXxI09+5uuRC+GYI=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=AnwkEP3HZjzGy38t1rKrQ5Sq4bEi/VXmO+tZcn0w5+L4qn2Y3qoONPfDE5gM5Z1iS 6chLBFWVaLxAX0X6AJcz7dZ6+Yp1MKNpUGkRKriyyhG5pebPa4sBBiLn9KGRg42JVw 7FtrZtEJ9PV5nFBOAe/DQHd/Y2aBJxQ2fQy3+vRk= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20200702040706epcas1p4ded8bc0a4377b2e65a53400e4c98d717~d0_WUindx2564425644epcas1p4A; Thu, 2 Jul 2020 04:07:06 +0000 (GMT) Received: from epsmges1p3.samsung.com (unknown [182.195.40.158]) by epsnrtp1.localdomain (Postfix) with ESMTP id 49y4Kz693gzMqYm7; Thu, 2 Jul 2020 04:07:03 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p3.samsung.com (Symantec Messaging Gateway) with SMTP id 59.D0.29173.76D5DFE5; Thu, 2 Jul 2020 13:07:03 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas1p3.samsung.com (KnoxPortal) with ESMTPA id 20200702040703epcas1p3f8b2c6f5a3a9c49ce121659d0de215bd~d0_TY4jwO2343023430epcas1p3c; Thu, 2 Jul 2020 04:07:03 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200702040702epsmtrp1b8419846011fd7e80cd260570f732743~d0_TX5xR50526105261epsmtrp1-; Thu, 2 Jul 2020 04:07:02 +0000 (GMT) X-AuditID: b6c32a37-9b7ff700000071f5-9a-5efd5d6783da Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 68.C8.08303.66D5DFE5; Thu, 2 Jul 2020 13:07:02 +0900 (KST) Received: from [10.113.221.102] (unknown [10.113.221.102]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200702040702epsmtip24222edcb032c7d2c57cc9c880c4e3847~d0_TGzNf71793117931epsmtip2x; Thu, 2 Jul 2020 04:07:02 +0000 (GMT) Subject: Re: [PATCH v4 12/37] 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: =?UTF-8?B?QXJ0dXIgxZp3aWdvxYQ=?= , 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: <4ea7fe00-7676-3186-8222-6e0d0eb8ed1f@samsung.com> Date: Thu, 2 Jul 2020 13:18:18 +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: <20200609131404.17523-13-digetx@gmail.com> Content-Language: en-US Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPJsWRmVeSWpSXmKPExsWy7bCmrm567N84g0X/DSzuz2tltHj36Smr xfwj51gtVn98zGhx5et7NovpezexWbTMWsRicbbpDbvF5V1z2Cw+9x5htOj8MovN4uIpV4vb jSvYLCatncpo0br3CLvFv2sbWSx+7prH4iDo8f5GK7vHzll32T0unfvD7LFpVSebx51re9g8 7ncfZ/LobX7H5tG3ZRWjx+dNcgGcUdk2GamJKalFCql5yfkpmXnptkrewfHO8aZmBoa6hpYW 5koKeYm5qbZKLj4Bum6ZOUC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osR07za8jeYpZVBiKc5INNRiLipOBACK Lp0uXAMAAA== X-CMS-MailID: 20200702040703epcas1p3f8b2c6f5a3a9c49ce121659d0de215bd 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: 20200609131458epcas1p2c774a0302bcef2c02790c2cb8cad57a0 References: <20200609131404.17523-1-digetx@gmail.com> <20200609131404.17523-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 6/9/20 10:13 PM, 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 | 18 +++++++++++------- > 1 file changed, 11 insertions(+), 7 deletions(-) > > diff --git a/drivers/devfreq/tegra20-devfreq.c b/drivers/devfreq/tegra20-devfreq.c > index 6469dc69c5e0..bf504ca4dea2 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(); > @@ -151,12 +150,17 @@ 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); > + if (!mc->num_timings) { Could you explain what is meaning of 'num_timing? Also, why add the opp entry in case of mc->num_timings is zero? > + err = dev_pm_opp_add(&pdev->dev, > + clk_get_rate(tegra->emc_clock), 0); > + if (err) { > + dev_err(&pdev->dev, "failed to add OPP: %d\n", err); > + return err; > + } > + } > > - 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; > -- Best Regards, Chanwoo Choi Samsung Electronics