alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] ALSA: hda: intel-dsp-config: Add SND_INTEL_BYT_PREFER_SOF Kconfig option
@ 2021-02-08 13:59 Hans de Goede
  2021-02-08 15:33 ` Pierre-Louis Bossart
  2021-02-08 16:51 ` Takashi Iwai
  0 siblings, 2 replies; 3+ messages in thread
From: Hans de Goede @ 2021-02-08 13:59 UTC (permalink / raw)
  To: Cezary Rojewski, Pierre-Louis Bossart, Jaroslav Kysela, Takashi Iwai
  Cc: Takashi Iwai, Hans de Goede, alsa-devel

The kernel has 2 drivers for the Low Power Engine audio-block on
Bay- and Cherry-Trail SoCs. The old SST driver and the new SOF
driver. If both drivers are enabled then the kernel will default
to using the old SST driver, unless told otherwise through the
snd_intel_dspcfg.dsp_driver module-parameter.

Add a boolean SND_INTEL_BYT_PREFER_SOF Kconfig option, which when set to Y
will make the kernel default to the new SOF driver instead.
The option defaults to n, preserving the current behavior.

Making this configurable will help distributions such as Fedora:
https://fedoraproject.org/w/index.php?title=Changes/SofDefaultForIntelLpe
to test using SOF on BYT/CHT during the transition phase where we
have both drivers (eventually the old driver and this option will
be removed).

Note that this drops the acpi_config_table[] containing 2 entries per ACPI
hardware-id if both drivers are enabled. snd_intel_acpi_dsp_find_config()
will always return the first hit, so we only need a single entry with the
flags value set depending on the Kconfig settings.

Suggested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
- Rework following Takashi's suggestions
---
 sound/hda/Kconfig            | 14 ++++++++++++++
 sound/hda/intel-dsp-config.c | 29 ++++++++++++-----------------
 2 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/sound/hda/Kconfig b/sound/hda/Kconfig
index 3bc9224d5e4f..9ed5cfa3c18c 100644
--- a/sound/hda/Kconfig
+++ b/sound/hda/Kconfig
@@ -46,3 +46,17 @@ config SND_INTEL_DSP_CONFIG
 	select SND_INTEL_NHLT if ACPI
 	# this config should be selected only for Intel DSP platforms.
 	# A fallback is provided so that the code compiles in all cases.
+
+config SND_INTEL_BYT_PREFER_SOF
+	bool "Prefer SOF driver over SST on BY/CHT platforms"
+	depends on SND_SST_ATOM_HIFI2_PLATFORM_ACPI && SND_SOC_SOF_BAYTRAIL
+	default n
+	help
+	  The kernel has 2 drivers for the Low Power Engine audio-block on
+	  Bay- and Cherry-Trail SoCs. The old SST driver and the new SOF
+	  driver. If both drivers are enabled then the kernel will default
+	  to using the old SST driver, unless told otherwise through the
+	  snd_intel_dspcfg.dsp_driver module-parameter.
+
+	  Set this option to Y to make the kernel default to the new SOF
+	  driver instead.
diff --git a/sound/hda/intel-dsp-config.c b/sound/hda/intel-dsp-config.c
index c45686172517..68bb977c6a37 100644
--- a/sound/hda/intel-dsp-config.c
+++ b/sound/hda/intel-dsp-config.c
@@ -452,35 +452,30 @@ int snd_intel_dsp_driver_probe(struct pci_dev *pci)
 }
 EXPORT_SYMBOL_GPL(snd_intel_dsp_driver_probe);
 
+/* Should we default to SOF or SST for BYT/CHT ? */
+#if IS_ENABLED(CONFIG_SND_INTEL_BYT_PREFER_SOF) || \
+    !IS_ENABLED(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM_ACPI)
+#define FLAG_SST_OR_SOF_BYT	FLAG_SOF
+#else
+#define FLAG_SST_OR_SOF_BYT	FLAG_SST
+#endif
+
 /*
  * configuration table
  * - the order of similar ACPI ID entries is important!
  * - the first successful match will win
  */
 static const struct config_entry acpi_config_table[] = {
+#if IS_ENABLED(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM_ACPI) || \
+    IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
 /* BayTrail */
-#if IS_ENABLED(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM_ACPI)
-	{
-		.flags = FLAG_SST,
-		.acpi_hid = "80860F28",
-	},
-#endif
-#if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
 	{
-		.flags = FLAG_SOF,
+		.flags = FLAG_SST_OR_SOF_BYT,
 		.acpi_hid = "80860F28",
 	},
-#endif
 /* CherryTrail */
-#if IS_ENABLED(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM_ACPI)
-	{
-		.flags = FLAG_SST,
-		.acpi_hid = "808622A8",
-	},
-#endif
-#if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
 	{
-		.flags = FLAG_SOF,
+		.flags = FLAG_SST_OR_SOF_BYT,
 		.acpi_hid = "808622A8",
 	},
 #endif
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] ALSA: hda: intel-dsp-config: Add SND_INTEL_BYT_PREFER_SOF Kconfig option
  2021-02-08 13:59 [PATCH v2] ALSA: hda: intel-dsp-config: Add SND_INTEL_BYT_PREFER_SOF Kconfig option Hans de Goede
