@@ -1107,6 +1107,26 @@ nouveau_connector_hotplug(struct nvif_notify *notify)
1107
1107
const struct nvif_notify_conn_rep_v0 * rep = notify -> data ;
1108
1108
const char * name = connector -> name ;
1109
1109
struct nouveau_encoder * nv_encoder ;
1110
+ int ret ;
1111
+
1112
+ ret = pm_runtime_get (drm -> dev -> dev );
1113
+ if (ret == 0 ) {
1114
+ /* We can't block here if there's a pending PM request
1115
+ * running, as we'll deadlock nouveau_display_fini() when it
1116
+ * calls nvif_put() on our nvif_notify struct. So, simply
1117
+ * defer the hotplug event until the device finishes resuming
1118
+ */
1119
+ NV_DEBUG (drm , "Deferring HPD on %s until runtime resume\n" ,
1120
+ name );
1121
+ schedule_work (& drm -> hpd_work );
1122
+
1123
+ pm_runtime_put_noidle (drm -> dev -> dev );
1124
+ return NVIF_NOTIFY_KEEP ;
1125
+ } else if (ret != 1 && ret != - EACCES ) {
1126
+ NV_WARN (drm , "HPD on %s dropped due to RPM failure: %d\n" ,
1127
+ name , ret );
1128
+ return NVIF_NOTIFY_DROP ;
1129
+ }
1110
1130
1111
1131
if (rep -> mask & NVIF_NOTIFY_CONN_V0_IRQ ) {
1112
1132
NV_DEBUG (drm , "service %s\n" , name );
@@ -1124,6 +1144,8 @@ nouveau_connector_hotplug(struct nvif_notify *notify)
1124
1144
drm_helper_hpd_irq_event (connector -> dev );
1125
1145
}
1126
1146
1147
+ pm_runtime_mark_last_busy (drm -> dev -> dev );
1148
+ pm_runtime_put_autosuspend (drm -> dev -> dev );
1127
1149
return NVIF_NOTIFY_KEEP ;
1128
1150
}
1129
1151
0 commit comments