]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/commitdiff
ASoC: tegra-alt: Fix parent runtime PM handling
authorJon Hunter <jonathanh@nvidia.com>
Mon, 22 May 2017 15:02:11 +0000 (16:02 +0100)
committermobile promotions <svcmobile_promotions@nvidia.com>
Tue, 6 Jun 2017 09:50:54 +0000 (02:50 -0700)
Linux runtime PM automatically handles the runtime resuming and
suspending of a parent device and therefore, it is not necessary
for a child device to explicitly runtime resume or suspend the
parent.

The various Tegra ASoC codec drivers explicitly runtime resume
and suspend the parent device from within their runtime PM callback
handler. This should not be necessary.

Furthermore, currently the various Tegra ASoC codec drivers are
not suspended correctly if active when system suspend occurs. During
system suspend it is common to directly call the runtime PM callbacks
to suspend and resume the device if active from the system suspend
callbacks. However, the APIs, pm_runtime_get/put(), cannot be called
during system suspend and so the runtime PM callbacks for these codec
drivers cannot be called from the context of the system suspend
callbacks.

Remove the calls to runtime resume and suspend the parent device from
the runtime PM callbacks for the various Tegra ASoC drivers. This will
allow us to fix suspending and resuming of the Tegra ASoC drivers
across system suspend.

Bug 200275736

Change-Id: Ia2c954f206ed0276c6d54627f274e6a713d88a6f
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: http://git-master/r/1487805
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
12 files changed:
sound/soc/tegra-alt/tegra210_admaif_alt.c
sound/soc/tegra-alt/tegra210_adx_alt.c
sound/soc/tegra-alt/tegra210_afc_alt.c
sound/soc/tegra-alt/tegra210_amx_alt.c
sound/soc/tegra-alt/tegra210_dmic_alt.c
sound/soc/tegra-alt/tegra210_i2s_alt.c
sound/soc/tegra-alt/tegra210_iqc_alt.c
sound/soc/tegra-alt/tegra210_mixer_alt.c
sound/soc/tegra-alt/tegra210_mvc_alt.c
sound/soc/tegra-alt/tegra210_ope_alt.c
sound/soc/tegra-alt/tegra210_sfc_alt.c
sound/soc/tegra-alt/tegra210_spdif_alt.c

index 0e3c45680bd6a996b675b90d9bae50379b85b24f..6205d3ad31dcbdfc38e50cb9e80bc9d661e5eea3 100644 (file)
@@ -228,7 +228,6 @@ static int tegra210_admaif_runtime_suspend(struct device *dev)
 
        regcache_cache_only(admaif->regmap, true);
        regcache_mark_dirty(admaif->regmap);
-       pm_runtime_put_sync(dev->parent);
 
        return 0;
 }
@@ -236,13 +235,6 @@ static int tegra210_admaif_runtime_suspend(struct device *dev)
 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;
-       }
 
        regcache_cache_only(admaif->regmap, false);
        if (!admaif->is_shutdown)
index 71e8a8e6e30f70a44c8e99a3ea1278e2df7350af..d982003a770ced3fceb66736d1f720e4941ab711 100644 (file)
@@ -249,21 +249,12 @@ static int tegra210_adx_runtime_suspend(struct device *dev)
        regcache_cache_only(adx->regmap, true);
        regcache_mark_dirty(adx->regmap);
 
-       pm_runtime_put_sync(dev->parent);
-
        return 0;
 }
 
 static int tegra210_adx_runtime_resume(struct device *dev)
 {
        struct tegra210_adx *adx = 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;
-       }
 
        regcache_cache_only(adx->regmap, false);
 
index 542cf24f9d1cfe62eb314256c720e9d17a58fa8c..56c6af1e82864239e1d839fe7bd3e6237093bb48 100644 (file)
@@ -67,21 +67,12 @@ static int tegra210_afc_runtime_suspend(struct device *dev)
        regcache_cache_only(afc->regmap, true);
        regcache_mark_dirty(afc->regmap);
 
-       pm_runtime_put_sync(dev->parent);
-
        return 0;
 }
 
 static int tegra210_afc_runtime_resume(struct device *dev)
 {
        struct tegra210_afc *afc = 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;
-       }
 
        regcache_cache_only(afc->regmap, false);
 
index bb6868423be38ffbe56f375ea182ec3586ff3168..d30043d1bd220fa3808dc50d9b9389826e4bc26c 100644 (file)
@@ -243,8 +243,6 @@ static int tegra210_amx_runtime_suspend(struct device *dev)
        regcache_cache_only(amx->regmap, true);
        regcache_mark_dirty(amx->regmap);
 
-       pm_runtime_put_sync(dev->parent);
-
        return 0;
 }
 
@@ -282,13 +280,6 @@ static unsigned int tegra210_amx_read_map_ram(struct tegra210_amx *amx,
 static int tegra210_amx_runtime_resume(struct device *dev)
 {
        struct tegra210_amx *amx = 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;
-       }
 
        regcache_cache_only(amx->regmap, false);
 
index 3dfd28607a82e65aeb2b19b11622f9375cc3a182..08a520795455dfcae231e948db13f6cb8d55c655 100644 (file)
@@ -90,8 +90,6 @@ static int tegra210_dmic_runtime_suspend(struct device *dev)
                clk_disable_unprepare(dmic->clk_dmic);
        }
 
-       pm_runtime_put_sync(dev->parent);
-
        return 0;
 }
 
