summaryrefslogtreecommitdiffstats
path: root/sys-kernel/boest-v5.0.15/raspberrypi/0166-Revert-staging-bcm2835-audio-Drop-DT-dependency.patch
diff options
context:
space:
mode:
Diffstat (limited to 'sys-kernel/boest-v5.0.15/raspberrypi/0166-Revert-staging-bcm2835-audio-Drop-DT-dependency.patch')
-rw-r--r--sys-kernel/boest-v5.0.15/raspberrypi/0166-Revert-staging-bcm2835-audio-Drop-DT-dependency.patch98
1 files changed, 98 insertions, 0 deletions
diff --git a/sys-kernel/boest-v5.0.15/raspberrypi/0166-Revert-staging-bcm2835-audio-Drop-DT-dependency.patch b/sys-kernel/boest-v5.0.15/raspberrypi/0166-Revert-staging-bcm2835-audio-Drop-DT-dependency.patch
new file mode 100644
index 00000000..b6755c55
--- /dev/null
+++ b/sys-kernel/boest-v5.0.15/raspberrypi/0166-Revert-staging-bcm2835-audio-Drop-DT-dependency.patch
@@ -0,0 +1,98 @@
+From 7f6883bede1341e73e487cecf506cc8f0bbb8578 Mon Sep 17 00:00:00 2001
+From: popcornmix <popcornmix@gmail.com>
+Date: Fri, 15 Mar 2019 21:11:10 +0000
+Subject: [PATCH 166/194] Revert "staging: bcm2835-audio: Drop DT dependency"
+
+This reverts commit b7491a9fca2dc2535b9dc922550a37c5baae9d3d.
+---
+ .../vc04_services/bcm2835-audio/bcm2835.c | 31 +++++++++++++------
+ 1 file changed, 22 insertions(+), 9 deletions(-)
+
+diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c
+index cf5f80f5ca6b..86b921030db7 100644
+--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c
++++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c
+@@ -6,13 +6,13 @@
+ #include <linux/init.h>
+ #include <linux/slab.h>
+ #include <linux/module.h>
++#include <linux/of.h>
+
+ #include "bcm2835.h"
+
+ static bool enable_hdmi;
+ static bool enable_headphones;
+ static bool enable_compat_alsa = true;
+-static int num_channels = MAX_SUBSTREAMS;
+
+ module_param(enable_hdmi, bool, 0444);
+ MODULE_PARM_DESC(enable_hdmi, "Enables HDMI virtual audio device");
+@@ -21,8 +21,6 @@ MODULE_PARM_DESC(enable_headphones, "Enables Headphones virtual audio device");
+ module_param(enable_compat_alsa, bool, 0444);
+ MODULE_PARM_DESC(enable_compat_alsa,
+ "Enables ALSA compatibility virtual audio device");
+-module_param(num_channels, int, 0644);
+-MODULE_PARM_DESC(num_channels, "Number of audio channels (default: 8)");
+
+ static void bcm2835_devm_free_vchi_ctx(struct device *dev, void *res)
+ {
+@@ -296,19 +294,28 @@ static int snd_add_child_devices(struct device *device, u32 numchans)
+ static int snd_bcm2835_alsa_probe(struct platform_device *pdev)
+ {
+ struct device *dev = &pdev->dev;
++ u32 numchans;
+ int err;
+
+- if (num_channels <= 0 || num_channels > MAX_SUBSTREAMS) {
+- num_channels = MAX_SUBSTREAMS;
+- dev_warn(dev, "Illegal num_channels value, will use %u\n",
+- num_channels);
++ err = of_property_read_u32(dev->of_node, "brcm,pwm-channels",
++ &numchans);
++ if (err) {
++ dev_err(dev, "Failed to get DT property 'brcm,pwm-channels'");
++ return err;
++ }
++
++ if (numchans == 0 || numchans > MAX_SUBSTREAMS) {
++ numchans = MAX_SUBSTREAMS;
++ dev_warn(dev,
++ "Illegal 'brcm,pwm-channels' value, will use %u\n",
++ numchans);
+ }
+
+ err = bcm2835_devm_add_vchi_ctx(dev);
+ if (err)
+ return err;
+
+- err = snd_add_child_devices(dev, num_channels);
++ err = snd_add_child_devices(dev, numchans);
+ if (err)
+ return err;
+
+@@ -330,6 +337,12 @@ static int snd_bcm2835_alsa_resume(struct platform_device *pdev)
+
+ #endif
+
++static const struct of_device_id snd_bcm2835_of_match_table[] = {
++ { .compatible = "brcm,bcm2835-audio",},
++ {},
++};
++MODULE_DEVICE_TABLE(of, snd_bcm2835_of_match_table);
++
+ static struct platform_driver bcm2835_alsa_driver = {
+ .probe = snd_bcm2835_alsa_probe,
+ #ifdef CONFIG_PM
+@@ -338,6 +351,7 @@ static struct platform_driver bcm2835_alsa_driver = {
+ #endif
+ .driver = {
+ .name = "bcm2835_audio",
++ .of_match_table = snd_bcm2835_of_match_table,
+ },
+ };
+ module_platform_driver(bcm2835_alsa_driver);
+@@ -345,4 +359,3 @@ module_platform_driver(bcm2835_alsa_driver);
+ MODULE_AUTHOR("Dom Cobley");
+ MODULE_DESCRIPTION("Alsa driver for BCM2835 chip");
+ MODULE_LICENSE("GPL");
+-MODULE_ALIAS("platform:bcm2835_audio");