On Wed, Oct 6, 2021 at 12:58 PM Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com wrote:
I don't see an issue with still using a struct since we are using the same list across multiple machines, but this makes me wonder if maybe we should refactor this into another layer, having the ids at a top structure and then the speaker matches a layer down. E.g.
struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = { { .drv_name = "adl_mx98373_rt5682", .machine_quirk = snd_soc_acpi_codec_list, .quirk_data = &adl_max98373_amp, }, { .drv_name = "adl_mx98357_rt5682", .machine_quirk = snd_soc_acpi_codec_list, .quirk_data = &adl_max98357a_amp, }, { .drv_name = "adl_mx98360_rt5682", .machine_quirk = snd_soc_acpi_codec_list, .quirk_data = &adl_max98360a_amp, } }
struct machine_driver adl_rt5682_driver_match { .id = { "10EC5682", "RTL5682" } .instances = &adl_rt5682_machines }
We probably need to experiment various options, on one hand the proposal removes duplication but in a lot of cases outside of Chromebooks/rt5640 there is none, so that table rework adds an indirection with no real benefit.
Fair point, given the current situation this would benefit RTK boards only. I have no idea if we will end up in the same boat with any other boards, but given the current supply chain status I would expect this (multi-sourcing) to be a way of the future. So maybe an idea we pocket for now and deploy when we end up in this situation with more drivers.