diff mbox

[v4,1/8] cpufreq: cpufreq-cpu0: allow use of optional boost mode frequencies

Message ID 1400029876-5830-2-git-send-email-thomas.ab@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Thomas Abraham May 14, 2014, 1:11 a.m. UTC
From: Thomas Abraham <thomas.ab@samsung.com>

Lookup for the optional boost-frequency property in cpu0 node and if
available, enable support for boost mode frequencies. The frequencies
usable in boost mode are determined while preparing the cpufreq table
from the list of operating points available.

Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Thomas Abraham <thomas.ab@samsung.com>
---
 .../devicetree/bindings/cpufreq/cpufreq-cpu0.txt   |    2 ++
 drivers/cpufreq/Kconfig                            |   11 +++++++++++
 drivers/cpufreq/cpufreq-cpu0.c                     |    5 +++++
 3 files changed, 18 insertions(+), 0 deletions(-)

Comments

Viresh Kumar May 14, 2014, 3:46 a.m. UTC | #1
On 14 May 2014 06:41, Thomas Abraham <ta.omasab@gmail.com> wrote:
> From: Thomas Abraham <thomas.ab@samsung.com>
>
> Lookup for the optional boost-frequency property in cpu0 node and if
> available, enable support for boost mode frequencies. The frequencies
> usable in boost mode are determined while preparing the cpufreq table
> from the list of operating points available.
>
> Cc: Shawn Guo <shawn.guo@linaro.org>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Signed-off-by: Thomas Abraham <thomas.ab@samsung.com>
> ---
>  .../devicetree/bindings/cpufreq/cpufreq-cpu0.txt   |    2 ++
>  drivers/cpufreq/Kconfig                            |   11 +++++++++++
>  drivers/cpufreq/cpufreq-cpu0.c                     |    5 +++++
>  3 files changed, 18 insertions(+), 0 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt b/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt
> index f055515..60f321a 100644
> --- a/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt
> +++ b/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt
> @@ -19,6 +19,8 @@ Optional properties:
>  - cooling-min-level:
>  - cooling-max-level:
>       Please refer to Documentation/devicetree/bindings/thermal/thermal.txt.
> +- boost-frequency:
> +     Please refer to Documentation/devicetree/bindings/cpufreq/cpufreq-boost.txt
>
>  Examples:
>
> diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
> index 1fbe11f..0ca4485 100644
> --- a/drivers/cpufreq/Kconfig
> +++ b/drivers/cpufreq/Kconfig
> @@ -194,6 +194,17 @@ config GENERIC_CPUFREQ_CPU0
>
>           If in doubt, say N.
>
> +config GENERIC_CPUFREQ_CPU0_BOOST

Get rid of this.. just not required.

> +       bool "Boost frequency support for generic CPU0 cpufreq driver"
> +       depends on GENERIC_CPUFREQ_CPU0
> +       select CPU_FREQ_BOOST_SW
> +       help
> +         This enables support for software managed overclocking (BOOST). It
> +         allows usage of special frequencies (those beyond the normal operating
> +         frequencies).
> +
> +         If in doubt, say N.
> +
>  menu "x86 CPU frequency scaling drivers"
>  depends on X86
>  source "drivers/cpufreq/Kconfig.x86"
> diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
> index 1bf6bba..e6c21a8 100644
> --- a/drivers/cpufreq/cpufreq-cpu0.c
> +++ b/drivers/cpufreq/cpufreq-cpu0.c
> @@ -194,6 +194,11 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
>                         transition_latency += ret * 1000;
>         }
>
> +#ifdef CONFIG_GENERIC_CPUFREQ_CPU0_BOOST
> +       if (of_find_property(cpu_dev->of_node, "boost-frequency", NULL))

Lets see what happens to the other thread for this.

