diff mbox

[v5,6/7] cpufreq:boost:Kconfig: Enable software managed BOOST support at Kconfig

Message ID 1372927830-2949-7-git-send-email-l.majewski@samsung.com (mailing list archive)
State Changes Requested, archived
Headers show

Commit Message

Lukasz Majewski July 4, 2013, 8:50 a.m. UTC
For safety reasons new flag - CONFIG_CPU_FREQ_BOOST_SW has been added.
Only after selecting "CPU frequency BOOST support" Kconfig option the
software managed boost is enabled. It also selects thermal subsystem
to be compiled in. Thermal is necessary for disabling boost and cooling
down the device when overheating detected.

Boost _MUST_NOT_ be enabled without thermal subsystem with properly
defined temperatures, which indicate overheating.

This option doesn't affect x86's ACPI hardware managed boost support
(i.e. Intel, AMD). In this situation boost management is embedded at
hardware.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>

---
Changes for v5:
- New patch

 drivers/cpufreq/Kconfig          |   14 ++++++++++++++
 drivers/cpufreq/exynos-cpufreq.c |    5 ++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

Comments

Viresh Kumar July 16, 2013, 9:58 a.m. UTC | #1
On 4 July 2013 14:20, Lukasz Majewski <l.majewski@samsung.com> wrote:
> diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig

> +config CPU_FREQ_BOOST_SW
> +       bool "CPU frequency overclocking (BOOST)"

Name it "CPU Frequency Overclocking - Software"

> +       depends on ARM_EXYNOS_CPUFREQ && EXYNOS_THERMAL

Remote Exynos from here. If you want to enable it for your platform by
default, then select it from EXYNOS.

