aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2014-03-13 10:19:34 -0400
committerMark Brown <broonie@linaro.org>2014-03-13 10:19:34 -0400
commit5881af77082924fe56a23b5bcc9823f906780772 (patch)
treedcc0b2522f6f264a9dd2ae85ef507fdcf81b3d5b
parent4c11a761b8cff3d1941a53ec2a2bb2279ca38b44 (diff)
parent74d04c3efbc4f10990e5c4218ad3f65bfdcf3c75 (diff)
Merge remote-tracking branch 'asoc/topic/kirkwood' into asoc-next
-rw-r--r--Documentation/devicetree/bindings/sound/armada-370db-audio.txt24
-rw-r--r--Documentation/devicetree/bindings/sound/mvebu-audio.txt1
-rw-r--r--sound/soc/kirkwood/Kconfig10
-rw-r--r--sound/soc/kirkwood/Makefile2
-rw-r--r--sound/soc/kirkwood/armada-370-db.c120
-rw-r--r--sound/soc/kirkwood/kirkwood-i2s.c1
6 files changed, 157 insertions, 1 deletions
diff --git a/Documentation/devicetree/bindings/sound/armada-370db-audio.txt b/Documentation/devicetree/bindings/sound/armada-370db-audio.txt
new file mode 100644
index 000000000000..3893b4d15a20
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/armada-370db-audio.txt
@@ -0,0 +1,24 @@
1Device Tree bindings for the Armada 370 DB audio
2================================================
3
4These Device Tree bindings are used to describe the audio complex
5found on the Armada 370 DB platform.
6
7Mandatory properties:
8
9 * compatible: must be "marvell,a370db-audio"
10
11 * marvell,audio-controller: a phandle that points to the audio
12 controller of the Armada 370 SoC.
13
14 * marvell,audio-codec: a phandle that points to the analog audio
15 codec connected to the Armada 370 SoC.
16
17Example:
18
19 sound {
20 compatible = "marvell,a370db-audio";
21 marvell,audio-controller = <&audio_controller>;
22 marvell,audio-codec = <&audio_codec>;
23 status = "okay";
24 };
diff --git a/Documentation/devicetree/bindings/sound/mvebu-audio.txt b/Documentation/devicetree/bindings/sound/mvebu-audio.txt
index f0062c5871b4..cb8c07c81ce4 100644
--- a/Documentation/devicetree/bindings/sound/mvebu-audio.txt
+++ b/Documentation/devicetree/bindings/sound/mvebu-audio.txt
@@ -5,6 +5,7 @@ Required properties:
5- compatible: 5- compatible:
6 "marvell,kirkwood-audio" for Kirkwood platforms 6 "marvell,kirkwood-audio" for Kirkwood platforms
7 "marvell,dove-audio" for Dove platforms 7 "marvell,dove-audio" for Dove platforms
8 "marvell,armada370-audio" for Armada 370 platforms
8 9
9- reg: physical base address of the controller and length of memory mapped 10- reg: physical base address of the controller and length of memory mapped
10 region. 11 region.
diff --git a/sound/soc/kirkwood/Kconfig b/sound/soc/kirkwood/Kconfig
index 78ed4a42ad21..2dc3ecf34801 100644
--- a/sound/soc/kirkwood/Kconfig
+++ b/sound/soc/kirkwood/Kconfig
@@ -1,11 +1,19 @@
1config SND_KIRKWOOD_SOC 1config SND_KIRKWOOD_SOC
2 tristate "SoC Audio for the Marvell Kirkwood and Dove chips" 2 tristate "SoC Audio for the Marvell Kirkwood and Dove chips"
3 depends on ARCH_KIRKWOOD || ARCH_DOVE || COMPILE_TEST 3 depends on ARCH_KIRKWOOD || ARCH_DOVE || ARCH_MVEBU || COMPILE_TEST
4 help 4 help
5 Say Y or M if you want to add support for codecs attached to 5 Say Y or M if you want to add support for codecs attached to
6 the Kirkwood I2S interface. You will also need to select the 6 the Kirkwood I2S interface. You will also need to select the
7 audio interfaces to support below. 7 audio interfaces to support below.
8 8
9config SND_KIRKWOOD_SOC_ARMADA370_DB
10 tristate "SoC Audio support for Armada 370 DB"
11 depends on SND_KIRKWOOD_SOC && (ARCH_MVEBU || COMPILE_TEST) && I2C
12 select SND_SOC_CS42L51
13 help
14 Say Y if you want to add support for SoC audio on
15 the Armada 370 Development Board.
16
9config SND_KIRKWOOD_SOC_OPENRD 17config SND_KIRKWOOD_SOC_OPENRD
10 tristate "SoC Audio support for Kirkwood Openrd Client" 18 tristate "SoC Audio support for Kirkwood Openrd Client"
11 depends on SND_KIRKWOOD_SOC && (MACH_OPENRD_CLIENT || MACH_OPENRD_ULTIMATE || COMPILE_TEST) 19 depends on SND_KIRKWOOD_SOC && (MACH_OPENRD_CLIENT || MACH_OPENRD_ULTIMATE || COMPILE_TEST)
diff --git a/sound/soc/kirkwood/Makefile b/sound/soc/kirkwood/Makefile
index 9e781385cb88..7c1d8fe09e6b 100644
--- a/sound/soc/kirkwood/Makefile
+++ b/sound/soc/kirkwood/Makefile
@@ -4,6 +4,8 @@ obj-$(CONFIG_SND_KIRKWOOD_SOC) += snd-soc-kirkwood.o
4 4
5snd-soc-openrd-objs := kirkwood-openrd.o 5snd-soc-openrd-objs := kirkwood-openrd.o
6snd-soc-t5325-objs := kirkwood-t5325.o 6snd-soc-t5325-objs := kirkwood-t5325.o
7snd-soc-armada-370-db-objs := armada-370-db.o
7 8
9obj-$(CONFIG_SND_KIRKWOOD_SOC_ARMADA370_DB) += snd-soc-armada-370-db.o
8obj-$(CONFIG_SND_KIRKWOOD_SOC_OPENRD) += snd-soc-openrd.o 10obj-$(CONFIG_SND_KIRKWOOD_SOC_OPENRD) += snd-soc-openrd.o
9obj-$(CONFIG_SND_KIRKWOOD_SOC_T5325) += snd-soc-t5325.o 11obj-$(CONFIG_SND_KIRKWOOD_SOC_T5325) += snd-soc-t5325.o
diff --git a/sound/soc/kirkwood/armada-370-db.c b/sound/soc/kirkwood/armada-370-db.c
new file mode 100644
index 000000000000..977639b3ffde
--- /dev/null
+++ b/sound/soc/kirkwood/armada-370-db.c
@@ -0,0 +1,120 @@
1/*
2 * Copyright (C) 2014 Marvell
3 *
4 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
10 */
11
12#include <linux/module.h>
13#include <linux/moduleparam.h>
14#include <linux/interrupt.h>
15#include <linux/platform_device.h>
16#include <linux/slab.h>
17#include <sound/soc.h>
18#include <linux/of.h>
19#include <linux/platform_data/asoc-kirkwood.h>
20#include "../codecs/cs42l51.h"
21
22static int a370db_hw_params(struct snd_pcm_substream *substream,
23 struct snd_pcm_hw_params *params)
24{
25 struct snd_soc_pcm_runtime *rtd = substream->private_data;
26 struct snd_soc_dai *codec_dai = rtd->codec_dai;
27 unsigned int freq;
28
29 switch (params_rate(params)) {
30 default:
31 case 44100:
32 freq = 11289600;
33 break;
34 case 48000:
35 freq = 12288000;
36 break;
37 case 96000:
38 freq = 24576000;
39 break;
40 }
41
42 return snd_soc_dai_set_sysclk(codec_dai, 0, freq, SND_SOC_CLOCK_IN);
43}
44
45static struct snd_soc_ops a370db_ops = {
46 .hw_params = a370db_hw_params,
47};
48
49static const struct snd_soc_dapm_widget a370db_dapm_widgets[] = {
50 SND_SOC_DAPM_HP("Out Jack", NULL),
51 SND_SOC_DAPM_LINE("In Jack", NULL),
52};
53
54static const struct snd_soc_dapm_route a370db_route[] = {
55 { "Out Jack", NULL, "HPL" },
56 { "Out Jack", NULL, "HPR" },
57 { "AIN1L", NULL, "In Jack" },
58 { "AIN1L", NULL, "In Jack" },
59};
60
61static struct snd_soc_dai_link a370db_dai[] = {
62{
63 .name = "CS42L51",
64 .stream_name = "analog",
65 .cpu_dai_name = "i2s",
66 .codec_dai_name = "cs42l51-hifi",
67 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS,
68 .ops = &a370db_ops,
69},
70};
71
72static struct snd_soc_card a370db = {
73 .name = "a370db",
74 .owner = THIS_MODULE,
75 .dai_link = a370db_dai,
76 .num_links = ARRAY_SIZE(a370db_dai),
77 .dapm_widgets = a370db_dapm_widgets,
78 .num_dapm_widgets = ARRAY_SIZE(a370db_dapm_widgets),
79 .dapm_routes = a370db_route,
80 .num_dapm_routes = ARRAY_SIZE(a370db_route),
81};
82
83static int a370db_probe(struct platform_device *pdev)
84{
85 struct snd_soc_card *card = &a370db;
86
87 card->dev = &pdev->dev;
88
89 a370db_dai[0].cpu_of_node =
90 of_parse_phandle(pdev->dev.of_node,
91 "marvell,audio-controller", 0);
92 a370db_dai[0].platform_of_node = a370db_dai[0].cpu_of_node;
93
94 a370db_dai[0].codec_of_node =
95 of_parse_phandle(pdev->dev.of_node,
96 "marvell,audio-codec", 0);
97
98 return devm_snd_soc_register_card(card->dev, card);
99}
100
101static const struct of_device_id a370db_dt_ids[] = {
102 { .compatible = "marvell,a370db-audio" },
103 { },
104};
105
106static struct platform_driver a370db_driver = {
107 .driver = {
108 .name = "a370db-audio",
109 .owner = THIS_MODULE,
110 .of_match_table = of_match_ptr(a370db_dt_ids),
111 },
112 .probe = a370db_probe,
113};
114
115module_platform_driver(a370db_driver);
116
117MODULE_AUTHOR("Thomas Petazzoni <thomas.petazzoni@free-electrons.com>");
118MODULE_DESCRIPTION("ALSA SoC a370db audio client");
119MODULE_LICENSE("GPL");
120MODULE_ALIAS("platform:a370db-audio");
diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c
index 3920a5e8125f..9f842222e798 100644
--- a/sound/soc/kirkwood/kirkwood-i2s.c
+++ b/sound/soc/kirkwood/kirkwood-i2s.c
@@ -633,6 +633,7 @@ static int kirkwood_i2s_dev_remove(struct platform_device *pdev)
633static struct of_device_id mvebu_audio_of_match[] = { 633static struct of_device_id mvebu_audio_of_match[] = {
634 { .compatible = "marvell,kirkwood-audio" }, 634 { .compatible = "marvell,kirkwood-audio" },
635 { .compatible = "marvell,dove-audio" }, 635 { .compatible = "marvell,dove-audio" },
636 { .compatible = "marvell,armada370-audio" },
636 { } 637 { }
637}; 638};
638MODULE_DEVICE_TABLE(of, mvebu_audio_of_match); 639MODULE_DEVICE_TABLE(of, mvebu_audio_of_match);