Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
0d2cff8b
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看板
提交
0d2cff8b
编写于
12月 10, 2012
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'regulator/topic/max1586' into regulator-next
上级
a8bfb69e
4efd9dfe
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
41 addition
and
3 deletion
+41
-3
drivers/regulator/max1586.c
drivers/regulator/max1586.c
+41
-3
未找到文件。
drivers/regulator/max1586.c
浏览文件 @
0d2cff8b
...
...
@@ -44,6 +44,9 @@ struct max1586_data {
unsigned
int
min_uV
;
unsigned
int
max_uV
;
unsigned
int
v3_curr_sel
;
unsigned
int
v6_curr_sel
;
struct
regulator_dev
*
rdev
[
0
];
};
...
...
@@ -63,31 +66,60 @@ static int v6_voltages_uv[] = { 1, 1800000, 2500000, 3000000 };
* R24 and R25=100kOhm as described in the data sheet.
* The gain is approximately: 1 + R24/R25 + R24/185.5kOhm
*/
static
int
max1586_v3_get_voltage_sel
(
struct
regulator_dev
*
rdev
)
{
struct
max1586_data
*
max1586
=
rdev_get_drvdata
(
rdev
);
return
max1586
->
v3_curr_sel
;
}
static
int
max1586_v3_set_voltage_sel
(
struct
regulator_dev
*
rdev
,
unsigned
selector
)
{
struct
max1586_data
*
max1586
=
rdev_get_drvdata
(
rdev
);
struct
i2c_client
*
client
=
max1586
->
client
;
int
ret
;
u8
v3_prog
;
dev_dbg
(
&
client
->
dev
,
"changing voltage v3 to %dmv
\n
"
,
regulator_list_voltage_linear
(
rdev
,
selector
)
/
1000
);
v3_prog
=
I2C_V3_SELECT
|
(
u8
)
selector
;
return
i2c_smbus_write_byte
(
client
,
v3_prog
);
ret
=
i2c_smbus_write_byte
(
client
,
v3_prog
);
if
(
ret
)
return
ret
;
max1586
->
v3_curr_sel
=
selector
;
return
0
;
}
static
int
max1586_v6_get_voltage_sel
(
struct
regulator_dev
*
rdev
)
{
struct
max1586_data
*
max1586
=
rdev_get_drvdata
(
rdev
);
return
max1586
->
v6_curr_sel
;
}
static
int
max1586_v6_set_voltage_sel
(
struct
regulator_dev
*
rdev
,
unsigned
int
selector
)
{
struct
i2c_client
*
client
=
rdev_get_drvdata
(
rdev
);
struct
max1586_data
*
max1586
=
rdev_get_drvdata
(
rdev
);
struct
i2c_client
*
client
=
max1586
->
client
;
u8
v6_prog
;
int
ret
;
dev_dbg
(
&
client
->
dev
,
"changing voltage v6 to %dmv
\n
"
,
rdev
->
desc
->
volt_table
[
selector
]
/
1000
);
v6_prog
=
I2C_V6_SELECT
|
(
u8
)
selector
;
return
i2c_smbus_write_byte
(
client
,
v6_prog
);
ret
=
i2c_smbus_write_byte
(
client
,
v6_prog
);
if
(
ret
)
return
ret
;
max1586
->
v6_curr_sel
=
selector
;
return
0
;
}
/*
...
...
@@ -95,12 +127,14 @@ static int max1586_v6_set_voltage_sel(struct regulator_dev *rdev,
* the set up value.
*/
static
struct
regulator_ops
max1586_v3_ops
=
{
.
get_voltage_sel
=
max1586_v3_get_voltage_sel
,
.
set_voltage_sel
=
max1586_v3_set_voltage_sel
,
.
list_voltage
=
regulator_list_voltage_linear
,
.
map_voltage
=
regulator_map_voltage_linear
,
};
static
struct
regulator_ops
max1586_v6_ops
=
{
.
get_voltage_sel
=
max1586_v6_get_voltage_sel
,
.
set_voltage_sel
=
max1586_v6_set_voltage_sel
,
.
list_voltage
=
regulator_list_voltage_table
,
};
...
...
@@ -148,6 +182,10 @@ static int max1586_pmic_probe(struct i2c_client *client,
max1586
->
min_uV
=
MAX1586_V3_MIN_UV
/
1000
*
pdata
->
v3_gain
/
1000
;
max1586
->
max_uV
=
MAX1586_V3_MAX_UV
/
1000
*
pdata
->
v3_gain
/
1000
;
/* Set curr_sel to default voltage on power-up */
max1586
->
v3_curr_sel
=
24
;
/* 1.3V */
max1586
->
v6_curr_sel
=
0
;
rdev
=
max1586
->
rdev
;
for
(
i
=
0
;
i
<
pdata
->
num_subdevs
&&
i
<=
MAX1586_V6
;
i
++
)
{
id
=
pdata
->
subdevs
[
i
].
id
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录