[PATCH 1/3] ASoC: soc-acpi: add alternative id field for machine driver matching

Andy Shevchenko andy.shevchenko at gmail.com
Wed Oct 6 18:44:13 CEST 2021


On Wed, Oct 6, 2021 at 7:21 PM Brent Lu <brent.lu at intel.com> wrote:
>
> Current design to support second headphone driver in the same machine
> driver is to duplicate the entries in snd_soc_acpi_mach array and
> board configs in machine driver. We can avoid this by adding an id_alt
> field in snd_soc_acpi_mach structure to specify alternative ACPI HIDs
> for machine driver enumeration and leave the codec type detection to
> machine driver if necessary.

...

> +static bool snd_soc_acpi_id_present(struct snd_soc_acpi_mach *machine)
> +{
> +       struct snd_soc_acpi_codecs *id_alt = machine->id_alt;
> +       int i;
> +
> +       if (acpi_dev_present(machine->id, NULL, -1))
> +               return true;
> +
> +       if (id_alt == NULL)
> +               return false;
> +
> +       for (i = 0; i < id_alt->num_codecs; i++) {
> +               if (acpi_dev_present(id_alt->codecs[i], NULL, -1))
> +                       return true;
> +       }
> +
> +       return false;
> +}

Wondering if you may modify data structure in a way that makes it
possible to use for_each_acpi_dev_match().

...

> +               if (snd_soc_acpi_id_present(mach) != false) {

' != fase' is redundant.



-- 
With Best Regards,
Andy Shevchenko


More information about the Alsa-devel mailing list