@@ -1120,6 +1120,26 @@ nouveau_connector_hotplug(struct nvif_notify *notify)
1120
1120
const struct nvif_notify_conn_rep_v0 * rep = notify -> data ;
1121
1121
const char * name = connector -> name ;
1122
1122
struct nouveau_encoder * nv_encoder ;
1123
+ int ret ;
1124
+
1125
+ ret = pm_runtime_get (drm -> dev -> dev );
1126
+ if (ret == 0 ) {
1127
+ /* We can't block here if there's a pending PM request
1128
+ * running, as we'll deadlock nouveau_display_fini() when it
1129
+ * calls nvif_put() on our nvif_notify struct. So, simply
1130
+ * defer the hotplug event until the device finishes resuming
1131
+ */
1132
+ NV_DEBUG (drm , "Deferring HPD on %s until runtime resume\n" ,
1133
+ name );
1134
+ schedule_work (& drm -> hpd_work );
1135
+
1136
+ pm_runtime_put_noidle (drm -> dev -> dev );
1137
+ return NVIF_NOTIFY_KEEP ;
1138
+ } else if (ret != 1 && ret != - EACCES ) {
1139
+ NV_WARN (drm , "HPD on %s dropped due to RPM failure: %d\n" ,
1140
+ name , ret );
1141
+ return NVIF_NOTIFY_DROP ;
1142
+ }
1123
1143
1124
1144
if (rep -> mask & NVIF_NOTIFY_CONN_V0_IRQ ) {
1125
1145
NV_DEBUG (drm , "service %s\n" , name );
@@ -1137,6 +1157,8 @@ nouveau_connector_hotplug(struct nvif_notify *notify)
1137
1157
drm_helper_hpd_irq_event (connector -> dev );
1138
1158
}
1139
1159
1160
+ pm_runtime_mark_last_busy (drm -> dev -> dev );
1161
+ pm_runtime_put_autosuspend (drm -> dev -> dev );
1140
1162
return NVIF_NOTIFY_KEEP ;
1141
1163
}
1142
1164
0 commit comments