提交 4e929134 编写于 作者: A Adam Thomson 提交者: Mark Brown

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: NAdam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 7c933772
...@@ -1554,8 +1554,10 @@ static int da7219_handle_supplies(struct snd_soc_codec *codec) ...@@ -1554,8 +1554,10 @@ static int da7219_handle_supplies(struct snd_soc_codec *codec)
ret = devm_regulator_bulk_get(codec->dev, DA7219_NUM_SUPPLIES, ret = devm_regulator_bulk_get(codec->dev, DA7219_NUM_SUPPLIES,
da7219->supplies); da7219->supplies);
if (ret) if (ret) {
dev_err(codec->dev, "Failed to get supplies");
return ret; return ret;
}
/* Determine VDDIO voltage provided */ /* Determine VDDIO voltage provided */
vddio = da7219->supplies[DA7219_SUPPLY_VDDIO].consumer; vddio = da7219->supplies[DA7219_SUPPLY_VDDIO].consumer;
...@@ -1567,6 +1569,10 @@ static int da7219_handle_supplies(struct snd_soc_codec *codec) ...@@ -1567,6 +1569,10 @@ static int da7219_handle_supplies(struct snd_soc_codec *codec)
/* Enable main supplies */ /* Enable main supplies */
ret = regulator_bulk_enable(DA7219_NUM_SUPPLIES, da7219->supplies); ret = regulator_bulk_enable(DA7219_NUM_SUPPLIES, da7219->supplies);
if (ret) {
dev_err(codec->dev, "Failed to enable supplies");
return ret;
}
/* Ensure device in active mode */ /* Ensure device in active mode */
snd_soc_write(codec, DA7219_SYSTEM_ACTIVE, DA7219_SYSTEM_ACTIVE_MASK); 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,7 +1580,7 @@ static int da7219_handle_supplies(struct snd_soc_codec *codec)
/* Update IO voltage level range */ /* Update IO voltage level range */
snd_soc_write(codec, DA7219_IO_CTRL, io_voltage_lvl); snd_soc_write(codec, DA7219_IO_CTRL, io_voltage_lvl);
return ret; return 0;
} }
static void da7219_handle_pdata(struct snd_soc_codec *codec) static void da7219_handle_pdata(struct snd_soc_codec *codec)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册