Skip to contentSkip to conversation

SOF IMX fixes

PATCH In review Daniel Baluta 2 participants 9 messages Jul 20, 2020 – Jul 22, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover SOF IMX fixes

From: Daniel Baluta <[email protected]>

This patchseries contains a couple of SOF IMX fixes found during our first IMX SOF release.

Daniel Baluta (7):
ASoC: SOF: define INFO_ flags in dsp_ops for imx8
ASoC: SOF: imx: Use ARRAY_SIZE instead of hardcoded value
ASoC: SOF: imx8: Fix ESAI DAI driver name for i.MX8/iMX8X
ASoC: SOF: imx8m: Fix SAI DAI driver for i.MX8M
ASoC: SOF: imx8: Add SAI dai driver for i.MX/i.MX8X
ASoC: SOF: topology: Update SAI config bclk/fsync rate
ASoC: SOF: pcm: Update rate/channels for SAI/ESAI DAIs

 sound/soc/sof/imx/imx8.c  | 24 +++++++++++++++++++++---
 sound/soc/sof/imx/imx8m.c |  4 ++--
 sound/soc/sof/pcm.c       |  8 ++++++++
 sound/soc/sof/topology.c  |  2 ++
 4 files changed, 33 insertions(+), 5 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/7 ASoC: SOF: define INFO_ flags in dsp_ops for imx8

From: Daniel Baluta <[email protected]>

In the past, the INFO_ flags such as PAUSE/NO_PERIOD_WAKEUP were defined in the SOF PCM core, but that was changed since commit 27e322fabd50 ("ASoC: SOF: define INFO_ flags in dsp_ops")

Now these flags must be set in DSP ops.

---
 sound/soc/sof/imx/imx8.c | 7 +++++++
 1 file changed, 7 insertions(+)
sound/soc/sof/imx/imx8.c +7 -0
index a4fa8451d8cb..b558132bb609 100644
@@ -416,6 +416,13 @@ struct snd_sof_dsp_ops sof_imx8_ops = {
 	/* DAI drivers */
 	.drv = imx8_dai,
 	.num_drv = 1, /* we have only 1 ESAI interface on i.MX8 */
+
+	/* ALSA HW info flags */
+	.hw_info =	SNDRV_PCM_INFO_MMAP |
+			SNDRV_PCM_INFO_MMAP_VALID |
+			SNDRV_PCM_INFO_INTERLEAVED |
+			SNDRV_PCM_INFO_PAUSE |
+			SNDRV_PCM_INFO_NO_PERIOD_WAKEUP,
 };
 EXPORT_SYMBOL(sof_imx8_ops);
 
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/7 ASoC: SOF: imx: Use ARRAY_SIZE instead of hardcoded value

In reply to Daniel Baluta

From: Daniel Baluta <[email protected]>

With this change we no longer need to update num_drv when adding new DAI driver.

---
 sound/soc/sof/imx/imx8.c  | 4 ++--
 sound/soc/sof/imx/imx8m.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
