Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
d16383ef
cloud-kernel
项目概览
openanolis
/
cloud-kernel
12 个月 前同步成功
通知
150
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d16383ef
编写于
9月 12, 2012
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ASoC: wm8728: Convert to direct regmap API usage
Signed-off-by:
N
Mark Brown
<
broonie@opensource.wolfsonmicro.com
>
上级
5aa5fa9f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
28 addition
and
17 deletion
+28
-17
sound/soc/codecs/wm8728.c
sound/soc/codecs/wm8728.c
+28
-17
未找到文件。
sound/soc/codecs/wm8728.c
浏览文件 @
d16383ef
...
...
@@ -17,6 +17,7 @@
#include <linux/pm.h>
#include <linux/i2c.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/spi/spi.h>
#include <linux/slab.h>
#include <linux/of_device.h>
...
...
@@ -35,16 +36,16 @@
* the volume update bits, mute the output and enable infinite zero
* detect.
*/
static
const
u16
wm8728_reg_defaults
[]
=
{
0x1ff
,
0x1ff
,
0x001
,
0x100
,
static
const
struct
reg_default
wm8728_reg_defaults
[]
=
{
{
0
,
0x1ff
}
,
{
1
,
0x1ff
}
,
{
2
,
0x001
}
,
{
3
,
0x100
}
,
};
/* codec private data */
struct
wm8728_priv
{
enum
snd_soc_control_type
control_type
;
struct
regmap
*
regmap
;
};
static
const
DECLARE_TLV_DB_SCALE
(
wm8728_tlv
,
-
12750
,
50
,
1
);
...
...
@@ -162,8 +163,8 @@ static int wm8728_set_dai_fmt(struct snd_soc_dai *codec_dai,
static
int
wm8728_set_bias_level
(
struct
snd_soc_codec
*
codec
,
enum
snd_soc_bias_level
level
)
{
struct
wm8728_priv
*
wm8728
=
snd_soc_codec_get_drvdata
(
codec
);
u16
reg
;
int
i
;
switch
(
level
)
{
case
SND_SOC_BIAS_ON
:
...
...
@@ -175,9 +176,7 @@ static int wm8728_set_bias_level(struct snd_soc_codec *codec,
snd_soc_write
(
codec
,
WM8728_DACCTL
,
reg
&
~
0x4
);
/* ..then sync in the register cache. */
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
wm8728_reg_defaults
);
i
++
)
snd_soc_write
(
codec
,
i
,
snd_soc_read
(
codec
,
i
));
regcache_sync
(
wm8728
->
regmap
);
}
break
;
...
...
@@ -229,10 +228,9 @@ static int wm8728_resume(struct snd_soc_codec *codec)
static
int
wm8728_probe
(
struct
snd_soc_codec
*
codec
)
{
struct
wm8728_priv
*
wm8728
=
snd_soc_codec_get_drvdata
(
codec
);
int
ret
;
ret
=
snd_soc_codec_set_cache_io
(
codec
,
7
,
9
,
wm8728
->
control_type
);
ret
=
snd_soc_codec_set_cache_io
(
codec
,
7
,
9
,
SND_SOC_REGMAP
);
if
(
ret
<
0
)
{
printk
(
KERN_ERR
"wm8728: failed to configure cache I/O: %d
\n
"
,
ret
);
...
...
@@ -257,9 +255,6 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8728 = {
.
suspend
=
wm8728_suspend
,
.
resume
=
wm8728_resume
,
.
set_bias_level
=
wm8728_set_bias_level
,
.
reg_cache_size
=
ARRAY_SIZE
(
wm8728_reg_defaults
),
.
reg_word_size
=
sizeof
(
u16
),
.
reg_cache_default
=
wm8728_reg_defaults
,
.
controls
=
wm8728_snd_controls
,
.
num_controls
=
ARRAY_SIZE
(
wm8728_snd_controls
),
.
dapm_widgets
=
wm8728_dapm_widgets
,
...
...
@@ -274,6 +269,16 @@ static const struct of_device_id wm8728_of_match[] = {
};
MODULE_DEVICE_TABLE
(
of
,
wm8728_of_match
);
static
const
struct
regmap_config
wm8728_regmap
=
{
.
reg_bits
=
7
,
.
val_bits
=
9
,
.
max_register
=
WM8728_IFCTL
,
.
reg_defaults
=
wm8728_reg_defaults
,
.
num_reg_defaults
=
ARRAY_SIZE
(
wm8728_reg_defaults
),
.
cache_type
=
REGCACHE_RBTREE
,
};
#if defined(CONFIG_SPI_MASTER)
static
int
__devinit
wm8728_spi_probe
(
struct
spi_device
*
spi
)
{
...
...
@@ -285,7 +290,10 @@ static int __devinit wm8728_spi_probe(struct spi_device *spi)
if
(
wm8728
==
NULL
)
return
-
ENOMEM
;
wm8728
->
control_type
=
SND_SOC_SPI
;
wm8728
->
regmap
=
devm_regmap_init_spi
(
spi
,
&
wm8728_regmap
);
if
(
IS_ERR
(
wm8728
->
regmap
))
return
PTR_ERR
(
wm8728
->
regmap
);
spi_set_drvdata
(
spi
,
wm8728
);
ret
=
snd_soc_register_codec
(
&
spi
->
dev
,
...
...
@@ -324,8 +332,11 @@ static __devinit int wm8728_i2c_probe(struct i2c_client *i2c,
if
(
wm8728
==
NULL
)
return
-
ENOMEM
;
wm8728
->
regmap
=
devm_regmap_init_i2c
(
i2c
,
&
wm8728_regmap
);
if
(
IS_ERR
(
wm8728
->
regmap
))
return
PTR_ERR
(
wm8728
->
regmap
);
i2c_set_clientdata
(
i2c
,
wm8728
);
wm8728
->
control_type
=
SND_SOC_I2C
;
ret
=
snd_soc_register_codec
(
&
i2c
->
dev
,
&
soc_codec_dev_wm8728
,
&
wm8728_dai
,
1
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录