[PATCH v2] ALSA: hda: intel-dsp-cfg: Use AVS driver on SKL/KBL/APL Chromebooks

Brady Norander posted 1 patch 2 years, 1 month ago
sound/hda/intel-dsp-config.c | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
[PATCH v2] ALSA: hda: intel-dsp-cfg: Use AVS driver on SKL/KBL/APL Chromebooks
Posted by Brady Norander 2 years, 1 month ago
The legacy SKL driver no longer works properly on these Chromebook
platforms. Use the new AVS driver by default instead.

Signed-off-by: Brady Norander <bradynorander@gmail.com>
---
v2: Only use quirk if AVS is enabled
  sound/hda/intel-dsp-config.c | 26 +++++++++++++++++---------
  1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/sound/hda/intel-dsp-config.c b/sound/hda/intel-dsp-config.c
index 756fa0aa69bb..e056aca01900 100644
--- a/sound/hda/intel-dsp-config.c
+++ b/sound/hda/intel-dsp-config.c
@@ -16,10 +16,11 @@
  static int dsp_driver;

  module_param(dsp_driver, int, 0444);
-MODULE_PARM_DESC(dsp_driver, "Force the DSP driver for Intel DSP 
(0=auto, 1=legacy, 2=SST, 3=SOF)");
+MODULE_PARM_DESC(dsp_driver, "Force the DSP driver for Intel DSP 
(0=auto, 1=legacy, 2=SST, 3=SOF, 4=AVS)");

  #define FLAG_SST			BIT(0)
  #define FLAG_SOF			BIT(1)
+#define FLAG_AVS			BIT(2)
  #define FLAG_SST_ONLY_IF_DMIC		BIT(15)
  #define FLAG_SOF_ONLY_IF_DMIC		BIT(16)
  #define FLAG_SOF_ONLY_IF_SOUNDWIRE	BIT(17)
@@ -56,7 +57,7 @@ static const struct config_entry config_table[] = {
  /*
   * Apollolake (Broxton-P)
   * the legacy HDAudio driver is used except on Up Squared (SOF) and
- * Chromebooks (SST), as well as devices based on the ES8336 codec
+ * Chromebooks (AVS), as well as devices based on the ES8336 codec
   */
  #if IS_ENABLED(CONFIG_SND_SOC_SOF_APOLLOLAKE)
  	{
@@ -79,9 +80,9 @@ static const struct config_entry config_table[] = {
  		.codec_hid =  &essx_83x6,
  	},
  #endif
-#if IS_ENABLED(CONFIG_SND_SOC_INTEL_APL)
+#if IS_ENABLED(CONFIG_SND_SOC_INTEL_AVS)
  	{
-		.flags = FLAG_SST,
+		.flags = FLAG_AVS,
  		.device = PCI_DEVICE_ID_INTEL_HDA_APL,
  		.dmi_table = (const struct dmi_system_id []) {
  			{
@@ -96,13 +97,13 @@ static const struct config_entry config_table[] = {
  #endif
  /*
   * Skylake and Kabylake use legacy HDAudio driver except for Google
- * Chromebooks (SST)
+ * Chromebooks (AVS)
   */

  /* Sunrise Point-LP */
-#if IS_ENABLED(CONFIG_SND_SOC_INTEL_SKL)
+#if IS_ENABLED(CONFIG_SND_SOC_INTEL_AVS)
  	{
-		.flags = FLAG_SST,
+		.flags = FLAG_AVS,
  		.device = PCI_DEVICE_ID_INTEL_HDA_SKL_LP,
  		.dmi_table = (const struct dmi_system_id []) {
  			{
@@ -114,15 +115,17 @@ static const struct config_entry config_table[] = {
  			{}
  		}
  	},
+#endif
+#if IS_ENABLED(CONFIG_SND_SOC_INTEL_SKL)
  	{
  		.flags = FLAG_SST | FLAG_SST_ONLY_IF_DMIC,
  		.device = PCI_DEVICE_ID_INTEL_HDA_SKL_LP,
  	},
  #endif
  /* Kabylake-LP */
-#if IS_ENABLED(CONFIG_SND_SOC_INTEL_KBL)
+#if IS_ENABLED(CONFIG_SND_SOC_INTEL_AVS)
  	{
-		.flags = FLAG_SST,
+		.flags = FLAG_AVS,
  		.device = PCI_DEVICE_ID_INTEL_HDA_KBL_LP,
  		.dmi_table = (const struct dmi_system_id []) {
  			{
@@ -134,6 +137,8 @@ static const struct config_entry config_table[] = {
  			{}
  		}
  	},
+#endif
+#if IS_ENABLED(CONFIG_SND_SOC_INTEL_KBL)
  	{
  		.flags = FLAG_SST | FLAG_SST_ONLY_IF_DMIC,
  		.device = PCI_DEVICE_ID_INTEL_HDA_KBL_LP,
@@ -667,6 +672,9 @@ int snd_intel_dsp_driver_probe(struct pci_dev *pci)
  		}
  	}

+	if (cfg->flags & FLAG_AVS)
+		return SND_INTEL_DSP_DRIVER_AVS;
+
  	return SND_INTEL_DSP_DRIVER_LEGACY;
  }
  EXPORT_SYMBOL_GPL(snd_intel_dsp_driver_probe);
-- 
2.42.0
Re: [PATCH v2] ALSA: hda: intel-dsp-cfg: Use AVS driver on SKL/KBL/APL Chromebooks
Posted by Takashi Iwai 2 years, 1 month ago
On Mon, 30 Oct 2023 19:58:52 +0100,
Brady Norander wrote:
> 
> The legacy SKL driver no longer works properly on these Chromebook
> platforms. Use the new AVS driver by default instead.
> 
> Signed-off-by: Brady Norander <bradynorander@gmail.com>

It's fine to switch to the new and more maintained AVS (once after the
topology is ready), but I wonder how the breakage of SKL happened.
Was it our intentional breakage in the past?  If so, why can't we
recover it?


thanks,

Takashi

> ---
> v2: Only use quirk if AVS is enabled
>  sound/hda/intel-dsp-config.c | 26 +++++++++++++++++---------
>  1 file changed, 17 insertions(+), 9 deletions(-)
> 
> diff --git a/sound/hda/intel-dsp-config.c b/sound/hda/intel-dsp-config.c
> index 756fa0aa69bb..e056aca01900 100644
> --- a/sound/hda/intel-dsp-config.c
> +++ b/sound/hda/intel-dsp-config.c
> @@ -16,10 +16,11 @@
>  static int dsp_driver;
> 
>  module_param(dsp_driver, int, 0444);
> -MODULE_PARM_DESC(dsp_driver, "Force the DSP driver for Intel DSP
> (0=auto, 1=legacy, 2=SST, 3=SOF)");
> +MODULE_PARM_DESC(dsp_driver, "Force the DSP driver for Intel DSP
> (0=auto, 1=legacy, 2=SST, 3=SOF, 4=AVS)");
> 
>  #define FLAG_SST			BIT(0)
>  #define FLAG_SOF			BIT(1)
> +#define FLAG_AVS			BIT(2)
>  #define FLAG_SST_ONLY_IF_DMIC		BIT(15)
>  #define FLAG_SOF_ONLY_IF_DMIC		BIT(16)
>  #define FLAG_SOF_ONLY_IF_SOUNDWIRE	BIT(17)
> @@ -56,7 +57,7 @@ static const struct config_entry config_table[] = {
>  /*
>   * Apollolake (Broxton-P)
>   * the legacy HDAudio driver is used except on Up Squared (SOF) and
> - * Chromebooks (SST), as well as devices based on the ES8336 codec
> + * Chromebooks (AVS), as well as devices based on the ES8336 codec
>   */
>  #if IS_ENABLED(CONFIG_SND_SOC_SOF_APOLLOLAKE)
>  	{
> @@ -79,9 +80,9 @@ static const struct config_entry config_table[] = {
>  		.codec_hid =  &essx_83x6,
>  	},
>  #endif
> -#if IS_ENABLED(CONFIG_SND_SOC_INTEL_APL)
> +#if IS_ENABLED(CONFIG_SND_SOC_INTEL_AVS)
>  	{
> -		.flags = FLAG_SST,
> +		.flags = FLAG_AVS,
>  		.device = PCI_DEVICE_ID_INTEL_HDA_APL,
>  		.dmi_table = (const struct dmi_system_id []) {
>  			{
> @@ -96,13 +97,13 @@ static const struct config_entry config_table[] = {
>  #endif
>  /*
>   * Skylake and Kabylake use legacy HDAudio driver except for Google
> - * Chromebooks (SST)
> + * Chromebooks (AVS)
>   */
> 
>  /* Sunrise Point-LP */
> -#if IS_ENABLED(CONFIG_SND_SOC_INTEL_SKL)
> +#if IS_ENABLED(CONFIG_SND_SOC_INTEL_AVS)
>  	{
> -		.flags = FLAG_SST,
> +		.flags = FLAG_AVS,
>  		.device = PCI_DEVICE_ID_INTEL_HDA_SKL_LP,
>  		.dmi_table = (const struct dmi_system_id []) {
>  			{
> @@ -114,15 +115,17 @@ static const struct config_entry config_table[] = {
>  			{}
>  		}
>  	},
> +#endif
> +#if IS_ENABLED(CONFIG_SND_SOC_INTEL_SKL)
>  	{
>  		.flags = FLAG_SST | FLAG_SST_ONLY_IF_DMIC,
>  		.device = PCI_DEVICE_ID_INTEL_HDA_SKL_LP,
>  	},
>  #endif
>  /* Kabylake-LP */
> -#if IS_ENABLED(CONFIG_SND_SOC_INTEL_KBL)
> +#if IS_ENABLED(CONFIG_SND_SOC_INTEL_AVS)
>  	{
> -		.flags = FLAG_SST,
> +		.flags = FLAG_AVS,
>  		.device = PCI_DEVICE_ID_INTEL_HDA_KBL_LP,
>  		.dmi_table = (const struct dmi_system_id []) {
>  			{
> @@ -134,6 +137,8 @@ static const struct config_entry config_table[] = {
>  			{}
>  		}
>  	},
> +#endif
> +#if IS_ENABLED(CONFIG_SND_SOC_INTEL_KBL)
>  	{
>  		.flags = FLAG_SST | FLAG_SST_ONLY_IF_DMIC,
>  		.device = PCI_DEVICE_ID_INTEL_HDA_KBL_LP,
> @@ -667,6 +672,9 @@ int snd_intel_dsp_driver_probe(struct pci_dev *pci)
>  		}
>  	}
> 
> +	if (cfg->flags & FLAG_AVS)
> +		return SND_INTEL_DSP_DRIVER_AVS;
> +
>  	return SND_INTEL_DSP_DRIVER_LEGACY;
>  }
>  EXPORT_SYMBOL_GPL(snd_intel_dsp_driver_probe);
> -- 
> 2.42.0
>
Re: [PATCH v2] ALSA: hda: intel-dsp-cfg: Use AVS driver on SKL/KBL/APL Chromebooks
Posted by Cezary Rojewski 2 years, 1 month ago
On 2023-10-31 9:07 AM, Takashi Iwai wrote:
> On Mon, 30 Oct 2023 19:58:52 +0100,
> Brady Norander wrote:
>>
>> The legacy SKL driver no longer works properly on these Chromebook
>> platforms. Use the new AVS driver by default instead.
>>
>> Signed-off-by: Brady Norander <bradynorander@gmail.com>
> 
> It's fine to switch to the new and more maintained AVS (once after the
> topology is ready), but I wonder how the breakage of SKL happened.
> Was it our intentional breakage in the past?  If so, why can't we
> recover it?

To my knowledge, skylake-driver used in I2S configurations never worked 
on "bare" upstream. While I and the team have been sending plethora of 
fixes to upstream, it has always been done "after the fact".

Another topic is the topology. Again, from what I know, skylake-driver 
topology files were never pushed as an official package to any distro. 
In most cases, Chromebook-users were taking what we have done during 
recent up-revs for those devices onto their distros. Eventually 
avs-topology-xml/for-skylake-driver [1] and avsdk/for-skylake-driver [2] 
have been created to help downstream users. While the method is not 
perfect, it is certainly better than forcing users to switch to the 
avs-driver immediately without addressing any existing skylake-driver 
issues.


[1]: 
https://github.com/thesofproject/avs-topology-xml/tree/for-skylake-driver
[2]: https://github.com/thesofproject/avsdk/tree/for-skylake-driver

Czarek
Re: [PATCH v2] ALSA: hda: intel-dsp-cfg: Use AVS driver on SKL/KBL/APL Chromebooks
Posted by Cezary Rojewski 2 years, 1 month ago
On 2023-10-30 7:58 PM, Brady Norander wrote:
> The legacy SKL driver no longer works properly on these Chromebook
> platforms. Use the new AVS driver by default instead.

Hello,

Thank you for the patch. The code looks fine but it will cause backward 
compatibility problems on driver <-> topology line which I'd like to avoid.

There's an ongoing discussion regarding 24/32 format support for HDAudio 
drivers which is currently incorrect for all Intel AudioDSP drivers. 
Until the discussion is finished I'd like to avoid switching. While the 
avs-driver deprecates the skylake-driver since v5.4, the topology file 
package is not yet part of any official distro release.

I've high hopes to finish the process by the end of November. That 
means: driver code gets updated to properly represent 24/32 format AND 
the avs-topology-xml repo [1] receives equivalent update making it a 
candidate for distro integration. I'll bump this patch once the process 
concludes.

[1]: https://github.com/thesofproject/avs-topology-xml

Czarek