2022-09-24 04:10:42

by Chunxu Li

[permalink] [raw]
Subject: [PATCH 0/2] ASoC: SOF: mediatek: mt8195: Add dsp_ops callback

ASoC: SOF: mediatek: mt8195: Add pcm_{hw_params,pointer} callback

Chunxu Li (2):
ASoC: SOF: mediatek: mt8195: Add pcm_hw_params callback
ASoC: SOF: mediatek: mt8195: Add pcm_pointer callback

sound/soc/sof/mediatek/mt8195/mt8195.c | 44 ++++++++++++++++++++++++++
1 file changed, 44 insertions(+)

--
2.25.1


2022-09-24 04:23:12

by Chunxu Li

[permalink] [raw]
Subject: [PATCH 1/2] ASoC: SOF: mediatek: mt8195: Add pcm_hw_params callback

Add pcm_hw_params callback for mt8195 to support continue
update dma host position

Signed-off-by: Chunxu Li <[email protected]>
---
sound/soc/sof/mediatek/mt8195/mt8195.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/sound/soc/sof/mediatek/mt8195/mt8195.c b/sound/soc/sof/mediatek/mt8195/mt8195.c
index c12192c8a6f8..882fde741cf5 100644
--- a/sound/soc/sof/mediatek/mt8195/mt8195.c
+++ b/sound/soc/sof/mediatek/mt8195/mt8195.c
@@ -496,6 +496,16 @@ static int mt8195_get_bar_index(struct snd_sof_dev *sdev, u32 type)
return type;
}

+static int mt8195_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)
+{
+ platform_params->cont_update_posn = 1;
+
+ return 0;
+}
+
static void mt8195_adsp_dump(struct snd_sof_dev *sdev, u32 flags)
{
u32 dbg_pc, dbg_data, dbg_bus0, dbg_bus1, dbg_inst;
@@ -588,6 +598,7 @@ static struct snd_sof_dsp_ops sof_mt8195_ops = {

/* stream callbacks */
.pcm_open = sof_stream_pcm_open,
+ .pcm_hw_params = mt8195_pcm_hw_params,
.pcm_close = sof_stream_pcm_close,

/* firmware loading */
--
2.25.1

2022-09-24 04:23:13

by Chunxu Li

[permalink] [raw]
Subject: [PATCH 2/2] ASoC: SOF: mediatek: mt8195: Add pcm_pointer callback

Add pcm_pointer callback for mt8195 to support read
host position from DSP

Signed-off-by: Chunxu Li <[email protected]>
---
sound/soc/sof/mediatek/mt8195/mt8195.c | 33 ++++++++++++++++++++++++++
1 file changed, 33 insertions(+)

diff --git a/sound/soc/sof/mediatek/mt8195/mt8195.c b/sound/soc/sof/mediatek/mt8195/mt8195.c
index 882fde741cf5..3c81e84fcecf 100644
--- a/sound/soc/sof/mediatek/mt8195/mt8195.c
+++ b/sound/soc/sof/mediatek/mt8195/mt8195.c
@@ -506,6 +506,38 @@ static int mt8195_pcm_hw_params(struct snd_sof_dev *sdev,
return 0;
}

+static snd_pcm_uframes_t mt8195_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 void mt8195_adsp_dump(struct snd_sof_dev *sdev, u32 flags)
{
u32 dbg_pc, dbg_data, dbg_bus0, dbg_bus1, dbg_inst;
@@ -599,6 +631,7 @@ static struct snd_sof_dsp_ops sof_mt8195_ops = {
/* stream callbacks */
.pcm_open = sof_stream_pcm_open,
.pcm_hw_params = mt8195_pcm_hw_params,
+ .pcm_pointer = mt8195_pcm_pointer,
.pcm_close = sof_stream_pcm_close,

/* firmware loading */
--
2.25.1

Subject: Re: [PATCH 2/2] ASoC: SOF: mediatek: mt8195: Add pcm_pointer callback

Il 24/09/22 05:35, Chunxu Li ha scritto:
> Add pcm_pointer callback for mt8195 to support read
> host position from DSP
>
> Signed-off-by: Chunxu Li <[email protected]>

Reviewed-by: AngeloGioacchino Del Regno <[email protected]>


Subject: Re: [PATCH 1/2] ASoC: SOF: mediatek: mt8195: Add pcm_hw_params callback

Il 24/09/22 05:35, Chunxu Li ha scritto:
> Add pcm_hw_params callback for mt8195 to support continue
> update dma host position
>
> Signed-off-by: Chunxu Li <[email protected]>

Reviewed-by: AngeloGioacchino Del Regno <[email protected]>


2022-09-27 12:21:44

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 0/2] ASoC: SOF: mediatek: mt8195: Add dsp_ops callback

On Sat, 24 Sep 2022 11:35:57 +0800, Chunxu Li wrote:
> ASoC: SOF: mediatek: mt8195: Add pcm_{hw_params,pointer} callback
>
> Chunxu Li (2):
> ASoC: SOF: mediatek: mt8195: Add pcm_hw_params callback
> ASoC: SOF: mediatek: mt8195: Add pcm_pointer callback
>
> sound/soc/sof/mediatek/mt8195/mt8195.c | 44 ++++++++++++++++++++++++++
> 1 file changed, 44 insertions(+)
>
> [...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/2] ASoC: SOF: mediatek: mt8195: Add pcm_hw_params callback
commit: 978a7144ae8497b40d833a3c0110b18810499f95
[2/2] ASoC: SOF: mediatek: mt8195: Add pcm_pointer callback
commit: f7c91bf65388547f61888b7a67169966fc698ce1

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