MLK-16285-2 usb: typec: tcpci: add optional reset pin support
authorPeter Chen <peter.chen@nxp.com>
Wed, 9 Jan 2019 08:52:08 +0000 (14:22 +0530)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
Some USB3 differential channel switch chips need to do reset before
functional, we add this support here.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Acked-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
drivers/usb/typec/tcpci.c

index 5923205..87eecb3 100644 (file)
@@ -659,6 +659,16 @@ static int tcpci_parse_config(struct tcpci *tcpci)
 static int tcpci_ss_mux_control_init(struct tcpci *tcpci)
 {
        struct device *dev = tcpci->dev;
+       struct gpio_desc *gpiod_reset;
+
+       gpiod_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
+       if (IS_ERR(gpiod_reset)) {
+               dev_err(dev, "Failed to request reset gpio.");
+               return PTR_ERR(gpiod_reset);
+       }
+
+       if (gpiod_reset)
+               usleep_range(700, 1000);
 
        tcpci->ss_sel_gpio = devm_gpiod_get_optional(dev, "ss-sel",
                                                     GPIOD_OUT_HIGH);