[Sound-open-firmware] [PATCH v2 0/2] Introduce sof_of_machine_select

chunxu.li chunxu.li at mediatek.com
Fri Sep 2 05:57:51 CEST 2022


On Tue, 2022-08-23 at 19:50 +0100, Mark Brown wrote:
> On Fri, 5 Aug 2022 15:04:47 +0800, Chunxu Li wrote:
> > From: "chunxu.li" <chunxu.li at mediatek.com>
> > 
> > Change since v1:
> >   - remove the callback of_machine_select defined in sof-priv.h
> >   - move sof_of_machine_select to common code, and called in
> >     sof_machine_check
> >   - rename .board field to .compatible in structure snd_sof_of_mach
> > 
> > [...]
> 
> Applied to
> 
>    
> https://urldefense.com/v3/__https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git__;!!CTRNKA9wMg0ARbw!wdXixJVRiZEF4J6bn68hzN7GZ5gAa67otOgycstenmVEsECqFl08ZMVP2aJBGVuvQg$
>   for-next
> 
> Thanks!
> 
> [1/2] ASoC: SOF: Introduce function sof_of_machine_select
>       commit: 6ace85b9838dc0162b474dbbbb6b388e7561f6a7
> [2/2] ASoC: SOF: mediatek: Add sof_mt8186_machs for mt8186
>       commit: 2dec9e09e955dfc4b7843fa4f9c09e7ee8931b1d
> 
> 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

Hi Mark,

It looks like the patch didn't applied success.

The patch link is 
https://patchwork.kernel.org/project/alsa-devel/patch/20220805070449.6611-2-chunxu.li@mediatek.com/

the merged link is 
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/commit/?id=6ace85b9838dc0162b474dbbbb6b388e7561f6a7

In sound/soc/sof/sof-audio.c the changes are:

 #include <linux/bitfield.h>
 #include "sof-audio.h"
+#include "sof-of-dev.h"
 #include "ops.h"
 
 static void sof_reset_route_setup_status(struct snd_sof_dev *sdev,
struct
 snd_sof_widget *widget)
@@ -784,6 +785,28 @@  int sof_dai_get_bclk(struct snd_soc_pcm_runtime
*rtd)
 }
 EXPORT_SYMBOL(sof_dai_get_bclk);
 
+static struct snd_sof_of_mach *sof_of_machine_select(struct
snd_sof_dev
 *sdev)
+{
+	struct snd_sof_pdata *sof_pdata = sdev->pdata;
+	const struct sof_dev_desc *desc = sof_pdata->desc;
+	struct snd_sof_of_mach *mach = desc->of_machines;
+
+	if (!mach)
+		return NULL;
+
+	for (; mach->compatible; mach++) {
+		if (of_machine_is_compatible(mach->compatible)) {
+			sof_pdata->tplg_filename = mach-
>sof_tplg_filename;
+			if (mach->fw_filename)
+				sof_pdata->fw_filename = mach-
>fw_filename;
+
+			return mach;
+		}
+	}
+
+	return NULL;
+}
+
 /*
  * SOF Driver enumeration.
  */
@@ -794,6 +817,7 @@  int sof_machine_check(struct snd_sof_dev *sdev)
 	struct snd_soc_acpi_mach *mach;
 
 	if (!IS_ENABLED(CONFIG_SND_SOC_SOF_FORCE_NOCODEC_MODE)) {
+		const struct snd_sof_of_mach *of_mach;
 
 		/* find machine */
 		mach = snd_sof_machine_select(sdev);
@@ -803,6 +827,12 @@  int sof_machine_check(struct snd_sof_dev *sdev)
 			return 0;
 		}
 
+		of_mach = sof_of_machine_select(sdev);
+		if (of_mach) {
+			sof_pdata->of_machine = of_mach;
+			return 0;
+		}
+


But the real applied is only one line as below.

 #include <linux/bitfield.h>
 #include "sof-audio.h"
+#include "sof-of-dev.h"
 #include "ops.h"




More information about the Sound-open-firmware mailing list