Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8593112ybi; Tue, 9 Jul 2019 19:20:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqwOv24jaD5FTFOR1XyUMBMkM5asvwZExqm80q3aJ7Pxvws05AZh/VBW0ZERuWb5Q1cJtr20 X-Received: by 2002:a17:902:f087:: with SMTP id go7mr35787919plb.330.1562725199955; Tue, 09 Jul 2019 19:19:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562725199; cv=none; d=google.com; s=arc-20160816; b=U6w/mdwQqMqhtxUADzmNmgqNmljhBPUiLJTNN8PbvWV7goD2uFwoJJMhi7tLgHkcfq DIm29AvIC4yL9vpDBWD40tJzb7sdnDMJda07jNelUb+3koMf/iyA+SS9SOJlDzCwODP4 rK8HjrF+7xUGT+zTrj13JqfQd/sl2QqokYYlrD2W2i7GgYa834Vy1i3Bta6s5pRIKAGR 9qWnV+jhcXm5n4ZRDeDyTiNJe2CQ/lYpqkD4ieAUcsxnrB0n18+afftoZO4cYdky6Sba 1ZaGKAA7637u9LjjOEpWkE3sCGATir8INrgJOMrUH2ANf0Q9gECvBnC8giSllzmcZUlg udXQ== 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=rfx+Gd8oVEa1XPLGf6Uhcr6PQLb7UV/+SVQIxm9mxvM=; b=Jwyf+0ahmM96rhfwlGwlvyf4sa3ysNBrHE3Pp4fzguSu097ZQ9eUJZWvfvdV4Od5xH esoXty8vaEhWHWo24ZiEoANjDqMsRi7ptwHuOYViJm2XUEY9cB9rrQbBBaJ59yNl9nrg nGl04heKqE0Wmo4+LN7XEqFu73Og8SAAUb60LnuceB7kiUI1cx5foS5FgNJhap/ArtLe 6Ax5ZaPh9x+G5YgsRYI+rc7FvulIb95kY/T5MLxGZoxcOJZZQf+YM4jFFZpV9U2/jBrm wXYZnUcF7WPYSC8mlfV9JUzJAIt8SopIw7ujsY4RznTo88NNeqvR7xpePg6JYpXe5z1W 68tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=aawXa+Lk; 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 c127si817490pfa.20.2019.07.09.19.19.44; Tue, 09 Jul 2019 19:19:59 -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=aawXa+Lk; 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 S1727144AbfGJCRS (ORCPT + 99 others); Tue, 9 Jul 2019 22:17:18 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:36528 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725832AbfGJCRH (ORCPT ); Tue, 9 Jul 2019 22:17:07 -0400 Received: by mail-pl1-f194.google.com with SMTP id k8so379983plt.3 for ; Tue, 09 Jul 2019 19:17:06 -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=rfx+Gd8oVEa1XPLGf6Uhcr6PQLb7UV/+SVQIxm9mxvM=; b=aawXa+LkTbucerXg4L9n9gF1KFbcTg+H2OKkFWI4ygUbxZGVqYGqbRu/syViUnFP/X js9OUUiu6Qrs1VAmsVJgu59Kwr3zqoUllfexi7fhUZBJh8s8sVGlQqkts+qdDLeR6FrU j3PeApwXk/eCwD6juKRGXxL5SfIacGIpfm3cM= 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=rfx+Gd8oVEa1XPLGf6Uhcr6PQLb7UV/+SVQIxm9mxvM=; b=Ipe6MiZU5ix+JsbQX4RN/b6xltOrwgWP7stE2ZzOg1SqfHWvYCvtqH3+QDudkbJn9m P+ffLW02gc1FQYPR56bf73hAGBRifmMVfSyzIxGX4pwRMMxeQi6zO0cT6wArFwRmi+tr AbsD6rtISPqvPt44r7gG/01BaD1u4wcVf3Z3VQp8febd6keUwbdp846+zqcE0MoA8QfO aJvaoYzgcizyH3vanqKtpaRIYSmOg7wfPnJarJrW3FYKJv8tFOyUkRYWw0EBJU6IBW1V MHlYoUpXVIKZUf1ueAwhyBiA6WcWPxLNtOJ+9kCfjlmv/Eg5HxoyoLD5poh7OSnVmYey fq6g== X-Gm-Message-State: APjAAAUyfMjbuhkfs6FPlHR/3C826a9FzpNd3U0/++yNIDR5f4KYloFG YSsBXfMFUA43d8dcHqU6x8B0zmg/ZEE= X-Received: by 2002:a17:902:42d:: with SMTP id 42mr34536201ple.228.1562725026148; Tue, 09 Jul 2019 19:17: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 f17sm326296pgv.16.2019.07.09.19.17.05 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 09 Jul 2019 19:17: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 v7 2/4] drm/panel: set display info in panel attach Date: Tue, 9 Jul 2019 19:16:57 -0700 Message-Id: <20190710021659.177950-3-dbasehore@chromium.org> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190710021659.177950-1-dbasehore@chromium.org> References: <20190710021659.177950-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 fc7da55f41d9..a6a881b987dd 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -39,6 +39,8 @@ enum drm_panel_orientation; * 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 @@ -95,6 +97,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