> +       default n
> +       help
> +        This driver supports software managed overclocking (BOOST).
> +         It allows usage of special frequencies for a particular processor
> +         if thermal conditions are appropriate.
> +
> +        It reguires, for safe operation, thermal framework with properly defined
> +         trip points.
> +
> +        If in doubt, say N.
> +
>  config CPU_FREQ_STAT
>         tristate "CPU frequency translation statistics"
>         select CPU_FREQ_TABLE
> diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c
> index 4f42fcc..7586b28 100644
> --- a/drivers/cpufreq/exynos-cpufreq.c
> +++ b/drivers/cpufreq/exynos-cpufreq.c
> @@ -288,7 +288,9 @@ static struct cpufreq_driver exynos_driver = {
>
>  static int __init exynos_cpufreq_init(void)
>  {
> +#ifdef CONFIG_CPU_FREQ_BOOST_SW
>         struct device_node *node = pdev->dev.of_node;
> +#endif
>         int ret = -EINVAL;
>
>         exynos_info = kzalloc(sizeof(struct exynos_dvfs_info), GFP_KERNEL);
> @@ -319,9 +321,10 @@ static int __init exynos_cpufreq_init(void)
>         }
>
>         locking_frequency = exynos_getspeed(0);
> +#ifdef CONFIG_CPU_FREQ_BOOST_SW
>         if (of_property_read_bool(node, "boost_mode"))
>                 exynos_driver.boost_supported = 1;
> -
> +#endif

Add a blank line here.

>         register_pm_notifier(&exynos_cpufreq_nb);
>
>         if (cpufreq_register_driver(&exynos_driver)) {
> --
> 1.7.10.4
>
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lukasz Majewski July 16, 2013, 11:50 a.m. UTC | #2
On Tue, 16 Jul 2013 15:28:40 +0530 Viresh Kumar viresh.kumar@linaro.org
wrote,
> On 4 July 2013 14:20, Lukasz Majewski <l.majewski@samsung.com> wrote:
> > diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
> 
> > +config CPU_FREQ_BOOST_SW
> > +       bool "CPU frequency overclocking (BOOST)"
> 
> Name it "CPU Frequency Overclocking - Software"

Thanks, I had a puzzle to came up with a good short name :-).

> 
> > +       depends on ARM_EXYNOS_CPUFREQ && EXYNOS_THERMAL && EXYNOS_THERMAL
 		       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [*]
> 
> Remote Exynos from here. If you want to enable it for your platform by
> default, then select it from EXYNOS.

The purpose of the condition [*] here is to prevent from enabling
boost when thermal for Exynos is not supported.

Only for properly configured Exynos (when thermal + cpufreq is set) the
option is possible to enable. And by default it is disabled.
This shall prevent from accidental boost usage. 
  

Please also note, that this switch only affects software based
boost. The HW boost (Intel ACPI) support doesn't depend on this Kconfig
setting. 

> 
> > +       default n
> > +       help
> > +        This driver supports software managed overclocking (BOOST).
> > +         It allows usage of special frequencies for a particular
> > processor
> > +         if thermal conditions are appropriate.
> > +
> > +        It reguires, for safe operation, thermal framework with
> > properly defined
> > +         trip points.
> > +
> > +        If in doubt, say N.
> > +
> >  config CPU_FREQ_STAT
> >         tristate "CPU frequency translation statistics"
> >         select CPU_FREQ_TABLE
> > diff --git a/drivers/cpufreq/exynos-cpufreq.c
> > b/drivers/cpufreq/exynos-cpufreq.c index 4f42fcc..7586b28 100644
> > --- a/drivers/cpufreq/exynos-cpufreq.c
> > +++ b/drivers/cpufreq/exynos-cpufreq.c
> > @@ -288,7 +288,9 @@ static struct cpufreq_driver exynos_driver = {
> >
> >  static int __init exynos_cpufreq_init(void)
> >  {
> > +#ifdef CONFIG_CPU_FREQ_BOOST_SW
> >         struct device_node *node = pdev->dev.of_node;
> > +#endif
> >         int ret = -EINVAL;
> >
> >         exynos_info = kzalloc(sizeof(struct exynos_dvfs_info),
> > GFP_KERNEL); @@ -319,9 +321,10 @@ static int __init
> > exynos_cpufreq_init(void) }
> >
> >         locking_frequency = exynos_getspeed(0);
> > +#ifdef CONFIG_CPU_FREQ_BOOST_SW
> >         if (of_property_read_bool(node, "boost_mode"))
> >                 exynos_driver.boost_supported = 1;
> > -
> > +#endif
> 
> Add a blank line here.

OK

> 
> >         register_pm_notifier(&exynos_cpufreq_nb);
> >
> >         if (cpufreq_register_driver(&exynos_driver)) {
> > --
> > 1.7.10.4
> >
Viresh Kumar July 17, 2013, 5:24 a.m. UTC | #3
On 16 July 2013 17:20, Lukasz Majewski <l.majewski@samsung.com> wrote:
> On Tue, 16 Jul 2013 15:28:40 +0530 Viresh Kumar viresh.kumar@linaro.org
> wrote,
>> On 4 July 2013 14:20, Lukasz Majewski <l.majewski@samsung.com> wrote:
>> > diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
>>
>> > +config CPU_FREQ_BOOST_SW
>> > +       bool "CPU frequency overclocking (BOOST)"
>>
>> Name it "CPU Frequency Overclocking - Software"
>
> Thanks, I had a puzzle to came up with a good short name :-).
>
>>
>> > +       depends on ARM_EXYNOS_CPUFREQ && EXYNOS_THERMAL
>                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [*]
>>
>> Remote Exynos from here. If you want to enable it for your platform by
>> default, then select it from EXYNOS.

I misread it a bit. I wanted to say make it dependent only on THERMAL and
not on Exynos.

> The purpose of the condition [*] here is to prevent from enabling
> boost when thermal for Exynos is not supported.

Why? Can't others use it? Its not exynos specific :)
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lukasz Majewski July 17, 2013, 7:17 a.m. UTC | #4
On Wed, 17 Jul 2013 10:54:55 +0530 Viresh Kumar viresh.kumar@linaro.org
wrote,
> On 16 July 2013 17:20, Lukasz Majewski <l.majewski@samsung.com> wrote:
> > On Tue, 16 Jul 2013 15:28:40 +0530 Viresh Kumar
> > viresh.kumar@linaro.org wrote,
> >> On 4 July 2013 14:20, Lukasz Majewski <l.majewski@samsung.com>
> >> wrote:
> >> > diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
> >>
> >> > +config CPU_FREQ_BOOST_SW
> >> > +       bool "CPU frequency overclocking (BOOST)"
> >>
> >> Name it "CPU Frequency Overclocking - Software"
> >
> > Thanks, I had a puzzle to came up with a good short name :-).
> >
> >>
> >> > +       depends on ARM_EXYNOS_CPUFREQ && EXYNOS_THERMAL
> >                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [*]
> >>
> >> Remote Exynos from here. If you want to enable it for your
> >> platform by default, then select it from EXYNOS.

I can change ARM_EXYNOS_CPUFREQ -> CPUFREQ at [*]

> 
> I misread it a bit. I wanted to say make it dependent only on THERMAL
> and not on Exynos.

The cpufreq boost feature is possible to be enabled only when those [*]
dependencies are met. Moreover, it is disabled by default. 

This means that not only THERMAL generic code must be supported, but
also EXYNOS specific one - like per SoC trip points [**].

With thermal it is possible (and correct) to only define THERMAL, with
no platform (in this case Exynos) specific definitions. To force
potential user to define [**], I think, that EXYNOS_THERMAL is required.

> 
> > The purpose of the condition [*] here is to prevent from enabling
> > boost when thermal for Exynos is not supported.
> 
> Why? Can't others use it? Its not exynos specific :)

No it is not exynos specific.
For other platform one need to define:

depends on CPUFREQ && (EXYNOS_THERMAL || <PLATFORM_SUPPORTED>_THERMAL)

Such condition improves my confidence about proper boost usage.
Viresh Kumar July 17, 2013, 7:52 a.m. UTC | #5
On 17 July 2013 12:47, Lukasz Majewski <l.majewski@samsung.com> wrote:
> On Wed, 17 Jul 2013 10:54:55 +0530 Viresh Kumar viresh.kumar@linaro.org
> wrote,
>> On 16 July 2013 17:20, Lukasz Majewski <l.majewski@samsung.com> wrote:
>> > On Tue, 16 Jul 2013 15:28:40 +0530 Viresh Kumar
>> > viresh.kumar@linaro.org wrote,
>> >> On 4 July 2013 14:20, Lukasz Majewski <l.majewski@samsung.com>
>> >> wrote:
>> >> > diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
>> >>
>> >> > +config CPU_FREQ_BOOST_SW
>> >> > +       bool "CPU frequency overclocking (BOOST)"
>> >>
>> >> Name it "CPU Frequency Overclocking - Software"
>> >
>> > Thanks, I had a puzzle to came up with a good short name :-).
>> >
>> >>
>> >> > +       depends on ARM_EXYNOS_CPUFREQ && EXYNOS_THERMAL
>> >                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [*]
>> >>
>> >> Remote Exynos from here. If you want to enable it for your
>> >> platform by default, then select it from EXYNOS.
>
> I can change ARM_EXYNOS_CPUFREQ -> CPUFREQ at [*]

