diff mbox

[11/12] ASoC: AMD: add suspend/resume for ACP PCM driver

Message ID 1438871112-25946-11-git-send-email-alexander.deucher@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Deucher Aug. 6, 2015, 2:25 p.m. UTC
From: Maruthi Srinivas Bayyavarapu <Maruthi.Bayyavarapu@amd.com>

Added suspend/resume functionality for AMD ACP ASoC PCM driver.
Enabled them in the ASoC machine driver

Signed-off-by: Maruthi Bayyavarapu <maruthi.bayyavarapu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Murali Krishna Vemuri <murali-krishna.vemuri@amd.com>
---
 sound/soc/amd/acp-pcm-dma.c | 31 +++++++++++++++++++++++++++++++
 sound/soc/amd/acp-rt286.c   |  1 -
 2 files changed, 31 insertions(+), 1 deletion(-)

Comments

Mark Brown Aug. 6, 2015, 7:23 p.m. UTC | #1
On Thu, Aug 06, 2015 at 10:25:11AM -0400, Alex Deucher wrote:

> +static int acp_pcm_suspend(struct device *dev)
> +{
> +	return 0;
> +}

You should never need to add empty functions like this.
diff mbox

Patch

diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c
index 0f58957..db09b77 100644
--- a/sound/soc/amd/acp-pcm-dma.c
+++ b/sound/soc/amd/acp-pcm-dma.c
@@ -625,11 +625,42 @@  static int acp_amdsoc_remove(struct amd_gnb_bus_dev *adev)
 	return 0;
 }
 
+static int acp_pcm_suspend(struct device *dev)
+{
+	return 0;
+}
+
+static int acp_pcm_resume(struct device *dev)
+{
+	struct snd_pcm_substream *substream;
+	struct snd_pcm_runtime *runtime;
+	struct audio_substream_data *rtd;
+
+	struct audio_drv_data *irq_data =
+	    (struct audio_drv_data *)dev_get_drvdata(dev);
+
+	substream = irq_data->play_stream;
+	runtime = substream->runtime;
+	rtd = runtime->private_data;
+
+	irq_data->acp_dev->config_i2s(irq_data->acp_dev, rtd->i2s_config);
+	irq_data->acp_dev->config_dma(irq_data->acp_dev, rtd->dma_config);
+
+	return 0;
+}
+
+static const struct dev_pm_ops acp_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(acp_pcm_suspend, acp_pcm_resume)
+};
+
 static struct amd_gnb_bus_driver acp_dma_driver = {
 	.name = "acp-pcm-driver",
 	.ip = AMD_GNB_IP_ACP_PCM,
 	.probe = acp_amdsoc_probe,
 	.remove = acp_amdsoc_remove,
+	.driver = {
+		.pm = &acp_pm_ops,
+	},
 };
 
 static int __init amdsoc_bus_acp_dma_driver_init(void)
diff --git a/sound/soc/amd/acp-rt286.c b/sound/soc/amd/acp-rt286.c
index 7d4bdf9..8be9236 100644
--- a/sound/soc/amd/acp-rt286.c
+++ b/sound/soc/amd/acp-rt286.c
@@ -129,7 +129,6 @@  static struct snd_soc_dai_link carrizo_dai_rt286 = {
 	.codec_name = "rt286.3-001c",
 	.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
 			| SND_SOC_DAIFMT_CBM_CFM,
-	.ignore_suspend = 1,
 	.ops = &carrizo_rt286_ops,
 	.init = carrizo_init,
 };