Skip to content

Commit 7b44818

Browse files
HiassofTpopcornmix
authored andcommitted
bcm2835-i2s: Register PCM device
Code ported from bcm2708-i2s driver in Raspberry Pi tree. RPi commit ba46b49 ("ASoC: Add support for BCM2708") This driver adds support for digital audio (I2S) for the BCM2708 SoC that is used by the Raspberry Pi. External audio codecs can be connected to the Raspberry Pi via P5 header. It relies on cyclic DMA engine support for BCM2708. Signed-off-by: Florian Meier <[email protected]> Signed-off-by: Matthias Reichl <[email protected]>
1 parent 433841f commit 7b44818

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

sound/soc/bcm/bcm2835-i2s.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,25 @@ static const struct snd_soc_component_driver bcm2835_i2s_component = {
799799
.name = "bcm2835-i2s-comp",
800800
};
801801

802+
static const struct snd_pcm_hardware bcm2835_pcm_hardware = {
803+
.info = SNDRV_PCM_INFO_INTERLEAVED |
804+
SNDRV_PCM_INFO_JOINT_DUPLEX,
805+
.formats = SNDRV_PCM_FMTBIT_S16_LE |
806+
SNDRV_PCM_FMTBIT_S24_LE |
807+
SNDRV_PCM_FMTBIT_S32_LE,
808+
.period_bytes_min = 32,
809+
.period_bytes_max = 64 * PAGE_SIZE,
810+
.periods_min = 2,
811+
.periods_max = 255,
812+
.buffer_bytes_max = 128 * PAGE_SIZE,
813+
};
814+
815+
static const struct snd_dmaengine_pcm_config bcm2835_dmaengine_pcm_config = {
816+
.prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,
817+
.pcm_hardware = &bcm2835_pcm_hardware,
818+
.prealloc_buffer_size = 256 * PAGE_SIZE,
819+
};
820+
802821
static int bcm2835_i2s_probe(struct platform_device *pdev)
803822
{
804823
struct bcm2835_i2s_dev *dev;
@@ -870,7 +889,9 @@ static int bcm2835_i2s_probe(struct platform_device *pdev)
870889
return ret;
871890
}
872891

873-
ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
892+
ret = devm_snd_dmaengine_pcm_register(&pdev->dev,
893+
&bcm2835_dmaengine_pcm_config,
894+
SND_DMAENGINE_PCM_FLAG_COMPAT);
874895
if (ret) {
875896
dev_err(&pdev->dev, "Could not register PCM: %d\n", ret);
876897
return ret;

0 commit comments

Comments
 (0)