Skip to content

Commit e2ae6e1

Browse files
committed
Merge tag 'regulator-v6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator updates from Mark Brown: "This has been a very quiet release, we've got support for one device added, another removed, and some smaller fixes and API improvements. The main thing of note is the rework of the PCA9450 LDO5 handling. - A rework of the handling of LDO5 on the PCA9450, this was quite wrong in how it handled the SD_VSEL conrol and only worked for some system designs. This includes a DTS update since there was a not quite ABI compatible change as part of the fix - A devres change introducing devm_kmemdup_array() was pulled in so it could be used with some regulator conversions to that function, this pulled in some other devres and IIO stuff that was part of the same pull request - Removal of the PCF50633 driver, the SoC for the OpenMoko platform that used it has been removed - Support for the NXP PF9453" * tag 'regulator-v6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (24 commits) regulator: axp20x: AXP717: dcdc4 doesn't have delay regulator: dt-bindings: rtq2208: Cleanup whitespace regulator: dt-bindings: rtq2208: Mark fixed LDO VOUT property as deprecated regulator: rtq6752: make const read-only array fault_mask static regulator: pf9453: add PMIC PF9453 support regulator: dt-bindings: pca9450: Add nxp,pf9453 compatible string regulator: pcf50633-regulator: Remove regulator: pca9450: Handle hardware with fixed SD_VSEL for LDO5 regulator: cros-ec: use devm_kmemdup_array() regulator: devres: use devm_kmemdup_array() regulator: Add (devm_)of_regulator_get() devres: Introduce devm_kmemdup_array() iio: imu: st_lsm9ds0: Replace device.h with what is needed driver core: Split devres APIs to device/devres.h err.h: move IOMEM_ERR_PTR() to err.h regulator: pca9450: Remove duplicate code in probe regulator: ad5398: Fix incorrect power down bit mask regulator: pca9450: Fix enable register for LDO5 regulator: pca9450: Fix control register for LDO5 Revert "regulator: pca9450: Add SD_VSEL GPIO for LDO5" ...
2 parents ee6740f + c94764d commit e2ae6e1

File tree

21 files changed

+1221
-304
lines changed

21 files changed

+1221
-304
lines changed

Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ description: |
1717
Datasheet is available at
1818
https://www.nxp.com/docs/en/data-sheet/PCA9450DS.pdf
1919
20+
Support PF9453, Datasheet is available at
21+
https://www.nxp.com/docs/en/data-sheet/PF9453_SDS.pdf
22+
2023
# The valid names for PCA9450 regulator nodes are:
2124
# BUCK1, BUCK2, BUCK3, BUCK4, BUCK5, BUCK6,
2225
# LDO1, LDO2, LDO3, LDO4, LDO5
@@ -30,6 +33,7 @@ properties:
3033
- nxp,pca9450c
3134
- nxp,pca9451a
3235
- nxp,pca9452
36+
- nxp,pf9453
3337

3438
reg:
3539
maxItems: 1
@@ -42,8 +46,30 @@ properties:
4246
description: |
4347
list of regulators provided by this controller
4448
49+
properties:
50+
LDO5:
51+
type: object
52+
$ref: regulator.yaml#
53+
description:
54+
Properties for single LDO5 regulator.
55+
56+
properties:
57+
nxp,sd-vsel-fixed-low:
58+
type: boolean
59+
description:
60+
Let the driver know that SD_VSEL is hardwired to low level and
61+
there is no GPIO to get the actual value from.
62+
63+
sd-vsel-gpios:
64+
description:
65+
GPIO that can be used to read the current status of the SD_VSEL
66+
signal in order for the driver to know if LDO5CTRL_L or LDO5CTRL_H
67+
is used by the hardware.
68+
69+
unevaluatedProperties: false
70+
4571
patternProperties:
46-
"^LDO[1-5]$":
72+
"^LDO([1-4]|-SNVS)$":
4773
type: object
4874
$ref: regulator.yaml#
4975
description:
@@ -78,11 +104,6 @@ properties:
78104

79105
additionalProperties: false
80106

81-
sd-vsel-gpios:
82-
description: GPIO that is used to switch LDO5 between being configured by
83-
LDO5CTRL_L or LDO5CTRL_H register. Use this if the SD_VSEL signal is
84-
connected to a host GPIO.
85-
86107
nxp,i2c-lt-enable:
87108
type: boolean
88109
description:
@@ -101,6 +122,24 @@ required:
101122

