Lines Matching +full:primary +full:- +full:pmic
1 // SPDX-License-Identifier: GPL-2.0
4 * - LP8764
5 * - TPS65224
6 * - TPS652G1
7 * - TPS6593
8 * - TPS6594
10 * Copyright (C) 2023 BayLibre Incorporated - https://www.baylibre.com/
132 MFD_CELL_RES("tps6594-regulator", tps6594_regulator_resources),
133 MFD_CELL_RES("tps6594-pinctrl", tps6594_pinctrl_resources),
134 MFD_CELL_RES("tps6594-pfsm", tps6594_pfsm_resources),
135 MFD_CELL_RES("tps6594-esm", tps6594_esm_resources),
139 MFD_CELL_RES("tps6594-rtc", tps6594_rtc_resources),
344 MFD_CELL_RES("tps65224-adc", tps65224_adc_resources),
345 MFD_CELL_RES("tps6594-pfsm", tps65224_pfsm_resources),
346 MFD_CELL_RES("tps6594-pinctrl", tps65224_pinctrl_resources),
347 MFD_CELL_RES("tps6594-regulator", tps65224_regulator_resources),
425 MFD_CELL_RES("tps6594-pfsm", tps65224_pfsm_resources),
426 MFD_CELL_RES("tps6594-pinctrl", tps65224_pinctrl_resources),
427 MFD_CELL_NAME("tps6594-regulator"),
496 * When CRC is enabled, writing to a read-only bit triggers an error, in tps6594_handle_post_irq()
498 * (that must be cleared) and read-only bits are sometimes grouped in in tps6594_handle_post_irq()
501 * an interrupt bit in a register containing also a read-only bit makes in tps6594_handle_post_irq()
505 if (tps->use_crc) { in tps6594_handle_post_irq()
506 if (tps->chip_id == TPS65224 || tps->chip_id == TPS652G1) { in tps6594_handle_post_irq()
514 ret = regmap_write_bits(tps->regmap, regmap_reg, mask_val, mask_val); in tps6594_handle_post_irq()
582 if (tps->chip_id == TPS65224 || tps->chip_id == TPS652G1) { in tps6594_check_crc_mode()
594 tps->use_crc = true; in tps6594_check_crc_mode()
595 ret = regmap_test_bits(tps->regmap, regmap_reg, mask_val); in tps6594_check_crc_mode()
597 ret = -EIO; in tps6594_check_crc_mode()
599 dev_info(tps->dev, "CRC feature enabled on %s PMIC", in tps6594_check_crc_mode()
600 primary_pmic ? "primary" : "secondary"); in tps6594_check_crc_mode()
612 if (tps->chip_id == TPS65224 || tps->chip_id == TPS652G1) { in tps6594_set_crc_feature()
624 * on primary PMIC. in tps6594_set_crc_feature()
626 tps->use_crc = false; in tps6594_set_crc_feature()
627 ret = regmap_write_bits(tps->regmap, regmap_reg, mask_val, mask_val); in tps6594_set_crc_feature()
633 * The datasheet indicates 2 ms, and clock specification is +/-5%. in tps6594_set_crc_feature()
646 struct device *dev = tps->dev; in tps6594_enable_crc()
653 * If this mode is specified for primary PMIC, it will also be applied to secondary PMICs in tps6594_enable_crc()
655 * In this multi-PMIC synchronization scheme, the primary PMIC is the controller device in tps6594_enable_crc()
658 is_primary = of_property_read_bool(dev->of_node, "ti,primary-pmic"); in tps6594_enable_crc()
660 /* Enable CRC feature on primary PMIC */ in tps6594_enable_crc()
668 /* Wait for CRC feature enabling event from primary PMIC */ in tps6594_enable_crc()
671 ret = -ETIMEDOUT; in tps6594_enable_crc()
681 struct device *dev = tps->dev; in tps6594_device_init()
693 /* Keep PMIC in ACTIVE state */ in tps6594_device_init()
694 ret = regmap_set_bits(tps->regmap, TPS6594_REG_FSM_NSLEEP_TRIGGERS, in tps6594_device_init()
697 return dev_err_probe(dev, ret, "Failed to set PMIC state\n"); in tps6594_device_init()
699 if (tps->chip_id == TPS65224) { in tps6594_device_init()
703 } else if (tps->chip_id == TPS652G1) { in tps6594_device_init()
713 irq_chip->irq_drv_data = tps; in tps6594_device_init()
714 irq_chip->name = devm_kasprintf(dev, GFP_KERNEL, "%s-%ld-0x%02x", in tps6594_device_init()
715 dev->driver->name, tps->chip_id, tps->reg); in tps6594_device_init()
717 if (!irq_chip->name) in tps6594_device_init()
718 return -ENOMEM; in tps6594_device_init()
720 ret = devm_regmap_add_irq_chip(dev, tps->regmap, tps->irq, IRQF_SHARED | IRQF_ONESHOT, in tps6594_device_init()
721 0, irq_chip, &tps->irq_data); in tps6594_device_init()
726 regmap_irq_get_domain(tps->irq_data)); in tps6594_device_init()
731 if (tps->chip_id != LP8764 && tps->chip_id != TPS65224 && tps->chip_id != TPS652G1) { in tps6594_device_init()
734 regmap_irq_get_domain(tps->irq_data)); in tps6594_device_init()