MLK-16285-2 staging: typec: tcpci: add optional reset pin support
authorPeter Chen <peter.chen@nxp.com>
Fri, 15 Sep 2017 02:48:19 +0000 (10:48 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:38:36 +0000 (15:38 -0500)
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>
drivers/staging/typec/tcpci.c

index 3f1c505..151b2b9 100644 (file)
@@ -701,6 +701,16 @@ snk_setting_wrong:
 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);