From: Simon Farnsworth Subject: Re: [PATCH] drm/i915: Enable SDVO hotplug interrupts for HDMI and DVI Date: Tue, 20 Sep 2011 17:38:37 +0100 Message-ID: <201109201738.37448.simon.farnsworth@onelan.co.uk> References: <1316528258-23006-1-git-send-email-simon.farnsworth@onelan.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from claranet-outbound-smtp01.uk.clara.net (claranet-outbound-smtp01.uk.clara.net [195.8.89.34]) by gabe.freedesktop.org (Postfix) with ESMTP id BDBB09ED55 for ; Tue, 20 Sep 2011 09:38:43 -0700 (PDT) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Keith Packard Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Tuesday 20 September 2011, Keith Packard wrote: > On Tue, 20 Sep 2011 15:17:38 +0100, Simon Farnsworth wrote: > > - if (on) { > > - intel_sdvo_write_cmd(intel_sdvo, SDVO_CMD_GET_HOT_PLUG_SUPPORT, NULL, > > 0); - status = intel_sdvo_read_response(intel_sdvo, &response, 2); > > + intel_sdvo_write_cmd(intel_sdvo, SDVO_CMD_GET_HOT_PLUG_SUPPORT, NULL, > > 0); + status = intel_sdvo_read_response(intel_sdvo, &response, 2); > > ... > > > + intel_sdvo_write_cmd(intel_sdvo, SDVO_CMD_SET_ACTIVE_HOT_PLUG, > > &response, 2); > > You are unconditionally enabling hotplug on all devices, I think you > want to take the desired device as an argument to this function and add > it to the set of active hotplug devices instead. You've just gotten the > active hotplug value above, so removing the call to GET_HOT_PLUG_SUPPORT > and doing: > > intel_sdvo_write_cmd(intel_sdvo, SDVO_CMD_GET_ACTIVE_HOT_PLUG, NULL, 0); > intel_sdvo_read_response(intel_sdvo, &response, 2); > > response[0] |= (1 << device); > > intel_sdvo_write_cmd(intel_sdvo, SDVO_CMD_SET_ACTIVE_HOT_PLUG, &response, > 2); > > should do what you want. This interacts badly with the need I've found to call this function every time a hotplug interrupt comes through (explained below) - I'm not sure how to track back from the encoder (which gets the callback) to the SDVO device number. > > > @@ -2062,7 +2020,13 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, > > int device) > > > > intel_connector = &intel_sdvo_connector->base; > > connector = &intel_connector->base; > > > > - connector->polled = DRM_CONNECTOR_POLL_CONNECT | > > DRM_CONNECTOR_POLL_DISCONNECT; + if > > (intel_sdvo_supports_hotplug(intel_sdvo) & (1 << device)) { > > + connector->polled = DRM_CONNECTOR_POLL_HPD; > > + intel_encoder->hot_plug = intel_sdvo_enable_hotplug; > > The encoder->hot_plug function is what is called when the hotplug > interrupt is detected. The only current user is the DisplayPort driver > which uses this to signal link retraining. You definitely don't want or > need to call intel_sdvo_enable_hotplug at that point. If I don't call intel_sdvo_enable_hotplug at this point, I only get the one hotplug interrupt; it appears that the SDVO devices I have send their interrupt, then expect you to re-enable HPD interrupts before they will send another interrupt. I'm not sure how best to handle this; my gut feeling is that there's no real harm enabling HPD interrupts on all ports that support it, even though I'm only processing HPD interrupts from DVI and HDMI ports. If you have better ideas, I'm happy to try them. -- Simon Farnsworth Software Engineer ONELAN Limited http://www.onelan.com/