[PATCH 0/2] ASoC: SOF: amd: Add pointer callback for amd
V sujith kumar Reddy (2): ASoC: SOF: amd: Add pcm pointer callback for amd platforms. ASoC: SOF: amd: Enable cont_update_posn variable in pcm hw_params.
sound/soc/sof/amd/acp-common.c | 1 + sound/soc/sof/amd/acp-pcm.c | 34 ++++++++++++++++++++++++++++++++++ sound/soc/sof/amd/acp.h | 2 ++ 3 files changed, 37 insertions(+)
Add pcm pointer callback for amd platforms to read host position update from stream box.
Signed-off-by: V sujith kumar Reddy Vsujithkumar.Reddy@amd.com --- sound/soc/sof/amd/acp-common.c | 1 + sound/soc/sof/amd/acp-pcm.c | 33 +++++++++++++++++++++++++++++++++ sound/soc/sof/amd/acp.h | 2 ++ 3 files changed, 36 insertions(+)
diff --git a/sound/soc/sof/amd/acp-common.c b/sound/soc/sof/amd/acp-common.c index bd6c1b198736..8ce4c8956933 100644 --- a/sound/soc/sof/amd/acp-common.c +++ b/sound/soc/sof/amd/acp-common.c @@ -187,6 +187,7 @@ struct snd_sof_dsp_ops sof_acp_common_ops = { .pcm_open = acp_pcm_open, .pcm_close = acp_pcm_close, .pcm_hw_params = acp_pcm_hw_params, + .pcm_pointer = acp_pcm_pointer,
.hw_info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | diff --git a/sound/soc/sof/amd/acp-pcm.c b/sound/soc/sof/amd/acp-pcm.c index 727c3a784a20..f342f0bac4a3 100644 --- a/sound/soc/sof/amd/acp-pcm.c +++ b/sound/soc/sof/amd/acp-pcm.c @@ -84,3 +84,36 @@ int acp_pcm_close(struct snd_sof_dev *sdev, struct snd_pcm_substream *substream) return acp_dsp_stream_put(sdev, stream); } EXPORT_SYMBOL_NS(acp_pcm_close, SND_SOC_SOF_AMD_COMMON); + +snd_pcm_uframes_t acp_pcm_pointer(struct snd_sof_dev *sdev, + struct snd_pcm_substream *substream) +{ + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); + struct snd_soc_component *scomp = sdev->component; + struct snd_sof_pcm_stream *stream; + struct sof_ipc_stream_posn posn; + struct snd_sof_pcm *spcm; + snd_pcm_uframes_t pos; + int ret; + + spcm = snd_sof_find_spcm_dai(scomp, rtd); + if (!spcm) { + dev_warn_ratelimited(sdev->dev, "warn: can't find PCM with DAI ID %d\n", + rtd->dai_link->id); + return 0; + } + + stream = &spcm->stream[substream->stream]; + ret = snd_sof_ipc_msg_data(sdev, stream, &posn, sizeof(posn)); + if (ret < 0) { + dev_warn(sdev->dev, "failed to read stream position: %d\n", ret); + return 0; + } + + memcpy(&stream->posn, &posn, sizeof(posn)); + pos = spcm->stream[substream->stream].posn.host_posn; + pos = bytes_to_frames(substream->runtime, pos); + + return pos; +} +EXPORT_SYMBOL_NS(acp_pcm_pointer, SND_SOC_SOF_AMD_COMMON); diff --git a/sound/soc/sof/amd/acp.h b/sound/soc/sof/amd/acp.h index 39165ebf684b..acad57947616 100644 --- a/sound/soc/sof/amd/acp.h +++ b/sound/soc/sof/amd/acp.h @@ -238,6 +238,8 @@ int acp_pcm_close(struct snd_sof_dev *sdev, struct snd_pcm_substream *substream) int acp_pcm_hw_params(struct snd_sof_dev *sdev, struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_sof_platform_stream_params *platform_params); +snd_pcm_uframes_t acp_pcm_pointer(struct snd_sof_dev *sdev, + struct snd_pcm_substream *substream);
extern struct snd_sof_dsp_ops sof_acp_common_ops;
On Wed, 08 Mar 2023 14:15:08 +0530, V sujith kumar Reddy wrote:
Add pcm pointer callback for amd platforms to read host position update from stream box.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/2] ASoC: SOF: amd: Add pcm pointer callback for amd platforms. commit: df6380dca2727bca62efdf332eaadd2e225f7c4d [2/2] ASoC: SOF: amd: Enable cont_update_posn variable in pcm hw_params. commit: b7f5c11761691a6f330411cb0490c6d0ee16c5f0
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
Enable cont_update_posn variable to update host position in streambox for every dma copy.
Signed-off-by: V sujith kumar Reddy Vsujithkumar.Reddy@amd.com --- sound/soc/sof/amd/acp-pcm.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/sound/soc/sof/amd/acp-pcm.c b/sound/soc/sof/amd/acp-pcm.c index f342f0bac4a3..0828245bbb99 100644 --- a/sound/soc/sof/amd/acp-pcm.c +++ b/sound/soc/sof/amd/acp-pcm.c @@ -39,6 +39,7 @@ int acp_pcm_hw_params(struct snd_sof_dev *sdev, struct snd_pcm_substream *substr platform_params->use_phy_address = true; platform_params->phy_addr = stream->reg_offset; platform_params->stream_tag = stream->stream_tag; + platform_params->cont_update_posn = 1;
/* write buffer size of stream in scratch memory */
participants (2)
-
Mark Brown
-
V sujith kumar Reddy