0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #include <linux/module.h>
0015 #include <linux/moduleparam.h>
0016 #include <linux/slab.h>
0017 #include <sound/soc.h>
0018 #include <sound/pcm.h>
0019 #include <sound/initval.h>
0020 #include <linux/of.h>
0021
0022 #define DRV_NAME "spdif-dit"
0023
0024 #define STUB_RATES SNDRV_PCM_RATE_8000_192000
0025 #define STUB_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \
0026 SNDRV_PCM_FMTBIT_S20_3LE | \
0027 SNDRV_PCM_FMTBIT_S24_LE | \
0028 SNDRV_PCM_FMTBIT_S32_LE)
0029
0030 static const struct snd_soc_dapm_widget dit_widgets[] = {
0031 SND_SOC_DAPM_OUTPUT("spdif-out"),
0032 };
0033
0034 static const struct snd_soc_dapm_route dit_routes[] = {
0035 { "spdif-out", NULL, "Playback" },
0036 };
0037
0038 static struct snd_soc_component_driver soc_codec_spdif_dit = {
0039 .dapm_widgets = dit_widgets,
0040 .num_dapm_widgets = ARRAY_SIZE(dit_widgets),
0041 .dapm_routes = dit_routes,
0042 .num_dapm_routes = ARRAY_SIZE(dit_routes),
0043 .idle_bias_on = 1,
0044 .use_pmdown_time = 1,
0045 .endianness = 1,
0046 };
0047
0048 static struct snd_soc_dai_driver dit_stub_dai = {
0049 .name = "dit-hifi",
0050 .playback = {
0051 .stream_name = "Playback",
0052 .channels_min = 1,
0053 .channels_max = 384,
0054 .rates = STUB_RATES,
0055 .formats = STUB_FORMATS,
0056 },
0057 };
0058
0059 static int spdif_dit_probe(struct platform_device *pdev)
0060 {
0061 return devm_snd_soc_register_component(&pdev->dev,
0062 &soc_codec_spdif_dit,
0063 &dit_stub_dai, 1);
0064 }
0065
0066 #ifdef CONFIG_OF
0067 static const struct of_device_id spdif_dit_dt_ids[] = {
0068 { .compatible = "linux,spdif-dit", },
0069 { }
0070 };
0071 MODULE_DEVICE_TABLE(of, spdif_dit_dt_ids);
0072 #endif
0073
0074 static struct platform_driver spdif_dit_driver = {
0075 .probe = spdif_dit_probe,
0076 .driver = {
0077 .name = DRV_NAME,
0078 .of_match_table = of_match_ptr(spdif_dit_dt_ids),
0079 },
0080 };
0081
0082 module_platform_driver(spdif_dit_driver);
0083
0084 MODULE_AUTHOR("Steve Chen <schen@mvista.com>");
0085 MODULE_DESCRIPTION("SPDIF dummy codec driver");
0086 MODULE_LICENSE("GPL");
0087 MODULE_ALIAS("platform:" DRV_NAME);