usb: typec: tcpci_maxim: Enable VSAFE0V signalling
Unmask EXTENDED_STATUS_MASK.vSafe0V, ALERT.Extended_Status and set vbus_vsafe0v to enable VSAFE0V signalling. Reviewed-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com> Link: https://lore.kernel.org/r/20201202040840.663578-3-badhri@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
766c485b86
commit
0fbb7d06d3
|
@ -112,11 +112,18 @@ static void max_tcpci_init_regs(struct max_tcpci_chip *chip)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Enable VSAFE0V detection */
|
||||||
|
ret = max_tcpci_write8(chip, TCPC_EXTENDED_STATUS_MASK, TCPC_EXTENDED_STATUS_VSAFE0V);
|
||||||
|
if (ret < 0) {
|
||||||
|
dev_err(chip->dev, "Unable to unmask TCPC_EXTENDED_STATUS_VSAFE0V ret:%d\n", ret);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
alert_mask = TCPC_ALERT_TX_SUCCESS | TCPC_ALERT_TX_DISCARDED | TCPC_ALERT_TX_FAILED |
|
alert_mask = TCPC_ALERT_TX_SUCCESS | TCPC_ALERT_TX_DISCARDED | TCPC_ALERT_TX_FAILED |
|
||||||
TCPC_ALERT_RX_HARD_RST | TCPC_ALERT_RX_STATUS | TCPC_ALERT_CC_STATUS |
|
TCPC_ALERT_RX_HARD_RST | TCPC_ALERT_RX_STATUS | TCPC_ALERT_CC_STATUS |
|
||||||
TCPC_ALERT_VBUS_DISCNCT | TCPC_ALERT_RX_BUF_OVF | TCPC_ALERT_POWER_STATUS |
|
TCPC_ALERT_VBUS_DISCNCT | TCPC_ALERT_RX_BUF_OVF | TCPC_ALERT_POWER_STATUS |
|
||||||
/* Enable Extended alert for detecting Fast Role Swap Signal */
|
/* Enable Extended alert for detecting Fast Role Swap Signal */
|
||||||
TCPC_ALERT_EXTND;
|
TCPC_ALERT_EXTND | TCPC_ALERT_EXTENDED_STATUS;
|
||||||
|
|
||||||
ret = max_tcpci_write16(chip, TCPC_ALERT_MASK, alert_mask);
|
ret = max_tcpci_write16(chip, TCPC_ALERT_MASK, alert_mask);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
@ -315,6 +322,12 @@ static irqreturn_t _max_tcpci_irq(struct max_tcpci_chip *chip, u16 status)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (status & TCPC_ALERT_EXTENDED_STATUS) {
|
||||||
|
ret = max_tcpci_read8(chip, TCPC_EXTENDED_STATUS, (u8 *)®_status);
|
||||||
|
if (ret >= 0 && (reg_status & TCPC_EXTENDED_STATUS_VSAFE0V))
|
||||||
|
tcpm_vbus_change(chip->port);
|
||||||
|
}
|
||||||
|
|
||||||
if (status & TCPC_ALERT_RX_STATUS)
|
if (status & TCPC_ALERT_RX_STATUS)
|
||||||
process_rx(chip, status);
|
process_rx(chip, status);
|
||||||
|
|
||||||
|
@ -442,6 +455,7 @@ static int max_tcpci_probe(struct i2c_client *client, const struct i2c_device_id
|
||||||
chip->data.init = tcpci_init;
|
chip->data.init = tcpci_init;
|
||||||
chip->data.frs_sourcing_vbus = max_tcpci_frs_sourcing_vbus;
|
chip->data.frs_sourcing_vbus = max_tcpci_frs_sourcing_vbus;
|
||||||
chip->data.auto_discharge_disconnect = true;
|
chip->data.auto_discharge_disconnect = true;
|
||||||
|
chip->data.vbus_vsafe0v = true;
|
||||||
|
|
||||||
max_tcpci_init_regs(chip);
|
max_tcpci_init_regs(chip);
|
||||||
chip->tcpci = tcpci_register_port(chip->dev, &chip->data);
|
chip->tcpci = tcpci_register_port(chip->dev, &chip->data);
|
||||||
|
|
Loading…
Reference in New Issue