aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/img/img-spdif-out.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/sound/soc/img/img-spdif-out.c b/sound/soc/img/img-spdif-out.c
index 1808a5542fd1..934ed3df2ebf 100644
--- a/sound/soc/img/img-spdif-out.c
+++ b/sound/soc/img/img-spdif-out.c
@@ -57,6 +57,7 @@ static int img_spdif_out_runtime_suspend(struct device *dev)
57 struct img_spdif_out *spdif = dev_get_drvdata(dev); 57 struct img_spdif_out *spdif = dev_get_drvdata(dev);
58 58
59 clk_disable_unprepare(spdif->clk_ref); 59 clk_disable_unprepare(spdif->clk_ref);
60 clk_disable_unprepare(spdif->clk_sys);
60 61
61 return 0; 62 return 0;
62} 63}
@@ -66,9 +67,16 @@ static int img_spdif_out_runtime_resume(struct device *dev)
66 struct img_spdif_out *spdif = dev_get_drvdata(dev); 67 struct img_spdif_out *spdif = dev_get_drvdata(dev);
67 int ret; 68 int ret;
68 69
70 ret = clk_prepare_enable(spdif->clk_sys);
71 if (ret) {
72 dev_err(dev, "clk_enable failed: %d\n", ret);
73 return ret;
74 }
75
69 ret = clk_prepare_enable(spdif->clk_ref); 76 ret = clk_prepare_enable(spdif->clk_ref);
70 if (ret) { 77 if (ret) {
71 dev_err(dev, "clk_enable failed: %d\n", ret); 78 dev_err(dev, "clk_enable failed: %d\n", ret);
79 clk_disable_unprepare(spdif->clk_sys);
72 return ret; 80 return ret;
73 } 81 }
74 82
@@ -358,21 +366,21 @@ static int img_spdif_out_probe(struct platform_device *pdev)
358 return PTR_ERR(spdif->clk_ref); 366 return PTR_ERR(spdif->clk_ref);
359 } 367 }
360 368
361 ret = clk_prepare_enable(spdif->clk_sys);
362 if (ret)
363 return ret;
364
365 img_spdif_out_writel(spdif, IMG_SPDIF_OUT_CTL_FS_MASK,
366 IMG_SPDIF_OUT_CTL);
367
368 img_spdif_out_reset(spdif);
369
370 pm_runtime_enable(&pdev->dev); 369 pm_runtime_enable(&pdev->dev);
371 if (!pm_runtime_enabled(&pdev->dev)) { 370 if (!pm_runtime_enabled(&pdev->dev)) {
372 ret = img_spdif_out_runtime_resume(&pdev->dev); 371 ret = img_spdif_out_runtime_resume(&pdev->dev);
373 if (ret) 372 if (ret)
374 goto err_pm_disable; 373 goto err_pm_disable;
375 } 374 }
375 ret = pm_runtime_get_sync(&pdev->dev);
376 if (ret < 0)
377 goto err_suspend;
378
379 img_spdif_out_writel(spdif, IMG_SPDIF_OUT_CTL_FS_MASK,
380 IMG_SPDIF_OUT_CTL);
381
382 img_spdif_out_reset(spdif);
383 pm_runtime_put(&pdev->dev);
376 384
377 spin_lock_init(&spdif->lock); 385 spin_lock_init(&spdif->lock);
378 386
@@ -399,21 +407,16 @@ err_suspend:
399 img_spdif_out_runtime_suspend(&pdev->dev); 407 img_spdif_out_runtime_suspend(&pdev->dev);
400err_pm_disable: 408err_pm_disable:
401 pm_runtime_disable(&pdev->dev); 409 pm_runtime_disable(&pdev->dev);
402 clk_disable_unprepare(spdif->clk_sys);
403 410
404 return ret; 411 return ret;
405} 412}
406 413
407static int img_spdif_out_dev_remove(struct platform_device *pdev) 414static int img_spdif_out_dev_remove(struct platform_device *pdev)
408{ 415{
409 struct img_spdif_out *spdif = platform_get_drvdata(pdev);
410
411 pm_runtime_disable(&pdev->dev); 416 pm_runtime_disable(&pdev->dev);
412 if (!pm_runtime_status_suspended(&pdev->dev)) 417 if (!pm_runtime_status_suspended(&pdev->dev))
413 img_spdif_out_runtime_suspend(&pdev->dev); 418 img_spdif_out_runtime_suspend(&pdev->dev);
414 419
415 clk_disable_unprepare(spdif->clk_sys);
416
417 return 0; 420 return 0;
418} 421}
419 422