Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp143367ybi; Tue, 2 Jul 2019 17:55:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqyypm+P/ypXoutYR8eXK9eXiZoDY9isoYPHTR2dc+Nt4/bvFYX6NGHpa6VRWaE/d/mSldFS X-Received: by 2002:a17:902:148:: with SMTP id 66mr36152078plb.143.1562115303987; Tue, 02 Jul 2019 17:55:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562115303; cv=none; d=google.com; s=arc-20160816; b=Ro7DoC1G/qKBPB+3fA3KC8iyPrdw81mMjYJ3xK4Q6IOtRg2NvUy4n3/H5S8UBYlRnU AmCmdjzh1agaqNvNyGA0xpSwrQdA6+4oBo71RTwa8axXYIqqWQRN5dmtFn+/s8Fjj7/5 OZwIbH6uOMOvmMNl/hKAYYjFUjNStLoK3VS4Cd1jbP/V1glMFvEIoxCch/t4x+3awrSB twwW+oLJe0jzqSeUTb97UCuUrVrEcMsDbyrIuYgXZa9lMAZ07UVeaAShaP14L38PYnNq G+L8Q51Ue3pEzjBD64WYfHq3zv/n01DgHUlaxzqaw4SKxEgcLvrNvCQTaWXMwvutUuY7 9C7Q== 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=LTgfihGXkEgE7V7ZvRB8XdBiWcmNn66JyBkQtEriRk0=; b=ut9rZXBz4obPJs7ZYk6SAAFVXQkT//EhwxDj5GUr+6cJLUyqaDDv6hW5xLhEpkW7Cx 8LxhExSurqe7f5EzHZRNM3cOqBka60+NbFW7JEzLUA1KVVhS/OUVdDIAql/nao79MIQg 7LPIezaRXZ+MOdRWSpAZGA/4ta6rip3QrKzTB5x08b7ZudYEvQiejK2/6IP71HXIJRCe Ss4mVJmOuThtP0gUqqKqrB7RNOhVyNpzw0eXLcruoRcBmExEHOiGXwLf6jvrM17LGm5Q bkZXKPfIUSx8O7Td+Klh+VUPWy52HqcwqE3HMne0+n+MUnucoVbCycxK+Bg3ENY3TSaI tR0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=L2a+LvEr; 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 w64si344515pgd.485.2019.07.02.17.54.48; Tue, 02 Jul 2019 17:55:03 -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=L2a+LvEr; 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 S1727289AbfGCAya (ORCPT + 99 others); Tue, 2 Jul 2019 20:54:30 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:37216 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727049AbfGCAya (ORCPT ); Tue, 2 Jul 2019 20:54:30 -0400 Received: by mail-pg1-f193.google.com with SMTP id g15so256491pgi.4 for ; Tue, 02 Jul 2019 17:54:29 -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=LTgfihGXkEgE7V7ZvRB8XdBiWcmNn66JyBkQtEriRk0=; b=L2a+LvEruMo/zpxKW+/XMxfMFGcYLx94EpJC8aEhmGfqKH9C8cHJatTddYsXQcusm3 D/P24vPx7fkT8mrTszUpF3+qhmaXnS7zvUjJRkErCijr7jDmfGk/xxWCWFa2BdYlNg2w /CelQ0Bm7R/JAQTpds6GWZ4C+gZ/urmVtP6rs= 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=LTgfihGXkEgE7V7ZvRB8XdBiWcmNn66JyBkQtEriRk0=; b=HWTzscDspuuDxGxEqZ8nRQnjOLASjgb8SCza3YPtWRJGBx3hHUwhvxfog3tc9w5Xvh AmzRyhy8d7mw5/3DgSxpPCxFtyVzbhUi/HN4a7HwBGO4w3eeWe50i/X/mlHEjKtTL8b4 nO3JbGXDgTwlbuX2vcgA45/ThO80YBH+U0ACP1KbDma6TrlPM8MRvejsg6esqGrWjXpx KSZ6QmxA9GGPbeEdgc2dxCULEKFe9pq1QTA2pjBt6R27UG3WTzFWt2YQYctJgfESX/Ky fIS+rfzlViHsdIlerm6Vof+KCuvM9w3bQVHrimofrEzgP7d5vA6GzGpTMi7+uWrjbAhE wrWw== X-Gm-Message-State: APjAAAUN4k9fYdBU1HPR/a1OYUqCrBVK5fc+P4fqsOg4SE4Pd1Dcr0kL SMp2/02nSQ7XeC2L3LzAEOi2resmXLU= X-Received: by 2002:a17:90a:3344:: with SMTP id m62mr8497489pjb.135.1562110986433; Tue, 02 Jul 2019 16:43:06 -0700 (PDT) Received: from exogeni.mtv.corp.google.com ([2620:15c:202:1:5be8:f2a6:fd7b:7459]) by smtp.gmail.com with ESMTPSA id c26sm167611pfr.172.2019.07.02.16.43.05 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 02 Jul 2019 16:43:05 -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 v4 3/4] drm/connector: Split out orientation quirk detection Date: Tue, 2 Jul 2019 16:42:57 -0700 Message-Id: <20190702234258.136349-4-dbasehore@chromium.org> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190702234258.136349-1-dbasehore@chromium.org> References: <20190702234258.136349-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 --- drivers/gpu/drm/drm_connector.c | 45 ++++++++++++++++++++++++--------- drivers/gpu/drm/i915/intel_dp.c | 4 +-- drivers/gpu/drm/i915/vlv_dsi.c | 2 +- include/drm/drm_connector.h | 2 ++ 4 files changed, 38 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index e17586aaa80f..c4b01adf927a 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -1894,31 +1894,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; @@ -1941,6 +1933,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/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index b099a9dc28fd..7d4e61cf5463 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -7282,8 +7282,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/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c index bfe2891eac37..aca99ece045e 100644 --- a/drivers/gpu/drm/i915/vlv_dsi.c +++ b/drivers/gpu/drm/i915/vlv_dsi.c @@ -1662,7 +1662,7 @@ static void intel_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 47e749b74e5f..0468fd9a4418 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -1370,6 +1370,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.22.0.410.gd8fdbe21b5-goog