Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1841863ybn; Thu, 26 Sep 2019 03:04:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqzv6MMuXXHw/bZFDSm4YORX6Woc5orqfMv5IIJMCCRGD4gkRkIjARzlVSnrmwUUm8modjwU X-Received: by 2002:a17:906:3281:: with SMTP id 1mr2260507ejw.181.1569492267658; Thu, 26 Sep 2019 03:04:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569492267; cv=none; d=google.com; s=arc-20160816; b=na+oMffoRjSg6LZi8c0cG4gVfCmT3S66myLvcR+LXwucYC2maxf3Wjdat+Rol/D7CY ttW2zOZ9LSueQGaO53ngcKxHmzSvxAf0HqoVltQNlas7My7KGMOVJU7MaTK9pleWZsHi s/Li7T4ku4JPRfMm5CaM1XPDcjFakn9IgA2DEIFfXncDYQhXc+Bsp0lsiFY2ks33lB1v GAmMnqp8U8c33CnBVYoLzluPLfAUfJer0wbS/TkXyFx8vzkrpZ1Y8fuNoyZwnFQMtQ4I jQ3FAsqhg2/6CYUcaHdYjbJ3kxLBVBuCo1mosesZbKX48jMyQ0QZFqNX4rGpwO6PbkFC BzWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=D3R5p5aNmKg+no70gbWvodTwkrK5NbK9C77qnFGnPQI=; b=CRZmwJ82LrrK4MexYQjN//NI6DQx+qgW2lLBXjuXqYXoIZCy0zcstPO8bm+dl0iKZD l1/v2vZCvK3FcbArRuMDJq17RZupULUCe+JT8l9tZ6ODuw9RScU2CS8LJo6FpmpYNG5U iawa3y7rFHsJ1H9kgEHSd7AqMBDU1HHl/WBR7ud5qezlpXIy0bR/5+QXqME6+eGb9P/x LtOYDh1m6Rusu0ePjlz1K1xVEW2fcv/XgWPE2UVu7Cn+R1EfM2LS1JY2d2J59PTCLU+f l0Y2znpam/S2VrHJ3N4aNa//EZEifhftxSmKsDJnSBHvrSlnBV2y5mQ0j+nGH9EFBzyd 7CAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=cIhCIVsF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o32si937215edb.63.2019.09.26.03.04.04; Thu, 26 Sep 2019 03:04:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=cIhCIVsF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730351AbfIYW6t (ORCPT + 99 others); Wed, 25 Sep 2019 18:58:49 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:40071 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730150AbfIYW6q (ORCPT ); Wed, 25 Sep 2019 18:58:46 -0400 Received: by mail-pf1-f193.google.com with SMTP id x127so433051pfb.7 for ; Wed, 25 Sep 2019 15:58:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D3R5p5aNmKg+no70gbWvodTwkrK5NbK9C77qnFGnPQI=; b=cIhCIVsFGefuQt7T8cW/AELGwXMhBV6XE1nXXaQCSx/Su5g9tAvLUHyazV9tnQ4UIi QdTdIDPpoy4opw9OOungkLA59WwHdQgmovVe21mB5VGzxgh2dc6q6feeSOBBT2XHLHYn 8gzP/CNxYAeDLGNA3uO/OnX2tAw0STo2HeU4A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=D3R5p5aNmKg+no70gbWvodTwkrK5NbK9C77qnFGnPQI=; b=Fz8ls8GXQd5mksz70kCNYgQkdiDzSY1H+KOUB7CPMPPzcQwdSdjK6iSUMUgB7QE7W3 mbWGGoCzeqtPhU5cutUPw73RYOU4OfvTzLmrN6G6S+/NcyXOOZ6zXVLFABn9HehtnTq8 y01oYF8YWHis4LUy1q01mfmQL69Fzhi5JYp1dUbyrCIK5J5aQHZUYD6doOa5HRZzebl0 TXHPWLhfGfPB2XBFvb1wsv4ErJz6qQZXh7KrwzytFyRbH8oMwpenj1FI4u1Yfmlbu8BH TNXfYDEsUDxSmsY7qrdycYLkJcwa1TuRU8Dq74/Ody1M0w8CJxzBaNOUpvglqdIa9k8X VgIA== X-Gm-Message-State: APjAAAW5CU7B38GaOPN6LFCi0ItdkI3UupzN3qEUriCC/2tY9ke8cAP8 PceOE21N9qjoL0x5BOA9gsOufleKcC4= X-Received: by 2002:aa7:81d7:: with SMTP id c23mr106190pfn.207.1569452323842; Wed, 25 Sep 2019 15:58:43 -0700 (PDT) Received: from exogeni.mtv.corp.google.com ([2620:15c:202:1:5be8:f2a6:fd7b:7459]) by smtp.gmail.com with ESMTPSA id j24sm76185pff.71.2019.09.25.15.58.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Sep 2019 15:58:43 -0700 (PDT) From: Derek Basehore To: linux-kernel@vger.kernel.org Cc: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Thierry Reding , Sam Ravnborg , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , CK Hu , Philipp Zabel , Matthias Brugger , dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Derek Basehore Subject: [PATCH v8 3/4] drm/connector: Split out orientation quirk detection Date: Wed, 25 Sep 2019 15:58:32 -0700 Message-Id: <20190925225833.7310-4-dbasehore@chromium.org> X-Mailer: git-send-email 2.23.0.351.gc4317032e6-goog In-Reply-To: <20190925225833.7310-1-dbasehore@chromium.org> References: <20190925225833.7310-1-dbasehore@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Not every platform needs quirk detection for panel orientation, so split the drm_connector_init_panel_orientation_property into two functions. One for platforms without the need for quirks, and the other for platforms that need quirks. Signed-off-by: Derek Basehore Acked-by: Sam Ravnborg --- drivers/gpu/drm/drm_connector.c | 45 ++++++++++++++++++------- drivers/gpu/drm/i915/display/icl_dsi.c | 2 +- drivers/gpu/drm/i915/display/intel_dp.c | 4 +-- drivers/gpu/drm/i915/display/vlv_dsi.c | 2 +- include/drm/drm_connector.h | 2 ++ 5 files changed, 39 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 4c766624b20d..faef25683faf 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -1989,31 +1989,23 @@ EXPORT_SYMBOL(drm_connector_set_vrr_capable_property); * drm_connector_init_panel_orientation_property - * initialize the connecters panel_orientation property * @connector: connector for which to init the panel-orientation property. - * @width: width in pixels of the panel, used for panel quirk detection - * @height: height in pixels of the panel, used for panel quirk detection * * This function should only be called for built-in panels, after setting * connector->display_info.panel_orientation first (if known). * - * This function will check for platform specific (e.g. DMI based) quirks - * overriding display_info.panel_orientation first, then if panel_orientation - * is not DRM_MODE_PANEL_ORIENTATION_UNKNOWN it will attach the - * "panel orientation" property to the connector. + * This function will check if the panel_orientation is not + * DRM_MODE_PANEL_ORIENTATION_UNKNOWN. If not, it will attach the "panel + * orientation" property to the connector. * * Returns: * Zero on success, negative errno on failure. */ int drm_connector_init_panel_orientation_property( - struct drm_connector *connector, int width, int height) + struct drm_connector *connector) { struct drm_device *dev = connector->dev; struct drm_display_info *info = &connector->display_info; struct drm_property *prop; - int orientation_quirk; - - orientation_quirk = drm_get_panel_orientation_quirk(width, height); - if (orientation_quirk != DRM_MODE_PANEL_ORIENTATION_UNKNOWN) - info->panel_orientation = orientation_quirk; if (info->panel_orientation == DRM_MODE_PANEL_ORIENTATION_UNKNOWN) return 0; @@ -2036,6 +2028,35 @@ int drm_connector_init_panel_orientation_property( } EXPORT_SYMBOL(drm_connector_init_panel_orientation_property); +/** + * drm_connector_init_panel_orientation_property_quirk - + * initialize the connecters panel_orientation property with a quirk + * override + * @connector: connector for which to init the panel-orientation property. + * @width: width in pixels of the panel, used for panel quirk detection + * @height: height in pixels of the panel, used for panel quirk detection + * + * This function will check for platform specific (e.g. DMI based) quirks + * overriding display_info.panel_orientation first, then if panel_orientation + * is not DRM_MODE_PANEL_ORIENTATION_UNKNOWN it will attach the + * "panel orientation" property to the connector. + * + * Returns: + * Zero on success, negative errno on failure. + */ +int drm_connector_init_panel_orientation_property_quirk( + struct drm_connector *connector, int width, int height) +{ + int orientation_quirk; + + orientation_quirk = drm_get_panel_orientation_quirk(width, height); + if (orientation_quirk != DRM_MODE_PANEL_ORIENTATION_UNKNOWN) + connector->display_info.panel_orientation = orientation_quirk; + + return drm_connector_init_panel_orientation_property(connector); +} +EXPORT_SYMBOL(drm_connector_init_panel_orientation_property_quirk); + int drm_connector_set_obj_prop(struct drm_mode_object *obj, struct drm_property *property, uint64_t value) diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c b/drivers/gpu/drm/i915/display/icl_dsi.c index 6e398c33a524..483287984090 100644 --- a/drivers/gpu/drm/i915/display/icl_dsi.c +++ b/drivers/gpu/drm/i915/display/icl_dsi.c @@ -1538,7 +1538,7 @@ static void icl_dsi_add_properties(struct intel_connector *connector) connector->base.display_info.panel_orientation = intel_dsi_get_panel_orientation(connector); - drm_connector_init_panel_orientation_property(&connector->base, + drm_connector_init_panel_orientation_property_quirk(&connector->base, connector->panel.fixed_mode->hdisplay, connector->panel.fixed_mode->vdisplay); } diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index 921ad0a2f7ba..419413fa8165 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -7076,8 +7076,8 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, intel_panel_setup_backlight(connector, pipe); if (fixed_mode) - drm_connector_init_panel_orientation_property( - connector, fixed_mode->hdisplay, fixed_mode->vdisplay); + drm_connector_init_panel_orientation_property_quirk(connector, + fixed_mode->hdisplay, fixed_mode->vdisplay); return true; diff --git a/drivers/gpu/drm/i915/display/vlv_dsi.c b/drivers/gpu/drm/i915/display/vlv_dsi.c index a71b22bdd95b..46cfb0821c17 100644 --- a/drivers/gpu/drm/i915/display/vlv_dsi.c +++ b/drivers/gpu/drm/i915/display/vlv_dsi.c @@ -1634,7 +1634,7 @@ static void vlv_dsi_add_properties(struct intel_connector *connector) connector->base.display_info.panel_orientation = vlv_dsi_get_panel_orientation(connector); - drm_connector_init_panel_orientation_property( + drm_connector_init_panel_orientation_property_quirk( &connector->base, connector->panel.fixed_mode->hdisplay, connector->panel.fixed_mode->vdisplay); diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 681cb590f952..e3416ac11478 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -1540,6 +1540,8 @@ void drm_connector_set_link_status_property(struct drm_connector *connector, void drm_connector_set_vrr_capable_property( struct drm_connector *connector, bool capable); int drm_connector_init_panel_orientation_property( + struct drm_connector *connector); +int drm_connector_init_panel_orientation_property_quirk( struct drm_connector *connector, int width, int height); int drm_connector_attach_max_bpc_property(struct drm_connector *connector, int min, int max); -- 2.23.0.351.gc4317032e6-goog