From patchwork Thu Aug 6 01:02:01 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhao, Yakui" X-Patchwork-Id: 39488 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 n7611EvB016261 for ; Thu, 6 Aug 2009 01:01:14 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D95D79F774; Wed, 5 Aug 2009 18:01:13 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id DA6259ECA8 for ; Wed, 5 Aug 2009 18:01:09 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 05 Aug 2009 17:59:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.43,331,1246863600"; d="scan'208";a="481129815" Received: from yakui_zhao.sh.intel.com (HELO localhost.localdomain) ([10.239.13.194]) by fmsmga002.fm.intel.com with ESMTP; 05 Aug 2009 17:54:06 -0700 From: yakui.zhao@intel.com To: eric@anholt.net Date: Thu, 6 Aug 2009 09:02:01 +0800 Message-Id: <1249520522-28941-3-git-send-email-yakui.zhao@intel.com> X-Mailer: git-send-email 1.5.4.5 In-Reply-To: <1249520522-28941-2-git-send-email-yakui.zhao@intel.com> References: <1249520522-28941-1-git-send-email-yakui.zhao@intel.com> <1249520522-28941-2-git-send-email-yakui.zhao@intel.com> Cc: Ma Ling , intel-gfx@lists.freedesktop.org Subject: [Intel-gfx] [PATCH 3/3] 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; }