Re: [PATCH 3/4] REGULATOR: TWL6025: add support to twl-regulator

From: Felipe Balbi
Date: Wed Apr 27 2011 - 06:43:51 EST


Hi,

On Wed, Apr 27, 2011 at 10:39:50AM +0100, Graeme Gregory wrote:
> Adding support for the twl6025. Major difference in the twl6025 is the
> group functionality has been removed from the chip so this affects how
> regulators are enabled and disabled.
>
> The names of the regulators also changed.
>
> The DCDCs of the 6025 are software controllable as well.
>
> Signed-off-by: Graeme Gregory <gg@xxxxxxxxxxxxxxx>
> ---
> drivers/regulator/twl-regulator.c | 447 ++++++++++++++++++++++++++++++++++---
> 1 files changed, 412 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
> index 2a808c2..c08a0de 100644
> --- a/drivers/regulator/twl-regulator.c
> +++ b/drivers/regulator/twl-regulator.c
> @@ -144,11 +158,14 @@ static int twl6030reg_is_enabled(struct regulator_dev *rdev)
> struct twlreg_info *info = rdev_get_drvdata(rdev);
> int grp, val;
>
> - grp = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_GRP);
> - if (grp < 0)
> - return grp;
> + if (!(twl_features() & TWL6025_SUBCLASS)) {

instead, why don't you pass some flag as platform_data to this driver,
which gets used to initialize a fiel in struct twlreg_info, then you use
that to do the checking.

> + grp = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_GRP);
> + if (grp < 0)
> + return grp;
>
> - grp &= P1_GRP_6030;
> + grp &= P1_GRP_6030;
> + } else
> + grp = 1;

if one branch has {} add it to both.

--
balbi
--
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/