Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
f6b967ab
K
Kernel
项目概览
openeuler
/
Kernel
大约 1 年 前同步成功
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f6b967ab
编写于
10月 24, 2013
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'asoc/topic/si476x' into asoc-next
上级
1f7f8e04
cfcff69a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
16 addition
and
48 deletion
+16
-48
sound/soc/codecs/si476x.c
sound/soc/codecs/si476x.c
+16
-48
未找到文件。
sound/soc/codecs/si476x.c
浏览文件 @
f6b967ab
...
...
@@ -60,48 +60,6 @@ enum si476x_pcm_format {
SI476X_PCM_FORMAT_S24_LE
=
6
,
};
static
unsigned
int
si476x_codec_read
(
struct
snd_soc_codec
*
codec
,
unsigned
int
reg
)
{
int
err
;
unsigned
int
val
;
struct
si476x_core
*
core
=
codec
->
control_data
;
si476x_core_lock
(
core
);
if
(
!
si476x_core_is_powered_up
(
core
))
regcache_cache_only
(
core
->
regmap
,
true
);
err
=
regmap_read
(
core
->
regmap
,
reg
,
&
val
);
if
(
!
si476x_core_is_powered_up
(
core
))
regcache_cache_only
(
core
->
regmap
,
false
);
si476x_core_unlock
(
core
);
if
(
err
<
0
)
return
err
;
return
val
;
}
static
int
si476x_codec_write
(
struct
snd_soc_codec
*
codec
,
unsigned
int
reg
,
unsigned
int
val
)
{
int
err
;
struct
si476x_core
*
core
=
codec
->
control_data
;
si476x_core_lock
(
core
);
if
(
!
si476x_core_is_powered_up
(
core
))
regcache_cache_only
(
core
->
regmap
,
true
);
err
=
regmap_write
(
core
->
regmap
,
reg
,
val
);
if
(
!
si476x_core_is_powered_up
(
core
))
regcache_cache_only
(
core
->
regmap
,
false
);
si476x_core_unlock
(
core
);
return
err
;
}
static
const
struct
snd_soc_dapm_widget
si476x_dapm_widgets
[]
=
{
SND_SOC_DAPM_OUTPUT
(
"LOUT"
),
SND_SOC_DAPM_OUTPUT
(
"ROUT"
),
...
...
@@ -115,6 +73,7 @@ static const struct snd_soc_dapm_route si476x_dapm_routes[] = {
static
int
si476x_codec_set_dai_fmt
(
struct
snd_soc_dai
*
codec_dai
,
unsigned
int
fmt
)
{
struct
si476x_core
*
core
=
i2c_mfd_cell_to_core
(
codec_dai
->
dev
);
int
err
;
u16
format
=
0
;
...
...
@@ -178,9 +137,14 @@ static int si476x_codec_set_dai_fmt(struct snd_soc_dai *codec_dai,
return
-
EINVAL
;
}
si476x_core_lock
(
core
);
err
=
snd_soc_update_bits
(
codec_dai
->
codec
,
SI476X_DIGITAL_IO_OUTPUT_FORMAT
,
SI476X_DIGITAL_IO_OUTPUT_FORMAT_MASK
,
format
);
si476x_core_unlock
(
core
);
if
(
err
<
0
)
{
dev_err
(
codec_dai
->
codec
->
dev
,
"Failed to set output format
\n
"
);
return
err
;
...
...
@@ -193,6 +157,7 @@ static int si476x_codec_hw_params(struct snd_pcm_substream *substream,
struct
snd_pcm_hw_params
*
params
,
struct
snd_soc_dai
*
dai
)
{
struct
si476x_core
*
core
=
i2c_mfd_cell_to_core
(
dai
->
dev
);
int
rate
,
width
,
err
;
rate
=
params_rate
(
params
);
...
...
@@ -218,11 +183,13 @@ static int si476x_codec_hw_params(struct snd_pcm_substream *substream,
return
-
EINVAL
;
}
si476x_core_lock
(
core
);
err
=
snd_soc_write
(
dai
->
codec
,
SI476X_DIGITAL_IO_OUTPUT_SAMPLE_RATE
,
rate
);
if
(
err
<
0
)
{
dev_err
(
dai
->
codec
->
dev
,
"Failed to set sample rate
\n
"
);
return
err
;
goto
out
;
}
err
=
snd_soc_update_bits
(
dai
->
codec
,
SI476X_DIGITAL_IO_OUTPUT_FORMAT
,
...
...
@@ -231,15 +198,18 @@ static int si476x_codec_hw_params(struct snd_pcm_substream *substream,
(
width
<<
SI476X_DIGITAL_IO_SAMPLE_SIZE_SHIFT
));
if
(
err
<
0
)
{
dev_err
(
dai
->
codec
->
dev
,
"Failed to set output width
\n
"
);
return
err
;
goto
out
;
}
return
0
;
out:
si476x_core_unlock
(
core
);
return
err
;
}
static
int
si476x_codec_probe
(
struct
snd_soc_codec
*
codec
)
{
codec
->
control_data
=
i2c_mfd_cell_to_core
(
codec
->
dev
);
codec
->
control_data
=
dev_get_regmap
(
codec
->
dev
->
parent
,
NULL
);
return
0
;
}
...
...
@@ -268,8 +238,6 @@ static struct snd_soc_dai_driver si476x_dai = {
static
struct
snd_soc_codec_driver
soc_codec_dev_si476x
=
{
.
probe
=
si476x_codec_probe
,
.
read
=
si476x_codec_read
,
.
write
=
si476x_codec_write
,
.
dapm_widgets
=
si476x_dapm_widgets
,
.
num_dapm_widgets
=
ARRAY_SIZE
(
si476x_dapm_widgets
),
.
dapm_routes
=
si476x_dapm_routes
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录