Merge branch 'linux-linaro-lsk-v4.4-android' of git://git.linaro.org/kernel/linux...
[firefly-linux-kernel-4.4.55.git] / sound / soc / codecs / hdmi_spdif.c
old mode 100644 (file)
new mode 100755 (executable)
index 6a1a7e7..792263c
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/slab.h>
+#include <linux/of.h>
+#include <linux/of_gpio.h>
 #include <sound/soc.h>
 #include <sound/pcm.h>
 #include <sound/initval.h>
 
 #define DRV_NAME "spdif-dit"
 
-#define STUB_RATES     SNDRV_PCM_RATE_8000_96000
-#define STUB_FORMATS   SNDRV_PCM_FMTBIT_S16_LE
+#define STUB_RATES     SNDRV_PCM_RATE_8000_192000
+#define STUB_FORMATS   (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE)
 
 
 static struct snd_soc_codec_driver soc_codec_spdif_dit;
 
 static struct snd_soc_dai_driver dit_stub_dai = {
-       .name           = "dit-hifi",
-       .playback       = {
+       .name           = "rk-hdmi-spdif-hifi",
+       .playback       = {
                .stream_name    = "Playback",
                .channels_min   = 1,
                .channels_max   = 384,
@@ -40,39 +42,45 @@ static struct snd_soc_dai_driver dit_stub_dai = {
        },
 };
 
-static int spdif_dit_probe(struct platform_device *pdev)
+static int hdmi_spdif_audio_probe(struct platform_device *pdev)
 {
-       return snd_soc_register_codec(&pdev->dev, &soc_codec_spdif_dit,
-                       &dit_stub_dai, 1);
+       int ret;
+
+       ret = snd_soc_register_codec(&pdev->dev, &soc_codec_spdif_dit,
+                                    &dit_stub_dai, 1);
+
+       if (ret)
+               dev_err(&pdev->dev, "%s register failed: %d\n",
+                       __func__, ret);
+
+       return ret;
 }
 
-static int spdif_dit_remove(struct platform_device *pdev)
+static int hdmi_spdif_audio_remove(struct platform_device *pdev)
 {
        snd_soc_unregister_codec(&pdev->dev);
+
        return 0;
 }
 
-static struct platform_driver spdif_dit_driver = {
-       .probe          = spdif_dit_probe,
-       .remove         = spdif_dit_remove,
-       .driver         = {
-               .name   = DRV_NAME,
-               .owner  = THIS_MODULE,
-       },
+#ifdef CONFIG_OF
+static const struct of_device_id hdmi_spdif_of_match[] = {
+       { .compatible = "hdmi-spdif", },
+       {},
 };
+MODULE_DEVICE_TABLE(of, hdmi_spdif_of_match);
+#endif /* CONFIG_OF */
 
-static int __init dit_modinit(void)
-{
-       return platform_driver_register(&spdif_dit_driver);
-}
-
-static void __exit dit_exit(void)
-{
-       platform_driver_unregister(&spdif_dit_driver);
-}
+static struct platform_driver hdmi_spdif_audio_driver = {
+       .driver = {
+               .name = "hdmi-spdif",
+               .of_match_table = of_match_ptr(hdmi_spdif_of_match),
+       },
+       .probe = hdmi_spdif_audio_probe,
+       .remove = hdmi_spdif_audio_remove,
+};
 
-module_init(dit_modinit);
-module_exit(dit_exit);
+module_platform_driver(hdmi_spdif_audio_driver);
 
 MODULE_AUTHOR("Steve Chen <schen@mvista.com>");
 MODULE_DESCRIPTION("SPDIF dummy codec driver");