Lines Matching full:utcpd

30  * 1. UTCPD, interfacing to external circuit on VBUS/VCONN voltage measurement,
33 * TCPC is implemented in UTCPD majorly; PPC and VBUS rely on TCPC for
35 * 2. For VBUS/VCONN voltage measurement, UTCPD is updated periodically
37 * will cover UTCPD, EADC, and Timer H/W characteristics of registers,
47 * (2) UTCPD
51 * (3) UTCPD
60 * @brief UTCPD VBUS threshold default in mV
62 * These are default values of UTCPD VBUS threshold registers. They need
65 * 2. UTCPD VBVOL.VBSCALE
85 * @brief UTCPD register write timeout in microseconds
90 * @brief UTCPD register write by name
96 LOG_ERR("UTCPD register (%s) write timeout", #reg_name); \
104 * @brief UTCPD register force write by name
110 LOG_ERR("UTCPD register (%s) write timeout, force-write", #reg_name); \
117 * @brief UTCPD register write by offset
123 LOG_ERR("UTCPD register (0x%04x) write timeout", reg_offset); \
131 * @brief UTCPD register force write by offset
137 LOG_ERR("UTCPD register (0x%04x) write timeout, force-write", reg_offset); \
144 * @brief UTCPD register read by name
149 * @brief UTCPD register read by offset
155 * @brief UTCPD register dump
158 LOG_INF("UTCPD: %8s: 0x%08x", #reg_name, NUMAKER_UTCPD_REG_READ_BY_NAME(dev, reg_name));
161 * @brief Helper to write UTCPD VBUS threshold
173 * @brief Helper to read UTCPD VBUS threshold
216 } utcpd; member
265 * @brief Wait ready for next write access to UTCPD register
288 * 2. UTCPD VBVOL.VBSCALE
290 * @note UTCPD VBVOL.VBVOL = MSB 10-bit of EADC DAT.RESULT[11:0],
299 return (uint32_t)(((uint64_t)bit) * data->vref_mv * config->utcpd.vbvol.vbscale.value / in numaker_utcpd_vbus_volt_bit2mv()
308 * 2. UTCPD VBVOL.VBSCALE
310 * @note UTCPD VBVOL.VBVOL = MSB 10-bit of EADC DAT.RESULT[11:0],
319 return mv * BIT_MASK(10) / data->vref_mv / config->utcpd.vbvol.vbscale.value; in numaker_utcpd_vbus_volt_mv2bit()
323 * @brief UTCPD register dump
336 /* UTCPD register */ in numaker_utcpd_dump_regs()
450 * @brief Reads and returns UTCPD VBUS measured in mV
482 * @brief Check if the UTCPD VBUS is present
484 * @retval 1 if UTCPD VBUS is present
485 * @retval 0 if UTCPD VBUS is not present
501 * @brief Check if the UTCPD VBUS is sourcing
503 * @retval 1 if UTCPD VBUS is sourcing
504 * @retval 0 if UTCPD VBUS is not sourcing
520 * @brief Check if the UTCPD VBUS is sinking
522 * @retval 1 if UTCPD VBUS is sinking
523 * @retval 0 if UTCPD VBUS is not sinking
539 * @brief Enable or disable discharge on UTCPD VBUS
549 const struct gpio_dt_spec *vbus_discharge_spec = &config->utcpd.gpios.vbus_discharge; in numaker_utcpd_vbus_set_discharge()
557 /* Use UTCPD VBUS discharge */ in numaker_utcpd_vbus_set_discharge()
572 * @brief Enable or disable UTCPD BIST test mode
599 * @brief Check if UTCPD BIST test mode is enabled
601 * @retval 1 if UTCPD BIST test mode is enabled
602 * @retval 0 if UTCPD BIST test mode is not enabled
618 * @brief Clears UTCPD Rx message FIFO
632 * @brief Reads Rx message data from UTCPD
691 * @brief Writes Tx message data to UTCPD
756 * @brief Enqueues UTCPD Rx message
781 LOG_ERR("Invalid UTCPD.RXBCNT: %d", rxbcnt); in numaker_utcpd_rx_fifo_enqueue()
857 * @brief UTCPD ISR
859 * @note UTCPD register write cannot be failed, or we may trap in ISR for
934 LOG_WRN("UTCPD VBUS voltage alarm high not addressed, disable the alert"); in numaker_utcpd_isr()
942 LOG_WRN("UTCPD VBUS voltage alarm low not addressed, disable the alert"); in numaker_utcpd_isr()
950 LOG_ERR("UTCPD fault (FUTSTS=0x%08x)", futsts); in numaker_utcpd_isr()
955 LOG_WRN("UTCPD fault (FUTSTS=0x%08x) not addressed, disable fault alert (FUTSTSIE)", in numaker_utcpd_isr()
1051 /* UTCPD VBUS scale factor */ in numaker_utcpd_vbus_init()
1053 vbvol |= config->utcpd.vbvol.vbscale.bit; in numaker_utcpd_vbus_init()
1066 /* UTCPD VBUS overvoltage threshold */ in numaker_utcpd_vbus_init()
1073 /* UTCPD VBUS vSafe5V threshold */ in numaker_utcpd_vbus_init()
1080 /* UTCPD VBUS vSafe0V threshold */ in numaker_utcpd_vbus_init()
1087 /* UTCPD VBUS stop force discharge threshold */ in numaker_utcpd_vbus_init()
1094 /* UTCPD VBUS sink disconnect threshold */ in numaker_utcpd_vbus_init()
1102 /* Enable UTCPD VBUS voltage monitor so that UTCPD.VBVOL is available */ in numaker_utcpd_vbus_init()
1108 /* Disable UTCPD VBUS voltage alarms */ in numaker_utcpd_vbus_init()
1110 /* Disable UTCPD VBUS auto-discharge on disconnect in numaker_utcpd_vbus_init()
1111 * NOTE: UTCPD may not integrate with discharge, so this feature is in numaker_utcpd_vbus_init()
1119 * @brief Initializes UTCPD GPIO pins
1131 spec = &config->utcpd.gpios.vbus_detect; in numaker_utcpd_gpios_init()
1147 spec = &config->utcpd.gpios.vbus_discharge; in numaker_utcpd_gpios_init()
1161 spec = &config->utcpd.gpios.vconn_discharge; in numaker_utcpd_gpios_init()
1178 * @brief Initializes UTCPD PHY
1199 * @brief Checks if UTCPD Dead Battery mode is enabled
1217 * @brief Enables or disables UTCPD Dead Battery mode
1232 /* UTCPD.ROLCTL controls internal Rd/Rp */ in numaker_utcpd_deadbattery_set_enable()
1239 * @brief Initializes UTCPD Dead Battery mode
1248 return numaker_utcpd_deadbattery_set_enable(dev, config->utcpd.dead_battery); in numaker_utcpd_deadbattery_init()
1252 * @brief Initializes UTCPD interrupts
1304 * @brief Initializes UTCPD at stack recycle
1349 * @brief Initializes UTCPD at device startup
1363 /* UTCPD GPIO */ in numaker_utcpd_init_startup()
1369 /* UTCPD PHY */ in numaker_utcpd_init_startup()
1375 /* UTCPD Dead Battery */ in numaker_utcpd_init_startup()
1381 /* UTCPD pin polarity */ in numaker_utcpd_init_startup()
1382 pinpl = config->utcpd.pinpl.bit; in numaker_utcpd_init_startup()
1394 /* UTCPD fault in numaker_utcpd_init_startup()
1407 /* UTCPD interconnection select in numaker_utcpd_init_startup()
1415 * is supposed to be invalid EADC channel number so that UTCPD won't get updated in numaker_utcpd_init_startup()
1530 /* Initialize UTCPD for attach/detach recycle */ in numaker_tcpc_init_recycle()
1599 /* Initialize UTCPD */ in numaker_tcpc_init_startup()
1749 * internal Rd/Rp gets controlled by to UTCPD.ROLCTL in numaker_tcpc_set_cc()
1846 const struct gpio_dt_spec *vconn_discharge_spec = &config->utcpd.gpios.vconn_discharge; in numaker_tcpc_vconn_discharge()
1862 /* Use UTCPD VCONN discharge */ in numaker_tcpc_vconn_discharge()
1892 /* Use UTCPD VCONN */ in numaker_tcpc_set_vconn()
2360 /* UTCPD GPIOs */
2371 /* UTCPD.PINPL.<PIN> cast */
2376 /* UTCPD.VBVOL.VBSCALE cast */
2389 /* UTCPD.PINPL */
2403 /* UTCPD.VBVOL */
2515 IRQ_CONNECT(DT_INST_IRQ_BY_NAME(inst, utcpd, irq), \
2516 DT_INST_IRQ_BY_NAME(inst, utcpd, priority), numaker_utcpd_isr, \
2519 irq_enable(DT_INST_IRQ_BY_NAME(inst, utcpd, irq)); \
2524 irq_disable(DT_INST_IRQ_BY_NAME(inst, utcpd, irq)); \
2528 .utcpd_base = (UTCPD_T *)DT_INST_REG_ADDR_BY_NAME(inst, utcpd), \
2533 .pcc_utcpd = NUMAKER_PCC_INST_GET_BY_NAME(inst, utcpd), \
2535 .reset_utcpd = NUMAKER_RESET_DT_SPEC_INST_GET_BY_NAME(inst, utcpd), \
2539 .utcpd = NUMAKER_UTCPD_INIT(inst), \