From patchwork Wed Sep 25 22:58:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Basehore X-Patchwork-Id: 11161909 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 84C8C912 for ; Thu, 26 Sep 2019 07:42:41 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6CD692146E for ; Thu, 26 Sep 2019 07:42:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6CD692146E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 16A986EE11; Thu, 26 Sep 2019 07:42:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id 784346ED65 for ; Wed, 25 Sep 2019 22:58:42 +0000 (UTC) Received: by mail-pg1-x544.google.com with SMTP id s1so192232pgv.8 for ; Wed, 25 Sep 2019 15:58:42 -0700 (PDT) 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=e54uTjhrMjS+i3uZjyZOFqJvo1DiLqu+QVKk06QE/rE=; b=s20mNLyk46eaP759RIwL9Hf5y6X2XpnVtfaAYR2S/kATX2YTWxpWKIqtLmL7hFzn04 OBY19rw8yDLM55mdzE8XLozLMnrdCx7Ra0LVyJ1r1ChrYnOkqsM4N11rwxy/7Oi+l8N5 rqj2uWYF2sljZ2hovk3PwSh3Q6LQDhvLlSXf5mqOfSDO0sOlAt02Qe6nEUsHG4wblP5p Kobrn0zONciSpjinQd77dOlPbzQxlKEiKmlmZ2Kw1cEii6H+ij4SQSPUBtti40W/VzDK 1v8u7UrzYWTqoDZUUsYrucLEWskAse6Ta2JgNTnTrJdEc/GcstdaobWMrC54kZC2s2el JkhQ== X-Gm-Message-State: APjAAAWFqLkobaDN/wNLV+DIoEU2YM5leS8GsV6LY9A+/BtD97uHtzin 8179gEA9CbthfDyD4SPDdg+gUQ== X-Google-Smtp-Source: APXvYqzK4P5iXr9jOF6+1L25eEXxPfuNyjSJPKhfdFr3rhdXJaKzGU5D+7A3nxPWuxjmqSRQYiqNoA== X-Received: by 2002:a63:c203:: with SMTP id b3mr283133pgd.450.1569452321998; Wed, 25 Sep 2019 15:58:41 -0700 (PDT) Received: from exogeni.mtv.corp.google.com ([2620:15c:202:1:5be8:f2a6:fd7b:7459]) by smtp.gmail.com with ESMTPSA id j24sm76185pff.71.2019.09.25.15.58.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Sep 2019 15:58:41 -0700 (PDT) From: Derek Basehore To: linux-kernel@vger.kernel.org Subject: [PATCH v8 2/4] drm/panel: set display info in panel attach Date: Wed, 25 Sep 2019 15:58:31 -0700 Message-Id: <20190925225833.7310-3-dbasehore@chromium.org> X-Mailer: git-send-email 2.23.0.351.gc4317032e6-goog In-Reply-To: <20190925225833.7310-1-dbasehore@chromium.org> References: <20190925225833.7310-1-dbasehore@chromium.org> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 26 Sep 2019 07:42:05 +0000 X-Mailman-Original-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=e54uTjhrMjS+i3uZjyZOFqJvo1DiLqu+QVKk06QE/rE=; b=nTzCAE+GktkwHSreEF1W8BpnrqcEc/f/Sl9mRlJjDNjgJF8kMD+xID7r4VV4G3yX9w GZ1hgcf0hxBU7Opu+Kn3+gQYzHMijRDwGJP1xFu3Ki5JQhoF5qFt/RieM3KgHQxrdnk3 Fkny4XUwI2dYgIVZ5jYPO407R700wwxt6I91Y= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Derek Basehore , Maxime Ripard , Sam Ravnborg , intel-gfx@lists.freedesktop.org, David Airlie , Thierry Reding , Matthias Brugger , dri-devel@lists.freedesktop.org, Rodrigo Vivi , linux-mediatek@lists.infradead.org, Sean Paul , linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 Reviewed-by: Sam Ravnborg --- drivers/gpu/drm/drm_panel.c | 28 +++++++++++++++++++++ include/drm/drm_panel.h | 50 +++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c index 0909b53b74e6..1cd2b56c9fe6 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; } @@ -126,6 +138,22 @@ EXPORT_SYMBOL(drm_panel_attach); */ void 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 d16158deacdc..f3587a54b8ac 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -141,6 +141,56 @@ struct drm_panel { */ const struct drm_panel_funcs *funcs; + /** + * @width_mm: + * + * Physical width in mm. + */ + unsigned int width_mm; + + /** + * @height_mm: + * + * Physical height in mm. + */ + unsigned int height_mm; + + /** + * @bpc: + * + * Maximum bits per color channel. Used by HDMI and DP outputs. + */ + unsigned int bpc; + + /** + * @orientation + * + * Installation orientation of the panel with respect to the chassis. + */ + int orientation; + + /** + * @bus_formats + * + * Pixel data format on the wire. + */ + const u32 *bus_formats; + + /** + * @num_bus_formats: + * + * Number of elements pointed to by @bus_formats + */ + unsigned int num_bus_formats; + + /** + * @bus_flags: + * + * Additional information (like pixel signal polarity) for the pixel + * data on the bus. + */ + u32 bus_flags; + /** * @list: *