Skip to content

Commit

Permalink
Merge tag 'regulator-v4.14' of git://git.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/broonie/regulator

Pull regulator updates from Mark Brown:
 "This is an extremely quiet release for the regulator subsystem, it's
  all fairly minor fixes and cleanups plus a few new drivers and ddevice
  ID additions:

   - Support for MediaTek MT6380, Ricoh RC5T619 and ST Voltage Reference
     Buffers"

* tag 'regulator-v4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (24 commits)
  regulator: Add support for stm32-vrefbuf
  regulator: Add STM32 Voltage Reference Buffer
  regulator: pv88090: Exception handling for out of bounds
  regulator: da9063: Return an error code on probe failure
  regulator: rn5t618: add RC5T619 PMIC support
  regulator: ltc3589: constify i2c_device_id
  regulator: fan53555: fix I2C device ids
  regulator: add fixes with MT6397 dt-bindings shouldn't reference driver
  regulator: add fixes with MT6323 dt-bindings shouldn't reference driver
  regulator: add fixes with MT6311 dt-bindings shouldn't reference driver
  regulator: Add document for MediaTek MT6380 regulator
  regulator: mt6380: Add support for MT6380
  regulator: pwm-regulator: Remove unneeded gpiod NULL check
  regulator: core: fix a possible race in disable_work handling
  regulator: fan53555: Use of_device_get_match_data() to simplify probe
  regulator: of: regulator_of_get_init_data() missing of_node_get()
  regulator: pwm-regulator: fix example syntax
  regulator: Convert to using %pOF instead of full_name
  regulator: cpcap: Add OF mode mapping
  regulator: cpcap: Fix standby mode
  ...
  • Loading branch information
Linus Torvalds committed Sep 5, 2017
2 parents b88f557 + 00ee929 commit fe9e313
Show file tree
Hide file tree
Showing 28 changed files with 835 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Mediatek MT6311 Regulator Driver
Mediatek MT6311 Regulator

Required properties:
- compatible: "mediatek,mt6311-regulator"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Mediatek MT6323 Regulator Driver
Mediatek MT6323 Regulator

All voltage regulators are defined as subnodes of the regulators node. A list
of regulators provided by this controller are defined as subnodes of the
Expand Down
89 changes: 89 additions & 0 deletions Documentation/devicetree/bindings/regulator/mt6380-regulator.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
MediaTek MT6380 Regulator

All voltage regulators provided by the MT6380 PMIC are described as the
subnodes of the MT6380 regulators node. Each regulator is named according
to its regulator type, buck-<name> and ldo-<name>. The definition for each
of these nodes is defined using the standard binding for regulators at
Documentation/devicetree/bindings/regulator/regulator.txt.

The valid names for regulators are:
BUCK:
buck-core1, buck-vcore, buck-vrf
LDO:
ldo-vm ,ldo-va , ldo-vphy, ldo-vddr, ldo-vt

Example:

regulators {
compatible = "mediatek,mt6380-regulator";

mt6380_vcpu_reg: buck-vcore1 {
regulator-name = "vcore1";
regulator-min-microvolt = < 600000>;
regulator-max-microvolt = <1393750>;
regulator-ramp-delay = <6250>;
regulator-always-on;
regulator-boot-on;
};

mt6380_vcore_reg: buck-vcore {
regulator-name = "vcore";
regulator-min-microvolt = <600000>;
regulator-max-microvolt = <1393750>;
regulator-ramp-delay = <6250>;
};

mt6380_vrf_reg: buck-vrf {
regulator-name = "vrf";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <1575000>;
regulator-ramp-delay = <0>;
regulator-always-on;
regulator-boot-on;
};

mt6380_vm_reg: ldo-vm {
regulator-name = "vm";
regulator-min-microvolt = <1050000>;
regulator-max-microvolt = <1400000>;
regulator-ramp-delay = <0>;
regulator-always-on;
regulator-boot-on;
};

mt6380_va_reg: ldo-va {
regulator-name = "va";
regulator-min-microvolt = <2200000>;
regulator-max-microvolt = <3300000>;
regulator-ramp-delay = <0>;
regulator-always-on;
regulator-boot-on;
};

mt6380_vphy_reg: ldo-vphy {
regulator-name = "vphy";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-ramp-delay = <0>;
regulator-always-on;
regulator-boot-on;
};

mt6380_vddr_reg: ldo-vddr {
regulator-name = "vddr";
regulator-min-microvolt = <1240000>;
regulator-max-microvolt = <1840000>;
regulator-ramp-delay = <0>;
regulator-always-on;
regulator-boot-on;
};

mt6380_vt_reg: ldo-vt {
regulator-name = "vt";
regulator-min-microvolt = <2200000>;
regulator-max-microvolt = <3300000>;
regulator-ramp-delay = <0>;
regulator-always-on;
regulator-boot-on;
};
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Mediatek MT6397 Regulator Driver
Mediatek MT6397 Regulator

Required properties:
- compatible: "mediatek,mt6397-regulator"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Continuous Voltage With Enable GPIO Example:
* Inverted PWM logic, and the duty cycle range is limited
* to 30%-70%.
*/
pwm-dutycycle-range <700 300>; /* */
pwm-dutycycle-range = <700 300>; /* */
};

