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;
|
u8 idle_detect_en;
|
||||||
int noise_gate_mode;
|
int noise_gate_mode;
|
||||||
bool pre_dev_up;
|
bool pre_dev_up;
|
||||||
|
int pbr_clk_users;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct snd_soc_dai_driver lpass_cdc_wsa_macro_dai[];
|
static struct snd_soc_dai_driver lpass_cdc_wsa_macro_dai[];
|
||||||
@@ -1580,12 +1581,15 @@ static int lpass_cdc_was_macro_config_pbr(struct snd_soc_component *component,
|
|||||||
reg3, 0x80, 0x80);
|
reg3, 0x80, 0x80);
|
||||||
lpass_cdc_wsa_macro_enable_softclip_clk(component, wsa_priv,
|
lpass_cdc_wsa_macro_enable_softclip_clk(component, wsa_priv,
|
||||||
softclip_path, true);
|
softclip_path, true);
|
||||||
|
if (wsa_priv->pbr_clk_users == 0)
|
||||||
snd_soc_component_update_bits(component,
|
snd_soc_component_update_bits(component,
|
||||||
LPASS_CDC_WSA_PBR_PATH_CTL,
|
LPASS_CDC_WSA_PBR_PATH_CTL,
|
||||||
0x01, 0x01);
|
0x01, 0x01);
|
||||||
|
++wsa_priv->pbr_clk_users;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SND_SOC_DAPM_EVENT_OFF(event)) {
|
if (SND_SOC_DAPM_EVENT_OFF(event)) {
|
||||||
|
if (wsa_priv->pbr_clk_users == 1)
|
||||||
snd_soc_component_update_bits(component,
|
snd_soc_component_update_bits(component,
|
||||||
LPASS_CDC_WSA_PBR_PATH_CTL,
|
LPASS_CDC_WSA_PBR_PATH_CTL,
|
||||||
0x01, 0x00);
|
0x01, 0x00);
|
||||||
@@ -1597,6 +1601,9 @@ static int lpass_cdc_was_macro_config_pbr(struct snd_soc_component *component,
|
|||||||
reg2, 0x40, 0x00);
|
reg2, 0x40, 0x00);
|
||||||
snd_soc_component_update_bits(component,
|
snd_soc_component_update_bits(component,
|
||||||
reg3, 0x80, 0x00);
|
reg3, 0x80, 0x00);
|
||||||
|
--wsa_priv->pbr_clk_users;
|
||||||
|
if (wsa_priv->pbr_clk_users < 0)
|
||||||
|
wsa_priv->pbr_clk_users = 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -317,6 +317,7 @@ struct lpass_cdc_wsa2_macro_priv {
|
|||||||
u8 idle_detect_en;
|
u8 idle_detect_en;
|
||||||
int noise_gate_mode;
|
int noise_gate_mode;
|
||||||
bool pre_dev_up;
|
bool pre_dev_up;
|
||||||
|
int pbr_clk_users;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct snd_soc_dai_driver lpass_cdc_wsa2_macro_dai[];
|
static struct snd_soc_dai_driver lpass_cdc_wsa2_macro_dai[];
|
||||||
@@ -1585,12 +1586,15 @@ static int lpass_cdc_was_macro_config_pbr(struct snd_soc_component *component,
|
|||||||
reg3, 0x80, 0x80);
|
reg3, 0x80, 0x80);
|
||||||
lpass_cdc_wsa2_macro_enable_softclip_clk(component, wsa2_priv,
|
lpass_cdc_wsa2_macro_enable_softclip_clk(component, wsa2_priv,
|
||||||
softclip_path, true);
|
softclip_path, true);
|
||||||
|
if (wsa2_priv->pbr_clk_users == 0)
|
||||||
snd_soc_component_update_bits(component,
|
snd_soc_component_update_bits(component,
|
||||||
LPASS_CDC_WSA2_PBR_PATH_CTL,
|
LPASS_CDC_WSA2_PBR_PATH_CTL,
|
||||||
0x01, 0x01);
|
0x01, 0x01);
|
||||||
|
++wsa2_priv->pbr_clk_users;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SND_SOC_DAPM_EVENT_OFF(event)) {
|
if (SND_SOC_DAPM_EVENT_OFF(event)) {
|
||||||
|
if (wsa2_priv->pbr_clk_users)
|
||||||
snd_soc_component_update_bits(component,
|
snd_soc_component_update_bits(component,
|
||||||
LPASS_CDC_WSA2_PBR_PATH_CTL,
|
LPASS_CDC_WSA2_PBR_PATH_CTL,
|
||||||
0x01, 0x00);
|
0x01, 0x00);
|
||||||
@@ -1602,6 +1606,9 @@ static int lpass_cdc_was_macro_config_pbr(struct snd_soc_component *component,
|
|||||||
reg2, 0x40, 0x00);
|
reg2, 0x40, 0x00);
|
||||||
snd_soc_component_update_bits(component,
|
snd_soc_component_update_bits(component,
|
||||||
reg3, 0x80, 0x00);
|
reg3, 0x80, 0x00);
|
||||||
|
--wsa2_priv->pbr_clk_users;
|
||||||
|
if (wsa2_priv->pbr_clk_users < 0)
|
||||||
|
wsa2_priv->pbr_clk_users = 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user