Commit 9b7612bb authored by Samuel Holland's avatar Samuel Holland Committed by Mark Brown

ASoC: sun50i-codec-analog: Gate the amplifier clock during suspend

The clock must be running for the zero-crossing mute functionality.
However, it must be gated for VDD-SYS to be turned off during system
suspend. Disable it in the suspend callback, after everything has
already been muted, to avoid pops when muting/unmuting outputs.
Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
Acked-by: default avatarChen-Yu Tsai <wens@csie.org>
Link: https://lore.kernel.org/r/20200726025334.59931-3-samuel@sholland.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent ad5b7f69
......@@ -438,6 +438,19 @@ static const struct snd_soc_dapm_route sun50i_a64_codec_routes[] = {
{ "EARPIECE", NULL, "Earpiece Amp" },
};
static int sun50i_a64_codec_suspend(struct snd_soc_component *component)
{
return regmap_update_bits(component->regmap, SUN50I_ADDA_HP_CTRL,
BIT(SUN50I_ADDA_HP_CTRL_PA_CLK_GATE),
BIT(SUN50I_ADDA_HP_CTRL_PA_CLK_GATE));
}
static int sun50i_a64_codec_resume(struct snd_soc_component *component)
{
return regmap_update_bits(component->regmap, SUN50I_ADDA_HP_CTRL,
BIT(SUN50I_ADDA_HP_CTRL_PA_CLK_GATE), 0);
}
static const struct snd_soc_component_driver sun50i_codec_analog_cmpnt_drv = {
.controls = sun50i_a64_codec_controls,
.num_controls = ARRAY_SIZE(sun50i_a64_codec_controls),
......@@ -445,6 +458,8 @@ static const struct snd_soc_component_driver sun50i_codec_analog_cmpnt_drv = {
.num_dapm_widgets = ARRAY_SIZE(sun50i_a64_codec_widgets),
.dapm_routes = sun50i_a64_codec_routes,
.num_dapm_routes = ARRAY_SIZE(sun50i_a64_codec_routes),
.suspend = sun50i_a64_codec_suspend,
.resume = sun50i_a64_codec_resume,
};
static const struct of_device_id sun50i_codec_analog_of_match[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment