Message ID | 20220804091359.31449-1-chunxu.li@mediatek.com |
---|---|
Headers | show |
Series | ASoC: SOF: Introduce of_machine_select | expand |
On Thu, 2022-08-04 at 14:17 +0100, Mark Brown wrote: > On Thu, Aug 04, 2022 at 05:13:58PM +0800, Chunxu Li wrote: > > > @@ -284,6 +284,7 @@ struct snd_sof_dsp_ops { > > void (*machine_unregister)(struct snd_sof_dev *sdev, > > void *pdata); /* optional */ > > struct snd_soc_acpi_mach * (*machine_select)(struct snd_sof_dev > > *sdev); /* > > optional */ > > + struct snd_sof_of_mach * (*of_machine_select)(struct > > snd_sof_dev *sdev); > > I don't understand why we pass this in as a function when as far as I > can see it should always be the standard operation provided by the > core > - why not just always call the function? We can tell at runtime if > the > system is using DT so there's no issue there and there shouldn't be > any > concerns with ACPI or other firmware interfaces. Thanks for you advice, I'll remove the callback function, and directly call sof_of_machine_select() in sof_machine_check() as following. int sof_machine_check(struct snd_sof_dev *sdev) { snip... const struct snd_sof_of_mach *of_mach; /* find machine */ mach = snd_sof_machine_select(sdev); if (mach) { sof_pdata->machine = mach; snd_sof_set_mach_params(mach, sdev); return 0; } + of_mach = sof_of_machine_select(sdev); + if (of_mach) { + sof_pdata->of_machine = of_mach; + return 0; + } snip ... }
On Thu, Aug 04, 2022 at 10:36:07PM +0800, chunxu.li wrote: > Thanks for you advice, I'll remove the callback function, and directly > call sof_of_machine_select() in sof_machine_check() as following. > > int sof_machine_check(struct snd_sof_dev *sdev) > { > } > > > + of_mach = sof_of_machine_select(sdev); > + if (of_mach) { > + sof_pdata->of_machine = of_mach; > + return 0; > + } Looks good.
From: "chunxu.li" <chunxu.li@mediatek.com> In these patches, we introduce of_machine_select for SOF Chunxu Li (2): ASoC: SOF: Introduce optional callback of_machine_select ASoC: SOF: mediatek: Add .of_machine_select field for mt8186 include/sound/sof.h | 2 ++ sound/soc/sof/mediatek/mt8186/mt8186.c | 11 +++++++++++ sound/soc/sof/ops.h | 9 +++++++++ sound/soc/sof/pcm.c | 8 +++++++- sound/soc/sof/sof-audio.c | 7 +++++++ sound/soc/sof/sof-of-dev.c | 23 +++++++++++++++++++++++ sound/soc/sof/sof-of-dev.h | 8 ++++++++ sound/soc/sof/sof-priv.h | 1 + 8 files changed, 68 insertions(+), 1 deletion(-)