[alsa-devel] [PATCH v3 6/6] ASoC: tlv320aic32x4: Support for regulators

Fabio Estevam festevam at gmail.com
Mon Jan 27 13:15:05 CET 2014


On Mon, Jan 27, 2014 at 10:03 AM, Markus Pargmann <mpa at pengutronix.de> wrote:

> +static int aic32x4_i2c_setup_regulators(struct device *dev,
> +               struct aic32x4_priv *aic32x4)
> +{
> +       int ret;
> +
> +       aic32x4->supply_ldo = devm_regulator_get_optional(dev, "ldoin");
> +       aic32x4->supply_iov = devm_regulator_get_optional(dev, "iov");
> +       aic32x4->supply_dv = devm_regulator_get_optional(dev, "dv");
> +       aic32x4->supply_av = devm_regulator_get_optional(dev, "av");
> +
> +       if (!IS_ERR(aic32x4->supply_ldo)) {
> +               ret = regulator_enable(aic32x4->supply_ldo);
> +               if (ret)
> +                       return ret;
> +       }
> +
> +       if (!IS_ERR(aic32x4->supply_iov)) {
> +               ret = regulator_enable(aic32x4->supply_iov);
> +               if (ret)
> +                       return ret;
> +       }
> +
> +       if (!IS_ERR(aic32x4->supply_dv)) {
> +               ret = regulator_enable(aic32x4->supply_dv);
> +               if (ret)
> +                       return ret;
> +       }
> +
> +       if (!IS_ERR(aic32x4->supply_av)) {
> +               ret = regulator_enable(aic32x4->supply_av);
> +               if (ret)
> +                       return ret;

Using regulator_bulk_enable() would simplify the code.

Regards,

Fabio Estevam


More information about the Alsa-devel mailing list