/*
* 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 <sound/pcm.h>
#include <sound/initval.h>
-#if 0
-#define DBG(x...) printk(KERN_INFO "hdmi i2s:"x)
-#else
-#define DBG(x...) do { } while (0)
-#endif
-
struct snd_soc_dai_driver hdmi_i2s_dai = {
.name = "rk-hdmi-i2s-hifi",
.playback = {
.stream_name = "HiFi Playback",
.channels_min = 2,
- .channels_max = 2,
+ .channels_max = 8,
.rates = (SNDRV_PCM_RATE_32000 |
- SNDRV_PCM_RATE_44100 |
- SNDRV_PCM_RATE_48000 |
- SNDRV_PCM_RATE_96000 |
- SNDRV_PCM_RATE_192000),
+ SNDRV_PCM_RATE_44100 |
+ SNDRV_PCM_RATE_48000 |
+ SNDRV_PCM_RATE_96000 |
+ SNDRV_PCM_RATE_192000),
.formats = (SNDRV_PCM_FMTBIT_S16_LE |
- SNDRV_PCM_FMTBIT_S20_3LE |
- SNDRV_PCM_FMTBIT_S24_LE),
+ SNDRV_PCM_FMTBIT_S20_3LE |
+ SNDRV_PCM_FMTBIT_S24_LE),
},
};
{
int ret;
- //set dev name to driver->name for sound card register
- dev_set_name(&pdev->dev, "%s", pdev->dev.driver->name);
-
ret = snd_soc_register_codec(&pdev->dev,
- &soc_codec_dev_hdmi_i2s,
- &hdmi_i2s_dai, 1);
+ &soc_codec_dev_hdmi_i2s,
+ &hdmi_i2s_dai, 1);
if (ret)
- printk("%s() register card failed:%d\n", __FUNCTION__, ret);
+ dev_err(&pdev->dev, "register card failed: %d\n", ret);
return ret;
}
#ifdef CONFIG_OF
static const struct of_device_id rockchip_hdmi_i2s_of_match[] = {
- { .compatible = "hdmi-i2s", },
- {},
+ { .compatible = "hdmi-i2s", },
+ {},
};
MODULE_DEVICE_TABLE(of, rockchip_hdmi_i2s_of_match);
#endif /* CONFIG_OF */
static struct platform_driver rockchip_hdmi_i2s_audio_driver = {
- .driver = {
- .name = "hdmi-i2s",
- .owner = THIS_MODULE,
- .of_match_table = of_match_ptr(rockchip_hdmi_i2s_of_match),
- },
- .probe = rockchip_hdmi_i2s_audio_probe,
- .remove = rockchip_hdmi_i2s_audio_remove,
+ .driver = {
+ .name = "hdmi-i2s",
+ .of_match_table = of_match_ptr(rockchip_hdmi_i2s_of_match),
+ },
+ .probe = rockchip_hdmi_i2s_audio_probe,
+ .remove = rockchip_hdmi_i2s_audio_remove,
};
module_platform_driver(rockchip_hdmi_i2s_audio_driver);
-MODULE_DESCRIPTION("HDMI I2S Controller Driver");
+MODULE_DESCRIPTION("Rockchip HDMI I2S Dummy Driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:hdmi-i2s");
#include <sound/pcm.h>
#include <sound/initval.h>
-#undef DEBUG_HDMI_SPDIF
-#define DEBUG_HDMI_SPDIF 0
-
-#if DEBUG_HDMI_SPDIF
-#define RK_HDMISPDIF_DBG(x...) pr_info("hdmi_spdif:"x)
-#else
-#define RK_HDMISPDIF_DBG(x...) do { } while (0)
-#endif
-
-
#define DRV_NAME "spdif-dit"
#define STUB_RATES SNDRV_PCM_RATE_8000_192000
{
int ret;
- /* set dev name to driver->name for sound card register. */
- dev_set_name(&pdev->dev, "%s", pdev->dev.driver->name);
-
- ret = snd_soc_register_codec(&pdev->
- dev, &soc_codec_spdif_dit, &dit_stub_dai, 1);
+ ret = snd_soc_register_codec(&pdev->dev, &soc_codec_spdif_dit,
+ &dit_stub_dai, 1);
if (ret)
- RK_HDMISPDIF_DBG("%s register codec failed:%d\n"
- , __func__, ret);
+ dev_err(&pdev->dev, "%s register failed: %d\n",
+ __func__, ret);
return ret;
}
#endif /* CONFIG_OF */
static struct platform_driver hdmi_spdif_audio_driver = {
- .driver = {
- .name = "hdmi-spdif",
- .owner = THIS_MODULE,
+ .driver = {
+ .name = "hdmi-spdif",
.of_match_table = of_match_ptr(hdmi_spdif_of_match),
},
- .probe = hdmi_spdif_audio_probe,
- .remove = hdmi_spdif_audio_remove,
+ .probe = hdmi_spdif_audio_probe,
+ .remove = hdmi_spdif_audio_remove,
};
module_platform_driver(hdmi_spdif_audio_driver);
};
*/
int rockchip_of_get_sound_card_info_(struct snd_soc_card *card,
- bool is_need_fmt)
+ bool is_need_fmt)
{
struct device_node *dai_node, *child_dai_node;
int dai_num;
dai_num = 0;
for_each_child_of_node(dai_node, child_dai_node) {
-
if (is_need_fmt) {
card->dai_link[dai_num].dai_fmt =
snd_soc_of_parse_daifmt(child_dai_node, NULL);
/*
- * card_info.h - ALSA PCM interface for the Rockchip rk28 SoC
+ * card_info.h - ALSA PCM interface for Rockchip
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
#define _SND_SOC_ROCKCHIP_CARD_INFO_H
int rockchip_of_get_sound_card_info_(struct snd_soc_card *card,
- bool is_need_fmt);
+ bool is_need_fmt);
int rockchip_of_get_sound_card_info(struct snd_soc_card *card);
#endif /* _SND_SOC_ROCKCHIP_CARD_INFO_H */
/*
* 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;
}
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;
}
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;
}
#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");
-/*$_FOR_ROCKCHIP_RBOX_$*/
-/*$_rbox_$_modify_$_huangzhibao for spdif output*/
-
/*
- * smdk_spdif.c -- S/PDIF audio for SMDK
+ * rk_hdmi_spdif.c -- hdmi spdif for rockchip
+ *
+ * Copyright (C) 2015 Fuzhou Rockchip Electronics Co., Ltd
*
- * Copyright 2010 Samsung 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 free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
+ * 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 "card_info.h"
#include "rk_pcm.h"
-#if 0
-#define RK_SPDIF_DBG(x...) pr_info("rk_hdmi_spdif:"x)
-#else
-#define RK_SPDIF_DBG(x...) do { } while (0)
-#endif
-
static int rk_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
unsigned long sclk;
int ret, ratio;
- RK_SPDIF_DBG("spdif:Entered %s\n", __func__);
-
/* bmc: 2*32*fs*2 = 128fs */
ratio = 128;
switch (params_rate(params)) {
ret = snd_soc_dai_set_sysclk(cpu_dai, 0,
sclk, SND_SOC_CLOCK_IN);
- if (ret < 0)
- return ret;
return ret;
}
#ifdef CONFIG_OF
static const struct of_device_id rockchip_hdmi_spdif_of_match[] = {
- { .compatible = "rockchip-hdmi-spdif"},
+ { .compatible = "rockchip-hdmi-spdif", },
{},
};
MODULE_DEVICE_TABLE(of, rockchip_hdmi_spdif_of_match);
#endif /* CONFIG_OF */
static struct platform_driver rockchip_hdmi_spdif_audio_driver = {
- .driver = {
- .name = "rockchip-hdmi-spdif",
- .owner = THIS_MODULE,
+ .driver = {
+ .name = "rockchip-hdmi-spdif",
.pm = &snd_soc_pm_ops,
.of_match_table = of_match_ptr(rockchip_hdmi_spdif_of_match),
},
- .probe = rockchip_hdmi_spdif_audio_probe,
- .remove = rockchip_hdmi_spdif_audio_remove,
+ .probe = rockchip_hdmi_spdif_audio_probe,
+ .remove = rockchip_hdmi_spdif_audio_remove,
};
module_platform_driver(rockchip_hdmi_spdif_audio_driver);
-MODULE_AUTHOR("hzb, <hzb@rock-chips.com>");
-MODULE_DESCRIPTION("ALSA SoC RK+S/PDIF");
+MODULE_AUTHOR("hzb <hzb@rock-chips.com>");
+MODULE_DESCRIPTION("Rockchip HDMI Spdif Card");
MODULE_LICENSE("GPL");
/*
* rk_spdif_card.c -- spdif card for rockchip
*
- * Copyright 2014 rockchip Co. Ltd.
+ * Copyright (C) 2014 Fuzhou Rockchip Electronics Co., Ltd
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
+ * 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.
*
*/
ret = snd_soc_dai_set_sysclk(cpu_dai, 0,
sclk, SND_SOC_CLOCK_IN);
- if (ret < 0)
- return ret;
return ret;
}
#ifdef CONFIG_OF
static const struct of_device_id rockchip_spdif_card_of_match[] = {
- { .compatible = "rockchip-spdif-card"},
+ { .compatible = "rockchip-spdif-card", },
{},
};
MODULE_DEVICE_TABLE(of, rockchip_spdif_card_of_match);
#endif /* CONFIG_OF */
static struct platform_driver rockchip_spdif_card_driver = {
- .driver = {
- .name = "rockchip-spdif-card",
- .owner = THIS_MODULE,
+ .driver = {
+ .name = "rockchip-spdif-card",
+ .owner = THIS_MODULE,
.pm = &snd_soc_pm_ops,
.of_match_table = of_match_ptr(rockchip_spdif_card_of_match),
},
- .probe = rockchip_spdif_card_probe,
- .remove = rockchip_spdif_card_remove,
+ .probe = rockchip_spdif_card_probe,
+ .remove = rockchip_spdif_card_remove,
};
-//module_platform_driver(rockchip_spdif_card_driver);
-
+/* module_platform_driver(rockchip_spdif_card_driver); */
static int __init rockchip_spdif_init(void)
{
- return platform_driver_register(&rockchip_spdif_card_driver);
+ return platform_driver_register(&rockchip_spdif_card_driver);
};
late_initcall(rockchip_spdif_init);
static void __exit rockchip_spdif_exit(void)
{
- platform_driver_unregister(&rockchip_spdif_card_driver);
+ platform_driver_unregister(&rockchip_spdif_card_driver);
}
module_exit(rockchip_spdif_exit);
-MODULE_AUTHOR("hzb, <hzb@rock-chips.com>");
+MODULE_AUTHOR("hzb <hzb@rock-chips.com>");
MODULE_DESCRIPTION("ALSA SoC RK S/PDIF");
MODULE_LICENSE("GPL");