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: 11161681 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 E7F00912 for ; Wed, 25 Sep 2019 22:59:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 C5F2520673 for ; Wed, 25 Sep 2019 22:59:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="iDeCAM3Q"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="nTzCAE+G" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C5F2520673 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AWJ0wAbJXFlOPlmwoKSuvJNKhakXv0vQp7XOGGpgpHA=; b=iDeCAM3QEaUR1v zdISN9+cJgEwZRMhCAK+PMyBfsYu5HGKRa+I2Y5erYFkKRatcP2omzoP8ArughUHjgappxYzvFRKY r5UNMJnjOD5ddJwMGM8Lxs8rtP1PIAf0o1ZrjqG5U6H7vxnrGpGrFYCZOK8Y97CT79aVWXftlh8LS sboPije95ibZjcbHMwYW12b4T9a7nR/Rg1yoHPrvgd0NP+aWvIZr9mdNfj0yCPWiBgq1NYlW+DBYK HW8Z+kCYwe42S/wkyrJquV2OgQn6e8yUL2sGyx11JTueWDEijpk98pk3Dnjeq9/RnLBSUxP+nheV0 1+vschRp1sdhuG6ovBvw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iDGFz-0003hW-NT; Wed, 25 Sep 2019 22:59:35 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iDGF8-0002oa-Lc for linux-mediatek@lists.infradead.org; Wed, 25 Sep 2019 22:58:45 +0000 Received: by mail-pg1-x542.google.com with SMTP id t14so215028pgs.3 for ; Wed, 25 Sep 2019 15:58:42 -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=e54uTjhrMjS+i3uZjyZOFqJvo1DiLqu+QVKk06QE/rE=; b=nTzCAE+GktkwHSreEF1W8BpnrqcEc/f/Sl9mRlJjDNjgJF8kMD+xID7r4VV4G3yX9w GZ1hgcf0hxBU7Opu+Kn3+gQYzHMijRDwGJP1xFu3Ki5JQhoF5qFt/RieM3KgHQxrdnk3 Fkny4XUwI2dYgIVZ5jYPO407R700wwxt6I91Y= 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=tbVFCoDnt/Uuqnx1pcsZ2opfiK/u1id6oAPJWPNKhuzQb7Jttvze9Ls5i5SRSsbyAa Jz6Jsh1+o2GSxMga9F+emE2m7s3/sktocLVmPnJ+p5ShBFVECl/XUOt5+5KpICscQt0S lW6rGBsuYFmXQzb41xYmuyVcamywu69D16LJqfP7Y/wnbF8pgjPNojKurLJTLaWwtavx EKBIKNRWNx7tS+dQQp105b43u1AW2u60EnykB1oUv2GJzKajcRSrVuDwbAJ/TWuIV+Tu PtMvaHd+LzHohlvSVZU0SXuwG70GjEgzQ8yVZkK5FiBxdgmwm/6TvM4mNmCfRLDxMETy I9RQ== X-Gm-Message-State: APjAAAVLvUV+5tM0Gm0VVZkQG1vCi0lpiPNmOa/XmK0GFW7XzJ8jDfsA e1RT/uX4rlEEvdGrwslnw2A4AQ== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190925_155842_730219_ACA545CF X-CRM114-Status: GOOD ( 12.62 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:542 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Derek Basehore , Philipp Zabel , Maxime Ripard , Sam Ravnborg , intel-gfx@lists.freedesktop.org, Joonas Lahtinen , Maarten Lankhorst , Jani Nikula , David Airlie , Thierry Reding , Matthias Brugger , dri-devel@lists.freedesktop.org, Daniel Vetter , Rodrigo Vivi , CK Hu , linux-mediatek@lists.infradead.org, Sean Paul , linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.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 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: *