a209f16304ed2c1deaca062fe2a0ecc4e99cc201
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.1 / 0071-bcm2835-audio-Create-the-platform-device-if-the-DT-n.patch
1 From 92f76fcdda43617a0f3461741bba9e6d328684da Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Wed, 27 May 2015 17:22:15 +0100
4 Subject: [PATCH 071/121] bcm2835-audio: Create the platform device if the DT
5 node is disabled
6
7 For backwards compatibility, allow the built-in ALSA driver to be enabled
8 either by loading the module from /etc/modules or by enabling the "/audio"
9 node in DT.
10 ---
11 arch/arm/mach-bcm2708/bcm2708.c | 10 ++++++++--
12 arch/arm/mach-bcm2709/bcm2709.c | 10 ++++++++--
13 2 files changed, 16 insertions(+), 4 deletions(-)
14
15 --- a/arch/arm/mach-bcm2708/bcm2708.c
16 +++ b/arch/arm/mach-bcm2708/bcm2708.c
17 @@ -898,8 +898,14 @@ void __init bcm2708_init(void)
18 #endif
19 bcm2708_init_led();
20 bcm2708_init_uart1();
21 - for (i = 0; i < ARRAY_SIZE(bcm2708_alsa_devices); i++)
22 - bcm_register_device_dt(&bcm2708_alsa_devices[i]);
23 +
24 + /* Only create the platform devices for the ALSA driver in the
25 + absence of an enabled "audio" DT node */
26 + if (!use_dt ||
27 + !of_device_is_available(of_find_node_by_path("/audio"))) {
28 + for (i = 0; i < ARRAY_SIZE(bcm2708_alsa_devices); i++)
29 + bcm_register_device(&bcm2708_alsa_devices[i]);
30 + }
31
32 bcm_register_device_dt(&bcm2708_spi_device);
33
34 --- a/arch/arm/mach-bcm2709/bcm2709.c
35 +++ b/arch/arm/mach-bcm2709/bcm2709.c
36 @@ -918,8 +918,14 @@ void __init bcm2709_init(void)
37 #endif
38 bcm2709_init_led();
39 bcm2709_init_uart1();
40 - for (i = 0; i < ARRAY_SIZE(bcm2708_alsa_devices); i++)
41 - bcm_register_device_dt(&bcm2708_alsa_devices[i]);
42 +
43 + /* Only create the platform devices for the ALSA driver in the
44 + absence of an enabled "audio" DT node */
45 + if (!use_dt ||
46 + !of_device_is_available(of_find_node_by_path("/audio"))) {
47 + for (i = 0; i < ARRAY_SIZE(bcm2708_alsa_devices); i++)
48 + bcm_register_device(&bcm2708_alsa_devices[i]);
49 + }
50
51 bcm_register_device_dt(&bcm2708_spi_device);
52