Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1440021ybi; Wed, 3 Jul 2019 16:04:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqycqj9xLiKngLypoAsEl1t4JzlsZAvdoqkoGeMmx8CSyi3niCstR3aIh/PIRRK71M5x3Z0E X-Received: by 2002:a17:90a:2041:: with SMTP id n59mr15007470pjc.6.1562195081753; Wed, 03 Jul 2019 16:04:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562195081; cv=none; d=google.com; s=arc-20160816; b=a3hH7axVyIFX+5hdfdacGSeQInw6gkMQYLlx+GKmY7ImAZjXNttXHYRR9kJ8yiqMDU sjp6yOPf8Zyy7PbuKX0RAW69GKzCGyqi9SvfigEhK/uAQlTmBAo9hzQrSfxAaouSRgIm eUDeUmn2Cdr69b846Ta3NB9C/cQWjSkwynZF1q83tHt+lj4QAFatDh2qwK+eCR+HLZZw CEV7Urw2NLwyinSoJe//BmgujgYhcARHPrqXuiacpR7DHBL6jGtCEutcDb1oMKDJZE8L 9mAXOmhmhmGNX3LnsbQDEdd35LEi7MKPzBywg5l2MdCOg5qwbZIWc7yWu81sHikySmZl /txA== 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=rUReYf1ZvvUqiOQUR6cxOticK+yDM74IObmktxtVEtg+GwZFHg+mlQUsemZKakGQXm lNmyn4Ff+2Uk2tr5VY73BEmN1/QOOtisr0GgazVTsDIaK17kwg5CNbpKfrjO3PuS8Fdp 2BJPicClqmpG9BLz/kc5BujPk7E2f4ml9Zq1z6ue05brhhIqVqUq+oCd+JPK5xIH0SrB z6JLsIYPMLUfrlvkCkGc3MtmJjTJZZsoDGj1+I41Fg0DgaLC2le+07qPnqLo4bm2Tedq y+OBYRx2JkHULJ5e18t5bBCClCJrxHODB8b61Myj2xENdrbXT8f0ZvvLkj3FIdDgZkGc S6rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lLPz2AEy; 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 t19si3662414pfe.94.2019.07.03.16.04.26; Wed, 03 Jul 2019 16:04:41 -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=lLPz2AEy; 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 S1727485AbfGCXCc (ORCPT + 99 others); Wed, 3 Jul 2019 19:02:32 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:33742 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727377AbfGCXCT (ORCPT ); Wed, 3 Jul 2019 19:02:19 -0400 Received: by mail-pl1-f194.google.com with SMTP id c14so2018231plo.0 for ; Wed, 03 Jul 2019 16:02:19 -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=lLPz2AEydp02tkSoEhP9SXY7a96EaFW/sEWl5Z9jyX1Oiof3E30YoRsS0CERy0MaiP d9nVLGPJFwytYl2TGnWz8A+1pEzGjuBY8MBcUpsYDiAMqeGLy0xpT694AoSbaILKWmaJ Z7rrznqr0uyvDDtaLQEEAf79XwmuMMeCM+7Yg= 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=tgH+vGbpcPovVrCD1AdWeqjZtco6cOUUhmGWKpqzw3Z1ejxi95SciGreCeHZDglX/z hjJRiksz8L8UkGxyHxdqzAnxK6pkzMWrCv6gdFPzaD6hIwotK43px380UPfmM2+YsJmR 1uek4rx4wXPfd7arU79eDspEeosr99sqPkRtblGnC4wW3dC4D+p0+3p137XmhWKbiHO9 ag9aA3o5LvwFIhldVFsjkY9SgKY11HIyFYckz3XR5n0/Ch0WhKbrtbjUSBnXYs4m7h68 AbPVe/3Zrny2dRQiCzqA72fuRXS0eJuV+uVta20fXlEoCTW7lqF0TcURCNNlP7pXt5Wj IiLQ== X-Gm-Message-State: APjAAAXf0v22p4xLiUBlPphhivZ+aauFgRGXHYaLfHSQijLkeGRl/VRO h7orkX3e4VsvZeYkiaiCfQh4Ea6tGD0= X-Received: by 2002:a17:902:403:: with SMTP id 3mr44361012ple.66.1562194938800; Wed, 03 Jul 2019 16:02:18 -0700 (PDT) Received: from exogeni.mtv.corp.google.com ([2620:15c:202:1:5be8:f2a6:fd7b:7459]) by smtp.gmail.com with ESMTPSA id t8sm4245171pfq.31.2019.07.03.16.02.17 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 03 Jul 2019 16:02:18 -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 v5 3/4] drm/connector: Split out orientation quirk detection Date: Wed, 3 Jul 2019 16:02:09 -0700 Message-Id: <20190703230210.85342-4-dbasehore@chromium.org> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190703230210.85342-1-dbasehore@chromium.org> References: <20190703230210.85342-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