mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
Audio:
- update spdif driver. - add spdif card, default disabled.
This commit is contained in:
8
sound/soc/rockchip/Kconfig
Normal file → Executable file
8
sound/soc/rockchip/Kconfig
Normal file → Executable file
@@ -33,6 +33,14 @@ choice
|
||||
endchoice
|
||||
endif #SND_RK_SOC && RK_HDMI
|
||||
|
||||
config SND_RK_SOC_CARD_SPDIF
|
||||
tristate "SoC spdif card support for rockchip"
|
||||
depends on !SND_RK_SOC_HDMI_SPDIF
|
||||
select SND_RK_SOC_SPDIF
|
||||
select SND_SOC_HDMI_SPDIF
|
||||
|
||||
|
||||
|
||||
config SND_RK_SOC_AK4396
|
||||
tristate "SoC I2S Audio support for rockchip - AK4396"
|
||||
depends on SND_RK_SOC
|
||||
|
||||
1
sound/soc/rockchip/Makefile
Normal file → Executable file
1
sound/soc/rockchip/Makefile
Normal file → Executable file
@@ -69,5 +69,6 @@ obj-$(CONFIG_SND_RK_SOC_RK3026) += snd-soc-rk3026.o
|
||||
obj-$(CONFIG_SND_RK_SOC_RK3190) += snd-soc-rk3190.o
|
||||
obj-$(CONFIG_SND_RK_SOC_RT5512) += snd-soc-rt5512.o
|
||||
obj-$(CONFIG_SND_RK_SOC_CX2070X) += snd-soc-cx2070x.o
|
||||
obj-$(CONFIG_SND_RK_SOC_CARD_SPDIF) += snd-soc-hdmi-spdif.o
|
||||
obj-$(CONFIG_SND_RK_SOC_HDMI_I2S) += snd-soc-hdmi-i2s.o
|
||||
obj-$(CONFIG_SND_RK_SOC_HDMI_SPDIF) += snd-soc-hdmi-spdif.o
|
||||
|
||||
@@ -32,66 +32,16 @@
|
||||
#define RK_SPDIF_DBG(x...) do { } while (0)
|
||||
#endif
|
||||
|
||||
static int set_audio_clock_rate(unsigned long pll_rate,
|
||||
unsigned long audio_rate)
|
||||
{
|
||||
struct clk *sclk_spdif;
|
||||
#if defined(CONFIG_ARCH_RK30) || defined(CONFIG_ARCH_RK3188)
|
||||
struct clk *hclk_spdif;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ARCH_RK30) || defined(CONFIG_ARCH_RK3188)
|
||||
hclk_spdif = clk_get(NULL, "hclk_spdif");
|
||||
if (IS_ERR(hclk_spdif)) {
|
||||
pr_err("spdif:failed to get hclk_spdif\n");
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
clk_set_rate(hclk_spdif, pll_rate);
|
||||
clk_put(hclk_spdif);
|
||||
#endif
|
||||
|
||||
sclk_spdif = clk_get(NULL, "spdif");
|
||||
if (IS_ERR(sclk_spdif)) {
|
||||
pr_err("spdif:failed to get sclk_spdif\n");
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
clk_set_rate(sclk_spdif, audio_rate);
|
||||
clk_put(sclk_spdif);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rk_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;
|
||||
struct snd_soc_dai *codec_dai = rtd->codec_dai;
|
||||
unsigned long pll_out, rclk_rate, dai_fmt = rtd->dai_link->dai_fmt;
|
||||
unsigned long pll_out, rclk_rate;
|
||||
int ret, ratio;
|
||||
|
||||
RK_SPDIF_DBG("spdif:Entered %s\n", __func__);
|
||||
|
||||
return 0;
|
||||
|
||||
/* set codec DAI configuration */
|
||||
ret = snd_soc_dai_set_fmt(codec_dai, dai_fmt);
|
||||
if (ret < 0) {
|
||||
pr_err("%s():failed to set the format for codec side\n",
|
||||
__func__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 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__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
switch (params_rate(params)) {
|
||||
case 44100:
|
||||
pll_out = 11289600;
|
||||
@@ -114,7 +64,8 @@ static int rk_hw_params(struct snd_pcm_substream *substream,
|
||||
rclk_rate = params_rate(params) * ratio;
|
||||
|
||||
/* Set audio source clock rates */
|
||||
ret = set_audio_clock_rate(pll_out, rclk_rate);
|
||||
ret = snd_soc_dai_set_sysclk(cpu_dai, 0,
|
||||
rclk_rate, SND_SOC_CLOCK_IN);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -148,7 +99,7 @@ static int rockchip_hdmi_spdif_audio_probe(struct platform_device *pdev)
|
||||
ret = rockchip_of_get_sound_card_info_(card, false);
|
||||
if (ret) {
|
||||
pr_err("%s() get sound card info failed:%d\n",
|
||||
__func__, ret);
|
||||
__func__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -156,7 +107,7 @@ static int rockchip_hdmi_spdif_audio_probe(struct platform_device *pdev)
|
||||
|
||||
if (ret)
|
||||
pr_err("%s() register card failed:%d\n",
|
||||
__func__, ret);
|
||||
__func__, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -187,6 +187,7 @@ static int spdif_set_syclk(struct snd_soc_dai *
|
||||
RK_SPDIF_DBG("Entered %s sysclk=%d\n", __func__, freq);
|
||||
|
||||
spdif->clk_rate = freq;
|
||||
clk_set_rate(spdif->clk, freq);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user