From d155fdcb2f09184d78873eba160e6228124218c0 Mon Sep 17 00:00:00 2001 From: Xiaojun Sang Date: Thu, 11 Oct 2018 15:11:59 +0800 Subject: [PATCH] asoc: bolero: avoid TX distortion by runtime HPF param change Runtime HPF param change leads to TX distortion at the beginning. Unmute HPF after param change. Change-Id: I7683ca047123dd004fb2dd019365305edfc72ea5 Signed-off-by: Xiaojun Sang --- asoc/codecs/bolero/tx-macro.c | 9 +++------ asoc/codecs/bolero/va-macro.c | 9 +++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/asoc/codecs/bolero/tx-macro.c b/asoc/codecs/bolero/tx-macro.c index 09dd3b097b01..a16f778de4d3 100644 --- a/asoc/codecs/bolero/tx-macro.c +++ b/asoc/codecs/bolero/tx-macro.c @@ -370,10 +370,10 @@ static void tx_macro_tx_hpf_corner_freq_callback(struct work_struct *work) tx_hpf_set: snd_soc_update_bits(codec, dec_cfg_reg, TX_HPF_CUT_OFF_FREQ_MASK, hpf_cut_off_freq << 5); - snd_soc_update_bits(codec, hpf_gate_reg, 0x02, 0x02); + snd_soc_update_bits(codec, hpf_gate_reg, 0x03, 0x02); /* Minimum 1 clk cycle delay is required as per HW spec */ usleep_range(1000, 1010); - snd_soc_update_bits(codec, hpf_gate_reg, 0x02, 0x00); + snd_soc_update_bits(codec, hpf_gate_reg, 0x03, 0x01); } static void tx_macro_mute_update_callback(struct work_struct *work) @@ -382,7 +382,7 @@ static void tx_macro_mute_update_callback(struct work_struct *work) struct snd_soc_codec *codec = NULL; struct tx_macro_priv *tx_priv = NULL; struct delayed_work *delayed_work = NULL; - u16 tx_vol_ctl_reg = 0, hpf_gate_reg = 0; + u16 tx_vol_ctl_reg = 0; u8 decimator = 0; delayed_work = to_delayed_work(work); @@ -394,9 +394,6 @@ static void tx_macro_mute_update_callback(struct work_struct *work) tx_vol_ctl_reg = BOLERO_CDC_TX0_TX_PATH_CTL + TX_MACRO_TX_PATH_OFFSET * decimator; - hpf_gate_reg = BOLERO_CDC_TX0_TX_PATH_SEC2 + - TX_MACRO_TX_PATH_OFFSET * decimator; - snd_soc_update_bits(codec, hpf_gate_reg, 0x01, 0x01); snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x10, 0x00); dev_dbg(tx_priv->dev, "%s: decimator %u unmute\n", __func__, decimator); diff --git a/asoc/codecs/bolero/va-macro.c b/asoc/codecs/bolero/va-macro.c index 0bbdc68be334..e32d9cdc9654 100644 --- a/asoc/codecs/bolero/va-macro.c +++ b/asoc/codecs/bolero/va-macro.c @@ -304,10 +304,10 @@ static void va_macro_tx_hpf_corner_freq_callback(struct work_struct *work) snd_soc_update_bits(codec, dec_cfg_reg, TX_HPF_CUT_OFF_FREQ_MASK, hpf_cut_off_freq << 5); - snd_soc_update_bits(codec, hpf_gate_reg, 0x02, 0x02); + snd_soc_update_bits(codec, hpf_gate_reg, 0x03, 0x02); /* Minimum 1 clk cycle delay is required as per HW spec */ usleep_range(1000, 1010); - snd_soc_update_bits(codec, hpf_gate_reg, 0x02, 0x00); + snd_soc_update_bits(codec, hpf_gate_reg, 0x03, 0x01); } static void va_macro_mute_update_callback(struct work_struct *work) @@ -316,7 +316,7 @@ static void va_macro_mute_update_callback(struct work_struct *work) struct snd_soc_codec *codec = NULL; struct va_macro_priv *va_priv; struct delayed_work *delayed_work; - u16 tx_vol_ctl_reg, hpf_gate_reg, decimator; + u16 tx_vol_ctl_reg, decimator; delayed_work = to_delayed_work(work); va_mute_dwork = container_of(delayed_work, struct va_mute_work, dwork); @@ -327,9 +327,6 @@ static void va_macro_mute_update_callback(struct work_struct *work) tx_vol_ctl_reg = BOLERO_CDC_VA_TX0_TX_PATH_CTL + VA_MACRO_TX_PATH_OFFSET * decimator; - hpf_gate_reg = BOLERO_CDC_VA_TX0_TX_PATH_SEC2 + - VA_MACRO_TX_PATH_OFFSET * decimator; - snd_soc_update_bits(codec, hpf_gate_reg, 0x01, 0x01); snd_soc_update_bits(codec, tx_vol_ctl_reg, 0x10, 0x00); dev_dbg(va_priv->dev, "%s: decimator %u unmute\n", __func__, decimator);