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
nexedi
linux
Commits
495fd8c8
Commit
495fd8c8
authored
Jun 27, 2012
by
Mark Brown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
regulator: wm8994: Use core GPIO enable support
Signed-off-by:
Mark Brown
<
broonie@opensource.wolfsonmicro.com
>
parent
25a53dfb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
64 deletions
+4
-64
drivers/regulator/wm8994-regulator.c
drivers/regulator/wm8994-regulator.c
+4
-64
No files found.
drivers/regulator/wm8994-regulator.c
View file @
495fd8c8
...
@@ -26,8 +26,6 @@
...
@@ -26,8 +26,6 @@
#include <linux/mfd/wm8994/pdata.h>
#include <linux/mfd/wm8994/pdata.h>
struct
wm8994_ldo
{
struct
wm8994_ldo
{
int
enable
;
bool
is_enabled
;
struct
regulator_dev
*
regulator
;
struct
regulator_dev
*
regulator
;
struct
wm8994
*
wm8994
;
struct
wm8994
*
wm8994
;
};
};
...
@@ -35,46 +33,7 @@ struct wm8994_ldo {
...
@@ -35,46 +33,7 @@ struct wm8994_ldo {
#define WM8994_LDO1_MAX_SELECTOR 0x7
#define WM8994_LDO1_MAX_SELECTOR 0x7
#define WM8994_LDO2_MAX_SELECTOR 0x3
#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
=
{
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
,
.
list_voltage
=
regulator_list_voltage_linear
,
.
map_voltage
=
regulator_map_voltage_linear
,
.
map_voltage
=
regulator_map_voltage_linear
,
.
get_voltage_sel
=
regulator_get_voltage_sel_regmap
,
.
get_voltage_sel
=
regulator_get_voltage_sel_regmap
,
...
@@ -108,10 +67,6 @@ static int wm8994_ldo2_list_voltage(struct regulator_dev *rdev,
...
@@ -108,10 +67,6 @@ static int wm8994_ldo2_list_voltage(struct regulator_dev *rdev,
}
}
static
struct
regulator_ops
wm8994_ldo2_ops
=
{
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
,
.
list_voltage
=
wm8994_ldo2_list_voltage
,
.
get_voltage_sel
=
regulator_get_voltage_sel_regmap
,
.
get_voltage_sel
=
regulator_get_voltage_sel_regmap
,
.
set_voltage_sel
=
regulator_set_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)
...
@@ -163,39 +118,26 @@ static __devinit int wm8994_ldo_probe(struct platform_device *pdev)
ldo
->
wm8994
=
wm8994
;
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
.
dev
=
wm8994
->
dev
;
config
.
driver_data
=
ldo
;
config
.
driver_data
=
ldo
;
config
.
regmap
=
wm8994
->
regmap
;
config
.
regmap
=
wm8994
->
regmap
;
if
(
pdata
)
if
(
pdata
)
{
config
.
init_data
=
pdata
->
ldo
[
id
].
init_data
;
config
.
init_data
=
pdata
->
ldo
[
id
].
init_data
;
config
.
ena_gpio
=
pdata
->
ldo
[
id
].
enable
;
}
ldo
->
regulator
=
regulator_register
(
&
wm8994_ldo_desc
[
id
],
&
config
);
ldo
->
regulator
=
regulator_register
(
&
wm8994_ldo_desc
[
id
],
&
config
);
if
(
IS_ERR
(
ldo
->
regulator
))
{
if
(
IS_ERR
(
ldo
->
regulator
))
{
ret
=
PTR_ERR
(
ldo
->
regulator
);
ret
=
PTR_ERR
(
ldo
->
regulator
);
dev_err
(
wm8994
->
dev
,
"Failed to register LDO%d: %d
\n
"
,
dev_err
(
wm8994
->
dev
,
"Failed to register LDO%d: %d
\n
"
,
id
+
1
,
ret
);
id
+
1
,
ret
);
goto
err
_gpio
;
goto
err
;
}
}
platform_set_drvdata
(
pdev
,
ldo
);
platform_set_drvdata
(
pdev
,
ldo
);
return
0
;
return
0
;
err_gpio:
if
(
gpio_is_valid
(
ldo
->
enable
))
gpio_free
(
ldo
->
enable
);
err:
err:
return
ret
;
return
ret
;
}
}
...
@@ -207,8 +149,6 @@ static __devexit int wm8994_ldo_remove(struct platform_device *pdev)
...
@@ -207,8 +149,6 @@ static __devexit int wm8994_ldo_remove(struct platform_device *pdev)
platform_set_drvdata
(
pdev
,
NULL
);
platform_set_drvdata
(
pdev
,
NULL
);
regulator_unregister
(
ldo
->
regulator
);
regulator_unregister
(
ldo
->
regulator
);
if
(
gpio_is_valid
(
ldo
->
enable
))
gpio_free
(
ldo
->
enable
);
return
0
;
return
0
;
}
}
...
...
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