1 From c3294683a11a781ec75c31d0717bee4f6438c6e6 Mon Sep 17 00:00:00 2001
2 From: Florian Meier <florian.meier@koalo.de>
3 Date: Fri, 22 Nov 2013 14:59:51 +0100
4 Subject: [PATCH 031/114] ASoC: Add support for PCM5102A codec
6 Some definitions to support the PCM5102A codec
9 Signed-off-by: Florian Meier <florian.meier@koalo.de>
11 sound/soc/codecs/Kconfig | 4 +++
12 sound/soc/codecs/Makefile | 2 ++
13 sound/soc/codecs/pcm5102a.c | 63 +++++++++++++++++++++++++++++++++++++++++++++
14 3 files changed, 69 insertions(+)
15 create mode 100644 sound/soc/codecs/pcm5102a.c
17 --- a/sound/soc/codecs/Kconfig
18 +++ b/sound/soc/codecs/Kconfig
19 @@ -80,6 +80,7 @@ config SND_SOC_ALL_CODECS
20 select SND_SOC_PCM512x_I2C if I2C
21 select SND_SOC_PCM512x_SPI if SPI_MASTER
22 select SND_SOC_RT286 if I2C
23 + select SND_SOC_PCM5102A if I2C
24 select SND_SOC_RT5631 if I2C
25 select SND_SOC_RT5640 if I2C
26 select SND_SOC_RT5645 if I2C
27 @@ -486,6 +487,9 @@ config SND_SOC_RT286
31 +config SND_SOC_PCM5102A
37 --- a/sound/soc/codecs/Makefile
38 +++ b/sound/soc/codecs/Makefile
39 @@ -74,6 +74,7 @@ snd-soc-pcm512x-i2c-objs := pcm512x-i2c.
40 snd-soc-pcm512x-spi-objs := pcm512x-spi.o
41 snd-soc-rl6231-objs := rl6231.o
42 snd-soc-rt286-objs := rt286.o
43 +snd-soc-pcm5102a-objs := pcm5102a.o
44 snd-soc-rt5631-objs := rt5631.o
45 snd-soc-rt5640-objs := rt5640.o
46 snd-soc-rt5645-objs := rt5645.o
47 @@ -250,6 +251,7 @@ obj-$(CONFIG_SND_SOC_PCM512x_I2C) += snd
48 obj-$(CONFIG_SND_SOC_PCM512x_SPI) += snd-soc-pcm512x-spi.o
49 obj-$(CONFIG_SND_SOC_RL6231) += snd-soc-rl6231.o
50 obj-$(CONFIG_SND_SOC_RT286) += snd-soc-rt286.o
51 +obj-$(CONFIG_SND_SOC_PCM5102A) += snd-soc-pcm5102a.o
52 obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o
53 obj-$(CONFIG_SND_SOC_RT5640) += snd-soc-rt5640.o
54 obj-$(CONFIG_SND_SOC_RT5645) += snd-soc-rt5645.o
56 +++ b/sound/soc/codecs/pcm5102a.c
59 + * Driver for the PCM5102A codec
61 + * Author: Florian Meier <florian.meier@koalo.de>
64 + * This program is free software; you can redistribute it and/or
65 + * modify it under the terms of the GNU General Public License
66 + * version 2 as published by the Free Software Foundation.
68 + * This program is distributed in the hope that it will be useful, but
69 + * WITHOUT ANY WARRANTY; without even the implied warranty of
70 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
71 + * General Public License for more details.
75 +#include <linux/init.h>
76 +#include <linux/module.h>
77 +#include <linux/platform_device.h>
79 +#include <sound/soc.h>
81 +static struct snd_soc_dai_driver pcm5102a_dai = {
82 + .name = "pcm5102a-hifi",
86 + .rates = SNDRV_PCM_RATE_8000_192000,
87 + .formats = SNDRV_PCM_FMTBIT_S16_LE |
88 + SNDRV_PCM_FMTBIT_S24_LE |
89 + SNDRV_PCM_FMTBIT_S32_LE
93 +static struct snd_soc_codec_driver soc_codec_dev_pcm5102a;
95 +static int pcm5102a_probe(struct platform_device *pdev)
97 + return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pcm5102a,
101 +static int pcm5102a_remove(struct platform_device *pdev)
103 + snd_soc_unregister_codec(&pdev->dev);
107 +static struct platform_driver pcm5102a_codec_driver = {
108 + .probe = pcm5102a_probe,
109 + .remove = pcm5102a_remove,
111 + .name = "pcm5102a-codec",
112 + .owner = THIS_MODULE,
116 +module_platform_driver(pcm5102a_codec_driver);
118 +MODULE_DESCRIPTION("ASoC PCM5102A codec driver");
119 +MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>");
120 +MODULE_LICENSE("GPL v2");