Skip to content

Commit

Permalink
Merge tag 'regulator-v5.5' of git://git.kernel.org/pub/scm/linux/kern…
Browse files Browse the repository at this point in the history
…el/git/broonie/regulator

Pull regulator updates from Mark Brown:
 "Another fairly quiet release for the regulator API, some work all
  around including some core work but mostly in specialist or driver
  specific code:

   - Fix for powering off boot-on regulators

   - Enhancements to the coupled regulator support introduced in the
     last release

   - Conversion of a bunch of drivers to the fwnode API for GPIOs

   - Mode support for DA9062

   - New device support for Qualcomm PM1650, PM8004 and PM895 and
     Silergy SR83X

   - Removal of obsolete AB8505 support"

* tag 'regulator-v5.5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (49 commits)
  regulator: da9062: Return REGULATOR_MODE_INVALID for invalid mode
  regulator: Fix Kconfig indentation
  regulator: tps6105x: add optional devicetree support
  tps6105x: add optional devicetree support
  regulator: rn5t618: fix rc5t619 ldo10 enable
  regulator: vexpress: Use PTR_ERR_OR_ZERO() to simplify code
  dt-bindings: mfd: da9062: describe buck modes
  regulator: da9062: add of_map_mode support for bucks
  regulator: da9062: refactor buck modes into header
  regulator: stpmic1: Set a default ramp delay value
  regulator: core: Let boot-on regulators be powered off
  regulator: core: Don't try to remove device links if add failed
  regulator: ab8500: Remove SYSCLKREQ from enum ab8505_regulator_id
  regulator: ab8500: Remove AB8505 USB regulator
  regulator: fan53555: add chip id for Silergy SYR83X
  regulator: fixed: add off-on-delay
  dt-bindings: regulator: fixed: add off-on-delay-us property
  regulator: core: Allow generic coupling only for always-on regulators
  regulator: core: Release coupled_rdevs on regulator_init_coupling() error
  regulator: bd70528: Add MODULE_ALIAS to allow module auto loading
  ...
  • Loading branch information
torvalds committed Nov 26, 2019
2 parents 3b397c7 + a21da94 commit d873a0c
Show file tree
Hide file tree
Showing 43 changed files with 576 additions and 229 deletions.
4 changes: 4 additions & 0 deletions Documentation/devicetree/bindings/mfd/da9062.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ Sub-nodes:
details of individual regulator device can be found in:
Documentation/devicetree/bindings/regulator/regulator.txt

regulator-initial-mode may be specified for buck regulators using mode values
from include/dt-bindings/regulator/dlg,da9063-regulator.h.

- rtc : This node defines settings required for the Real-Time Clock associated
with the DA9062. There are currently no entries in this binding, however
compatible = "dlg,da9062-rtc" should be added if a node is created.
Expand Down Expand Up @@ -96,6 +99,7 @@ Example:
regulator-max-microvolt = <1570000>;
regulator-min-microamp = <500000>;
regulator-max-microamp = <2000000>;
regulator-initial-mode = <DA9063_BUCK_MODE_SYNC>;
regulator-boot-on;
};
DA9062_LDO1: ldo1 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ properties:
description: startup time in microseconds
$ref: /schemas/types.yaml#/definitions/uint32

off-on-delay-us:
description: off delay time in microseconds
$ref: /schemas/types.yaml#/definitions/uint32

enable-active-high:
description:
Polarity of GPIO is Active high. If this property is missing,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Supported regulator node names:
PM8150L: smps1 - smps8, ldo1 - ldo11, bob, flash, rgb
PM8998: smps1 - smps13, ldo1 - ldo28, lvs1 - lvs2
PMI8998: bob
PM6150: smps1 - smps5, ldo1 - ldo19
PM6150L: smps1 - smps8, ldo1 - ldo11, bob

========================
First Level Nodes - PMIC
Expand All @@ -43,6 +45,8 @@ First Level Nodes - PMIC
"qcom,pm8150l-rpmh-regulators"
"qcom,pm8998-rpmh-regulators"
"qcom,pmi8998-rpmh-regulators"
"qcom,pm6150-rpmh-regulators"
"qcom,pm6150l-rpmh-regulators"