> +               cpu0_cpufreq_driver.boost_supported = true;
> +#endif
> +
>         ret = cpufreq_register_driver(&cpu0_cpufreq_driver);
>         if (ret) {
>                 pr_err("failed register driver: %d\n", ret);
> --
> 1.7.4.4
>
Lukasz Majewski May 14, 2014, 6:17 a.m. UTC | #2
Hi Viresh, Tomas,

> On 14 May 2014 06:41, Thomas Abraham <ta.omasab@gmail.com> wrote:
> > From: Thomas Abraham <thomas.ab@samsung.com>
> >
> > Lookup for the optional boost-frequency property in cpu0 node and if
> > available, enable support for boost mode frequencies. The
> > frequencies usable in boost mode are determined while preparing the
> > cpufreq table from the list of operating points available.
> >
> > Cc: Shawn Guo <shawn.guo@linaro.org>
> > Cc: Lukasz Majewski <l.majewski@samsung.com>
> > Signed-off-by: Thomas Abraham <thomas.ab@samsung.com>
> > ---
> >  .../devicetree/bindings/cpufreq/cpufreq-cpu0.txt   |    2 ++
> >  drivers/cpufreq/Kconfig                            |   11
> > +++++++++++ drivers/cpufreq/cpufreq-cpu0.c                     |
> > 5 +++++ 3 files changed, 18 insertions(+), 0 deletions(-)
> >
> > diff --git
> > a/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt
> > b/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt index
> > f055515..60f321a 100644 ---
> > a/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt +++
> > b/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt @@
> > -19,6 +19,8 @@ Optional properties:
> >  - cooling-min-level:
> >  - cooling-max-level:
> >       Please refer to
> > Documentation/devicetree/bindings/thermal/thermal.txt. +-
> > boost-frequency:
> > +     Please refer to
> > Documentation/devicetree/bindings/cpufreq/cpufreq-boost.txt
> >
> >  Examples:
> >
> > diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
> > index 1fbe11f..0ca4485 100644
> > --- a/drivers/cpufreq/Kconfig
> > +++ b/drivers/cpufreq/Kconfig
> > @@ -194,6 +194,17 @@ config GENERIC_CPUFREQ_CPU0
> >
> >           If in doubt, say N.
> >
> > +config GENERIC_CPUFREQ_CPU0_BOOST
> 
> Get rid of this.. just not required.

I think that you can rely solely on the CPU_FREQ_BOOST_SW flag if the
original author of cpufreq-cpu0.c don't mind.

> 
> > +       bool "Boost frequency support for generic CPU0 cpufreq
> > driver"
> > +       depends on GENERIC_CPUFREQ_CPU0
> > +       select CPU_FREQ_BOOST_SW
> > +       help
> > +         This enables support for software managed overclocking
> > (BOOST). It
> > +         allows usage of special frequencies (those beyond the
> > normal operating
> > +         frequencies).
> > +
> > +         If in doubt, say N.
> > +
> >  menu "x86 CPU frequency scaling drivers"
> >  depends on X86
> >  source "drivers/cpufreq/Kconfig.x86"
> > diff --git a/drivers/cpufreq/cpufreq-cpu0.c
> > b/drivers/cpufreq/cpufreq-cpu0.c index 1bf6bba..e6c21a8 100644
> > --- a/drivers/cpufreq/cpufreq-cpu0.c
> > +++ b/drivers/cpufreq/cpufreq-cpu0.c
> > @@ -194,6 +194,11 @@ static int cpu0_cpufreq_probe(struct
> > platform_device *pdev) transition_latency += ret * 1000;
> >         }
> >
> > +#ifdef CONFIG_GENERIC_CPUFREQ_CPU0_BOOST
> > +       if (of_find_property(cpu_dev->of_node, "boost-frequency",
> > NULL))
> 
> Lets see what happens to the other thread for this.
> 
> > +               cpu0_cpufreq_driver.boost_supported = true;
> > +#endif
> > +
> >         ret = cpufreq_register_driver(&cpu0_cpufreq_driver);
> >         if (ret) {
> >                 pr_err("failed register driver: %d\n", ret);
> > --
> > 1.7.4.4
> >
Viresh Kumar May 14, 2014, 6:20 a.m. UTC | #3
On 14 May 2014 11:47, Lukasz Majewski <l.majewski@samsung.com> wrote:
> I think that you can rely solely on the CPU_FREQ_BOOST_SW flag if the
> original author of cpufreq-cpu0.c don't mind.

We don't have to. struct cpufreq_driver: boost_supported is always available.
Just update it without any ugly #ifdefs ..
Thomas Abraham May 14, 2014, 1:43 p.m. UTC | #4
Hi Lukasz, Viresh,

On Wed, May 14, 2014 at 11:50 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> On 14 May 2014 11:47, Lukasz Majewski <l.majewski@samsung.com> wrote:
>> I think that you can rely solely on the CPU_FREQ_BOOST_SW flag if the
>> original author of cpufreq-cpu0.c don't mind.
>
> We don't have to. struct cpufreq_driver: boost_supported is always available.
> Just update it without any ugly #ifdefs ..

Okay, so you are suggesting that Kconfig entry used to select
cpufreq-cpu0 should also enable CPU_FREQ_BOOST_SW config as well.
Considering that exynos4412 is the only user of this feature in
mainline, should we do this?
Viresh Kumar May 14, 2014, 1:50 p.m. UTC | #5
On 14 May 2014 19:13, Thomas Abraham <ta.omasab@gmail.com> wrote:
> Okay, so you are suggesting that Kconfig entry used to select
> cpufreq-cpu0 should also enable CPU_FREQ_BOOST_SW config as well.

I never said that... That should be enabled by your defconfig instead.
What I said was, don't put code within any #ifdefs in cpufreq-cpu0.
Thomas Abraham May 14, 2014, 2:18 p.m. UTC | #6
On Wed, May 14, 2014 at 7:20 PM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> On 14 May 2014 19:13, Thomas Abraham <ta.omasab@gmail.com> wrote:
>> Okay, so you are suggesting that Kconfig entry used to select
>> cpufreq-cpu0 should also enable CPU_FREQ_BOOST_SW config as well.
>
> I never said that... That should be enabled by your defconfig instead.
> What I said was, don't put code within any #ifdefs in cpufreq-cpu0.

Okay, I get the point about #ifdef in cpufreq-cpu0. What about your
earlier comment about the new Kconfig entry ("Get rid of this.. just
not required.")? The new Kconfig entry would be needed in that case.
Viresh Kumar May 14, 2014, 2:20 p.m. UTC | #7
On 14 May 2014 19:48, Thomas Abraham <ta.omasab@gmail.com> wrote:
> Okay, I get the point about #ifdef in cpufreq-cpu0. What about your
> earlier comment about the new Kconfig entry ("Get rid of this.. just
> not required.")? The new Kconfig entry would be needed in that case.

The only place you used that ifdef was in cpufreq-cpu0, which we
already decided should stay without any ifdefs..

Now, you must enable CPU_FREQ_BOOST_SW from your defconfig.

Did I make it clear this time ?

--
viresh
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt b/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt
index f055515..60f321a 100644
--- a/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt
+++ b/Documentation/devicetree/bindings/cpufreq/cpufreq-cpu0.txt
@@ -19,6 +19,8 @@  Optional properties:
 - cooling-min-level:
 - cooling-max-level:
      Please refer to Documentation/devicetree/bindings/thermal/thermal.txt.
+- boost-frequency:
+     Please refer to Documentation/devicetree/bindings/cpufreq/cpufreq-boost.txt
 
 Examples:
 
diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
index 1fbe11f..0ca4485 100644
--- a/drivers/cpufreq/Kconfig
+++ b/drivers/cpufreq/Kconfig
@@ -194,6 +194,17 @@  config GENERIC_CPUFREQ_CPU0
 
 	  If in doubt, say N.
 
+config GENERIC_CPUFREQ_CPU0_BOOST
+	bool "Boost frequency support for generic CPU0 cpufreq driver"
+	depends on GENERIC_CPUFREQ_CPU0
+	select CPU_FREQ_BOOST_SW
+	help
+	  This enables support for software managed overclocking (BOOST). It
+	  allows usage of special frequencies (those beyond the normal operating
+	  frequencies).
+
+	  If in doubt, say N.
+
 menu "x86 CPU frequency scaling drivers"
 depends on X86
 source "drivers/cpufreq/Kconfig.x86"
diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
index 1bf6bba..e6c21a8 100644
--- a/drivers/cpufreq/cpufreq-cpu0.c
+++ b/drivers/cpufreq/cpufreq-cpu0.c
@@ -194,6 +194,11 @@  static int cpu0_cpufreq_probe(struct platform_device *pdev)
 			transition_latency += ret * 1000;
 	}
 
+#ifdef CONFIG_GENERIC_CPUFREQ_CPU0_BOOST
+	if (of_find_property(cpu_dev->of_node, "boost-frequency", NULL))
+		cpu0_cpufreq_driver.boost_supported = true;
+#endif
+
 	ret = cpufreq_register_driver(&cpu0_cpufreq_driver);
 	if (ret) {
 		pr_err("failed register driver: %d\n", ret);