From: Samuel Holland <samuel@sholland.org>
To: Mark Brown <broonie@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Maxime Ripard <mripard@kernel.org>, Chen-Yu Tsai <wens@csie.org>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>
Cc: Ondrej Jirman <megous@megous.com>,
alsa-devel@alsa-project.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Samuel Holland <samuel@sholland.org>
Subject: [PATCH 9/9] ASoC: sun8i-codec: Manage module clock via DAPM
Date: Sun, 30 Aug 2020 22:48:52 -0500 [thread overview]
Message-ID: <20200831034852.18841-10-samuel@sholland.org> (raw)
In-Reply-To: <20200831034852.18841-1-samuel@sholland.org>
By representing the module clock as a DAPM widget, we ensure that the
clock is only enabled when the module is actually in use, without
additional code in runtime PM hooks.
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
sound/soc/sunxi/sun8i-codec.c | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c
index 8a7f98910347..178f6fb31fd4 100644
--- a/sound/soc/sunxi/sun8i-codec.c
+++ b/sound/soc/sunxi/sun8i-codec.c
@@ -102,26 +102,15 @@ static int sun8i_codec_runtime_resume(struct device *dev)
struct sun8i_codec *scodec = dev_get_drvdata(dev);
int ret;
- ret = clk_prepare_enable(scodec->clk_module);
- if (ret) {
- dev_err(dev, "Failed to enable the module clock\n");
- return ret;
- }
-
regcache_cache_only(scodec->regmap, false);
ret = regcache_sync(scodec->regmap);
if (ret) {
dev_err(dev, "Failed to sync regmap cache\n");
- goto err_disable_clk;
+ return ret;
}
return 0;
-
-err_disable_clk:
- clk_disable_unprepare(scodec->clk_module);
-
- return ret;
}
static int sun8i_codec_runtime_suspend(struct device *dev)
@@ -131,8 +120,6 @@ static int sun8i_codec_runtime_suspend(struct device *dev)
regcache_cache_only(scodec->regmap, true);
regcache_mark_dirty(scodec->regmap);
- clk_disable_unprepare(scodec->clk_module);
-
return 0;
}
@@ -379,6 +366,8 @@ static const struct snd_kcontrol_new sun8i_input_mixer_controls[] = {
};
static const struct snd_soc_dapm_widget sun8i_codec_dapm_widgets[] = {
+ SND_SOC_DAPM_CLOCK_SUPPLY("mod"),
+
/* Digital parts of the DACs and ADC */
SND_SOC_DAPM_SUPPLY("DAC", SUN8I_DAC_DIG_CTRL, SUN8I_DAC_DIG_CTRL_ENDA,
0, NULL, 0),
@@ -448,6 +437,8 @@ static const struct snd_soc_dapm_widget sun8i_codec_dapm_widgets[] = {
static const struct snd_soc_dapm_route sun8i_codec_dapm_routes[] = {
/* Clock Routes */
+ { "AIF1", NULL, "mod" },
+
{ "AIF1", NULL, "SYSCLK AIF1" },
{ "AIF1 PLL", NULL, "AIF1" },
{ "SYSCLK", NULL, "AIF1 PLL" },
--
2.26.2
next prev parent reply other threads:[~2020-08-31 3:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-31 3:48 [PATCH 0/9] ASoC: sun8i-codec driver cleanup Samuel Holland
2020-08-31 3:48 ` [PATCH 1/9] ASoC: sun8i-codec: Remove extraneous widgets Samuel Holland
2020-08-31 3:48 ` [PATCH 2/9] ASoC: sun8i-codec: Fix AIF1 MODCLK widget name Samuel Holland
2020-08-31 3:48 ` [PATCH 3/9] ASoC: sun8i-codec: Fix AIF1_ADCDAT_CTRL field names Samuel Holland
2020-08-31 3:48 ` [PATCH 4/9] ASoC: sun8i-codec: Fix AIF1_MXR_SRC " Samuel Holland
2020-08-31 3:48 ` [PATCH 5/9] ASoC: sun8i-codec: Fix ADC_DIG_CTRL field name Samuel Holland
2020-08-31 3:48 ` [PATCH 6/9] ASoC: sun8i-codec: Fix field bit number indentation Samuel Holland
2020-08-31 3:48 ` [PATCH 7/9] ASoC: sun8i-codec: Sort masks in a consistent order Samuel Holland
2020-08-31 3:48 ` [PATCH 8/9] ASoC: sun8i-codec: Attach the bus clock to the regmap Samuel Holland
2020-09-04 9:17 ` Maxime Ripard
2020-08-31 3:48 ` Samuel Holland [this message]
2020-09-04 9:17 ` [PATCH 9/9] ASoC: sun8i-codec: Manage module clock via DAPM Maxime Ripard
2020-09-07 18:05 ` [PATCH 0/9] ASoC: sun8i-codec driver cleanup Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200831034852.18841-10-samuel@sholland.org \
--to=samuel@sholland.org \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=megous@megous.com \
--cc=mripard@kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=wens@csie.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).