aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorTushar Behera <tushar.behera@linaro.org>2012-05-18 16:02:37 +0530
committerAndrey Konovalov <andrey.konovalov@linaro.org>2014-04-16 23:51:24 +0400
commitbd9bd62ef7d92c58c6e7ba9cd8abfc7eeb1a7540 (patch)
tree111852a9690878b828ee5fc068d20eea8b2b8cda /sound
parentcd6bc114684e9557d3ab6b2c68c9cf6b2edf69fc (diff)
ASoC: codec: i2s_stub: Add a dummy I2S based codec driver
HDMI (in Samsung EXYNOS based SoCs) can be configured to source audio data from I2S bus. For boards on which there are no external audio chips, we still need to create a I2S-based soundcard with a dummy codec driver to enable I2S subsystem to pump data to the I2S bus, which can be used by HDMI module. This patch adds a I2S stub audio codec driver which can be used to create a I2S soundcard when external chip is not there. Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/Kconfig3
-rw-r--r--sound/soc/codecs/Makefile2
-rw-r--r--sound/soc/codecs/i2s_stub.c74
3 files changed, 79 insertions, 0 deletions
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 983d087aa92..8d6bd6b4709 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -258,6 +258,9 @@ config SND_SOC_CX20442
tristate
depends on TTY
+config SND_SOC_I2S_STUB
+ tristate
+
config SND_SOC_JZ4740_CODEC
select REGMAP_MMIO
tristate
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index bc126764a44..349b4aa5c9a 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -30,6 +30,7 @@ snd-soc-da732x-objs := da732x.o
snd-soc-da9055-objs := da9055.o
snd-soc-bt-sco-objs := bt-sco.o
snd-soc-dmic-objs := dmic.o
+snd-soc-i2s-stub-objs := i2s_stub.o
snd-soc-isabelle-objs := isabelle.o
snd-soc-jz4740-codec-objs := jz4740.o
snd-soc-l3-objs := l3.o
@@ -163,6 +164,7 @@ obj-$(CONFIG_SND_SOC_DA732X) += snd-soc-da732x.o
obj-$(CONFIG_SND_SOC_DA9055) += snd-soc-da9055.o
obj-$(CONFIG_SND_SOC_BT_SCO) += snd-soc-bt-sco.o
obj-$(CONFIG_SND_SOC_DMIC) += snd-soc-dmic.o
+obj-$(CONFIG_SND_SOC_I2S_STUB) += snd-soc-i2s-stub.o
obj-$(CONFIG_SND_SOC_ISABELLE) += snd-soc-isabelle.o
obj-$(CONFIG_SND_SOC_JZ4740_CODEC) += snd-soc-jz4740-codec.o
obj-$(CONFIG_SND_SOC_L3) += snd-soc-l3.o
diff --git a/sound/soc/codecs/i2s_stub.c b/sound/soc/codecs/i2s_stub.c
new file mode 100644
index 00000000000..df6b08944ed
--- /dev/null
+++ b/sound/soc/codecs/i2s_stub.c
@@ -0,0 +1,74 @@
+/*
+ * ALSA SoC I2S Stub Codec driver
+ *
+ * This driver is used by controllers which can operate in I2S mode with
+ * Stub codec driver for I2S mode.
+ *
+ * The code is based on sound/soc/codec/spdif_transceiver.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/slab.h>
+#include <linux/of.h>
+#include <sound/soc.h>
+#include <sound/pcm.h>
+#include <sound/initval.h>
+
+
+#define I2S_STUB_RATES SNDRV_PCM_RATE_8000_192000
+#define I2S_STUB_FORMATS SNDRV_PCM_FMTBIT_S16_LE
+
+static struct snd_soc_codec_driver soc_codec_i2s_stub;
+
+static struct snd_soc_dai_driver i2s_stub_dai = {
+ .name = "i2s-stub-hifi",
+ .playback = {
+ .stream_name = "Playback",
+ .channels_min = 1,
+ .channels_max = 2,
+ .rates = I2S_STUB_RATES,
+ .formats = I2S_STUB_FORMATS,
+ },
+};
+
+static int i2s_stub_probe(struct platform_device *pdev)
+{
+ return snd_soc_register_codec(&pdev->dev, &soc_codec_i2s_stub,
+ &i2s_stub_dai, 1);
+}
+
+static int i2s_stub_remove(struct platform_device *pdev)
+{
+ snd_soc_unregister_codec(&pdev->dev);
+ return 0;
+}
+
+#ifdef CONFIG_OF
+static const struct of_device_id i2s_stub_dt_ids[] = {
+ { .compatible = "linux,i2s-stub", },
+ { }
+};
+MODULE_DEVICE_TABLE(of, i2s_stub_dt_ids);
+#endif
+
+static struct platform_driver i2s_stub_driver = {
+ .probe = i2s_stub_probe,
+ .remove = i2s_stub_remove,
+ .driver = {
+ .name = "i2s-stub",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(i2s_stub_dt_ids),
+ },
+};
+
+module_platform_driver(i2s_stub_driver);
+
+MODULE_AUTHOR("Tushar Behera");
+MODULE_DESCRIPTION("I2S stub codec driver");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform: i2s-stub");