Commit 573eda59 authored by Tero Kristo's avatar Tero Kristo Committed by Mark Brown

ASoC: dmic: Fix clock parenting

In 4.16 the clock hierarchy got changed by
a5c82a09 ARM: dts: omap4: add clkctrl nodes

The fck of dmic is no longer a mux clock, it's parent is.
Signed-off-by: default avatarTero Kristo <t-kristo@ti.com>
Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org # 4.16+
parent 445bb423
...@@ -281,7 +281,7 @@ static int omap_dmic_dai_trigger(struct snd_pcm_substream *substream, ...@@ -281,7 +281,7 @@ static int omap_dmic_dai_trigger(struct snd_pcm_substream *substream,
static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id, static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id,
unsigned int freq) unsigned int freq)
{ {
struct clk *parent_clk; struct clk *parent_clk, *mux;
char *parent_clk_name; char *parent_clk_name;
int ret = 0; int ret = 0;
...@@ -329,14 +329,21 @@ static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id, ...@@ -329,14 +329,21 @@ static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id,
return -ENODEV; return -ENODEV;
} }
mux = clk_get_parent(dmic->fclk);
if (IS_ERR(mux)) {
dev_err(dmic->dev, "can't get fck mux parent\n");
clk_put(parent_clk);
return -ENODEV;
}
mutex_lock(&dmic->mutex); mutex_lock(&dmic->mutex);
if (dmic->active) { if (dmic->active) {
/* disable clock while reparenting */ /* disable clock while reparenting */
pm_runtime_put_sync(dmic->dev); pm_runtime_put_sync(dmic->dev);
ret = clk_set_parent(dmic->fclk, parent_clk); ret = clk_set_parent(mux, parent_clk);
pm_runtime_get_sync(dmic->dev); pm_runtime_get_sync(dmic->dev);
} else { } else {
ret = clk_set_parent(dmic->fclk, parent_clk); ret = clk_set_parent(mux, parent_clk);
} }
mutex_unlock(&dmic->mutex); mutex_unlock(&dmic->mutex);
...@@ -349,6 +356,7 @@ static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id, ...@@ -349,6 +356,7 @@ static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id,
dmic->fclk_freq = freq; dmic->fclk_freq = freq;
err_busy: err_busy:
clk_put(mux);
clk_put(parent_clk); clk_put(parent_clk);
return ret; return ret;
......
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