linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] ASoC: Fixes for MT8195 SOF support
@ 2022-09-06  9:27 AngeloGioacchino Del Regno
  2022-09-06  9:27 ` [PATCH 1/5] ASoC: mediatek: mt8195-mt6359: Properly register sound card for SOF AngeloGioacchino Del Regno
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-09-06  9:27 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, perex, tiwai, matthias.bgg, wenst,
	pierre-louis.bossart, peter.ujfalusi, yung-chuan.liao,
	ranjani.sridharan, kai.vehmanen, daniel.baluta, trevor.wu,
	tzungbi, angelogioacchino.delregno, yc.hung, Allen-KH.Cheng,
	geert, chunxu.li, alsa-devel, linux-arm-kernel, linux-mediatek,
	linux-kernel, sound-open-firmware, kernel

This series fixes Sound Open Firmware support for MT8195 by making
sure that the sound card driver is actually able to probe and IPC
can finally happen.
It is now possible to get DSP support for audio.

Tested on MT8195 Tomato - Acer Chromebook Spin 513 CP513-2H (Pipewire).

AngeloGioacchino Del Regno (5):
  ASoC: mediatek: mt8195-mt6359: Properly register sound card for SOF
  ASoC: SOF: mediatek: mt8195: Import namespace SND_SOC_SOF_MTK_COMMON
  ASoC: SOF: mediatek: mt8195: Add mailbox generic callbacks for IPC
  ASoC: SOF: mediatek: mt8195: Add generic pcm_{open,close} callbacks
  ASoC: SOF: mediatek: mt8195: Add devicetree support to select
    topologies

 sound/soc/mediatek/mt8195/mt8195-mt6359.c |  6 +++++
 sound/soc/sof/mediatek/mt8195/mt8195.c    | 32 ++++++++++++++++-------
 2 files changed, 29 insertions(+), 9 deletions(-)

-- 
2.37.2


_______________________________________________
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] 7+ messages in thread

* [PATCH 1/5] ASoC: mediatek: mt8195-mt6359: Properly register sound card for SOF
  2022-09-06  9:27 [PATCH 0/5] ASoC: Fixes for MT8195 SOF support AngeloGioacchino Del Regno
@ 2022-09-06  9:27 ` AngeloGioacchino Del Regno
  2022-09-06  9:27 ` [PATCH 2/5] ASoC: SOF: mediatek: mt8195: Import namespace SND_SOC_SOF_MTK_COMMON AngeloGioacchino Del Regno
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-09-06  9:27 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, perex, tiwai, matthias.bgg, wenst,
	pierre-louis.bossart, peter.ujfalusi, yung-chuan.liao,
	ranjani.sridharan, kai.vehmanen, daniel.baluta, trevor.wu,
	tzungbi, angelogioacchino.delregno, yc.hung, Allen-KH.Cheng,
	geert, chunxu.li, alsa-devel, linux-arm-kernel, linux-mediatek,
	linux-kernel, sound-open-firmware, kernel

Adding a probe callback on this snd_soc_card is required when
Sound Open Firmware support is desired, as we need to appropriately
populate the stream_name for SOF to be able to bind widgets.
Failing to do so will produce errors when applying the SOF topology
leading to card registration failure (so, no sound).
While at it, also make sure to fill the topology_shortname as required.

Fixes: 0caf1120c583 ("ASoC: mediatek: mt8195: extract SOF common code")
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 sound/soc/mediatek/mt8195/mt8195-mt6359.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sound/soc/mediatek/mt8195/mt8195-mt6359.c b/sound/soc/mediatek/mt8195/mt8195-mt6359.c
index c530e3fc27e4..961e769602d6 100644
--- a/sound/soc/mediatek/mt8195/mt8195-mt6359.c
+++ b/sound/soc/mediatek/mt8195/mt8195-mt6359.c
@@ -1383,7 +1383,13 @@ static int mt8195_mt6359_dev_probe(struct platform_device *pdev)
 		sof_priv->num_streams = ARRAY_SIZE(g_sof_conn_streams);
 		sof_priv->sof_dai_link_fixup = mt8195_dai_link_fixup;
 		soc_card_data->sof_priv = sof_priv;
+		card->probe = mtk_sof_card_probe;
 		card->late_probe = mtk_sof_card_late_probe;
+		if (!card->topology_shortname_created) {
+			snprintf(card->topology_shortname, 32, "sof-%s", card->name);
+			card->topology_shortname_created = true;
+		}
+		card->name = card->topology_shortname;
 		sof_on = 1;
 	}
 
-- 
2.37.2


_______________________________________________
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] 7+ messages in thread

* [PATCH 2/5] ASoC: SOF: mediatek: mt8195: Import namespace SND_SOC_SOF_MTK_COMMON
  2022-09-06  9:27 [PATCH 0/5] ASoC: Fixes for MT8195 SOF support AngeloGioacchino Del Regno
  2022-09-06  9:27 ` [PATCH 1/5] ASoC: mediatek: mt8195-mt6359: Properly register sound card for SOF AngeloGioacchino Del Regno
