From a4faaf428bb8360425ec1fdfbead9dedade25375 Mon Sep 17 00:00:00 2001 From: "nengwen.chen" Date: Wed, 20 Mar 2019 21:10:40 +0800 Subject: [PATCH] audio: Image signal delay of 1.5 seconds when switching to AV source [1/2] PD#TV-3067 Problem: Image signal delay of 1.5 seconds when switching to AV source. Solution: 1.add av audio control for audio patch. Verify: verified by x301 Change-Id: I3e820923a26439b3aeb9841562b81cd6d55ed4ea Signed-off-by: nengwen.chen --- include/linux/amlogic/media/sound/misc.h | 9 +++++++++ sound/soc/amlogic/auge/extn.c | 7 +++++++ sound/soc/amlogic/common/misc.c | 14 ++++++++++++++ sound/soc/amlogic/meson/tv.c | 18 +----------------- 4 files changed, 31 insertions(+), 17 deletions(-) diff --git a/include/linux/amlogic/media/sound/misc.h b/include/linux/amlogic/media/sound/misc.h index 7f3edbfb5bcd..25341c2e18be 100644 --- a/include/linux/amlogic/media/sound/misc.h +++ b/include/linux/amlogic/media/sound/misc.h @@ -31,6 +31,15 @@ int aml_get_atv_audio_stable( #endif +#ifdef CONFIG_AMLOGIC_MEDIA_TVIN_AVDETECT +extern int tvin_get_av_status(void); +extern const struct soc_enum av_audio_status_enum; + +extern int aml_get_av_audio_stable( + struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol); +#endif + #ifdef CONFIG_AMLOGIC_MEDIA_TVIN_HDMI extern int update_spdifin_audio_type(int audio_type); diff --git a/sound/soc/amlogic/auge/extn.c b/sound/soc/amlogic/auge/extn.c index ad7aacbe7a22..07d31ee2e8ee 100644 --- a/sound/soc/amlogic/auge/extn.c +++ b/sound/soc/amlogic/auge/extn.c @@ -772,6 +772,13 @@ static const struct snd_kcontrol_new extn_controls[] = { NULL), #endif +#ifdef CONFIG_AMLOGIC_MEDIA_TVIN_AVDETECT + SOC_ENUM_EXT("AV audio stable", + av_audio_status_enum, + aml_get_av_audio_stable, + NULL), +#endif + #ifdef CONFIG_AMLOGIC_MEDIA_TVIN_HDMI SOC_ENUM_EXT("HDMIIN audio stable", hdmi_in_status_enum[0], diff --git a/sound/soc/amlogic/common/misc.c b/sound/soc/amlogic/common/misc.c index 42d7e23438d1..fc15a68f4de1 100644 --- a/sound/soc/amlogic/common/misc.c +++ b/sound/soc/amlogic/common/misc.c @@ -47,6 +47,20 @@ int aml_get_atv_audio_stable( } #endif /* CONFIG_AMLOGIC_ATV_DEMOD */ +#ifdef CONFIG_AMLOGIC_MEDIA_TVIN_AVDETECT + +const struct soc_enum av_audio_status_enum = + SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, ARRAY_SIZE(audio_is_stable), + audio_is_stable); + +int aml_get_av_audio_stable(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + ucontrol->value.integer.value[0] = tvin_get_av_status(); + return 0; +} +#endif /* CONFIG_AMLOGIC_MEDIA_TVIN_AVDETECT */ + #ifdef CONFIG_AMLOGIC_MEDIA_TVIN_HDMI int hdmiin_fifo_disable_count; diff --git a/sound/soc/amlogic/meson/tv.c b/sound/soc/amlogic/meson/tv.c index 6c184fd8497a..a5b00f110581 100644 --- a/sound/soc/amlogic/meson/tv.c +++ b/sound/soc/amlogic/meson/tv.c @@ -562,22 +562,6 @@ static int aml_set_arc_audio(struct snd_kcontrol *kcontrol, } #endif -#ifdef CONFIG_TVIN_VDIN -static const char *const av_audio_is_stable[] = { - "false", - "true" -}; -static const struct soc_enum av_audio_status_enum = - SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, ARRAY_SIZE(av_audio_is_stable), - av_audio_is_stable); -static int aml_get_av_audio_stable(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - ucontrol->value.integer.value[0] = tvin_get_av_status(); - return 0; -} -#endif /* CONFIG_TVIN_VDIN */ - static const struct snd_kcontrol_new av_controls[] = { SOC_ENUM_EXT("AudioIn Switch", audio_in_switch_enum, @@ -641,7 +625,7 @@ static const struct snd_kcontrol_new aml_tv_controls[] = { aml_get_atv_audio_stable, NULL), #endif -#ifdef CONFIG_TVIN_VDIN +#ifdef CONFIG_AMLOGIC_MEDIA_TVIN_AVDETECT SOC_ENUM_EXT("AV audio stable", av_audio_status_enum, aml_get_av_audio_stable, NULL),