Commit b7491a9f authored by Stefan Wahren's avatar Stefan Wahren Committed by Greg Kroah-Hartman

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: default avatarStefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: default avatarNicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c04a8fe4
...@@ -6,13 +6,13 @@ ...@@ -6,13 +6,13 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h>
#include "bcm2835.h" #include "bcm2835.h"
static bool enable_hdmi; static bool enable_hdmi;
static bool enable_headphones; static bool enable_headphones;
static bool enable_compat_alsa = true; static bool enable_compat_alsa = true;
static int num_channels = MAX_SUBSTREAMS;
module_param(enable_hdmi, bool, 0444); module_param(enable_hdmi, bool, 0444);
MODULE_PARM_DESC(enable_hdmi, "Enables HDMI virtual audio device"); MODULE_PARM_DESC(enable_hdmi, "Enables HDMI virtual audio device");
...@@ -21,6 +21,8 @@ MODULE_PARM_DESC(enable_headphones, "Enables Headphones virtual audio device"); ...@@ -21,6 +21,8 @@ MODULE_PARM_DESC(enable_headphones, "Enables Headphones virtual audio device");
module_param(enable_compat_alsa, bool, 0444); module_param(enable_compat_alsa, bool, 0444);
MODULE_PARM_DESC(enable_compat_alsa, MODULE_PARM_DESC(enable_compat_alsa,
"Enables ALSA compatibility virtual audio device"); "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) static void bcm2835_devm_free_vchi_ctx(struct device *dev, void *res)
{ {
...@@ -294,28 +296,19 @@ static int snd_add_child_devices(struct device *device, u32 numchans) ...@@ -294,28 +296,19 @@ static int snd_add_child_devices(struct device *device, u32 numchans)
static int snd_bcm2835_alsa_probe(struct platform_device *pdev) static int snd_bcm2835_alsa_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
u32 numchans;
int err; int err;
err = of_property_read_u32(dev->of_node, "brcm,pwm-channels", if (num_channels <= 0 || num_channels > MAX_SUBSTREAMS) {
&numchans); num_channels = MAX_SUBSTREAMS;
if (err) { dev_warn(dev, "Illegal num_channels value, will use %u\n",
dev_err(dev, "Failed to get DT property 'brcm,pwm-channels'"); num_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); err = bcm2835_devm_add_vchi_ctx(dev);
if (err) if (err)
return err; return err;
err = snd_add_child_devices(dev, numchans); err = snd_add_child_devices(dev, num_channels);
if (err) if (err)
return err; return err;
...@@ -337,12 +330,6 @@ static int snd_bcm2835_alsa_resume(struct platform_device *pdev) ...@@ -337,12 +330,6 @@ static int snd_bcm2835_alsa_resume(struct platform_device *pdev)
#endif #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 = { static struct platform_driver bcm2835_alsa_driver = {
.probe = snd_bcm2835_alsa_probe, .probe = snd_bcm2835_alsa_probe,
#ifdef CONFIG_PM #ifdef CONFIG_PM
...@@ -351,7 +338,6 @@ static struct platform_driver bcm2835_alsa_driver = { ...@@ -351,7 +338,6 @@ static struct platform_driver bcm2835_alsa_driver = {
#endif #endif
.driver = { .driver = {
.name = "bcm2835_audio", .name = "bcm2835_audio",
.of_match_table = snd_bcm2835_of_match_table,
}, },
}; };
module_platform_driver(bcm2835_alsa_driver); module_platform_driver(bcm2835_alsa_driver);
...@@ -359,3 +345,4 @@ module_platform_driver(bcm2835_alsa_driver); ...@@ -359,3 +345,4 @@ module_platform_driver(bcm2835_alsa_driver);
MODULE_AUTHOR("Dom Cobley"); MODULE_AUTHOR("Dom Cobley");
MODULE_DESCRIPTION("Alsa driver for BCM2835 chip"); MODULE_DESCRIPTION("Alsa driver for BCM2835 chip");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:bcm2835_audio");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment