aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/omap/omap-dmic.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c
index 09db2aec12a3..b2f5d2fa354d 100644
--- a/sound/soc/omap/omap-dmic.c
+++ b/sound/soc/omap/omap-dmic.c
@@ -281,7 +281,7 @@ static int omap_dmic_dai_trigger(struct snd_pcm_substream *substream,
281static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id, 281static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id,
282 unsigned int freq) 282 unsigned int freq)
283{ 283{
284 struct clk *parent_clk; 284 struct clk *parent_clk, *mux;
285 char *parent_clk_name; 285 char *parent_clk_name;
286 int ret = 0; 286 int ret = 0;
287 287
@@ -329,14 +329,21 @@ static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id,
329 return -ENODEV; 329 return -ENODEV;
330 } 330 }
331 331
332 mux = clk_get_parent(dmic->fclk);
333 if (IS_ERR(mux)) {
334 dev_err(dmic->dev, "can't get fck mux parent\n");
335 clk_put(parent_clk);
336 return -ENODEV;
337 }
338
332 mutex_lock(&dmic->mutex); 339 mutex_lock(&dmic->mutex);
333 if (dmic->active) { 340 if (dmic->active) {
334 /* disable clock while reparenting */ 341 /* disable clock while reparenting */
335 pm_runtime_put_sync(dmic->dev); 342 pm_runtime_put_sync(dmic->dev);
336 ret = clk_set_parent(dmic->fclk, parent_clk); 343 ret = clk_set_parent(mux, parent_clk);
337 pm_runtime_get_sync(dmic->dev); 344 pm_runtime_get_sync(dmic->dev);
338 } else { 345 } else {
339 ret = clk_set_parent(dmic->fclk, parent_clk); 346 ret = clk_set_parent(mux, parent_clk);
340 } 347 }
341 mutex_unlock(&dmic->mutex); 348 mutex_unlock(&dmic->mutex);
342 349
@@ -349,6 +356,7 @@ static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id,
349 dmic->fclk_freq = freq; 356 dmic->fclk_freq = freq;
350 357
351err_busy: 358err_busy:
359 clk_put(mux);
352 clk_put(parent_clk); 360 clk_put(parent_clk);
353 361
354 return ret; 362 return ret;