We are in cpufreq Kconfig and so dependency is automatically
there on cpufreq.

>>
>> I misread it a bit. I wanted to say make it dependent only on THERMAL
>> and not on Exynos.
>
> The cpufreq boost feature is possible to be enabled only when those [*]
> dependencies are met. Moreover, it is disabled by default.
>
> This means that not only THERMAL generic code must be supported, but
> also EXYNOS specific one - like per SoC trip points [**].
>
> With thermal it is possible (and correct) to only define THERMAL, with
> no platform (in this case Exynos) specific definitions. To force
> potential user to define [**], I think, that EXYNOS_THERMAL is required.
>
>>
>> > The purpose of the condition [*] here is to prevent from enabling
>> > boost when thermal for Exynos is not supported.
>>
>> Why? Can't others use it? Its not exynos specific :)
>
> No it is not exynos specific.
> For other platform one need to define:
>
> depends on CPUFREQ && (EXYNOS_THERMAL || <PLATFORM_SUPPORTED>_THERMAL)

Exactly. I don't want this kind of mess to be present here.

People selecting this feature must know what it does and
dependency on a coolant is enough.

For other drivers, selecting this doesn't matter as they don't
support boost.
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lukasz Majewski July 17, 2013, 8:12 a.m. UTC | #6
On Wed, 17 Jul 2013 13:22:20 +0530 Viresh Kumar viresh.kumar@linaro.org
wrote,
> On 17 July 2013 12:47, Lukasz Majewski <l.majewski@samsung.com> wrote:
> > On Wed, 17 Jul 2013 10:54:55 +0530 Viresh Kumar
> > viresh.kumar@linaro.org wrote,
> >> On 16 July 2013 17:20, Lukasz Majewski <l.majewski@samsung.com>
> >> wrote:
> >> > On Tue, 16 Jul 2013 15:28:40 +0530 Viresh Kumar
> >> > viresh.kumar@linaro.org wrote,
> >> >> On 4 July 2013 14:20, Lukasz Majewski <l.majewski@samsung.com>
> >> >> wrote:
> >> >> > diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
> >> >>
> >> >> > +config CPU_FREQ_BOOST_SW
> >> >> > +       bool "CPU frequency overclocking (BOOST)"
> >> >>
> >> >> Name it "CPU Frequency Overclocking - Software"
> >> >
> >> > Thanks, I had a puzzle to came up with a good short name :-).
> >> >
> >> >>
> >> >> > +       depends on ARM_EXYNOS_CPUFREQ && EXYNOS_THERMAL
> >> >                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [*]
> >> >>
> >> >> Remote Exynos from here. If you want to enable it for your
> >> >> platform by default, then select it from EXYNOS.
> >
> > I can change ARM_EXYNOS_CPUFREQ -> CPUFREQ at [*]
> 
> We are in cpufreq Kconfig and so dependency is automatically
> there on cpufreq.

