From nobody Sun Sep 22 01:47:14 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B4CFC433EF for ; Mon, 6 Jun 2022 05:06:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229535AbiFFFG2 (ORCPT ); Mon, 6 Jun 2022 01:06:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229499AbiFFFGW (ORCPT ); Mon, 6 Jun 2022 01:06:22 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43E624991C for ; Sun, 5 Jun 2022 21:47:31 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id e9so1340492pju.5 for ; Sun, 05 Jun 2022 21:47:31 -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=8MQxz8kqIDAZ2fZ4kfRiAMdgAPZT0OSWTELIOXH4bpA=; b=bijG36Pt+M1nDEyjoGMrkaI9t4WYfcYdP+WZvFtG4qqKlRVCURyenQorZwvdwzgOV2 rgV2/0rYZAVwdMhSIzPujdPzeTd3lkGeRkbFI1yuY0dQnqMJr+1tpT4r0onWdGqgqkHa GqYdc69FSkzbyYjUAq914jSACIJVZt8JnQi1I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8MQxz8kqIDAZ2fZ4kfRiAMdgAPZT0OSWTELIOXH4bpA=; b=Akhk+zS1iYiHl8V9k0nDG8jOfGqDLHAl4djPhCrvanHgKnlymGuxS/b/ilTNvP0ZQk u1A3q/lUfg7b75rIEFxjVNjcQo82oka3Kn8nA2/CQJ/sRLDDOftIkD5ZJEHZao4w9WwN HSu9az3maYcI3ivEE+vsASErmXylMuZCMzo1rAaRKlqAmcndluo8TXveel4eiEA6sSVe JBbqDw74BecYUwP7OOM/iAa8txZrMArtt7KttIrRugYZOqgM1rwY8LxJVqZ8JqCn5TCE PQM5dxG/atgQ7IcicnFNS+9S93T+tHvjnj4K1uBO3hlTnILHQU8gJ47qlufxKG5wcYJh 6phA== X-Gm-Message-State: AOAM531vMKYgmM7deybELpqKptir23i7EuRV102TWi79lRow3utaDTxq GHp5l4XxYFxW3xOTfsCnHnlbVw== X-Google-Smtp-Source: ABdhPJyEhyggeaOMzIgoDx50rqIZ96LmNePoBj+W9JhZTpmi9YNIR5A0G9TFAJu584hNP5KsKh6jeg== X-Received: by 2002:a17:90b:38c1:b0:1e8:5df7:cfd8 with SMTP id nn1-20020a17090b38c100b001e85df7cfd8mr10240268pjb.79.1654490850677; Sun, 05 Jun 2022 21:47:30 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:ced3:b110:401b:b32c]) by smtp.gmail.com with ESMTPSA id t190-20020a6381c7000000b003db7de758besm9718609pgd.5.2022.06.05.21.47.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 21:47:30 -0700 (PDT) From: Hsin-Yi Wang To: Chun-Kuang Hu Cc: Hans de Goede , Thierry Reding , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Philipp Zabel , David Airlie , Daniel Vetter , Matthias Brugger , dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, Rob Clark , Stephen Boyd , Douglas Anderson , Rob Herring , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/8] drm/panel: Add an API drm_panel_get_orientation() to return panel orientation Date: Mon, 6 Jun 2022 12:47:13 +0800 Message-Id: <20220606044720.945964-2-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog In-Reply-To: <20220606044720.945964-1-hsinyi@chromium.org> References: <20220606044720.945964-1-hsinyi@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Panels usually call drm_connector_set_panel_orientation(), which is later than drm/kms driver calling drm_dev_register(). This leads to a WARN(). The orientation property is known earlier. For example, some panels parse the property through device tree during probe. Add an API to return the property from panel to drm/kms driver, so the drivers are able to call drm_connector_set_panel_orientation() before drm_dev_register(). Suggested-by: Hans de Goede Signed-off-by: Hsin-Yi Wang Reviewed-by: Hans de Goede Reviewed-by: Douglas Anderson --- v2->v3: no change --- drivers/gpu/drm/drm_panel.c | 8 ++++++++ include/drm/drm_panel.h | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c index f634371c717a..4a512ca80673 100644 --- a/drivers/gpu/drm/drm_panel.c +++ b/drivers/gpu/drm/drm_panel.c @@ -223,6 +223,14 @@ int drm_panel_get_modes(struct drm_panel *panel, } EXPORT_SYMBOL(drm_panel_get_modes); =20 +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *pan= el) +{ + if (panel && panel->funcs && panel->funcs->get_orientation) + return panel->funcs->get_orientation(panel); + + return DRM_MODE_PANEL_ORIENTATION_UNKNOWN; +} +EXPORT_SYMBOL(drm_panel_get_orientation); #ifdef CONFIG_OF /** * of_drm_find_panel - look up a panel using a device tree node diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index 1ba2d424a53f..d1bd3be4bbdf 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -133,6 +133,15 @@ struct drm_panel_funcs { * Allows panels to create panels-specific debugfs files. */ void (*debugfs_init)(struct drm_panel *panel, struct dentry *root); + + /** + * @get_orientation: + * + * Return the panel orientation set by device tree or EDID. + * + * This function is optional. + */ + enum drm_panel_orientation (*get_orientation)(struct drm_panel *panel); }; =20 /** @@ -195,6 +204,7 @@ int drm_panel_enable(struct drm_panel *panel); int drm_panel_disable(struct drm_panel *panel); =20 int drm_panel_get_modes(struct drm_panel *panel, struct drm_connector *con= nector); +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *pan= el); =20 #if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL) struct drm_panel *of_drm_find_panel(const struct device_node *np); --=20 2.36.1.255.ge46751e96f-goog