Add start up and shutdown dai ops for AMD Master driver.
Signed-off-by: Vijendar Mukunda <[email protected]>
---
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
On 1/11/23 03:02, Vijendar Mukunda wrote:
> Add start up and shutdown dai ops for AMD Master driver.
I don't think those startup and shutdown ops are necessary, we removed
them for Intel, see "soundwire: intel: remove DAI startup/shutdown"
On 11/01/23 21:19, Pierre-Louis Bossart wrote:
>
> On 1/11/23 03:02, Vijendar Mukunda wrote:
>> Add start up and shutdown dai ops for AMD Master driver.
> I don't think those startup and shutdown ops are necessary, we removed
> them for Intel, see "soundwire: intel: remove DAI startup/shutdown"
will drop this patch.