2 * ALSA SoC SPDIF DIT driver
4 * This driver is used by controllers which can operate in DIT (SPDI/F) where
5 * no codec is needed. This file provides stub codec that can be used
6 * in these configurations. TI DaVinci Audio controller uses this driver.
8 * Author: Steve Chen, <schen@mvista.com>
9 * Copyright: (C) 2009 MontaVista Software, Inc., <source@mvista.com>
10 * Copyright: (C) 2009 Texas Instruments, India
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
17 #include <linux/module.h>
18 #include <linux/moduleparam.h>
19 #include <linux/slab.h>
21 #include <linux/of_gpio.h>
22 #include <sound/soc.h>
23 #include <sound/pcm.h>
24 #include <sound/initval.h>
26 #undef DEBUG_HDMI_SPDIF
27 #define DEBUG_HDMI_SPDIF 0
30 #define RK_HDMISPDIF_DBG(x...) pr_info("hdmi_spdif:"x)
32 #define RK_HDMISPDIF_DBG(x...) do { } while (0)
36 #define DRV_NAME "spdif-dit"
38 #define STUB_RATES SNDRV_PCM_RATE_8000_96000
39 #define STUB_FORMATS SNDRV_PCM_FMTBIT_S16_LE
42 static struct snd_soc_codec_driver soc_codec_spdif_dit;
44 static struct snd_soc_dai_driver dit_stub_dai = {
45 .name = "rk-hdmi-spdif-hifi",
47 .stream_name = "Playback",
51 .formats = STUB_FORMATS,
55 static int hdmi_spdif_audio_probe(struct platform_device *pdev)
59 /* set dev name to driver->name for sound card register. */
60 dev_set_name(&pdev->dev, "%s", pdev->dev.driver->name);
62 ret = snd_soc_register_codec(&pdev->
63 dev, &soc_codec_spdif_dit, &dit_stub_dai, 1);
66 RK_HDMISPDIF_DBG("%s register codec failed:%d\n"
72 static int hdmi_spdif_audio_remove(struct platform_device *pdev)
74 snd_soc_unregister_codec(&pdev->dev);
80 static const struct of_device_id hdmi_spdif_of_match[] = {
81 { .compatible = "hdmi-spdif", },
84 MODULE_DEVICE_TABLE(of, hdmi_spdif_of_match);
85 #endif /* CONFIG_OF */
87 static struct platform_driver hdmi_spdif_audio_driver = {
91 .of_match_table = of_match_ptr(hdmi_spdif_of_match),
93 .probe = hdmi_spdif_audio_probe,
94 .remove = hdmi_spdif_audio_remove,
97 module_platform_driver(hdmi_spdif_audio_driver);
99 MODULE_AUTHOR("Steve Chen <schen@mvista.com>");
100 MODULE_DESCRIPTION("SPDIF dummy codec driver");
101 MODULE_LICENSE("GPL");
102 MODULE_ALIAS("platform:" DRV_NAME);