From patchwork Mon Aug 17 02:51:31 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhao, Yakui" X-Patchwork-Id: 41929 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 n7H2pe7t014089 for ; Mon, 17 Aug 2009 02:51:40 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 486EF9ECEF; Sun, 16 Aug 2009 19:51:39 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id B430F9E996 for ; Sun, 16 Aug 2009 19:51:34 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 16 Aug 2009 19:39:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.43,393,1246863600"; d="scan'208";a="439489994" Received: from yakui_zhao.sh.intel.com (HELO localhost.localdomain) ([10.239.13.167]) by orsmga002.jf.intel.com with ESMTP; 16 Aug 2009 19:57:55 -0700 From: yakui.zhao@intel.com To: eric@anholt.net Date: Mon, 17 Aug 2009 10:51:31 +0800 Message-Id: <1250477492-26359-3-git-send-email-yakui.zhao@intel.com> X-Mailer: git-send-email 1.5.4.5 In-Reply-To: <1250477492-26359-2-git-send-email-yakui.zhao@intel.com> References: <1250477492-26359-1-git-send-email-yakui.zhao@intel.com> <1250477492-26359-2-git-send-email-yakui.zhao@intel.com> Cc: Ma Ling , intel-gfx@lists.freedesktop.org Subject: [Intel-gfx] [PATCH 3/4] drm/i915: select TV format according to connector type 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 From: Ma Ling For integrated TV there are 3 connector types: S-VIDEO, Composite and Component(YprPb). Those tv formats whose component flag is true should be assigned to Component connector, others are for S-VIDEO and Composite. The patch intends to find appropriate tv format for each connector. In such case it will return the correct modeline to user space. Otherwise it will return the incorrect modeline when S-video/composite is connected. Signed-off-by: Ma Ling reviewed-by: Zhao Yakui --- drivers/gpu/drm/i915/intel_tv.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) Index: linux-2.6/drivers/gpu/drm/i915/intel_tv.c =================================================================== --- linux-2.6.orig/drivers/gpu/drm/i915/intel_tv.c 2009-08-06 08:32:38.000000000 +0800 +++ linux-2.6/drivers/gpu/drm/i915/intel_tv.c 2009-08-06 08:32:52.000000000 +0800 @@ -1437,6 +1437,35 @@ return type; } +/* + * Here we set accurate tv format according to connector type + * i.e Component TV should not be assigned by NTSC or PAL + */ +static void intel_tv_find_better_format(struct drm_connector *connector) +{ + struct intel_output *intel_output = to_intel_output(connector); + struct intel_tv_priv *tv_priv = intel_output->dev_priv; + const struct tv_mode *tv_mode = intel_tv_mode_find(intel_output); + int i; + + if ((tv_priv->type == DRM_MODE_CONNECTOR_Component) == + tv_mode->component_only) + return; + + + for (i = 0; i < sizeof(tv_modes) / sizeof(*tv_modes); i++) { + tv_mode = tv_modes + i; + + if ((tv_priv->type == DRM_MODE_CONNECTOR_Component) == + tv_mode->component_only) + break; + } + + tv_priv->tv_format = tv_mode->name; + drm_connector_property_set_value(connector, + connector->dev->mode_config.tv_mode_property, i); +} + /** * Detect the TV connection. * @@ -1473,6 +1502,7 @@ if (type < 0) return connector_status_disconnected; + intel_tv_find_better_format(connector); return connector_status_connected; }