Re: [PATCH v5 2/7] cpufreq: Add boost frequency support in core

Lukasz Majewski
2013-07-16T12:07:16Z

On Tue, 16 Jul 2013 15:11:54 +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/cpufreq.c b/drivers/cpufreq/cpufreq.c
>
> > +int cpufreq_boost_trigger_state(int state)
> > +{
> > + unsigned long flags;
> > + int ret = 0;
> > +
> > + if (boost_enabled != state) {
> > + write_lock_irqsave(&cpufreq_driver_lock, flags);
> > + boost_enabled = state;
> > +
> > + ret = cpufreq_driver->enable_boost(state);
> > + if (ret)
> > + boost_enabled = 0;
> > +
> > + write_unlock_irqrestore(&cpufreq_driver_lock,
> > flags); +
> > + if (ret)
> > + pr_err("%s: BOOST cannot enable (%d)\n",
>
> Who said we are enabling it?

You are right here - also disablement could fail. I will fix it.

>
> > + __func__, ret);
> > + }
> > +
> > + return ret;
> > +}
> > +
> > +int cpufreq_boost_supported(void)
> > +{
> > + if (cpufreq_driver)
> > + return cpufreq_driver->boost_supported;
> > +
> > + return 0;
> > +}
> > +EXPORT_SYMBOL_GPL(cpufreq_boost_supported);
> > +
> > +int cpufreq_boost_enabled(void)
> > +{
> > + return boost_enabled;
> > +}
> > +EXPORT_SYMBOL_GPL(cpufreq_boost_enabled);
> > +
> > +void cpufreq_set_boost_enabled(int state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [*]

>
> Maybe cpufreq_block_boost? As suggested by Rafael.

What do you mean by cpufreq_block_boost()? This name would reverse the
logic.

Function [*] is used to change boost_enabled static flag (defined at
cpufreq.c file) state according to acpi-cpufreq.c boost support status.

>
> > +{
> > + boost_enabled = state;
> > +}
> > +EXPORT_SYMBOL_GPL(cpufreq_set_boost_enabled);
> > +
> > +/*********************************************************************
> > * REGISTER / UNREGISTER CPUFREQ
> > DRIVER *
> > *********************************************************************/
> >
> > @@ -2001,6 +2094,22 @@ int cpufreq_register_driver(struct
> > cpufreq_driver *driver_data) cpufreq_driver = driver_data;
> > write_unlock_irqrestore(&cpufreq_driver_lock, flags);
> >
> > + if (cpufreq_driver->boost_supported) {
> > + /*
> > + * Check if boost driver provides function to
> > enable boost -
> > + * if not, use cpufreq_boost_enable_sw as default
> > + */
> > + if (!cpufreq_driver->enable_boost)
> > + cpufreq_driver->enable_boost =
> > &cpufreq_boost_enable_sw;
>
> & is redundant.

Yes, correct. I will change that.

--
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group