102123
additionalProperties: false
103124

125+
allOf:
126+
- if:
127+
properties:
128+
compatible:
129+
contains:
130+
const: nxp,pf9453
131+
then:
132+
properties:
133+
regulators:
134+
patternProperties:
135+
"^LDO[3-4]$": false
136+
"^BUCK[5-6]$": false
137+
else:
138+
properties:
139+
regulators:
140+
properties:
141+
LDO-SNVS: false
142+
104143
examples:
105144
- |
106145
#include <dt-bindings/interrupt-controller/irq.h>

Documentation/devicetree/bindings/regulator/richtek,rtq2208.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ properties:
3939

4040
interrupts:
4141
maxItems: 1
42-
42+
4343
richtek,mtp-sel-high:
4444
type: boolean
4545
description:
@@ -77,6 +77,7 @@ properties:
7777

7878
properties:
7979
richtek,fixed-microvolt:
80+
deprecated: true
8081
description: |
8182
This property can be used to set a fixed operating voltage that lies outside
8283
the range of the regulator's adjustable mode.

arch/arm64/boot/dts/freescale/imx8mp-skov-reva.dtsi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@
232232
pinctrl-names = "default";
233233
pinctrl-0 = <&pinctrl_pmic>;
234234
interrupts-extended = <&gpio1 3 IRQ_TYPE_EDGE_RISING>;
235-
sd-vsel-gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>;
236235

237236
regulators {
238237
reg_vdd_soc: BUCK1 {
@@ -555,7 +554,6 @@
555554
pinctrl_pmic: pmicirqgrp {
556555
fsl,pins = <
557556
MX8MP_IOMUXC_GPIO1_IO03__GPIO1_IO03 0x41
558-
MX8MP_IOMUXC_GPIO1_IO04__GPIO1_IO04 0x41
559557
>;
560558
};
561559

@@ -623,6 +621,7 @@
623621
MX8MP_IOMUXC_SD2_DATA1__USDHC2_DATA1 0x1d0
624622
MX8MP_IOMUXC_SD2_DATA2__USDHC2_DATA2 0x1d0
625623
MX8MP_IOMUXC_SD2_DATA3__USDHC2_DATA3 0x1d0
624+
MX8MP_IOMUXC_GPIO1_IO04__USDHC2_VSELECT 0xc0
626625
>;
627626
};
628627

@@ -634,6 +633,7 @@
634633
MX8MP_IOMUXC_SD2_DATA1__USDHC2_DATA1 0x1d4
635634
MX8MP_IOMUXC_SD2_DATA2__USDHC2_DATA2 0x1d4
636635
MX8MP_IOMUXC_SD2_DATA3__USDHC2_DATA3 0x1d4
636+
MX8MP_IOMUXC_GPIO1_IO04__USDHC2_VSELECT 0xc0
637637
>;
638638
};
639639

@@ -645,6 +645,7 @@
645645
MX8MP_IOMUXC_SD2_DATA1__USDHC2_DATA1 0x1d6
646646
MX8MP_IOMUXC_SD2_DATA2__USDHC2_DATA2 0x1d6
647647
MX8MP_IOMUXC_SD2_DATA3__USDHC2_DATA3 0x1d6
648+
MX8MP_IOMUXC_GPIO1_IO04__USDHC2_VSELECT 0xc0
648649
>;
649650
};
650651

drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
88
*/
99

10-
#include <linux/device.h>
10+
#include <linux/device/devres.h>
1111
#include <linux/err.h>
1212
#include <linux/gfp_types.h>
1313
#include <linux/i2c.h>

drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
88
*/
99

10-
#include <linux/device.h>
10+
#include <linux/device/devres.h>
1111
#include <linux/err.h>
1212
#include <linux/gfp_types.h>
1313
#include <linux/module.h>

drivers/regulator/Kconfig

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -981,20 +981,20 @@ config REGULATOR_PCA9450
981981
Say y here to support the NXP PCA9450A/PCA9450B/PCA9450C PMIC
982982
regulator driver.
983983

984+
config REGULATOR_PF9453
985+
tristate "NXP PF9453 regulator driver"
986+
depends on I2C
987+
select REGMAP_I2C
988+
help
989+
Say y here to support the NXP PF9453 PMIC regulator driver.
990+
984991
config REGULATOR_PCAP
985992
tristate "Motorola PCAP2 regulator driver"
986993
depends on EZX_PCAP
987994
help
988995
This driver provides support for the voltage regulators of the
989996
PCAP2 PMIC.
990997

