Skip to content

Commit

Permalink
BCM2708: Add I2S support to board file
Browse files Browse the repository at this point in the history
Adds the required initializations for I2S
to the board file of mach-bcm2708.

Signed-off-by: Florian Meier <florian.meier@koalo.de>

bcm2708-i2s: Enable MMAP support via a DT property and overlay

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: #1004

bcm2708-i2s: Don't use static pin configuration with DT
  • Loading branch information
koalo authored and popcornmix committed Nov 2, 2015
1 parent 5cc3a21 commit caa36c0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
26 changes: 26 additions & 0 deletions arch/arm/mach-bcm2708/bcm2708.c
Expand Up @@ -605,6 +605,28 @@ static struct platform_device bcm2835_thermal_device = {
.name = "bcm2835_thermal",
};

#if defined(CONFIG_SND_BCM2708_SOC_I2S) || defined(CONFIG_SND_BCM2708_SOC_I2S_MODULE)
static struct resource bcm2708_i2s_resources[] = {
{
.start = I2S_BASE,
.end = I2S_BASE + 0x20,
.flags = IORESOURCE_MEM,
},
{
.start = PCM_CLOCK_BASE,
.end = PCM_CLOCK_BASE + 0x02,
.flags = IORESOURCE_MEM,
}
};

static struct platform_device bcm2708_i2s_device = {
.name = "bcm2708-i2s",
.id = 0,
.num_resources = ARRAY_SIZE(bcm2708_i2s_resources),
.resource = bcm2708_i2s_resources,
};
#endif

int __init bcm_register_device(struct platform_device *pdev)
{
int ret;
Expand Down Expand Up @@ -774,6 +796,10 @@ void __init bcm2708_init(void)

bcm_register_device_dt(&bcm2835_thermal_device);

#if defined(CONFIG_SND_BCM2708_SOC_I2S) || defined(CONFIG_SND_BCM2708_SOC_I2S_MODULE)
bcm_register_device_dt(&bcm2708_i2s_device);
#endif

if (!use_dt) {
for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
struct amba_device *d = amba_devs[i];
Expand Down
11 changes: 8 additions & 3 deletions sound/soc/bcm/bcm2708-i2s.c
Expand Up @@ -409,8 +409,8 @@ static int bcm2708_i2s_hw_params(struct snd_pcm_substream *substream,
if (csreg & (BCM2708_I2S_TXON | BCM2708_I2S_RXON))
return 0;


bcm2708_i2s_setup_gpio();
if (!dev->dev->of_node)
bcm2708_i2s_setup_gpio();

/*
* Adjust the data length according to the format.
Expand Down 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 caa36c0

Please sign in to comment.