diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c index 105b8beeee9a8c..60c830fd95461a 100644 --- a/arch/arm/mach-bcm2708/bcm2708.c +++ b/arch/arm/mach-bcm2708/bcm2708.c @@ -736,6 +736,20 @@ static struct platform_device snd_rpi_ess9018_codec_device = { }; #endif +#ifdef CONFIG_SND_BCM2708_SOC_RPI_CODEC_PCM5102A_MODULE +static struct platform_device snd_rpi_pcm5102a_device = { + .name = "snd-rpi-pcm5102a", + .id = 0, + .num_resources = 0, +}; + +static struct platform_device snd_rpi_pcm5102a_codec_device = { + .name = "pcm5102a-codec", + .id = -1, + .num_resources = 0, +}; +#endif + int __init bcm_register_device(struct platform_device *pdev) { int ret; @@ -854,6 +868,11 @@ void __init bcm2708_init(void) bcm_register_device(&snd_rpi_ess9018_codec_device); #endif +#ifdef CONFIG_SND_BCM2708_SOC_RPI_CODEC_PCM5102A_MODULE + bcm_register_device(&snd_rpi_pcm5102a_device); + bcm_register_device(&snd_rpi_pcm5102a_codec_device); +#endif + for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { struct amba_device *d = amba_devs[i]; amba_device_register(d, &iomem_resource); diff --git a/sound/soc/bcm2708/Kconfig b/sound/soc/bcm2708/Kconfig index f1123bc880bd5c..ae1da8006b098b 100644 --- a/sound/soc/bcm2708/Kconfig +++ b/sound/soc/bcm2708/Kconfig @@ -44,3 +44,12 @@ config SND_BCM2708_SOC_RPI_CODEC_ESS9018 help Say Y if you want to add support for ESS9018 +config SND_BCM2708_SOC_RPI_CODEC_PCM5102A + tristate "Support for PCM5102A" + depends on SND_BCM2708_SOC + select SND_BCM2708_SOC_I2S + select SND_SOC_PCM5102A + help + Say Y if you want to add support for PCM5102A + + diff --git a/sound/soc/bcm2708/Makefile b/sound/soc/bcm2708/Makefile index ff6e727caaa5ae..7e5b60d1f98172 100644 --- a/sound/soc/bcm2708/Makefile +++ b/sound/soc/bcm2708/Makefile @@ -5,6 +5,7 @@ snd-soc-rpi-mbed-objs := rpi-mbed.o snd-soc-rpi-tda1541a-objs := rpi-tda1541a.o snd-soc-rpi-proto-objs := rpi-proto.o snd-soc-rpi-ess9018-objs := rpi-ess9018.o +snd-soc-rpi-pcm5102a-objs := rpi-pcm5102a.o obj-$(CONFIG_SND_BCM2708_SOC) += snd-soc-bcm2708.o obj-$(CONFIG_SND_BCM2708_SOC_I2S) += snd-soc-bcm2708-i2s.o @@ -14,4 +15,5 @@ obj-$(CONFIG_SND_BCM2708_SOC_RPI_CODEC_MBED) += snd-soc-rpi-mbed.o obj-$(CONFIG_SND_BCM2708_SOC_RPI_CODEC_TDA1541A) += snd-soc-rpi-tda1541a.o obj-$(CONFIG_SND_BCM2708_SOC_RPI_CODEC_PROTO) += snd-soc-rpi-proto.o obj-$(CONFIG_SND_BCM2708_SOC_RPI_CODEC_ESS9018) += snd-soc-rpi-ess9018.o +obj-$(CONFIG_SND_BCM2708_SOC_RPI_CODEC_PCM5102A) += snd-soc-rpi-pcm5102a.o diff --git a/sound/soc/bcm2708/rpi-pcm5102a.c b/sound/soc/bcm2708/rpi-pcm5102a.c new file mode 100644 index 00000000000000..1914daa199a175 --- /dev/null +++ b/sound/soc/bcm2708/rpi-pcm5102a.c @@ -0,0 +1,92 @@ +/* + * ASoC driver for PCM5102A codec + * connected to a Raspberry Pi + * + * Author: Florian Meier, + * 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 +#include + +#include +#include +#include +#include + +static int snd_rpi_pcm5102a_init(struct snd_soc_pcm_runtime *rtd) +{ + return 0; +} + +static int snd_rpi_pcm5102a_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + return 0; +} + +/* machine stream operations */ +static struct snd_soc_ops snd_rpi_pcm5102a_ops = { + .hw_params = snd_rpi_pcm5102a_hw_params, +}; + +static struct snd_soc_dai_link snd_rpi_pcm5102a_dai[] = { +{ + .name = "PCM5102A", + .stream_name = "PCM5102A HiFi", + .cpu_dai_name = "bcm2708-i2s.0", + .codec_dai_name = "pcm5102a-hifi", + .platform_name = "bcm2708-pcm-audio.0", + .codec_name = "pcm5102a-codec", + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBS_CFS, + .ops = &snd_rpi_pcm5102a_ops, + .init = snd_rpi_pcm5102a_init, +}, +}; + +/* audio machine driver */ +static struct snd_soc_card snd_rpi_pcm5102a = { + .name = "snd_rpi_pcm5102a", + .dai_link = snd_rpi_pcm5102a_dai, + .num_links = ARRAY_SIZE(snd_rpi_pcm5102a_dai), +}; + +static int snd_rpi_pcm5102a_probe(struct platform_device *pdev) +{ + int ret = 0; + + snd_rpi_pcm5102a.dev = &pdev->dev; + ret = snd_soc_register_card(&snd_rpi_pcm5102a); + if (ret) + { + dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); + } + + return ret; +} + + +static int snd_rpi_pcm5102a_remove(struct platform_device *pdev) +{ + return snd_soc_unregister_card(&snd_rpi_pcm5102a); +} + +static struct platform_driver snd_rpi_pcm5102a_driver = { + .driver = { + .name = "snd-rpi-pcm5102a", + .owner = THIS_MODULE, + }, + .probe = snd_rpi_pcm5102a_probe, + .remove = snd_rpi_pcm5102a_remove, +}; + +module_platform_driver(snd_rpi_pcm5102a_driver); + +MODULE_AUTHOR("Florian Meier"); +MODULE_DESCRIPTION("ASoC Driver for Raspberry Pi connected to a PCM5102A"); +MODULE_LICENSE("GPL"); diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 2be53bfb384dd1..48da84a103e412 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -54,6 +54,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_ML26124 if I2C select SND_SOC_OMAP_HDMI_CODEC if OMAP4_DSS_HDMI select SND_SOC_PCM3008 + select SND_SOC_PCM5102A select SND_SOC_RT5631 if I2C select SND_SOC_SGTL5000 if I2C select SND_SOC_SI476X if MFD_SI476X_CORE @@ -288,6 +289,9 @@ config SND_SOC_OMAP_HDMI_CODEC config SND_SOC_PCM3008 tristate +config SND_SOC_PCM5102A + tristate + config SND_SOC_RT5631 tristate diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index 9d2f300895f345..7009a2207d1940 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -42,6 +42,7 @@ snd-soc-mc13783-objs := mc13783.o snd-soc-ml26124-objs := ml26124.o snd-soc-omap-hdmi-codec-objs := omap-hdmi.o snd-soc-pcm3008-objs := pcm3008.o +snd-soc-pcm5102a-objs := pcm5102a.o snd-soc-rt5631-objs := rt5631.o snd-soc-sgtl5000-objs := sgtl5000.o snd-soc-alc5623-objs := alc5623.o @@ -168,6 +169,7 @@ obj-$(CONFIG_SND_SOC_MC13783) += snd-soc-mc13783.o obj-$(CONFIG_SND_SOC_ML26124) += snd-soc-ml26124.o obj-$(CONFIG_SND_SOC_OMAP_HDMI_CODEC) += snd-soc-omap-hdmi-codec.o obj-$(CONFIG_SND_SOC_PCM3008) += snd-soc-pcm3008.o +obj-$(CONFIG_SND_SOC_PCM5102A) += snd-soc-pcm5102a.o obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o obj-$(CONFIG_SND_SOC_SGTL5000) += snd-soc-sgtl5000.o obj-$(CONFIG_SND_SOC_SIGMADSP) += snd-soc-sigmadsp.o diff --git a/sound/soc/codecs/pcm5102a.c b/sound/soc/codecs/pcm5102a.c new file mode 100644 index 00000000000000..17c9a483d6f66d --- /dev/null +++ b/sound/soc/codecs/pcm5102a.c @@ -0,0 +1,59 @@ +/* + * Driver for the PCM5102A codec + * It is a dummy driver without any controls. + * + * Copyright 2013 Florian Meier + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + */ + +#include +#include +#include + +#include + +static struct snd_soc_dai_driver pcm5102a_dai = { + .name = "pcm5102a-hifi", + .playback = { + .channels_min = 1, + .channels_max = 8, + .rates = SNDRV_PCM_RATE_8000_192000, + .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE + }, +}; + +static struct snd_soc_codec_driver soc_codec_dev_pcm5102a; + +static int pcm5102a_probe(struct platform_device *pdev) +{ + return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pcm5102a, + &pcm5102a_dai, 1); +} + +static int pcm5102a_remove(struct platform_device *pdev) +{ + snd_soc_unregister_codec(&pdev->dev); + + return 0; +} + +static struct platform_driver pcm5102a_codec_driver = { + .probe = pcm5102a_probe, + .remove = pcm5102a_remove, + .driver = { + .name = "pcm5102a-codec", + .owner = THIS_MODULE, + }, +}; + +module_platform_driver(pcm5102a_codec_driver); + +MODULE_AUTHOR("Florian Meier "); +MODULE_DESCRIPTION("ASoC PCM5102A codec driver"); +MODULE_LICENSE("GPL"); +