Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp128094ybi; Tue, 2 Jul 2019 17:34:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqyhjYrBpjlxkgu/JNJXF8IQvwhY7l0kL1aIs+lHOjheBkQ4eFZrdywckVxCtP/grHgbcLmZ X-Received: by 2002:a17:902:2865:: with SMTP id e92mr37874885plb.264.1562114083269; Tue, 02 Jul 2019 17:34:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562114083; cv=none; d=google.com; s=arc-20160816; b=ZGnRr686I8tQLV3zAW3FbcqI2Sy3tlfw8/FfgEqQw41OPWcvONS+xmyYh6miQdMP7P /YnM0LTcOJKfVJy+yZHDSGMdJTa5xzWdSZdDBCmqAnjcJVfNuw3Y5STyaPu8t7ATbo2n 5jFYlIEtltU9OdX3bRiZiqgGglhjG3qLsoRLlPoIEAecflSbkAqiGeiqXz9/uEElSIeg Xu+JZJB6ZR7iEPN7owNn6YFQBgHj/AmpJZT28UcGBKIpyeQHhNv+b0L3u5s/haIl7hED XcW1Na+3pwvgRSUDyUIsE6CcUuVV67xSvJd6pqfL6/mI0h3yJ0pTKQrmX9eT7lEXbAUP XAsg== 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=Y5LkWhTcvPQC4NG4falfMj1lBJQGgq+CYaBR0TE5Oh74f9AxCi+2iT+qTBQ0l9u5Pm SjhapEhlKnD1ZcTZsgOadcZtSU6RfYiBNjbMyM9u/WoDCU+cXwGI3eVaEeVZLk8r812Z wxfNmDXGoLHpl6ZxyvDtHBWeRocUHDD+0+Rt3UMbLi0qDPwgwbDTdtkhjr01PgiAGoOg 16mECz6TtTF7UjAvH5Em6hJg27uUJU4C5DCWXqDGDH8jsmZ1ga8aPJ66a1m63AbA4p8u SOJn907nH8M/zYa3qcLHI9zIyXEDXJOKntYkG8eGhzZ9LKhP1giFR2XxKYH5vNrs1Ic8 yw4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dFzA0+ZM; 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 n11si337228plg.315.2019.07.02.17.34.27; Tue, 02 Jul 2019 17:34: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=dFzA0+ZM; 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 S1727359AbfGCAeK (ORCPT + 99 others); Tue, 2 Jul 2019 20:34:10 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:38741 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726736AbfGCAeJ (ORCPT ); Tue, 2 Jul 2019 20:34:09 -0400 Received: by mail-pg1-f195.google.com with SMTP id z75so232580pgz.5 for ; Tue, 02 Jul 2019 17:34:09 -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=dFzA0+ZM/PVDybniMdkvL0WIQsMyvZHBETHqycFlrZdNZa7xDcQUdRIzxAl6Je8eco 9lc9whbmZkX1d2mcWlkyHCKfppRAnXU1GzsWqhKs0nm7Gjxd8SYdt2/yZ+XvBPK5FnnL 9ojMlh+zoH3Z5GKJ8c06rrVYvpOexK1p4uLco= 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=k+mpiC2/1WhmTq6moLkM2gvysx60YkHT/R944ebIV4XfnKy8N5cfRKwu1jfHs8oh1C Yxu5ip+BIyvY6mtbK7tNHrsFQANSsOxU3CeP3WUCvjhY4c2nv3SU+2p3RF41nZXnEdgM 84CK8Vrl6yCFxKxDkW5ZIdffc3qo8LOuZmp1/BC+ZkoDK3BtpQjo2FRxQnInb5vhOq1N RqniHjPZZXok3+gLsW35Q10jaHOY2h253e+syQOREIYUMhKupNFcVBLoxjWOA+ACLoEF fuwZXGf2iRrLYIIk3r2O8sdTvRv3P9inQWawcoV+8o8bPkZ0n5kJKfRX+NABqH45qzJd KOaQ== X-Gm-Message-State: APjAAAXBtR3wpIYu42Y6/QShG5vIar6aDw7JXtaxQD34Nb22pNSUPmr4 hTUbTmchDyUzRoP3biTJHLKH0v0Lkhc= X-Received: by 2002:a17:90a:37ac:: with SMTP id v41mr8199127pjb.6.1562110985234; Tue, 02 Jul 2019 16:43:05 -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.04 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 02 Jul 2019 16:43:04 -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 2/4] drm/panel: set display info in panel attach Date: Tue, 2 Jul 2019 16:42:56 -0700 Message-Id: <20190702234258.136349-3-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 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