Lines Matching +full:output +full:- +full:range +full:- +full:microvolts

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * tps65910.c -- TI tps65910
30 /* supported VIO voltages in microvolts */
37 /* supported VRTC voltages in microvolts */
42 /* supported VDD3 voltages in microvolts */
47 /* supported VDIG1 voltages in microvolts */
52 /* supported VDIG2 voltages in microvolts */
57 /* supported VPLL voltages in microvolts */
62 /* supported VDAC voltages in microvolts */
67 /* supported VAUX1 voltages in microvolts */
72 /* supported VAUX2 voltages in microvolts */
77 /* supported VAUX33 voltages in microvolts */
82 /* supported VMMC voltages in microvolts */
87 /* supported BBCH voltages in microvolts */
352 return -EINVAL; in tps65910_get_ctrl_register()
386 return -EINVAL; in tps65911_get_ctrl_register()
396 reg = pmic->get_ctrl_reg(id); in tps65910_set_mode()
412 return -EINVAL; in tps65910_set_mode()
421 reg = pmic->get_ctrl_reg(id); in tps65910_get_mode()
495 /* normalise to valid range */ in tps65910_get_voltage_dcdc_sel()
500 return srvsel - 3; in tps65910_get_voltage_dcdc_sel()
503 /* normalise to valid range*/ in tps65910_get_voltage_dcdc_sel()
508 return opvsel - 3; in tps65910_get_voltage_dcdc_sel()
510 return -EINVAL; in tps65910_get_voltage_dcdc_sel()
519 reg = pmic->get_ctrl_reg(id); in tps65910_get_voltage_sel()
545 return -EINVAL; in tps65910_get_voltage_sel()
553 return dev->desc->volt_table[0]; in tps65910_get_voltage_vdd3()
563 reg = pmic->get_ctrl_reg(id); in tps65911_get_voltage_sel()
589 return -EINVAL; in tps65911_get_voltage_sel()
606 dcdc_mult--; in tps65910_set_voltage_dcdc_sel()
616 dcdc_mult--; in tps65910_set_voltage_dcdc_sel()
639 reg = pmic->get_ctrl_reg(id); in tps65910_set_voltage_sel()
660 return -EINVAL; in tps65910_set_voltage_sel()
670 reg = pmic->get_ctrl_reg(id); in tps65911_set_voltage_sel()
695 return -EINVAL; in tps65911_set_voltage_sel()
716 return -EINVAL; in tps65910_list_voltage_dcdc()
735 selector -= 4; in tps65911_list_voltage()
748 selector -= 2; in tps65911_list_voltage()
753 return pmic->info[id]->voltage_table[selector]; in tps65911_list_voltage()
755 return -EINVAL; in tps65911_list_voltage()
825 struct tps65910 *mfd = pmic->mfd; in tps65910_set_ext_sleep_config()
826 u8 regoffs = (pmic->ext_sleep_control[id] >> 8) & 0xFF; in tps65910_set_ext_sleep_config()
827 u8 bit_pos = (1 << pmic->ext_sleep_control[id] & 0xFF); in tps65910_set_ext_sleep_config()
845 dev_err(mfd->dev, in tps65910_set_ext_sleep_config()
847 return -EINVAL; in tps65910_set_ext_sleep_config()
851 pmic->board_ext_control[id] = ext_sleep_config; in tps65910_set_ext_sleep_config()
855 ret = regmap_set_bits(mfd->regmap, in tps65910_set_ext_sleep_config()
858 ret = regmap_clear_bits(mfd->regmap, in tps65910_set_ext_sleep_config()
861 dev_err(mfd->dev, in tps65910_set_ext_sleep_config()
868 ret = regmap_set_bits(mfd->regmap, in tps65910_set_ext_sleep_config()
871 ret = regmap_clear_bits(mfd->regmap, in tps65910_set_ext_sleep_config()
874 dev_err(mfd->dev, in tps65910_set_ext_sleep_config()
883 ret = regmap_set_bits(mfd->regmap, in tps65910_set_ext_sleep_config()
886 ret = regmap_clear_bits(mfd->regmap, in tps65910_set_ext_sleep_config()
889 dev_err(mfd->dev, in tps65910_set_ext_sleep_config()
898 ret = regmap_clear_bits(mfd->regmap, in tps65910_set_ext_sleep_config()
901 ret = regmap_clear_bits(mfd->regmap, in tps65910_set_ext_sleep_config()
904 dev_err(mfd->dev, in tps65910_set_ext_sleep_config()
918 int op_reg_add = pmic->get_ctrl_reg(id) + 1; in tps65910_set_ext_sleep_config()
919 int sr_reg_add = pmic->get_ctrl_reg(id) + 2; in tps65910_set_ext_sleep_config()
922 ret = regmap_read(mfd->regmap, op_reg_add, &opvsel); in tps65910_set_ext_sleep_config()
925 ret = regmap_read(mfd->regmap, sr_reg_add, &srvsel); in tps65910_set_ext_sleep_config()
932 ret = regmap_write(mfd->regmap, op_reg_add, reg_val); in tps65910_set_ext_sleep_config()
934 dev_err(mfd->dev, in tps65910_set_ext_sleep_config()
939 ret = regmap_write(mfd->regmap, sr_reg_add, 0); in tps65910_set_ext_sleep_config()
941 dev_err(mfd->dev, "Error in setting sr register\n"); in tps65910_set_ext_sleep_config()
946 ret = regmap_clear_bits(mfd->regmap, in tps65910_set_ext_sleep_config()
950 ret = regmap_set_bits(mfd->regmap, in tps65910_set_ext_sleep_config()
953 ret = regmap_clear_bits(mfd->regmap, in tps65910_set_ext_sleep_config()
957 dev_err(mfd->dev, in tps65910_set_ext_sleep_config()
1003 struct tps65910 *tps65910 = dev_get_drvdata(pdev->dev.parent); in tps65910_parse_dt_reg_data()
1009 pmic_plat_data = devm_kzalloc(&pdev->dev, sizeof(*pmic_plat_data), in tps65910_parse_dt_reg_data()
1014 np = pdev->dev.parent->of_node; in tps65910_parse_dt_reg_data()
1017 dev_err(&pdev->dev, "regulator node not found\n"); in tps65910_parse_dt_reg_data()
1032 dev_err(&pdev->dev, "Invalid tps chip version\n"); in tps65910_parse_dt_reg_data()
1036 ret = of_regulator_match(&pdev->dev, regulators, matches, count); in tps65910_parse_dt_reg_data()
1039 dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", in tps65910_parse_dt_reg_data()
1050 pmic_plat_data->tps65910_pmic_init_data[idx] = in tps65910_parse_dt_reg_data()
1054 "ti,regulator-ext-sleep-control", &prop); in tps65910_parse_dt_reg_data()
1056 pmic_plat_data->regulator_ext_sleep_control[idx] = prop; in tps65910_parse_dt_reg_data()
1074 struct tps65910 *tps65910 = dev_get_drvdata(pdev->dev.parent); in tps65910_probe()
1083 pmic_plat_data = dev_get_platdata(tps65910->dev); in tps65910_probe()
1084 if (!pmic_plat_data && tps65910->dev->of_node) in tps65910_probe()
1089 dev_err(&pdev->dev, "Platform data not found\n"); in tps65910_probe()
1090 return -EINVAL; in tps65910_probe()
1093 pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL); in tps65910_probe()
1095 return -ENOMEM; in tps65910_probe()
1097 pmic->mfd = tps65910; in tps65910_probe()
1101 err = regmap_set_bits(pmic->mfd->regmap, TPS65910_DEVCTRL, in tps65910_probe()
1109 pmic->get_ctrl_reg = &tps65910_get_ctrl_register; in tps65910_probe()
1110 pmic->num_regulators = ARRAY_SIZE(tps65910_regs); in tps65910_probe()
1111 pmic->ext_sleep_control = tps65910_ext_sleep_control; in tps65910_probe()
1113 /* Work around silicon erratum SWCZ010: output programmed in tps65910_probe()
1117 regmap_clear_bits(pmic->mfd->regmap, TPS65910_DCDCCTRL, in tps65910_probe()
1122 pmic->get_ctrl_reg = &tps65911_get_ctrl_register; in tps65910_probe()
1123 pmic->num_regulators = ARRAY_SIZE(tps65911_regs); in tps65910_probe()
1124 pmic->ext_sleep_control = tps65911_ext_sleep_control; in tps65910_probe()
1128 dev_err(&pdev->dev, "Invalid tps chip version\n"); in tps65910_probe()
1129 return -ENODEV; in tps65910_probe()
1132 pmic->desc = devm_kcalloc(&pdev->dev, in tps65910_probe()
1133 pmic->num_regulators, in tps65910_probe()
1136 if (!pmic->desc) in tps65910_probe()
1137 return -ENOMEM; in tps65910_probe()
1139 pmic->info = devm_kcalloc(&pdev->dev, in tps65910_probe()
1140 pmic->num_regulators, in tps65910_probe()
1143 if (!pmic->info) in tps65910_probe()
1144 return -ENOMEM; in tps65910_probe()
1146 pmic->rdev = devm_kcalloc(&pdev->dev, in tps65910_probe()
1147 pmic->num_regulators, in tps65910_probe()
1150 if (!pmic->rdev) in tps65910_probe()
1151 return -ENOMEM; in tps65910_probe()
1153 for (i = 0; i < pmic->num_regulators; i++, info++) { in tps65910_probe()
1155 pmic->info[i] = info; in tps65910_probe()
1157 pmic->desc[i].name = info->name; in tps65910_probe()
1158 pmic->desc[i].supply_name = info->vin_name; in tps65910_probe()
1159 pmic->desc[i].id = i; in tps65910_probe()
1160 pmic->desc[i].n_voltages = info->n_voltages; in tps65910_probe()
1161 pmic->desc[i].enable_time = info->enable_time_us; in tps65910_probe()
1164 pmic->desc[i].ops = &tps65910_ops_dcdc; in tps65910_probe()
1165 pmic->desc[i].n_voltages = VDD1_2_NUM_VOLT_FINE * in tps65910_probe()
1167 pmic->desc[i].ramp_delay = 12500; in tps65910_probe()
1170 pmic->desc[i].ops = &tps65910_ops_vdd3; in tps65910_probe()
1171 pmic->desc[i].volt_table = info->voltage_table; in tps65910_probe()
1173 pmic->desc[i].ops = &tps65910_ops_dcdc; in tps65910_probe()
1174 pmic->desc[i].ramp_delay = 5000; in tps65910_probe()
1178 pmic->desc[i].ops = &tps65910_ops_vbb; in tps65910_probe()
1179 pmic->desc[i].volt_table = info->voltage_table; in tps65910_probe()
1182 pmic->desc[i].ops = &tps65910_ops; in tps65910_probe()
1183 pmic->desc[i].volt_table = info->voltage_table; in tps65910_probe()
1185 pmic->desc[i].ops = &tps65911_ops; in tps65910_probe()
1190 pmic_plat_data->regulator_ext_sleep_control[i]); in tps65910_probe()
1196 dev_warn(tps65910->dev, in tps65910_probe()
1199 pmic->desc[i].type = REGULATOR_VOLTAGE; in tps65910_probe()
1200 pmic->desc[i].owner = THIS_MODULE; in tps65910_probe()
1201 pmic->desc[i].enable_reg = pmic->get_ctrl_reg(i); in tps65910_probe()
1202 pmic->desc[i].enable_mask = TPS65910_SUPPLY_STATE_ENABLED; in tps65910_probe()
1204 config.dev = tps65910->dev; in tps65910_probe()
1205 config.init_data = pmic_plat_data->tps65910_pmic_init_data[i]; in tps65910_probe()
1207 config.regmap = tps65910->regmap; in tps65910_probe()
1212 rdev = devm_regulator_register(&pdev->dev, &pmic->desc[i], in tps65910_probe()
1215 return dev_err_probe(tps65910->dev, PTR_ERR(rdev), in tps65910_probe()
1217 pdev->name); in tps65910_probe()
1220 pmic->rdev[i] = rdev; in tps65910_probe()
1237 * its output will be available as per register programming even in tps65910_shutdown()
1240 * bootloader initializes it, the system requires the rail output in tps65910_shutdown()
1243 for (i = 0; i < pmic->num_regulators; i++) { in tps65910_shutdown()
1245 if (!pmic->rdev[i]) in tps65910_shutdown()
1250 dev_err(&pdev->dev, in tps65910_shutdown()
1257 .name = "tps65910-pmic",
1278 MODULE_ALIAS("platform:tps65910-pmic");