Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp134807iof; Sun, 5 Jun 2022 23:24:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzaJld29xgqlIY3HRwvkEGzWmTfR8TRPvhLvBpdb1SI8K6mHLNuHVcLHR/+8ZW34+Umb9M X-Received: by 2002:a17:90a:7e02:b0:1e0:a6a7:6eb with SMTP id i2-20020a17090a7e0200b001e0a6a706ebmr24723283pjl.203.1654496657193; Sun, 05 Jun 2022 23:24:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654496657; cv=none; d=google.com; s=arc-20160816; b=FW54UM31geFxMYOAcxQoqPd5fiu4sCa2f1qoV4GU0OaLDPfEb0AlhvXsk2nvoMWLjV 1B3241tS2J/33F9twvkyxK52xJ/FEuBZTi+5zhs0XUy7H5r4F19DIXmYKfR2fVGtrVcU mwlVoybCzkqvheA3zbsHLpYizx1jEz5SVJIgp96p+ZIS9KaINolGYV4qTSnozUFZJtQT QPZH67UGlCF4M2KynAuI2xGqLwU4qyLV9VXLlsoXMWJefk2zqu2IhlMXeMGDiJYDodPw OavvMPmJc9WfF5e1Iihihwaw6tKL8PYiEWf1U7iuU9GA432vPKIeME173LRQ5Tgg/HB/ V9Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8MQxz8kqIDAZ2fZ4kfRiAMdgAPZT0OSWTELIOXH4bpA=; b=cbBUWMJR/2YTJeEbw8P6dmfZTb61SFdrHn/gvL7h/GFGk4VBQlIiSo1yRe9o7XZ34p g50BP4SLT65GdIjtCHmn4tcJg3yZBjIquxhEytimBCmGpzeUBFXk41rHVpVgRWw6yJml UKsacRePKGE22WShgD2V1Fps7o2Z1IkeQyY7Vdlmw82L9naD3ZYSTQETdYTq5i9R/ix4 leFadn72/FDDOlm+DdJKa5PMdupljZDGA0pBPHjH+H9d9ZS7517Pu1gacf427eH6R9nD YAqH0pmN+Wf0OARIJNDbbcSHIfR3wK0CaXhCouCiXvtM804M7fewxvIRxsoKv7062SjY KmDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=bijG36Pt; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id lp8-20020a17090b4a8800b001e073312c32si12991153pjb.8.2022.06.05.23.24.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 23:24:17 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=bijG36Pt; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0DC2313569B; Sun, 5 Jun 2022 22:07:04 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229520AbiFFFG1 (ORCPT + 99 others); Mon, 6 Jun 2022 01:06:27 -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-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: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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); +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel) +{ + 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); }; /** @@ -195,6 +204,7 @@ int drm_panel_enable(struct drm_panel *panel); int drm_panel_disable(struct drm_panel *panel); int drm_panel_get_modes(struct drm_panel *panel, struct drm_connector *connector); +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel); #if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL) struct drm_panel *of_drm_find_panel(const struct device_node *np); -- 2.36.1.255.ge46751e96f-goog