Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915/vga: Consolidate intel_vga_disable() calls

Currently we disable the VGA plane from various places, sometimes
multiple times in the same init/resume sequence. Get rid of all this
mess and do it just once. The most correct place seems to be just
after intel_early_display_was() as that one applies various workarounds
that need to be in place before we touch any planes (including the
VGA plane).

Actually, we do still have a second caller in
vlv_display_power_well_init(). I think we still need that as the reset
value of VGACNTR is 0x0 and thus technically the VGA plane will be
(at least partially) enabled after the power well has been toggled.

In both cases we have the necessary power reference already held
(INIT power domain for load/resume case, and the display power well
itself being what we need for vlv_display_power_well_init()).

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250417114454.12836-7-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>

+3 -29
-3
drivers/gpu/drm/i915/display/intel_display_driver.c
··· 458 458 459 459 intel_hti_init(display); 460 460 461 - /* Just disable it once at startup */ 462 - intel_vga_disable(display); 463 461 intel_setup_outputs(display); 464 462 465 463 ret = intel_dp_tunnel_mgr_init(display); ··· 694 696 int ret, i; 695 697 696 698 intel_modeset_setup_hw_state(display, ctx); 697 - intel_vga_redisable(display); 698 699 699 700 if (!state) 700 701 return 0;
+3
drivers/gpu/drm/i915/display/intel_modeset_setup.c
··· 31 31 #include "intel_pmdemand.h" 32 32 #include "intel_tc.h" 33 33 #include "intel_vblank.h" 34 + #include "intel_vga.h" 34 35 #include "intel_wm.h" 35 36 #include "skl_watermark.h" 36 37 ··· 936 935 wakeref = intel_display_power_get(display, POWER_DOMAIN_INIT); 937 936 938 937 intel_early_display_was(display); 938 + intel_vga_disable(display); 939 + 939 940 intel_modeset_readout_hw_state(display); 940 941 941 942 /* HW state is read out, now we need to sanitize this mess. */
-22
drivers/gpu/drm/i915/display/intel_vga.c
··· 77 77 intel_de_posting_read(display, vga_reg); 78 78 } 79 79 80 - void intel_vga_redisable(struct intel_display *display) 81 - { 82 - intel_wakeref_t wakeref; 83 - 84 - /* 85 - * This function can be called both from intel_modeset_setup_hw_state or 86 - * at a very early point in our resume sequence, where the power well 87 - * structures are not yet restored. Since this function is at a very 88 - * paranoid "someone might have enabled VGA while we were not looking" 89 - * level, just check if the power well is enabled instead of trying to 90 - * follow the "don't touch the power well if we don't need it" policy 91 - * the rest of the driver uses. 92 - */ 93 - wakeref = intel_display_power_get_if_enabled(display, POWER_DOMAIN_VGA); 94 - if (!wakeref) 95 - return; 96 - 97 - intel_vga_disable(display); 98 - 99 - intel_display_power_put(display, POWER_DOMAIN_VGA, wakeref); 100 - } 101 - 102 80 void intel_vga_reset_io_mem(struct intel_display *display) 103 81 { 104 82 struct pci_dev *pdev = to_pci_dev(display->drm->dev);
-1
drivers/gpu/drm/i915/display/intel_vga.h
··· 10 10 11 11 void intel_vga_reset_io_mem(struct intel_display *display); 12 12 void intel_vga_disable(struct intel_display *display); 13 - void intel_vga_redisable(struct intel_display *display); 14 13 int intel_vga_register(struct intel_display *display); 15 14 void intel_vga_unregister(struct intel_display *display); 16 15
-3
drivers/gpu/drm/i915/i915_driver.c
··· 62 62 #include "display/intel_pch_refclk.h" 63 63 #include "display/intel_pps.h" 64 64 #include "display/intel_sprite_uapi.h" 65 - #include "display/intel_vga.h" 66 65 #include "display/skl_watermark.h" 67 66 68 67 #include "gem/i915_gem_context.h" ··· 1200 1201 intel_dmc_resume(display); 1201 1202 1202 1203 i9xx_display_sr_restore(display); 1203 - 1204 - intel_vga_redisable(display); 1205 1204 1206 1205 intel_gmbus_reset(display); 1207 1206