73 lines
2.6 KiB
Diff
73 lines
2.6 KiB
Diff
From 518a8446429c8d311a90133da8a90e8b71f8824e Mon Sep 17 00:00:00 2001
|
|
From: Samuel Holland <samuel@sholland.org>
|
|
Date: Sat, 26 Sep 2020 21:39:27 -0500
|
|
Subject: [PATCH 319/351] ASoC: sun50i-codec-analog: Move suspend/resume to
|
|
set_bias_level
|
|
|
|
With idle_bias_on and suspend_bias_off, there are bias level transitions
|
|
that match the suspend/resume callbacks. However, there are also
|
|
transitions during probe (OFF => STANDBY) and removal (STANDBY => OFF).
|
|
|
|
By using the set_bias_level hook, the driver can have one copy of code
|
|
that would otherwise be duplicated between the probe/resume and
|
|
suspend/remove hooks.
|
|
|
|
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
---
|
|
sound/soc/sunxi/sun50i-codec-analog.c | 30 +++++++++++++++++----------
|
|
1 file changed, 19 insertions(+), 11 deletions(-)
|
|
|
|
diff --git a/sound/soc/sunxi/sun50i-codec-analog.c b/sound/soc/sunxi/sun50i-codec-analog.c
|
|
index 400283b67c82..1c892ab99a8c 100644
|
|
--- a/sound/soc/sunxi/sun50i-codec-analog.c
|
|
+++ b/sound/soc/sunxi/sun50i-codec-analog.c
|
|
@@ -488,17 +488,24 @@ static int sun50i_a64_codec_probe(struct snd_soc_component *component)
|
|
return 0;
|
|
}
|
|
|
|
-static int sun50i_a64_codec_suspend(struct snd_soc_component *component)
|
|
+static int sun50i_a64_codec_set_bias_level(struct snd_soc_component *component,
|
|
+ enum snd_soc_bias_level level)
|
|
{
|
|
- 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));
|
|
-}
|
|
+ switch (level) {
|
|
+ case SND_SOC_BIAS_OFF:
|
|
+ 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));
|
|
+ break;
|
|
+ case SND_SOC_BIAS_STANDBY:
|
|
+ regmap_update_bits(component->regmap, SUN50I_ADDA_HP_CTRL,
|
|
+ BIT(SUN50I_ADDA_HP_CTRL_PA_CLK_GATE), 0);
|
|
+ break;
|
|
+ default:
|
|
+ break;
|
|
+ }
|
|
|
|
-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);
|
|
+ return 0;
|
|
}
|
|
|
|
static const struct snd_soc_component_driver sun50i_codec_analog_cmpnt_drv = {
|
|
@@ -509,8 +516,9 @@ static const struct snd_soc_component_driver sun50i_codec_analog_cmpnt_drv = {
|
|
.dapm_routes = sun50i_a64_codec_routes,
|
|
.num_dapm_routes = ARRAY_SIZE(sun50i_a64_codec_routes),
|
|
.probe = sun50i_a64_codec_probe,
|
|
- .suspend = sun50i_a64_codec_suspend,
|
|
- .resume = sun50i_a64_codec_resume,
|
|
+ .set_bias_level = sun50i_a64_codec_set_bias_level,
|
|
+ .idle_bias_on = true,
|
|
+ .suspend_bias_off = true,
|
|
};
|
|
|
|
static const struct of_device_id sun50i_codec_analog_of_match[] = {
|
|
--
|
|
2.34.0
|
|
|