Permalink
Browse files

Add mbed driver

  • Loading branch information...
oklahomer committed Dec 28, 2014
1 parent 9301f9a commit 47243406b81de20390d57e1c430afca7abc769cb
Showing with 145 additions and 0 deletions.
  1. +33 −0 arch/arm/mach-bcm2708/bcm2708.c
  2. +7 −0 sound/soc/bcm/Kconfig
  3. +2 −0 sound/soc/bcm/Makefile
  4. +103 −0 sound/soc/bcm/rpi-mbed.c
@@ -682,6 +682,34 @@ static struct platform_device bcm2708_i2s_device = {
};
#endif
#ifdef CONFIG_SND_BCM2708_SOC_RPI_CODEC_MBED_MODULE
static struct platform_device snd_rpi_mbed_device = {
.name = "snd-rpi-mbed",
.id = 0,
.num_resources = 0,
};
static struct i2c_board_info __initdata snd_rpi_mbed_i2c_devices[] = {
{
I2C_BOARD_INFO("tlv320aic23", 0x1b)
},
};
#endif
#ifdef CONFIG_SND_BCM2708_SOC_RPI_CODEC_TDA1541A_MODULE
static struct platform_device snd_rpi_tda1541a_device = {
.name = "snd-rpi-tda1541a",
.id = 0,
.num_resources = 0,
};
static struct platform_device snd_rpi_tda1541a_codec_device = {
.name = "tda1541a-codec",
.id = -1,
.num_resources = 0,
};
#endif
#if defined(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) || defined(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC_MODULE)
static struct platform_device snd_hifiberry_dac_device = {
.name = "snd-hifiberry-dac",
@@ -914,6 +942,11 @@ void __init bcm2708_init(void)
bcm_register_device(&bcm2708_i2s_device);
#endif
#ifdef CONFIG_SND_BCM2708_SOC_RPI_CODEC_MBED_MODULE
bcm_register_device(&snd_rpi_mbed_device);
i2c_register_board_info(1, snd_rpi_mbed_i2c_devices, ARRAY_SIZE(snd_rpi_mbed_i2c_devices));
#endif
#if defined(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) || defined(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC_MODULE)
bcm_register_device(&snd_hifiberry_dac_device);
bcm_register_device(&snd_pcm5102a_codec_device);
View
@@ -9,6 +9,13 @@ config SND_BCM2708_SOC_I2S
the BCM2708 I2S interface. You will also need
to select the audio interfaces to support below.
config SND_BCM2708_SOC_RPI_CODEC_MBED
tristate "Support mbed AudioCODEC (TLV320AIC23B)"
depends on SND_BCM2708_SOC_I2S
select SND_SOC_TLV320AIC23
help
Say Y or M if you want to add support for mbed AudioCODEC (TLV320AIC23B).
config SND_BCM2708_SOC_HIFIBERRY_DAC
tristate "Support for HifiBerry DAC"
depends on SND_BCM2708_SOC_I2S
View
@@ -4,13 +4,15 @@ snd-soc-bcm2708-i2s-objs := bcm2708-i2s.o
obj-$(CONFIG_SND_BCM2708_SOC_I2S) += snd-soc-bcm2708-i2s.o
# BCM2708 Machine Support
snd-soc-rpi-mbed-objs := rpi-mbed.o
snd-soc-hifiberry-dac-objs := hifiberry_dac.o
snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o
snd-soc-hifiberry-digi-objs := hifiberry_digi.o
snd-soc-hifiberry-amp-objs := hifiberry_amp.o
snd-soc-rpi-dac-objs := rpi-dac.o
snd-soc-iqaudio-dac-objs := iqaudio-dac.o
obj-$(CONFIG_SND_BCM2708_SOC_RPI_CODEC_MBED) += snd-soc-rpi-mbed.o
obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o
obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o
obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o
View
@@ -0,0 +1,103 @@
/*
* ASoC driver for mbed AudioCODEC (with a TLV320AIC23b)
* connected to a Raspberry Pi
*
* Author: Florian Meier, <koalo@koalo.de>
* Copyright 2013
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/platform_device.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/soc.h>
#include <sound/jack.h>
#include "../codecs/tlv320aic23.h"
static int snd_rpi_mbed_init(struct snd_soc_pcm_runtime *rtd)
{
return 0;
}
static int snd_rpi_mbed_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
int sysclk;
sysclk = 12000000; /* this is fixed on this board */
/* set tlv320aic23 sysclk */
snd_soc_dai_set_sysclk(codec_dai, 0, sysclk, 0);
return 0;
}
/* machine stream operations */
static struct snd_soc_ops snd_rpi_mbed_ops = {
.hw_params = snd_rpi_mbed_hw_params,
};
static struct snd_soc_dai_link snd_rpi_mbed_dai[] = {
{
.name = "TLV320AIC23",
.stream_name = "TLV320AIC23 HiFi",
.cpu_dai_name = "bcm2708-i2s.0",
.codec_dai_name = "tlv320aic23-hifi",
.platform_name = "bcm2708-i2s.0",
.codec_name = "tlv320aic23-codec.1-001b",
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
.ops = &snd_rpi_mbed_ops,
.init = snd_rpi_mbed_init,
},
};
/* audio machine driver */
static struct snd_soc_card snd_rpi_mbed = {
.name = "snd_rpi_mbed",
.dai_link = snd_rpi_mbed_dai,
.num_links = ARRAY_SIZE(snd_rpi_mbed_dai),
};
static int snd_rpi_mbed_probe(struct platform_device *pdev)
{
int ret = 0;
snd_rpi_mbed.dev = &pdev->dev;
ret = snd_soc_register_card(&snd_rpi_mbed);
if (ret) {
dev_err(&pdev->dev,
"snd_soc_register_card() failed: %d\n", ret);
}
return ret;
}
static int snd_rpi_mbed_remove(struct platform_device *pdev)
{
return snd_soc_unregister_card(&snd_rpi_mbed);
}
static struct platform_driver snd_rpi_mbed_driver = {
.driver = {
.name = "snd-rpi-mbed",
.owner = THIS_MODULE,
},
.probe = snd_rpi_mbed_probe,
.remove = snd_rpi_mbed_remove,
};
module_platform_driver(snd_rpi_mbed_driver);
MODULE_AUTHOR("Florian Meier");
MODULE_DESCRIPTION("ASoC Driver for Raspberry Pi connected to mbed AudioCODEC");
MODULE_LICENSE("GPL");

0 comments on commit 4724340

Please sign in to comment.