summaryrefslogtreecommitdiffstats
path: root/sound/soc/sh/rcar/adg.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-09-10 13:03:08 +0200
committerTakashi Iwai <tiwai@suse.de>2019-09-10 13:03:08 +0200
commit7711fb7dac1ab77fd1b4d948f4647a569e4a1ae2 (patch)
treedd35ad21e0eb13572757dab279ae41f6d953baed /sound/soc/sh/rcar/adg.c
parent789492f0c86505e63369907bcb1afdf52dec9366 (diff)
parentbb831786117519fc16dfd3eaa7b84e4f6bbb8d99 (diff)
downloadlinux-stable-7711fb7dac1ab77fd1b4d948f4647a569e4a1ae2.tar.gz
linux-stable-7711fb7dac1ab77fd1b4d948f4647a569e4a1ae2.tar.bz2
linux-stable-7711fb7dac1ab77fd1b4d948f4647a569e4a1ae2.zip
Merge tag 'asoc-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next
ASoC: Updates for v5.4 Quite a big update this time around, particularly in the core where we've had a lot of cleanups from Morimoto-san - there's not much functional change but quite a bit of modernization going on. We've also seen a lot of driver work, a lot of it cleanups but also some particular drivers. - Lots and lots of cleanups from Morimoto-san and Yue Haibing. - Lots of cleanups and enhancements to the Freescale, sunxi dnd Intel rivers. - Initial Sound Open Firmware suppot for i.MX8. - Removal of w90x900 and nuc900 drivers as the platforms are being removed. - New support for Cirrus Logic CS47L15 and CS47L92, Freescale i.MX 7ULP and 8MQ, Meson G12A and NXP UDA1334
Diffstat (limited to 'sound/soc/sh/rcar/adg.c')
-rw-r--r--sound/soc/sh/rcar/adg.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/sound/soc/sh/rcar/adg.c b/sound/soc/sh/rcar/adg.c
index fce4e050a9b7..b9aacf3d3b29 100644
--- a/sound/soc/sh/rcar/adg.c
+++ b/sound/soc/sh/rcar/adg.c
@@ -30,6 +30,7 @@ struct rsnd_adg {
struct clk *clkout[CLKOUTMAX];
struct clk_onecell_data onecell;
struct rsnd_mod mod;
+ int clk_rate[CLKMAX];
u32 flags;
u32 ckr;
u32 rbga;
@@ -114,9 +115,9 @@ static void __rsnd_adg_get_timesel_ratio(struct rsnd_priv *priv,
unsigned int val, en;
unsigned int min, diff;
unsigned int sel_rate[] = {
- clk_get_rate(adg->clk[CLKA]), /* 0000: CLKA */
- clk_get_rate(adg->clk[CLKB]), /* 0001: CLKB */
- clk_get_rate(adg->clk[CLKC]), /* 0010: CLKC */
+ adg->clk_rate[CLKA], /* 0000: CLKA */
+ adg->clk_rate[CLKB], /* 0001: CLKB */
+ adg->clk_rate[CLKC], /* 0010: CLKC */
adg->rbga_rate_for_441khz, /* 0011: RBGA */
adg->rbgb_rate_for_48khz, /* 0100: RBGB */
};
@@ -302,7 +303,7 @@ int rsnd_adg_clk_query(struct rsnd_priv *priv, unsigned int rate)
* AUDIO_CLKA/AUDIO_CLKB/AUDIO_CLKC/AUDIO_CLKI.
*/
for_each_rsnd_clk(clk, adg, i) {
- if (rate == clk_get_rate(clk))
+ if (rate == adg->clk_rate[i])
return sel_table[i];
}
@@ -369,10 +370,18 @@ void rsnd_adg_clk_control(struct rsnd_priv *priv, int enable)
for_each_rsnd_clk(clk, adg, i) {
ret = 0;
- if (enable)
+ if (enable) {
ret = clk_prepare_enable(clk);
- else
+
+ /*
+ * We shouldn't use clk_get_rate() under
+ * atomic context. Let's keep it when
+ * rsnd_adg_clk_enable() was called
+ */
+ adg->clk_rate[i] = clk_get_rate(adg->clk[i]);
+ } else {
clk_disable_unprepare(clk);
+ }
if (ret < 0)
dev_warn(dev, "can't use clk %d\n", i);