Merge remote-tracking branches 'regulator/topic/gpio', 'regulator/topic/lp873x', 'regulator/topic/max77620', 'regulator/topic/pwm' and 'regulator/topic/tps6507x' into regulator-next

This commit is contained in:
Mark Brown
2016-12-12 12:17:27 +00:00
8 changed files with 78 additions and 7 deletions
+6 -3
View File
@@ -162,8 +162,8 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np,
of_property_read_u32(np, "startup-delay-us", &config->startup_delay);
config->enable_gpio = of_get_named_gpio(np, "enable-gpio", 0);
if (config->enable_gpio == -EPROBE_DEFER)
return ERR_PTR(-EPROBE_DEFER);
if (config->enable_gpio < 0 && config->enable_gpio != -ENOENT)
return ERR_PTR(config->enable_gpio);
/* Fetch GPIOs. - optional property*/
ret = of_gpio_count(np);
@@ -190,8 +190,11 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np,
for (i = 0; i < config->nr_gpios; i++) {
gpio = of_get_named_gpio(np, "gpios", i);
if (gpio < 0)
if (gpio < 0) {
if (gpio != -ENOENT)
return ERR_PTR(gpio);
break;
}
config->gpios[i].gpio = gpio;
if (proplen > 0) {
of_property_read_u32_index(np, "gpios-states",
+1
View File
@@ -24,6 +24,7 @@
[_id] = { \
.desc = { \
.name = _name, \
.supply_name = _of "-in", \
.id = _id, \
.of_match = of_match_ptr(_of), \
.regulators_node = of_match_ptr("regulators"),\
+46 -1
View File
@@ -73,7 +73,6 @@ struct max77620_regulator_info {
};
struct max77620_regulator_pdata {
struct regulator_init_data *reg_idata;
int active_fps_src;
int active_fps_pd_slot;
int active_fps_pu_slot;
@@ -81,6 +80,7 @@ struct max77620_regulator_pdata {
int suspend_fps_pd_slot;
int suspend_fps_pu_slot;
int current_mode;
int power_ok;
int ramp_rate_setting;
};
@@ -351,11 +351,48 @@ static int max77620_set_slew_rate(struct max77620_regulator *pmic, int id,
return 0;
}
static int max77620_config_power_ok(struct max77620_regulator *pmic, int id)
{
struct max77620_regulator_pdata *rpdata = &pmic->reg_pdata[id];
struct max77620_regulator_info *rinfo = pmic->rinfo[id];
struct max77620_chip *chip = dev_get_drvdata(pmic->dev->parent);
u8 val, mask;
int ret;
switch (chip->chip_id) {
case MAX20024:
if (rpdata->power_ok >= 0) {
if (rinfo->type == MAX77620_REGULATOR_TYPE_SD)
mask = MAX20024_SD_CFG1_MPOK_MASK;
else
mask = MAX20024_LDO_CFG2_MPOK_MASK;
val = rpdata->power_ok ? mask : 0;
ret = regmap_update_bits(pmic->rmap, rinfo->cfg_addr,
mask, val);
if (ret < 0) {
dev_err(pmic->dev, "Reg 0x%02x update failed %d\n",
rinfo->cfg_addr, ret);
return ret;
}
}
break;
default:
break;
}
return 0;
}
static int max77620_init_pmic(struct max77620_regulator *pmic, int id)
{
struct max77620_regulator_pdata *rpdata = &pmic->reg_pdata[id];
int ret;
max77620_config_power_ok(pmic, id);
/* Update power mode */
ret = max77620_regulator_get_power_mode(pmic, id);
if (ret < 0)
@@ -595,6 +632,12 @@ static int max77620_of_parse_cb(struct device_node *np,
np, "maxim,suspend-fps-power-down-slot", &pval);
rpdata->suspend_fps_pd_slot = (!ret) ? pval : -1;
ret = of_property_read_u32(np, "maxim,power-ok-control", &pval);
if (!ret)
rpdata->power_ok = pval;
else
rpdata->power_ok = -1;
ret = of_property_read_u32(np, "maxim,ramp-rate-setting", &pval);
rpdata->ramp_rate_setting = (!ret) ? pval : 0;
@@ -807,6 +850,8 @@ static int max77620_regulator_resume(struct device *dev)
for (id = 0; id < MAX77620_NUM_REGS; id++) {
reg_pdata = &pmic->reg_pdata[id];
max77620_config_power_ok(pmic, id);
max77620_regulator_set_fps_slots(pmic, id, false);
if (reg_pdata->active_fps_src < 0)
continue;
+1 -1
View File
@@ -375,7 +375,7 @@ static struct tps6507x_board *tps6507x_parse_dt_reg_data(
struct device_node *np = pdev->dev.parent->of_node;
struct device_node *regulators;
struct of_regulator_match *matches;
static struct regulator_init_data *reg_data;
struct regulator_init_data *reg_data;
int idx = 0, count, ret;
tps_board = devm_kzalloc(&pdev->dev, sizeof(*tps_board),