From patchwork Wed Aug 6 03:32:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sharma, Shashank" X-Patchwork-Id: 4683191 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 19220C0338 for ; Wed, 6 Aug 2014 03:32:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0E3C220122 for ; Wed, 6 Aug 2014 03:32:37 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E2607200F3 for ; Wed, 6 Aug 2014 03:32:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 162FB6E0A2; Tue, 5 Aug 2014 20:32:35 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTP id A34C56E0A2 for ; Tue, 5 Aug 2014 20:32:34 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 05 Aug 2014 20:25:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,810,1400050800"; d="scan'208";a="572316336" Received: from fmsmsx107.amr.corp.intel.com ([10.19.9.54]) by fmsmga001.fm.intel.com with ESMTP; 05 Aug 2014 20:32:28 -0700 Received: from fmsmsx151.amr.corp.intel.com (10.19.17.220) by FMSMSX107.amr.corp.intel.com (10.19.9.54) with Microsoft SMTP Server (TLS) id 14.3.123.3; Tue, 5 Aug 2014 20:32:28 -0700 Received: from bgsmsx152.gar.corp.intel.com (10.224.48.50) by FMSMSX151.amr.corp.intel.com (10.19.17.220) with Microsoft SMTP Server (TLS) id 14.3.123.3; Tue, 5 Aug 2014 20:32:28 -0700 Received: from bgsmsx101.gar.corp.intel.com ([169.254.1.135]) by BGSMSX152.gar.corp.intel.com ([169.254.6.144]) with mapi id 14.03.0195.001; Wed, 6 Aug 2014 09:02:23 +0530 From: "Sharma, Shashank" To: "Vivi, Rodrigo" , "intel-gfx@lists.freedesktop.org" Thread-Topic: [PATCH 13/15] drm/i915: HDMI detection based on HPD pin live status Thread-Index: AQHPsPdb0GcdnxapHEOnH1LKHurap5vC6yWw Date: Wed, 6 Aug 2014 03:32:23 +0000 Message-ID: References: <1407250286-1801-1-git-send-email-rodrigo.vivi@intel.com> <1407250286-1801-14-git-send-email-rodrigo.vivi@intel.com> In-Reply-To: <1407250286-1801-14-git-send-email-rodrigo.vivi@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.223.10.10] MIME-Version: 1.0 Subject: Re: [Intel-gfx] [PATCH 13/15] drm/i915: HDMI detection based on HPD pin live status X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We have prepared a patch set for HDMI design change, which will not break old platforms, cache the EDID for a finite duration, support HDMI compliance etc. Please wait for a day or two, while we are doing the ULT. That patch is a superset of this, and will cover live_status based detection also. Regards Shashank -----Original Message----- From: Vivi, Rodrigo Sent: Tuesday, August 05, 2014 8:21 PM To: intel-gfx@lists.freedesktop.org Cc: C, Ramalingam; Sharma, Shashank; Vivi, Rodrigo Subject: [PATCH 13/15] drm/i915: HDMI detection based on HPD pin live status From: Ramalingam C This change uses the HPD pins live status bit from South Display Engine(SDE) to identify the HDMI hotplug state. On Soft HPD events (on automated test cases) only HPD pin will be toggled to notify the HDMI state change. But physical DDC will be alive. Similarly on slow HDMI hotplug out, because of the physical interface design, DDC remains active for short duration even when HPD live status is indicating the disconnect state. Because of this on VLV and HSW, slow hotplug out events and soft HPDs are not captured. Hence this patch uses the HPD pins live status to identify the HDMI connector status and allows EDID retrival only when live status is up. Change-Id: I958b57fa139e52b45c8b349c861cb8eab7b67ae5 Signed-off-by: Ramalingam C Signed-off-by: Shashank Sharma Signed-off-by: Rodrigo Vivi --- drivers/gpu/drm/i915/intel_drv.h | 10 +++++ drivers/gpu/drm/i915/intel_hdmi.c | 87 +++++++++++++++++++++++++++++++++------ 2 files changed, 85 insertions(+), 12 deletions(-) + status = get_hdmi_hotplug_live_status(dev, intel_hdmi); + intel_hdmi->has_hdmi_sink = false; intel_hdmi->has_audio = false; intel_hdmi->rgb_quant_range_selectable = false; - edid = drm_get_edid(connector, - intel_gmbus_get_adapter(dev_priv, - intel_hdmi->ddc_bus)); - if (edid) { - if (edid->input & DRM_EDID_INPUT_DIGITAL) { - status = connector_status_connected; - if (intel_hdmi->force_audio != HDMI_AUDIO_OFF_DVI) - intel_hdmi->has_hdmi_sink = + if (status == connector_status_connected) { + edid = drm_get_edid(connector, + intel_gmbus_get_adapter(dev_priv, + intel_hdmi->ddc_bus)); + if (edid) { + if (edid->input & DRM_EDID_INPUT_DIGITAL) { + status = connector_status_connected; + if (intel_hdmi->force_audio != + HDMI_AUDIO_OFF_DVI) + intel_hdmi->has_hdmi_sink = drm_detect_hdmi_monitor(edid); - intel_hdmi->has_audio = drm_detect_monitor_audio(edid); - intel_hdmi->rgb_quant_range_selectable = - drm_rgb_quant_range_selectable(edid); + intel_hdmi->has_audio = + drm_detect_monitor_audio(edid); + intel_hdmi->rgb_quant_range_selectable = + drm_rgb_quant_range_selectable(edid); + } + kfree(edid); + } else { + status = connector_status_disconnected; } - kfree(edid); } if (status == connector_status_connected) { -- 1.9.3 diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 1f675a8..b2e2e0c 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -500,6 +500,16 @@ struct cxsr_latency { #define to_intel_plane(x) container_of(x, struct intel_plane, base) #define intel_fb_obj(x) (x ? to_intel_framebuffer(x)->obj : NULL) +/* DisplayPort/HDMI Hotplug line status bit mask */ +#define VLV_HDMIB_HOTPLUG_LIVE_STATUS (1 << 29) +#define VLV_HDMIC_HOTPLUG_LIVE_STATUS (1 << 28) +#define VLV_HDMID_HOTPLUG_LIVE_STATUS (1 << 27) + +/* DisplayPort/HDMI/DVI Hotplug line status bit mask */ #define +CORE_HDMIB_HOTPLUG_LIVE_STATUS (1 << 21) #define +CORE_HDMIC_HOTPLUG_LIVE_STATUS (1 << 22) #define +CORE_HDMID_HOTPLUG_LIVE_STATUS (1 << 23) + struct intel_hdmi { u32 hdmi_reg; int ddc_bus; diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index f9151f6..1920e4e 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -962,6 +962,61 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, return true; } +static int get_hdmi_hotplug_live_status(struct drm_device *dev, + struct intel_hdmi *intel_hdmi) +{ + uint32_t bit, reg; + struct drm_i915_private *dev_priv = dev->dev_private; + struct intel_digital_port *intel_dig_port = + hdmi_to_dig_port(intel_hdmi); + + DRM_DEBUG_KMS("Reading Live status"); + + /* Live status is available from Gen 6 onwards */ + if (INTEL_INFO(dev)->gen < 6) + return connector_status_connected; + + if (IS_VALLEYVIEW(dev)) { + switch (intel_dig_port->port) { + case PORT_B: + bit = VLV_HDMIB_HOTPLUG_LIVE_STATUS; + break; + case PORT_C: + bit = VLV_HDMIC_HOTPLUG_LIVE_STATUS; + break; + case PORT_D: + bit = VLV_HDMID_HOTPLUG_LIVE_STATUS; + break; + default: + DRM_ERROR("Unrecognized port is encountered\n"); + return connector_status_unknown; + } + reg = I915_READ(PORT_HOTPLUG_STAT); + + } else { + switch (intel_dig_port->port) { + case PORT_B: + bit = CORE_HDMIB_HOTPLUG_LIVE_STATUS; + break; + case PORT_C: + bit = CORE_HDMIC_HOTPLUG_LIVE_STATUS; + break; + case PORT_D: + bit = CORE_HDMID_HOTPLUG_LIVE_STATUS; + break; + default: + DRM_ERROR("Unrecognized port is encountered\n"); + return connector_status_unknown; + } + + reg = I915_READ(SDEISR); + } + + /* Return connector status */ + return ((reg & bit) ? + connector_status_connected : connector_status_disconnected); } + static enum drm_connector_status intel_hdmi_detect(struct drm_connector *connector, bool force) { @@ -981,24 +1036,32 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) power_domain = intel_display_port_power_domain(intel_encoder); intel_display_power_get(dev_priv, power_domain);