Voltage Table Example:
Expand Down
20 changes: 20 additions & 0 deletions Documentation/devicetree/bindings/regulator/st,stm32-vrefbuf.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
STM32 VREFBUF - Voltage reference buffer

Some STM32 devices embed a voltage reference buffer which can be used as
voltage reference for ADCs, DACs and also as voltage reference for external
components through the dedicated VREF+ pin.

Required properties:
- compatible: Must be "st,stm32-vrefbuf".
- reg: Offset and length of VREFBUF register set.
- clocks: Must contain an entry for peripheral clock.

Example:
vrefbuf: regulator@58003C00 {
compatible = "st,stm32-vrefbuf";
reg = <0x58003C00 0x8>;
clocks = <&rcc VREF_CK>;
regulator-min-microvolt = <1500000>;
regulator-max-microvolt = <2500000>;
vdda-supply = <&vdda>;
};
25 changes: 23 additions & 2 deletions drivers/regulator/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,15 @@ config REGULATOR_MT6323
This driver supports the control of different power rails of device
through regulator interface.

config REGULATOR_MT6380
tristate "MediaTek MT6380 PMIC"
depends on MTK_PMIC_WRAP
help
Say y here to select this option to enable the power regulator of
MediaTek MT6380 PMIC.
This driver supports the control of different power rails of device
through regulator interface.

config REGULATOR_MT6397
tristate "MediaTek MT6397 PMIC"
depends on MFD_MT6397
Expand Down Expand Up @@ -700,8 +709,8 @@ config REGULATOR_RN5T618
tristate "Ricoh RN5T567/618 voltage regulators"
depends on MFD_RN5T618
help
Say y here to support the regulators found on Ricoh RN5T567 or
RN5T618 PMIC.
Say y here to support the regulators found on Ricoh RN5T567,
RN5T618 or RC5T619 PMIC.

config REGULATOR_RT5033
tristate "Richtek RT5033 Regulators"
Expand Down Expand Up @@ -746,6 +755,18 @@ config REGULATOR_SKY81452
This driver can also be built as a module. If so, the module
will be called sky81452-regulator.

config REGULATOR_STM32_VREFBUF
tristate "STMicroelectronics STM32 VREFBUF"
depends on ARCH_STM32 || COMPILE_TEST
help
This driver supports STMicroelectronics STM32 VREFBUF (voltage
reference buffer) which can be used as voltage reference for
internal ADCs, DACs and also for external components through
dedicated Vref+ pin.

This driver can also be built as a module. If so, the module
will be called stm32-vrefbuf.