@ 2022-09-06  9:27 ` AngeloGioacchino Del Regno
  2022-09-06  9:27 ` [PATCH 3/5] ASoC: SOF: mediatek: mt8195: Add mailbox generic callbacks for IPC AngeloGioacchino Del Regno
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-09-06  9:27 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, perex, tiwai, matthias.bgg, wenst,
	pierre-louis.bossart, peter.ujfalusi, yung-chuan.liao,
	ranjani.sridharan, kai.vehmanen, daniel.baluta, trevor.wu,
	tzungbi, angelogioacchino.delregno, yc.hung, Allen-KH.Cheng,
	geert, chunxu.li, alsa-devel, linux-arm-kernel, linux-mediatek,
	linux-kernel, sound-open-firmware, kernel

Here we're using function mtk_adsp_dump() from mtk-adsp-common:
explicitly import its namespace.

Fixes: 3a054f90e955 ("ASoC: SOF: mediatek: Add mt8195 debug dump")
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 sound/soc/sof/mediatek/mt8195/mt8195.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/sof/mediatek/mt8195/mt8195.c b/sound/soc/sof/mediatek/mt8195/mt8195.c
index 9c146015cd1b..ff575de7e46a 100644
--- a/sound/soc/sof/mediatek/mt8195/mt8195.c
+++ b/sound/soc/sof/mediatek/mt8195/mt8195.c
@@ -652,4 +652,5 @@ static struct platform_driver snd_sof_of_mt8195_driver = {
 module_platform_driver(snd_sof_of_mt8195_driver);
 
 MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA);
+MODULE_IMPORT_NS(SND_SOC_SOF_MTK_COMMON);
 MODULE_LICENSE("Dual BSD/GPL");
-- 
2.37.2


_______________________________________________
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] 7+ messages in thread

* [PATCH 3/5] ASoC: SOF: mediatek: mt8195: Add mailbox generic callbacks for IPC
  2022-09-06  9:27 [PATCH 0/5] ASoC: Fixes for MT8195 SOF support AngeloGioacchino Del Regno
  2022-09-06  9:27 ` [PATCH 1/5] ASoC: mediatek: mt8195-mt6359: Properly register sound card for SOF AngeloGioacchino Del Regno
  2022-09-06  9:27 ` [PATCH 2/5] ASoC: SOF: mediatek: mt8195: Import namespace SND_SOC_SOF_MTK_COMMON AngeloGioacchino Del Regno
@ 2022-09-06  9:27 ` AngeloGioacchino Del Regno
  2022-09-06  9:27 ` [PATCH 4/5] ASoC: SOF: mediatek: mt8195: Add generic pcm_{open,close} callbacks AngeloGioacchino Del Regno
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-09-06  9:27 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, perex, tiwai, matthias.bgg, wenst,
	pierre-louis.bossart, peter.ujfalusi, yung-chuan.liao,
	ranjani.sridharan, kai.vehmanen, daniel.baluta, trevor.wu,
	tzungbi, angelogioacchino.delregno, yc.hung, Allen-KH.Cheng,
	geert, chunxu.li, alsa-devel, linux-arm-kernel, linux-mediatek,
	linux-kernel, sound-open-firmware, kernel

Add the .mailbox_{read,write} generic callbacks for SOF IPC and, while
at it, also change the ipc_msg_data callback to use the SOF API
sof_ipc_msg_data() instead of the custom function mt8195_ipc_msg_data().

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 sound/soc/sof/mediatek/mt8195/mt8195.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/sound/soc/sof/mediatek/mt8195/mt8195.c b/sound/soc/sof/mediatek/mt8195/mt8195.c
index ff575de7e46a..68747ee21c6f 100644
--- a/sound/soc/sof/mediatek/mt8195/mt8195.c
+++ b/sound/soc/sof/mediatek/mt8195/mt8195.c
@@ -496,14 +496,6 @@ static int mt8195_get_bar_index(struct snd_sof_dev *sdev, u32 type)
 	return type;
 }
 
