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
38962571
Commit
38962571
authored
Apr 23, 2014
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'regulator/fix/pbias' into regulator-linus
parents
5c437f42
60e8c1e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
56 deletions
+20
-56
drivers/regulator/pbias-regulator.c
drivers/regulator/pbias-regulator.c
+20
-56
No files found.
drivers/regulator/pbias-regulator.c
View file @
38962571
...
@@ -38,66 +38,24 @@ struct pbias_reg_info {
...
@@ -38,66 +38,24 @@ struct pbias_reg_info {
struct
pbias_regulator_data
{
struct
pbias_regulator_data
{
struct
regulator_desc
desc
;
struct
regulator_desc
desc
;
void
__iomem
*
pbias_addr
;
void
__iomem
*
pbias_addr
;
unsigned
int
pbias_reg
;
struct
regulator_dev
*
dev
;
struct
regulator_dev
*
dev
;
struct
regmap
*
syscon
;
struct
regmap
*
syscon
;
const
struct
pbias_reg_info
*
info
;
const
struct
pbias_reg_info
*
info
;
int
voltage
;
int
voltage
;
};
};
static
int
pbias_regulator_set_voltage
(
struct
regulator_dev
*
dev
,
static
const
unsigned
int
pbias_volt_table
[]
=
{
int
min_uV
,
int
max_uV
,
unsigned
*
selector
)
1800000
,
{
3000000
struct
pbias_regulator_data
*
data
=
rdev_get_drvdata
(
dev
);
};
const
struct
pbias_reg_info
*
info
=
data
->
info
;
int
ret
,
vmode
;
if
(
min_uV
<=
1800000
)
vmode
=
0
;
else
if
(
min_uV
>
1800000
)
vmode
=
info
->
vmode
;
ret
=
regmap_update_bits
(
data
->
syscon
,
data
->
pbias_reg
,
info
->
vmode
,
vmode
);
return
ret
;
}
static
int
pbias_regulator_get_voltage
(
struct
regulator_dev
*
rdev
)
{
struct
pbias_regulator_data
*
data
=
rdev_get_drvdata
(
rdev
);
const
struct
pbias_reg_info
*
info
=
data
->
info
;
int
value
,
voltage
;
regmap_read
(
data
->
syscon
,
data
->
pbias_reg
,
&
value
);
value
&=
info
->
vmode
;
voltage
=
value
?
3000000
:
1800000
;
return
voltage
;
}
static
int
pbias_regulator_enable
(
struct
regulator_dev
*
rdev
)
static
int
pbias_regulator_enable
(
struct
regulator_dev
*
rdev
)
{
{
struct
pbias_regulator_data
*
data
=
rdev_get_drvdata
(
rdev
);
struct
pbias_regulator_data
*
data
=
rdev_get_drvdata
(
rdev
);
const
struct
pbias_reg_info
*
info
=
data
->
info
;
const
struct
pbias_reg_info
*
info
=
data
->
info
;
int
ret
;
ret
=
regmap_update_bits
(
data
->
syscon
,
data
->
pbias_reg
,
info
->
enable_mask
,
info
->
enable
);
return
ret
;
}
static
int
pbias_regulator_disable
(
struct
regulator_dev
*
rdev
)
{
struct
pbias_regulator_data
*
data
=
rdev_get_drvdata
(
rdev
);
const
struct
pbias_reg_info
*
info
=
data
->
info
;
int
ret
;
ret
=
regmap_update_bits
(
data
->
syscon
,
data
->
pbias_reg
,
return
regmap_update_bits
(
data
->
syscon
,
rdev
->
desc
->
enable_reg
,
info
->
enable_mask
,
0
);
info
->
enable_mask
,
info
->
enable
);
return
ret
;
}
}
static
int
pbias_regulator_is_enable
(
struct
regulator_dev
*
rdev
)
static
int
pbias_regulator_is_enable
(
struct
regulator_dev
*
rdev
)
...
@@ -106,17 +64,18 @@ static int pbias_regulator_is_enable(struct regulator_dev *rdev)
...
@@ -106,17 +64,18 @@ static int pbias_regulator_is_enable(struct regulator_dev *rdev)
const
struct
pbias_reg_info
*
info
=
data
->
info
;
const
struct
pbias_reg_info
*
info
=
data
->
info
;
int
value
;
int
value
;
regmap_read
(
data
->
syscon
,
data
->
pbias
_reg
,
&
value
);
regmap_read
(
data
->
syscon
,
rdev
->
desc
->
enable
_reg
,
&
value
);
return
(
value
&
info
->
enable_mask
)
==
info
->
enable
_mask
;
return
(
value
&
info
->
enable_mask
)
==
info
->
enable
;
}
}
static
struct
regulator_ops
pbias_regulator_voltage_ops
=
{
static
struct
regulator_ops
pbias_regulator_voltage_ops
=
{
.
set_voltage
=
pbias_regulator_set_voltage
,
.
list_voltage
=
regulator_list_voltage_table
,
.
get_voltage
=
pbias_regulator_get_voltage
,
.
get_voltage_sel
=
regulator_get_voltage_sel_regmap
,
.
enable
=
pbias_regulator_enable
,
.
set_voltage_sel
=
regulator_set_voltage_sel_regmap
,
.
disable
=
pbias_regulator_disable
,
.
enable
=
pbias_regulator_enable
,
.
is_enabled
=
pbias_regulator_is_enable
,
.
disable
=
regulator_disable_regmap
,
.
is_enabled
=
pbias_regulator_is_enable
,
};
};
static
const
struct
pbias_reg_info
pbias_mmc_omap2430
=
{
static
const
struct
pbias_reg_info
pbias_mmc_omap2430
=
{
...
@@ -192,6 +151,7 @@ static int pbias_regulator_probe(struct platform_device *pdev)
...
@@ -192,6 +151,7 @@ static int pbias_regulator_probe(struct platform_device *pdev)
if
(
IS_ERR
(
syscon
))
if
(
IS_ERR
(
syscon
))
return
PTR_ERR
(
syscon
);
return
PTR_ERR
(
syscon
);
cfg
.
regmap
=
syscon
;
cfg
.
dev
=
&
pdev
->
dev
;
cfg
.
dev
=
&
pdev
->
dev
;
for
(
idx
=
0
;
idx
<
PBIAS_NUM_REGS
&&
data_idx
<
count
;
idx
++
)
{
for
(
idx
=
0
;
idx
<
PBIAS_NUM_REGS
&&
data_idx
<
count
;
idx
++
)
{
...
@@ -207,15 +167,19 @@ static int pbias_regulator_probe(struct platform_device *pdev)
...
@@ -207,15 +167,19 @@ static int pbias_regulator_probe(struct platform_device *pdev)
if
(
!
res
)
if
(
!
res
)
return
-
EINVAL
;
return
-
EINVAL
;
drvdata
[
data_idx
].
pbias_reg
=
res
->
start
;
drvdata
[
data_idx
].
syscon
=
syscon
;
drvdata
[
data_idx
].
syscon
=
syscon
;
drvdata
[
data_idx
].
info
=
info
;
drvdata
[
data_idx
].
info
=
info
;
drvdata
[
data_idx
].
desc
.
name
=
info
->
name
;
drvdata
[
data_idx
].
desc
.
name
=
info
->
name
;
drvdata
[
data_idx
].
desc
.
owner
=
THIS_MODULE
;
drvdata
[
data_idx
].
desc
.
owner
=
THIS_MODULE
;
drvdata
[
data_idx
].
desc
.
type
=
REGULATOR_VOLTAGE
;
drvdata
[
data_idx
].
desc
.
type
=
REGULATOR_VOLTAGE
;
drvdata
[
data_idx
].
desc
.
ops
=
&
pbias_regulator_voltage_ops
;
drvdata
[
data_idx
].
desc
.
ops
=
&
pbias_regulator_voltage_ops
;
drvdata
[
data_idx
].
desc
.
volt_table
=
pbias_volt_table
;
drvdata
[
data_idx
].
desc
.
n_voltages
=
2
;
drvdata
[
data_idx
].
desc
.
n_voltages
=
2
;
drvdata
[
data_idx
].
desc
.
enable_time
=
info
->
enable_time
;
drvdata
[
data_idx
].
desc
.
enable_time
=
info
->
enable_time
;
drvdata
[
data_idx
].
desc
.
vsel_reg
=
res
->
start
;
drvdata
[
data_idx
].
desc
.
vsel_mask
=
info
->
vmode
;
drvdata
[
data_idx
].
desc
.
enable_reg
=
res
->
start
;
drvdata
[
data_idx
].
desc
.
enable_mask
=
info
->
enable_mask
;
cfg
.
init_data
=
pbias_matches
[
idx
].
init_data
;
cfg
.
init_data
=
pbias_matches
[
idx
].
init_data
;
cfg
.
driver_data
=
&
drvdata
[
data_idx
];
cfg
.
driver_data
=
&
drvdata
[
data_idx
];
...
...
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