From c5e75fc60d987bf27ce9443d1680c4325e3c393f Mon Sep 17 00:00:00 2001 From: Bin Yang Date: Fri, 23 Sep 2016 15:22:34 +0800 Subject: [PATCH] mfd: fusb302: Add EXTCON_USB_VBUS_EN for fusb302 Some rk3399 board(rk3399 MID or rk3399 VR) is use rk81x generated vbus. So need fusb302 send a extcon to notify rk818 when OTG or DP cable plugin. If use EXTCON_USB_HOST, the extcon will notify dwc3 and rk818_charger at the same time,so need to add a new extcon EXTCON_USB_VBUS_EN. Change-Id: Ib019ed7c2d4343c50dcef739ab3076f592979ea0 Signed-off-by: Bin Yang --- drivers/mfd/fusb302.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/fusb302.c b/drivers/mfd/fusb302.c index ca0eb20c0014..3baaa6c21f65 100644 --- a/drivers/mfd/fusb302.c +++ b/drivers/mfd/fusb302.c @@ -103,6 +103,7 @@ static void dump_notify_info(struct fusb30x_chip *chip) static const unsigned int fusb302_cable[] = { EXTCON_USB, EXTCON_USB_HOST, + EXTCON_USB_VBUS_EN, EXTCON_CHG_USB_SDP, EXTCON_CHG_USB_CDP, EXTCON_CHG_USB_DCP, @@ -199,8 +200,13 @@ static void fusb_timer_start(struct hrtimer *timer, int ms) static void platform_set_vbus_lvl_enable(struct fusb30x_chip *chip, int vbus_5v, int vbus_other) { - if (chip->gpio_vbus_5v) + if (chip->gpio_vbus_5v) { gpiod_set_raw_value(chip->gpio_vbus_5v, vbus_5v); + } else { + extcon_set_state(chip->extcon, EXTCON_USB_VBUS_EN, vbus_5v); + extcon_sync(chip->extcon, EXTCON_USB_VBUS_EN); + dev_info(chip->dev, "fusb302 send extcon to enable vbus 5v\n"); + } if (chip->gpio_vbus_other) gpiod_set_raw_value(chip->gpio_vbus_5v, vbus_other); -- 2.34.1