drm/i915: Enable SDVO hotplug interrupts for HDMI and DVI
Subsystems (2)
PATCH v5 1/1 drm/i915: Enable SDVO hotplug interrupts for HDMI and DVI
I was seeing a nasty 5 frame glitch every 10 seconds, caused by the poll for connection on DVI attached by SDVO.
As my SDVO DVI supports hotplug detect interrupts, the fix is to enable them, and hook them in to the various bits of driver infrastructure so that they work reliably.
With lots of help from Adam Jackson <[email protected]> on IRC.
---
Changes from the unnumbered v4:
* At Keith Packard's request, store the required hotplug bits in struct intel_sdvo and just call SET_ACTIVE_HOT_PLUG to enable hotplug interrupts.
* Add some comments to explain why I'm doing things that reviewers didn't think was obvious, so that the next person to examine this area doesn't get confused.
Changes from v3:
* As per Chris Wilson's comment, move the hotplug enable from intel_sdvo_init to intel_sdvo_dvi_init. Should correctly enable HPD if only one of a multifunction SDVO pair supports HPD.
Changes from v2:
* Stylistic cleanups requested by Chris Wilson in review:
* Make intel_sdvo_find_connector cleaner
* Rename intel_sdvo_set_hotplug to intel_sdvo_enable_hotplug (reflects functionality better)
* Remove intel_sdvo_do_hotplug
Changes from first version:
* Don't call intel_sdvo_supports_hotplug twice - pick up the setting in connector->polled instead (suggested by Keith Packard in review).
* Change subject prefix to drm/i915
drivers/gpu/drm/i915/intel_drv.h | 3 - drivers/gpu/drm/i915/intel_sdvo.c | 88 ++++++++++++------------------------- 2 files changed, 29 insertions(+), 62 deletions(-)
drivers/gpu/drm/i915/intel_drv.h +0 -3
@@ -337,9 +337,6 @@ extern void intel_release_load_detect_pipe(struct intel_encoder *intel_encoder,struct drm_connector *connector, struct intel_load_detect_pipe *old); -extern struct drm_connector *intel_sdvo_find (struct drm_device *dev,int sdvoB); -extern int intel_sdvo_supports_hotplug (struct drm_connector *connector); -extern void intel_sdvo_set_hotplug (struct drm_connector *connector,int enable);extern void intelfb_restore (void );extern void intel_crtc_fb_gamma_set (struct drm_crtc *crtc,u16 red,u16 green,u16 blue,int regno);
drivers/gpu/drm/i915/intel_sdvo.c +29 -59
128 lines not on this page · raw message
Signature · 1 line
1.7.6
drivers/gpu/drm/i915/intel_sdvo.c bool intel_sdvo_init(struct drm_device *dev, int sdvo_reg) · line 2541
Quoted 8 lines · Simon Farnsworth
drivers/gpu/drm/i915/intel_sdvo.c +8
-0+/* Set up hotplug command - note paranoia about contents of reply. +* We simply clear out the bits we understand, and hope that +* the rest are in good shape for the hardware. +*/ +intel_sdvo_get_value (intel_sdvo,SDVO_CMD_GET_HOT_PLUG_SUPPORT , + &intel_sdvo->hotplug_active,2 ); + intel_sdvo->hotplug_active[0 ] &=0x3 ; +
This appears to unconditionally set the bits for devices 0 and 1, making the dvi-specific code that sets the device bit irrelevant. I think you just want to set hotplug_active to 0.
Signature · 1 line
[email protected]
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 1 line · Keith Packard
On Tue, 20 Sep 2011 18:31:25 +0100, Simon Farnsworth
Quoted 4 lines · <[email protected]> wrote:
Quoted 4 lines
drivers/gpu/drm/i915/intel_sdvo.c +4
-0+/* Set up hotplug command - note paranoia about contents of reply. +* We simply clear out the bits we understand, and hope that +* the rest are in good shape for the hardware. +*/
Quoted 8 lines
drivers/gpu/drm/i915/intel_sdvo.c bool intel_sdvo_init(struct drm_device *dev, int sdvo_reg) · line 2541
Quoted 4 lines
drivers/gpu/drm/i915/intel_sdvo.c +4
-0+intel_sdvo_get_value (intel_sdvo,SDVO_CMD_GET_HOT_PLUG_SUPPORT , + &intel_sdvo->hotplug_active,2 ); + intel_sdvo->hotplug_active[0 ] &=0x3 ; +This appears to unconditionally set the bits for devices 0 and 1, making the dvi-specific code that sets the device bit irrelevant. I think you just want to set
hotplug_activeto 0.
I'm clearing the bits (&= not |=). I could respin setting it to 0, but that takes me even further from the old (commented out) code, and I'd really want someone to check SDVO specs before doing that.
Signature · 4 lines
Simon Farnsworth Software Engineer ONELAN Limited http://www.onelan.com/
Quoted 3 lines · Simon Farnsworth
I'm clearing the bits (&= not |=). I could respin setting it to 0, but that takes me even further from the old (commented out) code, and I'd really want someone to check SDVO specs before doing that.
What I see the code doing is asking whether devices 0 and 1 *could* support hotplug and then unconditionally setting the devices for which we *want* hotplug to that.
I think you should set the list of devices requesting hotplug to be the intersection of the set of devices which *could* do hotplug and the set of devices for which we *want* hotplug.
That seems like it would be achieved by just clearing the set of devices that we will request hotplug for and then checking which ones are supported and incrementally adding those to the hotplug_active set.
Signature · 1 line
[email protected]
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 1 line · Keith Packard
On Wed, 21 Sep 2011 10:08:13 +0100, Simon Farnsworth
Quoted 8 lines · <[email protected]> wrote:
Quoted 3 lines
I'm clearing the bits (&= not |=). I could respin setting it to 0, but that takes me even further from the old (commented out) code, and I'd really want someone to check SDVO specs before doing that.
What I see the code doing is asking whether devices 0 and 1 *could* support hotplug and then unconditionally setting the devices for which we *want* hotplug to that.
Quoted 7 lines
I think you should set the list of devices requesting hotplug to be the intersection of the set of devices which *could* do hotplug and the set of devices for which we *want* hotplug.
That seems like it would be achieved by just clearing the set of devices that we will request hotplug for and then checking which ones are supported and incrementally adding those to the
hotplug_activeset.
I think I see my mistake - but I'd like to check before I do a v6 of this patch.
I'm ANDing the value returned by hardware with 3 - I should be ANDing it with an appropriate ~3. The rest of the code (setting those bits in intel_sdvo_dvi_init based on what functions I have) should be OK.
Essentially, I'm fairly confident based on empirical evidence that bit 0 is HPD for device 0 (as my SDVO devices both return 0x01 in that byte). I don't know what the rest of the bits mean, but it seems like a reasonable guess that bit 1 is HPD for device 1, so I'm acting accordingly.
I would still like someone with the spec to go over what I'm doing - this seems appropriate, but *all* I have to test against are two different motherboards with "integrated" DVI-D that turns out to be an SDVO device.
I have no documentation for SDVO - all of this is based on the existing code with hints from ajax; it could be complete nonsense for anything other than the two devices I have.
Signature · 4 lines
Simon Farnsworth Software Engineer ONELAN Limited http://www.onelan.com/
Quoted 3 lines · Simon Farnsworth
I'm ANDing the value returned by hardware with 3 - I should be ANDing it with an appropriate ~3. The rest of the code (setting those bits in
intel_sdvo_dvi_initbased on what functions I have) should be OK.
Oh, that's a good point. I'd say that you shouldn't change any bits you don't know about.
So, fetch the current active hotplug value and then clear bits 0 and 1 so that we change only those.
Quoted 4 lines
I would still like someone with the spec to go over what I'm doing - this seems appropriate, but *all* I have to test against are two different motherboards with "integrated" DVI-D that turns out to be an SDVO device.
Yeah, I've been digging around for an SDVO spec, but it's buried as it contains a pile of stuff for macro-vision and other content protection bits.
Signature · 1 line
[email protected]
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx