Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1187201ybt; Wed, 1 Jul 2020 22:08:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPeiyXHUkTOxrQEDK5MnjjYsP8kbD17hxXJif0srS/TyXgQw2jWmL9CDkp1f1jvrRdm23f X-Received: by 2002:a17:906:7f90:: with SMTP id f16mr25544763ejr.507.1593666507728; Wed, 01 Jul 2020 22:08:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593666507; cv=none; d=google.com; s=arc-20160816; b=T5PPGGxYzVJ6Cn/S87vzjmZDCNBKCIAs6vml+wA7t43sg3qWFXmmGcyMVAxq66jGB/ Iwmdj7YULJ+w6GCWj/RLEtDL/0YMAE+5NrSIlObBFZHPlBGFEGd0bzgVZZOyZhyrpMUw pqCh+QQglQxT7kesua//ChxcIv5PU4nkfBj3p/gmRXt89cva6WQB3g3s7aDnSjM/PhlX T9dc72Kgz6UW31g2DRRswlUfAqcmcoEmAi6hnT0TaKBEOQH5mZlrhqQbquQf0PFBnNwW v8au0IP4ME+7mLimnR+mY0LyaqOpaspkgd9CqYOBlZ92sjv8co0Ehe0P4AK8TAgTZAdW ds0g== 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=K8qAxukp9RFHBdE6WbPdUscXd1LN37Q3w/L7nkVqajo=; b=LbVuz0C36a6//GgLZOrhdhiLzZxDJuBD4InWs1ytlovnMxYhG/3DQ5/QLD2B2gIlux VR/nco5eubni3QoTqOSMMCUZMk+3dT9ixVrWgik1d7vorQcF2ww3ggzMkMaII7oNlPxe zEsw+xuVui2lsHqFHmqWWaRi0CatT2PTJopLPyiw6iiTpwaolL/f8N6OSHhIS4+ewIVi uaSalUdW/MTtXVAAM9o33SijYbSfiuVuRMC8QCTazB2mke/C9ZCHRE5x+MNiH1XkpbC8 fJaxD4cqg4pOGXZURfREl1MNDZlx1X3+3FtrKVBUQQJ3OWAeBKu8kU7yTywh8URqKDIc br4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VqmofHQS; 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 k14si5521831ejs.400.2020.07.01.22.08.04; Wed, 01 Jul 2020 22:08:27 -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=VqmofHQS; 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 S1726425AbgGBFH0 (ORCPT + 99 others); Thu, 2 Jul 2020 01:07:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726184AbgGBFHY (ORCPT ); Thu, 2 Jul 2020 01:07:24 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C868DC08C5C1; Wed, 1 Jul 2020 22:07:23 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id s1so30047531ljo.0; Wed, 01 Jul 2020 22:07:23 -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=K8qAxukp9RFHBdE6WbPdUscXd1LN37Q3w/L7nkVqajo=; b=VqmofHQSAPlBpUCxL4rTflz7VqMU9XTFBswSFaT0mDdL6H43EXQ6FW5GHx4GlI7qGQ fEWxbeqBLWdHdB3DYZYDwPVZ0TiKrh8ErZ7LQelQzlLERoz5pvCKWWqfZaEFF2S7Qfxi nTsyD4aCv1sdijFfHId/0snc/8sfXCxZIWVg45Q9+5LcS+t2jODYxnCfWthpcsa1xAMi wUPvrBa4VAWOIzAfn3408W/wDQyJMf+AWsYE39v3QnoIg8h6UBoemF34AiS3v2wY97B3 +G8SYZZqXujqM4GXX1thRU7Z0izEwGNmZA27wVvteuiL68sk+Y/utUm12dBmn44goyca d19Q== 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=K8qAxukp9RFHBdE6WbPdUscXd1LN37Q3w/L7nkVqajo=; b=oEM7oMR4lWJMyqV451Zwlx02i5lgkpKZJoP9/jm44OKIDV+0M9OCqVy/o3DH9ruzU4 2WU6sVqTD5i1eSPWoWyglMOKPO0l8FEKK9BAB+M5qz/2woBor+mLqNCFQn6O0aYjyEKf AuzXvfJnufDB9yCe5HGWgcz6Y9mwYxTUNY6hK1OEQyxM3+8ZdyqQHK7KOPAOdW+7G8CY sMzGYJpMQhxm+XmHJzlJ6x1+SnAo0Nv+SN1ZfllgLBboWsQktKWdWYM8HfNGZUWbaG4c AdfW+Gp43EXWf2T/nOniWtRlkJS3iWZSJJxyTH56kOCEHnskYUkNb0VIhQ64JwjbiiJA TzaQ== X-Gm-Message-State: AOAM5334G8lK1a7xcI/4L2rSwHDyrewD2AltK5IhkowigPqXQkvudNWP Hn3gYiYOv3KN6+8zux/KRWBf0HnyslA= X-Received: by 2002:a2e:9b94:: with SMTP id z20mr13271728lji.404.1593666441965; Wed, 01 Jul 2020 22:07:21 -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 w19sm1331770ljm.120.2020.07.01.22.07.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Jul 2020 22:07:20 -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> From: Dmitry Osipenko Message-ID: <4b22d3ee-f303-d81d-e261-187d4a46e749@gmail.com> Date: Thu, 2 Jul 2020 08:07:19 +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: <4ea7fe00-7676-3186-8222-6e0d0eb8ed1f@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 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. > 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. 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.