diff options
author | Takashi Iwai <tiwai@suse.de> | 2017-02-13 03:52:44 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-02-21 16:17:45 -0500 |
commit | 3002b9fb7cbc26e8d29927c9e20e235f38319b24 (patch) | |
tree | c524567d696d57c5ddd2ed4edb3a2845461f80c8 /sound | |
parent | 34371d236eab28933eefc0d77bd1e3df62fc585b (diff) |
ALSA: x86: Use runtime PM autosuspend
This patch adds a few lines to the driver to use autosuspend for the
runtime PM. It'll become useful with the combination of the keep-link
feature.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/x86/intel_hdmi_audio.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c index 360cff35b239..d1504303adfb 100644 --- a/sound/x86/intel_hdmi_audio.c +++ b/sound/x86/intel_hdmi_audio.c | |||
@@ -1082,7 +1082,8 @@ static int had_pcm_open(struct snd_pcm_substream *substream) | |||
1082 | 1082 | ||
1083 | return retval; | 1083 | return retval; |
1084 | error: | 1084 | error: |
1085 | pm_runtime_put(intelhaddata->dev); | 1085 | pm_runtime_mark_last_busy(intelhaddata->dev); |
1086 | pm_runtime_put_autosuspend(intelhaddata->dev); | ||
1086 | return retval; | 1087 | return retval; |
1087 | } | 1088 | } |
1088 | 1089 | ||
@@ -1106,7 +1107,8 @@ static int had_pcm_close(struct snd_pcm_substream *substream) | |||
1106 | } | 1107 | } |
1107 | spin_unlock_irq(&intelhaddata->had_spinlock); | 1108 | spin_unlock_irq(&intelhaddata->had_spinlock); |
1108 | 1109 | ||
1109 | pm_runtime_put(intelhaddata->dev); | 1110 | pm_runtime_mark_last_busy(intelhaddata->dev); |
1111 | pm_runtime_put_autosuspend(intelhaddata->dev); | ||
1110 | return 0; | 1112 | return 0; |
1111 | } | 1113 | } |
1112 | 1114 | ||
@@ -1596,7 +1598,8 @@ static void had_audio_wq(struct work_struct *work) | |||
1596 | had_process_mode_change(ctx); | 1598 | had_process_mode_change(ctx); |
1597 | } | 1599 | } |
1598 | mutex_unlock(&ctx->mutex); | 1600 | mutex_unlock(&ctx->mutex); |
1599 | pm_runtime_put(ctx->dev); | 1601 | pm_runtime_mark_last_busy(ctx->dev); |
1602 | pm_runtime_put_autosuspend(ctx->dev); | ||
1600 | } | 1603 | } |
1601 | 1604 | ||
1602 | /* | 1605 | /* |
@@ -1643,10 +1646,17 @@ static int __maybe_unused hdmi_lpe_audio_suspend(struct device *dev) | |||
1643 | return err; | 1646 | return err; |
1644 | } | 1647 | } |
1645 | 1648 | ||
1649 | static int hdmi_lpe_audio_runtime_resume(struct device *dev) | ||
1650 | { | ||
1651 | pm_runtime_mark_last_busy(dev); | ||
1652 | return 0; | ||
1653 | } | ||
1654 | |||
1646 | static int __maybe_unused hdmi_lpe_audio_resume(struct device *dev) | 1655 | static int __maybe_unused hdmi_lpe_audio_resume(struct device *dev) |
1647 | { | 1656 | { |
1648 | struct snd_intelhad *ctx = dev_get_drvdata(dev); | 1657 | struct snd_intelhad *ctx = dev_get_drvdata(dev); |
1649 | 1658 | ||
1659 | hdmi_lpe_audio_runtime_resume(dev); | ||
1650 | snd_power_change_state(ctx->card, SNDRV_CTL_POWER_D0); | 1660 | snd_power_change_state(ctx->card, SNDRV_CTL_POWER_D0); |
1651 | return 0; | 1661 | return 0; |
1652 | } | 1662 | } |
@@ -1799,6 +1809,9 @@ static int hdmi_lpe_audio_probe(struct platform_device *pdev) | |||
1799 | pdata->notify_pending = false; | 1809 | pdata->notify_pending = false; |
1800 | spin_unlock_irq(&pdata->lpe_audio_slock); | 1810 | spin_unlock_irq(&pdata->lpe_audio_slock); |
1801 | 1811 | ||
1812 | pm_runtime_use_autosuspend(&pdev->dev); | ||
1813 | pm_runtime_mark_last_busy(&pdev->dev); | ||
1814 | |||
1802 | pm_runtime_set_active(&pdev->dev); | 1815 | pm_runtime_set_active(&pdev->dev); |
1803 | pm_runtime_enable(&pdev->dev); | 1816 | pm_runtime_enable(&pdev->dev); |
1804 | 1817 | ||
@@ -1827,7 +1840,8 @@ static int hdmi_lpe_audio_remove(struct platform_device *pdev) | |||
1827 | 1840 | ||
1828 | static const struct dev_pm_ops hdmi_lpe_audio_pm = { | 1841 | static const struct dev_pm_ops hdmi_lpe_audio_pm = { |
1829 | SET_SYSTEM_SLEEP_PM_OPS(hdmi_lpe_audio_suspend, hdmi_lpe_audio_resume) | 1842 | SET_SYSTEM_SLEEP_PM_OPS(hdmi_lpe_audio_suspend, hdmi_lpe_audio_resume) |
1830 | SET_RUNTIME_PM_OPS(hdmi_lpe_audio_runtime_suspend, NULL, NULL) | 1843 | SET_RUNTIME_PM_OPS(hdmi_lpe_audio_runtime_suspend, |
1844 | hdmi_lpe_audio_runtime_resume, NULL) | ||
1831 | }; | 1845 | }; |
1832 | 1846 | ||
1833 | static struct platform_driver hdmi_lpe_audio_driver = { | 1847 | static struct platform_driver hdmi_lpe_audio_driver = { |