ASoC: rockchip: coding style.
[firefly-linux-kernel-4.4.55.git] / sound / soc / codecs / hdmi_i2s.c
1 /*
2  * hdmi_i2s.c  --  HDMI i2s audio for rockchip
3  *
4  * Copyright (C) 2015 Fuzhou Rockchip Electronics Co., Ltd
5  *
6  * This software is licensed under the terms of the GNU General Public
7  * License version 2, as published by the Free Software Foundation, and
8  * may be copied, distributed, and modified under those terms.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  */
16
17 #include <linux/module.h>
18 #include <linux/moduleparam.h>
19 #include <linux/slab.h>
20 #include <linux/of.h>
21 #include <linux/of_gpio.h>
22 #include <sound/soc.h>
23 #include <sound/pcm.h>
24 #include <sound/initval.h>
25
26 struct snd_soc_dai_driver hdmi_i2s_dai = {
27         .name = "rk-hdmi-i2s-hifi",
28         .playback = {
29                 .stream_name = "HiFi Playback",
30                 .channels_min = 2,
31                 .channels_max = 8,
32                 .rates = (SNDRV_PCM_RATE_32000 |
33                           SNDRV_PCM_RATE_44100 |
34                           SNDRV_PCM_RATE_48000 |
35                           SNDRV_PCM_RATE_96000 |
36                           SNDRV_PCM_RATE_192000),
37                 .formats = (SNDRV_PCM_FMTBIT_S16_LE |
38                             SNDRV_PCM_FMTBIT_S20_3LE |
39                             SNDRV_PCM_FMTBIT_S24_LE),
40         },
41 };
42
43 static struct snd_soc_codec_driver soc_codec_dev_hdmi_i2s;
44
45 static int rockchip_hdmi_i2s_audio_probe(struct platform_device *pdev)
46 {
47         int ret;
48
49         ret = snd_soc_register_codec(&pdev->dev,
50                                      &soc_codec_dev_hdmi_i2s,
51                                      &hdmi_i2s_dai, 1);
52
53         if (ret)
54                 dev_err(&pdev->dev, "register card failed: %d\n", ret);
55
56         return ret;
57 }
58
59 static int rockchip_hdmi_i2s_audio_remove(struct platform_device *pdev)
60 {
61         snd_soc_unregister_codec(&pdev->dev);
62
63         return 0;
64 }
65
66 #ifdef CONFIG_OF
67 static const struct of_device_id rockchip_hdmi_i2s_of_match[] = {
68         { .compatible = "hdmi-i2s", },
69         {},
70 };
71 MODULE_DEVICE_TABLE(of, rockchip_hdmi_i2s_of_match);
72 #endif /* CONFIG_OF */
73
74 static struct platform_driver rockchip_hdmi_i2s_audio_driver = {
75         .driver = {
76                 .name = "hdmi-i2s",
77                 .of_match_table = of_match_ptr(rockchip_hdmi_i2s_of_match),
78         },
79         .probe = rockchip_hdmi_i2s_audio_probe,
80         .remove = rockchip_hdmi_i2s_audio_remove,
81 };
82
83 module_platform_driver(rockchip_hdmi_i2s_audio_driver);
84
85 MODULE_DESCRIPTION("Rockchip HDMI I2S Dummy Driver");
86 MODULE_LICENSE("GPL");
87 MODULE_ALIAS("platform:hdmi-i2s");