Skip to content

Commit 4997720

Browse files
koalopopcornmix
authored andcommitted
ASoC: Add support for Rpi-DAC
1 parent 714058a commit 4997720

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

sound/soc/codecs/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ config SND_SOC_ALL_CODECS
138138
select SND_SOC_PCM179X_SPI if SPI_MASTER
139139
select SND_SOC_PCM186X_I2C if I2C
140140
select SND_SOC_PCM186X_SPI if SPI_MASTER
141+
select SND_SOC_PCM1794A if I2C
141142
select SND_SOC_PCM3008
142143
select SND_SOC_PCM3060_I2C if I2C
143144
select SND_SOC_PCM3060_SPI if SPI_MASTER
@@ -1044,6 +1045,10 @@ config SND_SOC_RT5616
10441045
tristate "Realtek RT5616 CODEC"
10451046
depends on I2C
10461047

1048+
config SND_SOC_PCM1794A
1049+
tristate
1050+
depends on I2C
1051+
10471052
config SND_SOC_RT5631
10481053
tristate "Realtek ALC5631/RT5631 CODEC"
10491054
depends on I2C

sound/soc/codecs/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ snd-soc-pcm179x-spi-objs := pcm179x-spi.o
139139
snd-soc-pcm186x-objs := pcm186x.o
140140
snd-soc-pcm186x-i2c-objs := pcm186x-i2c.o
141141
snd-soc-pcm186x-spi-objs := pcm186x-spi.o
142+
snd-soc-pcm1794a-objs := pcm1794a.o
142143
snd-soc-pcm3008-objs := pcm3008.o
143144
snd-soc-pcm3060-objs := pcm3060.o
144145
snd-soc-pcm3060-i2c-objs := pcm3060-i2c.o
@@ -449,6 +450,7 @@ obj-$(CONFIG_SND_SOC_PCM512x) += snd-soc-pcm512x.o
449450
obj-$(CONFIG_SND_SOC_PCM512x_I2C) += snd-soc-pcm512x-i2c.o
450451
obj-$(CONFIG_SND_SOC_PCM512x_SPI) += snd-soc-pcm512x-spi.o
451452
obj-$(CONFIG_SND_SOC_RK3328) += snd-soc-rk3328.o
453+
obj-$(CONFIG_SND_SOC_PCM1794A) += snd-soc-pcm1794a.o
452454
obj-$(CONFIG_SND_SOC_RL6231) += snd-soc-rl6231.o
453455
obj-$(CONFIG_SND_SOC_RL6347A) += snd-soc-rl6347a.o
454456
obj-$(CONFIG_SND_SOC_RT1011) += snd-soc-rt1011.o

sound/soc/codecs/pcm1794a.c

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* Driver for the PCM1794A codec
3+
*
4+
* Author: Florian Meier <[email protected]>
5+
* Copyright 2013
6+
*
7+
* This program is free software; you can redistribute it and/or
8+
* modify it under the terms of the GNU General Public License
9+
* version 2 as published by the Free Software Foundation.
10+
*
11+
* This program is distributed in the hope that it will be useful, but
12+
* WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
* General Public License for more details.
15+
*/
16+
17+
18+
#include <linux/init.h>
19+
#include <linux/module.h>
20+
#include <linux/platform_device.h>
21+
22+
#include <sound/soc.h>
23+
24+
static struct snd_soc_dai_driver pcm1794a_dai = {
25+
.name = "pcm1794a-hifi",
26+
.playback = {
27+
.channels_min = 2,
28+
.channels_max = 2,
29+
.rates = SNDRV_PCM_RATE_8000_192000,
30+
.formats = SNDRV_PCM_FMTBIT_S16_LE |
31+
SNDRV_PCM_FMTBIT_S24_LE
32+
},
33+
};
34+
35+
static struct snd_soc_component_driver soc_component_dev_pcm1794a;
36+
37+
static int pcm1794a_probe(struct platform_device *pdev)
38+
{
39+
return snd_soc_register_component(&pdev->dev, &soc_component_dev_pcm1794a,
40+
&pcm1794a_dai, 1);
41+
}
42+
43+
static int pcm1794a_remove(struct platform_device *pdev)
44+
{
45+
snd_soc_unregister_component(&pdev->dev);
46+
return 0;
47+
}
48+
49+
static const struct of_device_id pcm1794a_of_match[] = {
50+
{ .compatible = "ti,pcm1794a", },
51+
{ }
52+
};
53+
MODULE_DEVICE_TABLE(of, pcm1794a_of_match);
54+
55+
static struct platform_driver pcm1794a_component_driver = {
56+
.probe = pcm1794a_probe,
57+
.remove = pcm1794a_remove,
58+
.driver = {
59+
.name = "pcm1794a-codec",
60+
.owner = THIS_MODULE,
61+
.of_match_table = of_match_ptr(pcm1794a_of_match),
62+
},
63+
};
64+
65+
module_platform_driver(pcm1794a_component_driver);
66+
67+
MODULE_DESCRIPTION("ASoC PCM1794A codec driver");
68+
MODULE_AUTHOR("Florian Meier <[email protected]>");
69+
MODULE_LICENSE("GPL v2");

0 commit comments

Comments
 (0)