- qcom,pmic-id
Usage: required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Regulator nodes are identified by their compatible:
"qcom,rpm-pm8841-regulators"
"qcom,rpm-pm8916-regulators"
"qcom,rpm-pm8941-regulators"
"qcom,rpm-pm8950-regulators"
"qcom,rpm-pm8994-regulators"
"qcom,rpm-pm8998-regulators"
"qcom,rpm-pma8084-regulators"
Expand Down Expand Up @@ -54,6 +55,26 @@ Regulator nodes are identified by their compatible:
Definition: reference to regulator supplying the input pin, as
described in the data sheet

- vdd_s1-supply:
- vdd_s2-supply:
- vdd_s3-supply:
- vdd_s4-supply:
- vdd_s4-supply:
- vdd_s5-supply:
- vdd_s6-supply:
- vdd_l1_l19-supply:
- vdd_l2_l23-supply:
- vdd_l3-supply:
- vdd_l4_l5_l6_l7_l16-supply:
- vdd_l8_l11_l12_l17_l22-supply:
- vdd_l9_l10_l13_l14_l15_l18-supply:
- vdd_l20-supply:
- vdd_l21-supply:
Usage: optional (pm8950 only)
Value type: <phandle>
Definition: reference to regulator supplying the input pin, as
described in the data sheet

- vdd_s1-supply:
- vdd_s2-supply:
- vdd_s3-supply:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ Qualcomm SPMI Regulators
Usage: required
Value type: <string>
Definition: must be one of:
"qcom,pm8004-regulators"
"qcom,pm8005-regulators"
"qcom,pm8841-regulators"
"qcom,pm8916-regulators"
"qcom,pm8941-regulators"
"qcom,pm8950-regulators"
"qcom,pm8994-regulators"
"qcom,pmi8994-regulators"
"qcom,pms405-regulators"
Expand Down Expand Up @@ -72,6 +74,26 @@ Qualcomm SPMI Regulators
Definition: Reference to regulator supplying the input pin, as
described in the data sheet.

- vdd_s1-supply:
- vdd_s2-supply:
- vdd_s3-supply:
- vdd_s4-supply:
- vdd_s4-supply:
- vdd_s5-supply:
- vdd_s6-supply:
- vdd_l1_l19-supply:
- vdd_l2_l23-supply:
- vdd_l3-supply:
- vdd_l4_l5_l6_l7_l16-supply:
- vdd_l8_l11_l12_l17_l22-supply:
- vdd_l9_l10_l13_l14_l15_l18-supply:
- vdd_l20-supply:
- vdd_l21-supply:
Usage: optional (pm8950 only)
Value type: <phandle>
Definition: reference to regulator supplying the input pin, as
described in the data sheet

- vdd_s1-supply:
- vdd_s2-supply:
- vdd_s3-supply:
Expand Down Expand Up @@ -139,6 +161,9 @@ The regulator node houses sub-nodes for each regulator within the device. Each
sub-node is identified using the node's name, with valid values listed for each
of the PMICs below.

pm8005:
s2, s5

pm8005:
s1, s2, s3, s4

Expand Down
7 changes: 6 additions & 1 deletion Documentation/devicetree/bindings/regulator/regulator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ properties:
type: boolean

regulator-boot-on:
description: bootloader/firmware enabled regulator
description: bootloader/firmware enabled regulator.
It's expected that this regulator was left on by the bootloader.
If the bootloader didn't leave it on then OS should turn it on
at boot but shouldn't prevent it from being turned off later.
This property is intended to only be used for regulators where
software cannot read the state of the regulator.
type: boolean

regulator-allow-bypass:
Expand Down
33 changes: 9 additions & 24 deletions drivers/gpio/gpiolib-devres.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,11 @@ struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev,
EXPORT_SYMBOL_GPL(devm_gpiod_get_from_of_node);

