mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-24 19:40:21 +09:00
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>
This commit is contained in:
committed by
Andrey Konovalov
parent
84b87e65c6
commit
a0f87ce5bd
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
74
sound/soc/codecs/i2s_stub.c
Normal file
74
sound/soc/codecs/i2s_stub.c
Normal file
@@ -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");
|
||||
Reference in New Issue
Block a user