asoc: lpass-cdc: Handle pbr clk based with its ref cnt.
Disable the common pbr clk register only when no one uses RX0 and RX1 channels. Change-Id: Ia5fab1d3e4be7d9ecb01ad0b612b9f6ef7406bea Signed-off-by: Ganapathiraju Sarath Varma <quic_ganavarm@quicinc.com>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
3211af5e43
commit
8280a19ab8
@@ -317,6 +317,7 @@ struct lpass_cdc_wsa_macro_priv {
|
||||
u8 idle_detect_en;
|
||||
int noise_gate_mode;
|
||||
bool pre_dev_up;
|
||||
int pbr_clk_users;
|
||||
};
|
||||
|
||||
static struct snd_soc_dai_driver lpass_cdc_wsa_macro_dai[];
|
||||
@@ -1580,15 +1581,18 @@ static int lpass_cdc_was_macro_config_pbr(struct snd_soc_component *component,
|
||||
reg3, 0x80, 0x80);
|
||||
lpass_cdc_wsa_macro_enable_softclip_clk(component, wsa_priv,
|
||||
softclip_path, true);
|
||||
snd_soc_component_update_bits(component,
|
||||
LPASS_CDC_WSA_PBR_PATH_CTL,
|
||||
0x01, 0x01);
|
||||
if (wsa_priv->pbr_clk_users == 0)
|
||||
snd_soc_component_update_bits(component,
|
||||
LPASS_CDC_WSA_PBR_PATH_CTL,
|
||||
0x01, 0x01);
|
||||
++wsa_priv->pbr_clk_users;
|
||||
}
|
||||
|
||||
if (SND_SOC_DAPM_EVENT_OFF(event)) {
|
||||
snd_soc_component_update_bits(component,
|
||||
LPASS_CDC_WSA_PBR_PATH_CTL,
|
||||
0x01, 0x00);
|
||||
if (wsa_priv->pbr_clk_users == 1)
|
||||
snd_soc_component_update_bits(component,
|
||||
LPASS_CDC_WSA_PBR_PATH_CTL,
|
||||
0x01, 0x00);
|
||||
lpass_cdc_wsa_macro_enable_softclip_clk(component, wsa_priv,
|
||||
softclip_path, false);
|
||||
snd_soc_component_update_bits(component,
|
||||
@@ -1597,6 +1601,9 @@ static int lpass_cdc_was_macro_config_pbr(struct snd_soc_component *component,
|
||||
reg2, 0x40, 0x00);
|
||||
snd_soc_component_update_bits(component,
|
||||
reg3, 0x80, 0x00);
|
||||
--wsa_priv->pbr_clk_users;
|
||||
if (wsa_priv->pbr_clk_users < 0)
|
||||
wsa_priv->pbr_clk_users = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user