[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20130814173710.GC2401@sirena.org.uk>
Date: Wed, 14 Aug 2013 18:37:10 +0100
From: Mark Brown <broonie@...nel.org>
To: Florian Lobmaier <florian.lobmaier@....com>
Cc: linux-kernel@...r.kernel.org, lgirdwood@...il.com
Subject: Re: [PATCH] added support for ams AS3722 regulator
On Wed, Aug 14, 2013 at 04:58:02PM +0200, Florian Lobmaier wrote:
> +++ b/drivers/regulator/Kconfig
> @@ -533,5 +533,12 @@ config REGULATOR_AS3711
> This driver provides support for the voltage regulators on the
> AS3711 PMIC
>
> +config REGULATOR_AS3722
> + tristate "ams AS3722 PMIC regulators"
> + depends on MFD_AS3722
> + help
> + This driver provides support for the voltage regulators of the
> + ams AS3722 PMIC.
> +
> endif
Keep this and the Makefile sorted please.
> + * as3722 ldo0 extended input range (0.825-1.25V) */
> +static int as3722_ldo0_is_enabled(struct regulator_dev *dev)
> +{
> + u32 val;
> + struct as3722 *as3722 = rdev_get_drvdata(dev);
> +
> + as3722_reg_read(as3722, AS3722_LDOCONTROL0_REG, &val);
> + return (val & AS3722_LDO0_CTRL_MASK) != 0;
> +}
These all look like you could use the standard regmap helpers.
> +static int as3722_ldo0_list_voltage(struct regulator_dev *dev,
> + unsigned selector)
> +{
> + if (selector >= AS3722_LDO0_VSEL_MAX)
> + return -EINVAL;
> +
> + return 800000 + (selector + 1) * 25000;
> +}
This is just a linear mapping, use the standard helpers - the same thing
applies to most of the driver, it seems like there's standard helpers
for most of the enable and voltage management.
> +static int __init as3722_regulator_init(void)
> +{
> + return platform_driver_register(&as3722_regulator_driver);
> +}
> +
> +subsys_initcall(as3722_regulator_init);
Modern platforms should just be able to register as a normal driver and
use deferred probing to sort out the init order.
Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists