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
83b0dd9e
Commit
83b0dd9e
authored
Apr 28, 2013
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'regulator/topic/as3711' into v3.9-rc8
parents
f50b7f2b
d6c7d731
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
3 deletions
+64
-3
drivers/regulator/as3711-regulator.c
drivers/regulator/as3711-regulator.c
+64
-3
No files found.
drivers/regulator/as3711-regulator.c
View file @
83b0dd9e
...
@@ -13,9 +13,11 @@
...
@@ -13,9 +13,11 @@
#include <linux/init.h>
#include <linux/init.h>
#include <linux/mfd/as3711.h>
#include <linux/mfd/as3711.h>
#include <linux/module.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/regmap.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/of_regulator.h>
#include <linux/slab.h>
#include <linux/slab.h>
struct
as3711_regulator_info
{
struct
as3711_regulator_info
{
...
@@ -276,6 +278,53 @@ static struct as3711_regulator_info as3711_reg_info[] = {
...
@@ -276,6 +278,53 @@ static struct as3711_regulator_info as3711_reg_info[] = {
#define AS3711_REGULATOR_NUM ARRAY_SIZE(as3711_reg_info)
#define AS3711_REGULATOR_NUM ARRAY_SIZE(as3711_reg_info)
static
struct
of_regulator_match
as3711_regulator_matches
[
AS3711_REGULATOR_NUM
]
=
{
[
AS3711_REGULATOR_SD_1
]
=
{
.
name
=
"sd1"
},
[
AS3711_REGULATOR_SD_2
]
=
{
.
name
=
"sd2"
},
[
AS3711_REGULATOR_SD_3
]
=
{
.
name
=
"sd3"
},
[
AS3711_REGULATOR_SD_4
]
=
{
.
name
=
"sd4"
},
[
AS3711_REGULATOR_LDO_1
]
=
{
.
name
=
"ldo1"
},
[
AS3711_REGULATOR_LDO_2
]
=
{
.
name
=
"ldo2"
},
[
AS3711_REGULATOR_LDO_3
]
=
{
.
name
=
"ldo3"
},
[
AS3711_REGULATOR_LDO_4
]
=
{
.
name
=
"ldo4"
},
[
AS3711_REGULATOR_LDO_5
]
=
{
.
name
=
"ldo5"
},
[
AS3711_REGULATOR_LDO_6
]
=
{
.
name
=
"ldo6"
},
[
AS3711_REGULATOR_LDO_7
]
=
{
.
name
=
"ldo7"
},
[
AS3711_REGULATOR_LDO_8
]
=
{
.
name
=
"ldo8"
},
};
static
int
as3711_regulator_parse_dt
(
struct
device
*
dev
,
struct
device_node
**
of_node
,
const
int
count
)
{
struct
as3711_regulator_pdata
*
pdata
=
dev_get_platdata
(
dev
);
struct
device_node
*
regulators
=
of_find_node_by_name
(
dev
->
parent
->
of_node
,
"regulators"
);
struct
of_regulator_match
*
match
;
int
ret
,
i
;
if
(
!
regulators
)
{
dev_err
(
dev
,
"regulator node not found
\n
"
);
return
-
ENODEV
;
}
ret
=
of_regulator_match
(
dev
->
parent
,
regulators
,
as3711_regulator_matches
,
count
);
of_node_put
(
regulators
);
if
(
ret
<
0
)
{
dev_err
(
dev
,
"Error parsing regulator init data: %d
\n
"
,
ret
);
return
ret
;
}
for
(
i
=
0
,
match
=
as3711_regulator_matches
;
i
<
count
;
i
++
,
match
++
)
if
(
match
->
of_node
)
{
pdata
->
init_data
[
i
]
=
match
->
init_data
;
of_node
[
i
]
=
match
->
of_node
;
}
return
0
;
}
static
int
as3711_regulator_probe
(
struct
platform_device
*
pdev
)
static
int
as3711_regulator_probe
(
struct
platform_device
*
pdev
)
{
{
struct
as3711_regulator_pdata
*
pdata
=
dev_get_platdata
(
&
pdev
->
dev
);
struct
as3711_regulator_pdata
*
pdata
=
dev_get_platdata
(
&
pdev
->
dev
);
...
@@ -284,13 +333,24 @@ static int as3711_regulator_probe(struct platform_device *pdev)
...
@@ -284,13 +333,24 @@ static int as3711_regulator_probe(struct platform_device *pdev)
struct
regulator_config
config
=
{.
dev
=
&
pdev
->
dev
,};
struct
regulator_config
config
=
{.
dev
=
&
pdev
->
dev
,};
struct
as3711_regulator
*
reg
=
NULL
;
struct
as3711_regulator
*
reg
=
NULL
;
struct
as3711_regulator
*
regs
;
struct
as3711_regulator
*
regs
;
struct
device_node
*
of_node
[
AS3711_REGULATOR_NUM
]
=
{};
struct
regulator_dev
*
rdev
;
struct
regulator_dev
*
rdev
;
struct
as3711_regulator_info
*
ri
;
struct
as3711_regulator_info
*
ri
;
int
ret
;
int
ret
;
int
id
;
int
id
;
if
(
!
pdata
)
if
(
!
pdata
)
{
dev_dbg
(
&
pdev
->
dev
,
"No platform data...
\n
"
);
dev_err
(
&
pdev
->
dev
,
"No platform data...
\n
"
);
return
-
ENODEV
;
}
if
(
pdev
->
dev
.
parent
->
of_node
)
{
ret
=
as3711_regulator_parse_dt
(
&
pdev
->
dev
,
of_node
,
AS3711_REGULATOR_NUM
);
if
(
ret
<
0
)
{
dev_err
(
&
pdev
->
dev
,
"DT parsing failed: %d
\n
"
,
ret
);
return
ret
;
}
}
regs
=
devm_kzalloc
(
&
pdev
->
dev
,
AS3711_REGULATOR_NUM
*
regs
=
devm_kzalloc
(
&
pdev
->
dev
,
AS3711_REGULATOR_NUM
*
sizeof
(
struct
as3711_regulator
),
GFP_KERNEL
);
sizeof
(
struct
as3711_regulator
),
GFP_KERNEL
);
...
@@ -300,7 +360,7 @@ static int as3711_regulator_probe(struct platform_device *pdev)
...
@@ -300,7 +360,7 @@ static int as3711_regulator_probe(struct platform_device *pdev)
}
}
for
(
id
=
0
,
ri
=
as3711_reg_info
;
id
<
AS3711_REGULATOR_NUM
;
++
id
,
ri
++
)
{
for
(
id
=
0
,
ri
=
as3711_reg_info
;
id
<
AS3711_REGULATOR_NUM
;
++
id
,
ri
++
)
{
reg_data
=
pdata
?
pdata
->
init_data
[
id
]
:
NULL
;
reg_data
=
pdata
->
init_data
[
id
]
;
/* No need to register if there is no regulator data */
/* No need to register if there is no regulator data */
if
(
!
reg_data
)
if
(
!
reg_data
)
...
@@ -312,6 +372,7 @@ static int as3711_regulator_probe(struct platform_device *pdev)
...
@@ -312,6 +372,7 @@ static int as3711_regulator_probe(struct platform_device *pdev)
config
.
init_data
=
reg_data
;
config
.
init_data
=
reg_data
;
config
.
driver_data
=
reg
;
config
.
driver_data
=
reg
;
config
.
regmap
=
as3711
->
regmap
;
config
.
regmap
=
as3711
->
regmap
;
config
.
of_node
=
of_node
[
id
];
rdev
=
regulator_register
(
&
ri
->
desc
,
&
config
);
rdev
=
regulator_register
(
&
ri
->
desc
,
&
config
);
if
(
IS_ERR
(
rdev
))
{
if
(
IS_ERR
(
rdev
))
{
...
...
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