summaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorSameer Pujar <spujar@nvidia.com>2019-01-22 13:03:16 +0530
committerTakashi Iwai <tiwai@suse.de>2019-01-22 09:21:53 +0100
commit3f7e94e6d66b52bb6a86b7e06f5f2453491bf7c8 (patch)
tree92741a38e2b58d56a91149163f76b87f219dac30 /sound/pci
parentfd1cc9de64c2ca6c2b5b9061421580a22bfac023 (diff)
downloadlinux-3f7e94e6d66b52bb6a86b7e06f5f2453491bf7c8.tar.bz2
ALSA: hda/tegra: runtime power management support
This patch enables runtime power management(runtime PM) support for hda. pm_runtime_enable() and pm_runtime_disable() are added during device probe and remove respectively. The runtime PM callbacks will be forbidden if hda controller does not have support for runtime PM. pm_runtime_get_sync() and pm_runtime_put() are added for hda register access. The callbacks for above will be added in subsequent patches. Signed-off-by: Sameer Pujar <spujar@nvidia.com> Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com> Reviewed-by: Mohan Kumar D <mkumard@nvidia.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/hda_tegra.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c
index 97a176d817a0..2f9dd23981fe 100644
--- a/sound/pci/hda/hda_tegra.c
+++ b/sound/pci/hda/hda_tegra.c
@@ -32,6 +32,7 @@
#include <linux/slab.h>
#include <linux/time.h>
#include <linux/string.h>
+#include <linux/pm_runtime.h>
#include <sound/core.h>
#include <sound/initval.h>
@@ -512,6 +513,11 @@ static int hda_tegra_probe(struct platform_device *pdev)
card->private_data = chip;
dev_set_drvdata(&pdev->dev, card);
+
+ pm_runtime_enable(hda->dev);
+ if (!azx_has_pm_runtime(chip))
+ pm_runtime_forbid(hda->dev);
+
schedule_work(&hda->probe_work);
return 0;
@@ -528,6 +534,7 @@ static void hda_tegra_probe_work(struct work_struct *work)
struct platform_device *pdev = to_platform_device(hda->dev);
int err;
+ pm_runtime_get_sync(hda->dev);
err = hda_tegra_first_init(chip, pdev);
if (err < 0)
goto out_free;
@@ -549,12 +556,18 @@ static void hda_tegra_probe_work(struct work_struct *work)
snd_hda_set_power_save(&chip->bus, power_save * 1000);
out_free:
+ pm_runtime_put(hda->dev);
return; /* no error return from async probe */
}
static int hda_tegra_remove(struct platform_device *pdev)
{
- return snd_card_free(dev_get_drvdata(&pdev->dev));
+ int ret;
+
+ ret = snd_card_free(dev_get_drvdata(&pdev->dev));
+ pm_runtime_disable(&pdev->dev);
+
+ return ret;
}
static void hda_tegra_shutdown(struct platform_device *pdev)