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 #define DRV_NAME "spdif-dit"
28 #define STUB_RATES SNDRV_PCM_RATE_8000_96000
29 #define STUB_FORMATS SNDRV_PCM_FMTBIT_S16_LE
32 static struct snd_soc_codec_driver soc_codec_spdif_dit;
34 static struct snd_soc_dai_driver dit_stub_dai = {
35 .name = "rk-hdmi-spdif-hifi",
37 .stream_name = "Playback",
41 .formats = STUB_FORMATS,
45 static int rockchip_hdmi_spdif_audio_probe(struct platform_device *pdev)
49 //set dev name to driver->name for sound card register
50 dev_set_name(&pdev->dev, "%s", pdev->dev.driver->name);
52 ret = snd_soc_register_codec(&pdev->dev, &soc_codec_spdif_dit,
56 printk("%s() register codec failed:%d\n", __FUNCTION__, ret);
61 static int rockchip_hdmi_spdif_audio_remove(struct platform_device *pdev)
63 snd_soc_unregister_codec(&pdev->dev);
69 static const struct of_device_id rockchip_hdmi_spdif_of_match[] = {
70 { .compatible = "hdmi-spdif", },
73 MODULE_DEVICE_TABLE(of, rockchip_hdmi_spdif_of_match);
74 #endif /* CONFIG_OF */
76 static struct platform_driver rockchip_hdmi_spdif_audio_driver = {
80 .of_match_table = of_match_ptr(rockchip_hdmi_spdif_of_match),
82 .probe = rockchip_hdmi_spdif_audio_probe,
83 .remove = rockchip_hdmi_spdif_audio_remove,
86 module_platform_driver(rockchip_hdmi_spdif_audio_driver);
88 MODULE_AUTHOR("Steve Chen <schen@mvista.com>");
89 MODULE_DESCRIPTION("SPDIF dummy codec driver");
90 MODULE_LICENSE("GPL");
91 MODULE_ALIAS("platform:" DRV_NAME);