[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230111090222.2016499-16-Vijendar.Mukunda@amd.com>
Date: Wed, 11 Jan 2023 14:32:18 +0530
From: Vijendar Mukunda <Vijendar.Mukunda@....com>
To: <broonie@...nel.org>, <vkoul@...nel.org>,
<alsa-devel@...a-project.org>
CC: <Basavaraj.Hiregoudar@....com>, <Sunil-kumar.Dommati@....com>,
<Mario.Limonciello@....com>, <Mastan.Katragadda@....com>,
<arungopal.kondaveeti@....com>,
Vijendar Mukunda <Vijendar.Mukunda@....com>,
Bard Liao <yung-chuan.liao@...ux.intel.com>,
Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
Sanyog Kale <sanyog.r.kale@...el.com>,
open list <linux-kernel@...r.kernel.org>
Subject: [PATCH 15/19] soundwire: amd: add startup and shutdown dai ops
Add start up and shutdown dai ops for AMD Master driver.
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@....com>
---
drivers/soundwire/amd_master.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/drivers/soundwire/amd_master.c b/drivers/soundwire/amd_master.c
index d2d7f07de202..290c59ab7760 100644
--- a/drivers/soundwire/amd_master.c
+++ b/drivers/soundwire/amd_master.c
@@ -1117,6 +1117,15 @@ static int amd_set_sdw_stream(struct snd_soc_dai *dai, void *stream, int directi
return 0;
}
+static void amd_sdwc_shutdown(struct snd_pcm_substream *substream,
+ struct snd_soc_dai *dai)
+{
+ struct amd_sdwc_ctrl *ctrl = snd_soc_dai_get_drvdata(dai);
+
+ pm_runtime_mark_last_busy(ctrl->dev);
+ pm_runtime_put_autosuspend(ctrl->dev);
+}
+
static int amd_pcm_set_sdw_stream(struct snd_soc_dai *dai, void *stream, int direction)
{
return amd_set_sdw_stream(dai, stream, direction);
@@ -1137,9 +1146,27 @@ static void *amd_get_sdw_stream(struct snd_soc_dai *dai, int direction)
return dma->stream;
}
+static int amd_sdwc_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
+{
+ struct amd_sdwc_ctrl *ctrl = snd_soc_dai_get_drvdata(dai);
+ int ret;
+
+ ret = pm_runtime_get_sync(ctrl->dev);
+ if (ret < 0 && ret != -EACCES) {
+ dev_err_ratelimited(ctrl->dev,
+ "pm_runtime_get_sync failed in %s, ret %d\n",
+ __func__, ret);
+ pm_runtime_put_noidle(ctrl->dev);
+ return ret;
+ }
+ return 0;
+}
+
static const struct snd_soc_dai_ops amd_sdwc_dai_ops = {
.hw_params = amd_sdwc_hw_params,
.hw_free = amd_sdwc_hw_free,
+ .startup = amd_sdwc_startup,
+ .shutdown = amd_sdwc_shutdown,
.set_stream = amd_pcm_set_sdw_stream,
.get_stream = amd_get_sdw_stream,
};
--
2.34.1
Powered by blists - more mailing lists