@@ -288,11 +288,58 @@ static void xe_display_flush_cleanup_work(struct xe_device *xe)
288288 }
289289}
290290
291- /* TODO: System and runtime suspend/resume sequences will be sanitized as a follow-up. */
292- static void __xe_display_pm_suspend (struct xe_device * xe , bool runtime )
291+ static void xe_display_enable_d3cold (struct xe_device * xe )
292+ {
293+ struct intel_display * display = & xe -> display ;
294+
295+ if (!xe -> info .probe_display )
296+ return ;
297+
298+ /*
299+ * We do a lot of poking in a lot of registers, make sure they work
300+ * properly.
301+ */
302+ intel_power_domains_disable (display );
303+
304+ xe_display_flush_cleanup_work (xe );
305+
306+ intel_opregion_suspend (display , PCI_D3cold );
307+
308+ intel_dmc_suspend (display );
309+
310+ if (has_display (xe ))
311+ intel_hpd_poll_enable (xe );
312+ }
313+
314+ static void xe_display_disable_d3cold (struct xe_device * xe )
315+ {
316+ struct intel_display * display = & xe -> display ;
317+
318+ if (!xe -> info .probe_display )
319+ return ;
320+
321+ intel_dmc_resume (display );
322+
323+ if (has_display (xe ))
324+ drm_mode_config_reset (& xe -> drm );
325+
326+ intel_display_driver_init_hw (display );
327+
328+ intel_hpd_init (xe );
329+
330+ if (has_display (xe ))
331+ intel_hpd_poll_disable (xe );
332+
333+ intel_opregion_resume (display );
334+
335+ intel_power_domains_enable (display );
336+ }
337+
338+ void xe_display_pm_suspend (struct xe_device * xe )
293339{
294340 struct intel_display * display = & xe -> display ;
295341 bool s2idle = suspend_to_idle ();
342+
296343 if (!xe -> info .probe_display )
297344 return ;
298345
@@ -301,36 +348,26 @@ static void __xe_display_pm_suspend(struct xe_device *xe, bool runtime)
301348 * properly.
302349 */
303350 intel_power_domains_disable (display );
304- if (!runtime )
305- intel_fbdev_set_suspend (& xe -> drm , FBINFO_STATE_SUSPENDED , true);
351+ intel_fbdev_set_suspend (& xe -> drm , FBINFO_STATE_SUSPENDED , true);
306352
307- if (! runtime && has_display (xe )) {
353+ if (has_display (xe )) {
308354 drm_kms_helper_poll_disable (& xe -> drm );
309355 intel_display_driver_disable_user_access (display );
310356 intel_display_driver_suspend (display );
311357 }
312358
313359 xe_display_flush_cleanup_work (xe );
314360
315- if (!runtime )
316- intel_hpd_cancel_work (xe );
361+ intel_hpd_cancel_work (xe );
317362
318- if (! runtime && has_display (xe )) {
363+ if (has_display (xe )) {
319364 intel_display_driver_suspend_access (display );
320365 intel_encoder_suspend_all (& xe -> display );
321366 }
322367
323368 intel_opregion_suspend (display , s2idle ? PCI_D1 : PCI_D3cold );
324369
325370 intel_dmc_suspend (display );
326-
327- if (runtime && has_display (xe ))
328- intel_hpd_poll_enable (xe );
329- }
330-
331- void xe_display_pm_suspend (struct xe_device * xe )
332- {
333- __xe_display_pm_suspend (xe , false);
334371}
335372
336373void xe_display_pm_shutdown (struct xe_device * xe )
@@ -369,7 +406,7 @@ void xe_display_pm_runtime_suspend(struct xe_device *xe)
369406 return ;
370407
371408 if (xe -> d3cold .allowed ) {
372- __xe_display_pm_suspend (xe , true );
409+ xe_display_enable_d3cold (xe );
373410 return ;
374411 }
375412
@@ -430,7 +467,7 @@ void xe_display_pm_resume_early(struct xe_device *xe)
430467 intel_display_power_resume_early (display );
431468}
432469
433- static void __xe_display_pm_resume (struct xe_device * xe , bool runtime )
470+ void xe_display_pm_resume (struct xe_device * xe )
434471{
435472 struct intel_display * display = & xe -> display ;
436473
@@ -444,12 +481,12 @@ static void __xe_display_pm_resume(struct xe_device *xe, bool runtime)
444481
445482 intel_display_driver_init_hw (display );
446483
447- if (! runtime && has_display (xe ))
484+ if (has_display (xe ))
448485 intel_display_driver_resume_access (display );
449486
450487 intel_hpd_init (xe );
451488
452- if (! runtime && has_display (xe )) {
489+ if (has_display (xe )) {
453490 intel_display_driver_resume (display );
454491 drm_kms_helper_poll_enable (& xe -> drm );
455492 intel_display_driver_enable_user_access (display );
@@ -460,24 +497,18 @@ static void __xe_display_pm_resume(struct xe_device *xe, bool runtime)
460497
461498 intel_opregion_resume (display );
462499
463- if (!runtime )
464- intel_fbdev_set_suspend (& xe -> drm , FBINFO_STATE_RUNNING , false);
500+ intel_fbdev_set_suspend (& xe -> drm , FBINFO_STATE_RUNNING , false);
465501
466502 intel_power_domains_enable (display );
467503}
468504
469- void xe_display_pm_resume (struct xe_device * xe )
470- {
471- __xe_display_pm_resume (xe , false);
472- }
473-
474505void xe_display_pm_runtime_resume (struct xe_device * xe )
475506{
476507 if (!xe -> info .probe_display )
477508 return ;
478509
479510 if (xe -> d3cold .allowed ) {
480- __xe_display_pm_resume (xe , true );
511+ xe_display_disable_d3cold (xe );
481512 return ;
482513 }
483514
0 commit comments