Message ID | 1582099197-20327-11-git-send-email-peng.fan@nxp.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ARM: imx7ulp: add cpufreq using cpufreq-dt | expand |
On 19-02-20, 15:59, peng.fan@nxp.com wrote: > From: Peng Fan <peng.fan@nxp.com> > > Platforms may need to implement platform specific get_intermediate and > target_intermediate hooks. > > Update cpufreq-dt driver's platform data to contain those for such > platforms. > > Signed-off-by: Peng Fan <peng.fan@nxp.com> > --- > drivers/cpufreq/cpufreq-dt.c | 4 ++++ > drivers/cpufreq/cpufreq-dt.h | 4 ++++ > 2 files changed, 8 insertions(+) > > diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c > index d2b5f062a07b..26fe8dfb9ce6 100644 > --- a/drivers/cpufreq/cpufreq-dt.c > +++ b/drivers/cpufreq/cpufreq-dt.c > @@ -363,6 +363,10 @@ static int dt_cpufreq_probe(struct platform_device *pdev) > dt_cpufreq_driver.resume = data->resume; > if (data->suspend) > dt_cpufreq_driver.suspend = data->suspend; > + if (data->get_intermediate) { > + dt_cpufreq_driver.target_intermediate = data->target_intermediate; > + dt_cpufreq_driver.get_intermediate = data->get_intermediate; > + } > } > > ret = cpufreq_register_driver(&dt_cpufreq_driver); > diff --git a/drivers/cpufreq/cpufreq-dt.h b/drivers/cpufreq/cpufreq-dt.h > index a5a45b547d0b..28c8af7ec5ef 100644 > --- a/drivers/cpufreq/cpufreq-dt.h > +++ b/drivers/cpufreq/cpufreq-dt.h > @@ -14,6 +14,10 @@ struct cpufreq_policy; > struct cpufreq_dt_platform_data { > bool have_governor_per_policy; > > + unsigned int (*get_intermediate)(struct cpufreq_policy *policy, > + unsigned int index); > + int (*target_intermediate)(struct cpufreq_policy *policy, > + unsigned int index); Who calls them ?
Hi Viresh, > Subject: Re: [PATCH v2 10/14] cpufreq: dt: Allow platform specific > intermediate callbacks > > On 19-02-20, 15:59, peng.fan@nxp.com wrote: > > From: Peng Fan <peng.fan@nxp.com> > > > > Platforms may need to implement platform specific get_intermediate and > > target_intermediate hooks. > > > > Update cpufreq-dt driver's platform data to contain those for such > > platforms. > > > > Signed-off-by: Peng Fan <peng.fan@nxp.com> > > --- > > drivers/cpufreq/cpufreq-dt.c | 4 ++++ drivers/cpufreq/cpufreq-dt.h | > > 4 ++++ > > 2 files changed, 8 insertions(+) > > > > diff --git a/drivers/cpufreq/cpufreq-dt.c > > b/drivers/cpufreq/cpufreq-dt.c index d2b5f062a07b..26fe8dfb9ce6 100644 > > --- a/drivers/cpufreq/cpufreq-dt.c > > +++ b/drivers/cpufreq/cpufreq-dt.c > > @@ -363,6 +363,10 @@ static int dt_cpufreq_probe(struct platform_device > *pdev) > > dt_cpufreq_driver.resume = data->resume; > > if (data->suspend) > > dt_cpufreq_driver.suspend = data->suspend; > > + if (data->get_intermediate) { > > + dt_cpufreq_driver.target_intermediate = > data->target_intermediate; > > + dt_cpufreq_driver.get_intermediate = data->get_intermediate; > > + } > > } > > > > ret = cpufreq_register_driver(&dt_cpufreq_driver); > > diff --git a/drivers/cpufreq/cpufreq-dt.h > > b/drivers/cpufreq/cpufreq-dt.h index a5a45b547d0b..28c8af7ec5ef 100644 > > --- a/drivers/cpufreq/cpufreq-dt.h > > +++ b/drivers/cpufreq/cpufreq-dt.h > > @@ -14,6 +14,10 @@ struct cpufreq_policy; struct > > cpufreq_dt_platform_data { > > bool have_governor_per_policy; > > > > + unsigned int (*get_intermediate)(struct cpufreq_policy *policy, > > + unsigned int index); > > + int (*target_intermediate)(struct cpufreq_policy *policy, > > + unsigned int index); > > Who calls them ? In drivers/cpufreq/cpufreq.c, function __target_index. Line 2065, see below: 2062 notify = !(cpufreq_driver->flags & CPUFREQ_ASYNC_NOTIFICATION); 2063 if (notify) { 2064 /* Handle switching to intermediate frequency */ 2065 if (cpufreq_driver->get_intermediate) { 2066 retval = __target_intermediate(policy, &freqs, index); 2067 if (retval) 2068 return retval; 2069 2070 intermediate_freq = freqs.new; 2071 /* Set old freq to intermediate */ 2072 if (intermediate_freq) 2073 freqs.old = freqs.new; 2074 } Inspired from tegra20-cpufreq.c, use target_intermediate could handle i.MX7ULP cpufreq easier. Thanks, Peng. > > -- > viresh
On 19-02-20, 09:41, Peng Fan wrote: > In drivers/cpufreq/cpufreq.c, function __target_index. Line 2065, see below: > > 2062 notify = !(cpufreq_driver->flags & CPUFREQ_ASYNC_NOTIFICATION); > 2063 if (notify) { > 2064 /* Handle switching to intermediate frequency */ > 2065 if (cpufreq_driver->get_intermediate) { > 2066 retval = __target_intermediate(policy, &freqs, index); > 2067 if (retval) > 2068 return retval; > 2069 > 2070 intermediate_freq = freqs.new; > 2071 /* Set old freq to intermediate */ > 2072 if (intermediate_freq) > 2073 freqs.old = freqs.new; > 2074 } > > Inspired from tegra20-cpufreq.c, use target_intermediate could handle > i.MX7ULP cpufreq easier. Ahh, sorry about that. Completely forgot this stuff existed :)
On 19-02-20, 15:59, peng.fan@nxp.com wrote: > From: Peng Fan <peng.fan@nxp.com> > > Platforms may need to implement platform specific get_intermediate and > target_intermediate hooks. > > Update cpufreq-dt driver's platform data to contain those for such > platforms. > > Signed-off-by: Peng Fan <peng.fan@nxp.com> > --- > drivers/cpufreq/cpufreq-dt.c | 4 ++++ > drivers/cpufreq/cpufreq-dt.h | 4 ++++ > 2 files changed, 8 insertions(+) Looks fine to me, please lemme know the patches you want me to apply to the cpufreq tree.
Hi Viresh, > Subject: Re: [PATCH v2 10/14] cpufreq: dt: Allow platform specific > intermediate callbacks > > On 19-02-20, 15:59, peng.fan@nxp.com wrote: > > From: Peng Fan <peng.fan@nxp.com> > > > > Platforms may need to implement platform specific get_intermediate and > > target_intermediate hooks. > > > > Update cpufreq-dt driver's platform data to contain those for such > > platforms. > > > > Signed-off-by: Peng Fan <peng.fan@nxp.com> > > --- > > drivers/cpufreq/cpufreq-dt.c | 4 ++++ drivers/cpufreq/cpufreq-dt.h | > > 4 ++++ > > 2 files changed, 8 insertions(+) > > Looks fine to me, please lemme know the patches you want me to apply to > the cpufreq tree. Thanks for quick reply. Patch 1-9,13 needs to go into i.MX tree. Patch 10-12 needs to go into your tree. But patch 11,12 depends on patch 3-9 to make i.MX7ULP cpufreq work. So for now, only patch 10 could be directly taken into your tree. Will let you know after CLK and i.MX maintainer agree on the clk part, then you could take patches 10-12 in a whole. Thanks, Peng. > > -- > viresh
On 19-02-20, 15:59, peng.fan@nxp.com wrote: > From: Peng Fan <peng.fan@nxp.com> > > Platforms may need to implement platform specific get_intermediate and > target_intermediate hooks. > > Update cpufreq-dt driver's platform data to contain those for such > platforms. > > Signed-off-by: Peng Fan <peng.fan@nxp.com> > --- > drivers/cpufreq/cpufreq-dt.c | 4 ++++ > drivers/cpufreq/cpufreq-dt.h | 4 ++++ > 2 files changed, 8 insertions(+) Applied. Thanks.
diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index d2b5f062a07b..26fe8dfb9ce6 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -363,6 +363,10 @@ static int dt_cpufreq_probe(struct platform_device *pdev) dt_cpufreq_driver.resume = data->resume; if (data->suspend) dt_cpufreq_driver.suspend = data->suspend; + if (data->get_intermediate) { + dt_cpufreq_driver.target_intermediate = data->target_intermediate; + dt_cpufreq_driver.get_intermediate = data->get_intermediate; + } } ret = cpufreq_register_driver(&dt_cpufreq_driver); diff --git a/drivers/cpufreq/cpufreq-dt.h b/drivers/cpufreq/cpufreq-dt.h index a5a45b547d0b..28c8af7ec5ef 100644 --- a/drivers/cpufreq/cpufreq-dt.h +++ b/drivers/cpufreq/cpufreq-dt.h @@ -14,6 +14,10 @@ struct cpufreq_policy; struct cpufreq_dt_platform_data { bool have_governor_per_policy; + unsigned int (*get_intermediate)(struct cpufreq_policy *policy, + unsigned int index); + int (*target_intermediate)(struct cpufreq_policy *policy, + unsigned int index); int (*suspend)(struct cpufreq_policy *policy); int (*resume)(struct cpufreq_policy *policy); };