ASoC: rockchip: coding style.
[firefly-linux-kernel-4.4.55.git] / sound / soc / rockchip / rk_hdmi_i2s.c
index 2d4c63daae7266c0b284e29db4d767b901e246b8..94c9ea279a4eada6919aa21a67d2db9939f41a7d 100755 (executable)
@@ -1,8 +1,17 @@
 /*
  * rk_hdmi_i2s.c  --  HDMI i2s audio for rockchip
  *
- * Copyright 2013 Rockship
- * Author: chenjq <chenjq@rock-chips.com>
+ * Copyright (C) 2015 Fuzhou Rockchip Electronics Co., Ltd
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
  */
 
 #include <linux/module.h>
 #include "rk_pcm.h"
 #include "rk_i2s.h"
 
-#if 0
-#define DBG(x...) pr_info("rk_hdmi_i2s:"x)
-#else
-#define DBG(x...) do { } while (0)
-#endif
-
 static int hdmi_i2s_hifi_hw_params(struct snd_pcm_substream *substream,
-       struct snd_pcm_hw_params *params)
+                                  struct snd_pcm_hw_params *params)
 {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
        unsigned int pll_out = 0, dai_fmt = rtd->dai_link->dai_fmt;
-       int div_bclk,div_mclk;
+       int div_bclk, div_mclk;
        int ret;
 
-       DBG("Enter::%s----%d\n", __func__, __LINE__);
-
        /* set cpu DAI configuration */
        ret = snd_soc_dai_set_fmt(cpu_dai, dai_fmt);
        if (ret < 0) {
-               pr_err("%s():failed to set the format for cpu side\n",
-                       __func__);
+               pr_err("%s: failed to set format for cpu dai\n", __func__);
                return ret;
        }
 
@@ -65,25 +65,20 @@ static int hdmi_i2s_hifi_hw_params(struct snd_pcm_substream *substream,
                pll_out = 12288000*2;
                break;
        default:
-               pr_err("Enter:%s, %d, Error rate=%d\n",
-                       __func__, __LINE__, params_rate(params));
+               pr_err("%s: %d: rate(%d) not support.\n",
+                      __func__, __LINE__, params_rate(params));
                return -EINVAL;
-               break;
        }
 
-       DBG("Enter:%s, %d, rate=%d\n",
-               __func__, __LINE__,
-               params_rate(params));
-
        div_bclk = 127;
        div_mclk = pll_out/(params_rate(params)*(div_bclk+1))-1;
 
        snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0);
-       snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK,div_bclk);
+       snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK, div_bclk);
        snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_MCLK, div_mclk);
 
-       DBG("Enter:%s, %d, div_bclk: %d, div_mclk: %d\n",
-               __func__, __LINE__, div_bclk, div_mclk);
+       pr_debug("%s: %d: div_bclk: %d, div_mclk: %d\n",
+                __func__, __LINE__, div_bclk, div_mclk);
 
        return 0;
 }
@@ -116,15 +111,15 @@ static int rockchip_hdmi_i2s_audio_probe(struct platform_device *pdev)
 
        ret = rockchip_of_get_sound_card_info(card);
        if (ret) {
-               pr_err("%s() get sound card info failed:%d\n",
-                       __func__, ret);
+               pr_err("%s() get sound card info failed: %d\n",
+                      __func__, ret);
                return ret;
        }
 
        ret = snd_soc_register_card(card);
        if (ret)
-               pr_err("%s() register card failed:%d\n",
-                       __func__, ret);
+               pr_err("%s() register card failed: %d\n",
+                      __func__, ret);
 
        return ret;
 }
@@ -147,19 +142,17 @@ MODULE_DEVICE_TABLE(of, rockchip_hdmi_i2s_of_match);
 #endif /* CONFIG_OF */
 
 static struct platform_driver rockchip_hdmi_i2s_audio_driver = {
-       .driver         = {
-               .name   = "rockchip-hdmi-i2s",
-               .owner  = THIS_MODULE,
+       .driver = {
+               .name = "rockchip-hdmi-i2s",
                .pm = &snd_soc_pm_ops,
                .of_match_table = of_match_ptr(rockchip_hdmi_i2s_of_match),
        },
-       .probe          = rockchip_hdmi_i2s_audio_probe,
-       .remove         = rockchip_hdmi_i2s_audio_remove,
+       .probe = rockchip_hdmi_i2s_audio_probe,
+       .remove = rockchip_hdmi_i2s_audio_remove,
 };
 
 module_platform_driver(rockchip_hdmi_i2s_audio_driver);
 
-/* Module information */
 MODULE_AUTHOR("rockchip");
-MODULE_DESCRIPTION("ROCKCHIP hdmi i2s ASoC Interface");
+MODULE_DESCRIPTION("Rockchip HDMI I2S Audio Card");
 MODULE_LICENSE("GPL");