Browse Source

disp: msm: dp: change dp driver to align with usb changes

Originally, a call is made to dwc3_msm_release_ss_lane to
notify the USB driver that DP 4 lane is in use. This was
cleared on USB disconnect. Combined with the autosuspend
timeout and UCSI notifying that USB was not needed, this
caused issues in bringing up the monitors.

This change implements a new api call from the USB driver,
dwc3_msm_set_dp_mode. DP driver makes a call to this api to
notify USB driver for 2 lane, 4 lane, and disconnected states.

Change-Id: I051e5424c518ca84e2cc6dc27c114715dc287ac0
Signed-off-by: Sudarsan Ramesh <[email protected]>
Sudarsan Ramesh 4 years ago
parent
commit
d914d696bf
1 changed files with 13 additions and 7 deletions
  1. 13 7
      msm/dp/dp_altmode.c

+ 13 - 7
msm/dp/dp_altmode.c

@@ -40,13 +40,14 @@ enum dp_altmode_pin_assignment {
 	DPAM_HPD_F,
 };
 
-static int dp_altmode_release_ss_lanes(struct dp_altmode_private *altmode)
+static int dp_altmode_set_usb_dp_mode(struct dp_altmode_private *altmode)
 {
 	int rc;
 	struct device_node *np;
 	struct device_node *usb_node;
 	struct platform_device *usb_pdev;
 	int timeout = 250;
+	u32 lanes = 4;
 
 	if (!altmode || !altmode->dev) {
 		DP_ERR("invalid args\n");
@@ -55,6 +56,9 @@ static int dp_altmode_release_ss_lanes(struct dp_altmode_private *altmode)
 
 	np = altmode->dev->of_node;
 
+	if (altmode->connected && altmode->dp_altmode.base.force_multi_func)
+		lanes = 2;
+
 	usb_node = of_parse_phandle(np, "usb-controller", 0);
 	if (!usb_node) {
 		DP_ERR("unable to get usb node\n");
@@ -69,7 +73,7 @@ static int dp_altmode_release_ss_lanes(struct dp_altmode_private *altmode)
 	}
 
 	while (timeout) {
-		rc = dwc3_msm_release_ss_lane(&usb_pdev->dev);
+		rc = dwc3_msm_set_dp_mode(&usb_pdev->dev, altmode->connected, lanes);
 		if (rc != -EBUSY)
 			break;
 
@@ -150,6 +154,10 @@ static int dp_altmode_notify(void *priv, void *data, size_t len)
 			altmode->dp_altmode.base.orientation = ORIENTATION_NONE;
 			if (altmode->dp_cb && altmode->dp_cb->disconnect)
 				altmode->dp_cb->disconnect(altmode->dev);
+
+			rc = dp_altmode_set_usb_dp_mode(altmode);
+			if (rc)
+				DP_ERR("failed to clear usb dp mode, rc: %d\n", rc);
 		}
 		goto ack;
 	}
@@ -177,11 +185,9 @@ static int dp_altmode_notify(void *priv, void *data, size_t len)
 
 		altmode->dp_altmode.base.orientation = orientation;
 
-		if (!altmode->dp_altmode.base.multi_func) {
-			rc = dp_altmode_release_ss_lanes(altmode);
-			if (rc)
-				goto ack;
-		}
+		rc = dp_altmode_set_usb_dp_mode(altmode);
+		if (rc)
+			goto ack;
 
 		if (altmode->dp_cb && altmode->dp_cb->configure)
 			altmode->dp_cb->configure(altmode->dev);