[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190717044923.ccmebeewbinlslkm@vireshk-i7>
Date: Wed, 17 Jul 2019 10:19:23 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Niklas Cassel <niklas.cassel@...aro.org>
Cc: Andy Gross <agross@...nel.org>, linux-arm-msm@...r.kernel.org,
jorge.ramirez-ortiz@...aro.org, sboyd@...nel.org,
vireshk@...nel.org, bjorn.andersson@...aro.org,
ulf.hansson@...aro.org, Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 11/13] arm64: dts: qcom: qcs404: Add CPR and populate OPP
table
On 16-07-19, 12:53, Niklas Cassel wrote:
> Here I cheated and simply used get_cpu_device(0).
>
> Since I cheated, I used get_cpu_device(0) always,
> so even when CPU1,CPU2,CPU3 is attached, dev_pm_opp_get_opp_count(cpu0) is
> still 0.
>
> I added a print in
> [ 3.836533] cpr_set_performance: number of OPPs for dev: cpu0: 3
>
> And there I can see that OPP count is 3, so it appears that with the
> current code, we need to wait until cpufreq-dt.c:cpufreq_init()
> has been called, maybe dev_pm_opp_of_cpumask_add_table() needs
> to be called before dev_pm_opp_get_opp_count(cpu0) actually returns 3.
>
> cpufreq_init() is called by platform_device_register_simple("cpufreq-dt", -1,
> NULL, 0);
> which is called after dev_pm_opp_attach_genpd().
>
> What I don't understand is that dev_pm_opp_attach_genpd() actually returns
> a OPP table. So why do we need to wait for dev_pm_opp_of_cpumask_add_table(),
> before either dev_pm_opp_get_opp_count(cpu0) or
> dev_pm_opp_get_opp_count(genpd_virtdev_for_cpu0) returns 3?
Ah, I see the problems now. No, cpufreq table can't be available at
this point of time and we aren't going to change that. It is the right
thing to do.
Now, even if the kernel isn't written in a way which works for you, it
isn't right to put more things in DT than required. DT is (should be)
very much independent of the Linux kernel.
So we have to parse DT to find highest frequency for each
required-opp. Best is to put that code in the OPP core and use it from
your driver.
--
viresh
Powered by blists - more mailing lists