Commit 2dab48ef authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'regulator/topic/load',...

Merge remote-tracking branches 'regulator/topic/load', 'regulator/topic/max77802', 'regulator/topic/pwm', 'regulator/topic/qcom-smd' and 'regulator/topic/stw481x' into regulator-next
...@@ -8,7 +8,28 @@ regulators that can be controlled over I2C. ...@@ -8,7 +8,28 @@ regulators that can be controlled over I2C.
Following properties should be present in main device node of the MFD chip. Following properties should be present in main device node of the MFD chip.
Optional node: Optional properties:
- inb1-supply: The input supply for BUCK1
- inb2-supply: The input supply for BUCK2
- inb3-supply: The input supply for BUCK3
- inb4-supply: The input supply for BUCK4
- inb5-supply: The input supply for BUCK5
- inb6-supply: The input supply for BUCK6
- inb7-supply: The input supply for BUCK7
- inb8-supply: The input supply for BUCK8
- inb9-supply: The input supply for BUCK9
- inb10-supply: The input supply for BUCK10
- inl1-supply: The input supply for LDO8 and LDO15
- inl2-supply: The input supply for LDO17, LDO27, LDO30 and LDO35
- inl3-supply: The input supply for LDO3, LDO5, LDO6 and LDO7
- inl4-supply: The input supply for LDO10, LDO11, LDO13 and LDO14
- inl5-supply: The input supply for LDO9 and LDO19
- inl6-supply: The input supply for LDO4, LDO21, LDO24 and LDO33
- inl7-supply: The input supply for LDO18, LDO20, LDO28 and LDO29
- inl9-supply: The input supply for LDO12, LDO23, LDO25, LDO26, LDO32 and LDO34
- inl10-supply: The input supply for LDO1 and LDO2
Optional nodes:
- regulators : The regulators of max77802 have to be instantiated - regulators : The regulators of max77802 have to be instantiated
under subnode named "regulators" using the following format. under subnode named "regulators" using the following format.
...@@ -58,6 +79,8 @@ Example: ...@@ -58,6 +79,8 @@ Example:
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;
inb1-supply = <&parent_reg>;
regulators { regulators {
ldo1_reg: LDO1 { ldo1_reg: LDO1 {
regulator-name = "vdd_1v0"; regulator-name = "vdd_1v0";
......
...@@ -11,6 +11,7 @@ Optional properties: ...@@ -11,6 +11,7 @@ Optional properties:
- regulator-always-on: boolean, regulator should never be disabled - regulator-always-on: boolean, regulator should never be disabled
- regulator-boot-on: bootloader/firmware enabled regulator - regulator-boot-on: bootloader/firmware enabled regulator
- regulator-allow-bypass: allow the regulator to go into bypass mode - regulator-allow-bypass: allow the regulator to go into bypass mode
- regulator-allow-set-load: allow the regulator performance level to be configured
- <name>-supply: phandle to the parent supply/regulator node - <name>-supply: phandle to the parent supply/regulator node
- regulator-ramp-delay: ramp delay for regulator(in uV/uS) - regulator-ramp-delay: ramp delay for regulator(in uV/uS)
For hardware which supports disabling ramp rate, it should be explicitly For hardware which supports disabling ramp rate, it should be explicitly
......
...@@ -627,7 +627,7 @@ config REGULATOR_TI_ABB ...@@ -627,7 +627,7 @@ config REGULATOR_TI_ABB
config REGULATOR_STW481X_VMMC config REGULATOR_STW481X_VMMC
bool "ST Microelectronics STW481X VMMC regulator" bool "ST Microelectronics STW481X VMMC regulator"
depends on MFD_STW481X depends on MFD_STW481X || COMPILE_TEST
default y if MFD_STW481X default y if MFD_STW481X
help help
This driver supports the internal VMMC regulator in the STw481x This driver supports the internal VMMC regulator in the STw481x
......
...@@ -76,6 +76,9 @@ static void of_get_regulation_constraints(struct device_node *np, ...@@ -76,6 +76,9 @@ static void of_get_regulation_constraints(struct device_node *np,
if (of_property_read_bool(np, "regulator-allow-bypass")) if (of_property_read_bool(np, "regulator-allow-bypass"))
constraints->valid_ops_mask |= REGULATOR_CHANGE_BYPASS; constraints->valid_ops_mask |= REGULATOR_CHANGE_BYPASS;
if (of_property_read_bool(np, "regulator-allow-set-load"))
constraints->valid_ops_mask |= REGULATOR_CHANGE_DRMS;
ret = of_property_read_u32(np, "regulator-ramp-delay", &pval); ret = of_property_read_u32(np, "regulator-ramp-delay", &pval);
if (!ret) { if (!ret) {
if (pval) if (pval)
......
...@@ -69,12 +69,6 @@ static int pwm_regulator_set_voltage_sel(struct regulator_dev *rdev, ...@@ -69,12 +69,6 @@ static int pwm_regulator_set_voltage_sel(struct regulator_dev *rdev,
drvdata->state = selector; drvdata->state = selector;
ret = pwm_enable(drvdata->pwm);
if (ret) {
dev_err(&rdev->dev, "Failed to enable PWM\n");
return ret;
}
return 0; return 0;
} }
...@@ -89,6 +83,29 @@ static int pwm_regulator_list_voltage(struct regulator_dev *rdev, ...@@ -89,6 +83,29 @@ static int pwm_regulator_list_voltage(struct regulator_dev *rdev,
return drvdata->duty_cycle_table[selector].uV; return drvdata->duty_cycle_table[selector].uV;
} }
static int pwm_regulator_enable(struct regulator_dev *dev)
{
struct pwm_regulator_data *drvdata = rdev_get_drvdata(dev);
return pwm_enable(drvdata->pwm);
}
static int pwm_regulator_disable(struct regulator_dev *dev)
{
struct pwm_regulator_data *drvdata = rdev_get_drvdata(dev);
pwm_disable(drvdata->pwm);
return 0;
}
static int pwm_regulator_is_enabled(struct regulator_dev *dev)
{
struct pwm_regulator_data *drvdata = rdev_get_drvdata(dev);
return pwm_is_enabled(drvdata->pwm);
}
/** /**
* Continuous voltage call-backs * Continuous voltage call-backs
*/ */
...@@ -144,11 +161,17 @@ static struct regulator_ops pwm_regulator_voltage_table_ops = { ...@@ -144,11 +161,17 @@ static struct regulator_ops pwm_regulator_voltage_table_ops = {
.get_voltage_sel = pwm_regulator_get_voltage_sel, .get_voltage_sel = pwm_regulator_get_voltage_sel,
.list_voltage = pwm_regulator_list_voltage, .list_voltage = pwm_regulator_list_voltage,
.map_voltage = regulator_map_voltage_iterate, .map_voltage = regulator_map_voltage_iterate,
.enable = pwm_regulator_enable,
.disable = pwm_regulator_disable,
.is_enabled = pwm_regulator_is_enabled,
}; };
static struct regulator_ops pwm_regulator_voltage_continuous_ops = { static struct regulator_ops pwm_regulator_voltage_continuous_ops = {
.get_voltage = pwm_regulator_get_voltage, .get_voltage = pwm_regulator_get_voltage,
.set_voltage = pwm_regulator_set_voltage, .set_voltage = pwm_regulator_set_voltage,
.enable = pwm_regulator_enable,
.disable = pwm_regulator_disable,
.is_enabled = pwm_regulator_is_enabled,
}; };
static struct regulator_desc pwm_regulator_desc = { static struct regulator_desc pwm_regulator_desc = {
......
...@@ -36,9 +36,9 @@ struct qcom_rpm_reg { ...@@ -36,9 +36,9 @@ struct qcom_rpm_reg {
}; };
struct rpm_regulator_req { struct rpm_regulator_req {
u32 key; __le32 key;
u32 nbytes; __le32 nbytes;
u32 value; __le32 value;
}; };
#define RPM_KEY_SWEN 0x6e657773 /* "swen" */ #define RPM_KEY_SWEN 0x6e657773 /* "swen" */
...@@ -62,9 +62,9 @@ static int rpm_reg_enable(struct regulator_dev *rdev) ...@@ -62,9 +62,9 @@ static int rpm_reg_enable(struct regulator_dev *rdev)
struct rpm_regulator_req req; struct rpm_regulator_req req;
int ret; int ret;
req.key = RPM_KEY_SWEN; req.key = cpu_to_le32(RPM_KEY_SWEN);
req.nbytes = sizeof(u32); req.nbytes = cpu_to_le32(sizeof(u32));
req.value = 1; req.value = cpu_to_le32(1);
ret = rpm_reg_write_active(vreg, &req, sizeof(req)); ret = rpm_reg_write_active(vreg, &req, sizeof(req));
if (!ret) if (!ret)
...@@ -86,8 +86,8 @@ static int rpm_reg_disable(struct regulator_dev *rdev) ...@@ -86,8 +86,8 @@ static int rpm_reg_disable(struct regulator_dev *rdev)
struct rpm_regulator_req req; struct rpm_regulator_req req;
int ret; int ret;
req.key = RPM_KEY_SWEN; req.key = cpu_to_le32(RPM_KEY_SWEN);
req.nbytes = sizeof(u32); req.nbytes = cpu_to_le32(sizeof(u32));
req.value = 0; req.value = 0;
ret = rpm_reg_write_active(vreg, &req, sizeof(req)); ret = rpm_reg_write_active(vreg, &req, sizeof(req));
...@@ -113,9 +113,9 @@ static int rpm_reg_set_voltage(struct regulator_dev *rdev, ...@@ -113,9 +113,9 @@ static int rpm_reg_set_voltage(struct regulator_dev *rdev,
struct rpm_regulator_req req; struct rpm_regulator_req req;
int ret = 0; int ret = 0;
req.key = RPM_KEY_UV; req.key = cpu_to_le32(RPM_KEY_UV);
req.nbytes = sizeof(u32); req.nbytes = cpu_to_le32(sizeof(u32));
req.value = min_uV; req.value = cpu_to_le32(min_uV);
ret = rpm_reg_write_active(vreg, &req, sizeof(req)); ret = rpm_reg_write_active(vreg, &req, sizeof(req));
if (!ret) if (!ret)
...@@ -129,9 +129,9 @@ static int rpm_reg_set_load(struct regulator_dev *rdev, int load_uA) ...@@ -129,9 +129,9 @@ static int rpm_reg_set_load(struct regulator_dev *rdev, int load_uA)
struct qcom_rpm_reg *vreg = rdev_get_drvdata(rdev); struct qcom_rpm_reg *vreg = rdev_get_drvdata(rdev);
struct rpm_regulator_req req; struct rpm_regulator_req req;
req.key = RPM_KEY_MA; req.key = cpu_to_le32(RPM_KEY_MA);
req.nbytes = sizeof(u32); req.nbytes = cpu_to_le32(sizeof(u32));
req.value = load_uA; req.value = cpu_to_le32(load_uA / 1000);
return rpm_reg_write_active(vreg, &req, sizeof(req)); return rpm_reg_write_active(vreg, &req, sizeof(req));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment