Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
6a244cad
Commit
6a244cad
authored
Feb 19, 2013
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'regulator/topic/max8997' into regulator-next
parents
1fe23017
b79ca051
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
61 deletions
+20
-61
drivers/regulator/max8997.c
drivers/regulator/max8997.c
+20
-61
No files found.
drivers/regulator/max8997.c
View file @
6a244cad
...
...
@@ -54,6 +54,13 @@ struct max8997_data {
u8
saved_states
[
MAX8997_REG_MAX
];
};
static
const
unsigned
int
safeoutvolt
[]
=
{
4850000
,
4900000
,
4950000
,
3300000
,
};
static
inline
void
max8997_set_gpio
(
struct
max8997_data
*
max8997
)
{
int
set3
=
(
max8997
->
buck125_gpioindex
)
&
0x1
;
...
...
@@ -130,29 +137,6 @@ static const struct voltage_map_desc *reg_voltage_map[] = {
[
MAX8997_CHARGER_TOPOFF
]
=
&
topoff_current_map_desc
,
};
static
int
max8997_list_voltage_safeout
(
struct
regulator_dev
*
rdev
,
unsigned
int
selector
)
{
int
rid
=
rdev_get_id
(
rdev
);
if
(
rid
==
MAX8997_ESAFEOUT1
||
rid
==
MAX8997_ESAFEOUT2
)
{
switch
(
selector
)
{
case
0
:
return
4850000
;
case
1
:
return
4900000
;
case
2
:
return
4950000
;
case
3
:
return
3300000
;
default:
return
-
EINVAL
;
}
}
return
-
EINVAL
;
}
static
int
max8997_list_voltage_charger_cv
(
struct
regulator_dev
*
rdev
,
unsigned
int
selector
)
{
...
...
@@ -522,7 +506,7 @@ static int max8997_set_voltage_ldobuck(struct regulator_dev *rdev,
return
ret
;
}
static
int
max8997_set_voltage_
ldo
buck_time_sel
(
struct
regulator_dev
*
rdev
,
static
int
max8997_set_voltage_buck_time_sel
(
struct
regulator_dev
*
rdev
,
unsigned
int
old_selector
,
unsigned
int
new_selector
)
{
...
...
@@ -720,49 +704,23 @@ static int max8997_set_voltage_buck(struct regulator_dev *rdev,
return
0
;
}
static
const
int
safeoutvolt
[]
=
{
3300000
,
4850000
,
4900000
,
4950000
,
};
/* For SAFEOUT1 and SAFEOUT2 */
static
int
max8997_set_voltage_safeout
(
struct
regulator_dev
*
rdev
,
int
min_uV
,
int
max_uV
,
unsigned
*
selector
)
static
int
max8997_set_voltage_safeout
_sel
(
struct
regulator_dev
*
rdev
,
unsigned
selector
)
{
struct
max8997_data
*
max8997
=
rdev_get_drvdata
(
rdev
);
struct
i2c_client
*
i2c
=
max8997
->
iodev
->
i2c
;
int
rid
=
rdev_get_id
(
rdev
);
int
reg
,
shift
=
0
,
mask
,
ret
;
int
i
=
0
;
u8
val
;
if
(
rid
!=
MAX8997_ESAFEOUT1
&&
rid
!=
MAX8997_ESAFEOUT2
)
return
-
EINVAL
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
safeoutvolt
);
i
++
)
{
if
(
min_uV
<=
safeoutvolt
[
i
]
&&
max_uV
>=
safeoutvolt
[
i
])
break
;
}
if
(
i
>=
ARRAY_SIZE
(
safeoutvolt
))
return
-
EINVAL
;
if
(
i
==
0
)
val
=
0x3
;
else
val
=
i
-
1
;
ret
=
max8997_get_voltage_register
(
rdev
,
&
reg
,
&
shift
,
&
mask
);
if
(
ret
)
return
ret
;
ret
=
max8997_update_reg
(
i2c
,
reg
,
val
<<
shift
,
mask
<<
shift
);
*
selector
=
val
;
return
ret
;
return
max8997_update_reg
(
i2c
,
reg
,
selector
<<
shift
,
mask
<<
shift
);
}
static
int
max8997_reg_disable_suspend
(
struct
regulator_dev
*
rdev
)
...
...
@@ -799,7 +757,6 @@ static struct regulator_ops max8997_ldo_ops = {
.
disable
=
max8997_reg_disable
,
.
get_voltage_sel
=
max8997_get_voltage_sel
,
.
set_voltage
=
max8997_set_voltage_ldobuck
,
.
set_voltage_time_sel
=
max8997_set_voltage_ldobuck_time_sel
,
.
set_suspend_disable
=
max8997_reg_disable_suspend
,
};
...
...
@@ -810,7 +767,7 @@ static struct regulator_ops max8997_buck_ops = {
.
disable
=
max8997_reg_disable
,
.
get_voltage_sel
=
max8997_get_voltage_sel
,
.
set_voltage
=
max8997_set_voltage_buck
,
.
set_voltage_time_sel
=
max8997_set_voltage_
ldo
buck_time_sel
,
.
set_voltage_time_sel
=
max8997_set_voltage_buck_time_sel
,
.
set_suspend_disable
=
max8997_reg_disable_suspend
,
};
...
...
@@ -823,12 +780,12 @@ static struct regulator_ops max8997_fixedvolt_ops = {
};
static
struct
regulator_ops
max8997_safeout_ops
=
{
.
list_voltage
=
max8997_list_voltage_safeout
,
.
list_voltage
=
regulator_list_voltage_table
,
.
is_enabled
=
max8997_reg_is_enabled
,
.
enable
=
max8997_reg_enable
,
.
disable
=
max8997_reg_disable
,
.
get_voltage_sel
=
max8997_get_voltage_sel
,
.
set_voltage
=
max8997_set_voltage_safeout
,
.
set_voltage
_sel
=
max8997_set_voltage_safeout_sel
,
.
set_suspend_disable
=
max8997_reg_disable_suspend
,
};
...
...
@@ -1233,13 +1190,15 @@ static int max8997_pmic_probe(struct platform_device *pdev)
int
id
=
pdata
->
regulators
[
i
].
id
;
desc
=
reg_voltage_map
[
id
];
if
(
desc
)
if
(
desc
)
{
regulators
[
id
].
n_voltages
=
(
desc
->
max
-
desc
->
min
)
/
desc
->
step
+
1
;
else
if
(
id
==
MAX8997_ESAFEOUT1
||
id
==
MAX8997_ESAFEOUT2
)
regulators
[
id
].
n_voltages
=
4
;
else
if
(
id
==
MAX8997_CHARGER_CV
)
}
else
if
(
id
==
MAX8997_ESAFEOUT1
||
id
==
MAX8997_ESAFEOUT2
)
{
regulators
[
id
].
volt_table
=
safeoutvolt
;
regulators
[
id
].
n_voltages
=
ARRAY_SIZE
(
safeoutvolt
);
}
else
if
(
id
==
MAX8997_CHARGER_CV
)
{
regulators
[
id
].
n_voltages
=
16
;
}
config
.
dev
=
max8997
->
dev
;
config
.
init_data
=
pdata
->
regulators
[
i
].
initdata
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment