summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorShengjiu Wang <shengjiu.wang@nxp.com>2018-05-31 14:14:42 +0800
committerJason Liu <jason.hui.liu@nxp.com>2019-02-12 10:31:59 +0800
commit8b3ad09dd60fd9a2b2dbb81adf0c2c768d3058b2 (patch)
tree074ddef7db0508b8d4d349bd10fe708529bed247 /sound
parent968fd2509437b87fac261407f48e9164f6d168e2 (diff)
MLK-18463: ASoC: ak4497: add return value for ak4497_probe
There is ak4497 audio card even no audio board connected, which os caused by there is no error return value even the i2c access failed. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/ak4497.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/sound/soc/codecs/ak4497.c b/sound/soc/codecs/ak4497.c
index 1f75b7a390f8..e2f8e3382a89 100644
--- a/sound/soc/codecs/ak4497.c
+++ b/sound/soc/codecs/ak4497.c
@@ -815,9 +815,10 @@ struct snd_soc_dai_driver ak4497_dai[] = {
},
};
-static void ak4497_init_reg(struct snd_soc_codec *codec)
+static int ak4497_init_reg(struct snd_soc_codec *codec)
{
struct ak4497_priv *ak4497 = snd_soc_codec_get_drvdata(codec);
+ int ret = 0;
/* External Mute ON */
if (gpio_is_valid(ak4497->mute_gpio))
@@ -833,10 +834,16 @@ static void ak4497_init_reg(struct snd_soc_codec *codec)
/* ak4497_set_bias_level(codec, SND_SOC_BIAS_STANDBY); */
/* SYNCE bit = 1 */
- snd_soc_update_bits(codec, AK4497_07_CONTROL5, 0x01, 0x01);
+ ret = snd_soc_update_bits(codec, AK4497_07_CONTROL5, 0x01, 0x01);
+ if (ret)
+ return ret;
/* HLOAD bit = 1, SC2 bit = 1 */
- snd_soc_update_bits(codec, AK4497_08_SOUNDCONTROL, 0x0F, 0x0C);
+ ret = snd_soc_update_bits(codec, AK4497_08_SOUNDCONTROL, 0x0F, 0x0C);
+ if (ret)
+ return ret;
+
+ return ret;
}
static int ak4497_parse_dt(struct ak4497_priv *ak4497)
@@ -882,16 +889,25 @@ static int ak4497_probe(struct snd_soc_codec *codec)
int ret = 0;
ret = ak4497_parse_dt(ak4497);
+ if (ret)
+ return ret;
+
if (gpio_is_valid(ak4497->pdn_gpio)) {
ret = gpio_request(ak4497->pdn_gpio, "ak4497 pdn");
+ if (ret)
+ return ret;
gpio_direction_output(ak4497->pdn_gpio, 0);
}
if (gpio_is_valid(ak4497->mute_gpio)) {
ret = gpio_request(ak4497->mute_gpio, "ak4497 mute");
+ if (ret)
+ return ret;
gpio_direction_output(ak4497->mute_gpio, 0);
}
- ak4497_init_reg(codec);
+ ret = ak4497_init_reg(codec);
+ if (ret)
+ return ret;
ak4497->fs1 = 48000;
ak4497->nBickFreq = 1;