From patchwork Wed Jul 29 03:31:18 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ling.ma@intel.com X-Patchwork-Id: 38053 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6T3VLot000717 for ; Wed, 29 Jul 2009 03:31:21 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F37DE9F5FD; Tue, 28 Jul 2009 20:31:20 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 9C8949F5F5 for ; Tue, 28 Jul 2009 20:31:19 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 28 Jul 2009 20:18:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.43,286,1246863600"; d="scan'208";a="536762416" Received: from unknown (HELO localhost.localdomain) ([10.239.36.100]) by orsmga001.jf.intel.com with ESMTP; 28 Jul 2009 20:30:53 -0700 From: ling.ma@intel.com To: eric@anholt.net Date: Wed, 29 Jul 2009 11:31:18 +0800 Message-Id: <1248838278-10341-1-git-send-email-ling.ma@intel.com> X-Mailer: git-send-email 1.5.4.4 Cc: Ma Ling , intel-gfx@lists.freedesktop.org Subject: [Intel-gfx] [PATCH V2] drm/i915: Detect SDVO digital output according to EDID X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org We send sdvo attach command to check sdvo output status, it is good enough for most cases. However we also should care about the similar case on 4X platform, which also share DDC bus with other analog devices. The patch fixed bug on MP965-D. When plugged VGA by DVI-I output, it shows sdvo dvi is detected incorrectly. Signed-off-by: Ma Ling --- drivers/gpu/drm/i915/intel_sdvo.c | 37 +++++++++++++++++++++++++++---------- 1 files changed, 27 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 4f0c309..b2d02a9 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c @@ -31,6 +31,7 @@ #include "drm.h" #include "drm_crtc.h" #include "intel_drv.h" +#include "drm_edid.h" #include "i915_drm.h" #include "i915_drv.h" #include "intel_sdvo_regs.h" @@ -1435,40 +1436,56 @@ void intel_sdvo_set_hotplug(struct drm_connector *connector, int on) intel_sdvo_read_response(intel_output, &response, 2); } -static void -intel_sdvo_hdmi_sink_detect(struct drm_connector *connector) +enum drm_connector_status +intel_sdvo_hdmi_sink_detect(struct drm_connector *connector, u16 response) { struct intel_output *intel_output = to_intel_output(connector); struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; + enum drm_connector_status status = connector_status_connected; struct edid *edid = NULL; edid = drm_get_edid(&intel_output->base, intel_output->ddc_bus); if (edid != NULL) { - sdvo_priv->is_hdmi = drm_detect_hdmi_monitor(edid); + + /* + * we try to avoid similar case(DVI-I) on 4X + * platform. + */ + if (response & (SDVO_OUTPUT_TMDS0 | SDVO_OUTPUT_TMDS1)) { + if (edid->input & DRM_EDID_INPUT_DIGITAL) + sdvo_priv->is_hdmi = + drm_detect_hdmi_monitor(edid); + else + status = connector_status_disconnected; + } + kfree(edid); intel_output->base.display_info.raw_edid = NULL; - } + + } else if (response & (SDVO_OUTPUT_TMDS0 | SDVO_OUTPUT_TMDS1)) + status = connector_status_disconnected; + + return status; } static enum drm_connector_status intel_sdvo_detect(struct drm_connector *connector) { - u8 response[2]; + u16 response; u8 status; struct intel_output *intel_output = to_intel_output(connector); intel_sdvo_write_cmd(intel_output, SDVO_CMD_GET_ATTACHED_DISPLAYS, NULL, 0); status = intel_sdvo_read_response(intel_output, &response, 2); - DRM_DEBUG("SDVO response %d %d\n", response[0], response[1]); + DRM_DEBUG("SDVO response %d\n", response); if (status != SDVO_CMD_STATUS_SUCCESS) return connector_status_unknown; - if ((response[0] != 0) || (response[1] != 0)) { - intel_sdvo_hdmi_sink_detect(connector); - return connector_status_connected; - } else + if (response != 0) + return intel_sdvo_hdmi_sink_detect(connector, response); + else return connector_status_disconnected; }