Skip to content

Commit 9ab1fba

Browse files
committed
codec : add some comment for es8316 machine code
1 parent ec00144 commit 9ab1fba

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

debug/codec/rk_es8316.c

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,16 @@
2323
#define DBG(x...)
2424
#endif
2525

26-
static int rk29_hw_params(struct snd_pcm_substream *substream,
26+
/* 设置CODEC DAI 和 CPU DAI 参数 */
27+
static int rk3288_hw_params(struct snd_pcm_substream *substream,
2728
struct snd_pcm_hw_params *params)
2829
{
29-
struct snd_soc_pcm_runtime *rtd = substream->private_data;
30-
struct snd_soc_dai *codec_dai = rtd->codec_dai;
31-
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
32-
unsigned int pll_out = 0, dai_fmt = rtd->card->dai_link->dai_fmt;
30+
struct snd_soc_pcm_runtime *pcm_rt = substream->private_data;
31+
struct snd_soc_dai *codec_dai = pcm_rt->codec_dai;
32+
struct snd_soc_dai *cpu_dai = pcm_rt->cpu_dai;
33+
unsigned int pll_out = 0, dai_fmt = pcm_rt->card->dai_link->dai_fmt;
3334
int ret;
3435

35-
DBG("Enter::%s----%d\n", __func__, __LINE__);
36-
3736
/* set codec DAI configuration */
3837
ret = snd_soc_dai_set_fmt(codec_dai, dai_fmt);
3938
if (ret < 0) {
@@ -48,6 +47,7 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
4847
return ret;
4948
}
5049

50+
/* 根据采样率设置PLL */
5151
switch (params_rate(params)) {
5252
case 8000:
5353
case 16000:
@@ -68,6 +68,7 @@ static int rk29_hw_params(struct snd_pcm_substream *substream,
6868
}
6969
DBG("Enter:%s, %d, rate=%d\n", __func__, __LINE__, params_rate(params));
7070

71+
/* 根据dai_fmt设置时钟分频系数 */
7172
if ((dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) == SND_SOC_DAIFMT_CBS_CFS) {
7273
snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0);
7374
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK,
@@ -96,9 +97,9 @@ static const struct snd_soc_dapm_route audio_map[] = {
9697
/*
9798
* Logic for a es8316 as connected on a rockchip board.
9899
*/
99-
static int rk29_es8316_init(struct snd_soc_pcm_runtime *rtd)
100+
static int rk3288_es8316_init(struct snd_soc_pcm_runtime *pcm_rt)
100101
{
101-
struct snd_soc_dai *codec_dai = rtd->codec_dai;
102+
struct snd_soc_dai *codec_dai = pcm_rt->codec_dai;
102103
int ret;
103104

104105
DBG("Enter::%s----%d\n", __func__, __LINE__);
@@ -111,24 +112,21 @@ static int rk29_es8316_init(struct snd_soc_pcm_runtime *rtd)
111112
return 0;
112113
}
113114

114-
static struct snd_soc_ops rk29_ops = {
115-
.hw_params = rk29_hw_params,
115+
static struct snd_soc_ops rk3288_ops = {
116+
.hw_params = rk3288_hw_params,
116117
};
117118

118-
static struct snd_soc_dai_link rk29_dai = {
119+
static struct snd_soc_dai_link rk3288_dai_link = {
119120
.name = "ES8316",
120121
.stream_name = "ES8316 PCM",
121-
.codec_name = "ES8316.v01a",
122-
.platform_name = "rockchip-audio",
123-
.cpu_dai_name = "rk29_i2s.0",
124122
.codec_dai_name = "ES8316 HiFi",
125-
.init = rk29_es8316_init,
126-
.ops = &rk29_ops,
123+
.init = rk3288_es8316_init,
124+
.ops = &rk3288_ops,
127125
};
128126

129127
static struct snd_soc_card rockchip_es8316_snd_card = {
130128
.name = "RK_ES8316",
131-
.dai_link = &rk29_dai,
129+
.dai_link = &rk3288_dai_link,
132130
.num_links = 1,
133131
};
134132

@@ -245,7 +243,6 @@ static struct platform_driver rockchip_es8316_audio_driver = {
245243
module_platform_driver(rockchip_es8316_audio_driver);
246244

247245
/* Module information */
248-
MODULE_AUTHOR("rockchip");
246+
MODULE_AUTHOR("zeroway");
249247
MODULE_DESCRIPTION("ROCKCHIP i2s ASoC Interface");
250248
MODULE_LICENSE("GPL");
251-

0 commit comments

Comments
 (0)