Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1438792ybi; Wed, 3 Jul 2019 16:03:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqwP2w+oEYE39SI2soRzobirICmOYP8NIzS2v68NVEV1sGS6/Z788PhhE76A3UKr2xc0PLgh X-Received: by 2002:a17:90a:26ef:: with SMTP id m102mr15391959pje.50.1562195005859; Wed, 03 Jul 2019 16:03:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562195005; cv=none; d=google.com; s=arc-20160816; b=YcKryCdjMuhQ/rjATjLdawsy1VIctLZeVn1RYZGdGDSMQSzyr6+8xUDLBdUPv6/RAA q3A/ZOqt5zdFwihd5+LFxF5IiBj145Snj/46zf6wd/vplRqHyRLTIdVXxCLZQIvTyjlU EAUFOjyTR3iMRbn1FQedXkoXJ09oUPT6H8aLP97oNA2PshjxoHC/1jhYOZOj9ldBAQ4m KwkAzTw9kApEyEhHB0BrG9lxLSgk/RbzU3qFbyK0Vl5vniO5kQuyB/4E0ccrpvIcB2Vq 5MHzozYkzeLkZ33Qhtmr06ig+GEo1D9PkdVP40IQezo/Fd2FdE32y6tLwJymRqmHQe5v phxA== 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=F9zUB08xFvBxYu2RwuQgWZYO7269mKq4j/1Liwi0s7g=; b=EYfaVWO2Qja85q/EFeoakjrR+R9G668/VoOZUbZy84CkSsgKW/rqAPOtZ3cVw6D09u OiiPsxG4FE/caocr1Yizfr6cLs3Z+gTE4R/o0dZ9r3mNqZ0u+Q4aaVRxmHwjLh79GUuu rhSElkDHiZkNH/9rCgLuYHdi5AwQQRNZVUGx/jGqHcqOEy1Ge+s8jFvb7q+k9aYrpE1n CVEf2+e4kA0iX/3gDAuerHhUKPd0RZd8mlp2aZIwoRBbDZnDeF3v17x4rbg4CCpWiRIG lUVd3iSIqRgEuRX7mdcFlAhbks5YPOzKRfrcaT0OmyaQQOf4YgrZ0IQ5r2P2PuIshZm1 4yqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=EcOJWfaW; 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 c23si3626835pfo.168.2019.07.03.16.03.10; Wed, 03 Jul 2019 16:03:25 -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=EcOJWfaW; 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 S1727407AbfGCXCT (ORCPT + 99 others); Wed, 3 Jul 2019 19:02:19 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:35676 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727373AbfGCXCS (ORCPT ); Wed, 3 Jul 2019 19:02:18 -0400 Received: by mail-pg1-f193.google.com with SMTP id s27so1946052pgl.2 for ; Wed, 03 Jul 2019 16:02:18 -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=F9zUB08xFvBxYu2RwuQgWZYO7269mKq4j/1Liwi0s7g=; b=EcOJWfaWPBl5iU7aepT+yYAsjTHNMWBKdA3MesZogv7wsYDwY8U4Tf0Uu23WK4Lqfj WKELViP7kELhAW6xmCvjV3Ekj/o/nLD+xEnBxekWjRQyoKXx8LY1c0uRF86jb06syE5L LDlhc2OjNnMV2xd+Z6k43KAaPx76sppQh04V0= 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=F9zUB08xFvBxYu2RwuQgWZYO7269mKq4j/1Liwi0s7g=; b=PHs0EXyuyrSCIs9oXwizsqkFfGPotOn/yv4AxxrGNPTiDYKoBXwdrBHdscsnIuwNZ9 fgC0EPeg/O1QkLiAy4Wb+hK+qKAlBl94LE7uxPdFBTtsh2YBXnQoSOdgtmloFQs+lEag 4urO1HoaUOXbdSipTjquSC8BPJV1ZByf90LxP/3JFSiJH8RWST8MEimH4Oz3vShjz5hB LBahu1mIRw6shkL4fAjQOEfLYL4lzTJCPrJJ+oX/ee1fNe8SzdUiwvXKPYfyrKb7AYjM MI9sz5eB+ch+hhv4fvg8as6MC/jE7F+f1dJ1kwcaRk1vRHwzKfcrZw1cj571VUM9FCVv u+nQ== X-Gm-Message-State: APjAAAVL6Ha6BpBQMr92+fKEPWbtLnS93IqN11GdFuKSIcboSlcCLU1q 48sUCM0KELSuA3FrNHIRBYtB9D+aK28= X-Received: by 2002:a17:90a:2023:: with SMTP id n32mr14939380pjc.3.1562194937600; Wed, 03 Jul 2019 16:02:17 -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.16 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 03 Jul 2019 16:02:17 -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 2/4] drm/panel: set display info in panel attach Date: Wed, 3 Jul 2019 16:02:08 -0700 Message-Id: <20190703230210.85342-3-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 Devicetree systems can set panel orientation via a panel binding, but there's no way, as is, to propagate this setting to the connector, where the property need to be added. To address this, this patch sets orientation, as well as other fixed values for the panel, in the drm_panel_attach function. These values are stored from probe in the drm_panel struct. Signed-off-by: Derek Basehore --- drivers/gpu/drm/drm_panel.c | 28 ++++++++++++++++++++++++++++ include/drm/drm_panel.h | 14 ++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c index 169bab54d52d..ca01095470a9 100644 --- a/drivers/gpu/drm/drm_panel.c +++ b/drivers/gpu/drm/drm_panel.c @@ -104,11 +104,23 @@ EXPORT_SYMBOL(drm_panel_remove); */ int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector) { + struct drm_display_info *info; + if (panel->connector) return -EBUSY; panel->connector = connector; panel->drm = connector->dev; + info = &connector->display_info; + info->width_mm = panel->width_mm; + info->height_mm = panel->height_mm; + info->bpc = panel->bpc; + info->panel_orientation = panel->orientation; + info->bus_flags = panel->bus_flags; + if (panel->bus_formats) + drm_display_info_set_bus_formats(&connector->display_info, + panel->bus_formats, + panel->num_bus_formats); return 0; } @@ -128,6 +140,22 @@ EXPORT_SYMBOL(drm_panel_attach); */ int drm_panel_detach(struct drm_panel *panel) { + struct drm_display_info *info; + + if (!panel->connector) + goto out; + + info = &panel->connector->display_info; + info->width_mm = 0; + info->height_mm = 0; + info->bpc = 0; + info->panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN; + info->bus_flags = 0; + kfree(info->bus_formats); + info->bus_formats = NULL; + info->num_bus_formats = 0; + +out: panel->connector = NULL; panel->drm = NULL; diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index 3564952f1a4f..760ca5865962 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -37,6 +37,8 @@ struct display_timing; * struct drm_panel_funcs - perform operations on a given panel * @disable: disable panel (turn off back light, etc.) * @unprepare: turn off panel + * @detach: detach panel->connector (clear internal state, etc.) + * @attach: attach panel->connector (update internal state, etc.) * @prepare: turn on panel and perform set up * @enable: enable panel (turn on back light, etc.) * @get_modes: add modes to the connector that the panel is attached to and @@ -93,6 +95,18 @@ struct drm_panel { const struct drm_panel_funcs *funcs; + /* + * panel information to be set in the connector when the panel is + * attached. + */ + unsigned int width_mm; + unsigned int height_mm; + unsigned int bpc; + int orientation; + const u32 *bus_formats; + unsigned int num_bus_formats; + u32 bus_flags; + struct list_head list; }; -- 2.22.0.410.gd8fdbe21b5-goog