From: Wu Liang feng Date: Sat, 15 Oct 2016 03:49:18 +0000 (+0800) Subject: mfd: fusb302: correct extcon cable state when enable vbus X-Git-Tag: firefly_0821_release~1393 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e90169f79e31c82918b25569904744c6d0341dd8;p=firefly-linux-kernel-4.4.55.git mfd: fusb302: correct extcon cable state when enable vbus Set extcon cable state to EXTCON_USB_VBUS_EN instead of EXTCON_USB_HOST when enable vbus 5v. Because EXTCON_USB_HOST state means that fusb302 has detected Type-C mode and the orientation. However, enable vbus is prior to Type-C mode and orientation detection. If we set EXTCON_USB_HOST state when power on vbus, it may cause usb controller driver to receive the state prematurely, and do tcphy orientation init improperly. Change-Id: Id65072dc8235693db44667ee5d2ceac74dc94920 Signed-off-by: Wu Liang feng --- diff --git a/drivers/mfd/fusb302.c b/drivers/mfd/fusb302.c index 7bf2a65aa99f..effa6968d1a1 100644 --- a/drivers/mfd/fusb302.c +++ b/drivers/mfd/fusb302.c @@ -214,6 +214,8 @@ static void platform_set_vbus_lvl_enable(struct fusb30x_chip *chip, int vbus_5v, { if (chip->gpio_vbus_5v) { gpiod_set_raw_value(chip->gpio_vbus_5v, vbus_5v); + /* Only set state here, don't sync notifier to PMIC */ + extcon_set_state(chip->extcon, EXTCON_USB_VBUS_EN, vbus_5v); } else { extcon_set_state(chip->extcon, EXTCON_USB_VBUS_EN, vbus_5v); extcon_sync(chip->extcon, EXTCON_USB_VBUS_EN); @@ -1323,7 +1325,6 @@ static void fusb_state_attach_wait_source(struct fusb30x_chip *chip, int evt) static void fusb_state_attached_source(struct fusb30x_chip *chip, int evt) { tcpm_set_polarity(chip, !(chip->cc_state & 0x01)); - extcon_set_state(chip->extcon, EXTCON_USB_HOST, 1); platform_set_vbus_lvl_enable(chip, 1, 0); tcpm_set_vconn(chip, 1);