@ 2021-02-08 15:33 ` Pierre-Louis Bossart
  2021-02-08 16:51 ` Takashi Iwai
  1 sibling, 0 replies; 3+ messages in thread
From: Pierre-Louis Bossart @ 2021-02-08 15:33 UTC (permalink / raw)
  To: Hans de Goede, Cezary Rojewski, Jaroslav Kysela, Takashi Iwai
  Cc: Takashi Iwai, alsa-devel



On 2/8/21 7:59 AM, Hans de Goede wrote:
> The kernel has 2 drivers for the Low Power Engine audio-block on
> Bay- and Cherry-Trail SoCs. The old SST driver and the new SOF
> driver. If both drivers are enabled then the kernel will default
> to using the old SST driver, unless told otherwise through the
> snd_intel_dspcfg.dsp_driver module-parameter.
> 
> Add a boolean SND_INTEL_BYT_PREFER_SOF Kconfig option, which when set to Y
> will make the kernel default to the new SOF driver instead.
> The option defaults to n, preserving the current behavior.
> 
> Making this configurable will help distributions such as Fedora:
> https://fedoraproject.org/w/index.php?title=Changes/SofDefaultForIntelLpe
> to test using SOF on BYT/CHT during the transition phase where we
> have both drivers (eventually the old driver and this option will
> be removed).
> 
> Note that this drops the acpi_config_table[] containing 2 entries per ACPI
> hardware-id if both drivers are enabled. snd_intel_acpi_dsp_find_config()
> will always return the first hit, so we only need a single entry with the
> flags value set depending on the Kconfig settings.
> 
> Suggested-by: Takashi Iwai <tiwai@suse.de>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Thanks Hans!


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] ALSA: hda: intel-dsp-config: Add SND_INTEL_BYT_PREFER_SOF Kconfig option
  2021-02-08 13:59 [PATCH v2] ALSA: hda: intel-dsp-config: Add SND_INTEL_BYT_PREFER_SOF Kconfig option Hans de Goede
  2021-02-08 15:33 ` Pierre-Louis Bossart
@ 2021-02-08 16:51 ` Takashi Iwai
  1 sibling, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2021-02-08 16:51 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Cezary Rojewski, Takashi Iwai, Pierre-Louis Bossart, alsa-devel

On Mon, 08 Feb 2021 14:59:19 +0100,
Hans de Goede wrote:
> 
> The kernel has 2 drivers for the Low Power Engine audio-block on
> Bay- and Cherry-Trail SoCs. The old SST driver and the new SOF
> driver. If both drivers are enabled then the kernel will default
> to using the old SST driver, unless told otherwise through the
> snd_intel_dspcfg.dsp_driver module-parameter.
> 
> Add a boolean SND_INTEL_BYT_PREFER_SOF Kconfig option, which when set to Y
> will make the kernel default to the new SOF driver instead.
> The option defaults to n, preserving the current behavior.
> 
> Making this configurable will help distributions such as Fedora:
> https://fedoraproject.org/w/index.php?title=Changes/SofDefaultForIntelLpe
> to test using SOF on BYT/CHT during the transition phase where we
> have both drivers (eventually the old driver and this option will
> be removed).
> 
> Note that this drops the acpi_config_table[] containing 2 entries per ACPI
> hardware-id if both drivers are enabled. snd_intel_acpi_dsp_find_config()
> will always return the first hit, so we only need a single entry with the
> flags value set depending on the Kconfig settings.
> 
> Suggested-by: Takashi Iwai <tiwai@suse.de>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> Changes in v2:
> - Rework following Takashi's suggestions

Applied now.  Thanks.


Takashi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-08 16:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-08 13:59 [PATCH v2] ALSA: hda: intel-dsp-config: Add SND_INTEL_BYT_PREFER_SOF Kconfig option Hans de Goede
2021-02-08 15:33 ` Pierre-Louis Bossart
2021-02-08 16:51 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).