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
28c426c7
Commit
28c426c7
authored
Nov 10, 2017
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'regulator/topic/axp20x' into regulator-next
parents
46294d66
ad92ceaf
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
4 deletions
+91
-4
drivers/regulator/axp20x-regulator.c
drivers/regulator/axp20x-regulator.c
+88
-4
include/linux/mfd/axp20x.h
include/linux/mfd/axp20x.h
+3
-0
No files found.
drivers/regulator/axp20x-regulator.c
View file @
28c426c7
...
@@ -244,6 +244,7 @@ static const struct regulator_desc axp22x_drivevbus_regulator = {
...
@@ -244,6 +244,7 @@ static const struct regulator_desc axp22x_drivevbus_regulator = {
.
ops
=
&
axp20x_ops_sw
,
.
ops
=
&
axp20x_ops_sw
,
};
};
/* DCDC ranges shared with AXP813 */
static
const
struct
regulator_linear_range
axp803_dcdc234_ranges
[]
=
{
static
const
struct
regulator_linear_range
axp803_dcdc234_ranges
[]
=
{
REGULATOR_LINEAR_RANGE
(
500000
,
0x0
,
0x46
,
10000
),
REGULATOR_LINEAR_RANGE
(
500000
,
0x0
,
0x46
,
10000
),
REGULATOR_LINEAR_RANGE
(
1220000
,
0x47
,
0x4b
,
20000
),
REGULATOR_LINEAR_RANGE
(
1220000
,
0x47
,
0x4b
,
20000
),
...
@@ -426,6 +427,69 @@ static const struct regulator_desc axp809_regulators[] = {
...
@@ -426,6 +427,69 @@ static const struct regulator_desc axp809_regulators[] = {
AXP_DESC_SW
(
AXP809
,
SW
,
"sw"
,
"swin"
,
AXP22X_PWR_OUT_CTRL2
,
BIT
(
6
)),
AXP_DESC_SW
(
AXP809
,
SW
,
"sw"
,
"swin"
,
AXP22X_PWR_OUT_CTRL2
,
BIT
(
6
)),
};
};
static
const
struct
regulator_desc
axp813_regulators
[]
=
{
AXP_DESC
(
AXP813
,
DCDC1
,
"dcdc1"
,
"vin1"
,
1600
,
3400
,
100
,
AXP803_DCDC1_V_OUT
,
0x1f
,
AXP22X_PWR_OUT_CTRL1
,
BIT
(
0
)),
AXP_DESC_RANGES
(
AXP813
,
DCDC2
,
"dcdc2"
,
"vin2"
,
axp803_dcdc234_ranges
,
76
,
AXP803_DCDC2_V_OUT
,
0x7f
,
AXP22X_PWR_OUT_CTRL1
,
BIT
(
1
)),
AXP_DESC_RANGES
(
AXP813
,
DCDC3
,
"dcdc3"
,
"vin3"
,
axp803_dcdc234_ranges
,
76
,
AXP803_DCDC3_V_OUT
,
0x7f
,
AXP22X_PWR_OUT_CTRL1
,
BIT
(
2
)),
AXP_DESC_RANGES
(
AXP813
,
DCDC4
,
"dcdc4"
,
"vin4"
,
axp803_dcdc234_ranges
,
76
,
AXP803_DCDC4_V_OUT
,
0x7f
,
AXP22X_PWR_OUT_CTRL1
,
BIT
(
3
)),
AXP_DESC_RANGES
(
AXP813
,
DCDC5
,
"dcdc5"
,
"vin5"
,
axp803_dcdc5_ranges
,
68
,
AXP803_DCDC5_V_OUT
,
0x7f
,
AXP22X_PWR_OUT_CTRL1
,
BIT
(
4
)),
AXP_DESC_RANGES
(
AXP813
,
DCDC6
,
"dcdc6"
,
"vin6"
,
axp803_dcdc6_ranges
,
72
,
AXP803_DCDC6_V_OUT
,
0x7f
,
AXP22X_PWR_OUT_CTRL1
,
BIT
(
5
)),
AXP_DESC_RANGES
(
AXP813
,
DCDC7
,
"dcdc7"
,
"vin7"
,
axp803_dcdc6_ranges
,
72
,
AXP813_DCDC7_V_OUT
,
0x7f
,
AXP22X_PWR_OUT_CTRL1
,
BIT
(
6
)),
AXP_DESC
(
AXP813
,
ALDO1
,
"aldo1"
,
"aldoin"
,
700
,
3300
,
100
,
AXP22X_ALDO1_V_OUT
,
0x1f
,
AXP22X_PWR_OUT_CTRL3
,
BIT
(
5
)),
AXP_DESC
(
AXP813
,
ALDO2
,
"aldo2"
,
"aldoin"
,
700
,
3300
,
100
,
AXP22X_ALDO2_V_OUT
,
0x1f
,
AXP22X_PWR_OUT_CTRL3
,
BIT
(
6
)),
AXP_DESC
(
AXP813
,
ALDO3
,
"aldo3"
,
"aldoin"
,
700
,
3300
,
100
,
AXP22X_ALDO3_V_OUT
,
0x1f
,
AXP22X_PWR_OUT_CTRL3
,
BIT
(
7
)),
AXP_DESC
(
AXP813
,
DLDO1
,
"dldo1"
,
"dldoin"
,
700
,
3300
,
100
,
AXP22X_DLDO1_V_OUT
,
0x1f
,
AXP22X_PWR_OUT_CTRL2
,
BIT
(
3
)),
AXP_DESC_RANGES
(
AXP813
,
DLDO2
,
"dldo2"
,
"dldoin"
,
axp803_dldo2_ranges
,
32
,
AXP22X_DLDO2_V_OUT
,
0x1f
,
AXP22X_PWR_OUT_CTRL2
,
BIT
(
4
)),
AXP_DESC
(
AXP813
,
DLDO3
,
"dldo3"
,
"dldoin"
,
700
,
3300
,
100
,
AXP22X_DLDO3_V_OUT
,
0x1f
,
AXP22X_PWR_OUT_CTRL2
,
BIT
(
5
)),
AXP_DESC
(
AXP813
,
DLDO4
,
"dldo4"
,
"dldoin"
,
700
,
3300
,
100
,
AXP22X_DLDO4_V_OUT
,
0x1f
,
AXP22X_PWR_OUT_CTRL2
,
BIT
(
6
)),
AXP_DESC
(
AXP813
,
ELDO1
,
"eldo1"
,
"eldoin"
,
700
,
1900
,
50
,
AXP22X_ELDO1_V_OUT
,
0x1f
,
AXP22X_PWR_OUT_CTRL2
,
BIT
(
0
)),
AXP_DESC
(
AXP813
,
ELDO2
,
"eldo2"
,
"eldoin"
,
700
,
1900
,
50
,
AXP22X_ELDO2_V_OUT
,
0x1f
,
AXP22X_PWR_OUT_CTRL2
,
BIT
(
1
)),
AXP_DESC
(
AXP813
,
ELDO3
,
"eldo3"
,
"eldoin"
,
700
,
1900
,
50
,
AXP22X_ELDO3_V_OUT
,
0x1f
,
AXP22X_PWR_OUT_CTRL2
,
BIT
(
2
)),
/* to do / check ... */
AXP_DESC
(
AXP813
,
FLDO1
,
"fldo1"
,
"fldoin"
,
700
,
1450
,
50
,
AXP803_FLDO1_V_OUT
,
0x0f
,
AXP22X_PWR_OUT_CTRL3
,
BIT
(
2
)),
AXP_DESC
(
AXP813
,
FLDO2
,
"fldo2"
,
"fldoin"
,
700
,
1450
,
50
,
AXP803_FLDO2_V_OUT
,
0x0f
,
AXP22X_PWR_OUT_CTRL3
,
BIT
(
3
)),
/*
* TODO: FLDO3 = {DCDC5, FLDOIN} / 2
*
* This means FLDO3 effectively switches supplies at runtime,
* something the regulator subsystem does not support.
*/
AXP_DESC_FIXED
(
AXP813
,
RTC_LDO
,
"rtc-ldo"
,
"ips"
,
1800
),
AXP_DESC_IO
(
AXP813
,
LDO_IO0
,
"ldo-io0"
,
"ips"
,
700
,
3300
,
100
,
AXP22X_LDO_IO0_V_OUT
,
0x1f
,
AXP20X_GPIO0_CTRL
,
0x07
,
AXP22X_IO_ENABLED
,
AXP22X_IO_DISABLED
),
AXP_DESC_IO
(
AXP813
,
LDO_IO1
,
"ldo-io1"
,
"ips"
,
700
,
3300
,
100
,
AXP22X_LDO_IO1_V_OUT
,
0x1f
,
AXP20X_GPIO1_CTRL
,
0x07
,
AXP22X_IO_ENABLED
,
AXP22X_IO_DISABLED
),
AXP_DESC_SW
(
AXP813
,
SW
,
"sw"
,
"swin"
,
AXP22X_PWR_OUT_CTRL2
,
BIT
(
7
)),
};
static
int
axp20x_set_dcdc_freq
(
struct
platform_device
*
pdev
,
u32
dcdcfreq
)
static
int
axp20x_set_dcdc_freq
(
struct
platform_device
*
pdev
,
u32
dcdcfreq
)
{
{
struct
axp20x_dev
*
axp20x
=
dev_get_drvdata
(
pdev
->
dev
.
parent
);
struct
axp20x_dev
*
axp20x
=
dev_get_drvdata
(
pdev
->
dev
.
parent
);
...
@@ -441,9 +505,10 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
...
@@ -441,9 +505,10 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
step
=
75
;
step
=
75
;
break
;
break
;
case
AXP803_ID
:
case
AXP803_ID
:
case
AXP813_ID
:
/*
/*
* AXP803
DCDC work frequency setting has the same range and
* AXP803
/AXP813 DCDC work frequency setting has the same
* step as AXP22X, but at a different register.
*
range and
step as AXP22X, but at a different register.
* Fall through to the check below.
* Fall through to the check below.
* (See include/linux/mfd/axp20x.h)
* (See include/linux/mfd/axp20x.h)
*/
*/
...
@@ -561,6 +626,14 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 work
...
@@ -561,6 +626,14 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 work
workmode
<<=
id
-
AXP803_DCDC1
;
workmode
<<=
id
-
AXP803_DCDC1
;
break
;
break
;
case
AXP813_ID
:
if
(
id
<
AXP813_DCDC1
||
id
>
AXP813_DCDC7
)
return
-
EINVAL
;
mask
=
AXP22X_WORKMODE_DCDCX_MASK
(
id
-
AXP813_DCDC1
);
workmode
<<=
id
-
AXP813_DCDC1
;
break
;
default:
default:
/* should not happen */
/* should not happen */
WARN_ON
(
1
);
WARN_ON
(
1
);
...
@@ -579,11 +652,12 @@ static bool axp20x_is_polyphase_slave(struct axp20x_dev *axp20x, int id)
...
@@ -579,11 +652,12 @@ static bool axp20x_is_polyphase_slave(struct axp20x_dev *axp20x, int id)
u32
reg
=
0
;
u32
reg
=
0
;
/*
/*
* Currently in our supported AXP variants, only AXP803
and AXP806
* Currently in our supported AXP variants, only AXP803
, AXP806,
* have polyphase regulators.
*
and AXP813
have polyphase regulators.
*/
*/
switch
(
axp20x
->
variant
)
{
switch
(
axp20x
->
variant
)
{
case
AXP803_ID
:
case
AXP803_ID
:
case
AXP813_ID
:
regmap_read
(
axp20x
->
regmap
,
AXP803_POLYPHASE_CTRL
,
&
reg
);
regmap_read
(
axp20x
->
regmap
,
AXP803_POLYPHASE_CTRL
,
&
reg
);
switch
(
id
)
{
switch
(
id
)
{
...
@@ -656,6 +730,12 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
...
@@ -656,6 +730,12 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
regulators
=
axp809_regulators
;
regulators
=
axp809_regulators
;
nregulators
=
AXP809_REG_ID_MAX
;
nregulators
=
AXP809_REG_ID_MAX
;
break
;
break
;
case
AXP813_ID
:
regulators
=
axp813_regulators
;
nregulators
=
AXP813_REG_ID_MAX
;
drivevbus
=
of_property_read_bool
(
pdev
->
dev
.
parent
->
of_node
,
"x-powers,drive-vbus-en"
);
break
;
default:
default:
dev_err
(
&
pdev
->
dev
,
"Unsupported AXP variant: %ld
\n
"
,
dev_err
(
&
pdev
->
dev
,
"Unsupported AXP variant: %ld
\n
"
,
axp20x
->
variant
);
axp20x
->
variant
);
...
@@ -677,6 +757,10 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
...
@@ -677,6 +757,10 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
if
(
axp20x_is_polyphase_slave
(
axp20x
,
i
))
if
(
axp20x_is_polyphase_slave
(
axp20x
,
i
))
continue
;
continue
;
/* Support for AXP813's FLDO3 is not implemented */
if
(
axp20x
->
variant
==
AXP813_ID
&&
i
==
AXP813_FLDO3
)
continue
;
/*
/*
* Regulators DC1SW and DC5LDO are connected internally,
* Regulators DC1SW and DC5LDO are connected internally,
* so we have to handle their supply names separately.
* so we have to handle their supply names separately.
...
...
include/linux/mfd/axp20x.h
View file @
28c426c7
...
@@ -131,6 +131,9 @@ enum axp20x_variants {
...
@@ -131,6 +131,9 @@ enum axp20x_variants {
#define AXP803_DCDC6_V_OUT 0x25
#define AXP803_DCDC6_V_OUT 0x25
#define AXP803_DCDC_FREQ_CTRL 0x3b
#define AXP803_DCDC_FREQ_CTRL 0x3b
/* Other DCDC regulator control registers are the same as AXP803 */
#define AXP813_DCDC7_V_OUT 0x26
/* Interrupt */
/* Interrupt */
#define AXP152_IRQ1_EN 0x40
#define AXP152_IRQ1_EN 0x40
#define AXP152_IRQ2_EN 0x41
#define AXP152_IRQ2_EN 0x41
...
...
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