lkml.org 
[lkml]   [2014]   [Feb]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH v2 11/14] regulator: s2mps11: Add opmode for S2MPS14 regulators
From
Date


On Thu, 2014-02-13 at 12:43 +0000, Lee Jones wrote:
> > S2MPS11/S2MPS14 regulators support different modes of operation:
> > - Always off;
> > - On/Off controlled by pin/GPIO (PWREN/LDOEN/EMMCEN);
> > - Always on;
> > This is very similar to S5M8767 regulator driver which also supports
> > opmodes (although S5M8767 have also low-power mode).
> >
> > This patch adds parsing the operation mode from DTS by reading a
> > "op_mode" property from regulator child node.
> >
> > The op_mode is then used for enabling the S2MPS14 regulators.
> > On S2MPS11 the DTS "op_mode" property is parsed but not used for
> > enabling, as this was not tested.
> >
> > Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> > Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
> > Cc: Mark Brown <broonie@kernel.org>
> > Cc: Liam Girdwood <lgirdwood@gmail.com>
> > ---
> > drivers/regulator/s2mps11.c | 97 ++++++++++++++++++++++++++++++++++-
> > include/linux/mfd/samsung/s2mps14.h | 19 +++++++
> > 2 files changed, 115 insertions(+), 1 deletion(-)
>
> <snip>
>
> > +++ b/include/linux/mfd/samsung/s2mps14.h
> > @@ -149,4 +149,23 @@ enum s2mps14_regulators {
> > #define S2MPS14_LDO_N_VOLTAGES (S2MPS14_LDO_VSEL_MASK + 1)
> > #define S2MPS14_BUCK_N_VOLTAGES (S2MPS14_BUCK_VSEL_MASK + 1)
> >
> > +#define S2MPS14_ENCTRL_SHIFT 6
> > +#define S2MPS14_ENCTRL_MASK (0x3 << S2MPS14_ENCTRL_SHIFT)
> > +
> > +/*
> > + * Values of regulator operation modes match device tree bindings.
> > + */
> > +enum s2mps14_regulator_opmode {
> > + S2MPS14_REGULATOR_OPMODE_OFF = 0,
> > + S2MPS14_REGULATOR_OPMODE_ON = 1,
> > + /*
> > + * Reserved for compatibility with S5M8767 where this
> > + * is a low power mode.
> > + */
> > + S2MPS14_REGULATOR_OPMODE_RESERVED = 2,
> > + S2MPS14_REGULATOR_OPMODE_SUSPEND = 3,
>
> You don't need to number these like this. If you want to force the
> numbering to start at '0' initialise the top value, then the rest
> should be sequential.

Yes, I know. I wanted to emphasize the relationship to opmode entries in
DTS (to prevent adding new enum value somewhere between them). The code
somehow self-documents that the enum should only be extended, not
modified.

Best regards,
Krzysztof

>
> > + S2MPS14_REGULATOR_OPMODE_MAX,
> > +};
> > +
> > #endif /* __LINUX_MFD_S2MPS14_H */
>


\
 
 \ /
  Last update: 2014-02-13 15:01    [W:0.171 / U:1.316 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site