Lines Matching +full:twl6030 +full:- +full:charger

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * twl-regulator.c -- support regulators in twl4030/twl6030 family chips
24 * include an audio codec, battery charger, and more voltage regulators.
25 * These chips are often used in OMAP-based systems.
27 * This driver implements software-based resource control for various
39 /* voltage in mV = table[VSEL]; table_len must be a power-of-two */
68 /* TWL6030 register offsets */
81 &value, info->base + offset); in twlreg_read()
90 value, info->base + offset); in twlreg_write()
93 /*----------------------------------------------------------------------*/
147 timeout--; in twl4030_wait_pb_ready()
150 return -ETIMEDOUT; in twl4030_wait_pb_ready()
246 message = MSG_SINGULAR(DEV_GRP_P1, info->id, RES_STATE_ACTIVE); in twl4030reg_set_mode()
249 message = MSG_SINGULAR(DEV_GRP_P1, info->id, RES_STATE_SLEEP); in twl4030reg_set_mode()
252 return -EINVAL; in twl4030reg_set_mode()
270 /*----------------------------------------------------------------------*/
273 * Support for adjustable-voltage LDOs uses a four bit (or less) voltage
292 !((info)->features & TWL4030_ALLOW_UNSUPPORTED))
369 int mV = info->table[index]; in twl4030ldo_list_voltage()
391 vsel &= info->table_len - 1; in twl4030ldo_get_voltage_sel()
415 int vsel = DIV_ROUND_UP(min_uV - 600000, 12500); in twl4030smps_set_voltage()
440 /*----------------------------------------------------------------------*/
454 /*----------------------------------------------------------------------*/
547 #define TWL6030_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWL6030, label)
553 TWL4030_OF_MATCH("ti,twl4030-vaux1", VAUX1),
554 TWL4030_OF_MATCH("ti,twl4030-vaux2", VAUX2_4030),
555 TWL4030_OF_MATCH("ti,twl5030-vaux2", VAUX2),
556 TWL4030_OF_MATCH("ti,twl4030-vaux3", VAUX3),
557 TWL4030_OF_MATCH("ti,twl4030-vaux4", VAUX4),
558 TWL4030_OF_MATCH("ti,twl4030-vmmc1", VMMC1),
559 TWL4030_OF_MATCH("ti,twl4030-vmmc2", VMMC2),
560 TWL4030_OF_MATCH("ti,twl4030-vpll1", VPLL1),
561 TWL4030_OF_MATCH("ti,twl4030-vpll2", VPLL2),
562 TWL4030_OF_MATCH("ti,twl4030-vsim", VSIM),
563 TWL4030_OF_MATCH("ti,twl4030-vdac", VDAC),
564 TWL4030_OF_MATCH("ti,twl4030-vintana2", VINTANA2),
565 TWL4030_OF_MATCH("ti,twl4030-vio", VIO),
566 TWL4030_OF_MATCH("ti,twl4030-vdd1", VDD1),
567 TWL4030_OF_MATCH("ti,twl4030-vdd2", VDD2),
568 TWLFIXED_OF_MATCH("ti,twl4030-vintana1", VINTANA1),
569 TWLFIXED_OF_MATCH("ti,twl4030-vintdig", VINTDIG),
570 TWLFIXED_OF_MATCH("ti,twl4030-vusb1v5", VUSB1V5),
571 TWLFIXED_OF_MATCH("ti,twl4030-vusb1v8", VUSB1V8),
572 TWLFIXED_OF_MATCH("ti,twl4030-vusb3v1", VUSB3V1),
587 template = of_device_get_match_data(&pdev->dev); in twlreg_probe()
589 return -ENODEV; in twlreg_probe()
591 id = template->desc.id; in twlreg_probe()
592 initdata = of_get_regulator_init_data(&pdev->dev, pdev->dev.of_node, in twlreg_probe()
593 &template->desc); in twlreg_probe()
595 return -EINVAL; in twlreg_probe()
597 info = devm_kmemdup(&pdev->dev, template, sizeof(*info), GFP_KERNEL); in twlreg_probe()
599 return -ENOMEM; in twlreg_probe()
601 /* Constrain board-specific capabilities according to what in twlreg_probe()
604 c = &initdata->constraints; in twlreg_probe()
605 c->valid_modes_mask &= REGULATOR_MODE_NORMAL | REGULATOR_MODE_STANDBY; in twlreg_probe()
606 c->valid_ops_mask &= REGULATOR_CHANGE_VOLTAGE in twlreg_probe()
617 c->always_on = true; in twlreg_probe()
623 config.dev = &pdev->dev; in twlreg_probe()
626 config.of_node = pdev->dev.of_node; in twlreg_probe()
628 rdev = devm_regulator_register(&pdev->dev, &info->desc, &config); in twlreg_probe()
630 dev_err(&pdev->dev, "can't register %s, %ld\n", in twlreg_probe()
631 info->desc.name, PTR_ERR(rdev)); in twlreg_probe()
636 twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_REMAP, info->remap); in twlreg_probe()
638 /* NOTE: many regulators support short-circuit IRQs (presentable in twlreg_probe()
640 * - SC_CONFIG in twlreg_probe()
641 * - SC_DETECT1 (vintana2, vmmc1/2, vaux1/2/3/4) in twlreg_probe()
642 * - SC_DETECT2 (vusb, vdac, vio, vdd1/2, vpll2) in twlreg_probe()
643 * - IT_CONFIG in twlreg_probe()