OSDN Git Service

staging: typec: tcpci: enable vbus detection
authorLi Jun <jun.li@nxp.com>
Tue, 26 Jun 2018 23:45:28 +0000 (07:45 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Jun 2018 10:49:48 +0000 (19:49 +0900)
TCPCI implementation may need SW to enable VBUS detection to generate
power status events.

Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/typec/tcpci.c

index 3b35fce..4d3b0ae 100644 (file)
@@ -373,6 +373,12 @@ static int tcpci_init(struct tcpc_dev *tcpc)
        if (ret < 0)
                return ret;
 
+       /* Enable Vbus detection */
+       ret = regmap_write(tcpci->regmap, TCPC_COMMAND,
+                          TCPC_CMD_ENABLE_VBUS_DETECT);
+       if (ret < 0)
+               return ret;
+
        reg = TCPC_ALERT_TX_SUCCESS | TCPC_ALERT_TX_FAILED |
                TCPC_ALERT_TX_DISCARDED | TCPC_ALERT_RX_STATUS |
                TCPC_ALERT_RX_HARD_RST | TCPC_ALERT_CC_STATUS;