Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1204531ybt; Wed, 1 Jul 2020 22:44:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdIWr5kMR3EpfaNHHxDUROxEfEQ6e18rp2Pw3Tm/UWF6cV3DtLUZwe2MvM6jkZEPBwVf0S X-Received: by 2002:a50:f109:: with SMTP id w9mr31593322edl.277.1593668647519; Wed, 01 Jul 2020 22:44:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593668647; cv=none; d=google.com; s=arc-20160816; b=qFUuVZRoRieUHW5BZgJROJFgn6SXbEpO9LkeYUvBDKxnZZ2Tm2xffQYHhzbpqYD+Mr vbXW5jd+gbiNvq0+W6mdLECyHbUMUU+B0IA/Z09TbV/Lsbcoz2mUNPGNeqMcN0OHB/+Y ydZmYcpJrTbybxrQXJbyWhGCChnLXpzDTcw0Aiic5bLjlSwvHdkg7yGgguOzPptJPJT1 kqn2w1xXAaDLYF0sjnlkmzaxBzynxRlqMcn2+yTELxSTMIZMlWlbt4DUcfCsEoCS1Bq3 nXutHgthV1QwVvShMnUUz+CyepMPIdrY8hQBpS0XIO1sV+ydRzO9gyGDSl/pTKXPNGtv JTqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=8q209O2LZaPOsMqrkcwLXZ9FBAITgOWF27/Mx+CT9XE=; b=UoFameAcDpww5vcqMGjGTFXG5+BzraQQDJmrZ8DYJVweVYgn1EZw/Q8dztrFveJkjb Hy40c9kJNRqNv7aIo/dDuJFLTeEi4T5sQYw+5nJBkcIee1X9GlzMQfe5QJi1JlPGqVsv MtFBxm2UxJ5sz1z7RZu1YELpXjwLjxkqNtQf96Rg44y0vhJCnTQdoiDWl8+AGHKUgfvC HfJwrdxusZh0wG3Iu/8CaeVd2wzjatX2XVPIbqwCesNpwFdvBW6844a94jHG2AkhLJ8l 43UNJQA8JA2wpF07J9pHtWCwDVWwcIF3P9JZ+JZhdVP0JyXKuxFrHL//ETydZ66/18jH DIJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=m6mNKjiO; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m27si5216014eja.699.2020.07.01.22.43.44; Wed, 01 Jul 2020 22:44:07 -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=@gmail.com header.s=20161025 header.b=m6mNKjiO; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726045AbgGBFnf (ORCPT + 99 others); Thu, 2 Jul 2020 01:43:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725263AbgGBFne (ORCPT ); Thu, 2 Jul 2020 01:43:34 -0400 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 435FAC08C5C1; Wed, 1 Jul 2020 22:43:34 -0700 (PDT) Received: by mail-lj1-x244.google.com with SMTP id h22so22975382lji.9; Wed, 01 Jul 2020 22:43:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=8q209O2LZaPOsMqrkcwLXZ9FBAITgOWF27/Mx+CT9XE=; b=m6mNKjiOin5lgFBuoN5BSEkJnGnaqUFj0LyH9vfXAI5kXFAMaAD6Gk3FH/jPRl178h fQQTlpUePeq4EXUm+oADV3rXutKG7wXyJp3IncAg0FLgPdK/lnLbIYinqm7vTd5aTomr bRsdSbtBZyNLj8Cmo9hNk0ljmnqAHKyZaHUxC2Krf5RbVQPtqeBl/I1c+fH6u/cU4H0e o7KEvY2B/Zd/aMNH0/sxZjXV+Y1pDAzxvquulWy91PqKwp6x8Iv7ZGcv4rrLL+7Ze3nq zIAOFLXLO4GSLT/gZxs45TYfQE8HBqC6n+Zd1SBHCeT736pqB73Rpxq0lCY03gtwKQK7 kjdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=8q209O2LZaPOsMqrkcwLXZ9FBAITgOWF27/Mx+CT9XE=; b=bPHXNhJSU7y/SPcPP2TiZmVqkeOg6nufoxFvLdcx9VMZSkn/kg5oydqsqWX+mgj5yR YP8Nwy8TMbO1J6zpVGeRA9OfdBgkH/av4pCBP9Kjiht4JFGyl8yU/KvE0NWX4r2G42CV b+SmnUKGQYvl4VPCgRGFKA0EUy4SbGsgDVTDQYuCoXi0jnwLyipyP4DuNSFOBe5e0VFU LKNpj+wZUBYjPE6pG458rsCjyyHCqN3igY120j+jBGvgDqCsrF2f7rtJt8mqzCwoCqkT +SwXsI6/qpo9ogNmEnj2kIJrWzh7wJnFfYPNy64horoSacCu0mVQ8i6lZMggwSU+UUxG mSkw== X-Gm-Message-State: AOAM533KuPA8IbtEkWnvPCc79rUA9mUdNcauxjyStIM4kaiNvHRY52mC SKVElh5D4YBamJLqELkAJTe458BhVrQ= X-Received: by 2002:a2e:9c51:: with SMTP id t17mr6402902ljj.333.1593668612201; Wed, 01 Jul 2020 22:43:32 -0700 (PDT) Received: from [192.168.2.145] (79-139-237-54.dynamic.spd-mgts.ru. [79.139.237.54]) by smtp.googlemail.com with ESMTPSA id w24sm2937288lfl.17.2020.07.01.22.43.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Jul 2020 22:43:31 -0700 (PDT) Subject: Re: [PATCH v4 12/37] PM / devfreq: tegra20: Use MC timings for building OPP table To: Chanwoo Choi , 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 References: <20200609131404.17523-1-digetx@gmail.com> <20200609131404.17523-13-digetx@gmail.com> <4ea7fe00-7676-3186-8222-6e0d0eb8ed1f@samsung.com> <4b22d3ee-f303-d81d-e261-187d4a46e749@gmail.com> <2069fb51-f043-795d-7768-0024fc9a9f4e@samsung.com> From: Dmitry Osipenko Message-ID: <7988b6cf-e60c-7e5c-ffc3-8075c20af3d3@gmail.com> Date: Thu, 2 Jul 2020 08:43:30 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <2069fb51-f043-795d-7768-0024fc9a9f4e@samsung.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 02.07.2020 08:30, Chanwoo Choi пишет: > On 7/2/20 2:07 PM, Dmitry Osipenko wrote: >> 02.07.2020 07:18, Chanwoo Choi пишет: >>> 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? >> >> The num_timings is the number of memory timings defined in a >> device-tree. One timing configuration per memory clock rate. > > OK. I understand. > >> >>> Also, why add the opp entry in case of mc->num_timings is zero? >> >> Timings may be not defined in some device-trees at all and in this case >> memory always running on a fixed clock rate. > > You mean that 'timings' information is optional? Yes Actually, looks like I missed to properly test this case where timings are missing in DT and it shouldn't work with the current code. I'll fix it in the next version. >> >> The devfreq driver won't be practically useful if mc->num_timings is >> zero since memory frequency can't be changed, but anyways we'd want to >> load the devfreq driver in order to prevent confusion about why it's not >> loaded. >> >> For example, you may ask somebody to show contents of >> /sys/class/devfreq/tegra20-devfreq/trans_stat and the person says to you >> that this file doesn't exist, now you'll have to figure out what >> happened to the devfreq driver. > > I understand why add OPP entry point when timing is not defined on DT. > But, actually, I think that you better to change 'timings' info is mandatory > instead of optional. Because the devfreq driver is for DVFS > and the driver supporting DVFS have to have the frequency information > like OPP. > > Or, > If you want to keep 'timing' is optional on DT, > I recommend that you add one timing data to tegra mc driver > when DT doesn't include the any timing information > I think that is it more clear. Okay, I'll move it into the MC driver in the next version. Thank you for the review!