summaryrefslogtreecommitdiff
path: root/sound/soc/sprd/codec/null-codec
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/sprd/codec/null-codec')
-rw-r--r--sound/soc/sprd/codec/null-codec/Kconfig2
-rw-r--r--sound/soc/sprd/codec/null-codec/Makefile6
-rw-r--r--sound/soc/sprd/codec/null-codec/null-codec.c110
-rw-r--r--sound/soc/sprd/codec/null-codec/null-codec.h20
4 files changed, 138 insertions, 0 deletions
diff --git a/sound/soc/sprd/codec/null-codec/Kconfig b/sound/soc/sprd/codec/null-codec/Kconfig
new file mode 100644
index 00000000..22c2e902
--- /dev/null
+++ b/sound/soc/sprd/codec/null-codec/Kconfig
@@ -0,0 +1,2 @@
+config SND_SOC_NULL_CODEC
+ tristate # "null codec"
diff --git a/sound/soc/sprd/codec/null-codec/Makefile b/sound/soc/sprd/codec/null-codec/Makefile
new file mode 100644
index 00000000..d6806e1d
--- /dev/null
+++ b/sound/soc/sprd/codec/null-codec/Makefile
@@ -0,0 +1,6 @@
+
+SPRD_SOUND_TREE := sound/soc/sprd/
+KBUILD_CFLAGS += -I$(SPRD_SOUND_TREE) -I$(SPRD_SOUND_TREE)/codec
+
+snd-soc-sprd-null-codec-objs := null-codec.o
+obj-$(CONFIG_SND_SOC_NULL_CODEC) += snd-soc-sprd-null-codec.o
diff --git a/sound/soc/sprd/codec/null-codec/null-codec.c b/sound/soc/sprd/codec/null-codec/null-codec.c
new file mode 100644
index 00000000..0a8a9a0a
--- /dev/null
+++ b/sound/soc/sprd/codec/null-codec/null-codec.c
@@ -0,0 +1,110 @@
+/*
+ * sound/soc/sprd/codec/null-codec/null-codec.c
+ *
+ * NULL-CODEC -- SpreadTrum just for codec code.
+ *
+ * Copyright (C) 2012 SpreadTrum Ltd.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+#include "sprd-asoc-debug.h"
+#define pr_fmt(fmt) pr_sprd_fmt("NULCD") fmt
+
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/device.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/delay.h>
+#include <linux/string.h>
+#include <linux/sysfs.h>
+#include <linux/stat.h>
+#include <linux/of.h>
+
+#include <sound/core.h>
+#include <sound/soc.h>
+
+#include "sprd-asoc-common.h"
+#include "null-codec.h"
+
+/* PCM Playing and Recording default in full duplex mode */
+struct snd_soc_dai_driver null_codec_dai[] = {
+ {
+ .name = "null-codec-dai",
+ .playback = {
+ .stream_name = "Playback",
+ .channels_min = 1,
+ .channels_max = 2,
+ .rates = SNDRV_PCM_RATE_8000_48000,
+ .formats = SNDRV_PCM_FMTBIT_S16_LE,
+ },
+ .capture = {
+ .stream_name = "Capture",
+ .channels_min = 1,
+ .channels_max = 2,
+ .rates = SNDRV_PCM_RATE_8000_48000,
+ .formats = SNDRV_PCM_FMTBIT_S16_LE,
+ },
+ },
+};
+
+static struct snd_soc_codec_driver soc_codec_dev_null_codec = { 0 };
+
+static int null_codec_codec_probe(struct platform_device *pdev)
+{
+ int ret;
+
+ sp_asoc_pr_dbg("%s\n", __func__);
+
+ ret = snd_soc_register_codec(&pdev->dev,
+ &soc_codec_dev_null_codec, null_codec_dai,
+ ARRAY_SIZE(null_codec_dai));
+ if (ret != 0) {
+ pr_err("ERR:Failed to register NULL CODEC: %d\n", ret);
+ return ret;
+ }
+
+ return 0;
+
+}
+
+static int null_codec_codec_remove(struct platform_device *pdev)
+{
+ snd_soc_unregister_codec(&pdev->dev);
+ return 0;
+}
+
+#ifdef CONFIG_OF
+static const struct of_device_id codec_of_match[] = {
+ {.compatible = "sprd,null-codec",},
+ {},
+};
+
+MODULE_DEVICE_TABLE(of, codec_of_match);
+#endif
+
+static struct platform_driver null_codec_codec_driver = {
+ .driver = {
+ .name = "null-codec",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(codec_of_match),
+ },
+ .probe = null_codec_codec_probe,
+ .remove = null_codec_codec_remove,
+};
+
+module_platform_driver(null_codec_codec_driver);
+
+MODULE_DESCRIPTION("NULL-CODEC ALSA SoC codec driver");
+MODULE_AUTHOR("Ken Kuang <ken.kuang@spreadtrum.com>");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("codec:null-codec");
diff --git a/sound/soc/sprd/codec/null-codec/null-codec.h b/sound/soc/sprd/codec/null-codec/null-codec.h
new file mode 100644
index 00000000..de413f0c
--- /dev/null
+++ b/sound/soc/sprd/codec/null-codec/null-codec.h
@@ -0,0 +1,20 @@
+/*
+ * sound/soc/sprd/codec/null-codec/null-codec.h
+ *
+ * NULL-CODEC -- SpreadTrum just for codec code.
+ *
+ * Copyright (C) 2012 SpreadTrum Ltd.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY ork FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+#ifndef __NULL_CODEC_H
+#define __NULL_CODEC_H
+
+#endif /* __NULL_CODEC_H */