diff --git a/sound/soc/tegra-alt/tegra210_admaif_alt.c b/sound/soc/tegra-alt/tegra210_admaif_alt.c index 87fbbfe5..56508630 100644 --- a/sound/soc/tegra-alt/tegra210_admaif_alt.c +++ b/sound/soc/tegra-alt/tegra210_admaif_alt.c @@ -180,8 +180,8 @@ static int tegra210_admaif_runtime_suspend(struct device *dev) struct tegra210_admaif *admaif = dev_get_drvdata(dev); regcache_cache_only(admaif->regmap, true); - clk_disable(admaif->clk); + pm_runtime_put_sync(dev->parent); return 0; } @@ -191,6 +191,12 @@ static int tegra210_admaif_runtime_resume(struct device *dev) struct tegra210_admaif *admaif = dev_get_drvdata(dev); int ret; + ret = pm_runtime_get_sync(dev->parent); + if (ret < 0) { + dev_err(dev, "parent get_sync failed: %d\n", ret); + return ret; + } + ret = clk_enable(admaif->clk); if (ret) { dev_err(dev, "clk_enable failed: %d\n", ret); diff --git a/sound/soc/tegra-alt/tegra210_adx_alt.c b/sound/soc/tegra-alt/tegra210_adx_alt.c index 15b00ee6..c0746342 100644 --- a/sound/soc/tegra-alt/tegra210_adx_alt.c +++ b/sound/soc/tegra-alt/tegra210_adx_alt.c @@ -235,7 +235,7 @@ static int tegra210_adx_runtime_suspend(struct device *dev) regcache_cache_only(adx->regmap, true); - clk_disable_unprepare(adx->clk_adx); + pm_runtime_put_sync(dev->parent); return 0; } @@ -245,9 +245,9 @@ static int tegra210_adx_runtime_resume(struct device *dev) struct tegra210_adx *adx = dev_get_drvdata(dev); int ret; - ret = clk_prepare_enable(adx->clk_adx); - if (ret) { - dev_err(dev, "clk_enable failed: %d\n", ret); + ret = pm_runtime_get_sync(dev->parent); + if (ret < 0) { + dev_err(dev, "parent get_sync failed: %d\n", ret); return ret; } @@ -631,13 +631,6 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev) adx->soc_data = soc_data; - adx->clk_adx = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(adx->clk_adx)) { - dev_err(&pdev->dev, "Can't retrieve adx clock\n"); - ret = PTR_ERR(adx->clk_adx); - goto err; - } - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem) { dev_err(&pdev->dev, "No memory resource\n"); @@ -650,14 +643,14 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev) if (!memregion) { dev_err(&pdev->dev, "Memory region already claimed\n"); ret = -EBUSY; - goto err_clk_put; + goto err; } regs = devm_ioremap(&pdev->dev, mem->start, resource_size(mem)); if (!regs) { dev_err(&pdev->dev, "ioremap failed\n"); ret = -ENOMEM; - goto err_clk_put; + goto err; } adx->regmap = devm_regmap_init_mmio(&pdev->dev, regs, @@ -665,7 +658,7 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev) if (IS_ERR(adx->regmap)) { dev_err(&pdev->dev, "regmap init failed\n"); ret = PTR_ERR(adx->regmap); - goto err_clk_put; + goto err; } regcache_cache_only(adx->regmap, true); @@ -675,7 +668,7 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Missing property nvidia,ahub-adx-id\n"); ret = -ENODEV; - goto err_clk_put; + goto err; } pm_runtime_enable(&pdev->dev); @@ -700,23 +693,18 @@ err_suspend: tegra210_adx_runtime_suspend(&pdev->dev); err_pm_disable: pm_runtime_disable(&pdev->dev); -err_clk_put: - devm_clk_put(&pdev->dev, adx->clk_adx); err: return ret; } static int tegra210_adx_platform_remove(struct platform_device *pdev) { - struct tegra210_adx *adx = dev_get_drvdata(&pdev->dev); snd_soc_unregister_codec(&pdev->dev); pm_runtime_disable(&pdev->dev); if (!pm_runtime_status_suspended(&pdev->dev)) tegra210_adx_runtime_suspend(&pdev->dev); - devm_clk_put(&pdev->dev, adx->clk_adx); - return 0; } diff --git a/sound/soc/tegra-alt/tegra210_afc_alt.c b/sound/soc/tegra-alt/tegra210_afc_alt.c index 1d8d3df0..a475bab4 100644 --- a/sound/soc/tegra-alt/tegra210_afc_alt.c +++ b/sound/soc/tegra-alt/tegra210_afc_alt.c @@ -43,7 +43,7 @@ static int tegra210_afc_runtime_suspend(struct device *dev) regcache_cache_only(afc->regmap, true); - clk_disable_unprepare(afc->clk_afc); + pm_runtime_put_sync(dev->parent); return 0; } @@ -53,9 +53,9 @@ static int tegra210_afc_runtime_resume(struct device *dev) struct tegra210_afc *afc = dev_get_drvdata(dev); int ret; - ret = clk_prepare_enable(afc->clk_afc); - if (ret) { - dev_err(dev, "clk_enable failed: %d\n", ret); + ret = pm_runtime_get_sync(dev->parent); + if (ret < 0) { + dev_err(dev, "parent get_sync failed: %d\n", ret); return ret; } @@ -367,18 +367,11 @@ static int tegra210_afc_platform_probe(struct platform_device *pdev) /* initialize default destination I2S */ afc->destination_i2s = 1; - afc->clk_afc = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(afc->clk_afc)) { - dev_err(&pdev->dev, "Can't retrieve afc clock\n"); - ret = PTR_ERR(afc->clk_afc); - goto err; - } - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem) { dev_err(&pdev->dev, "No memory resource\n"); ret = -ENODEV; - goto err_clk_put; + goto err; } memregion = devm_request_mem_region(&pdev->dev, mem->start, @@ -386,14 +379,14 @@ static int tegra210_afc_platform_probe(struct platform_device *pdev) if (!memregion) { dev_err(&pdev->dev, "Memory region already claimed\n"); ret = -EBUSY; - goto err_clk_put; + goto err; } regs = devm_ioremap(&pdev->dev, mem->start, resource_size(mem)); if (!regs) { dev_err(&pdev->dev, "ioremap failed\n"); ret = -ENOMEM; - goto err_clk_put; + goto err; } afc->regmap = devm_regmap_init_mmio(&pdev->dev, regs, @@ -401,7 +394,7 @@ static int tegra210_afc_platform_probe(struct platform_device *pdev) if (IS_ERR(afc->regmap)) { dev_err(&pdev->dev, "regmap init failed\n"); ret = PTR_ERR(afc->regmap); - goto err_clk_put; + goto err; } regcache_cache_only(afc->regmap, true); @@ -411,7 +404,7 @@ static int tegra210_afc_platform_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Missing property nvidia,ahub-afc-id\n"); ret = -ENODEV; - goto err_clk_put; + goto err; } pm_runtime_enable(&pdev->dev); @@ -440,23 +433,18 @@ err_suspend: tegra210_afc_runtime_suspend(&pdev->dev); err_pm_disable: pm_runtime_disable(&pdev->dev); -err_clk_put: - devm_clk_put(&pdev->dev, afc->clk_afc); err: return ret; } static int tegra210_afc_platform_remove(struct platform_device *pdev) { - struct tegra210_afc *afc = dev_get_drvdata(&pdev->dev); snd_soc_unregister_codec(&pdev->dev); pm_runtime_disable(&pdev->dev); if (!pm_runtime_status_suspended(&pdev->dev)) tegra210_afc_runtime_suspend(&pdev->dev); - devm_clk_put(&pdev->dev, afc->clk_afc); - return 0; } diff --git a/sound/soc/tegra-alt/tegra210_amx_alt.c b/sound/soc/tegra-alt/tegra210_amx_alt.c index d2f2502c..9cec5f35 100644 --- a/sound/soc/tegra-alt/tegra210_amx_alt.c +++ b/sound/soc/tegra-alt/tegra210_amx_alt.c @@ -230,7 +230,7 @@ static int tegra210_amx_runtime_suspend(struct device *dev) regcache_cache_only(amx->regmap, true); - clk_disable_unprepare(amx->clk_amx); + pm_runtime_put_sync(dev->parent); return 0; } @@ -271,9 +271,9 @@ static int tegra210_amx_runtime_resume(struct device *dev) struct tegra210_amx *amx = dev_get_drvdata(dev); int ret; - ret = clk_prepare_enable(amx->clk_amx); - if (ret) { - dev_err(dev, "clk_enable failed: %d\n", ret); + ret = pm_runtime_get_sync(dev->parent); + if (ret < 0) { + dev_err(dev, "parent get_sync failed: %d\n", ret); return ret; } @@ -664,18 +664,11 @@ static int tegra210_amx_platform_probe(struct platform_device *pdev) amx->soc_data = soc_data; - amx->clk_amx = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(amx->clk_amx)) { - dev_err(&pdev->dev, "Can't retrieve tegra210_amx clock\n"); - ret = PTR_ERR(amx->clk_amx); - goto err; - } - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem) { dev_err(&pdev->dev, "No memory resource\n"); ret = -ENODEV; - goto err_clk_put; + goto err; } memregion = devm_request_mem_region(&pdev->dev, mem->start, @@ -683,14 +676,14 @@ static int tegra210_amx_platform_probe(struct platform_device *pdev) if (!memregion) { dev_err(&pdev->dev, "Memory region already claimed\n"); ret = -EBUSY; - goto err_clk_put; + goto err; } regs = devm_ioremap(&pdev->dev, mem->start, resource_size(mem)); if (!regs) { dev_err(&pdev->dev, "ioremap failed\n"); ret = -ENOMEM; - goto err_clk_put; + goto err; } amx->regmap = devm_regmap_init_mmio(&pdev->dev, regs, @@ -698,7 +691,7 @@ static int tegra210_amx_platform_probe(struct platform_device *pdev) if (IS_ERR(amx->regmap)) { dev_err(&pdev->dev, "regmap init failed\n"); ret = PTR_ERR(amx->regmap); - goto err_clk_put; + goto err; } regcache_cache_only(amx->regmap, true); @@ -708,7 +701,7 @@ static int tegra210_amx_platform_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Missing property nvidia,ahub-amx-id\n"); ret = -ENODEV; - goto err_clk_put; + goto err; } pm_runtime_enable(&pdev->dev); @@ -733,24 +726,18 @@ err_suspend: tegra210_amx_runtime_suspend(&pdev->dev); err_pm_disable: pm_runtime_disable(&pdev->dev); -err_clk_put: - devm_clk_put(&pdev->dev, amx->clk_amx); err: return ret; } static int tegra210_amx_platform_remove(struct platform_device *pdev) { - struct tegra210_amx *amx = dev_get_drvdata(&pdev->dev); - snd_soc_unregister_codec(&pdev->dev); pm_runtime_disable(&pdev->dev); if (!pm_runtime_status_suspended(&pdev->dev)) tegra210_amx_runtime_suspend(&pdev->dev); - devm_clk_put(&pdev->dev, amx->clk_amx); - return 0; } diff --git a/sound/soc/tegra-alt/tegra210_dmic_alt.c b/sound/soc/tegra-alt/tegra210_dmic_alt.c index 0ca2381c..b91ef575 100644 --- a/sound/soc/tegra-alt/tegra210_dmic_alt.c +++ b/sound/soc/tegra-alt/tegra210_dmic_alt.c @@ -45,16 +45,23 @@ static int tegra210_dmic_runtime_suspend(struct device *dev) #ifndef CONFIG_MACH_GRENADA clk_disable_unprepare(dmic->clk_dmic); #endif + pm_runtime_put_sync(dev->parent); + return 0; } static int tegra210_dmic_runtime_resume(struct device *dev) { struct tegra210_dmic *dmic = dev_get_drvdata(dev); - -#ifndef CONFIG_MACH_GRENADA int ret; + ret = pm_runtime_get_sync(dev->parent); + if (ret < 0) { + dev_err(dev, "parent get_sync failed: %d\n", ret); + return ret; + } + +#ifndef CONFIG_MACH_GRENADA ret = clk_prepare_enable(dmic->clk_dmic); if (ret) { dev_err(dev, "clk_enable failed: %d\n", ret); diff --git a/sound/soc/tegra-alt/tegra210_i2s_alt.c b/sound/soc/tegra-alt/tegra210_i2s_alt.c index ed7cea5b..f1f67a43 100644 --- a/sound/soc/tegra-alt/tegra210_i2s_alt.c +++ b/sound/soc/tegra-alt/tegra210_i2s_alt.c @@ -224,6 +224,7 @@ static int tegra210_i2s_runtime_suspend(struct device *dev) regcache_cache_only(i2s->regmap, true); clk_disable_unprepare(i2s->clk_i2s); + pm_runtime_put_sync(dev->parent); return 0; } @@ -233,6 +234,12 @@ static int tegra210_i2s_runtime_resume(struct device *dev) struct tegra210_i2s *i2s = dev_get_drvdata(dev); int ret; + ret = pm_runtime_get_sync(dev->parent); + if (ret < 0) { + dev_err(dev, "parent get_sync failed: %d\n", ret); + return ret; + } + if (!IS_ERR(i2s->pin_default_state)) { ret = pinctrl_select_state(i2s->pinctrl, i2s->pin_default_state); diff --git a/sound/soc/tegra-alt/tegra210_iqc_alt.c b/sound/soc/tegra-alt/tegra210_iqc_alt.c index 70eb61f2..874befad 100644 --- a/sound/soc/tegra-alt/tegra210_iqc_alt.c +++ b/sound/soc/tegra-alt/tegra210_iqc_alt.c @@ -43,9 +43,10 @@ static int tegra210_iqc_runtime_suspend(struct device *dev) regcache_cache_only(iqc->regmap, true); - #ifndef CONFIG_MACH_GRENADA +#ifndef CONFIG_MACH_GRENADA clk_disable_unprepare(iqc->clk_iqc); - #endif +#endif + pm_runtime_put_sync(dev->parent); return 0; } @@ -53,16 +54,21 @@ static int tegra210_iqc_runtime_suspend(struct device *dev) static int tegra210_iqc_runtime_resume(struct device *dev) { struct tegra210_iqc *iqc = dev_get_drvdata(dev); - - #ifndef CONFIG_MACH_GRENADA int ret; + ret = pm_runtime_get_sync(dev->parent); + if (ret < 0) { + dev_err(dev, "parent get_sync failed: %d\n", ret); + return ret; + } + +#ifndef CONFIG_MACH_GRENADA ret = clk_prepare_enable(iqc->clk_iqc); if (ret) { dev_err(dev, "clk_enable failed: %d\n", ret); return ret; } - #endif +#endif regcache_cache_only(iqc->regmap, false); diff --git a/sound/soc/tegra-alt/tegra210_mixer_alt.c b/sound/soc/tegra-alt/tegra210_mixer_alt.c index acd29f13..76bd5ed3 100644 --- a/sound/soc/tegra-alt/tegra210_mixer_alt.c +++ b/sound/soc/tegra-alt/tegra210_mixer_alt.c @@ -46,7 +46,7 @@ static int tegra210_mixer_runtime_suspend(struct device *dev) regcache_cache_only(mixer->regmap, true); - clk_disable_unprepare(mixer->clk_mixer); + pm_runtime_put_sync(dev->parent); return 0; } @@ -56,9 +56,9 @@ static int tegra210_mixer_runtime_resume(struct device *dev) struct tegra210_mixer *mixer = dev_get_drvdata(dev); int ret; - ret = clk_prepare_enable(mixer->clk_mixer); - if (ret) { - dev_err(dev, "clk_enable failed: %d\n", ret); + ret = pm_runtime_get_sync(dev->parent); + if (ret < 0) { + dev_err(dev, "parent get_sync failed: %d\n", ret); return ret; } @@ -578,18 +578,11 @@ static int tegra210_mixer_platform_probe(struct platform_device *pdev) mixer->gain_coeff[12] = 0x3e80; mixer->gain_coeff[13] = 0x83126E; - mixer->clk_mixer = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(mixer->clk_mixer)) { - dev_err(&pdev->dev, "Can't retrieve tegra210_mixer clock\n"); - ret = PTR_ERR(mixer->clk_mixer); - goto err; - } - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem) { dev_err(&pdev->dev, "No memory resource\n"); ret = -ENODEV; - goto err_clk_put; + goto err; } memregion = devm_request_mem_region(&pdev->dev, mem->start, @@ -597,14 +590,14 @@ static int tegra210_mixer_platform_probe(struct platform_device *pdev) if (!memregion) { dev_err(&pdev->dev, "Memory region already claimed\n"); ret = -EBUSY; - goto err_clk_put; + goto err; } regs = devm_ioremap(&pdev->dev, mem->start, resource_size(mem)); if (!regs) { dev_err(&pdev->dev, "ioremap failed\n"); ret = -ENOMEM; - goto err_clk_put; + goto err; } mixer->regmap = devm_regmap_init_mmio(&pdev->dev, regs, @@ -612,7 +605,7 @@ static int tegra210_mixer_platform_probe(struct platform_device *pdev) if (IS_ERR(mixer->regmap)) { dev_err(&pdev->dev, "regmap init failed\n"); ret = PTR_ERR(mixer->regmap); - goto err_clk_put; + goto err; } regcache_cache_only(mixer->regmap, true); @@ -622,7 +615,7 @@ static int tegra210_mixer_platform_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Missing property nvidia,ahub-amixer-id\n"); ret = -ENODEV; - goto err_clk_put; + goto err; } pm_runtime_enable(&pdev->dev); @@ -647,24 +640,18 @@ err_suspend: tegra210_mixer_runtime_suspend(&pdev->dev); err_pm_disable: pm_runtime_disable(&pdev->dev); -err_clk_put: - devm_clk_put(&pdev->dev, mixer->clk_mixer); err: return ret; } static int tegra210_mixer_platform_remove(struct platform_device *pdev) { - struct tegra210_mixer *mixer = dev_get_drvdata(&pdev->dev); - snd_soc_unregister_codec(&pdev->dev); pm_runtime_disable(&pdev->dev); if (!pm_runtime_status_suspended(&pdev->dev)) tegra210_mixer_runtime_suspend(&pdev->dev); - devm_clk_put(&pdev->dev, mixer->clk_mixer); - return 0; } diff --git a/sound/soc/tegra-alt/tegra210_mvc_alt.c b/sound/soc/tegra-alt/tegra210_mvc_alt.c index b4225665..3fb0465a 100644 --- a/sound/soc/tegra-alt/tegra210_mvc_alt.c +++ b/sound/soc/tegra-alt/tegra210_mvc_alt.c @@ -42,7 +42,7 @@ static int tegra210_mvc_runtime_suspend(struct device *dev) regcache_cache_only(mvc->regmap, true); - clk_disable_unprepare(mvc->clk_mvc); + pm_runtime_put_sync(dev->parent); return 0; } @@ -50,12 +50,11 @@ static int tegra210_mvc_runtime_suspend(struct device *dev) static int tegra210_mvc_runtime_resume(struct device *dev) { struct tegra210_mvc *mvc = dev_get_drvdata(dev); - int ret; - ret = clk_prepare_enable(mvc->clk_mvc); - if (ret) { - dev_err(dev, "clk_enable failed: %d\n", ret); + ret = pm_runtime_get_sync(dev->parent); + if (ret < 0) { + dev_err(dev, "parent get_sync failed: %d\n", ret); return ret; } @@ -422,18 +421,11 @@ static int tegra210_mvc_platform_probe(struct platform_device *pdev) mvc->poly_coeff[7] = 5527252; mvc->poly_coeff[8] = -785042; - mvc->clk_mvc = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(mvc->clk_mvc)) { - dev_err(&pdev->dev, "Can't retrieve mvc clock\n"); - ret = PTR_ERR(mvc->clk_mvc); - goto err; - } - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem) { dev_err(&pdev->dev, "No memory resource\n"); ret = -ENODEV; - goto err_clk_put; + goto err; } memregion = devm_request_mem_region(&pdev->dev, mem->start, @@ -441,14 +433,14 @@ static int tegra210_mvc_platform_probe(struct platform_device *pdev) if (!memregion) { dev_err(&pdev->dev, "Memory region already claimed\n"); ret = -EBUSY; - goto err_clk_put; + goto err; } regs = devm_ioremap(&pdev->dev, mem->start, resource_size(mem)); if (!regs) { dev_err(&pdev->dev, "ioremap failed\n"); ret = -ENOMEM; - goto err_clk_put; + goto err; } mvc->regmap = devm_regmap_init_mmio(&pdev->dev, regs, @@ -456,7 +448,7 @@ static int tegra210_mvc_platform_probe(struct platform_device *pdev) if (IS_ERR(mvc->regmap)) { dev_err(&pdev->dev, "regmap init failed\n"); ret = PTR_ERR(mvc->regmap); - goto err_clk_put; + goto err; } regcache_cache_only(mvc->regmap, true); @@ -466,7 +458,7 @@ static int tegra210_mvc_platform_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Missing property nvidia,ahub-mvc-id\n"); ret = -ENODEV; - goto err_clk_put; + goto err; } pm_runtime_enable(&pdev->dev); @@ -491,24 +483,18 @@ err_suspend: tegra210_mvc_runtime_suspend(&pdev->dev); err_pm_disable: pm_runtime_disable(&pdev->dev); -err_clk_put: - devm_clk_put(&pdev->dev, mvc->clk_mvc); err: return ret; } static int tegra210_mvc_platform_remove(struct platform_device *pdev) { - struct tegra210_mvc *mvc = dev_get_drvdata(&pdev->dev); - snd_soc_unregister_codec(&pdev->dev); pm_runtime_disable(&pdev->dev); if (!pm_runtime_status_suspended(&pdev->dev)) tegra210_mvc_runtime_suspend(&pdev->dev); - devm_clk_put(&pdev->dev, mvc->clk_mvc); - return 0; } diff --git a/sound/soc/tegra-alt/tegra210_ope_alt.c b/sound/soc/tegra-alt/tegra210_ope_alt.c index 736e125f..cc9611ee 100644 --- a/sound/soc/tegra-alt/tegra210_ope_alt.c +++ b/sound/soc/tegra-alt/tegra210_ope_alt.c @@ -44,7 +44,9 @@ static int tegra210_ope_runtime_suspend(struct device *dev) regcache_cache_only(ope->mbdrc_regmap, true); regcache_cache_only(ope->peq_regmap, true); regcache_cache_only(ope->regmap, true); - clk_disable_unprepare(ope->clk_ope); + + pm_runtime_put_sync(dev->parent); + return 0; } @@ -53,11 +55,12 @@ static int tegra210_ope_runtime_resume(struct device *dev) struct tegra210_ope *ope = dev_get_drvdata(dev); int ret; - ret = clk_prepare_enable(ope->clk_ope); - if (ret) { - dev_err(dev, "clk_enable failed: %d\n", ret); + ret = pm_runtime_get_sync(dev->parent); + if (ret < 0) { + dev_err(dev, "parent get_sync failed: %d\n", ret); return ret; } + regcache_cache_only(ope->regmap, false); regcache_cache_only(ope->peq_regmap, false); regcache_cache_only(ope->mbdrc_regmap, false); @@ -332,18 +335,11 @@ static int tegra210_ope_platform_probe(struct platform_device *pdev) ope->soc_data = soc_data; - ope->clk_ope = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(ope->clk_ope)) { - dev_err(&pdev->dev, "Can't retrieve ope clock\n"); - ret = PTR_ERR(ope->clk_ope); - goto err; - } - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem) { dev_err(&pdev->dev, "No memory resource\n"); ret = -ENODEV; - goto err_clk_put; + goto err; } memregion = devm_request_mem_region(&pdev->dev, mem->start, @@ -351,14 +347,14 @@ static int tegra210_ope_platform_probe(struct platform_device *pdev) if (!memregion) { dev_err(&pdev->dev, "Memory region already claimed\n"); ret = -EBUSY; - goto err_clk_put; + goto err; } regs = devm_ioremap(&pdev->dev, mem->start, resource_size(mem)); if (!regs) { dev_err(&pdev->dev, "ioremap failed\n"); ret = -ENOMEM; - goto err_clk_put; + goto err; } ope->regmap = devm_regmap_init_mmio(&pdev->dev, regs, @@ -366,7 +362,7 @@ static int tegra210_ope_platform_probe(struct platform_device *pdev) if (IS_ERR(ope->regmap)) { dev_err(&pdev->dev, "regmap init failed\n"); ret = PTR_ERR(ope->regmap); - goto err_clk_put; + goto err; } regcache_cache_only(ope->regmap, true); @@ -374,7 +370,7 @@ static int tegra210_ope_platform_probe(struct platform_device *pdev) TEGRA210_PEQ_IORESOURCE_MEM); if (ret < 0) { dev_err(&pdev->dev, "peq init failed\n"); - goto err_clk_put; + goto err; } regcache_cache_only(ope->peq_regmap, true); @@ -382,7 +378,7 @@ static int tegra210_ope_platform_probe(struct platform_device *pdev) TEGRA210_MBDRC_IORESOURCE_MEM); if (ret < 0) { dev_err(&pdev->dev, "mbdrc init failed\n"); - goto err_clk_put; + goto err; } regcache_cache_only(ope->mbdrc_regmap, true); @@ -392,7 +388,7 @@ static int tegra210_ope_platform_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Missing property nvidia,ahub-ope-id\n"); ret = -ENODEV; - goto err_clk_put; + goto err; } pm_runtime_enable(&pdev->dev); @@ -419,22 +415,18 @@ err_suspend: tegra210_ope_runtime_suspend(&pdev->dev); err_pm_disable: pm_runtime_disable(&pdev->dev); -err_clk_put: - devm_clk_put(&pdev->dev, ope->clk_ope); err: return ret; } static int tegra210_ope_platform_remove(struct platform_device *pdev) { - struct tegra210_ope *ope = dev_get_drvdata(&pdev->dev); snd_soc_unregister_codec(&pdev->dev); pm_runtime_disable(&pdev->dev); if (!pm_runtime_status_suspended(&pdev->dev)) tegra210_ope_runtime_suspend(&pdev->dev); - devm_clk_put(&pdev->dev, ope->clk_ope); return 0; } diff --git a/sound/soc/tegra-alt/tegra210_sfc_alt.c b/sound/soc/tegra-alt/tegra210_sfc_alt.c index a46a4b29..50095f3f 100644 --- a/sound/soc/tegra-alt/tegra210_sfc_alt.c +++ b/sound/soc/tegra-alt/tegra210_sfc_alt.c @@ -42,7 +42,7 @@ static int tegra210_sfc_runtime_suspend(struct device *dev) regcache_cache_only(sfc->regmap, true); - clk_disable_unprepare(sfc->clk_sfc); + pm_runtime_put_sync(dev->parent); return 0; } @@ -50,12 +50,11 @@ static int tegra210_sfc_runtime_suspend(struct device *dev) static int tegra210_sfc_runtime_resume(struct device *dev) { struct tegra210_sfc *sfc = dev_get_drvdata(dev); - int ret; - ret = clk_prepare_enable(sfc->clk_sfc); - if (ret) { - dev_err(dev, "clk_enable failed: %d\n", ret); + ret = pm_runtime_get_sync(dev->parent); + if (ret < 0) { + dev_err(dev, "parent get_sync failed: %d\n", ret); return ret; } @@ -469,18 +468,11 @@ static int tegra210_sfc_platform_probe(struct platform_device *pdev) /* initialize default output srate */ sfc->srate_out = TEGRA210_SFC_FS48; - sfc->clk_sfc = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(sfc->clk_sfc)) { - dev_err(&pdev->dev, "Can't retrieve sfc clock\n"); - ret = PTR_ERR(sfc->clk_sfc); - goto err; - } - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem) { dev_err(&pdev->dev, "No memory resource\n"); ret = -ENODEV; - goto err_clk_put; + goto err; } memregion = devm_request_mem_region(&pdev->dev, mem->start, @@ -488,14 +480,14 @@ static int tegra210_sfc_platform_probe(struct platform_device *pdev) if (!memregion) { dev_err(&pdev->dev, "Memory region already claimed\n"); ret = -EBUSY; - goto err_clk_put; + goto err; } regs = devm_ioremap(&pdev->dev, mem->start, resource_size(mem)); if (!regs) { dev_err(&pdev->dev, "ioremap failed\n"); ret = -ENOMEM; - goto err_clk_put; + goto err; } sfc->regmap = devm_regmap_init_mmio(&pdev->dev, regs, @@ -503,7 +495,7 @@ static int tegra210_sfc_platform_probe(struct platform_device *pdev) if (IS_ERR(sfc->regmap)) { dev_err(&pdev->dev, "regmap init failed\n"); ret = PTR_ERR(sfc->regmap); - goto err_clk_put; + goto err; } regcache_cache_only(sfc->regmap, true); @@ -513,7 +505,7 @@ static int tegra210_sfc_platform_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Missing property nvidia,ahub-sfc-id\n"); ret = -ENODEV; - goto err_clk_put; + goto err; } pm_runtime_enable(&pdev->dev); @@ -538,24 +530,18 @@ err_suspend: tegra210_sfc_runtime_suspend(&pdev->dev); err_pm_disable: pm_runtime_disable(&pdev->dev); -err_clk_put: - devm_clk_put(&pdev->dev, sfc->clk_sfc); err: return ret; } static int tegra210_sfc_platform_remove(struct platform_device *pdev) { - struct tegra210_sfc *sfc = dev_get_drvdata(&pdev->dev); - snd_soc_unregister_codec(&pdev->dev); pm_runtime_disable(&pdev->dev); if (!pm_runtime_status_suspended(&pdev->dev)) tegra210_sfc_runtime_suspend(&pdev->dev); - devm_clk_put(&pdev->dev, sfc->clk_sfc); - return 0; } diff --git a/sound/soc/tegra-alt/tegra210_spdif_alt.c b/sound/soc/tegra-alt/tegra210_spdif_alt.c index 9b74b6ca..fcb1e1d8 100644 --- a/sound/soc/tegra-alt/tegra210_spdif_alt.c +++ b/sound/soc/tegra-alt/tegra210_spdif_alt.c @@ -44,6 +44,7 @@ static int tegra210_spdif_runtime_suspend(struct device *dev) clk_disable_unprepare(spdif->clk_spdif_out); clk_disable_unprepare(spdif->clk_spdif_in); + pm_runtime_put_sync(dev->parent); return 0; } @@ -53,6 +54,12 @@ static int tegra210_spdif_runtime_resume(struct device *dev) struct tegra210_spdif *spdif = dev_get_drvdata(dev); int ret = 0; + ret = pm_runtime_get_sync(dev->parent); + if (ret < 0) { + dev_err(dev, "parent get_sync failed: %d\n", ret); + return ret; + } + ret = clk_prepare_enable(spdif->clk_spdif_out); if (ret) { dev_err(dev, "spdif_out_clk_enable failed: %d\n", ret);