ASoC: rt5640: Fix the wrong state of JD1 and JD2
Subsystems (3)
Oder Chiou
maintainerPATCH 1/2 ASoC: rt5640: Fix the wrong state of JD1 and JD2
The patch fixes the wrong state of JD1 and JD2 while the bst1 or bst2 is power on in the HDA JD using.
--- sound/soc/codecs/rt5640.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-)
sound/soc/codecs/rt5640.c +22 -8
@@ -1984,7 +1984,12 @@ static int rt5640_set_bias_level(struct snd_soc_component *component,snd_soc_component_write (component,RT5640_PWR_DIG2 ,0x0000 );snd_soc_component_write (component,RT5640_PWR_VOL ,0x0000 );snd_soc_component_write (component,RT5640_PWR_MIXER ,0x0000 ); -snd_soc_component_write (component,RT5640_PWR_ANLG1 ,0x0000 ); +if (rt5640->jd_src ==RT5640_JD_SRC_HDA_HEADER ) +snd_soc_component_write (component,RT5640_PWR_ANLG1 , +0x0018 ); +else +snd_soc_component_write (component,RT5640_PWR_ANLG1 , +0x0000 );snd_soc_component_write (component,RT5640_PWR_ANLG2 ,0x0000 );break ;
@@ -2393,9 +2398,15 @@ static void rt5640_jack_work(struct work_struct *work)static irqreturn_t rt5640_irq (int irq,void *data) {struct rt5640_priv *rt5640 = data; +int delay =0 ; + +if (rt5640->jd_src ==RT5640_JD_SRC_HDA_HEADER ) { +cancel_delayed_work_sync (&rt5640->jack_work); + delay =100 ; + }if (rt5640->jack) -queue_delayed_work (system_long_wq, &rt5640->jack_work,0 ); +queue_delayed_work (system_long_wq, &rt5640->jack_work, delay);return IRQ_HANDLED ; }
@@ -2580,6 +2591,12 @@ static void rt5640_enable_hda_jack_detect(snd_soc_component_update_bits (component,RT5640_DUMMY1 ,0x400 ,0x0 ); +snd_soc_component_update_bits (component,RT5640_PWR_ANLG1 , +RT5640_PWR_VREF2 ,RT5640_PWR_VREF2 ); +usleep_range (10000 ,15000 ); +snd_soc_component_update_bits (component,RT5640_PWR_ANLG1 , +RT5640_PWR_FV2 ,RT5640_PWR_FV2 ); + rt5640->jack = jack; ret = request_irq(rt5640->irq, rt5640_irq,
@@ -2696,16 +2713,13 @@ static int rt5640_probe(struct snd_soc_component *component)if (device_property_read_u32 (component->dev,"realtek,jack-detect-source" , &val) ==0 ) { -if (val <=RT5640_JD_SRC_GPIO4 ) { +if (val <=RT5640_JD_SRC_GPIO4 ) rt5640->jd_src = val <<RT5640_JD_SFT ; - }else if (val ==RT5640_JD_SRC_HDA_HEADER ) { +else if (val ==RT5640_JD_SRC_HDA_HEADER ) rt5640->jd_src =RT5640_JD_SRC_HDA_HEADER ; -snd_soc_component_update_bits (component,RT5640_DUMMY1 , -0x0300 ,0x0 ); - }else { +else dev_warn (component->dev,"Warning: Invalid jack-detect-source value: %d, leaving jack-detect disabled\n" , val); - } }if (!device_property_read_bool (component->dev,"realtek,jack-detect-not-inverted" ))
Signature · 1 line
2.37.0
Oder Chiou
maintainerPATCH 2/2 ASoC: rt5640: Add the MICBIAS1 to the dapm routing
The patch adds the MICBIAS1 to the dapm routing while the HDA header used.
--- sound/soc/codecs/rt5640.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
sound/soc/codecs/rt5640.c +11 -0
@@ -2567,10 +2567,18 @@ static void rt5640_enable_jack_detect(struct snd_soc_component *component,queue_delayed_work (system_long_wq, &rt5640->jack_work,0 ); } +static const struct snd_soc_dapm_route rt5640_hda_jack_dapm_routes[] = { + {"IN1P" ,NULL ,"MICBIAS1" }, + {"IN2P" ,NULL ,"MICBIAS1" }, + {"IN3P" ,NULL ,"MICBIAS1" }, +}; +static void rt5640_enable_hda_jack_detect (struct snd_soc_component *component,struct snd_soc_jack *jack) {struct rt5640_priv *rt5640 =snd_soc_component_get_drvdata (component); +struct snd_soc_dapm_context *dapm = +snd_soc_component_get_dapm (component);int ret;/* Select JD1 for Mic */
@@ -2609,6 +2617,9 @@ static void rt5640_enable_hda_jack_detect(/* sync initial jack state */ queue_delayed_work (system_long_wq, &rt5640->jack_work,0 ); + +snd_soc_dapm_add_routes (dapm, rt5640_hda_jack_dapm_routes, +ARRAY_SIZE (rt5640_hda_jack_dapm_routes)); } static int rt5640_set_jack(struct snd_soc_component *component,
Signature · 1 line
2.37.0
Mark Brown
maintainerQuoted 4 lines · Oder Chiou
The patch fixes the wrong state of JD1 and JD2 while the bst1 or bst2 is power on in the HDA JD using.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/2] ASoC: rt5640: Fix the wrong state of JD1 and JD2
commit: ca687e8c7e1f5b6b07e84db592bfbef3670d8ead
[2/2] ASoC: rt5640: Add the MICBIAS1 to the dapm routing
(no commit info)
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark