Lines Matching +full:pmic +full:- +full:buck2 +full:- +full:uses +full:- +full:gpio +full:- +full:dvs

1 // SPDX-License-Identifier: GPL-2.0+
9 #include <linux/gpio/consumer.h>
171 *reg = S5M8767_REG_LDO1CTRL + (reg_id - S5M8767_LDO1); in s5m8767_get_register()
174 *reg = S5M8767_REG_LDO3CTRL + (reg_id - S5M8767_LDO3); in s5m8767_get_register()
180 *reg = S5M8767_REG_BUCK2CTRL + (reg_id - S5M8767_BUCK2) * 9; in s5m8767_get_register()
186 *reg = S5M8767_REG_BUCK6CTRL1 + (reg_id - S5M8767_BUCK6) * 2; in s5m8767_get_register()
189 return -EINVAL; in s5m8767_get_register()
192 for (i = 0; i < s5m8767->num_regulators; i++) { in s5m8767_get_register()
193 if (s5m8767->opmode[i].id == reg_id) { in s5m8767_get_register()
194 mode = s5m8767->opmode[i].mode; in s5m8767_get_register()
199 if (i >= s5m8767->num_regulators) in s5m8767_get_register()
200 return -EINVAL; in s5m8767_get_register()
213 reg = S5M8767_REG_LDO1CTRL + (reg_id - S5M8767_LDO1); in s5m8767_get_vsel_reg()
216 reg = S5M8767_REG_LDO3CTRL + (reg_id - S5M8767_LDO3); in s5m8767_get_vsel_reg()
223 if (s5m8767->buck2_gpiodvs) in s5m8767_get_vsel_reg()
224 reg += s5m8767->buck_gpioindex; in s5m8767_get_vsel_reg()
228 if (s5m8767->buck3_gpiodvs) in s5m8767_get_vsel_reg()
229 reg += s5m8767->buck_gpioindex; in s5m8767_get_vsel_reg()
233 if (s5m8767->buck4_gpiodvs) in s5m8767_get_vsel_reg()
234 reg += s5m8767->buck_gpioindex; in s5m8767_get_vsel_reg()
240 reg = S5M8767_REG_BUCK6CTRL2 + (reg_id - S5M8767_BUCK6) * 2; in s5m8767_get_vsel_reg()
243 return -EINVAL; in s5m8767_get_vsel_reg()
255 return -EINVAL; in s5m8767_convert_voltage_to_sel()
257 if (min_vol > desc->max) in s5m8767_convert_voltage_to_sel()
258 return -EINVAL; in s5m8767_convert_voltage_to_sel()
260 if (min_vol < desc->min) in s5m8767_convert_voltage_to_sel()
261 min_vol = desc->min; in s5m8767_convert_voltage_to_sel()
263 selector = DIV_ROUND_UP(min_vol - desc->min, desc->step); in s5m8767_convert_voltage_to_sel()
265 if (desc->min + desc->step * selector > desc->max) in s5m8767_convert_voltage_to_sel()
266 return -EINVAL; in s5m8767_convert_voltage_to_sel()
273 int temp_index = s5m8767->buck_gpioindex; in s5m8767_set_high()
275 gpio_set_value(s5m8767->buck_gpios[0], (temp_index >> 2) & 0x1); in s5m8767_set_high()
276 gpio_set_value(s5m8767->buck_gpios[1], (temp_index >> 1) & 0x1); in s5m8767_set_high()
277 gpio_set_value(s5m8767->buck_gpios[2], temp_index & 0x1); in s5m8767_set_high()
284 int temp_index = s5m8767->buck_gpioindex; in s5m8767_set_low()
286 gpio_set_value(s5m8767->buck_gpios[2], temp_index & 0x1); in s5m8767_set_low()
287 gpio_set_value(s5m8767->buck_gpios[1], (temp_index >> 1) & 0x1); in s5m8767_set_low()
288 gpio_set_value(s5m8767->buck_gpios[0], (temp_index >> 2) & 0x1); in s5m8767_set_low()
305 if (reg_id == S5M8767_BUCK2 && s5m8767->buck2_gpiodvs) in s5m8767_set_voltage_sel()
306 buck234_vol = &s5m8767->buck2_vol[0]; in s5m8767_set_voltage_sel()
307 else if (reg_id == S5M8767_BUCK3 && s5m8767->buck3_gpiodvs) in s5m8767_set_voltage_sel()
308 buck234_vol = &s5m8767->buck3_vol[0]; in s5m8767_set_voltage_sel()
309 else if (reg_id == S5M8767_BUCK4 && s5m8767->buck4_gpiodvs) in s5m8767_set_voltage_sel()
310 buck234_vol = &s5m8767->buck4_vol[0]; in s5m8767_set_voltage_sel()
313 return -EINVAL; in s5m8767_set_voltage_sel()
317 return -EINVAL; in s5m8767_set_voltage_sel()
320 /* buck234_vol != NULL means to control buck234 voltage via DVS GPIO */ in s5m8767_set_voltage_sel()
326 old_index = s5m8767->buck_gpioindex; in s5m8767_set_voltage_sel()
327 s5m8767->buck_gpioindex = index; in s5m8767_set_voltage_sel()
344 if ((old_sel < new_sel) && s5m8767->ramp_delay) in s5m8767_set_voltage_time_sel()
345 return DIV_ROUND_UP(rdev->desc->uV_step * (new_sel - old_sel), in s5m8767_set_voltage_time_sel()
346 s5m8767->ramp_delay * 1000); in s5m8767_set_voltage_time_sel()
415 s5m8767_regulator_desc(BUCK2),
426 * Enable GPIO control over BUCK9 in regulator_config for that regulator.
434 if (rdata->id != S5M8767_BUCK9) in s5m8767_regulator_config_ext_control()
438 for (i = 0; i < s5m8767->num_regulators; i++) { in s5m8767_regulator_config_ext_control()
439 const struct sec_opmode_data *opmode = &s5m8767->opmode[i]; in s5m8767_regulator_config_ext_control()
440 if (opmode->id == rdata->id) { in s5m8767_regulator_config_ext_control()
441 mode = s5m8767_opmode_reg[rdata->id][opmode->mode]; in s5m8767_regulator_config_ext_control()
446 dev_warn(s5m8767->dev, in s5m8767_regulator_config_ext_control()
447 "ext-control for %pOFn: mismatched op_mode (%x), ignoring\n", in s5m8767_regulator_config_ext_control()
448 rdata->reg_node, mode); in s5m8767_regulator_config_ext_control()
452 if (!rdata->ext_control_gpiod) { in s5m8767_regulator_config_ext_control()
453 dev_warn(s5m8767->dev, in s5m8767_regulator_config_ext_control()
454 "ext-control for %pOFn: GPIO not valid, ignoring\n", in s5m8767_regulator_config_ext_control()
455 rdata->reg_node); in s5m8767_regulator_config_ext_control()
459 config->ena_gpiod = rdata->ext_control_gpiod; in s5m8767_regulator_config_ext_control()
463 * Turn on GPIO control over BUCK9.
472 return -EINVAL; in s5m8767_enable_ext_control()
478 return regmap_update_bits(s5m8767->iodev->regmap_pmic, in s5m8767_enable_ext_control()
489 int i, gpio; in s5m8767_pmic_dt_parse_dvs_gpio() local
492 gpio = of_get_named_gpio(pmic_np, in s5m8767_pmic_dt_parse_dvs_gpio()
493 "s5m8767,pmic-buck-dvs-gpios", i); in s5m8767_pmic_dt_parse_dvs_gpio()
494 if (!gpio_is_valid(gpio)) { in s5m8767_pmic_dt_parse_dvs_gpio()
495 dev_err(iodev->dev, "invalid gpio[%d]: %d\n", i, gpio); in s5m8767_pmic_dt_parse_dvs_gpio()
496 return -EINVAL; in s5m8767_pmic_dt_parse_dvs_gpio()
498 pdata->buck_gpios[i] = gpio; in s5m8767_pmic_dt_parse_dvs_gpio()
507 int i, gpio; in s5m8767_pmic_dt_parse_ds_gpio() local
510 gpio = of_get_named_gpio(pmic_np, in s5m8767_pmic_dt_parse_ds_gpio()
511 "s5m8767,pmic-buck-ds-gpios", i); in s5m8767_pmic_dt_parse_ds_gpio()
512 if (!gpio_is_valid(gpio)) { in s5m8767_pmic_dt_parse_ds_gpio()
513 dev_err(iodev->dev, "invalid gpio[%d]: %d\n", i, gpio); in s5m8767_pmic_dt_parse_ds_gpio()
514 return -EINVAL; in s5m8767_pmic_dt_parse_ds_gpio()
516 pdata->buck_ds[i] = gpio; in s5m8767_pmic_dt_parse_ds_gpio()
524 struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent); in s5m8767_pmic_dt_parse_pdata()
530 pmic_np = iodev->dev->of_node; in s5m8767_pmic_dt_parse_pdata()
532 dev_err(iodev->dev, "could not find pmic sub-node\n"); in s5m8767_pmic_dt_parse_pdata()
533 return -ENODEV; in s5m8767_pmic_dt_parse_pdata()
539 dev_err(iodev->dev, "could not find regulators sub-node\n"); in s5m8767_pmic_dt_parse_pdata()
540 return -EINVAL; in s5m8767_pmic_dt_parse_pdata()
543 /* count the number of regulators to be supported in pmic */ in s5m8767_pmic_dt_parse_pdata()
544 pdata->num_regulators = of_get_child_count(regulators_np); in s5m8767_pmic_dt_parse_pdata()
546 rdata = devm_kcalloc(&pdev->dev, in s5m8767_pmic_dt_parse_pdata()
547 pdata->num_regulators, sizeof(*rdata), in s5m8767_pmic_dt_parse_pdata()
550 return -ENOMEM; in s5m8767_pmic_dt_parse_pdata()
552 rmode = devm_kcalloc(&pdev->dev, in s5m8767_pmic_dt_parse_pdata()
553 pdata->num_regulators, sizeof(*rmode), in s5m8767_pmic_dt_parse_pdata()
556 return -ENOMEM; in s5m8767_pmic_dt_parse_pdata()
558 pdata->regulators = rdata; in s5m8767_pmic_dt_parse_pdata()
559 pdata->opmode = rmode; in s5m8767_pmic_dt_parse_pdata()
566 dev_warn(iodev->dev, in s5m8767_pmic_dt_parse_pdata()
572 rdata->ext_control_gpiod = devm_fwnode_gpiod_get( in s5m8767_pmic_dt_parse_pdata()
573 &pdev->dev, in s5m8767_pmic_dt_parse_pdata()
575 "s5m8767,pmic-ext-control", in s5m8767_pmic_dt_parse_pdata()
578 if (PTR_ERR(rdata->ext_control_gpiod) == -ENOENT) { in s5m8767_pmic_dt_parse_pdata()
579 rdata->ext_control_gpiod = NULL; in s5m8767_pmic_dt_parse_pdata()
580 } else if (IS_ERR(rdata->ext_control_gpiod)) { in s5m8767_pmic_dt_parse_pdata()
582 return PTR_ERR(rdata->ext_control_gpiod); in s5m8767_pmic_dt_parse_pdata()
585 rdata->id = i; in s5m8767_pmic_dt_parse_pdata()
586 rdata->initdata = of_get_regulator_init_data( in s5m8767_pmic_dt_parse_pdata()
587 &pdev->dev, reg_np, in s5m8767_pmic_dt_parse_pdata()
589 rdata->reg_node = reg_np; in s5m8767_pmic_dt_parse_pdata()
591 rmode->id = i; in s5m8767_pmic_dt_parse_pdata()
593 &rmode->mode)) { in s5m8767_pmic_dt_parse_pdata()
594 dev_warn(iodev->dev, in s5m8767_pmic_dt_parse_pdata()
598 rmode->mode = S5M8767_OPMODE_NORMAL_MODE; in s5m8767_pmic_dt_parse_pdata()
603 if (of_property_read_bool(pmic_np, "s5m8767,pmic-buck2-uses-gpio-dvs")) { in s5m8767_pmic_dt_parse_pdata()
604 pdata->buck2_gpiodvs = true; in s5m8767_pmic_dt_parse_pdata()
607 "s5m8767,pmic-buck2-dvs-voltage", in s5m8767_pmic_dt_parse_pdata()
608 pdata->buck2_voltage, dvs_voltage_nr)) { in s5m8767_pmic_dt_parse_pdata()
609 dev_err(iodev->dev, "buck2 voltages not specified\n"); in s5m8767_pmic_dt_parse_pdata()
610 return -EINVAL; in s5m8767_pmic_dt_parse_pdata()
614 if (of_property_read_bool(pmic_np, "s5m8767,pmic-buck3-uses-gpio-dvs")) { in s5m8767_pmic_dt_parse_pdata()
615 pdata->buck3_gpiodvs = true; in s5m8767_pmic_dt_parse_pdata()
618 "s5m8767,pmic-buck3-dvs-voltage", in s5m8767_pmic_dt_parse_pdata()
619 pdata->buck3_voltage, dvs_voltage_nr)) { in s5m8767_pmic_dt_parse_pdata()
620 dev_err(iodev->dev, "buck3 voltages not specified\n"); in s5m8767_pmic_dt_parse_pdata()
621 return -EINVAL; in s5m8767_pmic_dt_parse_pdata()
625 if (of_property_read_bool(pmic_np, "s5m8767,pmic-buck4-uses-gpio-dvs")) { in s5m8767_pmic_dt_parse_pdata()
626 pdata->buck4_gpiodvs = true; in s5m8767_pmic_dt_parse_pdata()
629 "s5m8767,pmic-buck4-dvs-voltage", in s5m8767_pmic_dt_parse_pdata()
630 pdata->buck4_voltage, dvs_voltage_nr)) { in s5m8767_pmic_dt_parse_pdata()
631 dev_err(iodev->dev, "buck4 voltages not specified\n"); in s5m8767_pmic_dt_parse_pdata()
632 return -EINVAL; in s5m8767_pmic_dt_parse_pdata()
636 if (pdata->buck2_gpiodvs || pdata->buck3_gpiodvs || in s5m8767_pmic_dt_parse_pdata()
637 pdata->buck4_gpiodvs) { in s5m8767_pmic_dt_parse_pdata()
640 return -EINVAL; in s5m8767_pmic_dt_parse_pdata()
643 "s5m8767,pmic-buck-default-dvs-idx", in s5m8767_pmic_dt_parse_pdata()
644 &pdata->buck_default_idx)) { in s5m8767_pmic_dt_parse_pdata()
645 pdata->buck_default_idx = 0; in s5m8767_pmic_dt_parse_pdata()
647 if (pdata->buck_default_idx >= 8) { in s5m8767_pmic_dt_parse_pdata()
648 pdata->buck_default_idx = 0; in s5m8767_pmic_dt_parse_pdata()
649 dev_info(iodev->dev, in s5m8767_pmic_dt_parse_pdata()
650 "invalid value for default dvs index, use 0\n"); in s5m8767_pmic_dt_parse_pdata()
657 return -EINVAL; in s5m8767_pmic_dt_parse_pdata()
659 pdata->buck2_ramp_enable = of_property_read_bool(pmic_np, "s5m8767,pmic-buck2-ramp-enable"); in s5m8767_pmic_dt_parse_pdata()
660 pdata->buck3_ramp_enable = of_property_read_bool(pmic_np, "s5m8767,pmic-buck3-ramp-enable"); in s5m8767_pmic_dt_parse_pdata()
661 pdata->buck4_ramp_enable = of_property_read_bool(pmic_np, "s5m8767,pmic-buck4-ramp-enable"); in s5m8767_pmic_dt_parse_pdata()
663 if (pdata->buck2_ramp_enable || pdata->buck3_ramp_enable in s5m8767_pmic_dt_parse_pdata()
664 || pdata->buck4_ramp_enable) { in s5m8767_pmic_dt_parse_pdata()
665 if (of_property_read_u32(pmic_np, "s5m8767,pmic-buck-ramp-delay", in s5m8767_pmic_dt_parse_pdata()
666 &pdata->buck_ramp_delay)) in s5m8767_pmic_dt_parse_pdata()
667 pdata->buck_ramp_delay = 0; in s5m8767_pmic_dt_parse_pdata()
682 struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent); in s5m8767_pmic_probe()
683 struct sec_platform_data *pdata = iodev->pdata; in s5m8767_pmic_probe()
689 dev_err(pdev->dev.parent, "Platform data not supplied\n"); in s5m8767_pmic_probe()
690 return -ENODEV; in s5m8767_pmic_probe()
693 if (iodev->dev->of_node) { in s5m8767_pmic_probe()
699 if (pdata->buck2_gpiodvs) { in s5m8767_pmic_probe()
700 if (pdata->buck3_gpiodvs || pdata->buck4_gpiodvs) { in s5m8767_pmic_probe()
701 dev_err(&pdev->dev, "S5M8767 GPIO DVS NOT VALID\n"); in s5m8767_pmic_probe()
702 return -EINVAL; in s5m8767_pmic_probe()
706 if (pdata->buck3_gpiodvs) { in s5m8767_pmic_probe()
707 if (pdata->buck2_gpiodvs || pdata->buck4_gpiodvs) { in s5m8767_pmic_probe()
708 dev_err(&pdev->dev, "S5M8767 GPIO DVS NOT VALID\n"); in s5m8767_pmic_probe()
709 return -EINVAL; in s5m8767_pmic_probe()
713 if (pdata->buck4_gpiodvs) { in s5m8767_pmic_probe()
714 if (pdata->buck2_gpiodvs || pdata->buck3_gpiodvs) { in s5m8767_pmic_probe()
715 dev_err(&pdev->dev, "S5M8767 GPIO DVS NOT VALID\n"); in s5m8767_pmic_probe()
716 return -EINVAL; in s5m8767_pmic_probe()
720 s5m8767 = devm_kzalloc(&pdev->dev, sizeof(struct s5m8767_info), in s5m8767_pmic_probe()
723 return -ENOMEM; in s5m8767_pmic_probe()
725 s5m8767->dev = &pdev->dev; in s5m8767_pmic_probe()
726 s5m8767->iodev = iodev; in s5m8767_pmic_probe()
727 s5m8767->num_regulators = pdata->num_regulators; in s5m8767_pmic_probe()
730 s5m8767->buck_gpioindex = pdata->buck_default_idx; in s5m8767_pmic_probe()
731 s5m8767->buck2_gpiodvs = pdata->buck2_gpiodvs; in s5m8767_pmic_probe()
732 s5m8767->buck3_gpiodvs = pdata->buck3_gpiodvs; in s5m8767_pmic_probe()
733 s5m8767->buck4_gpiodvs = pdata->buck4_gpiodvs; in s5m8767_pmic_probe()
734 s5m8767->buck_gpios[0] = pdata->buck_gpios[0]; in s5m8767_pmic_probe()
735 s5m8767->buck_gpios[1] = pdata->buck_gpios[1]; in s5m8767_pmic_probe()
736 s5m8767->buck_gpios[2] = pdata->buck_gpios[2]; in s5m8767_pmic_probe()
737 s5m8767->buck_ds[0] = pdata->buck_ds[0]; in s5m8767_pmic_probe()
738 s5m8767->buck_ds[1] = pdata->buck_ds[1]; in s5m8767_pmic_probe()
739 s5m8767->buck_ds[2] = pdata->buck_ds[2]; in s5m8767_pmic_probe()
741 s5m8767->ramp_delay = pdata->buck_ramp_delay; in s5m8767_pmic_probe()
742 s5m8767->buck2_ramp = pdata->buck2_ramp_enable; in s5m8767_pmic_probe()
743 s5m8767->buck3_ramp = pdata->buck3_ramp_enable; in s5m8767_pmic_probe()
744 s5m8767->buck4_ramp = pdata->buck4_ramp_enable; in s5m8767_pmic_probe()
745 s5m8767->opmode = pdata->opmode; in s5m8767_pmic_probe()
748 pdata->buck2_init); in s5m8767_pmic_probe()
750 regmap_write(s5m8767->iodev->regmap_pmic, S5M8767_REG_BUCK2DVS2, in s5m8767_pmic_probe()
754 pdata->buck3_init); in s5m8767_pmic_probe()
756 regmap_write(s5m8767->iodev->regmap_pmic, S5M8767_REG_BUCK3DVS2, in s5m8767_pmic_probe()
760 pdata->buck4_init); in s5m8767_pmic_probe()
762 regmap_write(s5m8767->iodev->regmap_pmic, S5M8767_REG_BUCK4DVS2, in s5m8767_pmic_probe()
766 if (s5m8767->buck2_gpiodvs) { in s5m8767_pmic_probe()
767 s5m8767->buck2_vol[i] = in s5m8767_pmic_probe()
770 pdata->buck2_voltage[i]); in s5m8767_pmic_probe()
773 if (s5m8767->buck3_gpiodvs) { in s5m8767_pmic_probe()
774 s5m8767->buck3_vol[i] = in s5m8767_pmic_probe()
777 pdata->buck3_voltage[i]); in s5m8767_pmic_probe()
780 if (s5m8767->buck4_gpiodvs) { in s5m8767_pmic_probe()
781 s5m8767->buck4_vol[i] = in s5m8767_pmic_probe()
784 pdata->buck4_voltage[i]); in s5m8767_pmic_probe()
788 if (pdata->buck2_gpiodvs || pdata->buck3_gpiodvs || in s5m8767_pmic_probe()
789 pdata->buck4_gpiodvs) { in s5m8767_pmic_probe()
791 if (!gpio_is_valid(pdata->buck_gpios[0]) || in s5m8767_pmic_probe()
792 !gpio_is_valid(pdata->buck_gpios[1]) || in s5m8767_pmic_probe()
793 !gpio_is_valid(pdata->buck_gpios[2])) { in s5m8767_pmic_probe()
794 dev_err(&pdev->dev, "GPIO NOT VALID\n"); in s5m8767_pmic_probe()
795 return -EINVAL; in s5m8767_pmic_probe()
798 ret = devm_gpio_request(&pdev->dev, pdata->buck_gpios[0], in s5m8767_pmic_probe()
803 ret = devm_gpio_request(&pdev->dev, pdata->buck_gpios[1], in s5m8767_pmic_probe()
808 ret = devm_gpio_request(&pdev->dev, pdata->buck_gpios[2], in s5m8767_pmic_probe()
813 /* SET1 GPIO */ in s5m8767_pmic_probe()
814 gpio_direction_output(pdata->buck_gpios[0], in s5m8767_pmic_probe()
815 (s5m8767->buck_gpioindex >> 2) & 0x1); in s5m8767_pmic_probe()
816 /* SET2 GPIO */ in s5m8767_pmic_probe()
817 gpio_direction_output(pdata->buck_gpios[1], in s5m8767_pmic_probe()
818 (s5m8767->buck_gpioindex >> 1) & 0x1); in s5m8767_pmic_probe()
819 /* SET3 GPIO */ in s5m8767_pmic_probe()
820 gpio_direction_output(pdata->buck_gpios[2], in s5m8767_pmic_probe()
821 (s5m8767->buck_gpioindex >> 0) & 0x1); in s5m8767_pmic_probe()
824 ret = devm_gpio_request(&pdev->dev, pdata->buck_ds[0], "S5M8767 DS2"); in s5m8767_pmic_probe()
828 ret = devm_gpio_request(&pdev->dev, pdata->buck_ds[1], "S5M8767 DS3"); in s5m8767_pmic_probe()
832 ret = devm_gpio_request(&pdev->dev, pdata->buck_ds[2], "S5M8767 DS4"); in s5m8767_pmic_probe()
836 /* DS2 GPIO */ in s5m8767_pmic_probe()
837 gpio_direction_output(pdata->buck_ds[0], 0x0); in s5m8767_pmic_probe()
838 /* DS3 GPIO */ in s5m8767_pmic_probe()
839 gpio_direction_output(pdata->buck_ds[1], 0x0); in s5m8767_pmic_probe()
840 /* DS4 GPIO */ in s5m8767_pmic_probe()
841 gpio_direction_output(pdata->buck_ds[2], 0x0); in s5m8767_pmic_probe()
843 regmap_update_bits(s5m8767->iodev->regmap_pmic, in s5m8767_pmic_probe()
845 (pdata->buck2_gpiodvs) ? (1 << 1) : (0 << 1)); in s5m8767_pmic_probe()
846 regmap_update_bits(s5m8767->iodev->regmap_pmic, in s5m8767_pmic_probe()
848 (pdata->buck3_gpiodvs) ? (1 << 1) : (0 << 1)); in s5m8767_pmic_probe()
849 regmap_update_bits(s5m8767->iodev->regmap_pmic, in s5m8767_pmic_probe()
851 (pdata->buck4_gpiodvs) ? (1 << 1) : (0 << 1)); in s5m8767_pmic_probe()
853 /* Initialize GPIO DVS registers */ in s5m8767_pmic_probe()
855 if (s5m8767->buck2_gpiodvs) { in s5m8767_pmic_probe()
856 regmap_write(s5m8767->iodev->regmap_pmic, in s5m8767_pmic_probe()
858 s5m8767->buck2_vol[i]); in s5m8767_pmic_probe()
861 if (s5m8767->buck3_gpiodvs) { in s5m8767_pmic_probe()
862 regmap_write(s5m8767->iodev->regmap_pmic, in s5m8767_pmic_probe()
864 s5m8767->buck3_vol[i]); in s5m8767_pmic_probe()
867 if (s5m8767->buck4_gpiodvs) { in s5m8767_pmic_probe()
868 regmap_write(s5m8767->iodev->regmap_pmic, in s5m8767_pmic_probe()
870 s5m8767->buck4_vol[i]); in s5m8767_pmic_probe()
874 if (s5m8767->buck2_ramp) in s5m8767_pmic_probe()
875 regmap_update_bits(s5m8767->iodev->regmap_pmic, in s5m8767_pmic_probe()
878 if (s5m8767->buck3_ramp) in s5m8767_pmic_probe()
879 regmap_update_bits(s5m8767->iodev->regmap_pmic, in s5m8767_pmic_probe()
882 if (s5m8767->buck4_ramp) in s5m8767_pmic_probe()
883 regmap_update_bits(s5m8767->iodev->regmap_pmic, in s5m8767_pmic_probe()
886 if (s5m8767->buck2_ramp || s5m8767->buck3_ramp in s5m8767_pmic_probe()
887 || s5m8767->buck4_ramp) { in s5m8767_pmic_probe()
889 switch (s5m8767->ramp_delay) { in s5m8767_pmic_probe()
908 regmap_update_bits(s5m8767->iodev->regmap_pmic, in s5m8767_pmic_probe()
914 for (i = 0; i < pdata->num_regulators; i++) { in s5m8767_pmic_probe()
916 unsigned int id = pdata->regulators[i].id; in s5m8767_pmic_probe()
927 (desc->max - desc->min) / desc->step + 1; in s5m8767_pmic_probe()
928 regulators[id].min_uV = desc->min; in s5m8767_pmic_probe()
929 regulators[id].uV_step = desc->step; in s5m8767_pmic_probe()
940 dev_err(s5m8767->dev, "error reading registers\n"); in s5m8767_pmic_probe()
948 config.dev = s5m8767->dev; in s5m8767_pmic_probe()
949 config.init_data = pdata->regulators[i].initdata; in s5m8767_pmic_probe()
951 config.regmap = iodev->regmap_pmic; in s5m8767_pmic_probe()
952 config.of_node = pdata->regulators[i].reg_node; in s5m8767_pmic_probe()
954 if (pdata->regulators[i].ext_control_gpiod) { in s5m8767_pmic_probe()
957 &pdata->regulators[i], &config); in s5m8767_pmic_probe()
960 * Hand the GPIO descriptor management over to the in s5m8767_pmic_probe()
963 devm_gpiod_unhinge(s5m8767->dev, config.ena_gpiod); in s5m8767_pmic_probe()
965 rdev = devm_regulator_register(&pdev->dev, &regulators[id], in s5m8767_pmic_probe()
969 dev_err(s5m8767->dev, "regulator init failed for %d\n", in s5m8767_pmic_probe()
974 if (pdata->regulators[i].ext_control_gpiod) { in s5m8767_pmic_probe()
977 dev_err(s5m8767->dev, in s5m8767_pmic_probe()
978 "failed to enable gpio control over %s: %d\n", in s5m8767_pmic_probe()
979 rdev->desc->name, ret); in s5m8767_pmic_probe()
989 { "s5m8767-pmic", 0},
996 .name = "s5m8767-pmic",