aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTushar Behera <tushar.behera@linaro.org>2014-04-28 00:44:39 -0400
committerMark Brown <broonie@linaro.org>2014-04-29 15:09:38 -0400
commit31c26a6a842d541ca475a482112dda5993df2374 (patch)
tree8a6cf5f7d77bafcc3f23744dd5a6efd325c0f360
parentd66eac3e2b09690e28f9ac405969d6857325ee9d (diff)
ASoC: samsung: Add sound card driver for Snow board
Added machine driver to instantiate I2S based sound card on Snow board. It has MAX98095 audio codec on board. There are some other variants for Snow board which have MAX98090 audio codec. Hence support for MAX98090 is also added to this driver. Signed-off-by: Tushar Behera <tushar.behera@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--Documentation/devicetree/bindings/sound/snow.txt17
-rw-r--r--sound/soc/samsung/Kconfig10
-rw-r--r--sound/soc/samsung/Makefile2
-rw-r--r--sound/soc/samsung/snow.c122
4 files changed, 151 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/sound/snow.txt b/Documentation/devicetree/bindings/sound/snow.txt
new file mode 100644
index 000000000000..678b191c37b8
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/snow.txt
@@ -0,0 +1,17 @@
1Audio Binding for Snow boards
2
3Required properties:
4- compatible : Can be one of the following,
5 "google,snow-audio-max98090" or
6 "google,snow-audio-max98095"
7- samsung,i2s-controller: The phandle of the Samsung I2S controller
8- samsung,audio-codec: The phandle of the audio codec
9
10Example:
11
12sound {
13 compatible = "google,snow-audio-max98095";
14
15 samsung,i2s-controller = <&i2s0>;
16 samsung,audio-codec = <&max98095>;
17};
diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig
index f2e289180e46..50aa28963f49 100644
--- a/sound/soc/samsung/Kconfig
+++ b/sound/soc/samsung/Kconfig
@@ -231,3 +231,13 @@ config SND_SOC_LITTLEMILL
231 select SND_SAMSUNG_I2S 231 select SND_SAMSUNG_I2S
232 select MFD_WM8994 232 select MFD_WM8994
233 select SND_SOC_WM8994 233 select SND_SOC_WM8994
234
235config SND_SOC_SNOW
236 tristate "Audio support for Google Snow boards"
237 depends on SND_SOC_SAMSUNG
238 select SND_SOC_MAX98090
239 select SND_SOC_MAX98095
240 select SND_SAMSUNG_I2S
241 help
242 Say Y if you want to add audio support for various Snow
243 boards based on Exynos5 series of SoCs.
diff --git a/sound/soc/samsung/Makefile b/sound/soc/samsung/Makefile
index 86715d8efee6..6d0212ba571c 100644
--- a/sound/soc/samsung/Makefile
+++ b/sound/soc/samsung/Makefile
@@ -34,6 +34,7 @@ snd-soc-h1940-uda1380-objs := h1940_uda1380.o
34snd-soc-rx1950-uda1380-objs := rx1950_uda1380.o 34snd-soc-rx1950-uda1380-objs := rx1950_uda1380.o
35snd-soc-smdk-wm8580-objs := smdk_wm8580.o 35snd-soc-smdk-wm8580-objs := smdk_wm8580.o
36snd-soc-smdk-wm8994-objs := smdk_wm8994.o 36snd-soc-smdk-wm8994-objs := smdk_wm8994.o
37snd-soc-snow-objs := snow.o
37snd-soc-smdk-wm9713-objs := smdk_wm9713.o 38snd-soc-smdk-wm9713-objs := smdk_wm9713.o
38snd-soc-s3c64xx-smartq-wm8987-objs := smartq_wm8987.o 39snd-soc-s3c64xx-smartq-wm8987-objs := smartq_wm8987.o
39snd-soc-goni-wm8994-objs := goni_wm8994.o 40snd-soc-goni-wm8994-objs := goni_wm8994.o
@@ -58,6 +59,7 @@ obj-$(CONFIG_SND_SOC_SAMSUNG_H1940_UDA1380) += snd-soc-h1940-uda1380.o
58obj-$(CONFIG_SND_SOC_SAMSUNG_RX1950_UDA1380) += snd-soc-rx1950-uda1380.o 59obj-$(CONFIG_SND_SOC_SAMSUNG_RX1950_UDA1380) += snd-soc-rx1950-uda1380.o
59obj-$(CONFIG_SND_SOC_SAMSUNG_SMDK_WM8580) += snd-soc-smdk-wm8580.o 60obj-$(CONFIG_SND_SOC_SAMSUNG_SMDK_WM8580) += snd-soc-smdk-wm8580.o
60obj-$(CONFIG_SND_SOC_SAMSUNG_SMDK_WM8994) += snd-soc-smdk-wm8994.o 61obj-$(CONFIG_SND_SOC_SAMSUNG_SMDK_WM8994) += snd-soc-smdk-wm8994.o
62obj-$(CONFIG_SND_SOC_SNOW) += snd-soc-snow.o
61obj-$(CONFIG_SND_SOC_SAMSUNG_SMDK_WM9713) += snd-soc-smdk-wm9713.o 63obj-$(CONFIG_SND_SOC_SAMSUNG_SMDK_WM9713) += snd-soc-smdk-wm9713.o
62obj-$(CONFIG_SND_SOC_SMARTQ) += snd-soc-s3c64xx-smartq-wm8987.o 64obj-$(CONFIG_SND_SOC_SMARTQ) += snd-soc-s3c64xx-smartq-wm8987.o
63obj-$(CONFIG_SND_SOC_SAMSUNG_SMDK_SPDIF) += snd-soc-smdk-spdif.o 65obj-$(CONFIG_SND_SOC_SAMSUNG_SMDK_SPDIF) += snd-soc-smdk-spdif.o
diff --git a/sound/soc/samsung/snow.c b/sound/soc/samsung/snow.c
new file mode 100644
index 000000000000..0fa89a41d8c0
--- /dev/null
+++ b/sound/soc/samsung/snow.c
@@ -0,0 +1,122 @@
1/*
2 * ASoC machine driver for Snow boards
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 */
13
14#include <linux/module.h>
15#include <linux/platform_device.h>
16#include <linux/of.h>
17#include <linux/of_device.h>
18
19#include <sound/soc.h>
20
21#include "i2s.h"
22
23#define FIN_PLL_RATE 24000000
24
25static struct snd_soc_dai_link snow_dai[] = {
26 {
27 .name = "Primary",
28 .stream_name = "Primary",
29 .codec_dai_name = "HiFi",
30 .dai_fmt = SND_SOC_DAIFMT_I2S |
31 SND_SOC_DAIFMT_NB_NF |
32 SND_SOC_DAIFMT_CBS_CFS,
33 },
34};
35
36static int snow_late_probe(struct snd_soc_card *card)
37{
38 struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai;
39 struct snd_soc_dai *cpu_dai = card->rtd[0].cpu_dai;
40 int ret;
41
42 /* Set the MCLK rate for the codec */
43 ret = snd_soc_dai_set_sysclk(codec_dai, 0,
44 FIN_PLL_RATE, SND_SOC_CLOCK_IN);
45 if (ret < 0)
46 return ret;
47
48 /* Select I2S Bus clock to set RCLK and BCLK */
49 ret = snd_soc_dai_set_sysclk(cpu_dai, SAMSUNG_I2S_RCLKSRC_0,
50 0, SND_SOC_CLOCK_IN);
51 if (ret < 0)
52 return ret;
53
54 return 0;
55}
56
57static struct snd_soc_card snow_snd = {
58 .name = "Snow-I2S",
59 .dai_link = snow_dai,
60 .num_links = ARRAY_SIZE(snow_dai),
61
62 .late_probe = snow_late_probe,
63};
64
65static int snow_probe(struct platform_device *pdev)
66{
67 struct snd_soc_card *card = &snow_snd;
68 struct device_node *i2s_node, *codec_node;
69 int i, ret;
70
71 i2s_node = of_parse_phandle(pdev->dev.of_node,
72 "samsung,i2s-controller", 0);
73 if (!i2s_node) {
74 dev_err(&pdev->dev,
75 "Property 'i2s-controller' missing or invalid\n");
76 return -EINVAL;
77 }
78
79 codec_node = of_parse_phandle(pdev->dev.of_node,
80 "samsung,audio-codec", 0);
81 if (!codec_node) {
82 dev_err(&pdev->dev,
83 "Property 'audio-codec' missing or invalid\n");
84 return -EINVAL;
85 }
86
87 for (i = 0; i < ARRAY_SIZE(snow_dai); i++) {
88 snow_dai[i].codec_of_node = codec_node;
89 snow_dai[i].cpu_of_node = i2s_node;
90 snow_dai[i].platform_of_node = i2s_node;
91 }
92
93 card->dev = &pdev->dev;
94
95 ret = devm_snd_soc_register_card(&pdev->dev, card);
96 if (ret) {
97 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
98 return ret;
99 }
100
101 return ret;
102}
103
104static const struct of_device_id snow_of_match[] = {
105 { .compatible = "google,snow-audio-max98090", },
106 { .compatible = "google,snow-audio-max98095", },
107 {},
108};
109
110static struct platform_driver snow_driver = {
111 .driver = {
112 .name = "snow-audio",
113 .owner = THIS_MODULE,
114 .of_match_table = snow_of_match,
115 },
116 .probe = snow_probe,
117};
118
119module_platform_driver(snow_driver);
120
121MODULE_DESCRIPTION("ALSA SoC Audio machine driver for Snow");
122MODULE_LICENSE("GPL");