From 73fcf1ce438f0952253ceee84e8a99510332a064 Mon Sep 17 00:00:00 2001 From: Jerome Brunet Date: Thu, 23 Mar 2017 12:00:17 +0100 Subject: [PATCH 56/79] ASoC: meson: protect dai output clock rates Signed-off-by: Jerome Brunet Signed-off-by: Neil Armstrong --- sound/soc/meson/i2s-dai.c | 4 ++++ sound/soc/meson/spdif-dai.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/sound/soc/meson/i2s-dai.c b/sound/soc/meson/i2s-dai.c index 1008af8..d698aa0 100644 --- a/sound/soc/meson/i2s-dai.c +++ b/sound/soc/meson/i2s-dai.c @@ -351,6 +351,9 @@ static int meson_i2s_dai_startup(struct snd_pcm_substream *substream, AIU_I2S_SOURCE_DESC_MODE_SPLIT, AIU_I2S_SOURCE_DESC_MODE_SPLIT); + /* We can't tolerate glitches or rate change on this clock */ + clk_rate_protect(priv->mclk); + return 0; out_bclks: @@ -368,6 +371,7 @@ static void meson_i2s_dai_shutdown(struct snd_pcm_substream *substream, { struct meson_i2s_dai *priv = snd_soc_dai_get_drvdata(dai); + clk_rate_unprotect(priv->mclk); clk_disable_unprepare(priv->bclks); clk_disable_unprepare(priv->mclk); clk_disable_unprepare(priv->iface); diff --git a/sound/soc/meson/spdif-dai.c b/sound/soc/meson/spdif-dai.c index e763000..1d27f19 100644 --- a/sound/soc/meson/spdif-dai.c +++ b/sound/soc/meson/spdif-dai.c @@ -253,6 +253,9 @@ static int meson_spdif_dai_startup(struct snd_pcm_substream *substream, AIU_MEM_IEC958_CONTROL_MODE_LINEAR, AIU_MEM_IEC958_CONTROL_MODE_LINEAR); + /* We can't tolerate glitches or rate change on this clock */ + clk_rate_protect(priv->mclk); + return 0; out_mclk: @@ -268,6 +271,7 @@ static void meson_spdif_dai_shutdown(struct snd_pcm_substream *substream, { struct meson_spdif_dai *priv = snd_soc_dai_get_drvdata(dai); + clk_rate_unprotect(priv->mclk); clk_disable_unprepare(priv->iface); clk_disable_unprepare(priv->mclk); clk_disable_unprepare(priv->fast); -- 1.9.1