diff options
author | Álvaro Fernández Rojas <noltari@gmail.com> | 2019-07-09 20:32:28 +0200 |
---|---|---|
committer | Álvaro Fernández Rojas <noltari@gmail.com> | 2019-07-14 12:44:14 +0200 |
commit | 42954857190b9df16d9d873ecc7f6cc38e013e44 (patch) | |
tree | 98c588f629ff534d458eb0884782ea99672d7634 /target/linux/brcm2708/patches-4.19/950-0234-staging-bcm2835-audio-Drop-DT-dependency.patch | |
parent | f1875e902d0afb7d9b9e5285b4fd8da7f6c5e30a (diff) | |
download | upstream-42954857190b9df16d9d873ecc7f6cc38e013e44.tar.gz upstream-42954857190b9df16d9d873ecc7f6cc38e013e44.tar.bz2 upstream-42954857190b9df16d9d873ecc7f6cc38e013e44.zip |
brcm2708: add linux 4.19 support
Boot tested on Raspberry Pi B+ (BCM2708) and Raspberry Pi 2 (BCM2709)
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux/brcm2708/patches-4.19/950-0234-staging-bcm2835-audio-Drop-DT-dependency.patch')
-rw-r--r-- | target/linux/brcm2708/patches-4.19/950-0234-staging-bcm2835-audio-Drop-DT-dependency.patch | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/target/linux/brcm2708/patches-4.19/950-0234-staging-bcm2835-audio-Drop-DT-dependency.patch b/target/linux/brcm2708/patches-4.19/950-0234-staging-bcm2835-audio-Drop-DT-dependency.patch new file mode 100644 index 0000000000..29cd60732e --- /dev/null +++ b/target/linux/brcm2708/patches-4.19/950-0234-staging-bcm2835-audio-Drop-DT-dependency.patch @@ -0,0 +1,116 @@ +From 4f0fb18ee7b5479b673257d15fe7bec3b3d90aac Mon Sep 17 00:00:00 2001 +From: Stefan Wahren <stefan.wahren@i2se.com> +Date: Thu, 18 Oct 2018 19:54:01 +0200 +Subject: [PATCH 234/703] 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> +--- + .../vc04_services/bcm2835-audio/bcm2835.c | 41 +++++++++---------- + 1 file changed, 19 insertions(+), 22 deletions(-) + +--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c ++++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c +@@ -4,15 +4,17 @@ + #include <linux/platform_device.h> + + #include <linux/init.h> ++#include <linux/dma-mapping.h> ++#include <linux/of_device.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,6 +23,8 @@ MODULE_PARM_DESC(enable_headphones, "Ena + 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 snd_devm_unregister_child(struct device *dev, void *res) + { +@@ -407,31 +411,30 @@ static int snd_add_child_devices(struct + return 0; + } + +-static int snd_bcm2835_alsa_probe_dt(struct platform_device *pdev) ++static int snd_bcm2835_alsa_probe(struct platform_device *pdev) + { + struct device *dev = &pdev->dev; +- u32 numchans; + int err; + +- 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 (num_channels <= 0 || num_channels > MAX_SUBSTREAMS) { ++ num_channels = MAX_SUBSTREAMS; ++ dev_warn(dev, "Illegal num_channels value, will use %u\n", ++ num_channels); + } + +- if (numchans == 0 || numchans > MAX_SUBSTREAMS) { +- numchans = MAX_SUBSTREAMS; +- dev_warn(dev, +- "Illegal 'brcm,pwm-channels' value, will use %u\n", +- numchans); ++ dev->coherent_dma_mask = DMA_BIT_MASK(32); ++ dev->dma_mask = &dev->coherent_dma_mask; ++ err = of_dma_configure(dev, NULL, true); ++ if (err) { ++ dev_err(dev, "Unable to setup DMA: %d\n", err); ++ return err; + } + + err = bcm2835_devm_add_vchi_ctx(dev); + if (err) + return err; + +- err = snd_add_child_devices(dev, numchans); ++ err = snd_add_child_devices(dev, num_channels); + if (err) + return err; + +@@ -453,21 +456,14 @@ static int snd_bcm2835_alsa_resume(struc + + #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_alsa0_driver = { +- .probe = snd_bcm2835_alsa_probe_dt, ++ .probe = snd_bcm2835_alsa_probe, + #ifdef CONFIG_PM + .suspend = snd_bcm2835_alsa_suspend, + .resume = snd_bcm2835_alsa_resume, + #endif + .driver = { + .name = "bcm2835_audio", +- .of_match_table = snd_bcm2835_of_match_table, + }, + }; + module_platform_driver(bcm2835_alsa0_driver); +@@ -475,3 +471,4 @@ module_platform_driver(bcm2835_alsa0_dri + MODULE_AUTHOR("Dom Cobley"); + MODULE_DESCRIPTION("Alsa driver for BCM2835 chip"); + MODULE_LICENSE("GPL"); ++MODULE_ALIAS("platform:bcm2835_audio"); |