Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8440838ybi; Tue, 9 Jul 2019 16:00:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzYkusyAE4t516+TBB6sMeX9MjigeVzQm+XA1q9PRsIA2m3zYvmJxwKKQ2ni1RjIoUA996m X-Received: by 2002:a17:902:934a:: with SMTP id g10mr35711970plp.18.1562713243303; Tue, 09 Jul 2019 16:00:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562713243; cv=none; d=google.com; s=arc-20160816; b=Sx7v1LmRDQ5Zz8Ps6YcdC+nKOnDrdPfTmU2YyeuMRTh7Rybu1qyBcyf8giNVGASLhb +2+nPsh/VD3DbnJDrPqxB/7RATFa33rCnFKxBQ+jeqUWYBnZomfX4oy6HBw8/FniXWVt OVexJ9YR84Wew2/P9n2QErojzFdUrgzrbq5NHC7+O1tDyUT6hvD2mUFqGc/5Cu2dAzUf BXVSgJnOd4WM8x4qnPfyIRO+ybuZOIE8DXiGBcql9+D0N/IB0/1O2avMf4r08itfAb9A ycYIH4O2pqpy9FFIhTqKSI2Rb/ezbpvAO2oTqkVsZYAeRIjMjNoyHQXyPSr4Q0KonE+P ARwA== 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=bBVhvAORuxa08E5bVyE4KLrue551lcg8cyCDKswqftI=; b=nqaWkSOAUNCMwfYBPFSyTlsWaiyWU1gsMeJ9lgo1ziqNk10Wv5uWmGrwnSCLpPBWeg Q8ZeOSOufomU4tvSls2AG6Kpl+7QXyncwvMWgmoxfFWBtB35lJj7mL5aqEe5uJ83aMlo IWxvGRlEoFDNPWISoO7k07RnEBdb7pr1E5vcp0CaRIKQ/VBVUbBW3j6dG31oPOgfUwuF JXfkoDfuThYmtDz7FFv0SdSTGIf2hKEM17ce3Gp0aEq9jq1tfVxCr5/de0JCm5rEH9rz 470LnCPeAgeOSrQ71FSFDza5Xy2o4Gr/r67RAqpIfB86rnM7FfUo1eoq9txzWONlaF4s fNCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Xdo5o65c; 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 b16si250141pfd.126.2019.07.09.16.00.28; Tue, 09 Jul 2019 16:00:43 -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=Xdo5o65c; 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 S1727090AbfGIW7B (ORCPT + 99 others); Tue, 9 Jul 2019 18:59:01 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:36909 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727004AbfGIW6u (ORCPT ); Tue, 9 Jul 2019 18:58:50 -0400 Received: by mail-pl1-f193.google.com with SMTP id b3so149157plr.4 for ; Tue, 09 Jul 2019 15:58:49 -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=bBVhvAORuxa08E5bVyE4KLrue551lcg8cyCDKswqftI=; b=Xdo5o65cAK0QkwgE8+dbR/c1yDAk2t5FwKNDXKsYILcGubptUD38xPIDZfyVnqTa+h sa3PH/U+Gv5aJH9973+Q+uoe7Ftq7/sI8YQulmahRwnpv6kLxCwWgHPg/iUZe1G4XRJZ tGzaHLAYrNaHpRcnyVZ6cds07QpeSw2YznNNo= 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=bBVhvAORuxa08E5bVyE4KLrue551lcg8cyCDKswqftI=; b=aYa2brUFMC42wHHw5MlZupWRkjQZw/R8gFahIiLu5DpobAcHdIyGGk7nOS1WCxv9MX /FIEWz+5zuWLkCohU7G8CqTZBTy3i84fj3TcBW3VTlNyPf9f+AwDbxTFQLUf1FUT9HYM zKhnxSuWoLHYOX0U8W5WGFng5MQeEDNE6gvqOE7/1A1mPrP+BjyU/8PlH9vEa0ZNRzID 18UZt48zfypOe6lTTQGrWdFObT6HQtlvSV1xYqSz1OSO3Vu+erTAKzqxG37MJgzt1K85 jyDv+YnsnDNF5oHf7fWtAf7LeBF2awbrQ9ROgBhbFSdIuT4na2D2e2vooVQwAsCGhNpp C4AA== X-Gm-Message-State: APjAAAWoetIaAq/lcRnoZYYvONZoKOaiYO53D+hIA/nZENTopPpXqrxh TdmU2UyJtf2ImfGbuXUmV3ScM37ipm8= X-Received: by 2002:a17:902:934a:: with SMTP id g10mr35703367plp.18.1562713129173; Tue, 09 Jul 2019 15:58:49 -0700 (PDT) Received: from exogeni.mtv.corp.google.com ([2620:15c:202:1:5be8:f2a6:fd7b:7459]) by smtp.gmail.com with ESMTPSA id 201sm152939pfz.24.2019.07.09.15.58.48 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 09 Jul 2019 15:58:48 -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 v6 3/4] drm/connector: Split out orientation quirk detection Date: Tue, 9 Jul 2019 15:58:39 -0700 Message-Id: <20190709225840.144038-4-dbasehore@chromium.org> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190709225840.144038-1-dbasehore@chromium.org> References: <20190709225840.144038-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/display/intel_dp.c | 4 +-- drivers/gpu/drm/i915/display/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 b3f2cf7eae9c..52777d647494 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -1892,31 +1892,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; @@ -1939,6 +1931,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/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index 8f7188d71d08..45b637419085 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -7068,8 +7068,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 e272d826210a..dd7fa806f95c 100644 --- a/drivers/gpu/drm/i915/display/vlv_dsi.c +++ b/drivers/gpu/drm/i915/display/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 ca745d9feaf5..940254b06767 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -1512,6 +1512,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