diff options
Diffstat (limited to 'sound/soc/codecs/rt298.c')
-rw-r--r-- | sound/soc/codecs/rt298.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c index 2db8179047ae..7150a407ffd9 100644 --- a/sound/soc/codecs/rt298.c +++ b/sound/soc/codecs/rt298.c | |||
@@ -326,11 +326,31 @@ static void rt298_jack_detect_work(struct work_struct *work) | |||
326 | int rt298_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack) | 326 | int rt298_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack) |
327 | { | 327 | { |
328 | struct rt298_priv *rt298 = snd_soc_codec_get_drvdata(codec); | 328 | struct rt298_priv *rt298 = snd_soc_codec_get_drvdata(codec); |
329 | struct snd_soc_dapm_context *dapm; | ||
330 | bool hp = false; | ||
331 | bool mic = false; | ||
332 | int status = 0; | ||
333 | |||
334 | /* If jack in NULL, disable HS jack */ | ||
335 | if (!jack) { | ||
336 | regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x0); | ||
337 | dapm = snd_soc_codec_get_dapm(codec); | ||
338 | snd_soc_dapm_disable_pin(dapm, "LDO1"); | ||
339 | snd_soc_dapm_sync(dapm); | ||
340 | return 0; | ||
341 | } | ||
329 | 342 | ||
330 | rt298->jack = jack; | 343 | rt298->jack = jack; |
344 | regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x2); | ||
331 | 345 | ||
332 | /* Send an initial empty report */ | 346 | rt298_jack_detect(rt298, &hp, &mic); |
333 | snd_soc_jack_report(rt298->jack, 0, | 347 | if (hp == true) |
348 | status |= SND_JACK_HEADPHONE; | ||
349 | |||
350 | if (mic == true) | ||
351 | status |= SND_JACK_MICROPHONE; | ||
352 | |||
353 | snd_soc_jack_report(rt298->jack, status, | ||
334 | SND_JACK_MICROPHONE | SND_JACK_HEADPHONE); | 354 | SND_JACK_MICROPHONE | SND_JACK_HEADPHONE); |
335 | 355 | ||
336 | return 0; | 356 | return 0; |