[Intel-gfx] [Patch 4/5]: DRM/I915: Add the load-detection for crt detect
Eric Anholt
eric at anholt.net
Sat Mar 7 00:42:32 CET 2009
On Tue, 2009-03-03 at 18:08 +0800, yakui_zhao wrote:
> Subject: Patch DRM/I915: Add the load-detection for crt detect
> From: Zhao Yakui <yakui.zhao at intel.com>
>
> Add the load-detection for crt detect
>
> Signed-off-by: Zhao Yakui <yakui.zhao at intel.com>
> ---
> drivers/gpu/drm/i915/intel_crt.c | 136 ++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 133 insertions(+), 3 deletions(-)
>
> Index: linux-2.6/drivers/gpu/drm/i915/intel_crt.c
> ===================================================================
> --- linux-2.6.orig/drivers/gpu/drm/i915/intel_crt.c 2009-03-03 18:01:04.000000000 +0800
> +++ linux-2.6/drivers/gpu/drm/i915/intel_crt.c 2009-03-03 18:01:12.000000000 +0800
> @@ -217,9 +217,120 @@
> return intel_ddc_probe(intel_output);
> }
>
> +/*
> + * Detects CRT presence by checking for load.
> + *
> + * Requires that the current pipe's DPLL is active. This will cause flicker
> + * on the CRT, so it should not be used while the display is being used. Only
> + * color (not monochrome) displays are detected.
> + *
> + * return TRUE if CRT is connected.
> + * return FALSE if CRT is disconnected.
> + */
> +static bool intel_crt_detect_load(struct intel_crtc *intel_crtc,
> + struct intel_output *intel_output)
> +{
> + struct drm_encoder *encoder = &intel_output->enc;
> + struct drm_device *drm_dev = encoder->dev;
Everywhere else in the drm, this is called struct drm_device *dev.
Please follow that.
> + struct drm_i915_private *dev_priv = drm_dev->dev_private;
> + u32 save_bclrpat, save_vtotal, vtotal, vactive, vsample, vblank,
> + vblank_start, vblank_end, dsl;
> + u8 st00;
> + int bclrpat_reg, pipeconf_reg, pipe_dsl_reg, vtotal_reg,
> + vblank_reg, vsync_reg, pipe;
> + bool present;
> +
This is unusual formatting of your variables. For the following lines,
just start a new declaration:
+ u32 save_bclrpat, save_vtotal, vtotal, vactive, vsample, vblank,
+ u32 vblank_start, vblank_end, dsl;
> + pipe = intel_crtc->pipe;
> + if (pipe == 0) {
> + bclrpat_reg = BCLRPAT_A;
> + vtotal_reg = VTOTAL_A;
> + vblank_reg = VBLANK_A;
> + vsync_reg = VSYNC_A;
> + pipeconf_reg = PIPEACONF;
> + pipe_dsl_reg = PIPEADSL;
> + } else {
> + bclrpat_reg = BCLRPAT_B;
> + vtotal_reg = VTOTAL_B;
> + vblank_reg = VBLANK_B;
> + vsync_reg = VSYNC_B;
> + pipeconf_reg = PIPEBCONF;
> + pipe_dsl_reg = PIPEBDSL;
> + }
> + save_bclrpat = I915_READ(bclrpat_reg);
> + save_vtotal = I915_READ(vtotal_reg);
> + vblank = I915_READ(vblank_reg);
> +
> + vtotal = ((save_vtotal >> 16) & 0xfff) + 1;
> + vactive = (save_vtotal & 0x7ff) + 1;
> +
> + vblank_start = (vblank & 0xfff) + 1;
> + vblank_end = ((vblank >> 16) & 0xfff) + 1;
> +
> + /* Set the border color to purple. */
> + I915_WRITE(bclrpat_reg, 0x500050);
> + if (IS_I9XX(drm_dev)) {
> + u32 pipeconf = I915_READ(pipeconf_reg);
> + I915_WRITE(pipeconf_reg, pipeconf | PIPECONF_FORCE_BORDER);
> + st00 = I915_READ8(VGA_MSR_WRITE);
> + present = (st00 & (1 << 4)) != 0;
> + I915_WRITE(pipeconf_reg, pipeconf);
> + } else {
> + bool restore_vblank = false;
> + int count, detect;
> + /* If there isn't any border,add some.Yes,this will flicker */
More spaces:
/* If there isn't any border, add some. Yes, this will flicker */
and a newline between variables and code is appreciated.
> @@ -228,11 +339,30 @@
> return connector_status_disconnected;
> }
>
> - if (intel_crt_detect_ddc(connector))
> - return connector_status_connected;
> + intel_output = to_intel_output(connector);
> + drm_crtc = intel_get_load_detect_pipe(intel_output, NULL,
> + &dpms_mode);
Indent this guy into lining up with the other arguments.
--
Eric Anholt
eric at anholt.net eric.anholt at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20090306/4fa3375a/attachment.sig>
More information about the Intel-gfx
mailing list