brcm2708: update linux 4.4 patches to latest version
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.4 / 0063-ASoC-Add-support-for-PCM5102A-codec.patch
1 From 8d35b3a72d3580ad6f5bc5835bfe13b00cce6086 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 063/170] 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 | 5 ++++
12 sound/soc/codecs/Makefile | 2 ++
13 sound/soc/codecs/pcm5102a.c | 70 +++++++++++++++++++++++++++++++++++++++++++++
14 3 files changed, 77 insertions(+)
15 create mode 100644 sound/soc/codecs/pcm5102a.c
16
17 --- a/sound/soc/codecs/Kconfig
18 +++ b/sound/soc/codecs/Kconfig
19 @@ -89,6 +89,7 @@ config SND_SOC_ALL_CODECS
20 select SND_SOC_PCM512x_SPI if SPI_MASTER
21 select SND_SOC_RT286 if I2C
22 select SND_SOC_RT298 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 @@ -549,6 +550,10 @@ config SND_SOC_RT298
28 tristate
29 depends on I2C
30
31 +config SND_SOC_PCM5102A
32 + tristate
33 + depends on I2C
34 +
35 config SND_SOC_RT5631
36 tristate "Realtek ALC5631/RT5631 CODEC"
37 depends on I2C
38 --- a/sound/soc/codecs/Makefile
39 +++ b/sound/soc/codecs/Makefile
40 @@ -85,6 +85,7 @@ snd-soc-rl6231-objs := rl6231.o
41 snd-soc-rl6347a-objs := rl6347a.o
42 snd-soc-rt286-objs := rt286.o
43 snd-soc-rt298-objs := rt298.o
44 +snd-soc-pcm5102a-objs := pcm5102a.o
45 snd-soc-rt5631-objs := rt5631.o
46 snd-soc-rt5640-objs := rt5640.o
47 snd-soc-rt5645-objs := rt5645.o
48 @@ -280,6 +281,7 @@ obj-$(CONFIG_SND_SOC_RL6231) += snd-soc-
49 obj-$(CONFIG_SND_SOC_RL6347A) += snd-soc-rl6347a.o
50 obj-$(CONFIG_SND_SOC_RT286) += snd-soc-rt286.o
51 obj-$(CONFIG_SND_SOC_RT298) += snd-soc-rt298.o
52 +obj-$(CONFIG_SND_SOC_PCM5102A) += snd-soc-pcm5102a.o
53 obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o
54 obj-$(CONFIG_SND_SOC_RT5640) += snd-soc-rt5640.o
55 obj-$(CONFIG_SND_SOC_RT5645) += snd-soc-rt5645.o
56 --- /dev/null
57 +++ b/sound/soc/codecs/pcm5102a.c
58 @@ -0,0 +1,70 @@
59 +/*
60 + * Driver for the PCM5102A codec
61 + *
62 + * Author: Florian Meier <florian.meier@koalo.de>
63 + * Copyright 2013
64 + *
65 + * This program is free software; you can redistribute it and/or
66 + * modify it under the terms of the GNU General Public License
67 + * version 2 as published by the Free Software Foundation.
68 + *
69 + * This program is distributed in the hope that it will be useful, but
70 + * WITHOUT ANY WARRANTY; without even the implied warranty of
71 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
72 + * General Public License for more details.
73 + */
74 +
75 +
76 +#include <linux/init.h>
77 +#include <linux/module.h>
78 +#include <linux/platform_device.h>
79 +
80 +#include <sound/soc.h>
81 +
82 +static struct snd_soc_dai_driver pcm5102a_dai = {
83 + .name = "pcm5102a-hifi",
84 + .playback = {
85 + .channels_min = 2,
86 + .channels_max = 2,
87 + .rates = SNDRV_PCM_RATE_8000_192000,
88 + .formats = SNDRV_PCM_FMTBIT_S16_LE |
89 + SNDRV_PCM_FMTBIT_S24_LE |
90 + SNDRV_PCM_FMTBIT_S32_LE
91 + },
92 +};
93 +
94 +static struct snd_soc_codec_driver soc_codec_dev_pcm5102a;
95 +
96 +static int pcm5102a_probe(struct platform_device *pdev)
97 +{
98 + return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pcm5102a,
99 + &pcm5102a_dai, 1);
100 +}
101 +
102 +static int pcm5102a_remove(struct platform_device *pdev)
103 +{
104 + snd_soc_unregister_codec(&pdev->dev);
105 + return 0;
106 +}
107 +
108 +static const struct of_device_id pcm5102a_of_match[] = {
109 + { .compatible = "ti,pcm5102a", },
110 + { }
111 +};
112 +MODULE_DEVICE_TABLE(of, pcm5102a_of_match);
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 + .of_match_table = pcm5102a_of_match,
121 + },
122 +};
123 +
124 +module_platform_driver(pcm5102a_codec_driver);
125 +
126 +MODULE_DESCRIPTION("ASoC PCM5102A codec driver");
127 +MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>");
128 +MODULE_LICENSE("GPL v2");