mirror of https://gitee.com/openkylin/linux.git
Merge remote-tracking branches 'regulator/topic/settle', 'regulator/topic/tps65910' and 'regulator/topic/tps65917' into regulator-next
This commit is contained in:
commit
8d67f64f77
|
@ -61,6 +61,10 @@ Optional properties:
|
|||
There should be 9 entries here, one for each gpio.
|
||||
- ti,system-power-controller: Telling whether or not this pmic is controlling
|
||||
the system power.
|
||||
- ti,sleep-enable: Enable SLEEP state.
|
||||
- ti,sleep-keep-therm: Keep thermal monitoring on in sleep state.
|
||||
- ti,sleep-keep-ck32k: Keep the 32KHz clock output on in sleep state.
|
||||
- ti,sleep-keep-hsclk: Keep high speed internal clock on in sleep state.
|
||||
|
||||
Regulator Optional properties:
|
||||
- ti,regulator-ext-sleep-control: enable external sleep
|
||||
|
|
|
@ -24,6 +24,14 @@ Optional properties:
|
|||
- regulator-settling-time-us: Settling time, in microseconds, for voltage
|
||||
change if regulator have the constant time for any level voltage change.
|
||||
This is useful when regulator have exponential voltage change.
|
||||
- regulator-settling-time-up-us: Settling time, in microseconds, for voltage
|
||||
increase if the regulator needs a constant time to settle after voltage
|
||||
increases of any level. This is useful for regulators with exponential
|
||||
voltage changes.
|
||||
- regulator-settling-time-down-us: Settling time, in microseconds, for voltage
|
||||
decrease if the regulator needs a constant time to settle after voltage
|
||||
decreases of any level. This is useful for regulators with exponential
|
||||
voltage changes.
|
||||
- regulator-soft-start: Enable soft start so that voltage ramps slowly
|
||||
- regulator-state-mem sub-root node for Suspend-to-RAM mode
|
||||
: suspend to memory, the device goes to sleep, but all data stored in memory,
|
||||
|
|
|
@ -328,11 +328,7 @@ static int tps65910_sleepinit(struct tps65910 *tps65910,
|
|||
goto err_sleep_init;
|
||||
}
|
||||
|
||||
/* Return if there is no sleep keepon data. */
|
||||
if (!pmic_pdata->slp_keepon)
|
||||
return 0;
|
||||
|
||||
if (pmic_pdata->slp_keepon->therm_keepon) {
|
||||
if (pmic_pdata->slp_keepon.therm_keepon) {
|
||||
ret = tps65910_reg_set_bits(tps65910,
|
||||
TPS65910_SLEEP_KEEP_RES_ON,
|
||||
SLEEP_KEEP_RES_ON_THERM_KEEPON_MASK);
|
||||
|
@ -342,7 +338,7 @@ static int tps65910_sleepinit(struct tps65910 *tps65910,
|
|||
}
|
||||
}
|
||||
|
||||
if (pmic_pdata->slp_keepon->clkout32k_keepon) {
|
||||
if (pmic_pdata->slp_keepon.clkout32k_keepon) {
|
||||
ret = tps65910_reg_set_bits(tps65910,
|
||||
TPS65910_SLEEP_KEEP_RES_ON,
|
||||
SLEEP_KEEP_RES_ON_CLKOUT32K_KEEPON_MASK);
|
||||
|
@ -352,7 +348,7 @@ static int tps65910_sleepinit(struct tps65910 *tps65910,
|
|||
}
|
||||
}
|
||||
|
||||
if (pmic_pdata->slp_keepon->i2chs_keepon) {
|
||||
if (pmic_pdata->slp_keepon.i2chs_keepon) {
|
||||
ret = tps65910_reg_set_bits(tps65910,
|
||||
TPS65910_SLEEP_KEEP_RES_ON,
|
||||
SLEEP_KEEP_RES_ON_I2CHS_KEEPON_MASK);
|
||||
|
@ -415,6 +411,18 @@ static struct tps65910_board *tps65910_parse_dt(struct i2c_client *client,
|
|||
prop = of_property_read_bool(np, "ti,en-ck32k-xtal");
|
||||
board_info->en_ck32k_xtal = prop;
|
||||
|
||||
prop = of_property_read_bool(np, "ti,sleep-enable");
|
||||
board_info->en_dev_slp = prop;
|
||||
|
||||
prop = of_property_read_bool(np, "ti,sleep-keep-therm");
|
||||
board_info->slp_keepon.therm_keepon = prop;
|
||||
|
||||
prop = of_property_read_bool(np, "ti,sleep-keep-ck32k");
|
||||
board_info->slp_keepon.clkout32k_keepon = prop;
|
||||
|
||||
prop = of_property_read_bool(np, "ti,sleep-keep-hsclk");
|
||||
board_info->slp_keepon.i2chs_keepon = prop;
|
||||
|
||||
board_info->irq = client->irq;
|
||||
board_info->irq_base = -1;
|
||||
board_info->pm_off = of_property_read_bool(np,
|
||||
|
|
|
@ -2767,6 +2767,12 @@ static int _regulator_set_voltage_time(struct regulator_dev *rdev,
|
|||
ramp_delay = rdev->desc->ramp_delay;
|
||||
else if (rdev->constraints->settling_time)
|
||||
return rdev->constraints->settling_time;
|
||||
else if (rdev->constraints->settling_time_up &&
|
||||
(new_uV > old_uV))
|
||||
return rdev->constraints->settling_time_up;
|
||||
else if (rdev->constraints->settling_time_down &&
|
||||
(new_uV < old_uV))
|
||||
return rdev->constraints->settling_time_down;
|
||||
|
||||
if (ramp_delay == 0) {
|
||||
rdev_dbg(rdev, "ramp_delay not set\n");
|
||||
|
|
|
@ -90,6 +90,25 @@ static void of_get_regulation_constraints(struct device_node *np,
|
|||
if (!ret)
|
||||
constraints->settling_time = pval;
|
||||
|
||||
ret = of_property_read_u32(np, "regulator-settling-time-up-us", &pval);
|
||||
if (!ret)
|
||||
constraints->settling_time_up = pval;
|
||||
if (constraints->settling_time_up && constraints->settling_time) {
|
||||
pr_warn("%s: ambiguous configuration for settling time, ignoring 'regulator-settling-time-up-us'\n",
|
||||
np->name);
|
||||
constraints->settling_time_up = 0;
|
||||
}
|
||||
|
||||
ret = of_property_read_u32(np, "regulator-settling-time-down-us",
|
||||
&pval);
|
||||
if (!ret)
|
||||
constraints->settling_time_down = pval;
|
||||
if (constraints->settling_time_down && constraints->settling_time) {
|
||||
pr_warn("%s: ambiguous configuration for settling time, ignoring 'regulator-settling-time-down-us'\n",
|
||||
np->name);
|
||||
constraints->settling_time_down = 0;
|
||||
}
|
||||
|
||||
ret = of_property_read_u32(np, "regulator-enable-ramp-delay", &pval);
|
||||
if (!ret)
|
||||
constraints->enable_time = pval;
|
||||
|
|
|
@ -263,6 +263,13 @@ static struct palmas_regs_info tps65917_regs_info[] = {
|
|||
.ctrl_addr = TPS65917_SMPS5_CTRL,
|
||||
.sleep_id = TPS65917_EXTERNAL_REQSTR_ID_SMPS5,
|
||||
},
|
||||
{
|
||||
.name = "SMPS12",
|
||||
.sname = "smps1-in",
|
||||
.vsel_addr = TPS65917_SMPS1_VOLTAGE,
|
||||
.ctrl_addr = TPS65917_SMPS1_CTRL,
|
||||
.sleep_id = TPS65917_EXTERNAL_REQSTR_ID_SMPS12,
|
||||
},
|
||||
{
|
||||
.name = "LDO1",
|
||||
.sname = "ldo1-in",
|
||||
|
@ -367,6 +374,7 @@ static struct palmas_sleep_requestor_info tps65917_sleep_req_info[] = {
|
|||
EXTERNAL_REQUESTOR_TPS65917(SMPS3, 1, 2),
|
||||
EXTERNAL_REQUESTOR_TPS65917(SMPS4, 1, 3),
|
||||
EXTERNAL_REQUESTOR_TPS65917(SMPS5, 1, 4),
|
||||
EXTERNAL_REQUESTOR_TPS65917(SMPS12, 1, 5),
|
||||
EXTERNAL_REQUESTOR_TPS65917(LDO1, 2, 0),
|
||||
EXTERNAL_REQUESTOR_TPS65917(LDO2, 2, 1),
|
||||
EXTERNAL_REQUESTOR_TPS65917(LDO3, 2, 2),
|
||||
|
@ -1305,7 +1313,8 @@ static int tps65917_smps_registration(struct palmas_pmic *pmic,
|
|||
*/
|
||||
desc = &pmic->desc[id];
|
||||
desc->n_linear_ranges = 3;
|
||||
if ((id == TPS65917_REG_SMPS2) && pmic->smps12)
|
||||
if ((id == TPS65917_REG_SMPS2 || id == TPS65917_REG_SMPS1) &&
|
||||
pmic->smps12)
|
||||
continue;
|
||||
|
||||
/* Initialise sleep/init values from platform data */
|
||||
|
@ -1427,6 +1436,7 @@ static struct of_regulator_match tps65917_matches[] = {
|
|||
{ .name = "smps3", },
|
||||
{ .name = "smps4", },
|
||||
{ .name = "smps5", },
|
||||
{ .name = "smps12",},
|
||||
{ .name = "ldo1", },
|
||||
{ .name = "ldo2", },
|
||||
{ .name = "ldo3", },
|
||||
|
@ -1455,7 +1465,7 @@ static struct palmas_pmic_driver_data palmas_ddata = {
|
|||
|
||||
static struct palmas_pmic_driver_data tps65917_ddata = {
|
||||
.smps_start = TPS65917_REG_SMPS1,
|
||||
.smps_end = TPS65917_REG_SMPS5,
|
||||
.smps_end = TPS65917_REG_SMPS12,
|
||||
.ldo_begin = TPS65917_REG_LDO1,
|
||||
.ldo_end = TPS65917_REG_LDO5,
|
||||
.max_reg = TPS65917_NUM_REGS,
|
||||
|
@ -1643,8 +1653,10 @@ static int palmas_regulators_probe(struct platform_device *pdev)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (reg & PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN)
|
||||
if (reg & PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN) {
|
||||
pmic->smps123 = 1;
|
||||
pmic->smps12 = 1;
|
||||
}
|
||||
|
||||
if (reg & PALMAS_SMPS_CTRL_SMPS45_SMPS457_EN)
|
||||
pmic->smps457 = 1;
|
||||
|
|
|
@ -1107,6 +1107,7 @@ static int tps65910_probe(struct platform_device *pdev)
|
|||
|
||||
switch (tps65910_chip_id(tps65910)) {
|
||||
case TPS65910:
|
||||
BUILD_BUG_ON(TPS65910_NUM_REGS < ARRAY_SIZE(tps65910_regs));
|
||||
pmic->get_ctrl_reg = &tps65910_get_ctrl_register;
|
||||
pmic->num_regulators = ARRAY_SIZE(tps65910_regs);
|
||||
pmic->ext_sleep_control = tps65910_ext_sleep_control;
|
||||
|
@ -1119,6 +1120,7 @@ static int tps65910_probe(struct platform_device *pdev)
|
|||
DCDCCTRL_DCDCCKSYNC_MASK);
|
||||
break;
|
||||
case TPS65911:
|
||||
BUILD_BUG_ON(TPS65910_NUM_REGS < ARRAY_SIZE(tps65911_regs));
|
||||
pmic->get_ctrl_reg = &tps65911_get_ctrl_register;
|
||||
pmic->num_regulators = ARRAY_SIZE(tps65911_regs);
|
||||
pmic->ext_sleep_control = tps65911_ext_sleep_control;
|
||||
|
@ -1144,8 +1146,7 @@ static int tps65910_probe(struct platform_device *pdev)
|
|||
if (!pmic->rdev)
|
||||
return -ENOMEM;
|
||||
|
||||
for (i = 0; i < pmic->num_regulators && i < TPS65910_NUM_REGS;
|
||||
i++, info++) {
|
||||
for (i = 0; i < pmic->num_regulators; i++, info++) {
|
||||
/* Register the regulators */
|
||||
pmic->info[i] = info;
|
||||
|
||||
|
|
|
@ -250,6 +250,7 @@ enum tps65917_regulators {
|
|||
TPS65917_REG_SMPS3,
|
||||
TPS65917_REG_SMPS4,
|
||||
TPS65917_REG_SMPS5,
|
||||
TPS65917_REG_SMPS12,
|
||||
/* LDO regulators */
|
||||
TPS65917_REG_LDO1,
|
||||
TPS65917_REG_LDO2,
|
||||
|
@ -317,6 +318,7 @@ enum tps65917_external_requestor_id {
|
|||
TPS65917_EXTERNAL_REQSTR_ID_SMPS3,
|
||||
TPS65917_EXTERNAL_REQSTR_ID_SMPS4,
|
||||
TPS65917_EXTERNAL_REQSTR_ID_SMPS5,
|
||||
TPS65917_EXTERNAL_REQSTR_ID_SMPS12,
|
||||
TPS65917_EXTERNAL_REQSTR_ID_LDO1,
|
||||
TPS65917_EXTERNAL_REQSTR_ID_LDO2,
|
||||
TPS65917_EXTERNAL_REQSTR_ID_LDO3,
|
||||
|
|
|
@ -879,7 +879,7 @@ struct tps65910_board {
|
|||
bool en_ck32k_xtal;
|
||||
bool en_dev_slp;
|
||||
bool pm_off;
|
||||
struct tps65910_sleep_keepon_data *slp_keepon;
|
||||
struct tps65910_sleep_keepon_data slp_keepon;
|
||||
bool en_gpio_sleep[TPS6591X_MAX_NUM_GPIO];
|
||||
unsigned long regulator_ext_sleep_control[TPS65910_NUM_REGS];
|
||||
struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS];
|
||||
|
|
|
@ -110,6 +110,10 @@ struct regulator_state {
|
|||
* @ramp_delay: Time to settle down after voltage change (unit: uV/us)
|
||||
* @settling_time: Time to settle down after voltage change when voltage
|
||||
* change is non-linear (unit: microseconds).
|
||||
* @settling_time_up: Time to settle down after voltage increase when voltage
|
||||
* change is non-linear (unit: microseconds).
|
||||
* @settling_time_down : Time to settle down after voltage decrease when
|
||||
* voltage change is non-linear (unit: microseconds).
|
||||
* @active_discharge: Enable/disable active discharge. The enum
|
||||
* regulator_active_discharge values are used for
|
||||
* initialisation.
|
||||
|
@ -152,6 +156,8 @@ struct regulation_constraints {
|
|||
|
||||
unsigned int ramp_delay;
|
||||
unsigned int settling_time;
|
||||
unsigned int settling_time_up;
|
||||
unsigned int settling_time_down;
|
||||
unsigned int enable_time;
|
||||
|
||||
unsigned int active_discharge;
|
||||
|
|
Loading…
Reference in New Issue