diff --git a/asoc/codecs/bolero/rx-macro.c b/asoc/codecs/bolero/rx-macro.c index ead897129d41..8809a6a45f5b 100644 --- a/asoc/codecs/bolero/rx-macro.c +++ b/asoc/codecs/bolero/rx-macro.c @@ -3566,6 +3566,15 @@ exit: return ret; } +static const struct rx_macro_reg_mask_val rx_macro_reg_init[] = { + {BOLERO_CDC_RX_RX0_RX_PATH_SEC7, 0x07, 0x02}, + {BOLERO_CDC_RX_RX1_RX_PATH_SEC7, 0x07, 0x02}, + {BOLERO_CDC_RX_RX2_RX_PATH_SEC7, 0x07, 0x02}, + {BOLERO_CDC_RX_RX0_RX_PATH_CFG3, 0x03, 0x02}, + {BOLERO_CDC_RX_RX1_RX_PATH_CFG3, 0x03, 0x02}, + {BOLERO_CDC_RX_RX2_RX_PATH_CFG3, 0x03, 0x02}, +}; + static void rx_macro_init_bcl_pmic_reg(struct snd_soc_component *component) { struct device *rx_dev = NULL; @@ -3620,6 +3629,7 @@ static int rx_macro_init(struct snd_soc_component *component) int ret = 0; struct device *rx_dev = NULL; struct rx_macro_priv *rx_priv = NULL; + int i; rx_dev = bolero_get_device_ptr(component->dev, RX_MACRO); if (!rx_dev) { @@ -3671,18 +3681,11 @@ static int rx_macro_init(struct snd_soc_component *component) snd_soc_dapm_ignore_suspend(dapm, "RX_TX DEC3_INP"); snd_soc_dapm_sync(dapm); - snd_soc_component_update_bits(component, BOLERO_CDC_RX_RX0_RX_PATH_SEC7, - 0x07, 0x02); - snd_soc_component_update_bits(component, BOLERO_CDC_RX_RX1_RX_PATH_SEC7, - 0x07, 0x02); - snd_soc_component_update_bits(component, BOLERO_CDC_RX_RX2_RX_PATH_SEC7, - 0x07, 0x02); - snd_soc_component_update_bits(component, BOLERO_CDC_RX_RX0_RX_PATH_CFG3, - 0x03, 0x02); - snd_soc_component_update_bits(component, BOLERO_CDC_RX_RX1_RX_PATH_CFG3, - 0x03, 0x02); - snd_soc_component_update_bits(component, BOLERO_CDC_RX_RX2_RX_PATH_CFG3, - 0x03, 0x02); + for (i = 0; i < ARRAY_SIZE(rx_macro_reg_init); i++) + snd_soc_component_update_bits(component, + rx_macro_reg_init[i].reg, + rx_macro_reg_init[i].mask, + rx_macro_reg_init[i].val); rx_priv->component = component; rx_macro_init_bcl_pmic_reg(component); diff --git a/asoc/codecs/bolero/tx-macro.c b/asoc/codecs/bolero/tx-macro.c index 8c6913fa3a9a..ead73898700a 100644 --- a/asoc/codecs/bolero/tx-macro.c +++ b/asoc/codecs/bolero/tx-macro.c @@ -120,6 +120,12 @@ enum { VA_MCLK, }; +struct tx_macro_reg_mask_val { + u16 reg; + u8 mask; + u8 val; +}; + struct tx_mute_work { struct tx_macro_priv *tx_priv; u32 decimator; @@ -2089,6 +2095,10 @@ undefined_rate: return dmic_sample_rate; } +static const struct tx_macro_reg_mask_val tx_macro_reg_init[] = { + {BOLERO_CDC_TX0_TX_PATH_SEC7, 0x3F, 0x0E}, +}; + static int tx_macro_init(struct snd_soc_component *component) { struct snd_soc_dapm_context *dapm = @@ -2168,8 +2178,12 @@ static int tx_macro_init(struct snd_soc_component *component) } tx_priv->component = component; - snd_soc_component_update_bits(component, - BOLERO_CDC_TX0_TX_PATH_SEC7, 0x3F, 0x0E); + for (i = 0; i < ARRAY_SIZE(tx_macro_reg_init); i++) + snd_soc_component_update_bits(component, + tx_macro_reg_init[i].reg, + tx_macro_reg_init[i].mask, + tx_macro_reg_init[i].val); + return 0; }