brcm2708: update against latest rpi-3.10.y branch
[openwrt/svn-archive/archive.git] / target / linux / brcm2708 / patches-3.10 / 0118-ASoC-Add-support-for-PCM5102A-codec.patch
1 From bce5adc2ee7a7332909ccdc6bc6f8bda17d85bbf 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/174] 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 --- a/sound/soc/codecs/Kconfig
18 +++ b/sound/soc/codecs/Kconfig
19 @@ -55,6 +55,7 @@ config SND_SOC_ALL_CODECS
20 select SND_SOC_ML26124 if I2C
21 select SND_SOC_OMAP_HDMI_CODEC if OMAP4_DSS_HDMI
22 select SND_SOC_PCM3008
23 + select SND_SOC_PCM5102A
24 select SND_SOC_RT5631 if I2C
25 select SND_SOC_SGTL5000 if I2C
26 select SND_SOC_SI476X if MFD_SI476X_CORE
27 @@ -293,6 +294,9 @@ config SND_SOC_OMAP_HDMI_CODEC
28 config SND_SOC_PCM3008
29 tristate
30
31 +config SND_SOC_PCM5102A
32 + tristate
33 +
34 config SND_SOC_RT5631
35 tristate
36
37 --- a/sound/soc/codecs/Makefile
38 +++ b/sound/soc/codecs/Makefile
39 @@ -43,6 +43,7 @@ snd-soc-mc13783-objs := mc13783.o
40 snd-soc-ml26124-objs := ml26124.o
41 snd-soc-omap-hdmi-codec-objs := omap-hdmi.o
42 snd-soc-pcm3008-objs := pcm3008.o
43 +snd-soc-pcm5102a-objs := pcm5102a.o
44 snd-soc-rt5631-objs := rt5631.o
45 snd-soc-sgtl5000-objs := sgtl5000.o
46 snd-soc-alc5623-objs := alc5623.o
47 @@ -170,6 +171,7 @@ obj-$(CONFIG_SND_SOC_MC13783) += snd-soc
48 obj-$(CONFIG_SND_SOC_ML26124) += snd-soc-ml26124.o
49 obj-$(CONFIG_SND_SOC_OMAP_HDMI_CODEC) += snd-soc-omap-hdmi-codec.o
50 obj-$(CONFIG_SND_SOC_PCM3008) += snd-soc-pcm3008.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_SGTL5000) += snd-soc-sgtl5000.o
54 obj-$(CONFIG_SND_SOC_SIGMADSP) += snd-soc-sigmadsp.o
55 --- /dev/null
56 +++ b/sound/soc/codecs/pcm5102a.c
57 @@ -0,0 +1,63 @@
58 +/*
59 + * Driver for the PCM5102A codec
60 + *
61 + * Author: Florian Meier <florian.meier@koalo.de>
62 + * Copyright 2013
63 + *
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.
67 + *
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.
72 + */
73 +
74 +
75 +#include <linux/init.h>
76 +#include <linux/module.h>
77 +#include <linux/platform_device.h>
78 +
79 +#include <sound/soc.h>
80 +
81 +static struct snd_soc_dai_driver pcm5102a_dai = {
82 + .name = "pcm5102a-hifi",
83 + .playback = {
84 + .channels_min = 2,
85 + .channels_max = 2,
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
90 + },
91 +};
92 +
93 +static struct snd_soc_codec_driver soc_codec_dev_pcm5102a;
94 +
95 +static int pcm5102a_probe(struct platform_device *pdev)
96 +{
97 + return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pcm5102a,
98 + &pcm5102a_dai, 1);
99 +}
100 +
101 +static int pcm5102a_remove(struct platform_device *pdev)
102 +{
103 + snd_soc_unregister_codec(&pdev->dev);
104 + return 0;
105 +}
106 +
107 +static struct platform_driver pcm5102a_codec_driver = {
108 + .probe = pcm5102a_probe,
109 + .remove = pcm5102a_remove,
110 + .driver = {
111 + .name = "pcm5102a-codec",
112 + .owner = THIS_MODULE,
113 + },
114 +};
115 +
116 +module_platform_driver(pcm5102a_codec_driver);
117 +
118 +MODULE_DESCRIPTION("ASoC PCM5102A codec driver");
119 +MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>");
120 +MODULE_LICENSE("GPL v2");