Explorar o código

disp: msm: dp: force disconnect at simulation mode off

Force a disconnect if the simulation client disables simulation
before disconnecting from the simulated sink. This ensures that
the driver will not erroneously attempt AUX transactions in
subsequent interactions after simulation is disabled.

Change-Id: Ibc581deafe46753c514bccc70ba5c953c8d49bd8
Signed-off-by: Tatenda Chipeperekwa <[email protected]>
Tatenda Chipeperekwa %!s(int64=6) %!d(string=hai) anos
pai
achega
d1fb3ace28
Modificáronse 1 ficheiros con 15 adicións e 1 borrados
  1. 15 1
      msm/dp/dp_debug.c

+ 15 - 1
msm/dp/dp_debug.c

@@ -27,6 +27,7 @@ struct dp_debug_private {
 	u32 dpcd_size;
 	u32 dpcd_size;
 
 
 	u32 mst_con_id;
 	u32 mst_con_id;
+	bool hotplug;
 
 
 	char exe_mode[SZ_32];
 	char exe_mode[SZ_32];
 	char reg_dump[SZ_32];
 	char reg_dump[SZ_32];
@@ -338,10 +339,18 @@ static ssize_t dp_debug_write_hpd(struct file *file,
 		goto end;
 		goto end;
 
 
 	hpd &= hpd_data_mask;
 	hpd &= hpd_data_mask;
+	debug->hotplug = !!(hpd & BIT(0));
 
 
 	debug->dp_debug.psm_enabled = !!(hpd & BIT(1));
 	debug->dp_debug.psm_enabled = !!(hpd & BIT(1));
 
 
-	debug->hpd->simulate_connect(debug->hpd, !!(hpd & BIT(0)));
+	/*
+	 * print hotplug value as this code is executed
+	 * only while running in debug mode which is manually
+	 * triggered by a tester or a script.
+	 */
+	pr_info("%s\n", debug->hotplug ? "[CONNECT]" : "[DISCONNECT]");
+
+	debug->hpd->simulate_connect(debug->hpd, debug->hotplug);
 end:
 end:
 	return len;
 	return len;
 }
 }
@@ -1454,6 +1463,11 @@ static void dp_debug_set_sim_mode(struct dp_debug_private *debug, bool sim)
 		debug->aux->set_sim_mode(debug->aux, true,
 		debug->aux->set_sim_mode(debug->aux, true,
 			debug->edid, debug->dpcd);
 			debug->edid, debug->dpcd);
 	} else {
 	} else {
+		if (debug->hotplug) {
+			pr_warn("sim mode off before hotplug disconnect\n");
+			debug->hpd->simulate_connect(debug->hpd, false);
+			debug->hotplug = false;
+		}
 		debug->aux->abort(debug->aux);
 		debug->aux->abort(debug->aux);
 		debug->ctrl->abort(debug->ctrl);
 		debug->ctrl->abort(debug->ctrl);