mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Florian Lobmaier <florian.lobmaier@ams.com>
Cc: linux-kernel@vger.kernel.org, lgirdwood@gmail.com
Subject: Re: [PATCH] added support for ams AS3722 regulator
Date: Wed, 14 Aug 2013 18:37:10 +0100	[thread overview]
Message-ID: <20130814173710.GC2401@sirena.org.uk> (raw)
In-Reply-To: <1376492282-15932-1-git-send-email-florian.lobmaier@ams.com>

[-- Attachment #1: Type: text/plain, Size: 1649 bytes --]

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.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

      reply	other threads:[~2013-08-14 17:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-14 14:58 Florian Lobmaier
2013-08-14 17:37 ` Mark Brown [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130814173710.GC2401@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=florian.lobmaier@ams.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®