brcm2708: bcm2711: remove custom config file
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.19 / 950-0474-staging-bcm2835-audio-Drop-DT-dependency.patch
1 From 9031c962b5f4ad439441eb9d82633c469ff1678e Mon Sep 17 00:00:00 2001
2 From: Stefan Wahren <stefan.wahren@i2se.com>
3 Date: Thu, 6 Dec 2018 19:28:58 +0100
4 Subject: [PATCH 474/773] staging: bcm2835-audio: Drop DT dependency
5
6 commit 438fc48260a0afc4cee733e5bc20234ff2bbef56 upstream.
7
8 Just like the bcm2835-video make this a platform driver which is probed
9 by vchiq. In order to change the number of channels use a module
10 parameter instead, but use the maximum as default.
11
12 Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
13 Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
14 Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
15 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
16 ---
17 .../vc04_services/bcm2835-audio/bcm2835.c | 31 ++++++-------------
18 1 file changed, 9 insertions(+), 22 deletions(-)
19
20 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c
21 +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c
22 @@ -6,13 +6,13 @@
23 #include <linux/init.h>
24 #include <linux/slab.h>
25 #include <linux/module.h>
26 -#include <linux/of.h>
27
28 #include "bcm2835.h"
29
30 static bool enable_hdmi;
31 static bool enable_headphones;
32 static bool enable_compat_alsa = true;
33 +static int num_channels = MAX_SUBSTREAMS;
34
35 module_param(enable_hdmi, bool, 0444);
36 MODULE_PARM_DESC(enable_hdmi, "Enables HDMI virtual audio device");
37 @@ -21,6 +21,8 @@ MODULE_PARM_DESC(enable_headphones, "Ena
38 module_param(enable_compat_alsa, bool, 0444);
39 MODULE_PARM_DESC(enable_compat_alsa,
40 "Enables ALSA compatibility virtual audio device");
41 +module_param(num_channels, int, 0644);
42 +MODULE_PARM_DESC(num_channels, "Number of audio channels (default: 8)");
43
44 static void bcm2835_devm_free_vchi_ctx(struct device *dev, void *res)
45 {
46 @@ -294,28 +296,19 @@ static int snd_add_child_devices(struct
47 static int snd_bcm2835_alsa_probe(struct platform_device *pdev)
48 {
49 struct device *dev = &pdev->dev;
50 - u32 numchans;
51 int err;
52
53 - err = of_property_read_u32(dev->of_node, "brcm,pwm-channels",
54 - &numchans);
55 - if (err) {
56 - dev_err(dev, "Failed to get DT property 'brcm,pwm-channels'");
57 - return err;
58 - }
59 -
60 - if (numchans == 0 || numchans > MAX_SUBSTREAMS) {
61 - numchans = MAX_SUBSTREAMS;
62 - dev_warn(dev,
63 - "Illegal 'brcm,pwm-channels' value, will use %u\n",
64 - numchans);
65 + if (num_channels <= 0 || num_channels > MAX_SUBSTREAMS) {
66 + num_channels = MAX_SUBSTREAMS;
67 + dev_warn(dev, "Illegal num_channels value, will use %u\n",
68 + num_channels);
69 }
70
71 err = bcm2835_devm_add_vchi_ctx(dev);
72 if (err)
73 return err;
74
75 - err = snd_add_child_devices(dev, numchans);
76 + err = snd_add_child_devices(dev, num_channels);
77 if (err)
78 return err;
79
80 @@ -337,12 +330,6 @@ static int snd_bcm2835_alsa_resume(struc
81
82 #endif
83
84 -static const struct of_device_id snd_bcm2835_of_match_table[] = {
85 - { .compatible = "brcm,bcm2835-audio",},
86 - {},
87 -};
88 -MODULE_DEVICE_TABLE(of, snd_bcm2835_of_match_table);
89 -
90 static struct platform_driver bcm2835_alsa_driver = {
91 .probe = snd_bcm2835_alsa_probe,
92 #ifdef CONFIG_PM
93 @@ -351,7 +338,6 @@ static struct platform_driver bcm2835_al
94 #endif
95 .driver = {
96 .name = "bcm2835_audio",
97 - .of_match_table = snd_bcm2835_of_match_table,
98 },
99 };
100 module_platform_driver(bcm2835_alsa_driver);
101 @@ -359,3 +345,4 @@ module_platform_driver(bcm2835_alsa_driv
102 MODULE_AUTHOR("Dom Cobley");
103 MODULE_DESCRIPTION("Alsa driver for BCM2835 chip");
104 MODULE_LICENSE("GPL");
105 +MODULE_ALIAS("platform:bcm2835_audio");