Re: [RFC PATCH 6/6] ALSA: hda: add fallback capabilities for SKL+ platforms

From: Andy Shevchenko
Date: Wed Nov 21 2018 - 09:39:46 EST


On Tue, Nov 20, 2018 at 03:36:44PM -0600, Pierre-Louis Bossart wrote:
> Enable fallback for select PCI IDs
>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx>
> ---
> sound/pci/hda/Kconfig | 40 +++++++++++++++++++++++++++++++++++++++
> sound/pci/hda/hda_intel.c | 19 +++++++++++++------
> sound/soc/intel/Kconfig | 6 ++++++
> 3 files changed, 59 insertions(+), 6 deletions(-)
>
> diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig
> index 4235907b7858..9bb317fb3507 100644
> --- a/sound/pci/hda/Kconfig
> +++ b/sound/pci/hda/Kconfig
> @@ -228,4 +228,44 @@ config SND_HDA_POWER_SAVE_DEFAULT
>
> endif
>
> +if SND_HDA_INTEL
> +
> +config SND_HDA_INTEL_LEGACY_FALLBACK_SKL
> + bool
> + help
> + This option enables HD-audio legacy fallback for
> + Skylake machines
> +
> +config SND_HDA_INTEL_LEGACY_FALLBACK_APL
> + bool
> + help
> + This option enables HD-audio legacy fallback for
> + Broxton/ApolloLake machines
> +
> +config SND_HDA_INTEL_LEGACY_FALLBACK_KBL
> + bool
> + help
> + This option enables HD-audio legacy fallback for
> + KabyLake machines
> +
> +config SND_HDA_INTEL_LEGACY_FALLBACK_GLK
> + bool
> + help
> + This option enables HD-audio legacy fallback for
> + GeminiLake machines
> +
> +config SND_HDA_INTEL_LEGACY_FALLBACK_CNL
> + bool
> + help
> + This option enables HD-audio legacy fallback for
> + CannonLake machines
> +
> +config SND_HDA_INTEL_LEGACY_FALLBACK_CFL
> + bool
> + help
> + This option enables HD-audio legacy fallback for
> + CoffeeLake machines
> +
> +endif ## SND_HDA_INTEL
> +
> endmenu
> diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
> index eb00e37c1c27..569419242da3 100644
> --- a/sound/pci/hda/hda_intel.c
> +++ b/sound/pci/hda/hda_intel.c
> @@ -360,6 +360,7 @@ enum {
> AZX_DCAPS_NO_64BIT |\
> AZX_DCAPS_4K_BDLE_BOUNDARY | AZX_DCAPS_SNOOP_OFF)
>
> +#define AZX_DCAPS_INTEL_LEGACY_FALLBACK(conf) (IS_ENABLED(conf) ? AZX_DCAPS_INTEL_SHARED : 0)
> /*
> * vga_switcheroo support
> */
> @@ -2416,34 +2417,40 @@ static const struct pci_device_id azx_ids[] = {
> .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE },
> /* Sunrise Point-LP */
> { PCI_DEVICE(0x8086, 0x9d70),
> - .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE },
> + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE |
> + AZX_DCAPS_INTEL_LEGACY_FALLBACK(CONFIG_SND_HDA_INTEL_LEGACY_FALLBACK_SKL) },

Preprocessor may concatenate the same prefix for you.
I expect to see something like ..._FALLBACK(SKL) and so on.

Moreover, you can go further and create a macro that would consolidate all bits together.


> /* Kabylake */
> { PCI_DEVICE(0x8086, 0xa171),
> .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE },
> /* Kabylake-LP */
> { PCI_DEVICE(0x8086, 0x9d71),
> - .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE },
> + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE |
> + AZX_DCAPS_INTEL_LEGACY_FALLBACK(CONFIG_SND_HDA_INTEL_LEGACY_FALLBACK_KBL) },
> /* Kabylake-H */
> { PCI_DEVICE(0x8086, 0xa2f0),
> .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE },
> /* Coffelake */
> { PCI_DEVICE(0x8086, 0xa348),
> - .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
> + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE |
> + AZX_DCAPS_INTEL_LEGACY_FALLBACK(CONFIG_SND_HDA_INTEL_LEGACY_FALLBACK_CFL) },
> /* Cannonlake */
> { PCI_DEVICE(0x8086, 0x9dc8),
> - .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
> + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE |
> + AZX_DCAPS_INTEL_LEGACY_FALLBACK(CONFIG_SND_HDA_INTEL_LEGACY_FALLBACK_CNL) },
> /* Icelake */
> { PCI_DEVICE(0x8086, 0x34c8),
> .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
> /* Broxton-P(Apollolake) */
> { PCI_DEVICE(0x8086, 0x5a98),
> - .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_BROXTON },
> + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_BROXTON |
> + AZX_DCAPS_INTEL_LEGACY_FALLBACK(CONFIG_SND_HDA_INTEL_LEGACY_FALLBACK_APL) },
> /* Broxton-T */
> { PCI_DEVICE(0x8086, 0x1a98),
> .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_BROXTON },
> /* Gemini-Lake */
> { PCI_DEVICE(0x8086, 0x3198),
> - .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_BROXTON },
> + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_BROXTON |
> + AZX_DCAPS_INTEL_LEGACY_FALLBACK(CONFIG_SND_HDA_INTEL_LEGACY_FALLBACK_GLK) },
> /* Haswell */
> { PCI_DEVICE(0x8086, 0x0a0c),
> .driver_data = AZX_DRIVER_HDMI | AZX_DCAPS_INTEL_HASWELL },
> diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig
> index c02d08d31d0d..4c6abdbb0b90 100644
> --- a/sound/soc/intel/Kconfig
> +++ b/sound/soc/intel/Kconfig
> @@ -197,6 +197,12 @@ config SND_SOC_INTEL_SKYLAKE_COMMON
> config SND_SOC_INTEL_SKL_LEGACY_SUPPORT
> bool "Fallback legacy HD-audio binding"
> depends on SND_HDA_INTEL=y || SND_SOC_INTEL_SKYLAKE_FAMILY=SND_HDA_INTEL
> + select SND_HDA_INTEL_LEGACY_FALLBACK_SKL if SND_SOC_INTEL_SKL
> + select SND_HDA_INTEL_LEGACY_FALLBACK_APL if SND_SOC_INTEL_APL
> + select SND_HDA_INTEL_LEGACY_FALLBACK_KBL if SND_SOC_INTEL_KBL
> + select SND_HDA_INTEL_LEGACY_FALLBACK_GLK if SND_SOC_INTEL_GLK
> + select SND_HDA_INTEL_LEGACY_FALLBACK_CNL if SND_SOC_INTEL_CNL
> + select SND_HDA_INTEL_LEGACY_FALLBACK_CFL if SND_SOC_INTEL_CFL
> help
> Fallback binding with the legacy HD-audio driver when no DSP is
> found
> --
> 2.17.1
>

--
With Best Regards,
Andy Shevchenko