1 From 1ddeeda8208bc269c90aad4bd8bb878f7436f62d 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 473/806] staging: bcm2835-audio: Drop DT dependency
6 commit 438fc48260a0afc4cee733e5bc20234ff2bbef56 upstream.
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.
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>
17 .../vc04_services/bcm2835-audio/bcm2835.c | 31 ++++++-------------
18 1 file changed, 9 insertions(+), 22 deletions(-)
20 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c
21 +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c
23 #include <linux/init.h>
24 #include <linux/slab.h>
25 #include <linux/module.h>
26 -#include <linux/of.h>
30 static bool enable_hdmi;
31 static bool enable_headphones;
32 static bool enable_compat_alsa = true;
33 +static int num_channels = MAX_SUBSTREAMS;
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)");
44 static void bcm2835_devm_free_vchi_ctx(struct device *dev, void *res)
46 @@ -294,28 +296,19 @@ static int snd_add_child_devices(struct
47 static int snd_bcm2835_alsa_probe(struct platform_device *pdev)
49 struct device *dev = &pdev->dev;
53 - err = of_property_read_u32(dev->of_node, "brcm,pwm-channels",
56 - dev_err(dev, "Failed to get DT property 'brcm,pwm-channels'");
60 - if (numchans == 0 || numchans > MAX_SUBSTREAMS) {
61 - numchans = MAX_SUBSTREAMS;
63 - "Illegal 'brcm,pwm-channels' value, will use %u\n",
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",
71 err = bcm2835_devm_add_vchi_ctx(dev);
75 - err = snd_add_child_devices(dev, numchans);
76 + err = snd_add_child_devices(dev, num_channels);
80 @@ -337,12 +330,6 @@ static int snd_bcm2835_alsa_resume(struc
84 -static const struct of_device_id snd_bcm2835_of_match_table[] = {
85 - { .compatible = "brcm,bcm2835-audio",},
88 -MODULE_DEVICE_TABLE(of, snd_bcm2835_of_match_table);
90 static struct platform_driver bcm2835_alsa_driver = {
91 .probe = snd_bcm2835_alsa_probe,
93 @@ -351,7 +338,6 @@ static struct platform_driver bcm2835_al
96 .name = "bcm2835_audio",
97 - .of_match_table = snd_bcm2835_of_match_table,
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");