brcm2708: update 3.10 patches with raspberrypi/rpi-3.10.y of 27 Apr. 2014
[openwrt/staging/blogic.git] / target / linux / brcm2708 / patches-3.10 / 0118-ASoC-Add-support-for-PCM5102A-codec.patch
1 From 8f5751798e712bae5a2ff370368745a3464b2027 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 118/196] 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 2f45f00..7c43413 100644
19 --- a/sound/soc/codecs/Kconfig
20 +++ b/sound/soc/codecs/Kconfig
21 @@ -55,6 +55,7 @@ config SND_SOC_ALL_CODECS
22 select SND_SOC_ML26124 if I2C
23 select SND_SOC_OMAP_HDMI_CODEC if OMAP4_DSS_HDMI
24 select SND_SOC_PCM3008
25 + select SND_SOC_PCM5102A
26 select SND_SOC_RT5631 if I2C
27 select SND_SOC_SGTL5000 if I2C
28 select SND_SOC_SI476X if MFD_SI476X_CORE
29 @@ -293,6 +294,9 @@ config SND_SOC_OMAP_HDMI_CODEC
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 b9e41c9..0677eb5 100644
41 --- a/sound/soc/codecs/Makefile
42 +++ b/sound/soc/codecs/Makefile
43 @@ -43,6 +43,7 @@ snd-soc-mc13783-objs := mc13783.o
44 snd-soc-ml26124-objs := ml26124.o
45 snd-soc-omap-hdmi-codec-objs := omap-hdmi.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-sgtl5000-objs := sgtl5000.o
50 snd-soc-alc5623-objs := alc5623.o
51 @@ -170,6 +171,7 @@ obj-$(CONFIG_SND_SOC_MC13783) += snd-soc-mc13783.o
52 obj-$(CONFIG_SND_SOC_ML26124) += snd-soc-ml26124.o
53 obj-$(CONFIG_SND_SOC_OMAP_HDMI_CODEC) += snd-soc-omap-hdmi-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_SGTL5000) += snd-soc-sgtl5000.o
58 obj-$(CONFIG_SND_SOC_SIGMADSP) += snd-soc-sigmadsp.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