brcm2708: add linux 4.1 support
[openwrt/svn-archive/archive.git] / target / linux / brcm2708 / patches-4.1 / 0035-ASoC-Add-support-for-PCM5102A-codec.patch
1 From c368e010eacbc50e6a5f527fcc8651ea1cdc5f26 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 035/121] 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 @@ -83,6 +83,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 @@ -511,6 +512,9 @@ config SND_SOC_RT286
28 tristate
29 depends on I2C
30
31 +config SND_SOC_PCM5102A
32 + tristate
33 +
34 config SND_SOC_RT5631
35 tristate "Realtek ALC5631/RT5631 CODEC"
36 depends on I2C
37 --- a/sound/soc/codecs/Makefile
38 +++ b/sound/soc/codecs/Makefile
39 @@ -78,6 +78,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 @@ -263,6 +264,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
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");