Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp568643iof; Mon, 6 Jun 2022 08:39:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwO2wkykuwY65O4BQrGRbbTf7cbLnzF1XmNpGL8oq4vOAhB0yKRIO4HRadUjiN5Mvd5VKSW X-Received: by 2002:a17:902:ec92:b0:166:3502:ecb1 with SMTP id x18-20020a170902ec9200b001663502ecb1mr24812311plg.62.1654529960142; Mon, 06 Jun 2022 08:39:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654529960; cv=none; d=google.com; s=arc-20160816; b=x4lIffVbsthncVhJ8taFjk3AwZLZVjGalXMcXTnDMxZjLjE0UYsuI06XAgPXIOFS5o n5OdqDLu/cPFejyu0naYK6WQE5/M3lu2H7wB/1BsF2C2pjjEsdyl6Wr2CoSnv50oLy33 f/PtfX/W0hncuTS6+VJUCqDDCDixfHeH5IqwXuJkp9LoYPynWORo2kTesRkafrthOtHH hnnHA8SgDbDB9U4V+NnD4GRYQpUT7EO5a9XDRr2uAIJQh5FM0MLn49VSxlVSfcUKlj7o n9kTOk0VbIF4S959P5LjrLWgbGspGDKb4t4bg6jEtkLsNrrFHJj/5NYdWBRF7yBqInMv c2Eg== 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=/LOT6rcj75BLu5PAhhZSBrZhENYGfSEJ9VcTy2ymZ8A=; b=sSC4Cihnppm759Lc4u837lXJlaS82onYBVYafdbkSUqrYzjFgv2xTmdJZ9bmpv694h RFOUO0N1gzdifELBvY3J38uCQ/AjmK+W88TYlNScRkJ+Pv9CRdbI+mnFK155pv3kEmq3 rvxCLbPfNvWWKAVOVs6RrrWjAMT4MMTFvuOODu9rCe86HeNAvmm11401jySPV8OkmwgR rrXOZssWYjk7d1ZTLDHANA7RdepM1KYwvL/c87Ooq72j3rn/v3bTSgc1u3/uVe5ASPnD oqBdjX/4KBzsg1Mb5il63Ctl6SlP5l99JGq6J68PJMOlpNMq4/MAGd9/Yig6ZJnLaPxY rWwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=WEtPtsSl; 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 b64-20020a633443000000b003fbf9fb1fe3si22314339pga.98.2022.06.06.08.39.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 08:39:20 -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=WEtPtsSl; 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 F0AA72CF2A0; Mon, 6 Jun 2022 08:24:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240514AbiFFPYr (ORCPT + 99 others); Mon, 6 Jun 2022 11:24:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240499AbiFFPYm (ORCPT ); Mon, 6 Jun 2022 11:24:42 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9C062BA977 for ; Mon, 6 Jun 2022 08:24:41 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id d22so12347621plr.9 for ; Mon, 06 Jun 2022 08:24:41 -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=/LOT6rcj75BLu5PAhhZSBrZhENYGfSEJ9VcTy2ymZ8A=; b=WEtPtsSlp7epK+M3w4yaaaGS/p+B2+4rpNHJeUsP9pApwkHOD6/CvyYeaubs73Yt/w oPoFAMzIMC++OPvNhqyBh/HoAvv2qP66rFYT0/uEsedGJhm18S6d890znFvx8vGNsOEa vHBGRFLbv9y2nkty8mKnNyBjq9KlWxKnFuADI= 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=/LOT6rcj75BLu5PAhhZSBrZhENYGfSEJ9VcTy2ymZ8A=; b=beNPS7d/mFL4BphJJoZJE7RSG/Cxqh6Q6dBwuqb0cgXvME+7eN7a7v7aqVW/G4i1VI EV6AmIrxVGMG05uds/tFdu6YTm1DplUZiuuE2Ejhc9VpHXacsspf4R6GCITi1A0opFSi fgGckbiJFqhKJJzYdXtOLk3CpIe7xiPuMUQY5HqrA/EFYg0VXsuDvu1xxODTgSdG54ss HcRAIaAmXurQTs4NCwvgmJBqDSXyI2D/0CYNXJy83+BA0LCboSkxX/tsw8qwQUcunGl3 x1XNX2TbRNkyHBknD8THQEgJrb0roQiuonbpgAZ+z5rAgAL2BTGG/6ljqoDQg1X1iWVI 1wKg== X-Gm-Message-State: AOAM532G042Dz9JpSp26gxCvnfvA53tOIjqTBapq36tUUhSpSU8/W9TG lfEHSePMUnbGrddOff4J3wuXhw== X-Received: by 2002:a17:902:d50b:b0:165:2aa0:4b22 with SMTP id b11-20020a170902d50b00b001652aa04b22mr24685964plg.131.1654529080928; Mon, 06 Jun 2022 08:24:40 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:a0a:5e4:e24:c8c4]) by smtp.gmail.com with ESMTPSA id h1-20020a655181000000b003fbaae74971sm10749306pgq.72.2022.06.06.08.24.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 08:24:40 -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 v4 1/8] drm/panel: Add an API drm_panel_get_orientation() to return panel orientation Date: Mon, 6 Jun 2022 23:24:24 +0800 Message-Id: <20220606152431.1889185-2-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog In-Reply-To: <20220606152431.1889185-1-hsinyi@chromium.org> References: <20220606152431.1889185-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 Reviewed-by: Douglas Anderson --- v3->v4: Add a blank line. --- drivers/gpu/drm/drm_panel.c | 9 +++++++++ include/drm/drm_panel.h | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c index f634371c717a..e12056cfeca8 100644 --- a/drivers/gpu/drm/drm_panel.c +++ b/drivers/gpu/drm/drm_panel.c @@ -223,6 +223,15 @@ 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 d279ee455f01..5dadbf3b0370 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); }; /** @@ -202,6 +211,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