Detecting screen disconnection

Vladimir Dergachev volodya at mindspring.com
Sun Oct 31 18:40:09 PST 2004



On Sun, 31 Oct 2004, Jon Smirl wrote:

> On Sun, 31 Oct 2004 19:46:50 -0500 (EST), Vladimir Dergachev
> <volodya at mindspring.com> wrote:
>> ATI cards have hardware that can sense which inputs are connected or
>> disconnected and even send an interrupt on changes.
>
> Do you have some sample code for this? I'm working on the radeon
> driver right now and I can try and hook it in.

No, I have never played with it - though it looks like fun.

DAC_CNTL (and DAC_CNTL2) has bits that control this. Interestingly enough 
there is also a way to check for analog termination - I am not sure 
whether this is the same as CRT detection bits in a different place in 
the same register.

I.e. I don't understand why would someone want to test analog termination 
if there is a different way to find out whether CRT is connected.

It also appears that it is not possible to create an interrupt on hotplug 
of analog connection.

Flat panels on the other hand can be detected quite easily - GEN_INT_CNTL 
has two bits for each flat panel.

I imagine that as far as DRM driver interrupt handler is concerned it only 
needs to deal with bits 4 (primary FP) and 10 (FP2) in GEN_INT_CNTL and 
GEN_INT_STATUS.

These bits appear to not require any other initialization - in particular 
TMDS and LVDS registers do not have any bits that need to be enabled in 
order for these to work.

                      best

                         Vladimir Dergachev

PS: Patch for drm/shared-code/radeon_drv.h :

Index: radeon_drv.h
===================================================================
RCS file: /cvs/dri/drm/shared-core/radeon_drv.h,v
retrieving revision 1.36
diff -u -r1.36 radeon_drv.h
--- radeon_drv.h        10 Oct 2004 05:52:19 -0000      1.36
+++ radeon_drv.h        1 Nov 2004 02:38:46 -0000
@@ -397,12 +397,18 @@

  #define RADEON_GEN_INT_CNTL            0x0040
  #      define RADEON_CRTC_VBLANK_MASK          (1 << 0)
+#      define RADEON_FP_DETECT_ENABLE          (1 << 4)
+#      define RADEON_FP2_DETECT_ENABLE         (1 << 10)
  #      define RADEON_GUI_IDLE_INT_ENABLE       (1 << 19)
  #      define RADEON_SW_INT_ENABLE             (1 << 25)

  #define RADEON_GEN_INT_STATUS          0x0044
  #      define RADEON_CRTC_VBLANK_STAT          (1 << 0)
  #      define RADEON_CRTC_VBLANK_STAT_ACK      (1 << 0)
+#      define RADEON_FP_DETECT_STAT            (1 << 4)
+#      define RADEON_FP_DETECT_ACK             (1 << 4)
+#      define RADEON_FP2_DETECT_STAT           (1 << 10)
+#      define RADEON_FP_DETECT_ACK             (1 << 10)
  #      define RADEON_GUI_IDLE_INT_TEST_ACK     (1 << 19)
  #      define RADEON_SW_INT_TEST               (1 << 25)
  #      define RADEON_SW_INT_TEST_ACK           (1 << 25)




More information about the xorg mailing list