Lines Matching +full:output +full:- +full:range +full:- +full:microvolts
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * tps65910.c -- TI tps65910
29 /* supported VIO voltages in microvolts */
36 /* supported VRTC voltages in microvolts */
41 /* supported VDD3 voltages in microvolts */
46 /* supported VDIG1 voltages in microvolts */
51 /* supported VDIG2 voltages in microvolts */
56 /* supported VPLL voltages in microvolts */
61 /* supported VDAC voltages in microvolts */
66 /* supported VAUX1 voltages in microvolts */
71 /* supported VAUX2 voltages in microvolts */
76 /* supported VAUX33 voltages in microvolts */
81 /* supported VMMC voltages in microvolts */
86 /* supported BBCH voltages in microvolts */
351 return -EINVAL; in tps65910_get_ctrl_register()
385 return -EINVAL; in tps65911_get_ctrl_register()
395 reg = pmic->get_ctrl_reg(id); in tps65910_set_mode()
411 return -EINVAL; in tps65910_set_mode()
420 reg = pmic->get_ctrl_reg(id); in tps65910_get_mode()
494 /* normalise to valid range */ in tps65910_get_voltage_dcdc_sel()
499 return srvsel - 3; in tps65910_get_voltage_dcdc_sel()
502 /* normalise to valid range*/ in tps65910_get_voltage_dcdc_sel()
507 return opvsel - 3; in tps65910_get_voltage_dcdc_sel()
509 return -EINVAL; in tps65910_get_voltage_dcdc_sel()
518 reg = pmic->get_ctrl_reg(id); in tps65910_get_voltage_sel()
544 return -EINVAL; in tps65910_get_voltage_sel()
552 return dev->desc->volt_table[0]; in tps65910_get_voltage_vdd3()
562 reg = pmic->get_ctrl_reg(id); in tps65911_get_voltage_sel()
588 return -EINVAL; in tps65911_get_voltage_sel()
605 dcdc_mult--; in tps65910_set_voltage_dcdc_sel()
615 dcdc_mult--; in tps65910_set_voltage_dcdc_sel()
638 reg = pmic->get_ctrl_reg(id); in tps65910_set_voltage_sel()
659 return -EINVAL; in tps65910_set_voltage_sel()
669 reg = pmic->get_ctrl_reg(id); in tps65911_set_voltage_sel()
694 return -EINVAL; in tps65911_set_voltage_sel()
715 return -EINVAL; in tps65910_list_voltage_dcdc()
734 selector -= 4; in tps65911_list_voltage()
747 selector -= 2; in tps65911_list_voltage()
752 return pmic->info[id]->voltage_table[selector]; in tps65911_list_voltage()
754 return -EINVAL; in tps65911_list_voltage()
824 struct tps65910 *mfd = pmic->mfd; in tps65910_set_ext_sleep_config()
825 u8 regoffs = (pmic->ext_sleep_control[id] >> 8) & 0xFF; in tps65910_set_ext_sleep_config()
826 u8 bit_pos = (1 << pmic->ext_sleep_control[id] & 0xFF); in tps65910_set_ext_sleep_config()
844 dev_err(mfd->dev, in tps65910_set_ext_sleep_config()
846 return -EINVAL; in tps65910_set_ext_sleep_config()
850 pmic->board_ext_control[id] = ext_sleep_config; in tps65910_set_ext_sleep_config()
854 ret = regmap_set_bits(mfd->regmap, in tps65910_set_ext_sleep_config()
857 ret = regmap_clear_bits(mfd->regmap, in tps65910_set_ext_sleep_config()
860 dev_err(mfd->dev, in tps65910_set_ext_sleep_config()
867 ret = regmap_set_bits(mfd->regmap, in tps65910_set_ext_sleep_config()
870 ret = regmap_clear_bits(mfd->regmap, in tps65910_set_ext_sleep_config()
873 dev_err(mfd->dev, in tps65910_set_ext_sleep_config()
882 ret = regmap_set_bits(mfd->regmap, in tps65910_set_ext_sleep_config()
885 ret = regmap_clear_bits(mfd->regmap, in tps65910_set_ext_sleep_config()
888 dev_err(mfd->dev, in tps65910_set_ext_sleep_config()
897 ret = regmap_clear_bits(mfd->regmap, in tps65910_set_ext_sleep_config()
900 ret = regmap_clear_bits(mfd->regmap, in tps65910_set_ext_sleep_config()
903 dev_err(mfd->dev, in tps65910_set_ext_sleep_config()
917 int op_reg_add = pmic->get_ctrl_reg(id) + 1; in tps65910_set_ext_sleep_config()
918 int sr_reg_add = pmic->get_ctrl_reg(id) + 2; in tps65910_set_ext_sleep_config()
921 ret = regmap_read(mfd->regmap, op_reg_add, &opvsel); in tps65910_set_ext_sleep_config()
924 ret = regmap_read(mfd->regmap, sr_reg_add, &srvsel); in tps65910_set_ext_sleep_config()
931 ret = regmap_write(mfd->regmap, op_reg_add, reg_val); in tps65910_set_ext_sleep_config()
933 dev_err(mfd->dev, in tps65910_set_ext_sleep_config()
938 ret = regmap_write(mfd->regmap, sr_reg_add, 0); in tps65910_set_ext_sleep_config()
940 dev_err(mfd->dev, "Error in setting sr register\n"); in tps65910_set_ext_sleep_config()
945 ret = regmap_clear_bits(mfd->regmap, in tps65910_set_ext_sleep_config()
949 ret = regmap_set_bits(mfd->regmap, in tps65910_set_ext_sleep_config()
952 ret = regmap_clear_bits(mfd->regmap, in tps65910_set_ext_sleep_config()
956 dev_err(mfd->dev, in tps65910_set_ext_sleep_config()
1002 struct tps65910 *tps65910 = dev_get_drvdata(pdev->dev.parent); in tps65910_parse_dt_reg_data()
1008 pmic_plat_data = devm_kzalloc(&pdev->dev, sizeof(*pmic_plat_data), in tps65910_parse_dt_reg_data()
1013 np = pdev->dev.parent->of_node; in tps65910_parse_dt_reg_data()
1016 dev_err(&pdev->dev, "regulator node not found\n"); in tps65910_parse_dt_reg_data()
1031 dev_err(&pdev->dev, "Invalid tps chip version\n"); in tps65910_parse_dt_reg_data()
1035 ret = of_regulator_match(&pdev->dev, regulators, matches, count); in tps65910_parse_dt_reg_data()
1038 dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", in tps65910_parse_dt_reg_data()
1049 pmic_plat_data->tps65910_pmic_init_data[idx] = in tps65910_parse_dt_reg_data()
1053 "ti,regulator-ext-sleep-control", &prop); in tps65910_parse_dt_reg_data()
1055 pmic_plat_data->regulator_ext_sleep_control[idx] = prop; in tps65910_parse_dt_reg_data()
1073 struct tps65910 *tps65910 = dev_get_drvdata(pdev->dev.parent); in tps65910_probe()
1082 pmic_plat_data = dev_get_platdata(tps65910->dev); in tps65910_probe()
1083 if (!pmic_plat_data && tps65910->dev->of_node) in tps65910_probe()
1088 dev_err(&pdev->dev, "Platform data not found\n"); in tps65910_probe()
1089 return -EINVAL; in tps65910_probe()
1092 pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL); in tps65910_probe()
1094 return -ENOMEM; in tps65910_probe()
1096 pmic->mfd = tps65910; in tps65910_probe()
1100 err = regmap_set_bits(pmic->mfd->regmap, TPS65910_DEVCTRL, in tps65910_probe()
1108 pmic->get_ctrl_reg = &tps65910_get_ctrl_register; in tps65910_probe()
1109 pmic->num_regulators = ARRAY_SIZE(tps65910_regs); in tps65910_probe()
1110 pmic->ext_sleep_control = tps65910_ext_sleep_control; in tps65910_probe()
1112 /* Work around silicon erratum SWCZ010: output programmed in tps65910_probe()
1116 regmap_clear_bits(pmic->mfd->regmap, TPS65910_DCDCCTRL, in tps65910_probe()
1121 pmic->get_ctrl_reg = &tps65911_get_ctrl_register; in tps65910_probe()
1122 pmic->num_regulators = ARRAY_SIZE(tps65911_regs); in tps65910_probe()
1123 pmic->ext_sleep_control = tps65911_ext_sleep_control; in tps65910_probe()
1127 dev_err(&pdev->dev, "Invalid tps chip version\n"); in tps65910_probe()
1128 return -ENODEV; in tps65910_probe()
1131 pmic->desc = devm_kcalloc(&pdev->dev, in tps65910_probe()
1132 pmic->num_regulators, in tps65910_probe()
1135 if (!pmic->desc) in tps65910_probe()
1136 return -ENOMEM; in tps65910_probe()
1138 pmic->info = devm_kcalloc(&pdev->dev, in tps65910_probe()
1139 pmic->num_regulators, in tps65910_probe()
1142 if (!pmic->info) in tps65910_probe()
1143 return -ENOMEM; in tps65910_probe()
1145 pmic->rdev = devm_kcalloc(&pdev->dev, in tps65910_probe()
1146 pmic->num_regulators, in tps65910_probe()
1149 if (!pmic->rdev) in tps65910_probe()
1150 return -ENOMEM; in tps65910_probe()
1152 for (i = 0; i < pmic->num_regulators; i++, info++) { in tps65910_probe()
1154 pmic->info[i] = info; in tps65910_probe()
1156 pmic->desc[i].name = info->name; in tps65910_probe()
1157 pmic->desc[i].supply_name = info->vin_name; in tps65910_probe()
1158 pmic->desc[i].id = i; in tps65910_probe()
1159 pmic->desc[i].n_voltages = info->n_voltages; in tps65910_probe()
1160 pmic->desc[i].enable_time = info->enable_time_us; in tps65910_probe()
1163 pmic->desc[i].ops = &tps65910_ops_dcdc; in tps65910_probe()
1164 pmic->desc[i].n_voltages = VDD1_2_NUM_VOLT_FINE * in tps65910_probe()
1166 pmic->desc[i].ramp_delay = 12500; in tps65910_probe()
1169 pmic->desc[i].ops = &tps65910_ops_vdd3; in tps65910_probe()
1170 pmic->desc[i].volt_table = info->voltage_table; in tps65910_probe()
1172 pmic->desc[i].ops = &tps65910_ops_dcdc; in tps65910_probe()
1173 pmic->desc[i].ramp_delay = 5000; in tps65910_probe()
1177 pmic->desc[i].ops = &tps65910_ops_vbb; in tps65910_probe()
1178 pmic->desc[i].volt_table = info->voltage_table; in tps65910_probe()
1181 pmic->desc[i].ops = &tps65910_ops; in tps65910_probe()
1182 pmic->desc[i].volt_table = info->voltage_table; in tps65910_probe()
1184 pmic->desc[i].ops = &tps65911_ops; in tps65910_probe()
1189 pmic_plat_data->regulator_ext_sleep_control[i]); in tps65910_probe()
1195 dev_warn(tps65910->dev, in tps65910_probe()
1198 pmic->desc[i].type = REGULATOR_VOLTAGE; in tps65910_probe()
1199 pmic->desc[i].owner = THIS_MODULE; in tps65910_probe()
1200 pmic->desc[i].enable_reg = pmic->get_ctrl_reg(i); in tps65910_probe()
1201 pmic->desc[i].enable_mask = TPS65910_SUPPLY_STATE_ENABLED; in tps65910_probe()
1203 config.dev = tps65910->dev; in tps65910_probe()
1204 config.init_data = pmic_plat_data->tps65910_pmic_init_data[i]; in tps65910_probe()
1206 config.regmap = tps65910->regmap; in tps65910_probe()
1211 rdev = devm_regulator_register(&pdev->dev, &pmic->desc[i], in tps65910_probe()
1214 return dev_err_probe(tps65910->dev, PTR_ERR(rdev), in tps65910_probe()
1216 pdev->name); in tps65910_probe()
1219 pmic->rdev[i] = rdev; in tps65910_probe()
1236 * its output will be available as per register programming even in tps65910_shutdown()
1239 * bootloader initializes it, the system requires the rail output in tps65910_shutdown()
1242 for (i = 0; i < pmic->num_regulators; i++) { in tps65910_shutdown()
1244 if (!pmic->rdev[i]) in tps65910_shutdown()
1249 dev_err(&pdev->dev, in tps65910_shutdown()
1256 .name = "tps65910-pmic",
1278 MODULE_ALIAS("platform:tps65910-pmic");