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

Configure Feed

Select the types of activity you want to include in your feed.

drm/i915/crt: Extract intel_crt_sense_above_threshold()

Extract the CRT sense check into a helper instead of repeating
the same thing twice.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patch.msgid.link/20251208182637.334-17-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>

+9 -7
+9 -7
drivers/gpu/drm/i915/display/intel_crt.c
··· 693 693 return ret; 694 694 } 695 695 696 + static bool intel_crt_sense_above_threshold(struct intel_display *display) 697 + { 698 + return intel_vga_read(display, VGA_IS0_R, true) & (1 << 4); 699 + } 700 + 696 701 static enum drm_connector_status 697 702 intel_crt_load_detect(struct intel_crt *crt, enum pipe pipe) 698 703 { ··· 709 704 u32 vsample; 710 705 u32 vblank, vblank_start, vblank_end; 711 706 u32 dsl; 712 - u8 st00; 713 707 enum drm_connector_status status; 714 708 715 709 drm_dbg_kms(display->drm, "starting load-detect on CRT\n"); ··· 742 738 * border color for Color info. 743 739 */ 744 740 intel_crtc_wait_for_next_vblank(intel_crtc_for_pipe(display, pipe)); 745 - st00 = intel_vga_read(display, VGA_IS0_R, true); 746 - status = ((st00 & (1 << 4)) != 0) ? 741 + 742 + status = intel_crt_sense_above_threshold(display) ? 747 743 connector_status_connected : 748 744 connector_status_disconnected; 749 745 ··· 783 779 while ((dsl = intel_de_read(display, PIPEDSL(display, pipe))) <= vsample) 784 780 ; 785 781 /* 786 - * Watch ST00 for an entire scanline 782 + * Watch sense for an entire scanline 787 783 */ 788 784 detect = 0; 789 785 count = 0; 790 786 do { 791 787 count++; 792 - /* Read the ST00 VGA status register */ 793 - st00 = intel_vga_read(display, VGA_IS0_R, true); 794 - if (st00 & (1 << 4)) 788 + if (intel_crt_sense_above_threshold(display)) 795 789 detect++; 796 790 } while ((intel_de_read(display, PIPEDSL(display, pipe)) == dsl)); 797 791