Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
e4cf86a3
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e4cf86a3
编写于
9月 29, 2016
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'asoc/fix/tpa6130a2' into asoc-linus
上级
b669010e
a114580f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
26 addition
and
23 deletion
+26
-23
sound/soc/codecs/tpa6130a2.c
sound/soc/codecs/tpa6130a2.c
+26
-23
未找到文件。
sound/soc/codecs/tpa6130a2.c
浏览文件 @
e4cf86a3
...
@@ -52,7 +52,7 @@ struct tpa6130a2_data {
...
@@ -52,7 +52,7 @@ struct tpa6130a2_data {
static
int
tpa6130a2_power
(
struct
tpa6130a2_data
*
data
,
bool
enable
)
static
int
tpa6130a2_power
(
struct
tpa6130a2_data
*
data
,
bool
enable
)
{
{
int
ret
;
int
ret
=
0
,
ret2
;
if
(
enable
)
{
if
(
enable
)
{
ret
=
regulator_enable
(
data
->
supply
);
ret
=
regulator_enable
(
data
->
supply
);
...
@@ -64,20 +64,34 @@ static int tpa6130a2_power(struct tpa6130a2_data *data, bool enable)
...
@@ -64,20 +64,34 @@ static int tpa6130a2_power(struct tpa6130a2_data *data, bool enable)
/* Power on */
/* Power on */
if
(
data
->
power_gpio
>=
0
)
if
(
data
->
power_gpio
>=
0
)
gpio_set_value
(
data
->
power_gpio
,
1
);
gpio_set_value
(
data
->
power_gpio
,
1
);
/* Sync registers */
regcache_cache_only
(
data
->
regmap
,
false
);
ret
=
regcache_sync
(
data
->
regmap
);
if
(
ret
!=
0
)
{
dev_err
(
data
->
dev
,
"Failed to sync registers: %d
\n
"
,
ret
);
goto
regcache_sync_failed
;
}
}
else
{
}
else
{
/* Powered off device does not retain registers. While device
* is off, any register updates (i.e. volume changes) should
* happen in cache only.
*/
regcache_mark_dirty
(
data
->
regmap
);
regcache_sync_failed:
regcache_cache_only
(
data
->
regmap
,
true
);
/* Power off */
/* Power off */
if
(
data
->
power_gpio
>=
0
)
if
(
data
->
power_gpio
>=
0
)
gpio_set_value
(
data
->
power_gpio
,
0
);
gpio_set_value
(
data
->
power_gpio
,
0
);
ret
=
regulator_disable
(
data
->
supply
);
ret
2
=
regulator_disable
(
data
->
supply
);
if
(
ret
!=
0
)
{
if
(
ret
2
!=
0
)
{
dev_err
(
data
->
dev
,
dev_err
(
data
->
dev
,
"Failed to disable supply: %d
\n
"
,
ret
);
"Failed to disable supply: %d
\n
"
,
ret
2
);
return
ret
;
return
ret
?
ret
:
ret2
;
}
}
/* device regs does not match the cache state anymore */
regcache_mark_dirty
(
data
->
regmap
);
}
}
return
ret
;
return
ret
;
...
@@ -88,25 +102,14 @@ static int tpa6130a2_power_event(struct snd_soc_dapm_widget *w,
...
@@ -88,25 +102,14 @@ static int tpa6130a2_power_event(struct snd_soc_dapm_widget *w,
{
{
struct
snd_soc_component
*
c
=
snd_soc_dapm_to_component
(
w
->
dapm
);
struct
snd_soc_component
*
c
=
snd_soc_dapm_to_component
(
w
->
dapm
);
struct
tpa6130a2_data
*
data
=
snd_soc_component_get_drvdata
(
c
);
struct
tpa6130a2_data
*
data
=
snd_soc_component_get_drvdata
(
c
);
int
ret
;
/* before widget power up */
if
(
SND_SOC_DAPM_EVENT_ON
(
event
))
{
if
(
SND_SOC_DAPM_EVENT_ON
(
event
))
{
/* Turn on the chip */
/* Before widget power up: turn chip on, sync registers */
tpa6130a2_power
(
data
,
true
);
return
tpa6130a2_power
(
data
,
true
);
/* Sync the registers */
ret
=
regcache_sync
(
data
->
regmap
);
if
(
ret
<
0
)
{
dev_err
(
c
->
dev
,
"Failed to initialize chip
\n
"
);
tpa6130a2_power
(
data
,
false
);
return
ret
;
}
/* after widget power down */
}
else
{
}
else
{
tpa6130a2_power
(
data
,
false
);
/* After widget power down: turn chip off */
return
tpa6130a2_power
(
data
,
false
);
}
}
return
0
;
}
}
/*
/*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录