2 * hdmi_i2s.c -- HDMI i2s audio for rockchip
4 * Copyright 2013 Rockship
5 * Author: chenjq <chenjq@rock-chips.com>
8 #include <linux/module.h>
9 #include <linux/moduleparam.h>
10 #include <linux/slab.h>
12 #include <linux/of_gpio.h>
13 #include <sound/soc.h>
14 #include <sound/pcm.h>
15 #include <sound/initval.h>
18 #define DBG(x...) printk(KERN_INFO "hdmi i2s:"x)
20 #define DBG(x...) do { } while (0)
23 struct snd_soc_dai_driver hdmi_i2s_dai = {
24 .name = "rk-hdmi-i2s-hifi",
26 .stream_name = "HiFi Playback",
29 .rates = (SNDRV_PCM_RATE_32000 |
30 SNDRV_PCM_RATE_44100 |
31 SNDRV_PCM_RATE_48000 |
32 SNDRV_PCM_RATE_96000 |
33 SNDRV_PCM_RATE_192000),
34 .formats = (SNDRV_PCM_FMTBIT_S16_LE |
35 SNDRV_PCM_FMTBIT_S20_3LE |
36 SNDRV_PCM_FMTBIT_S24_LE),
40 static struct snd_soc_codec_driver soc_codec_dev_hdmi_i2s;
42 static int rockchip_hdmi_i2s_audio_probe(struct platform_device *pdev)
46 //set dev name to driver->name for sound card register
47 dev_set_name(&pdev->dev, "%s", pdev->dev.driver->name);
49 ret = snd_soc_register_codec(&pdev->dev,
50 &soc_codec_dev_hdmi_i2s,
54 printk("%s() register card failed:%d\n", __FUNCTION__, ret);
59 static int rockchip_hdmi_i2s_audio_remove(struct platform_device *pdev)
61 snd_soc_unregister_codec(&pdev->dev);
67 static const struct of_device_id rockchip_hdmi_i2s_of_match[] = {
68 { .compatible = "hdmi-i2s", },
71 MODULE_DEVICE_TABLE(of, rockchip_hdmi_i2s_of_match);
72 #endif /* CONFIG_OF */
74 static struct platform_driver rockchip_hdmi_i2s_audio_driver = {
78 .of_match_table = of_match_ptr(rockchip_hdmi_i2s_of_match),
80 .probe = rockchip_hdmi_i2s_audio_probe,
81 .remove = rockchip_hdmi_i2s_audio_remove,
84 module_platform_driver(rockchip_hdmi_i2s_audio_driver);
86 MODULE_DESCRIPTION("HDMI I2S Controller Driver");
87 MODULE_LICENSE("GPL");
88 MODULE_ALIAS("platform:hdmi-i2s");