diff options
Diffstat (limited to 'sound/soc/codecs/88pm860x-codec.c')
-rw-r--r-- | sound/soc/codecs/88pm860x-codec.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/sound/soc/codecs/88pm860x-codec.c b/sound/soc/codecs/88pm860x-codec.c index 01d19e9f53f9..06b6981b8d6d 100644 --- a/sound/soc/codecs/88pm860x-codec.c +++ b/sound/soc/codecs/88pm860x-codec.c | |||
@@ -19,10 +19,10 @@ | |||
19 | #include <sound/pcm.h> | 19 | #include <sound/pcm.h> |
20 | #include <sound/pcm_params.h> | 20 | #include <sound/pcm_params.h> |
21 | #include <sound/soc.h> | 21 | #include <sound/soc.h> |
22 | #include <sound/soc-dapm.h> | ||
23 | #include <sound/tlv.h> | 22 | #include <sound/tlv.h> |
24 | #include <sound/initval.h> | 23 | #include <sound/initval.h> |
25 | #include <sound/jack.h> | 24 | #include <sound/jack.h> |
25 | #include <trace/events/asoc.h> | ||
26 | 26 | ||
27 | #include "88pm860x-codec.h" | 27 | #include "88pm860x-codec.h" |
28 | 28 | ||
@@ -146,7 +146,6 @@ struct pm860x_priv { | |||
146 | 146 | ||
147 | int irq[4]; | 147 | int irq[4]; |
148 | unsigned char name[4][MAX_NAME_LEN]; | 148 | unsigned char name[4][MAX_NAME_LEN]; |
149 | unsigned char reg_cache[REG_CACHE_SIZE]; | ||
150 | }; | 149 | }; |
151 | 150 | ||
152 | /* -9450dB to 0dB in 150dB steps ( mute instead of -9450dB) */ | 151 | /* -9450dB to 0dB in 150dB steps ( mute instead of -9450dB) */ |
@@ -1172,7 +1171,7 @@ static int pm860x_set_bias_level(struct snd_soc_codec *codec, | |||
1172 | break; | 1171 | break; |
1173 | 1172 | ||
1174 | case SND_SOC_BIAS_STANDBY: | 1173 | case SND_SOC_BIAS_STANDBY: |
1175 | if (codec->bias_level == SND_SOC_BIAS_OFF) { | 1174 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { |
1176 | /* Enable Audio PLL & Audio section */ | 1175 | /* Enable Audio PLL & Audio section */ |
1177 | data = AUDIO_PLL | AUDIO_SECTION_RESET | 1176 | data = AUDIO_PLL | AUDIO_SECTION_RESET |
1178 | | AUDIO_SECTION_ON; | 1177 | | AUDIO_SECTION_ON; |
@@ -1185,7 +1184,7 @@ static int pm860x_set_bias_level(struct snd_soc_codec *codec, | |||
1185 | pm860x_set_bits(codec->control_data, REG_MISC2, data, 0); | 1184 | pm860x_set_bits(codec->control_data, REG_MISC2, data, 0); |
1186 | break; | 1185 | break; |
1187 | } | 1186 | } |
1188 | codec->bias_level = level; | 1187 | codec->dapm.bias_level = level; |
1189 | return 0; | 1188 | return 0; |
1190 | } | 1189 | } |
1191 | 1190 | ||
@@ -1263,6 +1262,12 @@ static irqreturn_t pm860x_codec_handler(int irq, void *data) | |||
1263 | mask = pm860x->det.hs_shrt | pm860x->det.hook_det | pm860x->det.lo_shrt | 1262 | mask = pm860x->det.hs_shrt | pm860x->det.hook_det | pm860x->det.lo_shrt |
1264 | | pm860x->det.hp_det; | 1263 | | pm860x->det.hp_det; |
1265 | 1264 | ||
1265 | #ifndef CONFIG_SND_SOC_88PM860X_MODULE | ||
1266 | if (status & (HEADSET_STATUS | MIC_STATUS | SHORT_HS1 | SHORT_HS2 | | ||
1267 | SHORT_LO1 | SHORT_LO2)) | ||
1268 | trace_snd_soc_jack_irq(dev_name(pm860x->codec->dev)); | ||
1269 | #endif | ||
1270 | |||
1266 | if ((pm860x->det.hp_det & SND_JACK_HEADPHONE) | 1271 | if ((pm860x->det.hp_det & SND_JACK_HEADPHONE) |
1267 | && (status & HEADSET_STATUS)) | 1272 | && (status & HEADSET_STATUS)) |
1268 | report |= SND_JACK_HEADPHONE; | 1273 | report |= SND_JACK_HEADPHONE; |
@@ -1346,6 +1351,7 @@ EXPORT_SYMBOL_GPL(pm860x_mic_jack_detect); | |||
1346 | static int pm860x_probe(struct snd_soc_codec *codec) | 1351 | static int pm860x_probe(struct snd_soc_codec *codec) |
1347 | { | 1352 | { |
1348 | struct pm860x_priv *pm860x = snd_soc_codec_get_drvdata(codec); | 1353 | struct pm860x_priv *pm860x = snd_soc_codec_get_drvdata(codec); |
1354 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
1349 | int i, ret; | 1355 | int i, ret; |
1350 | 1356 | ||
1351 | pm860x->codec = codec; | 1357 | pm860x->codec = codec; |
@@ -1358,7 +1364,7 @@ static int pm860x_probe(struct snd_soc_codec *codec) | |||
1358 | pm860x->name[i], pm860x); | 1364 | pm860x->name[i], pm860x); |
1359 | if (ret < 0) { | 1365 | if (ret < 0) { |
1360 | dev_err(codec->dev, "Failed to request IRQ!\n"); | 1366 | dev_err(codec->dev, "Failed to request IRQ!\n"); |
1361 | goto out_irq; | 1367 | goto out; |
1362 | } | 1368 | } |
1363 | } | 1369 | } |
1364 | 1370 | ||
@@ -1369,22 +1375,20 @@ static int pm860x_probe(struct snd_soc_codec *codec) | |||
1369 | if (ret < 0) { | 1375 | if (ret < 0) { |
1370 | dev_err(codec->dev, "Failed to fill register cache: %d\n", | 1376 | dev_err(codec->dev, "Failed to fill register cache: %d\n", |
1371 | ret); | 1377 | ret); |
1372 | goto out_codec; | 1378 | goto out; |
1373 | } | 1379 | } |
1374 | 1380 | ||
1375 | snd_soc_add_controls(codec, pm860x_snd_controls, | 1381 | snd_soc_add_controls(codec, pm860x_snd_controls, |
1376 | ARRAY_SIZE(pm860x_snd_controls)); | 1382 | ARRAY_SIZE(pm860x_snd_controls)); |
1377 | snd_soc_dapm_new_controls(codec, pm860x_dapm_widgets, | 1383 | snd_soc_dapm_new_controls(dapm, pm860x_dapm_widgets, |
1378 | ARRAY_SIZE(pm860x_dapm_widgets)); | 1384 | ARRAY_SIZE(pm860x_dapm_widgets)); |
1379 | snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); | 1385 | snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); |
1380 | return 0; | 1386 | return 0; |
1381 | 1387 | ||
1382 | out_codec: | 1388 | out: |
1383 | i = 3; | 1389 | while (--i >= 0) |
1384 | out_irq: | ||
1385 | for (; i >= 0; i--) | ||
1386 | free_irq(pm860x->irq[i], pm860x); | 1390 | free_irq(pm860x->irq[i], pm860x); |
1387 | return -EINVAL; | 1391 | return ret; |
1388 | } | 1392 | } |
1389 | 1393 | ||
1390 | static int pm860x_remove(struct snd_soc_codec *codec) | 1394 | static int pm860x_remove(struct snd_soc_codec *codec) |