From patchwork Wed May 5 07:38:59 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhao, Yakui" X-Patchwork-Id: 97002 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o457ft4b014739 for ; Wed, 5 May 2010 07:42:31 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8460F9EB45 for ; Wed, 5 May 2010 00:41:55 -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 [143.182.124.37]) by gabe.freedesktop.org (Postfix) with ESMTP id 354099E963 for ; Wed, 5 May 2010 00:41:47 -0700 (PDT) Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga102.ch.intel.com with ESMTP; 05 May 2010 00:41:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.52,332,1270450800"; d="scan'208";a="273476932" Received: from yakui_zhao.sh.intel.com (HELO [10.239.13.110]) ([10.239.13.110]) by azsmga001.ch.intel.com with ESMTP; 05 May 2010 00:41:45 -0700 From: ykzhao To: Adam Jackson In-Reply-To: <1272470337.25350.431.camel@atropine.boston.devel.redhat.com> References: <1272053772-6564-1-git-send-email-ajax@redhat.com> <20100428021519.GB9273@zhen-devel.sh.intel.com> <1272470337.25350.431.camel@atropine.boston.devel.redhat.com> Organization: Intel Open Source Technology Center Date: Wed, 05 May 2010 15:38:59 +0800 Message-Id: <1273045139.3733.137.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.22.1 (2.22.1-2.fc9) Cc: "intel-gfx@lists.freedesktop.org" Subject: Re: [Intel-gfx] [PATCH] drm/i915: Fix DDC bus selection for multifunction SDVO X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 05 May 2010 07:42:31 +0000 (UTC) diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index df9f997..4431ab6 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c @@ -172,6 +172,10 @@ struct intel_sdvo_connector { u32 cur_hue, max_hue; }; +static void +intel_sdvo_select_ddc_bus(struct intel_sdvo_priv *dev_priv, + struct intel_connector *intel_connector); + static bool intel_sdvo_output_setup(struct intel_encoder *intel_encoder, uint16_t flags); @@ -1599,8 +1603,11 @@ static enum drm_connector_status intel_sdvo_detect(struct drm_connector *connect sdvo_priv->attached_output = response; if ((sdvo_connector->output_flag & response) == 0) - ret = connector_status_disconnected; - else if (response & (SDVO_OUTPUT_TMDS0 | SDVO_OUTPUT_TMDS1)) + return connector_status_disconnected; + + intel_sdvo_select_ddc_bus(sdvo_priv, intel_connector); + + if (response & (SDVO_OUTPUT_TMDS0 | SDVO_OUTPUT_TMDS1)) ret = intel_sdvo_hdmi_sink_detect(connector, response); else ret = connector_status_connected; @@ -2047,21 +2054,25 @@ static const struct drm_encoder_funcs intel_sdvo_enc_funcs = { /** * Choose the appropriate DDC bus for control bus switch command for this - * SDVO output based on the controlled output. + * SDVO output based on the connector's output. * * DDC bus number assignment is in a priority order of RGB outputs, then TMDS * outputs, then LVDS outputs. */ static void -intel_sdvo_select_ddc_bus(struct intel_sdvo_priv *dev_priv) +intel_sdvo_select_ddc_bus(struct intel_sdvo_priv *dev_priv, + struct intel_connector *intel_connector) { uint16_t mask = 0; unsigned int num_bits; + struct intel_sdvo_connector *sdvo_connector; + + sdvo_connector = intel_connector->dev_priv; /* Make a mask of outputs less than or equal to our own priority in the * list. */ - switch (dev_priv->controlled_output) { + switch (sdvo_connector->output_flag) { case SDVO_OUTPUT_LVDS1: mask |= SDVO_OUTPUT_LVDS1; case SDVO_OUTPUT_LVDS0: @@ -2863,8 +2874,6 @@ bool intel_sdvo_init(struct drm_device *dev, int sdvo_reg) goto err_i2c; } - intel_sdvo_select_ddc_bus(sdvo_priv); - /* Set the input timing to the screen. Assume always input 0. */ intel_sdvo_set_target_input(intel_encoder, true, false);