991-
config REGULATOR_PCF50633
992-
tristate "NXP PCF50633 regulator driver"
993-
depends on MFD_PCF50633
994-
help
995-
Say Y here to support the voltage regulators and converters
996-
on PCF50633
997-
998998
config REGULATOR_PF8X00
999999
tristate "NXP PF8100/PF8121A/PF8200 regulator driver"
10001000
depends on I2C && OF

drivers/regulator/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ obj-$(CONFIG_REGULATOR_QCOM_SPMI) += qcom_spmi-regulator.o
123123
obj-$(CONFIG_REGULATOR_QCOM_USB_VBUS) += qcom_usb_vbus-regulator.o
124124
obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o
125125
obj-$(CONFIG_REGULATOR_PCA9450) += pca9450-regulator.o
126+
obj-$(CONFIG_REGULATOR_PF9453) += pf9453-regulator.o
126127
obj-$(CONFIG_REGULATOR_PF8X00) += pf8x00-regulator.o
127128
obj-$(CONFIG_REGULATOR_PFUZE100) += pfuze100-regulator.o
128129
obj-$(CONFIG_REGULATOR_PV88060) += pv88060-regulator.o
@@ -132,7 +133,6 @@ obj-$(CONFIG_REGULATOR_PWM) += pwm-regulator.o
132133
obj-$(CONFIG_REGULATOR_TPS51632) += tps51632-regulator.o
133134
obj-$(CONFIG_REGULATOR_PBIAS) += pbias-regulator.o
134135
obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o
135-
obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o
136136
obj-$(CONFIG_REGULATOR_RAA215300) += raa215300.o
137137
obj-$(CONFIG_REGULATOR_RASPBERRYPI_TOUCHSCREEN_ATTINY) += rpi-panel-attiny-regulator.o
138138
obj-$(CONFIG_REGULATOR_RC5T583) += rc5t583-regulator.o

drivers/regulator/ad5398.c

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
#include <linux/platform_device.h>
1515
#include <linux/regulator/driver.h>
1616
#include <linux/regulator/machine.h>
17+
#include <linux/regulator/of_regulator.h>
1718

18-
#define AD5398_CURRENT_EN_MASK 0x8000
19+
#define AD5398_SW_POWER_DOWN BIT(15)
1920

2021
struct ad5398_chip_info {
2122
struct i2c_client *client;
@@ -113,7 +114,7 @@ static int ad5398_set_current_limit(struct regulator_dev *rdev, int min_uA, int
113114

114115
/* prepare register data */
115116
selector = (selector << chip->current_offset) & chip->current_mask;
116-
data = (unsigned short)selector | (data & AD5398_CURRENT_EN_MASK);
117+
data = (unsigned short)selector | (data & AD5398_SW_POWER_DOWN);
117118

118119
/* write the new current value back as well as enable bit */
119120
ret = ad5398_write_reg(client, data);
@@ -132,10 +133,10 @@ static int ad5398_is_enabled(struct regulator_dev *rdev)
132133
if (ret < 0)
133134
return ret;
134135

135-
if (data & AD5398_CURRENT_EN_MASK)
136-
return 1;
137-
else
136+
if (data & AD5398_SW_POWER_DOWN)
138137
return 0;
138+
else
139+
return 1;
139140
}
140141

141142
static int ad5398_enable(struct regulator_dev *rdev)
@@ -149,10 +150,10 @@ static int ad5398_enable(struct regulator_dev *rdev)
149150
if (ret < 0)
150151
return ret;
151152

152-
if (data & AD5398_CURRENT_EN_MASK)
153+
if (!(data & AD5398_SW_POWER_DOWN))
153154
return 0;
154155

155-
data |= AD5398_CURRENT_EN_MASK;
156+
data &= ~AD5398_SW_POWER_DOWN;
156157

157158
ret = ad5398_write_reg(client, data);
158159

@@ -170,10 +171,10 @@ static int ad5398_disable(struct regulator_dev *rdev)
170171
if (ret < 0)
171172
return ret;
172173

173-
if (!(data & AD5398_CURRENT_EN_MASK))
174+
if (data & AD5398_SW_POWER_DOWN)
174175
return 0;
175176

176-
data &= ~AD5398_CURRENT_EN_MASK;
177+
data |= AD5398_SW_POWER_DOWN;
177178

178179
ret = ad5398_write_reg(client, data);
179180

@@ -221,15 +222,20 @@ static int ad5398_probe(struct i2c_client *client)
221222
const struct ad5398_current_data_format *df =
222223
(struct ad5398_current_data_format *)id->driver_data;
223224

224-
if (!init_data)
225-
return -EINVAL;
226-
227225
chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
228226
if (!chip)
229227
return -ENOMEM;
230228

231229
config.dev = &client->dev;
230+
if (client->dev.of_node)
231+
init_data = of_get_regulator_init_data(&client->dev,
232+
client->dev.of_node,
233+
&ad5398_reg);
234+
if (!init_data)
235+
return -EINVAL;
236+
232237
config.init_data = init_data;
238+
config.of_node = client->dev.of_node;
233239
config.driver_data = chip;
234240

235241
chip->client = client;

drivers/regulator/axp20x-regulator.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,8 @@
371371
.ops = &axp20x_ops, \
372372
}
373373

