Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
e12be671
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e12be671
编写于
6月 22, 2015
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branches 'asoc/topic/wm8523' and 'asoc/topic/wm8741' into asoc-next
上级
e39f6bc7
ef5294fd
e369bd00
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
52 addition
and
35 deletion
+52
-35
sound/soc/codecs/wm8523.c
sound/soc/codecs/wm8523.c
+26
-0
sound/soc/codecs/wm8741.c
sound/soc/codecs/wm8741.c
+26
-35
未找到文件。
sound/soc/codecs/wm8523.c
浏览文件 @
e12be671
...
...
@@ -113,6 +113,15 @@ static struct {
{
7
,
1152
},
};
static
struct
{
int
value
;
int
ratio
;
}
bclk_ratios
[
WM8523_NUM_RATES
]
=
{
{
2
,
32
},
{
3
,
64
},
{
4
,
128
},
};
static
int
wm8523_startup
(
struct
snd_pcm_substream
*
substream
,
struct
snd_soc_dai
*
dai
)
{
...
...
@@ -162,6 +171,23 @@ static int wm8523_hw_params(struct snd_pcm_substream *substream,
aifctrl2
&=
~
WM8523_SR_MASK
;
aifctrl2
|=
lrclk_ratios
[
i
].
value
;
if
(
aifctrl1
&
WM8523_AIF_MSTR
)
{
/* Find a fs->bclk ratio */
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
bclk_ratios
);
i
++
)
if
(
params_width
(
params
)
*
2
<=
bclk_ratios
[
i
].
ratio
)
break
;
if
(
i
==
ARRAY_SIZE
(
bclk_ratios
))
{
dev_err
(
codec
->
dev
,
"No matching BCLK/fs ratio for word length %d
\n
"
,
params_width
(
params
));
return
-
EINVAL
;
}
aifctrl2
&=
~
WM8523_BCLKDIV_MASK
;
aifctrl2
|=
bclk_ratios
[
i
].
value
<<
WM8523_BCLKDIV_SHIFT
;
}
aifctrl1
&=
~
WM8523_WL_MASK
;
switch
(
params_width
(
params
))
{
case
16
:
...
...
sound/soc/codecs/wm8741.c
浏览文件 @
e12be671
...
...
@@ -125,18 +125,6 @@ static const struct snd_soc_dapm_route wm8741_dapm_routes[] = {
{
"VOUTRN"
,
NULL
,
"DACR"
},
};
static
struct
{
int
value
;
int
ratio
;
}
lrclk_ratios
[
WM8741_NUM_RATES
]
=
{
{
1
,
128
},
{
2
,
192
},
{
3
,
256
},
{
4
,
384
},
{
5
,
512
},
{
6
,
768
},
};
static
const
unsigned
int
rates_11289
[]
=
{
44100
,
88200
,
};
...
...
@@ -209,25 +197,16 @@ static const struct snd_pcm_hw_constraint_list constraints_36864 = {
.
list
=
rates_36864
,
};
static
int
wm8741_startup
(
struct
snd_pcm_substream
*
substream
,
struct
snd_soc_dai
*
dai
)
{
struct
snd_soc_codec
*
codec
=
dai
->
codec
;
struct
wm8741_priv
*
wm8741
=
snd_soc_codec_get_drvdata
(
codec
);
/* The set of sample rates that can be supported depends on the
* MCLK supplied to the CODEC - enforce this.
*/
if
(
!
wm8741
->
sysclk
)
{
dev_err
(
codec
->
dev
,
"No MCLK configured, call set_sysclk() on init
\n
"
);
return
-
EINVAL
;
}
snd_pcm_hw_constraint_list
(
substream
->
runtime
,
0
,
SNDRV_PCM_HW_PARAM_RATE
,
wm8741
->
sysclk_constraints
);
if
(
wm8741
->
sysclk
)
snd_pcm_hw_constraint_list
(
substream
->
runtime
,
0
,
SNDRV_PCM_HW_PARAM_RATE
,
wm8741
->
sysclk_constraints
);
return
0
;
}
...
...
@@ -241,17 +220,24 @@ static int wm8741_hw_params(struct snd_pcm_substream *substream,
u16
iface
=
snd_soc_read
(
codec
,
WM8741_FORMAT_CONTROL
)
&
0x1FC
;
int
i
;
/* Find a supported LRCLK ratio */
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
lrclk_ratios
);
i
++
)
{
if
(
wm8741
->
sysclk
/
params_rate
(
params
)
==
lrclk_ratios
[
i
].
ratio
)
/* The set of sample rates that can be supported depends on the
* MCLK supplied to the CODEC - enforce this.
*/
if
(
!
wm8741
->
sysclk
)
{
dev_err
(
codec
->
dev
,
"No MCLK configured, call set_sysclk() on init or in hw_params
\n
"
);
return
-
EINVAL
;
}
/* Find a supported LRCLK rate */
for
(
i
=
0
;
i
<
wm8741
->
sysclk_constraints
->
count
;
i
++
)
{
if
(
wm8741
->
sysclk_constraints
->
list
[
i
]
==
params_rate
(
params
))
break
;
}
/* Should never happen, should be handled by constraints */
if
(
i
==
ARRAY_SIZE
(
lrclk_ratios
))
{
dev_err
(
codec
->
dev
,
"MCLK/fs ratio %d unsupported
\n
"
,
wm8741
->
sysclk
/
params_rate
(
params
));
if
(
i
==
wm8741
->
sysclk_constraints
->
count
)
{
dev_err
(
codec
->
dev
,
"LRCLK %d unsupported with MCLK %d
\n
"
,
params_rate
(
params
),
wm8741
->
sysclk
);
return
-
EINVAL
;
}
...
...
@@ -274,8 +260,8 @@ static int wm8741_hw_params(struct snd_pcm_substream *substream,
return
-
EINVAL
;
}
dev_dbg
(
codec
->
dev
,
"wm8741_hw_params: bit size param = %d"
,
params_width
(
params
));
dev_dbg
(
codec
->
dev
,
"wm8741_hw_params: bit size param = %d
, rate param = %d
"
,
params_width
(
params
)
,
params_rate
(
params
)
);
snd_soc_write
(
codec
,
WM8741_FORMAT_CONTROL
,
iface
);
return
0
;
...
...
@@ -290,6 +276,11 @@ static int wm8741_set_dai_sysclk(struct snd_soc_dai *codec_dai,
dev_dbg
(
codec
->
dev
,
"wm8741_set_dai_sysclk info: freq=%dHz
\n
"
,
freq
);
switch
(
freq
)
{
case
0
:
wm8741
->
sysclk_constraints
=
NULL
;
wm8741
->
sysclk
=
freq
;
return
0
;
case
11289600
:
wm8741
->
sysclk_constraints
=
&
constraints_11289
;
wm8741
->
sysclk
=
freq
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录