From: Mark Zhang <nvmarkzhang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Lucas Stach <dev-8ppwABl0HbeELgA04lAiVw@public.gmane.org>
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Thierry Reding
<thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>,
Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
Subject: Re: [PATCH 1/3] ARM: tegra: add EMC clock scaling API
Date: Tue, 18 Dec 2012 16:09:27 +0800 [thread overview]
Message-ID: <50D024B7.400@gmail.com> (raw)
In-Reply-To: <1355743334.1490.7.camel@tellur>
On 12/17/2012 07:22 PM, Lucas Stach wrote:
> Hi Mark,
>
> Am Montag, den 17.12.2012, 19:08 +0800 schrieb Mark Zhang:
>> If my understanding is right, I think this is a temporary solution.
>> Because this kind of requirement should be addressed by DVFS subsystem.
>>
> Yes, this can go away, once proper DVFS is added. But maybe it can also
> be an example of how things could be done there.
[...]
>
>>> #include <linux/platform_device.h>
>>> #include <linux/platform_data/tegra_emc.h>
>>> +#include <linux/types.h>
>>> +#include <memory/tegra_emc_performance.h>
>>
>> Why don't you put this file into the directory which "tegra_emc.h"
>> resides? I think that'll be easy to find and understand.
>>
> Because my understanding is that mach-tegra is not the right place for
> include files that are used by normal drivers and not just the platform
> code.
>
Tegra emc driver is not "normal" driver, it's highly tegra related.
"tegra_emc_performance.h" is also tegra related so I think it's not good
to put it into a generic directory, just like "include/memory" here.
>>>
>>> #include "tegra2_emc.h"
>>> #include "fuse.h"
>>> @@ -35,8 +38,16 @@ static bool emc_enable;
>>> #endif
>>> module_param(emc_enable, bool, 0644);
>>>
>>> +struct emc_superclient_constraint {
>>> + int bandwidth;
>>> + enum tegra_emc_perf_level perf_level;
>>> +};
>>> +
>>> +static struct emc_superclient_constraint constraints[TEGRA_EMC_SC_NUM];
>>> +
>>> static struct platform_device *emc_pdev;
>>> static void __iomem *emc_regbase;
>>> +static struct clk *emc_clk;
>>
>> Instead of using global variables, it's better to save it into a driver
>> private structure. Although this way is easy to write. :)
>> I think when we start upstream works on DVFS, an emc driver private
>> structure is needed so we can do this right now.
>>
> I can certainly do this. It will increase the churn of the patch a bit,
> but I think your concern is valid and I'll address it in V2.
>
>>>
>>> static inline void emc_writel(u32 val, unsigned long addr)
>>> {
>>> @@ -176,6 +187,64 @@ int tegra_emc_set_rate(unsigned long rate)
>>> return 0;
>>> }
>>>
>>> +static void tegra_emc_scale_clock(void)
>>> +{
>>> + u64 bandwidth_floor = 0;
>>> + enum tegra_emc_perf_level highest_level = TEGRA_EMC_PL_LOW;
>>> + unsigned long clock_rate;
>>> + int i;
>>> +
>>> + for (i = 0; i < ARRAY_SIZE(constraints); i++) {
>>> + bandwidth_floor += constraints[i].bandwidth;
>>
>> Get confused here. Why we add all bandwidth up? We should loop all the
>> bandwidth requests in "constraints" array, find out the largest one,
>> compare with emc table then finally write the registers and set the emc
>> clock, isn't it?
>>
> No, bandwidth constraints add up. Imagine two display clients scanning
> out at the same time. Both on their own may be satisfied with 83MHz DRAM
> clock, but if they are running at the same time you have to account for
> that and maybe bump DRAM freq to 133MHz.
Ah, yes, this is correct for dc. I skimmed the downstream kernel codes
and found that there are different logics for different clients. For DC,
their bandwidth request should be added up. For other clients, e.g: USB,
set to max bandwidth request is OK.
So we may do more works on this part later, to write a more accurate
algorithms to get the final emc rate. For now, it's OK.
>
> Regards,
> Lucas
>
>
next prev parent reply other threads:[~2012-12-18 8:09 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-14 20:14 [PATCH 0/3] Tegra EMC clock scaling API Lucas Stach
[not found] ` <1355516086-11116-1-git-send-email-dev-8ppwABl0HbeELgA04lAiVw@public.gmane.org>
2012-12-14 20:14 ` [PATCH 1/3] ARM: tegra: add " Lucas Stach
[not found] ` <1355516086-11116-2-git-send-email-dev-8ppwABl0HbeELgA04lAiVw@public.gmane.org>
2012-12-17 11:08 ` Mark Zhang
[not found] ` <50CEFD28.7080601-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-17 11:18 ` Mark Zhang
[not found] ` <50CEFF8B.5030901-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-17 11:23 ` Lucas Stach
2012-12-17 11:22 ` Lucas Stach
2012-12-18 8:09 ` Mark Zhang [this message]
[not found] ` <50D024B7.400-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-18 9:11 ` Lucas Stach
2012-12-18 11:50 ` Mark Zhang
[not found] ` <50D05891.3070006-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-18 12:02 ` Lucas Stach
2012-12-19 3:21 ` Mark Zhang
2012-12-17 21:23 ` Stephen Warren
[not found] ` <50CF8D51.6020208-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-12-17 21:43 ` Lucas Stach
2012-12-17 21:57 ` Stephen Warren
2012-12-14 20:14 ` [PATCH 2/3] ARM: tegra: use new EMC clock scaling API in CPUfreq driver Lucas Stach
2012-12-14 20:14 ` [PATCH 3/3] ARM: tegra: drm: use new EMC clock scaling API to reserve DC bandwidth Lucas Stach
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50D024B7.400@gmail.com \
--to=nvmarkzhang-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=dev-8ppwABl0HbeELgA04lAiVw@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
--cc=thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).