[PATCH 2/2] staging: bcm2835-audio: Disable extra virtual cards by default

Michael Zoran mzoran at crowfest.net
Mon Mar 13 23:45:09 PDT 2017


The extra virtual cards created for HDMI and Headphone output
may not be compatible with operating systems that expose
very simple audio controls.

By default only enable the traditional mode that exposes a single
card for maximum compatibility.

Add options to the build configuration for enabling the extra
virtual cards.

Signed-off-by: Michael Zoran <mzoran at crowfest.net>
---
 .../staging/vc04_services/bcm2835-audio/Kconfig    | 26 ++++++++++++++++++++++
 .../staging/vc04_services/bcm2835-audio/bcm2835.c  | 18 +++++++++++++++
 2 files changed, 44 insertions(+)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/Kconfig b/drivers/staging/vc04_services/bcm2835-audio/Kconfig
index 9f536533c257..8288677d8f1a 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/Kconfig
+++ b/drivers/staging/vc04_services/bcm2835-audio/Kconfig
@@ -6,3 +6,29 @@ config SND_BCM2835
         help
           Say Y or M if you want to support BCM2835 built in audio
 
+if SND_BCM2835
+
+config SND_BCM2835_TRADITIONAL_ALSA
+	bool "Traditional bcm2835 ALSA"
+	default y
+	help
+	   BCM2835 Audio supports a virtual card for each available
+	   output. This may not be compatible with some
+	   distributions, so this option adds a virtual card that
+	   works like the traditional version.
+
+config SND_BCM2835_HDMI_AUDIO
+	bool "HDMI Audio"
+	help
+	   BCM2835 Audio supports a virtual card for each available
+	   output.  This option adds a virtual card specifically
+	   for the HDMI output.
+
+config SND_BCM2835_HEADPHONE_AUDIO
+	bool "Headphone Audio"
+	help
+	   BCM2835 Audio supports a virtual card for each available
+	   output.  This option adds a virtual card specifically
+	   for the Headphone jack.
+
+endif
diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c
index 9076de6ae82f..0846b1b81e60 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c
@@ -167,6 +167,8 @@ struct bcm2835_audio_driver {
 	enum snd_bcm2835_route route;
 };
 
+#if defined(CONFIG_SND_BCM2835_TRADITIONAL_ALSA)
+
 static int bcm2835_audio_alsa_newpcm(struct bcm2835_chip *chip,
 				     const char *name,
 				     enum snd_bcm2835_route route,
@@ -197,6 +199,10 @@ static struct bcm2835_audio_driver bcm2835_audio_alsa = {
 	.newctl = snd_bcm2835_new_ctl,
 };
 
+#endif
+
+#if defined(CONFIG_SND_BCM2835_HDMI_AUDIO)
+
 static struct bcm2835_audio_driver bcm2835_audio_hdmi = {
 	.driver = {
 		.name = "bcm2835_hdmi",
@@ -210,6 +216,10 @@ static struct bcm2835_audio_driver bcm2835_audio_hdmi = {
 	.route = AUDIO_DEST_HDMI
 };
 
+#endif
+
+#if defined(CONFIG_SND_BCM2835_HEADPHONE_AUDIO)
+
 static struct bcm2835_audio_driver bcm2835_audio_headphones = {
 	.driver = {
 		.name = "bcm2835_headphones",
@@ -223,10 +233,18 @@ static struct bcm2835_audio_driver bcm2835_audio_headphones = {
 	.route = AUDIO_DEST_HEADPHONES
 };
 
+#endif
+
 static struct bcm2835_audio_driver *children_devices[] = {
+#if defined(CONFIG_SND_BCM2835_HDMI_AUDIO)
 	&bcm2835_audio_hdmi,
+#endif
+#if defined(CONFIG_SND_BCM2835_HEADPHONE_AUDIO)
 	&bcm2835_audio_headphones,
+#endif
+#if defined(CONFIG_SND_BCM2835_TRADITIONAL_ALSA)
 	&bcm2835_audio_alsa,
+#endif
 };
 
 static int snd_add_child_device(struct device *device,
-- 
2.11.0




More information about the linux-rpi-kernel mailing list