diff options
Diffstat (limited to 'sound/soc/codecs/rt286.c')
-rw-r--r-- | sound/soc/codecs/rt286.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c index 826037090c83..0fcda35a3a93 100644 --- a/sound/soc/codecs/rt286.c +++ b/sound/soc/codecs/rt286.c | |||
@@ -397,7 +397,7 @@ int rt286_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack) | |||
397 | 397 | ||
398 | if (jack) { | 398 | if (jack) { |
399 | /* enable IRQ */ | 399 | /* enable IRQ */ |
400 | if (rt286->jack->status | SND_JACK_HEADPHONE) | 400 | if (rt286->jack->status & SND_JACK_HEADPHONE) |
401 | snd_soc_dapm_force_enable_pin(&codec->dapm, "LDO1"); | 401 | snd_soc_dapm_force_enable_pin(&codec->dapm, "LDO1"); |
402 | regmap_update_bits(rt286->regmap, RT286_IRQ_CTRL, 0x2, 0x2); | 402 | regmap_update_bits(rt286->regmap, RT286_IRQ_CTRL, 0x2, 0x2); |
403 | /* Send an initial empty report */ | 403 | /* Send an initial empty report */ |
@@ -1048,7 +1048,6 @@ static int rt286_probe(struct snd_soc_codec *codec) | |||
1048 | struct rt286_priv *rt286 = snd_soc_codec_get_drvdata(codec); | 1048 | struct rt286_priv *rt286 = snd_soc_codec_get_drvdata(codec); |
1049 | 1049 | ||
1050 | rt286->codec = codec; | 1050 | rt286->codec = codec; |
1051 | codec->dapm.bias_level = SND_SOC_BIAS_OFF; | ||
1052 | 1051 | ||
1053 | if (rt286->i2c->irq) { | 1052 | if (rt286->i2c->irq) { |
1054 | regmap_update_bits(rt286->regmap, | 1053 | regmap_update_bits(rt286->regmap, |
@@ -1220,7 +1219,7 @@ static int rt286_i2c_probe(struct i2c_client *i2c, | |||
1220 | { | 1219 | { |
1221 | struct rt286_platform_data *pdata = dev_get_platdata(&i2c->dev); | 1220 | struct rt286_platform_data *pdata = dev_get_platdata(&i2c->dev); |
1222 | struct rt286_priv *rt286; | 1221 | struct rt286_priv *rt286; |
1223 | int i, ret; | 1222 | int i, ret, val; |
1224 | 1223 | ||
1225 | rt286 = devm_kzalloc(&i2c->dev, sizeof(*rt286), | 1224 | rt286 = devm_kzalloc(&i2c->dev, sizeof(*rt286), |
1226 | GFP_KERNEL); | 1225 | GFP_KERNEL); |
@@ -1235,11 +1234,15 @@ static int rt286_i2c_probe(struct i2c_client *i2c, | |||
1235 | return ret; | 1234 | return ret; |
1236 | } | 1235 | } |
1237 | 1236 | ||
1238 | regmap_read(rt286->regmap, | 1237 | ret = regmap_read(rt286->regmap, |
1239 | RT286_GET_PARAM(AC_NODE_ROOT, AC_PAR_VENDOR_ID), &ret); | 1238 | RT286_GET_PARAM(AC_NODE_ROOT, AC_PAR_VENDOR_ID), &val); |
1240 | if (ret != RT286_VENDOR_ID && ret != RT288_VENDOR_ID) { | 1239 | if (ret != 0) { |
1240 | dev_err(&i2c->dev, "I2C error %d\n", ret); | ||
1241 | return ret; | ||
1242 | } | ||
1243 | if (val != RT286_VENDOR_ID && val != RT288_VENDOR_ID) { | ||
1241 | dev_err(&i2c->dev, | 1244 | dev_err(&i2c->dev, |
1242 | "Device with ID register %x is not rt286\n", ret); | 1245 | "Device with ID register %x is not rt286\n", val); |
1243 | return -ENODEV; | 1246 | return -ENODEV; |
1244 | } | 1247 | } |
1245 | 1248 | ||
@@ -1247,6 +1250,14 @@ static int rt286_i2c_probe(struct i2c_client *i2c, | |||
1247 | rt286->i2c = i2c; | 1250 | rt286->i2c = i2c; |
1248 | i2c_set_clientdata(i2c, rt286); | 1251 | i2c_set_clientdata(i2c, rt286); |
1249 | 1252 | ||
1253 | /* restore codec default */ | ||
1254 | for (i = 0; i < INDEX_CACHE_SIZE; i++) | ||
1255 | regmap_write(rt286->regmap, rt286->index_cache[i].reg, | ||
1256 | rt286->index_cache[i].def); | ||
1257 | for (i = 0; i < ARRAY_SIZE(rt286_reg); i++) | ||
1258 | regmap_write(rt286->regmap, rt286_reg[i].reg, | ||
1259 | rt286_reg[i].def); | ||
1260 | |||
1250 | if (pdata) | 1261 | if (pdata) |
1251 | rt286->pdata = *pdata; | 1262 | rt286->pdata = *pdata; |
1252 | 1263 | ||