Lines Matching +full:has +full:- +full:interrupt +full:- +full:mask +full:- +full:reg
3 * SPDX-License-Identifier: Apache-2.0
212 int tcpci_read_reg8(const struct i2c_dt_spec *i2c, uint8_t reg, uint8_t *value) in tcpci_read_reg8() argument
217 ret = i2c_write_read(i2c->bus, i2c->addr, ®, sizeof(reg), value, sizeof(*value)); in tcpci_read_reg8()
225 LOG_ERR(LOG_COMM_ERR_STR, i2c->bus->name, i2c->addr, "r8", reg, *value); in tcpci_read_reg8()
231 int tcpci_write_reg8(const struct i2c_dt_spec *i2c, uint8_t reg, uint8_t value) in tcpci_write_reg8() argument
233 uint8_t buf[2] = {reg, value}; in tcpci_write_reg8()
237 ret = i2c_write(i2c->bus, buf, 2, i2c->addr); in tcpci_write_reg8()
245 LOG_ERR(LOG_COMM_ERR_STR, i2c->bus->name, i2c->addr, "w8", reg, value); in tcpci_write_reg8()
251 int tcpci_update_reg8(const struct i2c_dt_spec *i2c, uint8_t reg, uint8_t mask, uint8_t value) in tcpci_update_reg8() argument
256 ret = tcpci_read_reg8(i2c, reg, &old_value); in tcpci_update_reg8()
261 old_value &= ~mask; in tcpci_update_reg8()
262 old_value |= (value & mask); in tcpci_update_reg8()
264 ret = tcpci_write_reg8(i2c, reg, old_value); in tcpci_update_reg8()
269 int tcpci_read_reg16(const struct i2c_dt_spec *i2c, uint8_t reg, uint16_t *value) in tcpci_read_reg16() argument
274 ret = i2c_write_read(i2c->bus, i2c->addr, ®, sizeof(reg), value, sizeof(*value)); in tcpci_read_reg16()
283 LOG_ERR(LOG_COMM_ERR_STR, i2c->bus->name, i2c->addr, "r16", reg, *value); in tcpci_read_reg16()
289 int tcpci_write_reg16(const struct i2c_dt_spec *i2c, uint8_t reg, uint16_t value) in tcpci_write_reg16() argument
293 uint8_t buf[3] = {reg, value_ptr[0], value_ptr[1]}; in tcpci_write_reg16()
297 ret = i2c_write(i2c->bus, buf, 3, i2c->addr); in tcpci_write_reg16()
304 LOG_ERR(LOG_COMM_ERR_STR, i2c->bus->name, i2c->addr, "w16", reg, value); in tcpci_write_reg16()
310 enum tcpc_alert tcpci_alert_reg_to_enum(uint16_t reg) in tcpci_alert_reg_to_enum() argument
313 * Hard reset enum has priority since it causes other bits to be ignored. Other values in tcpci_alert_reg_to_enum()
316 if (reg & TCPC_REG_ALERT_RX_HARD_RST) { in tcpci_alert_reg_to_enum()
319 } else if (reg & TCPC_REG_ALERT_CC_STATUS) { in tcpci_alert_reg_to_enum()
322 } else if (reg & TCPC_REG_ALERT_POWER_STATUS) { in tcpci_alert_reg_to_enum()
325 } else if (reg & TCPC_REG_ALERT_RX_STATUS) { in tcpci_alert_reg_to_enum()
328 } else if (reg & TCPC_REG_ALERT_TX_FAILED) { in tcpci_alert_reg_to_enum()
331 } else if (reg & TCPC_REG_ALERT_TX_DISCARDED) { in tcpci_alert_reg_to_enum()
337 } else if (reg & TCPC_REG_ALERT_TX_SUCCESS) { in tcpci_alert_reg_to_enum()
340 } else if (reg & TCPC_REG_ALERT_V_ALARM_HI) { in tcpci_alert_reg_to_enum()
341 /** A high-voltage alarm has occurred */ in tcpci_alert_reg_to_enum()
343 } else if (reg & TCPC_REG_ALERT_V_ALARM_LO) { in tcpci_alert_reg_to_enum()
344 /** A low-voltage alarm has occurred */ in tcpci_alert_reg_to_enum()
346 } else if (reg & TCPC_REG_ALERT_FAULT) { in tcpci_alert_reg_to_enum()
347 /** A fault has occurred. Read the FAULT_STATUS register */ in tcpci_alert_reg_to_enum()
349 } else if (reg & TCPC_REG_ALERT_RX_BUF_OVF) { in tcpci_alert_reg_to_enum()
350 /** TCPC RX buffer has overflowed */ in tcpci_alert_reg_to_enum()
352 } else if (reg & TCPC_REG_ALERT_VBUS_DISCNCT) { in tcpci_alert_reg_to_enum()
353 /** The TCPC in Attached.SNK state has detected a sink disconnect */ in tcpci_alert_reg_to_enum()
355 } else if (reg & TCPC_REG_ALERT_RX_BEGINNING) { in tcpci_alert_reg_to_enum()
358 } else if (reg & TCPC_REG_ALERT_EXT_STATUS) { in tcpci_alert_reg_to_enum()
361 } else if (reg & TCPC_REG_ALERT_ALERT_EXT) { in tcpci_alert_reg_to_enum()
363 * An extended interrupt event has occurred. Read the alert_extended in tcpci_alert_reg_to_enum()
367 } else if (reg & TCPC_REG_ALERT_VENDOR_DEF) { in tcpci_alert_reg_to_enum()
368 /** A vendor defined alert has been detected */ in tcpci_alert_reg_to_enum()
373 return -1; in tcpci_alert_reg_to_enum()
385 return -EINVAL; in tcpci_tcpm_get_cc()