Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
7dea7c01
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,发现更多精彩内容 >>
提交
7dea7c01
编写于
10月 26, 2009
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ASoC: Add regulator support for WM8731
Signed-off-by:
N
Mark Brown
<
broonie@opensource.wolfsonmicro.com
>
上级
7a1fecf5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
47 addition
and
4 deletion
+47
-4
sound/soc/codecs/wm8731.c
sound/soc/codecs/wm8731.c
+47
-4
未找到文件。
sound/soc/codecs/wm8731.c
浏览文件 @
7dea7c01
...
...
@@ -19,6 +19,7 @@
#include <linux/pm.h>
#include <linux/i2c.h>
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
#include <linux/spi/spi.h>
#include <sound/core.h>
#include <sound/pcm.h>
...
...
@@ -33,9 +34,18 @@
static
struct
snd_soc_codec
*
wm8731_codec
;
struct
snd_soc_codec_device
soc_codec_dev_wm8731
;
#define WM8731_NUM_SUPPLIES 4
static
const
char
*
wm8731_supply_names
[
WM8731_NUM_SUPPLIES
]
=
{
"AVDD"
,
"HPVDD"
,
"DCVDD"
,
"DBVDD"
,
};
/* codec private data */
struct
wm8731_priv
{
struct
snd_soc_codec
codec
;
struct
regulator_bulk_data
supplies
[
WM8731_NUM_SUPPLIES
];
u16
reg_cache
[
WM8731_CACHEREGNUM
];
unsigned
int
sysclk
;
};
...
...
@@ -422,9 +432,12 @@ static int wm8731_suspend(struct platform_device *pdev, pm_message_t state)
{
struct
snd_soc_device
*
socdev
=
platform_get_drvdata
(
pdev
);
struct
snd_soc_codec
*
codec
=
socdev
->
card
->
codec
;
struct
wm8731_priv
*
wm8731
=
codec
->
private_data
;
snd_soc_write
(
codec
,
WM8731_ACTIVE
,
0x0
);
wm8731_set_bias_level
(
codec
,
SND_SOC_BIAS_OFF
);
regulator_bulk_disable
(
ARRAY_SIZE
(
wm8731
->
supplies
),
wm8731
->
supplies
);
return
0
;
}
...
...
@@ -432,10 +445,16 @@ static int wm8731_resume(struct platform_device *pdev)
{
struct
snd_soc_device
*
socdev
=
platform_get_drvdata
(
pdev
);
struct
snd_soc_codec
*
codec
=
socdev
->
card
->
codec
;
int
i
;
struct
wm8731_priv
*
wm8731
=
codec
->
private_data
;
int
i
,
ret
;
u8
data
[
2
];
u16
*
cache
=
codec
->
reg_cache
;
ret
=
regulator_bulk_enable
(
ARRAY_SIZE
(
wm8731
->
supplies
),
wm8731
->
supplies
);
if
(
ret
!=
0
)
return
ret
;
/* Sync reg_cache with the hardware */
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
wm8731_reg
);
i
++
)
{
data
[
0
]
=
(
i
<<
1
)
|
((
cache
[
i
]
>>
8
)
&
0x0001
);
...
...
@@ -444,6 +463,7 @@ static int wm8731_resume(struct platform_device *pdev)
}
wm8731_set_bias_level
(
codec
,
SND_SOC_BIAS_STANDBY
);
wm8731_set_bias_level
(
codec
,
codec
->
suspend_bias_level
);
return
0
;
}
#else
...
...
@@ -512,7 +532,7 @@ EXPORT_SYMBOL_GPL(soc_codec_dev_wm8731);
static
int
wm8731_register
(
struct
wm8731_priv
*
wm8731
,
enum
snd_soc_control_type
control
)
{
int
ret
;
int
ret
,
i
;
struct
snd_soc_codec
*
codec
=
&
wm8731
->
codec
;
if
(
wm8731_codec
)
{
...
...
@@ -543,10 +563,27 @@ static int wm8731_register(struct wm8731_priv *wm8731,
goto
err
;
}
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
wm8731
->
supplies
);
i
++
)
wm8731
->
supplies
[
i
].
supply
=
wm8731_supply_names
[
i
];
ret
=
regulator_bulk_get
(
codec
->
dev
,
ARRAY_SIZE
(
wm8731
->
supplies
),
wm8731
->
supplies
);
if
(
ret
!=
0
)
{
dev_err
(
codec
->
dev
,
"Failed to request supplies: %d
\n
"
,
ret
);
goto
err
;
}
ret
=
regulator_bulk_enable
(
ARRAY_SIZE
(
wm8731
->
supplies
),
wm8731
->
supplies
);
if
(
ret
!=
0
)
{
dev_err
(
codec
->
dev
,
"Failed to enable supplies: %d
\n
"
,
ret
);
goto
err_regulator_get
;
}
ret
=
wm8731_reset
(
codec
);
if
(
ret
<
0
)
{
dev_err
(
codec
->
dev
,
"Failed to issue reset: %d
\n
"
,
ret
);
goto
err
;
goto
err
_regulator_enable
;
}
wm8731_dai
.
dev
=
codec
->
dev
;
...
...
@@ -567,7 +604,7 @@ static int wm8731_register(struct wm8731_priv *wm8731,
ret
=
snd_soc_register_codec
(
codec
);
if
(
ret
!=
0
)
{
dev_err
(
codec
->
dev
,
"Failed to register codec: %d
\n
"
,
ret
);
goto
err
;
goto
err
_regulator_enable
;
}
ret
=
snd_soc_register_dai
(
&
wm8731_dai
);
...
...
@@ -581,6 +618,10 @@ static int wm8731_register(struct wm8731_priv *wm8731,
err_codec:
snd_soc_unregister_codec
(
codec
);
err_regulator_enable:
regulator_bulk_disable
(
ARRAY_SIZE
(
wm8731
->
supplies
),
wm8731
->
supplies
);
err_regulator_get:
regulator_bulk_free
(
ARRAY_SIZE
(
wm8731
->
supplies
),
wm8731
->
supplies
);
err:
kfree
(
wm8731
);
return
ret
;
...
...
@@ -591,6 +632,8 @@ static void wm8731_unregister(struct wm8731_priv *wm8731)
wm8731_set_bias_level
(
&
wm8731
->
codec
,
SND_SOC_BIAS_OFF
);
snd_soc_unregister_dai
(
&
wm8731_dai
);
snd_soc_unregister_codec
(
&
wm8731
->
codec
);
regulator_bulk_disable
(
ARRAY_SIZE
(
wm8731
->
supplies
),
wm8731
->
supplies
);
regulator_bulk_free
(
ARRAY_SIZE
(
wm8731
->
supplies
),
wm8731
->
supplies
);
kfree
(
wm8731
);
wm8731_codec
=
NULL
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录