diff --git a/sound/soc/amlogic/auge/earc.c b/sound/soc/amlogic/auge/earc.c index becf85179..99bfd870a 100644 --- a/sound/soc/amlogic/auge/earc.c +++ b/sound/soc/amlogic/auge/earc.c @@ -931,10 +931,8 @@ static void earctx_update_attend_event(struct earc *p_earc, } } - if (p_earc->tx_dmac_clk_on && - p_earc->tx_arc_status != ATNDTYP_DISCNCT && - !p_earc->tx_reset_hpd) - earctx_dmac_force_mode(p_earc->tx_dmac_map, false); + if (p_earc->tx_dmac_clk_on) + earctx_dmac_force_mode(p_earc->tx_dmac_map, is_earc, true); spin_unlock_irqrestore(&p_earc->tx_lock, flags); if (send) { @@ -2371,7 +2369,7 @@ static void earctx_set_earc_mode(struct earc *p_earc, bool earc_mode, bool tinym /* switch to force mode for consume data when switch earc mode */ spin_lock_irqsave(&p_earc->tx_lock, flags); if (p_earc->tx_dmac_clk_on) - earctx_dmac_force_mode(p_earc->tx_dmac_map, true); + earctx_dmac_force_mode(p_earc->tx_dmac_map, false, true); spin_unlock_irqrestore(&p_earc->tx_lock, flags); #if (defined CONFIG_AMLOGIC_MEDIA_TVIN_HDMI ||\ diff --git a/sound/soc/amlogic/auge/earc_hw.c b/sound/soc/amlogic/auge/earc_hw.c index f63483ed6..73745b988 100644 --- a/sound/soc/amlogic/auge/earc_hw.c +++ b/sound/soc/amlogic/auge/earc_hw.c @@ -1625,6 +1625,21 @@ static void earctx_channel_sync_start(struct regmap *dmac_map, bool statrt) } } +void earctx_dmac_force_mode(struct regmap *dmac_map, bool is_earc, bool enable) +{ + pr_info("set earc tx force mode is_earc %d, enable %d\n", is_earc, enable); + + /* 0xe for arc mode, 0x3 for earc mode */ + if (enable) { + if (is_earc) + mmio_write(dmac_map, EARCTX_DMAC_TOP_CTRL0, 0x3); + else + mmio_write(dmac_map, EARCTX_DMAC_TOP_CTRL0, 0xe); + } else { + mmio_write(dmac_map, EARCTX_DMAC_TOP_CTRL0, 0); + } +} + void earctx_enable(struct regmap *top_map, struct regmap *cmdc_map, struct regmap *dmac_map, @@ -1668,6 +1683,8 @@ void earctx_enable(struct regmap *top_map, val << offset); } + earctx_dmac_force_mode(dmac_map, false, false); + /* first biphase work clear, and then start * only for earc */ @@ -2208,16 +2225,6 @@ void earctx_dmac_mute_and_hold_bus(struct regmap *dmac_map, bool enable) } -void earctx_dmac_force_mode(struct regmap *dmac_map, bool enable) -{ - pr_info("set earc tx force mode %d\n", enable); - /* force arc mode as earc mode will consume data faster */ - if (enable) - mmio_write(dmac_map, EARCTX_DMAC_TOP_CTRL0, 0xe); - else - mmio_write(dmac_map, EARCTX_DMAC_TOP_CTRL0, 0); -} - int earcrx_get_sample_rate(struct regmap *dmac_map) { unsigned int val; diff --git a/sound/soc/amlogic/auge/earc_hw.h b/sound/soc/amlogic/auge/earc_hw.h index a4a736bfd..48e130294 100644 --- a/sound/soc/amlogic/auge/earc_hw.h +++ b/sound/soc/amlogic/auge/earc_hw.h @@ -361,7 +361,7 @@ u8 earcrx_cmdc_get_rx_stat_bits(struct regmap *cmdc_map); u8 earcrx_cmdc_get_tx_stat_bits(struct regmap *cmdc_map); void earctx_cmdc_earc_mode(struct regmap *cmdc_map, bool enable); void earctx_dmac_mute_and_hold_bus(struct regmap *dmac_map, bool enable); -void earctx_dmac_force_mode(struct regmap *dmac_map, bool enable); +void earctx_dmac_force_mode(struct regmap *dmac_map, bool is_earc, bool enable); int earcrx_get_sample_rate(struct regmap *dmac_map); void earcrx_err_correction_force_mode(struct regmap *dmac_map, bool enable); void earcrx_efuse_trim_set(struct regmap *rx_top_map);