* [PATCH] ASoC: SOF: mediatek: add pcm_pointer callback for mt8186
@ 2022-09-21 12:02 Chunxu Li
2022-09-21 12:17 ` AngeloGioacchino Del Regno
2022-09-22 11:29 ` Mark Brown
0 siblings, 2 replies; 4+ messages in thread
From: Chunxu Li @ 2022-09-21 12:02 UTC (permalink / raw)
To: broonie, pierre-louis.bossart, peter.ujfalusi, lgirdwood,
angelogioacchino.delregno, daniel.baluta
Cc: matthias.bgg, yc.hung, linux-kernel, alsa-devel,
sound-open-firmware, linux-arm-kernel, linux-mediatek,
project_global_chrome_upstream_group, Chunxu Li
add pcm_pointer callback for mt8186 to support read
host position from DSP
Signed-off-by: Chunxu Li <chunxu.li@mediatek.com>
---
sound/soc/sof/mediatek/mt8186/mt8186.c | 33 ++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/sound/soc/sof/mediatek/mt8186/mt8186.c b/sound/soc/sof/mediatek/mt8186/mt8186.c
index 9ec89fc7fec0..181189e00e02 100644
--- a/sound/soc/sof/mediatek/mt8186/mt8186.c
+++ b/sound/soc/sof/mediatek/mt8186/mt8186.c
@@ -470,6 +470,38 @@ static int mt8186_pcm_hw_params(struct snd_sof_dev *sdev,
return 0;
}
+static snd_pcm_uframes_t mt8186_pcm_pointer(struct snd_sof_dev *sdev,
+ struct snd_pcm_substream *substream)
+{
+ int ret;
+ snd_pcm_uframes_t pos;
+ struct snd_sof_pcm *spcm;
+ struct sof_ipc_stream_posn posn;
+ struct snd_sof_pcm_stream *stream;
+ struct snd_soc_component *scomp = sdev->component;
+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
+
+ 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->substream, &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;
+}
+
static struct snd_soc_dai_driver mt8186_dai[] = {
{
.name = "SOF_DL1",
@@ -537,6 +569,7 @@ static struct snd_sof_dsp_ops sof_mt8186_ops = {
/* stream callbacks */
.pcm_open = sof_stream_pcm_open,
.pcm_hw_params = mt8186_pcm_hw_params,
+ .pcm_pointer = mt8186_pcm_pointer,
.pcm_close = sof_stream_pcm_close,
/* firmware loading */
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: SOF: mediatek: add pcm_pointer callback for mt8186
2022-09-21 12:02 [PATCH] ASoC: SOF: mediatek: add pcm_pointer callback for mt8186 Chunxu Li
@ 2022-09-21 12:17 ` AngeloGioacchino Del Regno
2022-09-22 1:42 ` chunxu.li
2022-09-22 11:29 ` Mark Brown
1 sibling, 1 reply; 4+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-09-21 12:17 UTC (permalink / raw)
To: Chunxu Li, broonie, pierre-louis.bossart, peter.ujfalusi,
lgirdwood, daniel.baluta
Cc: matthias.bgg, yc.hung, linux-kernel, alsa-devel,
sound-open-firmware, linux-arm-kernel, linux-mediatek,
project_global_chrome_upstream_group
Il 21/09/22 14:02, Chunxu Li ha scritto:
> add pcm_pointer callback for mt8186 to support read
> host position from DSP
>
> Signed-off-by: Chunxu Li <chunxu.li@mediatek.com>
Hello Chunxu,
Can you please also add this, along with the .pcm_hw_params callback to mt8195.c?
Anyway, for this one:
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: SOF: mediatek: add pcm_pointer callback for mt8186
2022-09-21 12:17 ` AngeloGioacchino Del Regno
@ 2022-09-22 1:42 ` chunxu.li
0 siblings, 0 replies; 4+ messages in thread
From: chunxu.li @ 2022-09-22 1:42 UTC (permalink / raw)
To: AngeloGioacchino Del Regno, broonie, pierre-louis.bossart,
peter.ujfalusi, lgirdwood, daniel.baluta
Cc: matthias.bgg, yc.hung, linux-kernel, alsa-devel,
sound-open-firmware, linux-arm-kernel, linux-mediatek,
project_global_chrome_upstream_group
On Wed, 2022-09-21 at 14:17 +0200, AngeloGioacchino Del Regno wrote:
> Il 21/09/22 14:02, Chunxu Li ha scritto:
> > add pcm_pointer callback for mt8186 to support read
> > host position from DSP
> >
> > Signed-off-by: Chunxu Li <chunxu.li@mediatek.com>
>
> Hello Chunxu,
> Can you please also add this, along with the .pcm_hw_params callback
> to mt8195.c?
>
> Anyway, for this one:
>
> Reviewed-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno@collabora.com>
>
Sure, certainly.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: SOF: mediatek: add pcm_pointer callback for mt8186
2022-09-21 12:02 [PATCH] ASoC: SOF: mediatek: add pcm_pointer callback for mt8186 Chunxu Li
2022-09-21 12:17 ` AngeloGioacchino Del Regno
@ 2022-09-22 11:29 ` Mark Brown
1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2022-09-22 11:29 UTC (permalink / raw)
To: pierre-louis.bossart, lgirdwood, angelogioacchino.delregno,
Chunxu Li, daniel.baluta, peter.ujfalusi
Cc: yc.hung, project_global_chrome_upstream_group, alsa-devel,
linux-kernel, sound-open-firmware, matthias.bgg, linux-mediatek,
linux-arm-kernel
On Wed, 21 Sep 2022 20:02:39 +0800, Chunxu Li wrote:
> add pcm_pointer callback for mt8186 to support read
> host position from DSP
>
>
Applied to
broonie/sound.git for-next
Thanks!
[1/1] ASoC: SOF: mediatek: add pcm_pointer callback for mt8186
commit: a921986f445ad611b441c8ee7749dc6dfc770481
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-09-22 11:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-21 12:02 [PATCH] ASoC: SOF: mediatek: add pcm_pointer callback for mt8186 Chunxu Li
2022-09-21 12:17 ` AngeloGioacchino Del Regno
2022-09-22 1:42 ` chunxu.li
2022-09-22 11:29 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).