mirror of
https://github.com/torvalds/linux.git
synced 2026-09-13 15:40:03 +02:00
ASoC: codecs: ES8389: Prevent enable_count underflow in clk_core_disable
To prevent enable_count underflow in clk_core_disable, I replaced the direct call to `es8389_set_bias_level(component, SND_SOC_BIAS_STANDBY);` in the code with a helper function. Signed-off-by: Zhang Yi <zhangyi@everest-semi.com> Link: https://patch.msgid.link/20260904104141.3885-1-zhangyi@everest-semi.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
cff381508c
commit
c1e01ea350
|
|
@ -812,6 +812,23 @@ static int es8389_pcm_hw_free(struct snd_pcm_substream *substream,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void es8389_standby(struct snd_soc_component *component)
|
||||
{
|
||||
struct es8389_private *es8389 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
regmap_update_bits(es8389->regmap, ES8389_ADC_HPF1, 0x0f, 0x04);
|
||||
regmap_update_bits(es8389->regmap, ES8389_ADC_HPF2, 0x0f, 0x04);
|
||||
regmap_write(es8389->regmap, ES8389_CSM_JUMP, 0xD4);
|
||||
usleep_range(70000, 72000);
|
||||
regmap_write(es8389->regmap, ES8389_ANA_CTL1, 0x59);
|
||||
regmap_write(es8389->regmap, ES8389_ADC_EN, 0x00);
|
||||
regmap_write(es8389->regmap, ES8389_CLK_OFF1, 0x00);
|
||||
regmap_write(es8389->regmap, ES8389_RESET, 0x3E);
|
||||
regmap_update_bits(es8389->regmap, ES8389_DAC_INV, 0x80, 0x80);
|
||||
usleep_range(8000, 8500);
|
||||
regmap_update_bits(es8389->regmap, ES8389_DAC_INV, 0x80, 0x00);
|
||||
}
|
||||
|
||||
static int es8389_set_bias_level(struct snd_soc_component *component,
|
||||
enum snd_soc_bias_level level)
|
||||
{
|
||||
|
|
@ -834,18 +851,7 @@ static int es8389_set_bias_level(struct snd_soc_component *component,
|
|||
case SND_SOC_BIAS_PREPARE:
|
||||
break;
|
||||
case SND_SOC_BIAS_STANDBY:
|
||||
regmap_update_bits(es8389->regmap, ES8389_ADC_HPF1, 0x0f, 0x04);
|
||||
regmap_update_bits(es8389->regmap, ES8389_ADC_HPF2, 0x0f, 0x04);
|
||||
regmap_write(es8389->regmap, ES8389_CSM_JUMP, 0xD4);
|
||||
usleep_range(70000, 72000);
|
||||
regmap_write(es8389->regmap, ES8389_ANA_CTL1, 0x59);
|
||||
regmap_write(es8389->regmap, ES8389_ADC_EN, 0x00);
|
||||
regmap_write(es8389->regmap, ES8389_CLK_OFF1, 0x00);
|
||||
regmap_write(es8389->regmap, ES8389_RESET, 0x3E);
|
||||
regmap_update_bits(es8389->regmap, ES8389_DAC_INV, 0x80, 0x80);
|
||||
usleep_range(8000, 8500);
|
||||
regmap_update_bits(es8389->regmap, ES8389_DAC_INV, 0x80, 0x00);
|
||||
|
||||
es8389_standby(component);
|
||||
clk_disable_unprepare(es8389->mclk);
|
||||
break;
|
||||
case SND_SOC_BIAS_OFF:
|
||||
|
|
@ -1015,7 +1021,7 @@ static int es8389_suspend(struct snd_soc_component *component)
|
|||
{
|
||||
struct es8389_private *es8389 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
es8389_set_bias_level(component, SND_SOC_BIAS_STANDBY);
|
||||
es8389_standby(component);
|
||||
regcache_cache_only(es8389->regmap, true);
|
||||
regcache_mark_dirty(es8389->regmap);
|
||||
|
||||
|
|
@ -1084,7 +1090,7 @@ static int es8389_probe(struct snd_soc_component *component)
|
|||
|
||||
es8389->hpf_freq = ES8389_HPF_DEFAULT;
|
||||
es8389_init(component);
|
||||
es8389_set_bias_level(component, SND_SOC_BIAS_STANDBY);
|
||||
es8389_standby(component);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user