Skip to content

Commit

Permalink
bcm2708-i2s: Enable MMAP support via a DT property and overlay
Browse files Browse the repository at this point in the history
The i2s driver used to claim to support MMAP, but that feature was disabled
when some problems were found. Add the ability to enable this feature
through Device Tree, using the i2s-mmap overlay.

See: raspberrypi#1004
  • Loading branch information
Phil Elwell committed Jun 5, 2015
1 parent 739c586 commit 7ee829f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions arch/arm/boot/dts/overlays/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dtb-$(RPI_DT_OVERLAYS) += hifiberry-digi-overlay.dtb
dtb-$(RPI_DT_OVERLAYS) += hy28a-overlay.dtb
dtb-$(RPI_DT_OVERLAYS) += hy28b-overlay.dtb
dtb-$(RPI_DT_OVERLAYS) += i2c-rtc-overlay.dtb
dtb-$(RPI_DT_OVERLAYS) += i2s-mmap-overlay.dtb
dtb-$(RPI_DT_OVERLAYS) += iqaudio-dac-overlay.dtb
dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb
dtb-$(RPI_DT_OVERLAYS) += lirc-rpi-overlay.dtb
Expand Down
13 changes: 13 additions & 0 deletions arch/arm/boot/dts/overlays/i2s-mmap-overlay.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/dts-v1/;
/plugin/;

/{
compatible = "brcm,bcm2708";

fragment@0 {
target = <&i2s>;
__overlay__ {
brcm,enable-mmap;
};
};
};
7 changes: 6 additions & 1 deletion sound/soc/bcm/bcm2708-i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ static const struct snd_soc_component_driver bcm2708_i2s_component = {
.name = "bcm2708-i2s-comp",
};

static const struct snd_pcm_hardware bcm2708_pcm_hardware = {
static struct snd_pcm_hardware bcm2708_pcm_hardware = {
.info = SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_JOINT_DUPLEX,
.formats = SNDRV_PCM_FMTBIT_S16_LE |
Expand Down Expand Up @@ -902,6 +902,11 @@ static int bcm2708_i2s_probe(struct platform_device *pdev)
struct regmap *regmap[2];
struct resource *mem[2];

if (of_property_read_bool(pdev->dev.of_node, "brcm,enable-mmap"))
bcm2708_pcm_hardware.info |=
SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_MMAP_VALID;

/* Request both ioareas */
for (i = 0; i <= 1; i++) {
void __iomem *base;
Expand Down

0 comments on commit 7ee829f

Please sign in to comment.