@@ -100,12 +98,6 @@ static int tegra210_dmic_runtime_resume(struct device *dev)
        struct tegra210_dmic *dmic = 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 (!(tegra_platform_is_unit_fpga() || tegra_platform_is_fpga())) {
                if (!IS_ERR(dmic->pin_active_state) && dmic->is_pinctrl) {
                        ret = pinctrl_select_state(dmic->pinctrl,
index cc8a1fbcc04f95c54283924a35cdabc4974dd564..699c28a161e13426a688d5a8bf5f00305f1dcb58 100644 (file)
@@ -253,8 +253,6 @@ static int tegra210_i2s_runtime_suspend(struct device *dev)
        } else
                regcache_cache_only(i2s->regmap, true);
 
-       pm_runtime_put_sync(dev->parent);
-
        return 0;
 }
 
@@ -263,12 +261,6 @@ 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 (!(tegra_platform_is_unit_fpga() || tegra_platform_is_fpga())) {
                if (!IS_ERR(i2s->pin_default_state)) {
                        ret = pinctrl_select_state(i2s->pinctrl,
index f6c630834786b9e75fb048effe2e538ad399658d..61d929833fcd3137d375212d04c835e24f53883e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * tegra210_iqc.c - Tegra210 IQC driver
  *
- * Copyright (c) 2014-2016 NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2014-2017 NVIDIA CORPORATION.  All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -54,7 +54,6 @@ static int tegra210_iqc_runtime_suspend(struct device *dev)
 #ifndef CONFIG_MACH_GRENADA
        clk_disable_unprepare(iqc->clk_iqc);
 #endif
-       pm_runtime_put_sync(dev->parent);
 
        return 0;
 }
@@ -64,12 +63,6 @@ static int tegra210_iqc_runtime_resume(struct device *dev)
        struct tegra210_iqc *iqc = 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;
-       }
-
 #ifndef CONFIG_MACH_GRENADA
        ret = clk_prepare_enable(iqc->clk_iqc);
        if (ret) {
index 7ed3d36d8f72b1008c68d63d26cc77f0c2c5ddf5..73516b235de8a20e5fbc33d2522d3497981b3c81 100644 (file)
@@ -82,21 +82,12 @@ static int tegra210_mixer_runtime_suspend(struct device *dev)
        regcache_cache_only(mixer->regmap, true);
        regcache_mark_dirty(mixer->regmap);
 
-       pm_runtime_put_sync(dev->parent);
-
        return 0;
 }
 
 static int tegra210_mixer_runtime_resume(struct device *dev)
 {
        struct tegra210_mixer *mixer = 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;
-       }
 
        regcache_cache_only(mixer->regmap, false);
 
index 176c19bf6a4ccf7f036510b7aecf6ac079963b75..e2f1d708b54936e4c09f2acdd2d8eafdeabe097d 100644 (file)
@@ -60,21 +60,12 @@ static int tegra210_mvc_runtime_suspend(struct device *dev)
 
        regcache_cache_only(mvc->regmap, true);
 
-       pm_runtime_put_sync(dev->parent);
-
        return 0;
 }
 
 static int tegra210_mvc_runtime_resume(struct device *dev)
 {
        struct tegra210_mvc *mvc = 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;
-       }
 
        regcache_cache_only(mvc->regmap, false);
 
index 95fbc79723c9cce5736f65f0d989a553bfaaff89..2d35e6d40ac2e289c566ee97e84d7fc645473b0d 100644 (file)
@@ -56,21 +56,12 @@ static int tegra210_ope_runtime_suspend(struct device *dev)
        regcache_mark_dirty(ope->peq_regmap);
        regcache_mark_dirty(ope->mbdrc_regmap);
 
-       pm_runtime_put_sync(dev->parent);
-
        return 0;
 }
 
 static int tegra210_ope_runtime_resume(struct device *dev)
 {
        struct tegra210_ope *ope = 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;
-       }
 
        regcache_cache_only(ope->regmap, false);
        regcache_cache_only(ope->peq_regmap, false);
index 31cf971c770b5143557895256cdbb712f80942d4..b67046f5ae8bff435c1c8211331222262d2f9631 100644 (file)
@@ -69,21 +69,12 @@ static int tegra210_sfc_runtime_suspend(struct device *dev)
        regcache_cache_only(sfc->regmap, true);
        regcache_mark_dirty(sfc->regmap);
 
-       pm_runtime_put_sync(dev->parent);
-
        return 0;
 }
 
 static int tegra210_sfc_runtime_resume(struct device *dev)
 {
        struct tegra210_sfc *sfc = 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;
-       }
 
        regcache_cache_only(sfc->regmap, false);
 
index 1006e12941486ffbb51b4a0500f9c21baf3592bf..f40a2e4e442260706d6acb3a49d28f2af838c132 100644 (file)
@@ -77,8 +77,6 @@ static int tegra210_spdif_runtime_suspend(struct device *dev)
                clk_disable_unprepare(spdif->clk_spdif_in);
        }
 
-       pm_runtime_put_sync(dev->parent);
-
        return 0;
 }
 
@@ -87,12 +85,6 @@ static int tegra210_spdif_runtime_resume(struct device *dev)
        struct tegra210_spdif *spdif = 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 (!(tegra_platform_is_unit_fpga() || tegra_platform_is_fpga())) {
                if (!IS_ERR(spdif->pin_active_state) && spdif->is_pinctrl) {
                        ret = pinctrl_select_state(spdif->pinctrl,