aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/regulator/Kconfig8
-rw-r--r--drivers/regulator/Makefile1
-rw-r--r--drivers/regulator/bcm590xx-regulator.c413
3 files changed, 422 insertions, 0 deletions
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 6a7932822e37..1169a42519d5 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -139,6 +139,14 @@ config REGULATOR_AS3722
139 AS3722 PMIC. This will enable support for all the software 139 AS3722 PMIC. This will enable support for all the software
140 controllable DCDC/LDO regulators. 140 controllable DCDC/LDO regulators.
141 141
142config REGULATOR_BCM590XX
143 tristate "Broadcom BCM590xx PMU Regulators"
144 depends on MFD_BCM590XX
145 help
146 This driver provides support for the voltage regulators on the
147 BCM590xx PMUs. This will enable support for the software
148 controllable LDO/Switching regulators.
149
142config REGULATOR_DA903X 150config REGULATOR_DA903X
143 tristate "Dialog Semiconductor DA9030/DA9034 regulators" 151 tristate "Dialog Semiconductor DA9030/DA9034 regulators"
144 depends on PMIC_DA903X 152 depends on PMIC_DA903X
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 979f9ddcf259..e1ab514f03c5 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -20,6 +20,7 @@ obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o
20obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o 20obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o
21obj-$(CONFIG_REGULATOR_AS3711) += as3711-regulator.o 21obj-$(CONFIG_REGULATOR_AS3711) += as3711-regulator.o
22obj-$(CONFIG_REGULATOR_AS3722) += as3722-regulator.o 22obj-$(CONFIG_REGULATOR_AS3722) += as3722-regulator.o
23obj-$(CONFIG_REGULATOR_BCM590XX) += bcm590xx-regulator.o
23obj-$(CONFIG_REGULATOR_DA903X) += da903x.o 24obj-$(CONFIG_REGULATOR_DA903X) += da903x.o
24obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o 25obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o
25obj-$(CONFIG_REGULATOR_DA9055) += da9055-regulator.o 26obj-$(CONFIG_REGULATOR_DA9055) += da9055-regulator.o
diff --git a/drivers/regulator/bcm590xx-regulator.c b/drivers/regulator/bcm590xx-regulator.c
new file mode 100644
index 000000000000..e6b2e8e08c41
--- /dev/null
+++ b/drivers/regulator/bcm590xx-regulator.c
@@ -0,0 +1,413 @@
1/*
2 * Broadcom BCM590xx regulator driver
3 *
4 * Copyright 2014 Linaro Limited
5 * Author: Matt Porter <mporter@linaro.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13#include <linux/err.h>
14#include <linux/init.h>
15#include <linux/kernel.h>
16#include <linux/mfd/bcm590xx.h>
17#include <linux/module.h>
18#include <linux/of.h>
19#include <linux/platform_device.h>
20#include <linux/regulator/driver.h>
21#include <linux/regulator/machine.h>
22#include <linux/regulator/of_regulator.h>
23#include <linux/slab.h>
24
25/* Register defs */
26#define BCM590XX_RFLDOPMCTRL1 0x60
27#define BCM590XX_IOSR1PMCTRL1 0x7a
28#define BCM590XX_IOSR2PMCTRL1 0x7c
29#define BCM590XX_CSRPMCTRL1 0x7e
30#define BCM590XX_SDSR1PMCTRL1 0x82
31#define BCM590XX_SDSR2PMCTRL1 0x86
32#define BCM590XX_MSRPMCTRL1 0x8a
33#define BCM590XX_VSRPMCTRL1 0x8e
34#define BCM590XX_REG_ENABLE BIT(7)
35
36#define BCM590XX_RFLDOCTRL 0x96
37#define BCM590XX_CSRVOUT1 0xc0
38#define BCM590XX_LDO_VSEL_MASK GENMASK(5, 3)
39#define BCM590XX_SR_VSEL_MASK GENMASK(5, 0)
40
41/* LDO regulator IDs */
42#define BCM590XX_REG_RFLDO 0
43#define BCM590XX_REG_CAMLDO1 1
44#define BCM590XX_REG_CAMLDO2 2
45#define BCM590XX_REG_SIMLDO1 3
46#define BCM590XX_REG_SIMLDO2 4
47#define BCM590XX_REG_SDLDO 5
48#define BCM590XX_REG_SDXLDO 6
49#define BCM590XX_REG_MMCLDO1 7
50#define BCM590XX_REG_MMCLDO2 8
51#define BCM590XX_REG_AUDLDO 9
52#define BCM590XX_REG_MICLDO 10
53#define BCM590XX_REG_USBLDO 11
54#define BCM590XX_REG_VIBLDO 12
55
56/* DCDC regulator IDs */
57#define BCM590XX_REG_CSR 13
58#define BCM590XX_REG_IOSR1 14
59#define BCM590XX_REG_IOSR2 15
60#define BCM590XX_REG_MSR 16
61#define BCM590XX_REG_SDSR1 17
62#define BCM590XX_REG_SDSR2 18
63#define BCM590XX_REG_VSR 19
64
65#define BCM590XX_NUM_REGS 20
66
67#define BCM590XX_REG_IS_LDO(n) (n < BCM590XX_REG_CSR)
68
69struct bcm590xx_board {
70 struct regulator_init_data *bcm590xx_pmu_init_data[BCM590XX_NUM_REGS];
71};
72
73/* LDO group A: supported voltages in microvolts */
74static const unsigned int ldo_a_table[] = {
75 1200000, 1800000, 2500000, 2700000, 2800000,
76 2900000, 3000000, 3300000,
77};
78
79/* LDO group C: supported voltages in microvolts */
80static const unsigned int ldo_c_table[] = {
81 3100000, 1800000, 2500000, 2700000, 2800000,
82 2900000, 3000000, 3300000,
83};
84
85/* DCDC group CSR: supported voltages in microvolts */
86static const struct regulator_linear_range dcdc_csr_ranges[] = {
87 REGULATOR_LINEAR_RANGE(860000, 2, 50, 10000),
88 REGULATOR_LINEAR_RANGE(1360000, 51, 55, 20000),
89 REGULATOR_LINEAR_RANGE(900000, 56, 63, 0),
90};
91
92/* DCDC group IOSR1: supported voltages in microvolts */
93static const struct regulator_linear_range dcdc_iosr1_ranges[] = {
94 REGULATOR_LINEAR_RANGE(860000, 2, 51, 10000),
95 REGULATOR_LINEAR_RANGE(1500000, 52, 52, 0),
96 REGULATOR_LINEAR_RANGE(1800000, 53, 53, 0),
97 REGULATOR_LINEAR_RANGE(900000, 54, 63, 0),
98};
99
100/* DCDC group SDSR1: supported voltages in microvolts */
101static const struct regulator_linear_range dcdc_sdsr1_ranges[] = {
102 REGULATOR_LINEAR_RANGE(860000, 2, 50, 10000),
103 REGULATOR_LINEAR_RANGE(1340000, 51, 51, 0),
104 REGULATOR_LINEAR_RANGE(900000, 52, 63, 0),
105};
106
107struct bcm590xx_info {
108 const char *name;
109 const char *vin_name;
110 u8 n_voltages;
111 const unsigned int *volt_table;
112 u8 n_linear_ranges;
113 const struct regulator_linear_range *linear_ranges;
114};
115
116#define BCM590XX_REG_TABLE(_name, _table) \
117 { \
118 .name = #_name, \
119 .n_voltages = ARRAY_SIZE(_table), \
120 .volt_table = _table, \
121 }
122
123#define BCM590XX_REG_RANGES(_name, _ranges) \
124 { \
125 .name = #_name, \
126 .n_linear_ranges = ARRAY_SIZE(_ranges), \
127 .linear_ranges = _ranges, \
128 }
129
130static struct bcm590xx_info bcm590xx_regs[] = {
131 BCM590XX_REG_TABLE(rfldo, ldo_a_table),
132 BCM590XX_REG_TABLE(camldo1, ldo_c_table),
133 BCM590XX_REG_TABLE(camldo2, ldo_c_table),
134 BCM590XX_REG_TABLE(simldo1, ldo_a_table),
135 BCM590XX_REG_TABLE(simldo2, ldo_a_table),
136 BCM590XX_REG_TABLE(sdldo, ldo_c_table),
137 BCM590XX_REG_TABLE(sdxldo, ldo_a_table),
138 BCM590XX_REG_TABLE(mmcldo1, ldo_a_table),
139 BCM590XX_REG_TABLE(mmcldo2, ldo_a_table),
140 BCM590XX_REG_TABLE(audldo, ldo_a_table),
141 BCM590XX_REG_TABLE(micldo, ldo_a_table),
142 BCM590XX_REG_TABLE(usbldo, ldo_a_table),
143 BCM590XX_REG_TABLE(vibldo, ldo_c_table),
144 BCM590XX_REG_RANGES(csr, dcdc_csr_ranges),
145 BCM590XX_REG_RANGES(iosr1, dcdc_iosr1_ranges),
146 BCM590XX_REG_RANGES(iosr2, dcdc_iosr1_ranges),
147 BCM590XX_REG_RANGES(msr, dcdc_iosr1_ranges),
148 BCM590XX_REG_RANGES(sdsr1, dcdc_sdsr1_ranges),
149 BCM590XX_REG_RANGES(sdsr2, dcdc_iosr1_ranges),
150 BCM590XX_REG_RANGES(vsr, dcdc_iosr1_ranges),
151};
152
153struct bcm590xx_reg {
154 struct regulator_desc *desc;
155 struct bcm590xx *mfd;
156 struct regulator_dev **rdev;
157 struct bcm590xx_info **info;
158};
159