Re: [PATCH 1/4] mfd: arizona: Export function to control subsystem DVFS
From: Charles Keepax
Date: Mon Jun 16 2014 - 13:07:04 EST
On Mon, Jun 16, 2014 at 05:42:42PM +0100, Lee Jones wrote:
> On Mon, 09 Jun 2014, Richard Fitzgerald wrote:
>
> > Moving this control from being a side-effect of the LDO1
> > regulator driver to a specific exported function.
> >
> > Signed-off-by: Richard Fitzgerald <rf@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
> > ---
> > drivers/mfd/arizona-core.c | 84 ++++++++++++++++++++++++++++++++++++++
> > include/linux/mfd/arizona/core.h | 12 +++++
> > 2 files changed, 96 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
> > index 58e1fe5..a1b4fe6 100644
> > --- a/drivers/mfd/arizona-core.c
> > +++ b/drivers/mfd/arizona-core.c
> > @@ -94,6 +94,89 @@ int arizona_clk32k_disable(struct arizona *arizona)
> > }
> > EXPORT_SYMBOL_GPL(arizona_clk32k_disable);
> >
> > +int arizona_dvfs_up(struct arizona *arizona, unsigned int mask)
> > +{
> > + unsigned int new_flags;
> > + int ret = 0;
> > +
> > + mutex_lock(&arizona->subsys_max_lock);
> > +
> > + new_flags = arizona->subsys_max_rq | mask;
>
> This doesn't look like a mask to me. It looks like you're setting
> flags rather than masking out bits?
Richard is on holiday so I will fill in for him. Yeah these are
flags I think mask is just a poorly chosen variable name.
>
> > + if (arizona->subsys_max_rq != new_flags) {
> > + switch (arizona->type) {
> > + case WM5102:
> > + case WM8997:
> > + ret = regulator_set_voltage(arizona->dcvdd,
> > + 1800000, 1800000);
> > + if (ret != 0) {
> > + dev_err(arizona->dev,
> > + "Failed to raise dcvdd (%u)\n", ret);
> > + goto err;
> > + }
> > +
> > + ret = regmap_update_bits(arizona->regmap,
> > + ARIZONA_DYNAMIC_FREQUENCY_SCALING_1,
> > + ARIZONA_SUBSYS_MAX_FREQ, 1);
> > + if (ret != 0) {
> > + dev_err(arizona->dev,
> > + "Failed to enable subsys max (%u)\n",
> > + ret);
> > + regulator_set_voltage(arizona->dcvdd,
> > + 1200000, 1800000);
> > + goto err;
> > + }
> > + break;
> > +
> > + default:
> > + break;
> > + }
>
> I don't really get this. What's the point in passing the mask
> parameter - I don't see it being used for anything in this routine? No
> matter what is passed in you always just turn on the same regulator.
>
> What am I missing?
As Mark said each bit represents something that can require the
higher clock rate. Any of the causes being active requires the
higher clock rate.
>
> > + arizona->subsys_max_rq = new_flags;
>
> This tabbing is incorrect.
Will get fixed with the other comments.
Thanks,
Charles
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/