ASoC: tegra-alt: Fix parent runtime PM handling

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: I9130d8e1c9f91a439651d279ffdf389474018f92
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: http://git-master/r/1488961
(cherry picked from commit 6ae92527f6948ff484af761c1aa1073f79e13a8a)
Reviewed-on: https://git-master/r/1511032
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
This commit is contained in:
Jon Hunter
2017-05-24 17:36:54 +01:00
committed by Sameer Pujar
parent 85eae8d6ff
commit a29581fc2e
3 changed files with 2 additions and 25 deletions

View File

@@ -1,7 +1,7 @@
/*
* tegra186_arad_alt.c - Tegra186 ARAD driver
*
* Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2015-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,
@@ -88,8 +88,6 @@ static int tegra186_arad_runtime_suspend(struct device *dev)
regcache_cache_only(arad->regmap, true);
regcache_mark_dirty(arad->regmap);
pm_runtime_put_sync(dev->parent);
return 0;
}
@@ -97,13 +95,6 @@ static int tegra186_arad_runtime_suspend(struct device *dev)
static int tegra186_arad_runtime_resume(struct device *dev)
{
struct tegra186_arad *arad = 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(arad->regmap, false);
regcache_sync(arad->regmap);

View File

@@ -167,20 +167,13 @@ static int tegra186_asrc_runtime_suspend(struct device *dev)
regcache_cache_only(asrc->regmap, true);
regcache_mark_dirty(asrc->regmap);
pm_runtime_put_sync(dev->parent);
return 0;
}
static int tegra186_asrc_runtime_resume(struct device *dev)
{
struct tegra186_asrc *asrc = dev_get_drvdata(dev);
int ret, lane_id;
ret = pm_runtime_get_sync(dev->parent);
if (ret < 0) {
dev_err(dev, "parent get_sync failed: %d\n", ret);
return ret;
}
int lane_id;
regcache_cache_only(asrc->regmap, false);

View File

@@ -107,7 +107,6 @@ static int tegra186_dspk_runtime_suspend(struct device *dev)
clk_disable_unprepare(dspk->clk_dspk);
}
pm_runtime_put_sync(dev->parent);
return 0;
}
@@ -116,12 +115,6 @@ static int tegra186_dspk_runtime_resume(struct device *dev)
struct tegra186_dspk *dspk = 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(dspk->pin_active_state) && dspk->is_pinctrl) {
ret = pinctrl_select_state(dspk->pinctrl,