sound/soc/sof/imx/imx8.c +2 -2
index b558132bb609..c7aab646cb8e 100644
@@ -415,7 +415,7 @@ struct snd_sof_dsp_ops sof_imx8_ops = {
 
 	/* DAI drivers */
 	.drv = imx8_dai,
-	.num_drv = 1, /* we have only 1 ESAI interface on i.MX8 */
+	.num_drv = ARRAY_SIZE(imx8_dai),
 
 	/* ALSA HW info flags */
 	.hw_info =	SNDRV_PCM_INFO_MMAP |
@@ -455,7 +455,7 @@ struct snd_sof_dsp_ops sof_imx8x_ops = {
 
 	/* DAI drivers */
 	.drv = imx8_dai,
-	.num_drv = 1, /* we have only 1 ESAI interface on i.MX8 */
+	.num_drv = ARRAY_SIZE(imx8_dai),
 
 	/* ALSA HW info flags */
 	.hw_info =	SNDRV_PCM_INFO_MMAP |
sound/soc/sof/imx/imx8m.c +1 -1
index 287114a37688..067d2424c682 100644
@@ -280,7 +280,7 @@ struct snd_sof_dsp_ops sof_imx8m_ops = {
 
 	/* DAI drivers */
 	.drv = imx8m_dai,
-	.num_drv = 1, /* we have only 1 SAI interface on i.MX8M */
+	.num_drv = ARRAY_SIZE(imx8m_dai),
 
 	.hw_info = SNDRV_PCM_INFO_MMAP |
 		SNDRV_PCM_INFO_MMAP_VALID |
Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/7 ASoC: SOF: imx8: Fix ESAI DAI driver name for i.MX8/iMX8X

In reply to Daniel Baluta

From: Daniel Baluta <[email protected]>

This must match DAI name from topology. Also, esai-port is too generic as they are 2 ESAIs on i.MX8/i.MX8X boards.

SOF integration only uses ESAI0 for now.

---
 sound/soc/sof/imx/imx8.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sof/imx/imx8.c +1 -1
index c7aab646cb8e..f1308824e2cd 100644
@@ -374,7 +374,7 @@ static int imx8_ipc_pcm_params(struct snd_sof_dev *sdev,
 
 static struct snd_soc_dai_driver imx8_dai[] = {
 {
-	.name = "esai-port",
+	.name = "esai0",
 	.playback = {
 		.channels_min = 1,
 		.channels_max = 8,
Signature · 1 line
2.17.1
#4 lore raw

PATCH 4/7 ASoC: SOF: imx8m: Fix SAI DAI driver for i.MX8M

In reply to Daniel Baluta

From: Daniel Baluta <[email protected]>

This must match DAI name from topology. Also, sai-port is too generic. Physical DAI port on i.MX8MP is labeled SAI3.

---
 sound/soc/sof/imx/imx8m.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sof/imx/imx8m.c +1 -1
index 067d2424c682..3b9c560cd40f 100644
@@ -239,7 +239,7 @@ static int imx8m_ipc_pcm_params(struct snd_sof_dev *sdev,
 
 static struct snd_soc_dai_driver imx8m_dai[] = {
 {
-	.name = "sai-port",
+	.name = "sai3",
 	.playback = {
 		.channels_min = 1,
 		.channels_max = 32,
Signature · 1 line
2.17.1
#5 lore raw

PATCH 5/7 ASoC: SOF: imx8: Add SAI dai driver for i.MX/i.MX8X

In reply to Daniel Baluta

From: Daniel Baluta <[email protected]>

With SOF we support 1 ESAI interface and 1 SAI interface. This patch adds SAI1 interface support existing on i.MX8/i.MX8X boards.

---
 sound/soc/sof/imx/imx8.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
sound/soc/sof/imx/imx8.c +11 -0
index f1308824e2cd..bc0628c7b88c 100644
@@ -384,6 +384,17 @@ static struct snd_soc_dai_driver imx8_dai[] = {
 		.channels_max = 8,
 	},
 },
+{
+	.name = "sai1",
+	.playback = {
+		.channels_min = 1,
+		.channels_max = 32,
+	},
+	.capture = {
+		.channels_min = 1,
+		.channels_max = 32,
+	},
+},
 };
 
 /* i.MX8 ops */
Signature · 1 line
2.17.1
#6 lore raw

PATCH 6/7 ASoC: SOF: topology: Update SAI config bclk/fsync rate

In reply to Daniel Baluta

From: Daniel Baluta <[email protected]>

These parameters are read from topology file and sent to DSP.

---
 sound/soc/sof/topology.c | 2 ++
 1 file changed, 2 insertions(+)
sound/soc/sof/topology.c +2 -0
index 6a9703e5ff60..13e10a0c0b05 100644
@@ -2831,6 +2831,8 @@ static int sof_link_sai_load(struct snd_soc_component *scomp, int index,
 	}
 
 	config->sai.mclk_rate = le32_to_cpu(hw_config->mclk_rate);
+	config->sai.bclk_rate = le32_to_cpu(hw_config->bclk_rate);
+	config->sai.fsync_rate = le32_to_cpu(hw_config->fsync_rate);
 	config->sai.mclk_direction = hw_config->mclk_direction;
 
 	config->sai.tdm_slots = le32_to_cpu(hw_config->tdm_slots);
Signature · 1 line
2.17.1
#7 lore raw

PATCH 7/7 ASoC: SOF: pcm: Update rate/channels for SAI/ESAI DAIs

In reply to Daniel Baluta

From: Daniel Baluta <[email protected]>

Fixup BE DAI links rate/channels parameters to match any values from topology.

---
 sound/soc/sof/pcm.c | 8 ++++++++
 1 file changed, 8 insertions(+)
sound/soc/sof/pcm.c +8 -0
index 22fe9d5e932b..5cfd2611b252 100644
@@ -718,17 +718,25 @@ static int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd,
 		/* do nothing for ALH dai_link */
 		break;
 	case SOF_DAI_IMX_ESAI:
+		rate->min = dai->dai_config->esai.fsync_rate;
+		rate->max = dai->dai_config->esai.fsync_rate;
 		channels->min = dai->dai_config->esai.tdm_slots;
 		channels->max = dai->dai_config->esai.tdm_slots;
 
+		dev_dbg(component->dev,
+			"rate_min: %d rate_max: %d\n", rate->min, rate->max);
 		dev_dbg(component->dev,
 			"channels_min: %d channels_max: %d\n",
 			channels->min, channels->max);
 		break;
 	case SOF_DAI_IMX_SAI:
+		rate->min = dai->dai_config->sai.fsync_rate;
+		rate->max = dai->dai_config->sai.fsync_rate;
 		channels->min = dai->dai_config->sai.tdm_slots;
 		channels->max = dai->dai_config->sai.tdm_slots;
 
+		dev_dbg(component->dev,
+			"rate_min: %d rate_max: %d\n", rate->min, rate->max);
 		dev_dbg(component->dev,
 			"channels_min: %d channels_max: %d\n",
 			channels->min, channels->max);
Signature · 1 line
2.17.1
maintainer
#8 lore raw
In reply to Daniel Baluta
Quoted 12 lines · Daniel Baluta

This patchseries contains a couple of SOF IMX fixes found during our first IMX SOF release.

Daniel Baluta (7):
ASoC: SOF: define INFO_ flags in dsp_ops for imx8
ASoC: SOF: imx: Use ARRAY_SIZE instead of hardcoded value
ASoC: SOF: imx8: Fix ESAI DAI driver name for i.MX8/iMX8X
ASoC: SOF: imx8m: Fix SAI DAI driver for i.MX8M
ASoC: SOF: imx8: Add SAI dai driver for i.MX/i.MX8X
ASoC: SOF: topology: Update SAI config bclk/fsync rate
ASoC: SOF: pcm: Update rate/channels for SAI/ESAI DAIs

Quoted 1 line

[...]

Applied to

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

Thanks!

[1/7] ASoC: SOF: define INFO_ flags in dsp_ops for imx8

      commit: 45b7262174dcc2ca62e23220219eee1462dcada9
[2/7] ASoC: SOF: imx: Use ARRAY_SIZE instead of hardcoded value
      commit: beaa7bd10dce348b033aff3f466ab1a78b33fed3
[3/7] ASoC: SOF: imx8: Fix ESAI DAI driver name for i.MX8/iMX8X
      commit: bcba2c9d62f391cd2cd6acb7f658d47bfb10e8b9
[4/7] ASoC: SOF: imx8m: Fix SAI DAI driver for i.MX8M
      commit: f23a8e9402f899e3555ac8aff3d3d050adafe39e
[5/7] ASoC: SOF: imx8: Add SAI dai driver for i.MX/i.MX8X
      commit: 68f56f618c3fbc4b1af0428f715f952cdada7a54
[6/7] ASoC: SOF: topology: Update SAI config bclk/fsync rate
      commit: 72bb9564fd97cd4f6dec88c8363acc3ab642673f
[7/7] ASoC: SOF: pcm: Update rate/channels for SAI/ESAI DAIs
      commit: 51b0243aefaa554ca57817562da8eb269280d4ae

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