brcm2708: add linux 4.19 support
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.19 / 950-0066-ASoC-Add-support-for-Rpi-DAC.patch
1 From 2112d06f09c1ecd601de065351bc60b08fc53bca Mon Sep 17 00:00:00 2001
2 From: Florian Meier <florian.meier@koalo.de>
3 Date: Mon, 25 Jan 2016 15:48:59 +0000
4 Subject: [PATCH 066/703] ASoC: Add support for Rpi-DAC
5
6 ---
7 sound/soc/codecs/Kconfig | 5 +++
8 sound/soc/codecs/Makefile | 2 ++
9 sound/soc/codecs/pcm1794a.c | 69 +++++++++++++++++++++++++++++++++++++
10 3 files changed, 76 insertions(+)
11 create mode 100644 sound/soc/codecs/pcm1794a.c
12
13 --- a/sound/soc/codecs/Kconfig
14 +++ b/sound/soc/codecs/Kconfig
15 @@ -118,6 +118,7 @@ config SND_SOC_ALL_CODECS
16 select SND_SOC_PCM179X_SPI if SPI_MASTER
17 select SND_SOC_PCM186X_I2C if I2C
18 select SND_SOC_PCM186X_SPI if SPI_MASTER
19 + select SND_SOC_PCM1794A if I2C
20 select SND_SOC_PCM3008
21 select SND_SOC_PCM3168A_I2C if I2C
22 select SND_SOC_PCM3168A_SPI if SPI_MASTER
23 @@ -834,6 +835,10 @@ config SND_SOC_RT5616
24 tristate "Realtek RT5616 CODEC"
25 depends on I2C
26
27 +config SND_SOC_PCM1794A
28 + tristate
29 + depends on I2C
30 +
31 config SND_SOC_RT5631
32 tristate "Realtek ALC5631/RT5631 CODEC"
33 depends on I2C
34 --- a/sound/soc/codecs/Makefile
35 +++ b/sound/soc/codecs/Makefile
36 @@ -118,6 +118,7 @@ snd-soc-pcm179x-spi-objs := pcm179x-spi.
37 snd-soc-pcm186x-objs := pcm186x.o
38 snd-soc-pcm186x-i2c-objs := pcm186x-i2c.o
39 snd-soc-pcm186x-spi-objs := pcm186x-spi.o
40 +snd-soc-pcm1794a-objs := pcm1794a.o
41 snd-soc-pcm3008-objs := pcm3008.o
42 snd-soc-pcm3168a-objs := pcm3168a.o
43 snd-soc-pcm3168a-i2c-objs := pcm3168a-i2c.o
44 @@ -386,6 +387,7 @@ obj-$(CONFIG_SND_SOC_PCM5102A) += snd-so
45 obj-$(CONFIG_SND_SOC_PCM512x) += snd-soc-pcm512x.o
46 obj-$(CONFIG_SND_SOC_PCM512x_I2C) += snd-soc-pcm512x-i2c.o
47 obj-$(CONFIG_SND_SOC_PCM512x_SPI) += snd-soc-pcm512x-spi.o
48 +obj-$(CONFIG_SND_SOC_PCM1794A) += snd-soc-pcm1794a.o
49 obj-$(CONFIG_SND_SOC_RL6231) += snd-soc-rl6231.o
50 obj-$(CONFIG_SND_SOC_RL6347A) += snd-soc-rl6347a.o
51 obj-$(CONFIG_SND_SOC_RT1305) += snd-soc-rt1305.o
52 --- /dev/null
53 +++ b/sound/soc/codecs/pcm1794a.c
54 @@ -0,0 +1,69 @@
55 +/*
56 + * Driver for the PCM1794A codec
57 + *
58 + * Author: Florian Meier <florian.meier@koalo.de>
59 + * Copyright 2013
60 + *
61 + * This program is free software; you can redistribute it and/or
62 + * modify it under the terms of the GNU General Public License
63 + * version 2 as published by the Free Software Foundation.
64 + *
65 + * This program is distributed in the hope that it will be useful, but
66 + * WITHOUT ANY WARRANTY; without even the implied warranty of
67 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
68 + * General Public License for more details.
69 + */
70 +
71 +
72 +#include <linux/init.h>
73 +#include <linux/module.h>
74 +#include <linux/platform_device.h>
75 +
76 +#include <sound/soc.h>
77 +
78 +static struct snd_soc_dai_driver pcm1794a_dai = {
79 + .name = "pcm1794a-hifi",
80 + .playback = {
81 + .channels_min = 2,
82 + .channels_max = 2,
83 + .rates = SNDRV_PCM_RATE_8000_192000,
84 + .formats = SNDRV_PCM_FMTBIT_S16_LE |
85 + SNDRV_PCM_FMTBIT_S24_LE
86 + },
87 +};
88 +
89 +static struct snd_soc_component_driver soc_component_dev_pcm1794a;
90 +
91 +static int pcm1794a_probe(struct platform_device *pdev)
92 +{
93 + return snd_soc_register_component(&pdev->dev, &soc_component_dev_pcm1794a,
94 + &pcm1794a_dai, 1);
95 +}
96 +
97 +static int pcm1794a_remove(struct platform_device *pdev)
98 +{
99 + snd_soc_unregister_component(&pdev->dev);
100 + return 0;
101 +}
102 +
103 +static const struct of_device_id pcm1794a_of_match[] = {
104 + { .compatible = "ti,pcm1794a", },
105 + { }
106 +};
107 +MODULE_DEVICE_TABLE(of, pcm1794a_of_match);
108 +
109 +static struct platform_driver pcm1794a_component_driver = {
110 + .probe = pcm1794a_probe,
111 + .remove = pcm1794a_remove,
112 + .driver = {
113 + .name = "pcm1794a-codec",
114 + .owner = THIS_MODULE,
115 + .of_match_table = of_match_ptr(pcm1794a_of_match),
116 + },
117 +};
118 +
119 +module_platform_driver(pcm1794a_component_driver);
120 +
121 +MODULE_DESCRIPTION("ASoC PCM1794A codec driver");
122 +MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>");
123 +MODULE_LICENSE("GPL v2");