Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: bcm2835-audio: Drop DT dependency

Just like the bcm2835-video make this a platform driver which is probed
by vchiq. In order to change the number of channels use a module
parameter instead, but use the maximum as default.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Stefan Wahren and committed by
Greg Kroah-Hartman
b7491a9f c04a8fe4

+9 -22
+9 -22
drivers/staging/vc04_services/bcm2835-audio/bcm2835.c
··· 6 6 #include <linux/init.h> 7 7 #include <linux/slab.h> 8 8 #include <linux/module.h> 9 - #include <linux/of.h> 10 9 11 10 #include "bcm2835.h" 12 11 13 12 static bool enable_hdmi; 14 13 static bool enable_headphones; 15 14 static bool enable_compat_alsa = true; 15 + static int num_channels = MAX_SUBSTREAMS; 16 16 17 17 module_param(enable_hdmi, bool, 0444); 18 18 MODULE_PARM_DESC(enable_hdmi, "Enables HDMI virtual audio device"); ··· 21 21 module_param(enable_compat_alsa, bool, 0444); 22 22 MODULE_PARM_DESC(enable_compat_alsa, 23 23 "Enables ALSA compatibility virtual audio device"); 24 + module_param(num_channels, int, 0644); 25 + MODULE_PARM_DESC(num_channels, "Number of audio channels (default: 8)"); 24 26 25 27 static void bcm2835_devm_free_vchi_ctx(struct device *dev, void *res) 26 28 { ··· 296 294 static int snd_bcm2835_alsa_probe(struct platform_device *pdev) 297 295 { 298 296 struct device *dev = &pdev->dev; 299 - u32 numchans; 300 297 int err; 301 298 302 - err = of_property_read_u32(dev->of_node, "brcm,pwm-channels", 303 - &numchans); 304 - if (err) { 305 - dev_err(dev, "Failed to get DT property 'brcm,pwm-channels'"); 306 - return err; 307 - } 308 - 309 - if (numchans == 0 || numchans > MAX_SUBSTREAMS) { 310 - numchans = MAX_SUBSTREAMS; 311 - dev_warn(dev, 312 - "Illegal 'brcm,pwm-channels' value, will use %u\n", 313 - numchans); 299 + if (num_channels <= 0 || num_channels > MAX_SUBSTREAMS) { 300 + num_channels = MAX_SUBSTREAMS; 301 + dev_warn(dev, "Illegal num_channels value, will use %u\n", 302 + num_channels); 314 303 } 315 304 316 305 err = bcm2835_devm_add_vchi_ctx(dev); 317 306 if (err) 318 307 return err; 319 308 320 - err = snd_add_child_devices(dev, numchans); 309 + err = snd_add_child_devices(dev, num_channels); 321 310 if (err) 322 311 return err; 323 312 ··· 330 337 331 338 #endif 332 339 333 - static const struct of_device_id snd_bcm2835_of_match_table[] = { 334 - { .compatible = "brcm,bcm2835-audio",}, 335 - {}, 336 - }; 337 - MODULE_DEVICE_TABLE(of, snd_bcm2835_of_match_table); 338 - 339 340 static struct platform_driver bcm2835_alsa_driver = { 340 341 .probe = snd_bcm2835_alsa_probe, 341 342 #ifdef CONFIG_PM ··· 338 351 #endif 339 352 .driver = { 340 353 .name = "bcm2835_audio", 341 - .of_match_table = snd_bcm2835_of_match_table, 342 354 }, 343 355 }; 344 356 module_platform_driver(bcm2835_alsa_driver); ··· 345 359 MODULE_AUTHOR("Dom Cobley"); 346 360 MODULE_DESCRIPTION("Alsa driver for BCM2835 chip"); 347 361 MODULE_LICENSE("GPL"); 362 + MODULE_ALIAS("platform:bcm2835_audio");