From patchwork Wed Oct 26 01:16:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Navare, Manasi" X-Patchwork-Id: 9398779 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 85AD560234 for ; Thu, 27 Oct 2016 00:55:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F59F29E60 for ; Thu, 27 Oct 2016 00:55:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 445F929E62; Thu, 27 Oct 2016 00:55:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C6D5F29E60 for ; Thu, 27 Oct 2016 00:55:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E19D6E983; Thu, 27 Oct 2016 00:55:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9A3E56E795; Wed, 26 Oct 2016 01:15:12 +0000 (UTC) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP; 25 Oct 2016 18:15:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,548,1473145200"; d="scan'208";a="23735827" Received: from manasi-otcmedia.jf.intel.com ([10.7.199.175]) by orsmga005.jf.intel.com with ESMTP; 25 Oct 2016 18:15:12 -0700 From: Manasi Navare To: intel-gfx@lists.freedesktop.org Subject: [PATCH 1/2] drm: Add a new connector property for link status Date: Tue, 25 Oct 2016 18:16:34 -0700 Message-Id: <1477444595-19656-1-git-send-email-manasi.d.navare@intel.com> X-Mailer: git-send-email 1.9.1 X-Mailman-Approved-At: Thu, 27 Oct 2016 00:55:07 +0000 Cc: Manasi Navare , dri-devel@lists.freedesktop.org, Daniel Vetter X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP A new optional connector property is added for keeping track of whether the link is good (link training passed) or link is bad (link training failed). If the link status property is Bad, then userspace should fire off a new modeset at the current mode even if there have not been any changes in the mode list or connector status. Cc: dri-devel@lists.freedesktop.org Cc: Jani Nikula Cc: Daniel Vetter Cc: Ville Syrjala Cc: Chris Wilson Signed-off-by: Manasi Navare --- drivers/gpu/drm/drm_connector.c | 32 ++++++++++++++++++++++++++++++++ include/drm/drm_connector.h | 1 + include/drm/drm_crtc.h | 6 ++++++ include/uapi/drm/drm_mode.h | 4 ++++ 4 files changed, 43 insertions(+) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 2db7fb5..b4ce19f 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -588,6 +588,11 @@ int drm_display_info_set_bus_formats(struct drm_display_info *info, DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name, drm_tv_subconnector_enum_list) +static const struct drm_prop_enum_list drm_link_status_enum_list[] = { + { DRM_MODE_LINK_STATUS_GOOD, "Good" }, + { DRM_MODE_LINK_STATUS_BAD, "Bad" }, +}; + int drm_connector_create_standard_properties(struct drm_device *dev) { struct drm_property *prop; @@ -845,6 +850,33 @@ int drm_mode_create_suggested_offset_properties(struct drm_device *dev) EXPORT_SYMBOL(drm_mode_create_suggested_offset_properties); /** + * drm_mode_create_link_status_property - Create link status property + * @dev: DRM device + * + * Called by a driver the first time it's needed, must be attached to desired + * connectors. + * This property is used to indicate whether link sttaus is Good or Bad as + * a result fo link training + */ +int drm_mode_create_link_status_property(struct drm_device *dev) +{ + struct drm_property *link_status; + + if (dev->mode_config.link_status_property) + return 0; + + link_status = + drm_property_create_enum(dev, 0, "link-status", + drm_link_status_enum_list, + ARRAY_SIZE(drm_link_status_enum_list)); + + dev->mode_config.scaling_mode_property = link_status; + + return 0; +} +EXPORT_SYMBOL(drm_mode_create_link_status_property); + +/** * drm_mode_connector_set_path_property - set tile property on connector * @connector: connector to set property on. * @path: path to use for property; must not be NULL. diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index fc9d475..7234c0c 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -759,6 +759,7 @@ int drm_mode_create_tv_properties(struct drm_device *dev, int drm_mode_create_scaling_mode_property(struct drm_device *dev); int drm_mode_create_aspect_ratio_property(struct drm_device *dev); int drm_mode_create_suggested_offset_properties(struct drm_device *dev); +int drm_mode_create_link_status_property(struct drm_device *dev); int drm_mode_connector_set_path_property(struct drm_connector *connector, const char *path); diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index fa1aa21..3e9c833 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -1343,6 +1343,12 @@ struct drm_mode_config { */ struct drm_property *suggested_y_property; + /** + * @link_status_property: Optional connector property for link status + * of the connector as a result of link training. + */ + struct drm_property *link_status_property; + /* dumb ioctl parameters */ uint32_t preferred_depth, prefer_shadow; diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h index 084b50a..f1b0afd 100644 --- a/include/uapi/drm/drm_mode.h +++ b/include/uapi/drm/drm_mode.h @@ -121,6 +121,10 @@ #define DRM_MODE_DIRTY_ON 1 #define DRM_MODE_DIRTY_ANNOTATE 2 +/* Link Status options */ +#define DRM_MODE_LINK_STATUS_GOOD 0 +#define DRM_MODE_LINK_STATUS_BAD 1 + struct drm_mode_modeinfo { __u32 clock; __u16 hdisplay;