Loading Documentation/devicetree/bindings/mfd/s2mps11.txt +14 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,20 @@ for a particular group of BUCKs. So provide same regulator-ramp-delay<value>. Grouping of BUCKs sharing ramp rate setting is as follow : BUCK[1, 6], BUCK[3, 4], and BUCK[7, 8, 10] On S2MPS14 the LDO10, LDO11 and LDO12 can be configured to external control over GPIO. To turn this feature on this property must be added to the regulator sub-node: - samsung,ext-control-gpios: GPIO specifier for one GPIO controlling this regulator (enable/disable); Example: LDO12 { regulator-name = "V_EMMC_2.8V"; regulator-min-microvolt = <2800000>; regulator-max-microvolt = <2800000>; samsung,ext-control-gpios = <&gpk0 2 0>; }; The regulator constraints inside the regulator nodes use the standard regulator bindings which are documented elsewhere. Loading drivers/regulator/palmas-regulator.c +26 −132 Original line number Diff line number Diff line Loading @@ -36,6 +36,18 @@ struct regs_info { int sleep_id; }; static const struct regulator_linear_range smps_low_ranges[] = { REGULATOR_LINEAR_RANGE(500000, 0x1, 0x6, 0), REGULATOR_LINEAR_RANGE(510000, 0x7, 0x79, 10000), REGULATOR_LINEAR_RANGE(1650000, 0x7A, 0x7f, 0), }; static const struct regulator_linear_range smps_high_ranges[] = { REGULATOR_LINEAR_RANGE(1000000, 0x1, 0x6, 0), REGULATOR_LINEAR_RANGE(1020000, 0x7, 0x79, 20000), REGULATOR_LINEAR_RANGE(3300000, 0x7A, 0x7f, 0), }; static const struct regs_info palmas_regs_info[] = { { .name = "SMPS12", Loading Loading @@ -280,54 +292,6 @@ static int palmas_ldo_write(struct palmas *palmas, unsigned int reg, return regmap_write(palmas->regmap[REGULATOR_SLAVE], addr, value); } static int palmas_is_enabled_smps(struct regulator_dev *dev) { struct palmas_pmic *pmic = rdev_get_drvdata(dev); int id = rdev_get_id(dev); unsigned int reg; palmas_smps_read(pmic->palmas, palmas_regs_info[id].ctrl_addr, ®); reg &= PALMAS_SMPS12_CTRL_STATUS_MASK; reg >>= PALMAS_SMPS12_CTRL_STATUS_SHIFT; return !!(reg); } static int palmas_enable_smps(struct regulator_dev *dev) { struct palmas_pmic *pmic = rdev_get_drvdata(dev); int id = rdev_get_id(dev); unsigned int reg; palmas_smps_read(pmic->palmas, palmas_regs_info[id].ctrl_addr, ®); reg &= ~PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK; if (pmic->current_reg_mode[id]) reg |= pmic->current_reg_mode[id]; else reg |= SMPS_CTRL_MODE_ON; palmas_smps_write(pmic->palmas, palmas_regs_info[id].ctrl_addr, reg); return 0; } static int palmas_disable_smps(struct regulator_dev *dev) { struct palmas_pmic *pmic = rdev_get_drvdata(dev); int id = rdev_get_id(dev); unsigned int reg; palmas_smps_read(pmic->palmas, palmas_regs_info[id].ctrl_addr, ®); reg &= ~PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK; palmas_smps_write(pmic->palmas, palmas_regs_info[id].ctrl_addr, reg); return 0; } static int palmas_set_mode_smps(struct regulator_dev *dev, unsigned int mode) { struct palmas_pmic *pmic = rdev_get_drvdata(dev); Loading Loading @@ -382,81 +346,6 @@ static unsigned int palmas_get_mode_smps(struct regulator_dev *dev) return 0; } static int palmas_list_voltage_smps(struct regulator_dev *dev, unsigned selector) { struct palmas_pmic *pmic = rdev_get_drvdata(dev); int id = rdev_get_id(dev); int mult = 1; /* Read the multiplier set in VSEL register to return * the correct voltage. */ if (pmic->range[id]) mult = 2; if (selector == 0) return 0; else if (selector < 6) return 500000 * mult; else /* Voltage is linear mapping starting from selector 6, * volt = (0.49V + ((selector - 5) * 0.01V)) * RANGE * RANGE is either x1 or x2 */ return (490000 + ((selector - 5) * 10000)) * mult; } static int palmas_map_voltage_smps(struct regulator_dev *rdev, int min_uV, int max_uV) { struct palmas_pmic *pmic = rdev_get_drvdata(rdev); int id = rdev_get_id(rdev); int ret, voltage; if (min_uV == 0) return 0; if (pmic->range[id]) { /* RANGE is x2 */ if (min_uV < 1000000) min_uV = 1000000; ret = DIV_ROUND_UP(min_uV - 1000000, 20000) + 6; } else { /* RANGE is x1 */ if (min_uV < 500000) min_uV = 500000; ret = DIV_ROUND_UP(min_uV - 500000, 10000) + 6; } /* Map back into a voltage to verify we're still in bounds */ voltage = palmas_list_voltage_smps(rdev, ret); if (voltage < min_uV || voltage > max_uV) return -EINVAL; return ret; } static int palma_smps_set_voltage_smps_time_sel(struct regulator_dev *rdev, unsigned int old_selector, unsigned int new_selector) { struct palmas_pmic *pmic = rdev_get_drvdata(rdev); int id = rdev_get_id(rdev); int old_uv, new_uv; unsigned int ramp_delay = pmic->ramp_delay[id]; if (!ramp_delay) return 0; old_uv = palmas_list_voltage_smps(rdev, old_selector); if (old_uv < 0) return old_uv; new_uv = palmas_list_voltage_smps(rdev, new_selector); if (new_uv < 0) return new_uv; return DIV_ROUND_UP(abs(old_uv - new_uv), ramp_delay); } static int palmas_smps_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay) { Loading Loading @@ -493,16 +382,16 @@ static int palmas_smps_set_ramp_delay(struct regulator_dev *rdev, } static struct regulator_ops palmas_ops_smps = { .is_enabled = palmas_is_enabled_smps, .enable = palmas_enable_smps, .disable = palmas_disable_smps, .is_enabled = regulator_is_enabled_regmap, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .set_mode = palmas_set_mode_smps, .get_mode = palmas_get_mode_smps, .get_voltage_sel = regulator_get_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap, .list_voltage = palmas_list_voltage_smps, .map_voltage = palmas_map_voltage_smps, .set_voltage_time_sel = palma_smps_set_voltage_smps_time_sel, .list_voltage = regulator_list_voltage_linear_range, .map_voltage = regulator_map_voltage_linear_range, .set_voltage_time_sel = regulator_set_voltage_time_sel, .set_ramp_delay = palmas_smps_set_ramp_delay, }; Loading @@ -511,9 +400,9 @@ static struct regulator_ops palmas_ops_ext_control_smps = { .get_mode = palmas_get_mode_smps, .get_voltage_sel = regulator_get_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap, .list_voltage = palmas_list_voltage_smps, .map_voltage = palmas_map_voltage_smps, .set_voltage_time_sel = palma_smps_set_voltage_smps_time_sel, .list_voltage = regulator_list_voltage_linear_range, .map_voltage = regulator_map_voltage_linear_range, .set_voltage_time_sel = regulator_set_voltage_time_sel, .set_ramp_delay = palmas_smps_set_ramp_delay, }; Loading Loading @@ -1042,12 +931,17 @@ static int palmas_regulators_probe(struct platform_device *pdev) * ranges. Read the current smps mode for later use. */ addr = palmas_regs_info[id].vsel_addr; pmic->desc[id].n_linear_ranges = 3; ret = palmas_smps_read(pmic->palmas, addr, ®); if (ret) return ret; if (reg & PALMAS_SMPS12_VOLTAGE_RANGE) pmic->range[id] = 1; if (pmic->range[id]) pmic->desc[id].linear_ranges = smps_high_ranges; else pmic->desc[id].linear_ranges = smps_low_ranges; if (reg_init && reg_init->roof_floor) pmic->desc[id].ops = Loading drivers/regulator/pbias-regulator.c +4 −25 Original line number Diff line number Diff line Loading @@ -49,33 +49,13 @@ static const unsigned int pbias_volt_table[] = { 3000000 }; static int pbias_regulator_enable(struct regulator_dev *rdev) { struct pbias_regulator_data *data = rdev_get_drvdata(rdev); const struct pbias_reg_info *info = data->info; return regmap_update_bits(data->syscon, rdev->desc->enable_reg, info->enable_mask, info->enable); } static int pbias_regulator_is_enable(struct regulator_dev *rdev) { struct pbias_regulator_data *data = rdev_get_drvdata(rdev); const struct pbias_reg_info *info = data->info; int value; regmap_read(data->syscon, rdev->desc->enable_reg, &value); return (value & info->enable_mask) == info->enable; } static struct regulator_ops pbias_regulator_voltage_ops = { .list_voltage = regulator_list_voltage_table, .get_voltage_sel = regulator_get_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap, .enable = pbias_regulator_enable, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .is_enabled = pbias_regulator_is_enable, .is_enabled = regulator_is_enabled_regmap, }; static const struct pbias_reg_info pbias_mmc_omap2430 = { Loading Loading @@ -142,10 +122,8 @@ static int pbias_regulator_probe(struct platform_device *pdev) drvdata = devm_kzalloc(&pdev->dev, sizeof(struct pbias_regulator_data) * count, GFP_KERNEL); if (drvdata == NULL) { dev_err(&pdev->dev, "Failed to allocate device data\n"); if (!drvdata) return -ENOMEM; } syscon = syscon_regmap_lookup_by_phandle(np, "syscon"); if (IS_ERR(syscon)) Loading Loading @@ -180,6 +158,7 @@ static int pbias_regulator_probe(struct platform_device *pdev) drvdata[data_idx].desc.vsel_mask = info->vmode; drvdata[data_idx].desc.enable_reg = res->start; drvdata[data_idx].desc.enable_mask = info->enable_mask; drvdata[data_idx].desc.enable_val = info->enable; cfg.init_data = pbias_matches[idx].init_data; cfg.driver_data = &drvdata[data_idx]; Loading drivers/regulator/pfuze100-regulator.c +8 −0 Original line number Diff line number Diff line Loading @@ -125,6 +125,9 @@ static struct regulator_ops pfuze100_ldo_regulator_ops = { }; static struct regulator_ops pfuze100_fixed_regulator_ops = { .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .is_enabled = regulator_is_enabled_regmap, .list_voltage = regulator_list_voltage_linear, }; Loading @@ -137,6 +140,8 @@ static struct regulator_ops pfuze100_sw_regulator_ops = { }; static struct regulator_ops pfuze100_swb_regulator_ops = { .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .list_voltage = regulator_list_voltage_table, .map_voltage = regulator_map_voltage_ascend, .set_voltage_sel = regulator_set_voltage_sel_regmap, Loading Loading @@ -189,6 +194,8 @@ static struct regulator_ops pfuze100_swb_regulator_ops = { .volt_table = voltages, \ .vsel_reg = (base), \ .vsel_mask = (mask), \ .enable_reg = (base), \ .enable_mask = 0x48, \ }, \ } Loading Loading @@ -502,6 +509,7 @@ static int pfuze100_regulator_probe(struct i2c_client *client, config.init_data = init_data; config.driver_data = pfuze_chip; config.of_node = match_of_node(i); config.ena_gpio = -EINVAL; pfuze_chip->regulators[i] = devm_regulator_register(&client->dev, desc, &config); Loading drivers/regulator/s2mpa01.c +11 −7 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ static int s2mpa01_regulator_set_voltage_time_sel(struct regulator_dev *rdev, unsigned int ramp_delay = 0; int old_volt, new_volt; switch (rdev->desc->id) { switch (rdev_get_id(rdev)) { case S2MPA01_BUCK2: case S2MPA01_BUCK4: ramp_delay = s2mpa01->ramp_delay24; Loading Loading @@ -102,7 +102,7 @@ static int s2mpa01_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay) unsigned int ramp_enable = 1, enable_shift = 0; int ret; switch (rdev->desc->id) { switch (rdev_get_id(rdev)) { case S2MPA01_BUCK1: enable_shift = S2MPA01_BUCK1_RAMP_EN_SHIFT; if (!ramp_delay) { Loading Loading @@ -191,12 +191,16 @@ static int s2mpa01_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay) if (!ramp_enable) goto ramp_disable; /* Ramp delay can be enabled/disabled only for buck[1234] */ if (rdev_get_id(rdev) >= S2MPA01_BUCK1 && rdev_get_id(rdev) <= S2MPA01_BUCK4) { ret = regmap_update_bits(rdev->regmap, S2MPA01_REG_RAMP1, 1 << enable_shift, 1 << enable_shift); if (ret) { dev_err(&rdev->dev, "failed to enable ramp rate\n"); return ret; } } ramp_val = get_ramp_delay(ramp_delay); Loading Loading
Documentation/devicetree/bindings/mfd/s2mps11.txt +14 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,20 @@ for a particular group of BUCKs. So provide same regulator-ramp-delay<value>. Grouping of BUCKs sharing ramp rate setting is as follow : BUCK[1, 6], BUCK[3, 4], and BUCK[7, 8, 10] On S2MPS14 the LDO10, LDO11 and LDO12 can be configured to external control over GPIO. To turn this feature on this property must be added to the regulator sub-node: - samsung,ext-control-gpios: GPIO specifier for one GPIO controlling this regulator (enable/disable); Example: LDO12 { regulator-name = "V_EMMC_2.8V"; regulator-min-microvolt = <2800000>; regulator-max-microvolt = <2800000>; samsung,ext-control-gpios = <&gpk0 2 0>; }; The regulator constraints inside the regulator nodes use the standard regulator bindings which are documented elsewhere. Loading
drivers/regulator/palmas-regulator.c +26 −132 Original line number Diff line number Diff line Loading @@ -36,6 +36,18 @@ struct regs_info { int sleep_id; }; static const struct regulator_linear_range smps_low_ranges[] = { REGULATOR_LINEAR_RANGE(500000, 0x1, 0x6, 0), REGULATOR_LINEAR_RANGE(510000, 0x7, 0x79, 10000), REGULATOR_LINEAR_RANGE(1650000, 0x7A, 0x7f, 0), }; static const struct regulator_linear_range smps_high_ranges[] = { REGULATOR_LINEAR_RANGE(1000000, 0x1, 0x6, 0), REGULATOR_LINEAR_RANGE(1020000, 0x7, 0x79, 20000), REGULATOR_LINEAR_RANGE(3300000, 0x7A, 0x7f, 0), }; static const struct regs_info palmas_regs_info[] = { { .name = "SMPS12", Loading Loading @@ -280,54 +292,6 @@ static int palmas_ldo_write(struct palmas *palmas, unsigned int reg, return regmap_write(palmas->regmap[REGULATOR_SLAVE], addr, value); } static int palmas_is_enabled_smps(struct regulator_dev *dev) { struct palmas_pmic *pmic = rdev_get_drvdata(dev); int id = rdev_get_id(dev); unsigned int reg; palmas_smps_read(pmic->palmas, palmas_regs_info[id].ctrl_addr, ®); reg &= PALMAS_SMPS12_CTRL_STATUS_MASK; reg >>= PALMAS_SMPS12_CTRL_STATUS_SHIFT; return !!(reg); } static int palmas_enable_smps(struct regulator_dev *dev) { struct palmas_pmic *pmic = rdev_get_drvdata(dev); int id = rdev_get_id(dev); unsigned int reg; palmas_smps_read(pmic->palmas, palmas_regs_info[id].ctrl_addr, ®); reg &= ~PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK; if (pmic->current_reg_mode[id]) reg |= pmic->current_reg_mode[id]; else reg |= SMPS_CTRL_MODE_ON; palmas_smps_write(pmic->palmas, palmas_regs_info[id].ctrl_addr, reg); return 0; } static int palmas_disable_smps(struct regulator_dev *dev) { struct palmas_pmic *pmic = rdev_get_drvdata(dev); int id = rdev_get_id(dev); unsigned int reg; palmas_smps_read(pmic->palmas, palmas_regs_info[id].ctrl_addr, ®); reg &= ~PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK; palmas_smps_write(pmic->palmas, palmas_regs_info[id].ctrl_addr, reg); return 0; } static int palmas_set_mode_smps(struct regulator_dev *dev, unsigned int mode) { struct palmas_pmic *pmic = rdev_get_drvdata(dev); Loading Loading @@ -382,81 +346,6 @@ static unsigned int palmas_get_mode_smps(struct regulator_dev *dev) return 0; } static int palmas_list_voltage_smps(struct regulator_dev *dev, unsigned selector) { struct palmas_pmic *pmic = rdev_get_drvdata(dev); int id = rdev_get_id(dev); int mult = 1; /* Read the multiplier set in VSEL register to return * the correct voltage. */ if (pmic->range[id]) mult = 2; if (selector == 0) return 0; else if (selector < 6) return 500000 * mult; else /* Voltage is linear mapping starting from selector 6, * volt = (0.49V + ((selector - 5) * 0.01V)) * RANGE * RANGE is either x1 or x2 */ return (490000 + ((selector - 5) * 10000)) * mult; } static int palmas_map_voltage_smps(struct regulator_dev *rdev, int min_uV, int max_uV) { struct palmas_pmic *pmic = rdev_get_drvdata(rdev); int id = rdev_get_id(rdev); int ret, voltage; if (min_uV == 0) return 0; if (pmic->range[id]) { /* RANGE is x2 */ if (min_uV < 1000000) min_uV = 1000000; ret = DIV_ROUND_UP(min_uV - 1000000, 20000) + 6; } else { /* RANGE is x1 */ if (min_uV < 500000) min_uV = 500000; ret = DIV_ROUND_UP(min_uV - 500000, 10000) + 6; } /* Map back into a voltage to verify we're still in bounds */ voltage = palmas_list_voltage_smps(rdev, ret); if (voltage < min_uV || voltage > max_uV) return -EINVAL; return ret; } static int palma_smps_set_voltage_smps_time_sel(struct regulator_dev *rdev, unsigned int old_selector, unsigned int new_selector) { struct palmas_pmic *pmic = rdev_get_drvdata(rdev); int id = rdev_get_id(rdev); int old_uv, new_uv; unsigned int ramp_delay = pmic->ramp_delay[id]; if (!ramp_delay) return 0; old_uv = palmas_list_voltage_smps(rdev, old_selector); if (old_uv < 0) return old_uv; new_uv = palmas_list_voltage_smps(rdev, new_selector); if (new_uv < 0) return new_uv; return DIV_ROUND_UP(abs(old_uv - new_uv), ramp_delay); } static int palmas_smps_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay) { Loading Loading @@ -493,16 +382,16 @@ static int palmas_smps_set_ramp_delay(struct regulator_dev *rdev, } static struct regulator_ops palmas_ops_smps = { .is_enabled = palmas_is_enabled_smps, .enable = palmas_enable_smps, .disable = palmas_disable_smps, .is_enabled = regulator_is_enabled_regmap, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .set_mode = palmas_set_mode_smps, .get_mode = palmas_get_mode_smps, .get_voltage_sel = regulator_get_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap, .list_voltage = palmas_list_voltage_smps, .map_voltage = palmas_map_voltage_smps, .set_voltage_time_sel = palma_smps_set_voltage_smps_time_sel, .list_voltage = regulator_list_voltage_linear_range, .map_voltage = regulator_map_voltage_linear_range, .set_voltage_time_sel = regulator_set_voltage_time_sel, .set_ramp_delay = palmas_smps_set_ramp_delay, }; Loading @@ -511,9 +400,9 @@ static struct regulator_ops palmas_ops_ext_control_smps = { .get_mode = palmas_get_mode_smps, .get_voltage_sel = regulator_get_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap, .list_voltage = palmas_list_voltage_smps, .map_voltage = palmas_map_voltage_smps, .set_voltage_time_sel = palma_smps_set_voltage_smps_time_sel, .list_voltage = regulator_list_voltage_linear_range, .map_voltage = regulator_map_voltage_linear_range, .set_voltage_time_sel = regulator_set_voltage_time_sel, .set_ramp_delay = palmas_smps_set_ramp_delay, }; Loading Loading @@ -1042,12 +931,17 @@ static int palmas_regulators_probe(struct platform_device *pdev) * ranges. Read the current smps mode for later use. */ addr = palmas_regs_info[id].vsel_addr; pmic->desc[id].n_linear_ranges = 3; ret = palmas_smps_read(pmic->palmas, addr, ®); if (ret) return ret; if (reg & PALMAS_SMPS12_VOLTAGE_RANGE) pmic->range[id] = 1; if (pmic->range[id]) pmic->desc[id].linear_ranges = smps_high_ranges; else pmic->desc[id].linear_ranges = smps_low_ranges; if (reg_init && reg_init->roof_floor) pmic->desc[id].ops = Loading
drivers/regulator/pbias-regulator.c +4 −25 Original line number Diff line number Diff line Loading @@ -49,33 +49,13 @@ static const unsigned int pbias_volt_table[] = { 3000000 }; static int pbias_regulator_enable(struct regulator_dev *rdev) { struct pbias_regulator_data *data = rdev_get_drvdata(rdev); const struct pbias_reg_info *info = data->info; return regmap_update_bits(data->syscon, rdev->desc->enable_reg, info->enable_mask, info->enable); } static int pbias_regulator_is_enable(struct regulator_dev *rdev) { struct pbias_regulator_data *data = rdev_get_drvdata(rdev); const struct pbias_reg_info *info = data->info; int value; regmap_read(data->syscon, rdev->desc->enable_reg, &value); return (value & info->enable_mask) == info->enable; } static struct regulator_ops pbias_regulator_voltage_ops = { .list_voltage = regulator_list_voltage_table, .get_voltage_sel = regulator_get_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap, .enable = pbias_regulator_enable, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .is_enabled = pbias_regulator_is_enable, .is_enabled = regulator_is_enabled_regmap, }; static const struct pbias_reg_info pbias_mmc_omap2430 = { Loading Loading @@ -142,10 +122,8 @@ static int pbias_regulator_probe(struct platform_device *pdev) drvdata = devm_kzalloc(&pdev->dev, sizeof(struct pbias_regulator_data) * count, GFP_KERNEL); if (drvdata == NULL) { dev_err(&pdev->dev, "Failed to allocate device data\n"); if (!drvdata) return -ENOMEM; } syscon = syscon_regmap_lookup_by_phandle(np, "syscon"); if (IS_ERR(syscon)) Loading Loading @@ -180,6 +158,7 @@ static int pbias_regulator_probe(struct platform_device *pdev) drvdata[data_idx].desc.vsel_mask = info->vmode; drvdata[data_idx].desc.enable_reg = res->start; drvdata[data_idx].desc.enable_mask = info->enable_mask; drvdata[data_idx].desc.enable_val = info->enable; cfg.init_data = pbias_matches[idx].init_data; cfg.driver_data = &drvdata[data_idx]; Loading
drivers/regulator/pfuze100-regulator.c +8 −0 Original line number Diff line number Diff line Loading @@ -125,6 +125,9 @@ static struct regulator_ops pfuze100_ldo_regulator_ops = { }; static struct regulator_ops pfuze100_fixed_regulator_ops = { .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .is_enabled = regulator_is_enabled_regmap, .list_voltage = regulator_list_voltage_linear, }; Loading @@ -137,6 +140,8 @@ static struct regulator_ops pfuze100_sw_regulator_ops = { }; static struct regulator_ops pfuze100_swb_regulator_ops = { .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .list_voltage = regulator_list_voltage_table, .map_voltage = regulator_map_voltage_ascend, .set_voltage_sel = regulator_set_voltage_sel_regmap, Loading Loading @@ -189,6 +194,8 @@ static struct regulator_ops pfuze100_swb_regulator_ops = { .volt_table = voltages, \ .vsel_reg = (base), \ .vsel_mask = (mask), \ .enable_reg = (base), \ .enable_mask = 0x48, \ }, \ } Loading Loading @@ -502,6 +509,7 @@ static int pfuze100_regulator_probe(struct i2c_client *client, config.init_data = init_data; config.driver_data = pfuze_chip; config.of_node = match_of_node(i); config.ena_gpio = -EINVAL; pfuze_chip->regulators[i] = devm_regulator_register(&client->dev, desc, &config); Loading
drivers/regulator/s2mpa01.c +11 −7 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ static int s2mpa01_regulator_set_voltage_time_sel(struct regulator_dev *rdev, unsigned int ramp_delay = 0; int old_volt, new_volt; switch (rdev->desc->id) { switch (rdev_get_id(rdev)) { case S2MPA01_BUCK2: case S2MPA01_BUCK4: ramp_delay = s2mpa01->ramp_delay24; Loading Loading @@ -102,7 +102,7 @@ static int s2mpa01_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay) unsigned int ramp_enable = 1, enable_shift = 0; int ret; switch (rdev->desc->id) { switch (rdev_get_id(rdev)) { case S2MPA01_BUCK1: enable_shift = S2MPA01_BUCK1_RAMP_EN_SHIFT; if (!ramp_delay) { Loading Loading @@ -191,12 +191,16 @@ static int s2mpa01_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay) if (!ramp_enable) goto ramp_disable; /* Ramp delay can be enabled/disabled only for buck[1234] */ if (rdev_get_id(rdev) >= S2MPA01_BUCK1 && rdev_get_id(rdev) <= S2MPA01_BUCK4) { ret = regmap_update_bits(rdev->regmap, S2MPA01_REG_RAMP1, 1 << enable_shift, 1 << enable_shift); if (ret) { dev_err(&rdev->dev, "failed to enable ramp rate\n"); return ret; } } ramp_val = get_ramp_delay(ramp_delay); Loading