Skip to content

Commit 56e3d92

Browse files
committed
Merge remote-tracking branches 'regulator/topic/gpio', 'regulator/topic/lp873x', 'regulator/topic/max77620', 'regulator/topic/pwm' and 'regulator/topic/tps6507x' into regulator-next
6 parents bed6972 + 09f2ba0 + 205321f + 9837792 + 53a2046 + e98d5fe commit 56e3d92

File tree

8 files changed

+78
-7
lines changed

8 files changed

+78
-7
lines changed

Documentation/devicetree/bindings/mfd/lp873x.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ Required properties:
77
- #gpio-cells: Should be two. The first cell is the pin number and
88
the second cell is used to specify flags.
99
See ../gpio/gpio.txt for more information.
10+
- xxx-in-supply: Phandle to parent supply node of each regulator
11+
populated under regulators node. xxx can be
12+
buck0, buck1, ldo0 or ldo1.
1013
- regulators: List of child nodes that specify the regulator
1114
initialization data.
1215
Example:
@@ -17,6 +20,11 @@ pmic: lp8733@60 {
1720
gpio-controller;
1821
#gpio-cells = <2>;
1922

23+
buck0-in-supply = <&vsys_3v3>;
24+
buck1-in-supply = <&vsys_3v3>;
25+
ldo0-in-supply = <&vsys_3v3>;
26+
ldo1-in-supply = <&vsys_3v3>;
27+
2028
regulators {
2129
lp8733_buck0: buck0 {
2230
regulator-name = "lp8733-buck0";

Documentation/devicetree/bindings/mfd/max77620.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,18 @@ Here supported time periods by device in microseconds are as follows:
106106
MAX77620 supports 40, 80, 160, 320, 640, 1280, 2560 and 5120 microseconds.
107107
MAX20024 supports 20, 40, 80, 160, 320, 640, 1280 and 2540 microseconds.
108108

109+
-maxim,power-ok-control: configure map power ok bit
110+
1: Enables POK(Power OK) to control nRST_IO and GPIO1
111+
POK function.
112+
0: Disables POK control.
113+
if property missing, do not configure MPOK bit.
114+
If POK mapping is enabled for GPIO1/nRST_IO then,
115+
GPIO1/nRST_IO pins are HIGH only if all rails
116+
that have POK control enabled are HIGH.
117+
If any of the rails goes down(which are enabled for POK
118+
control) then, GPIO1/nRST_IO goes LOW.
119+
this property is valid for max20024 only.
120+
109121
For DT binding details of different sub modules like GPIO, pincontrol,
110122
regulator, power, please refer respective device-tree binding document
111123
under their respective sub-system directories.

Documentation/devicetree/bindings/regulator/pwm-regulator.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Any property defined as part of the core regulator binding can also be used.
5959

6060
Continuous Voltage With Enable GPIO Example:
6161
pwm_regulator {
62-
compatible = "pwm-regulator;
62+
compatible = "pwm-regulator";
6363
pwms = <&pwm1 0 8448 0>;
6464
enable-gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>;
6565
regulator-min-microvolt = <1016000>;
@@ -76,7 +76,7 @@ Continuous Voltage With Enable GPIO Example:
7676

7777
Voltage Table Example:
7878
pwm_regulator {
79-
compatible = "pwm-regulator;
79+
compatible = "pwm-regulator";
8080
pwms = <&pwm1 0 8448 0>;
8181
regulator-min-microvolt = <1016000>;
8282
regulator-max-microvolt = <1114000>;

drivers/regulator/gpio-regulator.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np,
162162
of_property_read_u32(np, "startup-delay-us", &config->startup_delay);
163163

164164
config->enable_gpio = of_get_named_gpio(np, "enable-gpio", 0);
165-
if (config->enable_gpio == -EPROBE_DEFER)
166-
return ERR_PTR(-EPROBE_DEFER);
165+
if (config->enable_gpio < 0 && config->enable_gpio != -ENOENT)
166+
return ERR_PTR(config->enable_gpio);
167167

168168
/* Fetch GPIOs. - optional property*/
169169
ret = of_gpio_count(np);
@@ -190,8 +190,11 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np,
190190

191191
for (i = 0; i < config->nr_gpios; i++) {
192192
gpio = of_get_named_gpio(np, "gpios", i);
193-
if (gpio < 0)
193+
if (gpio < 0) {
194+
if (gpio != -ENOENT)
195+
return ERR_PTR(gpio);
194196
break;
197+
}
195198
config->gpios[i].gpio = gpio;
196199
if (proplen > 0) {
197200
of_property_read_u32_index(np, "gpios-states",

drivers/regulator/lp873x-regulator.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
[_id] = { \
2525
.desc = { \
2626
.name = _name, \
27+
.supply_name = _of "-in", \
2728
.id = _id, \
2829
.of_match = of_match_ptr(_of), \
2930
.regulators_node = of_match_ptr("regulators"),\

drivers/regulator/max77620-regulator.c

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@ struct max77620_regulator_info {
7373
};
7474

7575
struct max77620_regulator_pdata {
76-
struct regulator_init_data *reg_idata;
7776
int active_fps_src;
7877
int active_fps_pd_slot;
7978
int active_fps_pu_slot;
8079
int suspend_fps_src;
8180
int suspend_fps_pd_slot;
8281
int suspend_fps_pu_slot;
8382
int current_mode;
83+
int power_ok;
8484
int ramp_rate_setting;
8585
};
8686

@@ -351,11 +351,48 @@ static int max77620_set_slew_rate(struct max77620_regulator *pmic, int id,
351351
return 0;
352352
}
353353

354+
static int max77620_config_power_ok(struct max77620_regulator *pmic, int id)
355+
{
356+
struct max77620_regulator_pdata *rpdata = &pmic->reg_pdata[id];
357+
struct max77620_regulator_info *rinfo = pmic->rinfo[id];
358+
struct max77620_chip *chip = dev_get_drvdata(pmic->dev->parent);
359+
u8 val, mask;
360+
int ret;
361+
362+
switch (chip->chip_id) {
363+
case MAX20024:
364+
if (rpdata->power_ok >= 0) {
365+
if (rinfo->type == MAX77620_REGULATOR_TYPE_SD)
366+
mask = MAX20024_SD_CFG1_MPOK_MASK;
367+
else
368+
mask = MAX20024_LDO_CFG2_MPOK_MASK;
369+
370+
val = rpdata->power_ok ? mask : 0;
371+
372+
ret = regmap_update_bits(pmic->rmap, rinfo->cfg_addr,
373+
mask, val);
374+
if (ret < 0) {
375+
dev_err(pmic->dev, "Reg 0x%02x update failed %d\n",
376+
rinfo->cfg_addr, ret);
377+
return ret;
378+
}
379+
}
380+
break;
381+
382+
default:
383+
break;
384+
}
385+
386+
return 0;
387+
}
388+
354389
static int max77620_init_pmic(struct max77620_regulator *pmic, int id)
355390
{
356391
struct max77620_regulator_pdata *rpdata = &pmic->reg_pdata[id];
357392
int ret;
358393

394+
max77620_config_power_ok(pmic, id);
395+
359396
/* Update power mode */
360397
ret = max77620_regulator_get_power_mode(pmic, id);
361398
if (ret < 0)
@@ -595,6 +632,12 @@ static int max77620_of_parse_cb(struct device_node *np,
595632
np, "maxim,suspend-fps-power-down-slot", &pval);
596633
rpdata->suspend_fps_pd_slot = (!ret) ? pval : -1;
597634

635+
ret = of_property_read_u32(np, "maxim,power-ok-control", &pval);
636+
if (!ret)
637+
rpdata->power_ok = pval;
638+
else
639+
rpdata->power_ok = -1;
640+
598641
ret = of_property_read_u32(np, "maxim,ramp-rate-setting", &pval);
599642
rpdata->ramp_rate_setting = (!ret) ? pval : 0;
600643

@@ -807,6 +850,8 @@ static int max77620_regulator_resume(struct device *dev)
807850
for (id = 0; id < MAX77620_NUM_REGS; id++) {
808851
reg_pdata = &pmic->reg_pdata[id];
809852

853+
max77620_config_power_ok(pmic, id);
854+
810855
max77620_regulator_set_fps_slots(pmic, id, false);
811856
if (reg_pdata->active_fps_src < 0)
812857
continue;

drivers/regulator/tps6507x-regulator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ static struct tps6507x_board *tps6507x_parse_dt_reg_data(
375375
struct device_node *np = pdev->dev.parent->of_node;
376376
struct device_node *regulators;
377377
struct of_regulator_match *matches;
378-
static struct regulator_init_data *reg_data;
378+
struct regulator_init_data *reg_data;
379379
int idx = 0, count, ret;
380380

381381
tps_board = devm_kzalloc(&pdev->dev, sizeof(*tps_board),

include/linux/mfd/max77620.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,15 @@
180180
#define MAX77620_SD_CFG1_FPWM_SD_MASK BIT(2)
181181
#define MAX77620_SD_CFG1_FPWM_SD_SKIP 0
182182
#define MAX77620_SD_CFG1_FPWM_SD_FPWM BIT(2)
183+
#define MAX20024_SD_CFG1_MPOK_MASK BIT(1)
183184
#define MAX77620_SD_CFG1_FSRADE_SD_MASK BIT(0)
184185
#define MAX77620_SD_CFG1_FSRADE_SD_DISABLE 0
185186
#define MAX77620_SD_CFG1_FSRADE_SD_ENABLE BIT(0)
186187

187188
/* LDO_CNFG2 */
188189
#define MAX77620_LDO_POWER_MODE_MASK 0xC0
189190
#define MAX77620_LDO_POWER_MODE_SHIFT 6
191+
#define MAX20024_LDO_CFG2_MPOK_MASK BIT(2)
190192
#define MAX77620_LDO_CFG2_ADE_MASK BIT(1)
191193
#define MAX77620_LDO_CFG2_ADE_DISABLE 0
192194
#define MAX77620_LDO_CFG2_ADE_ENABLE BIT(1)

0 commit comments

Comments
 (0)