Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
5aa5fa9f
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
158
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,发现更多精彩内容 >>
提交
5aa5fa9f
编写于
9月 12, 2012
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ASoC: wm8711: Convert to direct regmap API usage
Signed-off-by:
N
Mark Brown
<
broonie@opensource.wolfsonmicro.com
>
上级
18273b05
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
38 addition
and
12 deletion
+38
-12
sound/soc/codecs/wm8711.c
sound/soc/codecs/wm8711.c
+38
-12
未找到文件。
sound/soc/codecs/wm8711.c
浏览文件 @
5aa5fa9f
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#include <linux/delay.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/pm.h>
#include <linux/i2c.h>
#include <linux/i2c.h>
#include <linux/regmap.h>
#include <linux/spi/spi.h>
#include <linux/spi/spi.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/of_device.h>
#include <linux/of_device.h>
...
@@ -32,7 +33,7 @@
...
@@ -32,7 +33,7 @@
/* codec private data */
/* codec private data */
struct
wm8711_priv
{
struct
wm8711_priv
{
enum
snd_soc_control_type
bus_type
;
struct
regmap
*
regmap
;
unsigned
int
sysclk
;
unsigned
int
sysclk
;
};
};
...
@@ -42,11 +43,21 @@ struct wm8711_priv {
...
@@ -42,11 +43,21 @@ struct wm8711_priv {
* using 2 wire for device control, so we cache them instead.
* using 2 wire for device control, so we cache them instead.
* There is no point in caching the reset register
* There is no point in caching the reset register
*/
*/
static
const
u16
wm8711_reg
[
WM8711_CACHEREGNUM
]
=
{
static
const
struct
reg_default
wm8711_reg_defaults
[
]
=
{
0x0079
,
0x0079
,
0x000a
,
0x0008
,
{
0
,
0x0079
},
{
1
,
0x0079
},
{
2
,
0x000a
},
{
3
,
0x0008
}
,
0x009f
,
0x000a
,
0x0000
,
0x0000
{
4
,
0x009f
},
{
5
,
0x000a
},
{
6
,
0x0000
},
{
7
,
0x0000
},
};
};
static
bool
wm8711_volatile
(
struct
device
*
dev
,
unsigned
int
reg
)
{
switch
(
reg
)
{
case
WM8711_RESET
:
return
true
;
default:
return
false
;
}
}
#define wm8711_reset(c) snd_soc_write(c, WM8711_RESET, 0)
#define wm8711_reset(c) snd_soc_write(c, WM8711_RESET, 0)
static
const
DECLARE_TLV_DB_SCALE
(
out_tlv
,
-
12100
,
100
,
1
);
static
const
DECLARE_TLV_DB_SCALE
(
out_tlv
,
-
12100
,
100
,
1
);
...
@@ -289,6 +300,7 @@ static int wm8711_set_dai_fmt(struct snd_soc_dai *codec_dai,
...
@@ -289,6 +300,7 @@ static int wm8711_set_dai_fmt(struct snd_soc_dai *codec_dai,
static
int
wm8711_set_bias_level
(
struct
snd_soc_codec
*
codec
,
static
int
wm8711_set_bias_level
(
struct
snd_soc_codec
*
codec
,
enum
snd_soc_bias_level
level
)
enum
snd_soc_bias_level
level
)
{
{
struct
wm8711_priv
*
wm8711
=
snd_soc_codec_get_drvdata
(
codec
);
u16
reg
=
snd_soc_read
(
codec
,
WM8711_PWR
)
&
0xff7f
;
u16
reg
=
snd_soc_read
(
codec
,
WM8711_PWR
)
&
0xff7f
;
switch
(
level
)
{
switch
(
level
)
{
...
@@ -299,7 +311,7 @@ static int wm8711_set_bias_level(struct snd_soc_codec *codec,
...
@@ -299,7 +311,7 @@ static int wm8711_set_bias_level(struct snd_soc_codec *codec,
break
;
break
;
case
SND_SOC_BIAS_STANDBY
:
case
SND_SOC_BIAS_STANDBY
:
if
(
codec
->
dapm
.
bias_level
==
SND_SOC_BIAS_OFF
)
if
(
codec
->
dapm
.
bias_level
==
SND_SOC_BIAS_OFF
)
snd_soc_cache_sync
(
codec
);
regcache_sync
(
wm8711
->
regmap
);
snd_soc_write
(
codec
,
WM8711_PWR
,
reg
|
0x0040
);
snd_soc_write
(
codec
,
WM8711_PWR
,
reg
|
0x0040
);
break
;
break
;
...
@@ -353,10 +365,9 @@ static int wm8711_resume(struct snd_soc_codec *codec)
...
@@ -353,10 +365,9 @@ static int wm8711_resume(struct snd_soc_codec *codec)
static
int
wm8711_probe
(
struct
snd_soc_codec
*
codec
)
static
int
wm8711_probe
(
struct
snd_soc_codec
*
codec
)
{
{
struct
wm8711_priv
*
wm8711
=
snd_soc_codec_get_drvdata
(
codec
);
int
ret
;
int
ret
;
ret
=
snd_soc_codec_set_cache_io
(
codec
,
7
,
9
,
wm8711
->
bus_type
);
ret
=
snd_soc_codec_set_cache_io
(
codec
,
7
,
9
,
SND_SOC_REGMAP
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
codec
->
dev
,
"Failed to set cache I/O: %d
\n
"
,
ret
);
dev_err
(
codec
->
dev
,
"Failed to set cache I/O: %d
\n
"
,
ret
);
return
ret
;
return
ret
;
...
@@ -391,9 +402,6 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8711 = {
...
@@ -391,9 +402,6 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8711 = {
.
suspend
=
wm8711_suspend
,
.
suspend
=
wm8711_suspend
,
.
resume
=
wm8711_resume
,
.
resume
=
wm8711_resume
,
.
set_bias_level
=
wm8711_set_bias_level
,
.
set_bias_level
=
wm8711_set_bias_level
,
.
reg_cache_size
=
ARRAY_SIZE
(
wm8711_reg
),
.
reg_word_size
=
sizeof
(
u16
),
.
reg_cache_default
=
wm8711_reg
,
.
controls
=
wm8711_snd_controls
,
.
controls
=
wm8711_snd_controls
,
.
num_controls
=
ARRAY_SIZE
(
wm8711_snd_controls
),
.
num_controls
=
ARRAY_SIZE
(
wm8711_snd_controls
),
.
dapm_widgets
=
wm8711_dapm_widgets
,
.
dapm_widgets
=
wm8711_dapm_widgets
,
...
@@ -408,6 +416,18 @@ static const struct of_device_id wm8711_of_match[] = {
...
@@ -408,6 +416,18 @@ static const struct of_device_id wm8711_of_match[] = {
};
};
MODULE_DEVICE_TABLE
(
of
,
wm8711_of_match
);
MODULE_DEVICE_TABLE
(
of
,
wm8711_of_match
);
static
const
struct
regmap_config
wm8711_regmap
=
{
.
reg_bits
=
7
,
.
val_bits
=
9
,
.
max_register
=
WM8711_RESET
,
.
reg_defaults
=
wm8711_reg_defaults
,
.
num_reg_defaults
=
ARRAY_SIZE
(
wm8711_reg_defaults
),
.
cache_type
=
REGCACHE_RBTREE
,
.
volatile_reg
=
wm8711_volatile
,
};
#if defined(CONFIG_SPI_MASTER)
#if defined(CONFIG_SPI_MASTER)
static
int
__devinit
wm8711_spi_probe
(
struct
spi_device
*
spi
)
static
int
__devinit
wm8711_spi_probe
(
struct
spi_device
*
spi
)
{
{
...
@@ -419,8 +439,11 @@ static int __devinit wm8711_spi_probe(struct spi_device *spi)
...
@@ -419,8 +439,11 @@ static int __devinit wm8711_spi_probe(struct spi_device *spi)
if
(
wm8711
==
NULL
)
if
(
wm8711
==
NULL
)
return
-
ENOMEM
;
return
-
ENOMEM
;
wm8711
->
regmap
=
devm_regmap_init_spi
(
spi
,
&
wm8711_regmap
);
if
(
IS_ERR
(
wm8711
->
regmap
))
return
PTR_ERR
(
wm8711
->
regmap
);
spi_set_drvdata
(
spi
,
wm8711
);
spi_set_drvdata
(
spi
,
wm8711
);
wm8711
->
bus_type
=
SND_SOC_SPI
;
ret
=
snd_soc_register_codec
(
&
spi
->
dev
,
ret
=
snd_soc_register_codec
(
&
spi
->
dev
,
&
soc_codec_dev_wm8711
,
&
wm8711_dai
,
1
);
&
soc_codec_dev_wm8711
,
&
wm8711_dai
,
1
);
...
@@ -458,8 +481,11 @@ static __devinit int wm8711_i2c_probe(struct i2c_client *client,
...
@@ -458,8 +481,11 @@ static __devinit int wm8711_i2c_probe(struct i2c_client *client,
if
(
wm8711
==
NULL
)
if
(
wm8711
==
NULL
)
return
-
ENOMEM
;
return
-
ENOMEM
;
wm8711
->
regmap
=
devm_regmap_init_i2c
(
client
,
&
wm8711_regmap
);
if
(
IS_ERR
(
wm8711
->
regmap
))
return
PTR_ERR
(
wm8711
->
regmap
);
i2c_set_clientdata
(
client
,
wm8711
);
i2c_set_clientdata
(
client
,
wm8711
);
wm8711
->
bus_type
=
SND_SOC_I2C
;
ret
=
snd_soc_register_codec
(
&
client
->
dev
,
ret
=
snd_soc_register_codec
(
&
client
->
dev
,
&
soc_codec_dev_wm8711
,
&
wm8711_dai
,
1
);
&
soc_codec_dev_wm8711
,
&
wm8711_dai
,
1
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录