From 18898d41c5b2558300c2a5d55d524c064b0df483 Mon Sep 17 00:00:00 2001 From: Zhe Wang Date: Thu, 5 Apr 2018 20:30:54 +0800 Subject: [PATCH] audio & hdmi-rx: add hdmi-rx audio fifo reset and hdmi audio status[1/2] PD#161408: reset hdmi-rx audio fifo add hdmi audio status for audio driver. Change-Id: I6616301b2468204d4c0d56162b11f3efedd0650e Signed-off-by: Zhe Wang --- .../amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h | 26 +--------------------- drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.h | 1 - .../media/vin/tvin/hdmirx/hdmi_rx_wrapper.c | 4 ++-- .../linux/amlogic/media/frame_provider/tvin/tvin.h | 24 ++++++++++++++++++++ sound/soc/amlogic/meson/tv.c | 12 ++++++---- 5 files changed, 35 insertions(+), 32 deletions(-) diff --git a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h index 7dad765..64de015 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h @@ -34,7 +34,7 @@ //#include "hdmi_rx_edid.h" -#define RX_VER0 "ver.2018-03-30" +#define RX_VER0 "ver.2018-04-05" /* * * @@ -317,30 +317,6 @@ struct aud_info_s { int real_sr; }; -struct rx_audio_stat_s { - /* audio packets received */ - bool aud_rcv_flag; - /* audio stable status */ - bool aud_stb_flag; - /* audio sample rate */ - int aud_sr; - /* audio channel count - * 0: refer to stream header, - * 1: 2ch, 2: 3ch, 3: 4ch, 4: 5ch, - * 5: 6ch, 6: 7ch, 7: 8ch - */ - int aud_channel_cnt; - /* audio coding type - * 0: refer to stream header, 1: IEC60958 PCM, - * 2: AC-3, 3: MPEG1 (Layers 1 and 2), - * 4: MP3 (MPEG1 Layer 3), 5: MPEG2 (multichannel), - * 6: AAC, 7: DTS, 8: ATRAC, 9: One Bit Audio, - * 10: Dolby Digital Plus, 11: DTS-HD, - * 12: MAT (MLP), 13: DST, 14: WMA Pro - */ - int aud_type; -}; - struct rx_s { enum chip_id_e chip_id; /** HDMI RX received signal changed */ diff --git a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.h b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.h index 095a214..7904479 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.h +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.h @@ -1058,7 +1058,6 @@ extern void rx_get_video_info(void); extern void hdmirx_set_video_mute(bool mute); extern void hdmirx_config_video(void); extern void rx_get_audinfo(struct aud_info_s *audio_info); -extern void rx_get_audio_status(struct rx_audio_stat_s *aud_sts); extern bool rx_clkrate_monitor(void); extern unsigned char rx_get_hdcp14_sts(void); diff --git a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c index 5ab60da..ba138ba 100644 --- a/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c +++ b/drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_wrapper.c @@ -240,8 +240,7 @@ void rx_tasklet_handler(unsigned long arg) if (irq_flag & IRQ_PACKET_FLAG) rx_pkt_handler(PKT_BUFF_SET_FIFO); - if ((irq_flag & IRQ_AUD_FLAG) && - (rx.aud_info.real_sr != 0)) + if (irq_flag & IRQ_AUD_FLAG) hdmirx_audio_fifo_rst(); /*irq_flag = 0;*/ @@ -1918,6 +1917,7 @@ void rx_main_state_machine(void) //rx_set_eq_run_state(E_EQ_PASS); hdmirx_config_video(); rx_aud_pll_ctl(1); + hdmirx_audio_fifo_rst(); rx.stable_timestamp = rx.timestamp; rx_pr("Sig ready\n"); dump_state(1); diff --git a/include/linux/amlogic/media/frame_provider/tvin/tvin.h b/include/linux/amlogic/media/frame_provider/tvin/tvin.h index abf1b37..7d5de0a 100644 --- a/include/linux/amlogic/media/frame_provider/tvin/tvin.h +++ b/include/linux/amlogic/media/frame_provider/tvin/tvin.h @@ -450,7 +450,31 @@ struct dfe_adcpll_para { unsigned int demodctl; unsigned int atsc; }; + +struct rx_audio_stat_s { + /*audio packets received*/ + bool aud_rcv_flag; + /*audio stable status*/ + bool aud_stb_flag; + /*audio sample rate*/ + int aud_sr; + /**audio channel count*/ + /*0: refer to stream header,*/ + /*1: 2ch, 2: 3ch, 3: 4ch, 4: 5ch,*/ + /*5: 6ch, 6: 7ch, 7: 8ch*/ + int aud_channel_cnt; + /**audio coding type*/ + /*0: refer to stream header, 1: IEC60958 PCM,*/ + /*2: AC-3, 3: MPEG1 (Layers 1 and 2),*/ + /*4: MP3 (MPEG1 Layer 3), 5: MPEG2 (multichannel),*/ + /*6: AAC, 7: DTS, 8: ATRAC, 9: One Bit Audio,*/ + /*10: Dolby Digital Plus, 11: DTS-HD,*/ + /*12: MAT (MLP), 13: DST, 14: WMA Pro*/ + int aud_type; +}; + extern int adc_set_pll_cntl(bool on, unsigned int module_sel, void *pDtvPara); extern void tvafe_set_ddemod_default(void);/* add for dtv demod*/ +extern void rx_get_audio_status(struct rx_audio_stat_s *aud_sts); #endif diff --git a/sound/soc/amlogic/meson/tv.c b/sound/soc/amlogic/meson/tv.c index 307b938..51ed2c0 100644 --- a/sound/soc/amlogic/meson/tv.c +++ b/sound/soc/amlogic/meson/tv.c @@ -46,6 +46,9 @@ #ifdef CONFIG_AMLOGIC_AO_CEC #include #endif +#ifdef CONFIG_AMLOGIC_MEDIA_TVIN_HDMI +#include +#endif #include "i2s.h" #include "audio_hw.h" @@ -455,7 +458,7 @@ static int aml_set_arc_audio(struct snd_kcontrol *kcontrol, } #endif -#ifdef CONFIG_TVIN_HDMI +#ifdef CONFIG_AMLOGIC_MEDIA_TVIN_HDMI /* call HDMI CEC API to enable arc audio */ static int aml_set_atmos_audio_edid(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) @@ -465,7 +468,7 @@ static int aml_set_atmos_audio_edid(struct snd_kcontrol *kcontrol, bool enable = ucontrol->value.integer.value[0]; p_aml_audio = snd_soc_card_get_drvdata(card); - rx_set_atmos_flag(enable); + //rx_set_atmos_flag(enable); p_aml_audio->atmos_edid_enable = enable; return 0; } @@ -645,7 +648,8 @@ static int aml_get_hdmiin_audio_format(struct snd_kcontrol *kcontrol, ucontrol->value.integer.value[0] = aud_sts.aud_type; return 0; } -#endif /* CONFIG_TVIN_HDMI */ +#endif + #ifdef CONFIG_AM_DVB static const char *const atv_audio_is_stable[] = { "false", @@ -712,7 +716,7 @@ static const struct snd_kcontrol_new aml_tv_controls[] = { aml_get_arc_audio, aml_set_arc_audio), #endif -#ifdef CONFIG_TVIN_HDMI +#ifdef CONFIG_AMLOGIC_MEDIA_TVIN_HDMI SOC_ENUM_EXT("HDMIIN audio stable", hdmi_in_status_enum[0], aml_get_hdmiin_audio_stable, NULL), -- 2.7.4