[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200914164639.1487650-4-angus@akkea.ca>
Date: Mon, 14 Sep 2020 09:46:38 -0700
From: Angus Ainslie <angus@...ea.ca>
To: kernel@...i.sm
Cc: MyungJoo Ham <myungjoo.ham@...sung.com>,
Chanwoo Choi <cw00.choi@...sung.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org,
bryan.odonoghue@...aro.org, Angus Ainslie <angus@...ea.ca>
Subject: [PATCH 3/4] usb: typec: tps6598x: Add the extcon USB chargers
Notify extcon devcies that the charge current has changed
Signed-off-by: Angus Ainslie <angus@...ea.ca>
---
drivers/usb/typec/tps6598x.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/typec/tps6598x.c b/drivers/usb/typec/tps6598x.c
index 3b06d43c810d..d5aa58c9da0a 100644
--- a/drivers/usb/typec/tps6598x.c
+++ b/drivers/usb/typec/tps6598x.c
@@ -240,17 +240,25 @@ static void tps6589x_set_extcon_state(struct tps6598x *tps,
EXTCON_PROP_USB_VBUS_SRC,
val);
+ extcon_set_state(tps->edev, EXTCON_CHG_USB_SDP, 0);
+ extcon_set_state(tps->edev, EXTCON_CHG_USB_DCP, 0);
+ extcon_set_state(tps->edev, EXTCON_CHG_USB_CDP, 0);
+ extcon_set_state(tps->edev, EXTCON_CHG_USB_SLOW, 0);
+ extcon_set_state(tps->edev, EXTCON_CHG_USB_FAST, 0);
+
switch (TPS_POWER_STATUS_PWROPMODE(pwr_status)) {
case TYPEC_PWR_MODE_USB:
- max_current = 500;
+ max_current = val.intval = 500;
extcon_set_state(tps->edev, EXTCON_CHG_USB_SDP, state);
extcon_set_state(tps->edev, EXTCON_CHG_USB_SLOW, state);
break;
case TYPEC_PWR_MODE_1_5A:
- max_current = 1500;
+ max_current = val.intval = 1500;
+ extcon_set_state(tps->edev, EXTCON_CHG_USB_CDP, state);
break;
case TYPEC_PWR_MODE_3_0A:
- max_current = 3000;
+ max_current = val.intval = 3000;
+ extcon_set_state(tps->edev, EXTCON_CHG_USB_CDP, state);
break;
case TYPEC_PWR_MODE_PD:
max_current = 500;
@@ -265,10 +273,14 @@ static void tps6589x_set_extcon_state(struct tps6598x *tps,
EXTCON_PROP_USB_VBUS_CURRENT,
val);
- extcon_sync(tps->edev, EXTCON_USB);
- extcon_sync(tps->edev, EXTCON_USB_HOST);
extcon_sync(tps->edev, EXTCON_CHG_USB_SDP);
+ extcon_sync(tps->edev, EXTCON_CHG_USB_CDP);
+ extcon_sync(tps->edev, EXTCON_CHG_USB_DCP);
extcon_sync(tps->edev, EXTCON_CHG_USB_SLOW);
+ extcon_sync(tps->edev, EXTCON_CHG_USB_FAST);
+ /* do these last for extcon notifiers */
+ extcon_sync(tps->edev, EXTCON_USB);
+ extcon_sync(tps->edev, EXTCON_USB_HOST);
}
#endif
@@ -562,6 +574,8 @@ static const unsigned int tps6598x_extcon_cable[] = {
EXTCON_USB,
EXTCON_USB_HOST,
EXTCON_CHG_USB_SDP,
+ EXTCON_CHG_USB_CDP,
+ EXTCON_CHG_USB_DCP,
EXTCON_CHG_USB_SLOW,
EXTCON_CHG_USB_FAST,
EXTCON_NONE,
--
2.25.1
Powered by blists - more mailing lists