a63bda2059a96aca59dff00530cb1d0d415c0228
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.1 / 0036-BCM2708-Add-I2S-support-to-board-file.patch
1 From 48e87b89080e40af51338d5966480753b09ef7d3 Mon Sep 17 00:00:00 2001
2 From: Florian Meier <florian.meier@koalo.de>
3 Date: Fri, 22 Nov 2013 19:04:54 +0100
4 Subject: [PATCH 036/148] BCM2708: Add I2S support to board file
5
6 Adds the required initializations for I2S
7 to the board file of mach-bcm2708.
8
9 Signed-off-by: Florian Meier <florian.meier@koalo.de>
10
11 bcm2708-i2s: Enable MMAP support via a DT property and overlay
12
13 The i2s driver used to claim to support MMAP, but that feature was disabled
14 when some problems were found. Add the ability to enable this feature
15 through Device Tree, using the i2s-mmap overlay.
16
17 See: #1004
18 ---
19 arch/arm/mach-bcm2708/bcm2708.c | 26 ++++++++++++++++++++++++++
20 sound/soc/bcm/bcm2708-i2s.c | 7 ++++++-
21 2 files changed, 32 insertions(+), 1 deletion(-)
22
23 --- a/arch/arm/mach-bcm2708/bcm2708.c
24 +++ b/arch/arm/mach-bcm2708/bcm2708.c
25 @@ -616,6 +616,28 @@ static struct platform_device bcm2835_th
26 .name = "bcm2835_thermal",
27 };
28
29 +#if defined(CONFIG_SND_BCM2708_SOC_I2S) || defined(CONFIG_SND_BCM2708_SOC_I2S_MODULE)
30 +static struct resource bcm2708_i2s_resources[] = {
31 + {
32 + .start = I2S_BASE,
33 + .end = I2S_BASE + 0x20,
34 + .flags = IORESOURCE_MEM,
35 + },
36 + {
37 + .start = PCM_CLOCK_BASE,
38 + .end = PCM_CLOCK_BASE + 0x02,
39 + .flags = IORESOURCE_MEM,
40 + }
41 +};
42 +
43 +static struct platform_device bcm2708_i2s_device = {
44 + .name = "bcm2708-i2s",
45 + .id = 0,
46 + .num_resources = ARRAY_SIZE(bcm2708_i2s_resources),
47 + .resource = bcm2708_i2s_resources,
48 +};
49 +#endif
50 +
51 int __init bcm_register_device(struct platform_device *pdev)
52 {
53 int ret;
54 @@ -780,6 +802,10 @@ void __init bcm2708_init(void)
55
56 bcm_register_device_dt(&bcm2835_thermal_device);
57
58 +#if defined(CONFIG_SND_BCM2708_SOC_I2S) || defined(CONFIG_SND_BCM2708_SOC_I2S_MODULE)
59 + bcm_register_device_dt(&bcm2708_i2s_device);
60 +#endif
61 +
62 if (!use_dt) {
63 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
64 struct amba_device *d = amba_devs[i];
65 --- a/sound/soc/bcm/bcm2708-i2s.c
66 +++ b/sound/soc/bcm/bcm2708-i2s.c
67 @@ -874,7 +874,7 @@ static const struct snd_soc_component_dr
68 .name = "bcm2708-i2s-comp",
69 };
70
71 -static const struct snd_pcm_hardware bcm2708_pcm_hardware = {
72 +static struct snd_pcm_hardware bcm2708_pcm_hardware = {
73 .info = SNDRV_PCM_INFO_INTERLEAVED |
74 SNDRV_PCM_INFO_JOINT_DUPLEX,
75 .formats = SNDRV_PCM_FMTBIT_S16_LE |
76 @@ -902,6 +902,11 @@ static int bcm2708_i2s_probe(struct plat
77 struct regmap *regmap[2];
78 struct resource *mem[2];
79
80 + if (of_property_read_bool(pdev->dev.of_node, "brcm,enable-mmap"))
81 + bcm2708_pcm_hardware.info |=
82 + SNDRV_PCM_INFO_MMAP |
83 + SNDRV_PCM_INFO_MMAP_VALID;
84 +
85 /* Request both ioareas */
86 for (i = 0; i <= 1; i++) {
87 void __iomem *base;