Skip to content

Commit 5a5ccd6

Browse files
RD Babieragregkh
authored andcommitted
usb: typec: altmodes/displayport: Signal hpd when configuring pin assignment
When connecting to some DisplayPort partners, the initial status update after entering DisplayPort Alt Mode notifies that the DFP_D/UFP_D is not in the connected state. This leads to sending a configure message that keeps the device in USB mode. The port partner then sets DFP_D/UFP_D to the connected state and HPD to high in the same Attention message. Currently, the HPD signal is dropped in order to handle configuration. This patch saves changes to the HPD signal when the device chooses to configure during dp_altmode_status_update, and invokes sysfs_notify if necessary for HPD after configuring. Fixes: 0e3bb7d ("usb: typec: Add driver for DisplayPort alternate mode") Cc: stable@vger.kernel.org Signed-off-by: RD Babiera <rdbabiera@google.com> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20230726020903.1409072-1-rdbabiera@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4270d2b commit 5a5ccd6

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

drivers/usb/typec/altmodes/displayport.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ struct dp_altmode {
6060

6161
enum dp_state state;
6262
bool hpd;
63+
bool pending_hpd;
6364

6465
struct mutex lock; /* device lock */
6566
struct work_struct work;
@@ -144,8 +145,13 @@ static int dp_altmode_status_update(struct dp_altmode *dp)
144145
dp->state = DP_STATE_EXIT;
145146
} else if (!(con & DP_CONF_CURRENTLY(dp->data.conf))) {
146147
ret = dp_altmode_configure(dp, con);
147-
if (!ret)
148+
if (!ret) {
148149
dp->state = DP_STATE_CONFIGURE;
150+
if (dp->hpd != hpd) {
151+
dp->hpd = hpd;
152+
dp->pending_hpd = true;
153+
}
154+
}
149155
} else {
150156
if (dp->hpd != hpd) {
151157
drm_connector_oob_hotplug_event(dp->connector_fwnode);
@@ -161,6 +167,16 @@ static int dp_altmode_configured(struct dp_altmode *dp)
161167
{
162168
sysfs_notify(&dp->alt->dev.kobj, "displayport", "configuration");
163169
sysfs_notify(&dp->alt->dev.kobj, "displayport", "pin_assignment");
170+
/*
171+
* If the DFP_D/UFP_D sends a change in HPD when first notifying the
172+
* DisplayPort driver that it is connected, then we wait until
173+
* configuration is complete to signal HPD.
174+
*/
175+
if (dp->pending_hpd) {
176+
drm_connector_oob_hotplug_event(dp->connector_fwnode);
177+
sysfs_notify(&dp->alt->dev.kobj, "displayport", "hpd");
178+
dp->pending_hpd = false;
179+
}
164180

165181
return dp_altmode_notify(dp);
166182
}

0 commit comments

Comments
 (0)