aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Thomson <Adam.Thomson.Opensource@diasemi.com>2015-10-05 10:10:04 -0400
committerMark Brown <broonie@kernel.org>2015-10-05 10:59:16 -0400
commit4e929134eb8271abc9c52c371e056debfea6898b (patch)
treefb9ad4971b1f24b64fa5298892c1ffafa14cba8d
parent7c93377244329552a72912c63fd7503a4e88d6a1 (diff)
ASoC: da7219: Improve error handling for regulator supplies
Currently if bulk_enable() of supplies fails, the code still goes on to try and put the device into active state, and set expected IO voltage of the device. This doesn't really make sense so code now returns on bulk_enable() failure, with an error message. Also, to help with debug, failure to get supplies also provides an error message. Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/codecs/da7219.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sound/soc/codecs/da7219.c b/sound/soc/codecs/da7219.c
index 76f8fc2c00fe..c86a83305fb7 100644
--- a/sound/soc/codecs/da7219.c
+++ b/sound/soc/codecs/da7219.c
@@ -1554,8 +1554,10 @@ static int da7219_handle_supplies(struct snd_soc_codec *codec)
1554 1554
1555 ret = devm_regulator_bulk_get(codec->dev, DA7219_NUM_SUPPLIES, 1555 ret = devm_regulator_bulk_get(codec->dev, DA7219_NUM_SUPPLIES,
1556 da7219->supplies); 1556 da7219->supplies);
1557 if (ret) 1557 if (ret) {
1558 dev_err(codec->dev, "Failed to get supplies");
1558 return ret; 1559 return ret;
1560 }
1559 1561
1560 /* Determine VDDIO voltage provided */ 1562 /* Determine VDDIO voltage provided */
1561 vddio = da7219->supplies[DA7219_SUPPLY_VDDIO].consumer; 1563 vddio = da7219->supplies[DA7219_SUPPLY_VDDIO].consumer;
@@ -1567,6 +1569,10 @@ static int da7219_handle_supplies(struct snd_soc_codec *codec)
1567 1569
1568 /* Enable main supplies */ 1570 /* Enable main supplies */
1569 ret = regulator_bulk_enable(DA7219_NUM_SUPPLIES, da7219->supplies); 1571 ret = regulator_bulk_enable(DA7219_NUM_SUPPLIES, da7219->supplies);
1572 if (ret) {
1573 dev_err(codec->dev, "Failed to enable supplies");
1574 return ret;
1575 }
1570 1576
1571 /* Ensure device in active mode */ 1577 /* Ensure device in active mode */
1572 snd_soc_write(codec, DA7219_SYSTEM_ACTIVE, DA7219_SYSTEM_ACTIVE_MASK); 1578 snd_soc_write(codec, DA7219_SYSTEM_ACTIVE, DA7219_SYSTEM_ACTIVE_MASK);
@@ -1574,7 +1580,7 @@ static int da7219_handle_supplies(struct snd_soc_codec *codec)
1574 /* Update IO voltage level range */ 1580 /* Update IO voltage level range */
1575 snd_soc_write(codec, DA7219_IO_CTRL, io_voltage_lvl); 1581 snd_soc_write(codec, DA7219_IO_CTRL, io_voltage_lvl);
1576 1582
1577 return ret; 1583 return 0;
1578} 1584}
1579 1585
1580static void da7219_handle_pdata(struct snd_soc_codec *codec) 1586static void da7219_handle_pdata(struct snd_soc_codec *codec)