diff options
author | Florian Meier <florian.meier@koalo.de> | 2016-05-13 05:14:12 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-05-13 06:49:44 -0400 |
commit | 97d3ddd71fbf663a5da52897757333341a8b254f (patch) | |
tree | f997865001b1bb560e736c5ada39c01d7c6eee45 | |
parent | f55532a0c0b8bb6148f4e07853b876ef73bc69ca (diff) |
ASoC: pcm5102a: Add support for PCM5102A codec
Some definitions to support the PCM5102A codec
by Texas Instruments.
Signed-off-by: Florian Meier <florian.meier@koalo.de>
Changes to original patch by Florian Meier:
* rebased (Makefile and Kconfig
* fixed checkpath errors (spaces, newlines)
* added dt-binding documentation
Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | Documentation/devicetree/bindings/sound/pcm5102a.txt | 13 | ||||
-rw-r--r-- | sound/soc/codecs/Kconfig | 4 | ||||
-rw-r--r-- | sound/soc/codecs/Makefile | 2 | ||||
-rw-r--r-- | sound/soc/codecs/pcm5102a.c | 69 |
4 files changed, 88 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/sound/pcm5102a.txt b/Documentation/devicetree/bindings/sound/pcm5102a.txt new file mode 100644 index 000000000000..c63ab0b6ee19 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/pcm5102a.txt | |||
@@ -0,0 +1,13 @@ | |||
1 | PCM5102a audio CODECs | ||
2 | |||
3 | These devices does not use I2C or SPI. | ||
4 | |||
5 | Required properties: | ||
6 | |||
7 | - compatible : set as "ti,pcm5102a" | ||
8 | |||
9 | Examples: | ||
10 | |||
11 | pcm5102a: pcm5102a { | ||
12 | compatible = "ti,pcm5102a"; | ||
13 | }; | ||
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 649e92a252ae..f736953a4fd9 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig | |||
@@ -94,6 +94,7 @@ config SND_SOC_ALL_CODECS | |||
94 | select SND_SOC_PCM3008 | 94 | select SND_SOC_PCM3008 |
95 | select SND_SOC_PCM3168A_I2C if I2C | 95 | select SND_SOC_PCM3168A_I2C if I2C |
96 | select SND_SOC_PCM3168A_SPI if SPI_MASTER | 96 | select SND_SOC_PCM3168A_SPI if SPI_MASTER |
97 | select SND_SOC_PCM5102A | ||
97 | select SND_SOC_PCM512x_I2C if I2C | 98 | select SND_SOC_PCM512x_I2C if I2C |
98 | select SND_SOC_PCM512x_SPI if SPI_MASTER | 99 | select SND_SOC_PCM512x_SPI if SPI_MASTER |
99 | select SND_SOC_RT286 if I2C | 100 | select SND_SOC_RT286 if I2C |
@@ -575,6 +576,9 @@ config SND_SOC_PCM3168A_SPI | |||
575 | select SND_SOC_PCM3168A | 576 | select SND_SOC_PCM3168A |
576 | select REGMAP_SPI | 577 | select REGMAP_SPI |
577 | 578 | ||
579 | config SND_SOC_PCM5102A | ||
580 | tristate | ||
581 | |||
578 | config SND_SOC_PCM512x | 582 | config SND_SOC_PCM512x |
579 | tristate | 583 | tristate |
580 | 584 | ||
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index 185a712a7fe7..4532a743b5f8 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile | |||
@@ -89,6 +89,7 @@ snd-soc-pcm3008-objs := pcm3008.o | |||
89 | snd-soc-pcm3168a-objs := pcm3168a.o | 89 | snd-soc-pcm3168a-objs := pcm3168a.o |
90 | snd-soc-pcm3168a-i2c-objs := pcm3168a-i2c.o | 90 | snd-soc-pcm3168a-i2c-objs := pcm3168a-i2c.o |
91 | snd-soc-pcm3168a-spi-objs := pcm3168a-spi.o | 91 | snd-soc-pcm3168a-spi-objs := pcm3168a-spi.o |
92 | snd-soc-pcm5102a-objs := pcm5102a.o | ||
92 | snd-soc-pcm512x-objs := pcm512x.o | 93 | snd-soc-pcm512x-objs := pcm512x.o |
93 | snd-soc-pcm512x-i2c-objs := pcm512x-i2c.o | 94 | snd-soc-pcm512x-i2c-objs := pcm512x-i2c.o |
94 | snd-soc-pcm512x-spi-objs := pcm512x-spi.o | 95 | snd-soc-pcm512x-spi-objs := pcm512x-spi.o |
@@ -298,6 +299,7 @@ obj-$(CONFIG_SND_SOC_PCM3008) += snd-soc-pcm3008.o | |||
298 | obj-$(CONFIG_SND_SOC_PCM3168A) += snd-soc-pcm3168a.o | 299 | obj-$(CONFIG_SND_SOC_PCM3168A) += snd-soc-pcm3168a.o |
299 | obj-$(CONFIG_SND_SOC_PCM3168A_I2C) += snd-soc-pcm3168a-i2c.o | 300 | obj-$(CONFIG_SND_SOC_PCM3168A_I2C) += snd-soc-pcm3168a-i2c.o |
300 | obj-$(CONFIG_SND_SOC_PCM3168A_SPI) += snd-soc-pcm3168a-spi.o | 301 | obj-$(CONFIG_SND_SOC_PCM3168A_SPI) += snd-soc-pcm3168a-spi.o |
302 | obj-$(CONFIG_SND_SOC_PCM5102A) += snd-soc-pcm5102a.o | ||
301 | obj-$(CONFIG_SND_SOC_PCM512x) += snd-soc-pcm512x.o | 303 | obj-$(CONFIG_SND_SOC_PCM512x) += snd-soc-pcm512x.o |
302 | obj-$(CONFIG_SND_SOC_PCM512x_I2C) += snd-soc-pcm512x-i2c.o | 304 | obj-$(CONFIG_SND_SOC_PCM512x_I2C) += snd-soc-pcm512x-i2c.o |
303 | obj-$(CONFIG_SND_SOC_PCM512x_SPI) += snd-soc-pcm512x-spi.o | 305 | obj-$(CONFIG_SND_SOC_PCM512x_SPI) += snd-soc-pcm512x-spi.o |
diff --git a/sound/soc/codecs/pcm5102a.c b/sound/soc/codecs/pcm5102a.c new file mode 100644 index 000000000000..ed515677409b --- /dev/null +++ b/sound/soc/codecs/pcm5102a.c | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | * Driver for the PCM5102A codec | ||
3 | * | ||
4 | * Author: Florian Meier <florian.meier@koalo.de> | ||
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 | #include <linux/init.h> | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | |||
21 | #include <sound/soc.h> | ||
22 | |||
23 | static struct snd_soc_dai_driver pcm5102a_dai = { | ||
24 | .name = "pcm5102a-hifi", | ||
25 | .playback = { | ||
26 | .channels_min = 2, | ||
27 | .channels_max = 2, | ||
28 | .rates = SNDRV_PCM_RATE_8000_192000, | ||
29 | .formats = SNDRV_PCM_FMTBIT_S16_LE | | ||
30 | SNDRV_PCM_FMTBIT_S24_LE | | ||
31 | SNDRV_PCM_FMTBIT_S32_LE | ||
32 | }, | ||
33 | }; | ||
34 | |||
35 | static struct snd_soc_codec_driver soc_codec_dev_pcm5102a; | ||
36 | |||
37 | static int pcm5102a_probe(struct platform_device *pdev) | ||
38 | { | ||
39 | return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_pcm5102a, | ||
40 | &pcm5102a_dai, 1); | ||
41 | } | ||
42 | |||
43 | static int pcm5102a_remove(struct platform_device *pdev) | ||
44 | { | ||
45 | snd_soc_unregister_codec(&pdev->dev); | ||
46 | return 0; | ||
47 | } | ||
48 | |||
49 | static const struct of_device_id pcm5102a_of_match[] = { | ||
50 | { .compatible = "ti,pcm5102a", }, | ||
51 | { } | ||
52 | }; | ||
53 | MODULE_DEVICE_TABLE(of, pcm5102a_of_match); | ||
54 | |||
55 | static struct platform_driver pcm5102a_codec_driver = { | ||
56 | .probe = pcm5102a_probe, | ||
57 | .remove = pcm5102a_remove, | ||
58 | .driver = { | ||
59 | .name = "pcm5102a-codec", | ||
60 | .owner = THIS_MODULE, | ||
61 | .of_match_table = pcm5102a_of_match, | ||
62 | }, | ||
63 | }; | ||
64 | |||
65 | module_platform_driver(pcm5102a_codec_driver); | ||
66 | |||
67 | MODULE_DESCRIPTION("ASoC PCM5102A codec driver"); | ||
68 | MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>"); | ||
69 | MODULE_LICENSE("GPL v2"); | ||