You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge remote-tracking branches 'regulator/topic/fixed', 'regulator/topic/id-const', 'regulator/topic/ltc3589', 'regulator/topic/max8649' and 'regulator/topic/of' into regulator-next
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
Linear Technology LTC3589, LTC3589-1, and LTC3589-2 8-output regulators
|
||||
|
||||
Required properties:
|
||||
- compatible: "lltc,ltc3589", "lltc,ltc3589-1" or "lltc,ltc3589-2"
|
||||
- reg: I2C slave address
|
||||
|
||||
Required child node:
|
||||
- regulators: Contains eight regulator child nodes sw1, sw2, sw3, bb-out,
|
||||
ldo1, ldo2, ldo3, and ldo4, specifying the initialization data as
|
||||
documented in Documentation/devicetree/bindings/regulator/regulator.txt.
|
||||
|
||||
Each regulator is defined using the standard binding for regulators. The
|
||||
nodes for sw1, sw2, sw3, bb-out, ldo1, and ldo2 additionally need to specify
|
||||
the resistor values of their external feedback voltage dividers:
|
||||
|
||||
Required properties (not on ldo3, ldo4):
|
||||
- lltc,fb-voltage-divider: An array of two integers containing the resistor
|
||||
values R1 and R2 of the feedback voltage divider in ohms.
|
||||
|
||||
Regulators sw1, sw2, sw3, and ldo2 can regulate the feedback reference from
|
||||
0.3625 V to 0.75 V in 12.5 mV steps. The output voltage thus ranges between
|
||||
0.3625 * (1 + R1/R2) V and 0.75 * (1 + R1/R2) V. Regulators bb-out and ldo1
|
||||
have a fixed 0.8 V reference and thus output 0.8 * (1 + R1/R2) V. The ldo3
|
||||
regulator is fixed to 1.8 V on LTC3589 and to 2.8 V on LTC3589-1,2. The ldo4
|
||||
regulator can output between 1.8 V and 3.3 V on LTC3589 and between 1.2 V
|
||||
and 3.2 V on LTC3589-1,2 in four steps. The ldo1 standby regulator can not
|
||||
be disabled and thus should have the regulator-always-on property set.
|
||||
|
||||
Example:
|
||||
|
||||
ltc3589: pmic@34 {
|
||||
compatible = "lltc,ltc3589-1";
|
||||
reg = <0x34>;
|
||||
|
||||
regulators {
|
||||
sw1_reg: sw1 {
|
||||
regulator-min-microvolt = <591930>;
|
||||
regulator-max-microvolt = <1224671>;
|
||||
lltc,fb-voltage-divider = <100000 158000>;
|
||||
regulator-ramp-delay = <7000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
sw2_reg: sw2 {
|
||||
regulator-min-microvolt = <704123>;
|
||||
regulator-max-microvolt = <1456803>;
|
||||
lltc,fb-voltage-divider = <180000 191000>;
|
||||
regulator-ramp-delay = <7000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
sw3_reg: sw3 {
|
||||
regulator-min-microvolt = <1341250>;
|
||||
regulator-max-microvolt = <2775000>;
|
||||
lltc,fb-voltage-divider = <270000 100000>;
|
||||
regulator-ramp-delay = <7000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
bb_out_reg: bb-out {
|
||||
regulator-min-microvolt = <3387341>;
|
||||
regulator-max-microvolt = <3387341>;
|
||||
lltc,fb-voltage-divider = <511000 158000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
ldo1_reg: ldo1 {
|
||||
regulator-min-microvolt = <1306329>;
|
||||
regulator-max-microvolt = <1306329>;
|
||||
lltc,fb-voltage-divider = <100000 158000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
ldo2_reg: ldo2 {
|
||||
regulator-min-microvolt = <704123>;
|
||||
regulator-max-microvolt = <1456806>;
|
||||
lltc,fb-voltage-divider = <180000 191000>;
|
||||
regulator-ramp-delay = <7000>;
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
ldo3_reg: ldo3 {
|
||||
regulator-min-microvolt = <2800000>;
|
||||
regulator-max-microvolt = <2800000>;
|
||||
regulator-boot-on;
|
||||
};
|
||||
|
||||
ldo4_reg: ldo4 {
|
||||
regulator-min-microvolt = <1200000>;
|
||||
regulator-max-microvolt = <3200000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -73,6 +73,7 @@ lantiq Lantiq Semiconductor
|
||||
lg LG Corporation
|
||||
linux Linux-specific binding
|
||||
lsi LSI Corp. (LSI Logic)
|
||||
lltc Linear Technology Corporation
|
||||
marvell Marvell Technology Group Ltd.
|
||||
maxim Maxim Integrated Products
|
||||
microchip Microchip Technology Inc.
|
||||
|
||||
@@ -272,6 +272,14 @@ config REGULATOR_LP8788
|
||||
help
|
||||
This driver supports LP8788 voltage regulator chip.
|
||||
|
||||
config REGULATOR_LTC3589
|
||||
tristate "LTC3589 8-output voltage regulator"
|
||||
depends on I2C
|
||||
select REGMAP_I2C
|
||||
help
|
||||
This enables support for the LTC3589, LTC3589-1, and LTC3589-2
|
||||
8-output regulators controlled via I2C.
|
||||
|
||||
config REGULATOR_MAX14577
|
||||
tristate "Maxim 14577 regulator"
|
||||
depends on MFD_MAX14577
|
||||
|
||||
@@ -38,6 +38,7 @@ obj-$(CONFIG_REGULATOR_LP872X) += lp872x.o
|
||||
obj-$(CONFIG_REGULATOR_LP8788) += lp8788-buck.o
|
||||
obj-$(CONFIG_REGULATOR_LP8788) += lp8788-ldo.o
|
||||
obj-$(CONFIG_REGULATOR_LP8755) += lp8755.o
|
||||
obj-$(CONFIG_REGULATOR_LTC3589) += ltc3589.o
|
||||
obj-$(CONFIG_REGULATOR_MAX14577) += max14577.o
|
||||
obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o
|
||||
obj-$(CONFIG_REGULATOR_MAX8649) += max8649.o
|
||||
|
||||
@@ -300,7 +300,7 @@ static int anatop_regulator_probe(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct of_device_id of_anatop_regulator_match_tbl[] = {
|
||||
static const struct of_device_id of_anatop_regulator_match_tbl[] = {
|
||||
{ .compatible = "fsl,anatop-regulator", },
|
||||
{ /* end */ }
|
||||
};
|
||||
|
||||
@@ -3458,7 +3458,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
|
||||
|
||||
/* register with sysfs */
|
||||
rdev->dev.class = ®ulator_class;
|
||||
rdev->dev.of_node = config->of_node;
|
||||
rdev->dev.of_node = of_node_get(config->of_node);
|
||||
rdev->dev.parent = dev;
|
||||
dev_set_name(&rdev->dev, "regulator.%d",
|
||||
atomic_inc_return(®ulator_no) - 1);
|
||||
@@ -3600,6 +3600,7 @@ void regulator_unregister(struct regulator_dev *rdev)
|
||||
list_del(&rdev->list);
|
||||
kfree(rdev->constraints);
|
||||
regulator_ena_gpio_free(rdev);
|
||||
of_node_put(rdev->dev.of_node);
|
||||
device_unregister(&rdev->dev);
|
||||
mutex_unlock(®ulator_list_mutex);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ of_get_fixed_voltage_config(struct device *dev)
|
||||
{
|
||||
struct fixed_voltage_config *config;
|
||||
struct device_node *np = dev->of_node;
|
||||
const __be32 *delay;
|
||||
struct regulator_init_data *init_data;
|
||||
|
||||
config = devm_kzalloc(dev, sizeof(struct fixed_voltage_config),
|
||||
@@ -91,15 +90,11 @@ of_get_fixed_voltage_config(struct device *dev)
|
||||
if ((config->gpio == -ENODEV) || (config->gpio == -EPROBE_DEFER))
|
||||
return ERR_PTR(-EPROBE_DEFER);
|
||||
|
||||
delay = of_get_property(np, "startup-delay-us", NULL);
|
||||
if (delay)
|
||||
config->startup_delay = be32_to_cpu(*delay);
|
||||
of_property_read_u32(np, "startup-delay-us", &config->startup_delay);
|
||||
|
||||
if (of_find_property(np, "enable-active-high", NULL))
|
||||
config->enable_high = true;
|
||||
|
||||
if (of_find_property(np, "gpio-open-drain", NULL))
|
||||
config->gpio_is_open_drain = true;
|
||||
config->enable_high = of_property_read_bool(np, "enable-active-high");
|
||||
config->gpio_is_open_drain = of_property_read_bool(np,
|
||||
"gpio-open-drain");
|
||||
|
||||
if (of_find_property(np, "vin-supply", NULL))
|
||||
config->input_supply = "vin";
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -161,10 +161,8 @@ static int max8649_regulator_probe(struct i2c_client *client,
|
||||
|
||||
info = devm_kzalloc(&client->dev, sizeof(struct max8649_regulator_info),
|
||||
GFP_KERNEL);
|
||||
if (!info) {
|
||||
dev_err(&client->dev, "No enough memory\n");
|
||||
if (!info)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
info->regmap = devm_regmap_init_i2c(client, &max8649_regmap_config);
|
||||
if (IS_ERR(info->regmap)) {
|
||||
|
||||
@@ -129,7 +129,7 @@ static const struct regulator_desc regulator = {
|
||||
};
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
static struct of_device_id max8952_dt_match[] = {
|
||||
static const struct of_device_id max8952_dt_match[] = {
|
||||
{ .compatible = "maxim,max8952" },
|
||||
{},
|
||||
};
|
||||
|
||||
@@ -19,9 +19,7 @@
|
||||
static void of_get_regulation_constraints(struct device_node *np,
|
||||
struct regulator_init_data **init_data)
|
||||
{
|
||||
const __be32 *min_uV, *max_uV, *uV_offset;
|
||||
const __be32 *min_uA, *max_uA, *ramp_delay;
|
||||
struct property *prop;
|
||||
const __be32 *min_uV, *max_uV;
|
||||
struct regulation_constraints *constraints = &(*init_data)->constraints;
|
||||
int ret;
|
||||
u32 pval;
|
||||
@@ -42,36 +40,29 @@ static void of_get_regulation_constraints(struct device_node *np,
|
||||
if (min_uV && max_uV && constraints->min_uV == constraints->max_uV)
|
||||
constraints->apply_uV = true;
|
||||
|
||||
uV_offset = of_get_property(np, "regulator-microvolt-offset", NULL);
|
||||
if (uV_offset)
|
||||
constraints->uV_offset = be32_to_cpu(*uV_offset);
|
||||
min_uA = of_get_property(np, "regulator-min-microamp", NULL);
|
||||
if (min_uA)
|
||||
constraints->min_uA = be32_to_cpu(*min_uA);
|
||||
max_uA = of_get_property(np, "regulator-max-microamp", NULL);
|
||||
if (max_uA)
|
||||
constraints->max_uA = be32_to_cpu(*max_uA);
|
||||
if (!of_property_read_u32(np, "regulator-microvolt-offset", &pval))
|
||||
constraints->uV_offset = pval;
|
||||
if (!of_property_read_u32(np, "regulator-min-microamp", &pval))
|
||||
constraints->min_uA = pval;
|
||||
if (!of_property_read_u32(np, "regulator-max-microamp", &pval))
|
||||
constraints->max_uA = pval;
|
||||
|
||||
/* Current change possible? */
|
||||
if (constraints->min_uA != constraints->max_uA)
|
||||
constraints->valid_ops_mask |= REGULATOR_CHANGE_CURRENT;
|
||||
|
||||
if (of_find_property(np, "regulator-boot-on", NULL))
|
||||
constraints->boot_on = true;
|
||||
|
||||
if (of_find_property(np, "regulator-always-on", NULL))
|
||||
constraints->always_on = true;
|
||||
else /* status change should be possible if not always on. */
|
||||
constraints->boot_on = of_property_read_bool(np, "regulator-boot-on");
|
||||
constraints->always_on = of_property_read_bool(np, "regulator-always-on");
|
||||
if (!constraints->always_on) /* status change should be possible. */
|
||||
constraints->valid_ops_mask |= REGULATOR_CHANGE_STATUS;
|
||||
|
||||
if (of_property_read_bool(np, "regulator-allow-bypass"))
|
||||
constraints->valid_ops_mask |= REGULATOR_CHANGE_BYPASS;
|
||||
|
||||
prop = of_find_property(np, "regulator-ramp-delay", NULL);
|
||||
if (prop && prop->value) {
|
||||
ramp_delay = prop->value;
|
||||
if (*ramp_delay)
|
||||
constraints->ramp_delay = be32_to_cpu(*ramp_delay);
|
||||
ret = of_property_read_u32(np, "regulator-ramp-delay", &pval);
|
||||
if (!ret) {
|
||||
if (pval)
|
||||
constraints->ramp_delay = pval;
|
||||
else
|
||||
constraints->ramp_disable = true;
|
||||
}
|
||||
@@ -106,6 +97,20 @@ struct regulator_init_data *of_get_regulator_init_data(struct device *dev,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(of_get_regulator_init_data);
|
||||
|
||||
struct devm_of_regulator_matches {
|
||||
struct of_regulator_match *matches;
|
||||
unsigned int num_matches;
|
||||
};
|
||||
|
||||
static void devm_of_regulator_put_matches(struct device *dev, void *res)
|
||||
{
|
||||
struct devm_of_regulator_matches *devm_matches = res;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < devm_matches->num_matches; i++)
|
||||
of_node_put(devm_matches->matches[i].of_node);
|
||||
}
|
||||
|
||||
/**
|
||||
* of_regulator_match - extract multiple regulator init data from device tree.
|
||||
* @dev: device requesting the data
|
||||
@@ -119,7 +124,8 @@ EXPORT_SYMBOL_GPL(of_get_regulator_init_data);
|
||||
* regulator. The data parsed from a child node will be matched to a regulator
|
||||
* based on either the deprecated property regulator-compatible if present,
|
||||
* or otherwise the child node's name. Note that the match table is modified
|
||||
* in place.
|
||||
* in place and an additional of_node reference is taken for each matched
|
||||
* regulator.
|
||||
*
|
||||
* Returns the number of matches found or a negative error code on failure.
|
||||
*/
|
||||
@@ -131,10 +137,22 @@ int of_regulator_match(struct device *dev, struct device_node *node,
|
||||
unsigned int i;
|
||||
const char *name;
|
||||
struct device_node *child;
|
||||
struct devm_of_regulator_matches *devm_matches;
|
||||
|
||||
if (!dev || !node)
|
||||
return -EINVAL;
|
||||
|
||||
devm_matches = devres_alloc(devm_of_regulator_put_matches,
|
||||
sizeof(struct devm_of_regulator_matches),
|
||||
GFP_KERNEL);
|
||||
if (!devm_matches)
|
||||
return -ENOMEM;
|
||||
|
||||
devm_matches->matches = matches;
|
||||
devm_matches->num_matches = num_matches;
|
||||
|
||||
devres_add(dev, devm_matches);
|
||||
|
||||
for (i = 0; i < num_matches; i++) {
|
||||
struct of_regulator_match *match = &matches[i];
|
||||
match->init_data = NULL;
|
||||
@@ -162,7 +180,7 @@ int of_regulator_match(struct device *dev, struct device_node *node,
|
||||
child->name);
|
||||
return -EINVAL;
|
||||
}
|
||||
match->of_node = child;
|
||||
match->of_node = of_node_get(child);
|
||||
count++;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1199,7 +1199,7 @@ static int palmas_regulators_probe(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct of_device_id of_palmas_match_tbl[] = {
|
||||
static const struct of_device_id of_palmas_match_tbl[] = {
|
||||
{ .compatible = "ti,palmas-pmic", },
|
||||
{ .compatible = "ti,twl6035-pmic", },
|
||||
{ .compatible = "ti,twl6036-pmic", },
|
||||
|
||||
@@ -118,7 +118,7 @@ static const struct st_pwm_regulator_pdata b2105_info = {
|
||||
.duty_cycle_table = b2105_duty_cycle_table,
|
||||
};
|
||||
|
||||
static struct of_device_id st_pwm_of_match[] = {
|
||||
static const struct of_device_id st_pwm_of_match[] = {
|
||||
{ .compatible = "st,b2105-pwm-regulator", .data = &b2105_info, },
|
||||
{ },
|
||||
};
|
||||
|
||||
@@ -123,7 +123,7 @@ static int vexpress_regulator_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct of_device_id vexpress_regulator_of_match[] = {
|
||||
static const struct of_device_id vexpress_regulator_of_match[] = {
|
||||
{ .compatible = "arm,vexpress-volt", },
|
||||
{ }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user