Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
a9877b60
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,发现更多精彩内容 >>
提交
a9877b60
编写于
2月 08, 2015
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'regulator/topic/core' into regulator-next
上级
36818b82
39f802d6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
111 addition
and
130 deletion
+111
-130
drivers/regulator/core.c
drivers/regulator/core.c
+111
-130
未找到文件。
drivers/regulator/core.c
浏览文件 @
a9877b60
...
@@ -632,30 +632,6 @@ static ssize_t regulator_bypass_show(struct device *dev,
...
@@ -632,30 +632,6 @@ static ssize_t regulator_bypass_show(struct device *dev,
static
DEVICE_ATTR
(
bypass
,
0444
,
static
DEVICE_ATTR
(
bypass
,
0444
,
regulator_bypass_show
,
NULL
);
regulator_bypass_show
,
NULL
);
/*
* These are the only attributes are present for all regulators.
* Other attributes are a function of regulator functionality.
*/
static
struct
attribute
*
regulator_dev_attrs
[]
=
{
&
dev_attr_name
.
attr
,
&
dev_attr_num_users
.
attr
,
&
dev_attr_type
.
attr
,
NULL
,
};
ATTRIBUTE_GROUPS
(
regulator_dev
);
static
void
regulator_dev_release
(
struct
device
*
dev
)
{
struct
regulator_dev
*
rdev
=
dev_get_drvdata
(
dev
);
kfree
(
rdev
);
}
static
struct
class
regulator_class
=
{
.
name
=
"regulator"
,
.
dev_release
=
regulator_dev_release
,
.
dev_groups
=
regulator_dev_groups
,
};
/* Calculate the new optimum regulator operating mode based on the new total
/* Calculate the new optimum regulator operating mode based on the new total
* consumer load. All locks held by caller */
* consumer load. All locks held by caller */
static
void
drms_uA_update
(
struct
regulator_dev
*
rdev
)
static
void
drms_uA_update
(
struct
regulator_dev
*
rdev
)
...
@@ -3436,126 +3412,136 @@ int regulator_mode_to_status(unsigned int mode)
...
@@ -3436,126 +3412,136 @@ int regulator_mode_to_status(unsigned int mode)
}
}
EXPORT_SYMBOL_GPL
(
regulator_mode_to_status
);
EXPORT_SYMBOL_GPL
(
regulator_mode_to_status
);
static
struct
attribute
*
regulator_dev_attrs
[]
=
{
&
dev_attr_name
.
attr
,
&
dev_attr_num_users
.
attr
,
&
dev_attr_type
.
attr
,
&
dev_attr_microvolts
.
attr
,
&
dev_attr_microamps
.
attr
,
&
dev_attr_opmode
.
attr
,
&
dev_attr_state
.
attr
,
&
dev_attr_status
.
attr
,
&
dev_attr_bypass
.
attr
,
&
dev_attr_requested_microamps
.
attr
,
&
dev_attr_min_microvolts
.
attr
,
&
dev_attr_max_microvolts
.
attr
,
&
dev_attr_min_microamps
.
attr
,
&
dev_attr_max_microamps
.
attr
,
&
dev_attr_suspend_standby_state
.
attr
,
&
dev_attr_suspend_mem_state
.
attr
,
&
dev_attr_suspend_disk_state
.
attr
,
&
dev_attr_suspend_standby_microvolts
.
attr
,
&
dev_attr_suspend_mem_microvolts
.
attr
,
&
dev_attr_suspend_disk_microvolts
.
attr
,
&
dev_attr_suspend_standby_mode
.
attr
,
&
dev_attr_suspend_mem_mode
.
attr
,
&
dev_attr_suspend_disk_mode
.
attr
,
NULL
};
/*
/*
* To avoid cluttering sysfs (and memory) with useless state, only
* To avoid cluttering sysfs (and memory) with useless state, only
* create attributes that can be meaningfully displayed.
* create attributes that can be meaningfully displayed.
*/
*/
static
int
add_regulator_attributes
(
struct
regulator_dev
*
rdev
)
static
umode_t
regulator_attr_is_visible
(
struct
kobject
*
kobj
,
struct
attribute
*
attr
,
int
idx
)
{
{
struct
device
*
dev
=
&
rdev
->
dev
;
struct
device
*
dev
=
kobj_to_dev
(
kobj
);
struct
regulator_dev
*
rdev
=
container_of
(
dev
,
struct
regulator_dev
,
dev
);
const
struct
regulator_ops
*
ops
=
rdev
->
desc
->
ops
;
const
struct
regulator_ops
*
ops
=
rdev
->
desc
->
ops
;
int
status
=
0
;
umode_t
mode
=
attr
->
mode
;
/* these three are always present */
if
(
attr
==
&
dev_attr_name
.
attr
||
attr
==
&
dev_attr_num_users
.
attr
||
attr
==
&
dev_attr_type
.
attr
)
return
mode
;
/* some attributes need specific methods to be displayed */
/* some attributes need specific methods to be displayed */
if
((
ops
->
get_voltage
&&
ops
->
get_voltage
(
rdev
)
>=
0
)
||
if
(
attr
==
&
dev_attr_microvolts
.
attr
)
{
(
ops
->
get_voltage_sel
&&
ops
->
get_voltage_sel
(
rdev
)
>=
0
)
||
if
((
ops
->
get_voltage
&&
ops
->
get_voltage
(
rdev
)
>=
0
)
||
(
ops
->
list_voltage
&&
ops
->
list_voltage
(
rdev
,
0
)
>=
0
)
||
(
ops
->
get_voltage_sel
&&
ops
->
get_voltage_sel
(
rdev
)
>=
0
)
||
(
rdev
->
desc
->
fixed_uV
&&
(
rdev
->
desc
->
n_voltages
==
1
)))
{
(
ops
->
list_voltage
&&
ops
->
list_voltage
(
rdev
,
0
)
>=
0
)
||
status
=
device_create_file
(
dev
,
&
dev_attr_microvolts
);
(
rdev
->
desc
->
fixed_uV
&&
rdev
->
desc
->
n_voltages
==
1
))
if
(
status
<
0
)
return
mode
;
return
status
;
return
0
;
}
if
(
ops
->
get_current_limit
)
{
status
=
device_create_file
(
dev
,
&
dev_attr_microamps
);
if
(
status
<
0
)
return
status
;
}
if
(
ops
->
get_mode
)
{
status
=
device_create_file
(
dev
,
&
dev_attr_opmode
);
if
(
status
<
0
)
return
status
;
}
if
(
rdev
->
ena_pin
||
ops
->
is_enabled
)
{
status
=
device_create_file
(
dev
,
&
dev_attr_state
);
if
(
status
<
0
)
return
status
;
}
if
(
ops
->
get_status
)
{
status
=
device_create_file
(
dev
,
&
dev_attr_status
);
if
(
status
<
0
)
return
status
;
}
if
(
ops
->
get_bypass
)
{
status
=
device_create_file
(
dev
,
&
dev_attr_bypass
);
if
(
status
<
0
)
return
status
;
}
}
if
(
attr
==
&
dev_attr_microamps
.
attr
)
return
ops
->
get_current_limit
?
mode
:
0
;
if
(
attr
==
&
dev_attr_opmode
.
attr
)
return
ops
->
get_mode
?
mode
:
0
;
if
(
attr
==
&
dev_attr_state
.
attr
)
return
(
rdev
->
ena_pin
||
ops
->
is_enabled
)
?
mode
:
0
;
if
(
attr
==
&
dev_attr_status
.
attr
)
return
ops
->
get_status
?
mode
:
0
;
if
(
attr
==
&
dev_attr_bypass
.
attr
)
return
ops
->
get_bypass
?
mode
:
0
;
/* some attributes are type-specific */
/* some attributes are type-specific */
if
(
rdev
->
desc
->
type
==
REGULATOR_CURRENT
)
{
if
(
attr
==
&
dev_attr_requested_microamps
.
attr
)
status
=
device_create_file
(
dev
,
&
dev_attr_requested_microamps
);
return
rdev
->
desc
->
type
==
REGULATOR_CURRENT
?
mode
:
0
;
if
(
status
<
0
)
return
status
;
}
/* all the other attributes exist to support constraints;
/* all the other attributes exist to support constraints;
* don't show them if there are no constraints, or if the
* don't show them if there are no constraints, or if the
* relevant supporting methods are missing.
* relevant supporting methods are missing.
*/
*/
if
(
!
rdev
->
constraints
)
if
(
!
rdev
->
constraints
)
return
status
;
return
0
;
/* constraints need specific supporting methods */
/* constraints need specific supporting methods */
if
(
ops
->
set_voltage
||
ops
->
set_voltage_sel
)
{
if
(
attr
==
&
dev_attr_min_microvolts
.
attr
||
status
=
device_create_file
(
dev
,
&
dev_attr_min_microvolts
);
attr
==
&
dev_attr_max_microvolts
.
attr
)
if
(
status
<
0
)
return
(
ops
->
set_voltage
||
ops
->
set_voltage_sel
)
?
mode
:
0
;
return
status
;
status
=
device_create_file
(
dev
,
&
dev_attr_max_microvolts
);
if
(
attr
==
&
dev_attr_min_microamps
.
attr
||
if
(
status
<
0
)
attr
==
&
dev_attr_max_microamps
.
attr
)
return
status
;
return
ops
->
set_current_limit
?
mode
:
0
;
}
if
(
ops
->
set_current_limit
)
{
if
(
attr
==
&
dev_attr_suspend_standby_state
.
attr
||
status
=
device_create_file
(
dev
,
&
dev_attr_min_microamps
);
attr
==
&
dev_attr_suspend_mem_state
.
attr
||
if
(
status
<
0
)
attr
==
&
dev_attr_suspend_disk_state
.
attr
)
return
status
;
return
mode
;
status
=
device_create_file
(
dev
,
&
dev_attr_max_microamps
);
if
(
status
<
0
)
if
(
attr
==
&
dev_attr_suspend_standby_microvolts
.
attr
||
return
status
;
attr
==
&
dev_attr_suspend_mem_microvolts
.
attr
||
}
attr
==
&
dev_attr_suspend_disk_microvolts
.
attr
)
return
ops
->
set_suspend_voltage
?
mode
:
0
;
status
=
device_create_file
(
dev
,
&
dev_attr_suspend_standby_state
);
if
(
status
<
0
)
if
(
attr
==
&
dev_attr_suspend_standby_mode
.
attr
||
return
status
;
attr
==
&
dev_attr_suspend_mem_mode
.
attr
||
status
=
device_create_file
(
dev
,
&
dev_attr_suspend_mem_state
);
attr
==
&
dev_attr_suspend_disk_mode
.
attr
)
if
(
status
<
0
)
return
ops
->
set_suspend_mode
?
mode
:
0
;
return
status
;
status
=
device_create_file
(
dev
,
&
dev_attr_suspend_disk_state
);
return
mode
;
if
(
status
<
0
)
}
return
status
;
static
const
struct
attribute_group
regulator_dev_group
=
{
.
attrs
=
regulator_dev_attrs
,
.
is_visible
=
regulator_attr_is_visible
,
};
static
const
struct
attribute_group
*
regulator_dev_groups
[]
=
{
&
regulator_dev_group
,
NULL
};
if
(
ops
->
set_suspend_voltage
)
{
static
void
regulator_dev_release
(
struct
device
*
dev
)
status
=
device_create_file
(
dev
,
{
&
dev_attr_suspend_standby_microvolts
);
struct
regulator_dev
*
rdev
=
dev_get_drvdata
(
dev
);
if
(
status
<
0
)
kfree
(
rdev
);
return
status
;
status
=
device_create_file
(
dev
,
&
dev_attr_suspend_mem_microvolts
);
if
(
status
<
0
)
return
status
;
status
=
device_create_file
(
dev
,
&
dev_attr_suspend_disk_microvolts
);
if
(
status
<
0
)
return
status
;
}
if
(
ops
->
set_suspend_mode
)
{
status
=
device_create_file
(
dev
,
&
dev_attr_suspend_standby_mode
);
if
(
status
<
0
)
return
status
;
status
=
device_create_file
(
dev
,
&
dev_attr_suspend_mem_mode
);
if
(
status
<
0
)
return
status
;
status
=
device_create_file
(
dev
,
&
dev_attr_suspend_disk_mode
);
if
(
status
<
0
)
return
status
;
}
return
status
;
}
}
static
struct
class
regulator_class
=
{
.
name
=
"regulator"
,
.
dev_release
=
regulator_dev_release
,
.
dev_groups
=
regulator_dev_groups
,
};
static
void
rdev_init_debugfs
(
struct
regulator_dev
*
rdev
)
static
void
rdev_init_debugfs
(
struct
regulator_dev
*
rdev
)
{
{
rdev
->
debugfs
=
debugfs_create_dir
(
rdev_get_name
(
rdev
),
debugfs_root
);
rdev
->
debugfs
=
debugfs_create_dir
(
rdev_get_name
(
rdev
),
debugfs_root
);
...
@@ -3587,7 +3573,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
...
@@ -3587,7 +3573,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
{
{
const
struct
regulation_constraints
*
constraints
=
NULL
;
const
struct
regulation_constraints
*
constraints
=
NULL
;
const
struct
regulator_init_data
*
init_data
;
const
struct
regulator_init_data
*
init_data
;
static
atomic_t
regulator_no
=
ATOMIC_INIT
(
0
);
static
atomic_t
regulator_no
=
ATOMIC_INIT
(
-
1
);
struct
regulator_dev
*
rdev
;
struct
regulator_dev
*
rdev
;
struct
device
*
dev
;
struct
device
*
dev
;
int
ret
,
i
;
int
ret
,
i
;
...
@@ -3660,8 +3646,8 @@ regulator_register(const struct regulator_desc *regulator_desc,
...
@@ -3660,8 +3646,8 @@ regulator_register(const struct regulator_desc *regulator_desc,
/* register with sysfs */
/* register with sysfs */
rdev
->
dev
.
class
=
&
regulator_class
;
rdev
->
dev
.
class
=
&
regulator_class
;
rdev
->
dev
.
parent
=
dev
;
rdev
->
dev
.
parent
=
dev
;
dev_set_name
(
&
rdev
->
dev
,
"regulator.%
d
"
,
dev_set_name
(
&
rdev
->
dev
,
"regulator.%
lu
"
,
atomic_inc_return
(
&
regulator_no
)
-
1
);
(
unsigned
long
)
atomic_inc_return
(
&
regulator_no
)
);
ret
=
device_register
(
&
rdev
->
dev
);
ret
=
device_register
(
&
rdev
->
dev
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
put_device
(
&
rdev
->
dev
);
put_device
(
&
rdev
->
dev
);
...
@@ -3694,11 +3680,6 @@ regulator_register(const struct regulator_desc *regulator_desc,
...
@@ -3694,11 +3680,6 @@ regulator_register(const struct regulator_desc *regulator_desc,
if
(
ret
<
0
)
if
(
ret
<
0
)
goto
scrub
;
goto
scrub
;
/* add attributes supported by this regulator */
ret
=
add_regulator_attributes
(
rdev
);
if
(
ret
<
0
)
goto
scrub
;
if
(
init_data
&&
init_data
->
supply_regulator
)
if
(
init_data
&&
init_data
->
supply_regulator
)
supply
=
init_data
->
supply_regulator
;
supply
=
init_data
->
supply_regulator
;
else
if
(
regulator_desc
->
supply_name
)
else
if
(
regulator_desc
->
supply_name
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录