Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
495fd8c8
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看板
提交
495fd8c8
编写于
6月 27, 2012
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
regulator: wm8994: Use core GPIO enable support
Signed-off-by:
N
Mark Brown
<
broonie@opensource.wolfsonmicro.com
>
上级
25a53dfb
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
4 addition
and
64 deletion
+4
-64
drivers/regulator/wm8994-regulator.c
drivers/regulator/wm8994-regulator.c
+4
-64
未找到文件。
drivers/regulator/wm8994-regulator.c
浏览文件 @
495fd8c8
...
...
@@ -26,8 +26,6 @@
#include <linux/mfd/wm8994/pdata.h>
struct
wm8994_ldo
{
int
enable
;
bool
is_enabled
;
struct
regulator_dev
*
regulator
;
struct
wm8994
*
wm8994
;
};
...
...
@@ -35,46 +33,7 @@ struct wm8994_ldo {
#define WM8994_LDO1_MAX_SELECTOR 0x7
#define WM8994_LDO2_MAX_SELECTOR 0x3
static
int
wm8994_ldo_enable
(
struct
regulator_dev
*
rdev
)
{
struct
wm8994_ldo
*
ldo
=
rdev_get_drvdata
(
rdev
);
/* If we have no soft control assume that the LDO is always enabled. */
if
(
!
ldo
->
enable
)
return
0
;
gpio_set_value_cansleep
(
ldo
->
enable
,
1
);
ldo
->
is_enabled
=
true
;
return
0
;
}
static
int
wm8994_ldo_disable
(
struct
regulator_dev
*
rdev
)
{
struct
wm8994_ldo
*
ldo
=
rdev_get_drvdata
(
rdev
);
/* If we have no soft control assume that the LDO is always enabled. */
if
(
!
ldo
->
enable
)
return
-
EINVAL
;
gpio_set_value_cansleep
(
ldo
->
enable
,
0
);
ldo
->
is_enabled
=
false
;
return
0
;
}
static
int
wm8994_ldo_is_enabled
(
struct
regulator_dev
*
rdev
)
{
struct
wm8994_ldo
*
ldo
=
rdev_get_drvdata
(
rdev
);
return
ldo
->
is_enabled
;
}
static
struct
regulator_ops
wm8994_ldo1_ops
=
{
.
enable
=
wm8994_ldo_enable
,
.
disable
=
wm8994_ldo_disable
,
.
is_enabled
=
wm8994_ldo_is_enabled
,
.
list_voltage
=
regulator_list_voltage_linear
,
.
map_voltage
=
regulator_map_voltage_linear
,
.
get_voltage_sel
=
regulator_get_voltage_sel_regmap
,
...
...
@@ -108,10 +67,6 @@ static int wm8994_ldo2_list_voltage(struct regulator_dev *rdev,
}
static
struct
regulator_ops
wm8994_ldo2_ops
=
{
.
enable
=
wm8994_ldo_enable
,
.
disable
=
wm8994_ldo_disable
,
.
is_enabled
=
wm8994_ldo_is_enabled
,
.
list_voltage
=
wm8994_ldo2_list_voltage
,
.
get_voltage_sel
=
regulator_get_voltage_sel_regmap
,
.
set_voltage_sel
=
regulator_set_voltage_sel_regmap
,
...
...
@@ -163,39 +118,26 @@ static __devinit int wm8994_ldo_probe(struct platform_device *pdev)
ldo
->
wm8994
=
wm8994
;
if
(
pdata
->
ldo
[
id
].
enable
&&
gpio_is_valid
(
pdata
->
ldo
[
id
].
enable
))
{
ldo
->
enable
=
pdata
->
ldo
[
id
].
enable
;
ret
=
gpio_request_one
(
ldo
->
enable
,
0
,
"WM8994 LDO enable"
);
if
(
ret
<
0
)
{
dev_err
(
&
pdev
->
dev
,
"Failed to get enable GPIO: %d
\n
"
,
ret
);
goto
err
;
}
}
else
ldo
->
is_enabled
=
true
;
config
.
dev
=
wm8994
->
dev
;
config
.
driver_data
=
ldo
;
config
.
regmap
=
wm8994
->
regmap
;
if
(
pdata
)
if
(
pdata
)
{
config
.
init_data
=
pdata
->
ldo
[
id
].
init_data
;
config
.
ena_gpio
=
pdata
->
ldo
[
id
].
enable
;
}
ldo
->
regulator
=
regulator_register
(
&
wm8994_ldo_desc
[
id
],
&
config
);
if
(
IS_ERR
(
ldo
->
regulator
))
{
ret
=
PTR_ERR
(
ldo
->
regulator
);
dev_err
(
wm8994
->
dev
,
"Failed to register LDO%d: %d
\n
"
,
id
+
1
,
ret
);
goto
err
_gpio
;
goto
err
;
}
platform_set_drvdata
(
pdev
,
ldo
);
return
0
;
err_gpio:
if
(
gpio_is_valid
(
ldo
->
enable
))
gpio_free
(
ldo
->
enable
);
err:
return
ret
;
}
...
...
@@ -207,8 +149,6 @@ static __devexit int wm8994_ldo_remove(struct platform_device *pdev)
platform_set_drvdata
(
pdev
,
NULL
);
regulator_unregister
(
ldo
->
regulator
);
if
(
gpio_is_valid
(
ldo
->
enable
))
gpio_free
(
ldo
->
enable
);
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录