From patchwork Mon Aug 24 05:50:25 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhao, Yakui" X-Patchwork-Id: 43549 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 n7O5onwO018544 for ; Mon, 24 Aug 2009 05:50:49 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0A6EF9EAFC; Sun, 23 Aug 2009 22:50:47 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id E44B49E7E7 for ; Sun, 23 Aug 2009 22:50:43 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 23 Aug 2009 22:40:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.44,263,1249282800"; d="scan'208";a="719963958" Received: from yakui_zhao.sh.intel.com (HELO localhost.localdomain) ([10.239.13.157]) by fmsmga001.fm.intel.com with ESMTP; 23 Aug 2009 22:53:48 -0700 From: yakui.zhao@intel.com To: eric@anholt.net Date: Mon, 24 Aug 2009 13:50:25 +0800 Message-Id: <1251093029-24392-3-git-send-email-yakui.zhao@intel.com> X-Mailer: git-send-email 1.5.4.5 In-Reply-To: <1251093029-24392-2-git-send-email-yakui.zhao@intel.com> References: <1251093029-24392-1-git-send-email-yakui.zhao@intel.com> <1251093029-24392-2-git-send-email-yakui.zhao@intel.com> Cc: Ma Ling , intel-gfx@lists.freedesktop.org Subject: [Intel-gfx] [PATCH 3/7] 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-21 16:31:47.000000000 +0800 +++ linux-2.6/drivers/gpu/drm/i915/intel_tv.c 2009-08-21 16:31:53.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; }