• Home
  • Raw
  • Download

Lines Matching +full:control +full:- +full:parent

43  * struct tps65090_regulator - Per-regulator data for a tps65090 regulator
64 * tps65090_reg_set_overcurrent_wait - Setup overcurrent wait
72 * Return: 0 if no error, non-zero if there was an error writing the register.
79 ret = regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, in tps65090_reg_set_overcurrent_wait()
81 ri->overcurrent_wait << CTRL_WT_BIT); in tps65090_reg_set_overcurrent_wait()
83 dev_err(&rdev->dev, "Error updating overcurrent wait %#x\n", in tps65090_reg_set_overcurrent_wait()
84 rdev->desc->enable_reg); in tps65090_reg_set_overcurrent_wait()
91 * tps65090_try_enable_fet - Try to enable a FET
95 * Return: 0 if ok, -ENOTRECOVERABLE if the FET power good bit did not get
96 * set, or some other -ve value if another error occurred (e.g. i2c error)
100 unsigned int control; in tps65090_try_enable_fet() local
103 ret = regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, in tps65090_try_enable_fet()
104 rdev->desc->enable_mask, in tps65090_try_enable_fet()
105 rdev->desc->enable_mask); in tps65090_try_enable_fet()
107 dev_err(&rdev->dev, "Error in updating reg %#x\n", in tps65090_try_enable_fet()
108 rdev->desc->enable_reg); in tps65090_try_enable_fet()
113 ret = regmap_read(rdev->regmap, rdev->desc->enable_reg, in tps65090_try_enable_fet()
114 &control); in tps65090_try_enable_fet()
118 if (!(control & BIT(CTRL_TO_BIT))) in tps65090_try_enable_fet()
123 if (!(control & BIT(CTRL_PG_BIT))) in tps65090_try_enable_fet()
124 return -ENOTRECOVERABLE; in tps65090_try_enable_fet()
130 * tps65090_fet_enable - Enable a FET, trying a few times if it fails
135 * - We'll make sure that we bump the "overcurrent wait" to the maximum, which
137 * - We'll retry turning the FET on multiple times (turning off in between).
141 * Return: 0 if ok, non-zero if it fails.
156 if (ret != -ENOTRECOVERABLE || tries == MAX_FET_ENABLE_TRIES) in tps65090_fet_enable()
160 ret = regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, in tps65090_fet_enable()
161 rdev->desc->enable_mask, 0); in tps65090_fet_enable()
169 dev_warn(&rdev->dev, "reg %#x enable ok after %d tries\n", in tps65090_fet_enable()
170 rdev->desc->enable_reg, tries); in tps65090_fet_enable()
174 dev_warn(&rdev->dev, "reg %#x enable failed\n", rdev->desc->enable_reg); in tps65090_fet_enable()
246 tps65090_REG_FIXEDV(LDO1, "vsys-l1", 0, 0, 5000000,
248 tps65090_REG_FIXEDV(LDO2, "vsys-l2", 0, 0, 3300000,
268 struct device *parent = ri->dev->parent; in tps65090_config_ext_control() local
269 unsigned int reg_en_reg = ri->desc->enable_reg; in tps65090_config_ext_control()
272 ret = tps65090_set_bits(parent, reg_en_reg, 1); in tps65090_config_ext_control()
274 ret = tps65090_clr_bits(parent, reg_en_reg, 1); in tps65090_config_ext_control()
276 dev_err(ri->dev, "Error in updating reg 0x%x\n", reg_en_reg); in tps65090_config_ext_control()
285 struct device *parent = ri->dev->parent; in tps65090_regulator_disable_ext_control() local
286 unsigned int reg_en_reg = ri->desc->enable_reg; in tps65090_regulator_disable_ext_control()
289 * First enable output for internal control if require. in tps65090_regulator_disable_ext_control()
290 * And then disable external control. in tps65090_regulator_disable_ext_control()
292 if (tps_pdata->reg_init_data->constraints.always_on || in tps65090_regulator_disable_ext_control()
293 tps_pdata->reg_init_data->constraints.boot_on) { in tps65090_regulator_disable_ext_control()
294 ret = tps65090_set_bits(parent, reg_en_reg, 0); in tps65090_regulator_disable_ext_control()
296 dev_err(ri->dev, "Error in set reg 0x%x\n", reg_en_reg); in tps65090_regulator_disable_ext_control()
324 struct device_node *np = pdev->dev.parent->of_node; in tps65090_parse_dt_reg_data()
329 tps65090_pdata = devm_kzalloc(&pdev->dev, sizeof(*tps65090_pdata), in tps65090_parse_dt_reg_data()
332 return ERR_PTR(-ENOMEM); in tps65090_parse_dt_reg_data()
334 reg_pdata = devm_kcalloc(&pdev->dev, in tps65090_parse_dt_reg_data()
338 return ERR_PTR(-ENOMEM); in tps65090_parse_dt_reg_data()
342 dev_err(&pdev->dev, "regulator node not found\n"); in tps65090_parse_dt_reg_data()
343 return ERR_PTR(-ENODEV); in tps65090_parse_dt_reg_data()
346 ret = of_regulator_match(&pdev->dev, regulators, tps65090_matches, in tps65090_parse_dt_reg_data()
350 dev_err(&pdev->dev, in tps65090_parse_dt_reg_data()
365 rpdata->reg_init_data = ri_data; in tps65090_parse_dt_reg_data()
366 rpdata->enable_ext_control = of_property_read_bool( in tps65090_parse_dt_reg_data()
368 "ti,enable-ext-control"); in tps65090_parse_dt_reg_data()
369 if (rpdata->enable_ext_control) { in tps65090_parse_dt_reg_data()
372 if (ri_data->constraints.always_on || in tps65090_parse_dt_reg_data()
373 ri_data->constraints.boot_on) in tps65090_parse_dt_reg_data()
378 rpdata->gpiod = devm_gpiod_get_from_of_node(&pdev->dev, in tps65090_parse_dt_reg_data()
380 "dcdc-ext-control-gpios", 0, in tps65090_parse_dt_reg_data()
383 if (IS_ERR(rpdata->gpiod)) in tps65090_parse_dt_reg_data()
384 return ERR_CAST(rpdata->gpiod); in tps65090_parse_dt_reg_data()
385 if (!rpdata->gpiod) in tps65090_parse_dt_reg_data()
386 dev_err(&pdev->dev, in tps65090_parse_dt_reg_data()
387 "could not find DCDC external control GPIO\n"); in tps65090_parse_dt_reg_data()
391 "ti,overcurrent-wait", in tps65090_parse_dt_reg_data()
392 &rpdata->overcurrent_wait) == 0) in tps65090_parse_dt_reg_data()
393 rpdata->overcurrent_wait_valid = true; in tps65090_parse_dt_reg_data()
395 tps65090_pdata->reg_pdata[idx] = rpdata; in tps65090_parse_dt_reg_data()
411 struct tps65090 *tps65090_mfd = dev_get_drvdata(pdev->dev.parent); in tps65090_regulator_probe()
422 dev_dbg(&pdev->dev, "Probing regulator\n"); in tps65090_regulator_probe()
424 tps65090_pdata = dev_get_platdata(pdev->dev.parent); in tps65090_regulator_probe()
425 if (!tps65090_pdata && tps65090_mfd->dev->of_node) in tps65090_regulator_probe()
429 dev_err(&pdev->dev, "Platform data missing\n"); in tps65090_regulator_probe()
430 return tps65090_pdata ? PTR_ERR(tps65090_pdata) : -EINVAL; in tps65090_regulator_probe()
433 pmic = devm_kcalloc(&pdev->dev, in tps65090_regulator_probe()
437 return -ENOMEM; in tps65090_regulator_probe()
440 tps_pdata = tps65090_pdata->reg_pdata[num]; in tps65090_regulator_probe()
443 ri->dev = &pdev->dev; in tps65090_regulator_probe()
444 ri->desc = &tps65090_regulator_desc[num]; in tps65090_regulator_probe()
446 ri->overcurrent_wait_valid = in tps65090_regulator_probe()
447 tps_pdata->overcurrent_wait_valid; in tps65090_regulator_probe()
448 ri->overcurrent_wait = tps_pdata->overcurrent_wait; in tps65090_regulator_probe()
452 * TPS5090 DCDC support the control from external digital input. in tps65090_regulator_probe()
455 if (tps_pdata && is_dcdc(num) && tps_pdata->reg_init_data) { in tps65090_regulator_probe()
456 if (tps_pdata->enable_ext_control) { in tps65090_regulator_probe()
457 config.ena_gpiod = tps_pdata->gpiod; in tps65090_regulator_probe()
458 ri->desc->ops = &tps65090_ext_control_ops; in tps65090_regulator_probe()
463 dev_err(&pdev->dev, in tps65090_regulator_probe()
464 "failed disable ext control\n"); in tps65090_regulator_probe()
470 config.dev = pdev->dev.parent; in tps65090_regulator_probe()
472 config.regmap = tps65090_mfd->rmap; in tps65090_regulator_probe()
474 config.init_data = tps_pdata->reg_init_data; in tps65090_regulator_probe()
482 rdev = devm_regulator_register(&pdev->dev, ri->desc, &config); in tps65090_regulator_probe()
484 dev_err(&pdev->dev, "failed to register regulator %s\n", in tps65090_regulator_probe()
485 ri->desc->name); in tps65090_regulator_probe()
488 ri->rdev = rdev; in tps65090_regulator_probe()
490 if (ri->overcurrent_wait_valid) { in tps65090_regulator_probe()
496 /* Enable external control if it is require */ in tps65090_regulator_probe()
497 if (tps_pdata && is_dcdc(num) && tps_pdata->reg_init_data && in tps65090_regulator_probe()
498 tps_pdata->enable_ext_control) { in tps65090_regulator_probe()
511 .name = "tps65090-pmic",
531 MODULE_ALIAS("platform:tps65090-pmic");