7cf36d3ccae32b21b54e948d0a57f89cce402933
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-3.14 / 0036-ASoC-Add-support-for-PCM5102A-codec.patch
1 From c2155e69578ea9f02c915960599bb5216ce860c1 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 36/54] ASoC: Add support for PCM5102A codec
5
6 Some definitions to support the PCM5102A codec
7 by Texas Instruments.
8
9 Signed-off-by: Florian Meier <florian.meier@koalo.de>
10 ---
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
16
17 diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
18 index 983d087a..f0d76ec 100644
19 --- a/sound/soc/codecs/Kconfig
20 +++ b/sound/soc/codecs/Kconfig
21 @@ -59,6 +59,7 @@ config SND_SOC_ALL_CODECS
22 select SND_SOC_PCM1681 if I2C
23 select SND_SOC_PCM1792A if SPI_MASTER
24 select SND_SOC_PCM3008
25 + select SND_SOC_PCM5102A
26 select SND_SOC_RT5631 if I2C
27 select SND_SOC_RT5640 if I2C
28 select SND_SOC_SGTL5000 if I2C
29 @@ -313,6 +314,9 @@ config SND_SOC_PCM1792A
30 config SND_SOC_PCM3008
31 tristate
32
33 +config SND_SOC_PCM5102A
34 + tristate
35 +
36 config SND_SOC_RT5631
37 tristate
38
39 diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
40 index bc12676..612f414 100644
41 --- a/sound/soc/codecs/Makefile
42 +++ b/sound/soc/codecs/Makefile
43 @@ -46,6 +46,7 @@ snd-soc-hdmi-codec-objs := hdmi.o
44 snd-soc-pcm1681-objs := pcm1681.o
45 snd-soc-pcm1792a-codec-objs := pcm1792a.o
46 snd-soc-pcm3008-objs := pcm3008.o
47 +snd-soc-pcm5102a-objs := pcm5102a.o
48 snd-soc-rt5631-objs := rt5631.o
49 snd-soc-rt5640-objs := rt5640.o
50 snd-soc-sgtl5000-objs := sgtl5000.o
51 @@ -179,6 +180,7 @@ obj-$(CONFIG_SND_SOC_HDMI_CODEC) += snd-soc-hdmi-codec.o
52 obj-$(CONFIG_SND_SOC_PCM1681) += snd-soc-pcm1681.o
53 obj-$(CONFIG_SND_SOC_PCM1792A) += snd-soc-pcm1792a-codec.o
54 obj-$(CONFIG_SND_SOC_PCM3008) += snd-soc-pcm3008.o
55 +obj-$(CONFIG_SND_SOC_PCM5102A) += snd-soc-pcm5102a.o
56 obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o
57 obj-$(CONFIG_SND_SOC_RT5640) += snd-soc-rt5640.o
58 obj-$(CONFIG_SND_SOC_SGTL5000) += snd-soc-sgtl5000.o
59 diff --git a/sound/soc/codecs/pcm5102a.c b/sound/soc/codecs/pcm5102a.c
60 new file mode 100644
61 index 0000000..126f1e9
62 --- /dev/null
63 +++ b/sound/soc/codecs/pcm5102a.c
64 @@ -0,0 +1,63 @@
65 +/*
66 + * Driver for the PCM5102A codec
67 + *
68 + * Author: Florian Meier <florian.meier@koalo.de>
69 + * Copyright 2013
70 + *
71 + * This program is free software; you can redistribute it and/or
72 + * modify it under the terms of the GNU General Public License
73 + * version 2 as published by the Free Software Foundation.
74 + *
75 + * This program is distributed in the hope that it will be useful, but
76 + * WITHOUT ANY WARRANTY; without even the implied warranty of
77 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
78 + * General Public License for more details.
79 + */
80 +
81 +
82 +#include <linux/init.h>
83 +#include <linux/module.h>
84 +#include <linux/platform_device.h>
85 +
86 +#include <sound/soc.h>
87 +
88 +static struct snd_soc_dai_driver pcm5102a_dai = {
89 + .name = "pcm5102a-hifi",
90 + .playback = {
91 + .channels_min = 2,
92 + .channels_max = 2,
93 + .rates = SNDRV_PCM_RATE_8000_192000,
94 + .formats = SNDRV_PCM_FMTBIT_S16_LE |
95 + SNDRV_PCM_FMTBIT_S24_LE |
96 + SNDRV_PCM_FMTBIT_S32_LE
97 + },
98 +};
99 +
100 +static struct snd_soc_codec_driver soc_codec_dev_pcm5102a;
101 +
102 +static int pcm5102a_probe(struct platform_device *pdev)
103 +{
104 + return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pcm5102a,
105 + &pcm5102a_dai, 1);
106 +}
107 +
108 +static int pcm5102a_remove(struct platform_device *pdev)
109 +{
110 + snd_soc_unregister_codec(&pdev->dev);
111 + return 0;
112 +}
113 +
114 +static struct platform_driver pcm5102a_codec_driver = {
115 + .probe = pcm5102a_probe,
116 + .remove = pcm5102a_remove,
117 + .driver = {
118 + .name = "pcm5102a-codec",
119 + .owner = THIS_MODULE,
120 + },
121 +};
122 +
123 +module_platform_driver(pcm5102a_codec_driver);
124 +
125 +MODULE_DESCRIPTION("ASoC PCM5102A codec driver");
126 +MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>");
127 +MODULE_LICENSE("GPL v2");
128 --
129 1.9.1
130