/**
* devm_fwnode_get_index_gpiod_from_child - get a GPIO descriptor from a
* device's child node
* devm_fwnode_gpiod_get_index - get a GPIO descriptor from a given node
* @dev: GPIO consumer
* @fwnode: firmware node containing GPIO reference
* @con_id: function within the GPIO consumer
* @index: index of the GPIO to obtain in the consumer
* @child: firmware node (child of @dev)
* @flags: GPIO initialization flags
* @label: label to attach to the requested GPIO
*
Expand All @@ -200,35 +199,21 @@ EXPORT_SYMBOL_GPL(devm_gpiod_get_from_of_node);
* On successful request the GPIO pin is configured in accordance with
* provided @flags.
*/
struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev,
const char *con_id, int index,
struct fwnode_handle *child,
enum gpiod_flags flags,
const char *label)
struct gpio_desc *devm_fwnode_gpiod_get_index(struct device *dev,
struct fwnode_handle *fwnode,
const char *con_id, int index,
enum gpiod_flags flags,
const char *label)
{
char prop_name[32]; /* 32 is max size of property name */
struct gpio_desc **dr;
struct gpio_desc *desc;
unsigned int i;

dr = devres_alloc(devm_gpiod_release, sizeof(struct gpio_desc *),
GFP_KERNEL);
if (!dr)
return ERR_PTR(-ENOMEM);

for (i = 0; i < ARRAY_SIZE(gpio_suffixes); i++) {
if (con_id)
snprintf(prop_name, sizeof(prop_name), "%s-%s",
con_id, gpio_suffixes[i]);
else
snprintf(prop_name, sizeof(prop_name), "%s",
gpio_suffixes[i]);

desc = fwnode_get_named_gpiod(child, prop_name, index, flags,
label);
if (!IS_ERR(desc) || (PTR_ERR(desc) != -ENOENT))
break;
}
desc = fwnode_gpiod_get_index(fwnode, con_id, index, flags, label);
if (IS_ERR(desc)) {
devres_free(dr);
return desc;
Expand All @@ -239,7 +224,7 @@ struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev,

return desc;
}
EXPORT_SYMBOL_GPL(devm_fwnode_get_index_gpiod_from_child);
EXPORT_SYMBOL_GPL(devm_fwnode_gpiod_get_index);

/**
* devm_gpiod_get_index_optional - Resource-managed gpiod_get_index_optional()
Expand Down
48 changes: 48 additions & 0 deletions drivers/gpio/gpiolib.c
Original file line number Diff line number Diff line change
Expand Up @@ -4355,6 +4355,54 @@ static int platform_gpio_count(struct device *dev, const char *con_id)
return count;
}

/**
* fwnode_gpiod_get_index - obtain a GPIO from firmware node
* @fwnode: handle of the firmware node
* @con_id: function within the GPIO consumer
* @index: index of the GPIO to obtain for the consumer
* @flags: GPIO initialization flags
* @label: label to attach to the requested GPIO
*
* This function can be used for drivers that get their configuration
* from opaque firmware.
*
* The function properly finds the corresponding GPIO using whatever is the
* underlying firmware interface and then makes sure that the GPIO
* descriptor is requested before it is returned to the caller.
*
* Returns:
* On successful request the GPIO pin is configured in accordance with
* provided @flags.
*
* In case of error an ERR_PTR() is returned.
*/
struct gpio_desc *fwnode_gpiod_get_index(struct fwnode_handle *fwnode,
const char *con_id, int index,
enum gpiod_flags flags,
const char *label)
{
struct gpio_desc *desc;
char prop_name[32]; /* 32 is max size of property name */
unsigned int i;

for (i = 0; i < ARRAY_SIZE(gpio_suffixes); i++) {
if (con_id)
snprintf(prop_name, sizeof(prop_name), "%s-%s",
con_id, gpio_suffixes[i]);
else
snprintf(prop_name, sizeof(prop_name), "%s",
gpio_suffixes[i]);

desc = fwnode_get_named_gpiod(fwnode, prop_name, index, flags,
label);
if (!IS_ERR(desc) || (PTR_ERR(desc) != -ENOENT))
break;
}

return desc;
}
EXPORT_SYMBOL_GPL(fwnode_gpiod_get_index);

/**
* gpiod_count - return the number of GPIOs associated with a device / function
* or -ENOENT if no GPIO has been assigned to the requested function
Expand Down
34 changes: 31 additions & 3 deletions drivers/mfd/tps6105x.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,32 @@ static int tps6105x_add_device(struct tps6105x *tps6105x,
PLATFORM_DEVID_AUTO, cell, 1, NULL, 0, NULL);
}

static struct tps6105x_platform_data *tps6105x_parse_dt(struct device *dev)
{
struct device_node *np = dev->of_node;
struct tps6105x_platform_data *pdata;
struct device_node *child;

if (!np)
return ERR_PTR(-EINVAL);
if (of_get_available_child_count(np) > 1) {
dev_err(dev, "cannot support multiple operational modes");
return ERR_PTR(-EINVAL);
}
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
return ERR_PTR(-ENOMEM);
pdata->mode = TPS6105X_MODE_SHUTDOWN;
for_each_available_child_of_node(np, child) {
if (child->name && !of_node_cmp(child->name, "regulator"))
pdata->mode = TPS6105X_MODE_VOLTAGE;
else if (child->name && !of_node_cmp(child->name, "led"))
pdata->mode = TPS6105X_MODE_TORCH;
}

return pdata;
}

static int tps6105x_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
Expand All @@ -99,9 +125,11 @@ static int tps6105x_probe(struct i2c_client *client,
int ret;

pdata = dev_get_platdata(&client->dev);
if (!pdata) {
dev_err(&client->dev, "missing platform data\n");
return -ENODEV;
if (!pdata)
pdata = tps6105x_parse_dt(&client->dev);
if (IS_ERR(pdata)) {
dev_err(&client->dev, "No platform data or DT found");
return PTR_ERR(pdata);
}

tps6105x = devm_kmalloc(&client->dev, sizeof(*tps6105x), GFP_KERNEL);
Expand Down
8 changes: 4 additions & 4 deletions drivers/regulator/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -841,10 +841,10 @@ config REGULATOR_SKY81452
will be called sky81452-regulator.

config REGULATOR_SLG51000
tristate "Dialog Semiconductor SLG51000 regulators"
depends on I2C
select REGMAP_I2C
help
tristate "Dialog Semiconductor SLG51000 regulators"
depends on I2C
select REGMAP_I2C
help
Say y here to support for the Dialog Semiconductor SLG51000.
The SLG51000 is seven compact and customizable low dropout
regulators.
Expand Down
17 changes: 0 additions & 17 deletions drivers/regulator/ab8500.c
Original file line number Diff line number Diff line change
Expand Up @@ -953,23 +953,6 @@ static struct ab8500_regulator_info
.update_val_idle = 0x82,
.update_val_normal = 0x02,
},
[AB8505_LDO_USB] = {
.desc = {
.name = "LDO-USB",
.ops = &ab8500_regulator_mode_ops,
.type = REGULATOR_VOLTAGE,
.id = AB8505_LDO_USB,
.owner = THIS_MODULE,
.n_voltages = 1,
.volt_table = fixed_3300000_voltage,
},
.update_bank = 0x03,
.update_reg = 0x82,
.update_mask = 0x03,
.update_val = 0x01,
.update_val_idle = 0x03,
.update_val_normal = 0x01,
},
[AB8505_LDO_AUDIO] = {
.desc = {
.name = "LDO-AUDIO",
Expand Down
1 change: 1 addition & 0 deletions drivers/regulator/bd70528-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,4 @@ module_platform_driver(bd70528_regulator);
MODULE_AUTHOR("Matti Vaittinen <[email protected]>");
MODULE_DESCRIPTION("BD70528 voltage regulator driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:bd70528-pmic");
1 change: 1 addition & 0 deletions drivers/regulator/bd718x7-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -1293,3 +1293,4 @@ module_platform_driver(bd718xx_regulator);
MODULE_AUTHOR("Matti Vaittinen <[email protected]>");
MODULE_DESCRIPTION("BD71837/BD71847 voltage regulator driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:bd718xx-pmic");
Loading

0 comments on commit d873a0c

Please sign in to comment.