[alsa-devel] [PATCH v4 2/4] ASoC: tlv320aic32x4: Support for regulators

Markus Pargmann mpa at pengutronix.de
Mon Feb 17 10:07:24 CET 2014


Hi,

On Sun, Feb 16, 2014 at 07:27:30PM +0100, Markus Pargmann wrote:
> Support regulators to power up the codec. This patch also enables the
> AVDD LDO if no AV regulator was found.
> 
> Signed-off-by: Markus Pargmann <mpa at pengutronix.de>
> ---
>  .../devicetree/bindings/sound/tlv320aic32x4.txt    |  8 +++
>  sound/soc/codecs/tlv320aic32x4.c                   | 73 ++++++++++++++++++++++
>  2 files changed, 81 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/sound/tlv320aic32x4.txt b/Documentation/devicetree/bindings/sound/tlv320aic32x4.txt
> index 352be7b..5e2741a 100644
> --- a/Documentation/devicetree/bindings/sound/tlv320aic32x4.txt
> +++ b/Documentation/devicetree/bindings/sound/tlv320aic32x4.txt

...

> @@ -699,6 +705,67 @@ static int aic32x4_parse_dt(struct aic32x4_priv *aic32x4,
>  	return 0;
>  }
>  
> +static int aic32x4_i2c_setup_regulators(struct device *dev,
> +		struct aic32x4_priv *aic32x4)
> +{
> +	int ret;

This ret is uninitialized and returned later in this function. I will
fix it and send a new version for this.

Regards,

Markus

> +
> +	aic32x4->supply_ldo = devm_regulator_get_optional(dev, "ldoin");
> +	aic32x4->supply_iov = devm_regulator_get(dev, "iov");
> +	aic32x4->supply_dv = devm_regulator_get_optional(dev, "dv");
> +	aic32x4->supply_av = devm_regulator_get_optional(dev, "av");
> +
> +	/* Check if the regulator requirements are fulfilled */
> +
> +	if (IS_ERR(aic32x4->supply_iov)) {
> +		dev_err(dev, "Missing supply 'iov'\n");
> +		ret = -EINVAL;
> +	}
> +
> +	if (IS_ERR(aic32x4->supply_ldo)) {
> +		if (IS_ERR(aic32x4->supply_dv)) {
> +			dev_err(dev, "Missing supply 'dv' or 'ldoin'\n");
> +			ret = -EINVAL;
> +		}
> +		if (IS_ERR(aic32x4->supply_av)) {
> +			dev_err(dev, "Missing supply 'av' or 'ldoin'\n");
> +			ret = -EINVAL;
> +		}
> +	}
> +
> +	if (ret)
> +		return ret;
> +
> +	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;
> +	}
> +
> +	if (!IS_ERR(aic32x4->supply_ldo) && IS_ERR(aic32x4->supply_av))
> +		aic32x4->power_cfg |= AIC32X4_PWR_AIC32X4_LDO_ENABLE;
> +
> +	return 0;
> +}
> +
>  static int aic32x4_i2c_probe(struct i2c_client *i2c,
>  			     const struct i2c_device_id *id)
>  {
> @@ -736,6 +803,12 @@ static int aic32x4_i2c_probe(struct i2c_client *i2c,
>  		aic32x4->rstn_gpio = -1;
>  	}
>  
> +	ret = aic32x4_i2c_setup_regulators(&i2c->dev, aic32x4);
> +	if (ret) {
> +		dev_err(&i2c->dev, "Failed to setup regulators\n");
> +		return ret;
> +	}
> +
>  	aic32x4->mclk = devm_clk_get(&i2c->dev, "mclk");
>  	if (IS_ERR(aic32x4->mclk))
>  		dev_info(&i2c->dev, "No mclk found, continuing without clock\n");
> -- 
> 1.8.5.3
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20140217/ad775690/attachment.sig>


More information about the Alsa-devel mailing list