config REGULATOR_TI_ABB
tristate "TI Adaptive Body Bias on-chip LDO"
depends on ARCH_OMAP
Expand Down
2 changes: 2 additions & 0 deletions drivers/regulator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ obj-$(CONFIG_REGULATOR_MC13892) += mc13892-regulator.o
obj-$(CONFIG_REGULATOR_MC13XXX_CORE) += mc13xxx-regulator-core.o
obj-$(CONFIG_REGULATOR_MT6311) += mt6311-regulator.o
obj-$(CONFIG_REGULATOR_MT6323) += mt6323-regulator.o
obj-$(CONFIG_REGULATOR_MT6380) += mt6380-regulator.o
obj-$(CONFIG_REGULATOR_MT6397) += mt6397-regulator.o
obj-$(CONFIG_REGULATOR_QCOM_RPM) += qcom_rpm-regulator.o
obj-$(CONFIG_REGULATOR_QCOM_SMD_RPM) += qcom_smd-regulator.o
Expand All @@ -94,6 +95,7 @@ obj-$(CONFIG_REGULATOR_S2MPA01) += s2mpa01.o
obj-$(CONFIG_REGULATOR_S2MPS11) += s2mps11.o
obj-$(CONFIG_REGULATOR_S5M8767) += s5m8767.o
obj-$(CONFIG_REGULATOR_SKY81452) += sky81452-regulator.o
obj-$(CONFIG_REGULATOR_STM32_VREFBUF) += stm32-vrefbuf.o
obj-$(CONFIG_REGULATOR_STW481X_VMMC) += stw481x-vmmc.o
obj-$(CONFIG_REGULATOR_TI_ABB) += ti-abb-regulator.o
obj-$(CONFIG_REGULATOR_TPS6105X) += tps6105x-regulator.o
Expand Down
6 changes: 6 additions & 0 deletions drivers/regulator/axp20x-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,9 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
(regulators == axp809_regulators && i == AXP809_DC1SW)) {
new_desc = devm_kzalloc(&pdev->dev, sizeof(*desc),
GFP_KERNEL);
if (!new_desc)
return -ENOMEM;

*new_desc = regulators[i];
new_desc->supply_name = dcdc1_name;
desc = new_desc;
Expand All @@ -700,6 +703,9 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
(regulators == axp809_regulators && i == AXP809_DC5LDO)) {
new_desc = devm_kzalloc(&pdev->dev, sizeof(*desc),
GFP_KERNEL);
if (!new_desc)
return -ENOMEM;

*new_desc = regulators[i];
new_desc->supply_name = dcdc5_name;
desc = new_desc;
Expand Down
16 changes: 12 additions & 4 deletions drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ static struct device_node *of_get_regulator(struct device *dev, const char *supp
regnode = of_parse_phandle(dev->of_node, prop_name, 0);

if (!regnode) {
dev_dbg(dev, "Looking up %s property in node %s failed\n",
prop_name, dev->of_node->full_name);
dev_dbg(dev, "Looking up %s property in node %pOF failed\n",
prop_name, dev->of_node);
return NULL;
}
return regnode;
Expand Down Expand Up @@ -2396,6 +2396,14 @@ static void regulator_disable_work(struct work_struct *work)
count = rdev->deferred_disables;
rdev->deferred_disables = 0;

/*
* Workqueue functions queue the new work instance while the previous
* work instance is being processed. Cancel the queued work instance
* as the work instance under processing does the job of the queued
* work instance.
*/
cancel_delayed_work(&rdev->disable_work);

for (i = 0; i < count; i++) {
ret = _regulator_disable(rdev);
if (ret != 0)
Expand Down Expand Up @@ -2439,10 +2447,10 @@ int regulator_disable_deferred(struct regulator *regulator, int ms)

mutex_lock(&rdev->mutex);
rdev->deferred_disables++;
mod_delayed_work(system_power_efficient_wq, &rdev->disable_work,
msecs_to_jiffies(ms));
mutex_unlock(&rdev->mutex);

queue_delayed_work(system_power_efficient_wq, &rdev->disable_work,
msecs_to_jiffies(ms));
return 0;
}
EXPORT_SYMBOL_GPL(regulator_disable_deferred);
Expand Down
21 changes: 18 additions & 3 deletions drivers/regulator/cpcap-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
#define CPCAP_BIT_VAUDIO_MODE0 BIT(1)
#define CPCAP_BIT_V_AUDIO_EN BIT(0)

#define CPCAP_BIT_AUDIO_NORMAL_MODE 0x00

/*
* Off mode configuration bit. Used currently only by SW5 on omap4. There's
* the following comment in Motorola Linux kernel tree for it:
Expand Down Expand Up @@ -121,6 +123,7 @@ struct cpcap_regulator {
.enable_val = (mode_val), \
.disable_val = (off_val), \
.ramp_delay = (volt_trans_time), \
.of_map_mode = cpcap_map_mode, \
}, \
.assign_reg = (assignment_reg), \
.assign_mask = (assignment_mask), \
Expand Down Expand Up @@ -211,13 +214,25 @@ static int cpcap_regulator_disable(struct regulator_dev *rdev)
return error;
}

static unsigned int cpcap_map_mode(unsigned int mode)
{
switch (mode) {
case CPCAP_BIT_AUDIO_NORMAL_MODE:
return REGULATOR_MODE_NORMAL;
case CPCAP_BIT_AUDIO_LOW_PWR:
return REGULATOR_MODE_STANDBY;
default:
return -EINVAL;
}
}

static unsigned int cpcap_regulator_get_mode(struct regulator_dev *rdev)
{
int value;

regmap_read(rdev->regmap, rdev->desc->enable_reg, &value);

if (!(value & CPCAP_BIT_AUDIO_LOW_PWR))
if (value & CPCAP_BIT_AUDIO_LOW_PWR)
return REGULATOR_MODE_STANDBY;

return REGULATOR_MODE_NORMAL;
Expand All @@ -230,10 +245,10 @@ static int cpcap_regulator_set_mode(struct regulator_dev *rdev,

switch (mode) {
case REGULATOR_MODE_NORMAL:
value = CPCAP_BIT_AUDIO_LOW_PWR;
value = CPCAP_BIT_AUDIO_NORMAL_MODE;
break;
case REGULATOR_MODE_STANDBY:
value = 0;
value = CPCAP_BIT_AUDIO_LOW_PWR;
break;
default:
return -EINVAL;
Expand Down
2 changes: 1 addition & 1 deletion drivers/regulator/da9063-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ static int da9063_regulator_probe(struct platform_device *pdev)
if (IS_ERR(regl_pdata) || regl_pdata->n_regulators == 0) {
dev_err(&pdev->dev,
"No regulators defined for the platform\n");
return PTR_ERR(regl_pdata);
return -ENODEV;
}

/* Find regulators set for particular device model */
Expand Down
15 changes: 6 additions & 9 deletions drivers/regulator/fan53555.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,14 +407,8 @@ static int fan53555_regulator_probe(struct i2c_client *client,

di->regulator = pdata->regulator;
if (client->dev.of_node) {
const struct of_device_id *match;

match = of_match_device(of_match_ptr(fan53555_dt_ids),
&client->dev);
if (!match)
return -ENODEV;

di->vendor = (unsigned long) match->data;
di->vendor =
(unsigned long)of_device_get_match_data(&client->dev);
} else {
/* if no ramp constraint set, get the pdata ramp_delay */
if (!di->regulator->constraints.ramp_delay) {
Expand Down Expand Up @@ -476,7 +470,10 @@ static const struct i2c_device_id fan53555_id[] = {
.name = "fan53555",
.driver_data = FAN53555_VENDOR_FAIRCHILD
}, {
.name = "syr82x",
.name = "syr827",
.driver_data = FAN53555_VENDOR_SILERGY
}, {
.name = "syr828",
.driver_data = FAN53555_VENDOR_SILERGY
},
{ },
Expand Down
2 changes: 1 addition & 1 deletion drivers/regulator/ltc3589.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ static int ltc3589_probe(struct i2c_client *client,
return 0;
}

static struct i2c_device_id ltc3589_i2c_id[] = {
static const struct i2c_device_id ltc3589_i2c_id[] = {
{ "ltc3589", LTC3589 },
{ "ltc3589-1", LTC3589_1 },
{ "ltc3589-2", LTC3589_2 },
Expand Down
2 changes: 1 addition & 1 deletion drivers/regulator/max1586.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ static int of_get_max1586_platform_data(struct device *dev,

if (of_property_read_u32(np, "v3-gain",
&pdata->v3_gain) < 0) {
dev_err(dev, "%s has no 'v3-gain' property\n", np->full_name);
dev_err(dev, "%pOF has no 'v3-gain' property\n", np);
return -EINVAL;
}

Expand Down
Loading

0 comments on commit fe9e313

Please sign in to comment.