374-
#define AXP_DESC_DELAY(_family, _id, _match, _supply, _min, _max, _step, _vreg, \
375-
_vmask, _ereg, _emask, _ramp_delay) \
374+
#define AXP_DESC(_family, _id, _match, _supply, _min, _max, _step, _vreg, \
375+
_vmask, _ereg, _emask) \
376376
[_family##_##_id] = { \
377377
.name = (_match), \
378378
.supply_name = (_supply), \
@@ -388,15 +388,9 @@
388388
.vsel_mask = (_vmask), \
389389
.enable_reg = (_ereg), \
390390
.enable_mask = (_emask), \
391-
.ramp_delay = (_ramp_delay), \
392391
.ops = &axp20x_ops, \
393392
}
394393

395-
#define AXP_DESC(_family, _id, _match, _supply, _min, _max, _step, _vreg, \
396-
_vmask, _ereg, _emask) \
397-
AXP_DESC_DELAY(_family, _id, _match, _supply, _min, _max, _step, _vreg, \
398-
_vmask, _ereg, _emask, 0)
399-
400394
#define AXP_DESC_SW(_family, _id, _match, _supply, _ereg, _emask) \
401395
[_family##_##_id] = { \
402396
.name = (_match), \
@@ -805,9 +799,9 @@ static const struct regulator_desc axp717_regulators[] = {
805799
axp717_dcdc3_ranges, AXP717_DCDC3_NUM_VOLTAGES,
806800
AXP717_DCDC3_CONTROL, AXP717_DCDC_V_OUT_MASK,
807801
AXP717_DCDC_OUTPUT_CONTROL, BIT(2), 640),
808-
AXP_DESC_DELAY(AXP717, DCDC4, "dcdc4", "vin4", 1000, 3700, 100,
802+
AXP_DESC(AXP717, DCDC4, "dcdc4", "vin4", 1000, 3700, 100,
809803
AXP717_DCDC4_CONTROL, AXP717_DCDC_V_OUT_MASK,
810-
AXP717_DCDC_OUTPUT_CONTROL, BIT(3), 6400),
804+
AXP717_DCDC_OUTPUT_CONTROL, BIT(3)),
811805
AXP_DESC(AXP717, ALDO1, "aldo1", "aldoin", 500, 3500, 100,
812806
AXP717_ALDO1_CONTROL, AXP717_LDO_V_OUT_MASK,
813807
AXP717_LDO0_OUTPUT_CONTROL, BIT(0)),

drivers/regulator/cros-ec-regulator.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ static int cros_ec_regulator_init_info(struct device *dev,
138138
data->num_voltages =
139139
min_t(u16, ARRAY_SIZE(resp.voltages_mv), resp.num_voltages);
140140
data->voltages_mV =
141-
devm_kmemdup(dev, resp.voltages_mv,
142-
sizeof(u16) * data->num_voltages, GFP_KERNEL);
141+
devm_kmemdup_array(dev, resp.voltages_mv, data->num_voltages,
142+
sizeof(resp.voltages_mv[0]), GFP_KERNEL);
143143
if (!data->voltages_mV)
144144
return -ENOMEM;
145145

0 commit comments

Comments
 (0)