So then, it can be removed.

> 
> >>
> >> I misread it a bit. I wanted to say make it dependent only on
> >> THERMAL and not on Exynos.
> >
> > The cpufreq boost feature is possible to be enabled only when those
> > [*] dependencies are met. Moreover, it is disabled by default.
> >
> > This means that not only THERMAL generic code must be supported, but
> > also EXYNOS specific one - like per SoC trip points [**].
> >
> > With thermal it is possible (and correct) to only define THERMAL,
> > with no platform (in this case Exynos) specific definitions. To
> > force potential user to define [**], I think, that EXYNOS_THERMAL
> > is required.
> >
> >>
> >> > The purpose of the condition [*] here is to prevent from enabling
> >> > boost when thermal for Exynos is not supported.
> >>
> >> Why? Can't others use it? Its not exynos specific :)
> >
> > No it is not exynos specific.
> > For other platform one need to define:
> >
> > depends on CPUFREQ && (EXYNOS_THERMAL ||
> > <PLATFORM_SUPPORTED>_THERMAL)
> 
> Exactly. I don't want this kind of mess to be present here.
> 
> People selecting this feature must know what it does and
> dependency on a coolant is enough.
> 
> For other drivers, selecting this doesn't matter as they don't
> support boost.

Then it should be enough to only write:

depends on THERMAL

(since CPUFREQ is already enabled for entering this menu).
Viresh Kumar July 17, 2013, 8:29 a.m. UTC | #7
On 17 July 2013 13:42, Lukasz Majewski <l.majewski@samsung.com> wrote:
> Then it should be enough to only write:
>
> depends on THERMAL
>
> (since CPUFREQ is already enabled for entering this menu).

Correct
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lukasz Majewski July 17, 2013, 9:11 a.m. UTC | #8
On Wed, 17 Jul 2013 10:29:15 +0200 Viresh Kumar viresh.kumar@linaro.org
wrote,
> On 17 July 2013 13:42, Lukasz Majewski <l.majewski@samsung.com> wrote:
> > Then it should be enough to only write:
> >
> > depends on THERMAL
> >
> > (since CPUFREQ is already enabled for entering this menu).
> 
> Correct

OK.
diff mbox

Patch

diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
index 534fcb8..e65a112 100644
--- a/drivers/cpufreq/Kconfig
+++ b/drivers/cpufreq/Kconfig
@@ -23,6 +23,20 @@  config CPU_FREQ_TABLE
 config CPU_FREQ_GOV_COMMON
 	bool
 
+config CPU_FREQ_BOOST_SW
+       bool "CPU frequency overclocking (BOOST)"
+       depends on ARM_EXYNOS_CPUFREQ && EXYNOS_THERMAL
+       default n
+       help
+	 This driver supports software managed overclocking (BOOST).
+         It allows usage of special frequencies for a particular processor
+         if thermal conditions are appropriate.
+
+	 It reguires, for safe operation, thermal framework with properly defined
+         trip points.
+
+	 If in doubt, say N.
+
 config CPU_FREQ_STAT
 	tristate "CPU frequency translation statistics"
 	select CPU_FREQ_TABLE
diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c
index 4f42fcc..7586b28 100644
--- a/drivers/cpufreq/exynos-cpufreq.c
+++ b/drivers/cpufreq/exynos-cpufreq.c
@@ -288,7 +288,9 @@  static struct cpufreq_driver exynos_driver = {
 
 static int __init exynos_cpufreq_init(void)
 {
+#ifdef CONFIG_CPU_FREQ_BOOST_SW
 	struct device_node *node = pdev->dev.of_node;
+#endif
 	int ret = -EINVAL;
 
 	exynos_info = kzalloc(sizeof(struct exynos_dvfs_info), GFP_KERNEL);
@@ -319,9 +321,10 @@  static int __init exynos_cpufreq_init(void)
 	}
 
 	locking_frequency = exynos_getspeed(0);
+#ifdef CONFIG_CPU_FREQ_BOOST_SW
 	if (of_property_read_bool(node, "boost_mode"))
 		exynos_driver.boost_supported = 1;
-
+#endif
 	register_pm_notifier(&exynos_cpufreq_nb);
 
 	if (cpufreq_register_driver(&exynos_driver)) {