-static int mt8195_ipc_msg_data(struct snd_sof_dev *sdev,
-			       struct snd_pcm_substream *substream,
-			       void *p, size_t sz)
-{
-	sof_mailbox_read(sdev, sdev->dsp_box.offset, p, sz);
-	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;
@@ -574,6 +566,10 @@ static struct snd_sof_dsp_ops sof_mt8195_ops = {
 	.block_read	= sof_block_read,
 	.block_write	= sof_block_write,
 
+	/* Mailbox IO */
+	.mailbox_read	= sof_mailbox_read,
+	.mailbox_write	= sof_mailbox_write,
+
 	/* Register IO */
 	.write		= sof_io_write,
 	.read		= sof_io_read,
@@ -584,7 +580,7 @@ static struct snd_sof_dsp_ops sof_mt8195_ops = {
 	.send_msg		= mt8195_send_msg,
 	.get_mailbox_offset	= mt8195_get_mailbox_offset,
 	.get_window_offset	= mt8195_get_window_offset,
-	.ipc_msg_data		= mt8195_ipc_msg_data,
+	.ipc_msg_data		= sof_ipc_msg_data,
 	.set_stream_data_offset = sof_set_stream_data_offset,
 
 	/* misc */
-- 
2.37.2


_______________________________________________
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] 7+ messages in thread

* [PATCH 4/5] ASoC: SOF: mediatek: mt8195: Add generic pcm_{open,close} callbacks
  2022-09-06  9:27 [PATCH 0/5] ASoC: Fixes for MT8195 SOF support AngeloGioacchino Del Regno
                   ` (2 preceding siblings ...)
  2022-09-06  9:27 ` [PATCH 3/5] ASoC: SOF: mediatek: mt8195: Add mailbox generic callbacks for IPC AngeloGioacchino Del Regno
@ 2022-09-06  9:27 ` AngeloGioacchino Del Regno
  2022-09-06  9:27 ` [PATCH 5/5] ASoC: SOF: mediatek: mt8195: Add devicetree support to select topologies AngeloGioacchino Del Regno
  2022-09-07 14:29 ` [PATCH 0/5] ASoC: Fixes for MT8195 SOF support Mark Brown
  5 siblings, 0 replies; 7+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-09-06  9:27 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, perex, tiwai, matthias.bgg, wenst,
	pierre-louis.bossart, peter.ujfalusi, yung-chuan.liao,
	ranjani.sridharan, kai.vehmanen, daniel.baluta, trevor.wu,
	tzungbi, angelogioacchino.delregno, yc.hung, Allen-KH.Cheng,
	geert, chunxu.li, alsa-devel, linux-arm-kernel, linux-mediatek,
	linux-kernel, sound-open-firmware, kernel

Use the generic sof_stream_pcm_{open,close}() functions for the
pcm_{open,close} callbacks.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 sound/soc/sof/mediatek/mt8195/mt8195.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/soc/sof/mediatek/mt8195/mt8195.c b/sound/soc/sof/mediatek/mt8195/mt8195.c
index 68747ee21c6f..c1590e78edd4 100644
--- a/sound/soc/sof/mediatek/mt8195/mt8195.c
+++ b/sound/soc/sof/mediatek/mt8195/mt8195.c
@@ -586,6 +586,10 @@ static struct snd_sof_dsp_ops sof_mt8195_ops = {
 	/* misc */
 	.get_bar_index	= mt8195_get_bar_index,
 
+	/* stream callbacks */
+	.pcm_open	= sof_stream_pcm_open,
+	.pcm_close	= sof_stream_pcm_close,
+
 	/* firmware loading */
 	.load_firmware	= snd_sof_load_firmware_memcpy,
 
-- 
2.37.2


_______________________________________________
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] 7+ messages in thread

* [PATCH 5/5] ASoC: SOF: mediatek: mt8195: Add devicetree support to select topologies
  2022-09-06  9:27 [PATCH 0/5] ASoC: Fixes for MT8195 SOF support AngeloGioacchino Del Regno
                   ` (3 preceding siblings ...)
  2022-09-06  9:27 ` [PATCH 4/5] ASoC: SOF: mediatek: mt8195: Add generic pcm_{open,close} callbacks AngeloGioacchino Del Regno
@ 2022-09-06  9:27 ` AngeloGioacchino Del Regno
  2022-09-07 14:29 ` [PATCH 0/5] ASoC: Fixes for MT8195 SOF support Mark Brown
  5 siblings, 0 replies; 7+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-09-06  9:27 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, perex, tiwai, matthias.bgg, wenst,
	pierre-louis.bossart, peter.ujfalusi, yung-chuan.liao,
	ranjani.sridharan, kai.vehmanen, daniel.baluta, trevor.wu,
	tzungbi, angelogioacchino.delregno, yc.hung, Allen-KH.Cheng,
	geert, chunxu.li, alsa-devel, linux-arm-kernel, linux-mediatek,
	linux-kernel, sound-open-firmware, kernel

Support devicetree by adding a snd_soc_of_mach array, specifying SOF
topologies for a generic MT8195 machine and for Google Tomato
Chromebooks.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 sound/soc/sof/mediatek/mt8195/mt8195.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/sound/soc/sof/mediatek/mt8195/mt8195.c b/sound/soc/sof/mediatek/mt8195/mt8195.c
index c1590e78edd4..8e359c296308 100644
--- a/sound/soc/sof/mediatek/mt8195/mt8195.c
+++ b/sound/soc/sof/mediatek/mt8195/mt8195.c
@@ -615,7 +615,20 @@ static struct snd_sof_dsp_ops sof_mt8195_ops = {
 			SNDRV_PCM_INFO_NO_PERIOD_WAKEUP,
 };
 
+static struct snd_sof_of_mach sof_mt8195_machs[] = {
+	{
+		.compatible = "google,tomato",
+		.sof_tplg_filename = "sof-mt8195-mt6359-rt1019-rt5682-dts.tplg"
+	}, {
+		.compatible = "mediatek,mt8195",
+		.sof_tplg_filename = "sof-mt8195.tplg"
+	}, {
+		/* sentinel */
+	}
+};
+
 static const struct sof_dev_desc sof_of_mt8195_desc = {
+	.of_machines = sof_mt8195_machs,
 	.ipc_supported_mask	= BIT(SOF_IPC),
 	.ipc_default		= SOF_IPC,
 	.default_fw_path = {
-- 
2.37.2


_______________________________________________
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] 7+ messages in thread

* Re: [PATCH 0/5] ASoC: Fixes for MT8195 SOF support
  2022-09-06  9:27 [PATCH 0/5] ASoC: Fixes for MT8195 SOF support AngeloGioacchino Del Regno
                   ` (4 preceding siblings ...)
  2022-09-06  9:27 ` [PATCH 5/5] ASoC: SOF: mediatek: mt8195: Add devicetree support to select topologies AngeloGioacchino Del Regno
@ 2022-09-07 14:29 ` Mark Brown
  5 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2022-09-07 14:29 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: pierre-louis.bossart, yc.hung, ranjani.sridharan, Allen-KH.Cheng,
	trevor.wu, perex, matthias.bgg, lgirdwood, geert, alsa-devel,
	linux-kernel, daniel.baluta, chunxu.li, linux-mediatek,
	linux-arm-kernel, kai.vehmanen, yung-chuan.liao,
	sound-open-firmware, kernel, peter.ujfalusi, wenst, tzungbi,
	tiwai

On Tue, 6 Sep 2022 11:27:22 +0200, AngeloGioacchino Del Regno wrote:
> This series fixes Sound Open Firmware support for MT8195 by making
> sure that the sound card driver is actually able to probe and IPC
> can finally happen.
> It is now possible to get DSP support for audio.
> 
> Tested on MT8195 Tomato - Acer Chromebook Spin 513 CP513-2H (Pipewire).
> 
> [...]

Applied to

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

Thanks!

[1/5] ASoC: mediatek: mt8195-mt6359: Properly register sound card for SOF
      commit: 64ec924c781ee846bd469be8d1d6bbed78c0f439
[2/5] ASoC: SOF: mediatek: mt8195: Import namespace SND_SOC_SOF_MTK_COMMON
      commit: 404bec4c8f6c38ae5fa208344f1086d38026e93d
[3/5] ASoC: SOF: mediatek: mt8195: Add mailbox generic callbacks for IPC
      commit: c2186a9b3a98f1ff814996aa52a019158bfad9c9
[4/5] ASoC: SOF: mediatek: mt8195: Add generic pcm_{open,close} callbacks
      commit: cf84edeeb95ee8e76f12bb02a7444876d031bea7
[5/5] ASoC: SOF: mediatek: mt8195: Add devicetree support to select topologies
      commit: 8a7d5d85ed2161869452ddb9ec45345dad665f52

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] 7+ messages in thread

end of thread, other threads:[~2022-09-07 14:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-06  9:27 [PATCH 0/5] ASoC: Fixes for MT8195 SOF support AngeloGioacchino Del Regno
2022-09-06  9:27 ` [PATCH 1/5] ASoC: mediatek: mt8195-mt6359: Properly register sound card for SOF AngeloGioacchino Del Regno
2022-09-06  9:27 ` [PATCH 2/5] ASoC: SOF: mediatek: mt8195: Import namespace SND_SOC_SOF_MTK_COMMON AngeloGioacchino Del Regno
2022-09-06  9:27 ` [PATCH 3/5] ASoC: SOF: mediatek: mt8195: Add mailbox generic callbacks for IPC AngeloGioacchino Del Regno
2022-09-06  9:27 ` [PATCH 4/5] ASoC: SOF: mediatek: mt8195: Add generic pcm_{open,close} callbacks AngeloGioacchino Del Regno
2022-09-06  9:27 ` [PATCH 5/5] ASoC: SOF: mediatek: mt8195: Add devicetree support to select topologies AngeloGioacchino Del Regno
2022-09-07 14:29 ` [PATCH 0/5] ASoC: Fixes for MT8195 SOF support 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).