brcm2708: update to v3.18
[openwrt/staging/wigyori.git] / target / linux / brcm2708 / patches-3.18 / 0031-ASoC-Add-support-for-PCM5102A-codec.patch
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
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 a68d173..0ef8bb7 100644
19 --- a/sound/soc/codecs/Kconfig
20 +++ b/sound/soc/codecs/Kconfig
21 @@ -80,6 +80,7 @@ config SND_SOC_ALL_CODECS
22 select SND_SOC_PCM512x_I2C if I2C
23 select SND_SOC_PCM512x_SPI if SPI_MASTER
24 select SND_SOC_RT286 if I2C
25 + select SND_SOC_PCM5102A if I2C
26 select SND_SOC_RT5631 if I2C
27 select SND_SOC_RT5640 if I2C
28 select SND_SOC_RT5645 if I2C
29 @@ -486,6 +487,9 @@ config SND_SOC_RT286
30 tristate
31 depends on I2C
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 5dce451..7b606e6 100644
41 --- a/sound/soc/codecs/Makefile
42 +++ b/sound/soc/codecs/Makefile
43 @@ -74,6 +74,7 @@ snd-soc-pcm512x-i2c-objs := pcm512x-i2c.o
44 snd-soc-pcm512x-spi-objs := pcm512x-spi.o
45 snd-soc-rl6231-objs := rl6231.o
46 snd-soc-rt286-objs := rt286.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-rt5645-objs := rt5645.o
51 @@ -250,6 +251,7 @@ obj-$(CONFIG_SND_SOC_PCM512x_I2C) += snd-soc-pcm512x-i2c.o
52 obj-$(CONFIG_SND_SOC_PCM512x_SPI) += snd-soc-pcm512x-spi.o
53 obj-$(CONFIG_SND_SOC_RL6231) += snd-soc-rl6231.o
54 obj-$(CONFIG_SND_SOC_RT286) += snd-soc-rt286.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_RT5645) += snd-soc-rt5645.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.8.3.2
130