From patchwork Mon Jun 6 15:24:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12870537 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 25FFCCCA481 for ; Mon, 6 Jun 2022 15:26:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZXHRV+tJ8lut1Cbd7LnXrsw12UVLubJGVF8U4FvP3WQ=; b=pKGXVNzndk/Ire pGRUFADFVD50ZHBkxr/Jp3RuPF90MhBFsf2Ts5uW3xs3HJxwS9Co+t5y56lakDN+EK9E8oKIbCnVe o98wePtYEoELRVmC1kKq2UW3HkSl3FGIVJmIWdNy9AWRejvrpgvfBXJZEIRpa7Wq2IM9vgdVVmMub VZ9x184b4JSBGXESbow4dkQGCpwg9hQEXqto3SjAXcwap8rBJJDa1TdDHdAhdxa7fO1vJ6xQ15GJk eRc4WUOIuSB76PeLQSxvrLBEssZjidR9wj29TFGKhyk6RpHOWffNiEcdZNJWdyQvISOR9qO1xrC3u xHNS8s+ujP9oUdzvw2/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyEb9-001mKP-Tj; Mon, 06 Jun 2022 15:24:56 +0000 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyEax-001mCU-Tq for linux-arm-kernel@lists.infradead.org; Mon, 06 Jun 2022 15:24:45 +0000 Received: by mail-pl1-x632.google.com with SMTP id b5so12347332plx.10 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=DHd1L3hKAytxNrvDBzSzkexJITgXF55sxvaXh01pG6K5aRqbqDt6kY1JjlmbQLBRjB EDpbSo4Fb/RgOA/mpnqd2uMFrZrvKMLLr4JIOQ/bc/3qLLXe/NPHZaTpW0Js9+71cHfk 2EnIwKvwHckydVg5hOizuazBYXj0oP4wxZhhbBuLLZpKrjxHqvwTzrpnYYg26h8HuDXG enl5/NFimyVeomRx473vjUJMVwGf3fdzEjFV+0POhrKR3Fo4xCGxNErYShi1jEbtCgUL 3hI+rzOJVs35hdg6ZBh8R2P2cmx8H3GRwfjtXE//nVUdwsuWfK0DLvv/wza+rPTzwACX bv7Q== X-Gm-Message-State: AOAM530nRkCrQ5TrHY9u+Chnj4FIz7TZ6p9h+x1M2o0/gzLn9GP37C0w dHfdr8bmzsyaXhSsIwE3A2uRmg== X-Google-Smtp-Source: ABdhPJy7JvLDYfxz5F4Nt8K+TVZ3FjEYm4tRpfxZ1sLiT7du/kp/1NB5fmpP5Q6LvbYZVHw35nx5Nw== 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220606_082444_011885_4CD13EE9 X-CRM114-Status: GOOD ( 15.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 Reviewed-by: Sam Ravnborg --- 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); From patchwork Mon Jun 6 15:24:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12870538 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id D473BC43334 for ; Mon, 6 Jun 2022 15:26:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZyUYjlb8MlBz0I2roBwlxyArwgZH5aLFJQybwyciVS0=; b=TkSrCeBAtDMugo w23g3xB6AWD+njjAMV0ncdznNMgAHcXULt765gk68cGSYjZHeucHz9eD7bVnjzYOcMNO5dmBDPh2W B97yPUd2VIUkJfeeLHLX3EoBGtzw3NJC/epwVi4ZXifaoBlC45Ffs46RC7624lokzo2VM71WanG5E GpjBBLHZkxoXWiAmoAr7GGElNni5tw5OkSddTCIzN6R9c68CeVuaJxzttHtZ0LZ7/nUSHgdvYSLSJ zL8d9GmzVTwxzMTvn4mPz8+xDoD+N+EXdX/+BZtjaEMKrwaSF1RSebWZ/ExLYB7d9wDeqgyBydlcj TvDaCW1vdW1NfwANGivg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyEbN-001mTh-KD; Mon, 06 Jun 2022 15:25:09 +0000 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyEaz-001mED-3u for linux-arm-kernel@lists.infradead.org; Mon, 06 Jun 2022 15:24:46 +0000 Received: by mail-pf1-x42f.google.com with SMTP id 187so12965565pfu.9 for ; Mon, 06 Jun 2022 08:24:44 -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=/04hnBCcV0Pb71XDCLpgktf4L1f1O++fCdArJyAeL3A=; b=hvgs/sbSKFZQ23bXVpNvG2e3L5fQtSrJK3kobvZqiQL7AvZNRVYWFjhg8WgisISjVe dLXOT07VdQ2XS6nNO95Rr1zbAA7rrlxjJvM8Tr0ZpAaRqKqEtYEBCYc243PiP68vQdDC NbvC5YDPj4dIkZ7/lF1Ffu7sOaDHoluH+DNMM= 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=/04hnBCcV0Pb71XDCLpgktf4L1f1O++fCdArJyAeL3A=; b=foJNBRTHyOUkjO8jjrOwAdw9AIfyn0fdeTBYwl2/nXhwFIjmnAB8Q7vsYqaZm0LsT2 IPZLvBCNPpeBgJjivdBEalXYEB/4Dt0zDTcCSD+SXUxZf41nMrp/3bukSTuaoY3rXF5Q 4/nj/2N8LcanOmbG7J+ZYGkyn5lW68GyRsSKWXz3wJambOz0FmCGxJcdtWfFJUAVeTIk nSEXEEHZ+wPnzaHN1PMtuy+0NuzH1Pu95U5UP+MXIpMYMYJCr/YpHxpPVb5zkWU7GP+h FflCyaU/35btgYXRKm4rbkAGb/uOYV7pUM0tGMm4rUzVHUKEtVFjFBYfcbmmMHD0iLkA rYyA== X-Gm-Message-State: AOAM530VbYbCGCK4NO73q234w7Duh3VnlonWOqNH1XnpIFZ4zh6IyiSG K79jJ4/CxaU6wiHDI/IkLs1BAg== X-Google-Smtp-Source: ABdhPJzGQBTkk4Tgh5G1Gbtco9C5KKCDLaj5Jx6RMphpMPy36t68hkzaY9MJ4zflwyG376FemCJ7+g== X-Received: by 2002:a05:6a00:23ce:b0:50d:823f:981 with SMTP id g14-20020a056a0023ce00b0050d823f0981mr25132792pfc.10.1654529084342; Mon, 06 Jun 2022 08:24:44 -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.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 08:24:43 -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 2/8] drm/panel: boe-tv101wum-nl6: Implement .get_orientation callback Date: Mon, 6 Jun 2022 23:24:25 +0800 Message-Id: <20220606152431.1889185-3-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220606_082445_197580_AF3CFBB3 X-CRM114-Status: GOOD ( 13.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org To return the orientation property to drm/kms driver. Signed-off-by: Hsin-Yi Wang Reviewed-by: Hans de Goede Reviewed-by: Douglas Anderson --- drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c index 1be150ac758f..a9cd07234179 100644 --- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c +++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c @@ -1511,16 +1511,30 @@ static int boe_panel_get_modes(struct drm_panel *panel, connector->display_info.width_mm = boe->desc->size.width_mm; connector->display_info.height_mm = boe->desc->size.height_mm; connector->display_info.bpc = boe->desc->bpc; + /* + * drm drivers are expected to call drm_panel_get_orientation() to get + * panel's orientation then drm_connector_set_panel_orientation() to + * set the property before drm_dev_register(). Otherwise there will be + * a WARN_ON if orientation is set after drm is registered. + */ drm_connector_set_panel_orientation(connector, boe->orientation); return 1; } +static enum drm_panel_orientation boe_panel_get_orientation(struct drm_panel *panel) +{ + struct boe_panel *boe = to_boe_panel(panel); + + return boe->orientation; +} + static const struct drm_panel_funcs boe_panel_funcs = { .unprepare = boe_panel_unprepare, .prepare = boe_panel_prepare, .enable = boe_panel_enable, .get_modes = boe_panel_get_modes, + .get_orientation = boe_panel_get_orientation, }; static int boe_panel_add(struct boe_panel *boe) From patchwork Mon Jun 6 15:24:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12870539 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 84D3AC43334 for ; Mon, 6 Jun 2022 15:26:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bIoK9VUKaRt+sOdJIV1HDDfXcBKEq7wEMXe623E60kE=; b=gTh7/KAPJASgFX +Zq7lOcUXctFN4eKHOumy1bZQ9RaIV7pzY2Vjub6PyxefqySbqqfLxu+gD5rrWSNatVF+mLI7yrgL cIvTjzkgv6Yaz+5HmcRWLZ02v9zDWsO0TtCVI9p1IqyvtA5BMr/wOYAvBkHkG3snt+8Rw+jmN87qp a280eshWiUdjPZYgUQ7sq0m9KzS+PHfVihoCuB1RUcFx7yiQsTTKSCnLaDjTFHl5o2M5kT9bZfeL0 MurKNiCljbaKNZVaUNj1KErDa4m4GuTr6TU+vA5Tu6owzelarMALpk7Ph6HQln1KRqttZJHczgWkD 68QxfgS0cYufC6LdNKQQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyEbZ-001mZD-J0; Mon, 06 Jun 2022 15:25:21 +0000 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyEb3-001mG7-Jb for linux-arm-kernel@lists.infradead.org; Mon, 06 Jun 2022 15:24:51 +0000 Received: by mail-pl1-x631.google.com with SMTP id t2so12369146pld.4 for ; Mon, 06 Jun 2022 08:24:48 -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=NhoEcPNDHmfOm0zH51yFx0TR/S9SyI37TTBudlPfFt8=; b=bLmVV9G8nxZ0DbEYeB04GCYrVF2yXJrTwxLlXkwIBhzX21qKiBs6l8Dwx7L84vs3+B twAgdvwouWoMicxROrFcPiYDyKUdr556My/cs1kZ3Wg12HmivoQ1fmW6YwiVviprIKCC SbKLVBBE9VUMN6dWFdzXWoIC8MuBLA5+G1v8M= 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=NhoEcPNDHmfOm0zH51yFx0TR/S9SyI37TTBudlPfFt8=; b=fOxrVA7zN4KSREhQFpvbUU4S1FMq2ZQkY6CAUByV+iPHfPs7/2hUcGtFcyhmeXvD0F /OyAOmW34VeF9QkWdUjB0fB17rwOGby8SdUMUasMTHMbijU8TT9ELhAJ6/jtmzyykkDc wXqoiCM90xXY6tqAtADHO8KzK0QAb1KJQmqMQyS15LnKctvWIR1qGALN2k9rNJGUapdy za9nNYLZcXkplC7SObexxdXwPBLFLfLZhsbpOfvxNKWRQt/yMa/E/eMQN+2WWIwcx9L7 wQoeOwbiozIbYWwtKi6b7CcSZ7Szrf/rapO15U/EC/s4aOO3Pyb+QDfyQ70wjwRoBTDx +SJg== X-Gm-Message-State: AOAM5334WZsU8kTzNUOpaBto376HwGJCxpr7gpXyEIOvbZvfBHIc4JiC yUU29kcA8EA7DClTFom4TLQ+7A== X-Google-Smtp-Source: ABdhPJxPYz+Q+mHzIjxIOF/yZTOqS5+EjnzCHFxRtrzlos9dAuMVZ1mQE6TR5g/A7yPEiSYYDrsMmQ== X-Received: by 2002:a17:902:7781:b0:161:c85a:8fff with SMTP id o1-20020a170902778100b00161c85a8fffmr24699866pll.97.1654529087820; Mon, 06 Jun 2022 08:24:47 -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.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 08:24:47 -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 3/8] drm/panel: panel-edp: Implement .get_orientation callback Date: Mon, 6 Jun 2022 23:24:26 +0800 Message-Id: <20220606152431.1889185-4-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220606_082449_727443_D91B6BD6 X-CRM114-Status: GOOD ( 15.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org To return the orientation property to drm/kms driver. Signed-off-by: Hsin-Yi Wang Reviewed-by: Hans de Goede Reviewed-by: Douglas Anderson --- drivers/gpu/drm/panel/panel-edp.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c index c96014464355..c0a43bc7d24a 100644 --- a/drivers/gpu/drm/panel/panel-edp.c +++ b/drivers/gpu/drm/panel/panel-edp.c @@ -586,7 +586,12 @@ static int panel_edp_get_modes(struct drm_panel *panel, else if (!num) dev_warn(p->base.dev, "No display modes\n"); - /* set up connector's "panel orientation" property */ + /* + * drm drivers are expected to call drm_panel_get_orientation() to get + * panel's orientation then drm_connector_set_panel_orientation() to + * set the property before drm_dev_register(). Otherwise there will be + * a WARN_ON if orientation is set after drm is registered. + */ drm_connector_set_panel_orientation(connector, p->orientation); return num; @@ -609,6 +614,13 @@ static int panel_edp_get_timings(struct drm_panel *panel, return p->desc->num_timings; } +static enum drm_panel_orientation panel_edp_get_orientation(struct drm_panel *panel) +{ + struct panel_edp *p = to_panel_edp(panel); + + return p->orientation; +} + static int detected_panel_show(struct seq_file *s, void *data) { struct drm_panel *panel = s->private; @@ -637,6 +649,7 @@ static const struct drm_panel_funcs panel_edp_funcs = { .prepare = panel_edp_prepare, .enable = panel_edp_enable, .get_modes = panel_edp_get_modes, + .get_orientation = panel_edp_get_orientation, .get_timings = panel_edp_get_timings, .debugfs_init = panel_edp_debugfs_init, }; From patchwork Mon Jun 6 15:24:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12870540 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 40E73C433EF for ; Mon, 6 Jun 2022 15:27:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vi5j7VQpox6J91JLS+KTRKkmCXgzO4DyJlv7hI5iy6M=; b=U6/TxsGTLiy+Tc c8dq0fi91oR3bCbM9aQhwTjMPkEfWhTltdhH9oNqFmIj6X5yallneY6wDiGec1FYSjQwbbhORYgFX QRB2HNx3xrbPjcUd1g6dnED2LPtKj90GwmsMbxRzuWD8D++hcMSLa1baKQx487TMwIuD2XGi+v99J 1GKABHEShLcAxcG8juhjHqYZrPD1jJ173Oj12x5WfW84yxYROTgMcbO0QRCskYH8vVvDHlzOhxlEV vWZA45Y/vU9nNRQVP2s+XxN3rhJuO3yC2lj3E24hJI39TQAbBtGHBpKQtVBJKhyNW0SOKag5tfQie lA27AAfu7aHuYTn3ngdQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyEbu-001mlO-Vz; Mon, 06 Jun 2022 15:25:44 +0000 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyEb6-001mIC-1F for linux-arm-kernel@lists.infradead.org; Mon, 06 Jun 2022 15:24:53 +0000 Received: by mail-pj1-x1031.google.com with SMTP id l20-20020a17090a409400b001dd2a9d555bso12863344pjg.0 for ; Mon, 06 Jun 2022 08:24:51 -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=JUUMSUxjqpGlmr3hthDS9G4YblhtZnmP+Xt3CB0AHAw=; b=MM9wCxMHjra8vSnY99x51x6RVe62qnapf1dqn+TZ9V6KMLtMycNavxNRE0f2U7wBnO dSH0v42r3ErXXt7j22NXnI+Be3YKWIHWXNkU5iPsPIWtsk8gDOrVq68MESt0950u85Xf i4r5p4PXFFCfquE0opsQ7jduBXRim/P69Sfu4= 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=JUUMSUxjqpGlmr3hthDS9G4YblhtZnmP+Xt3CB0AHAw=; b=rPlY0iXu26WYMg1VCl5m2zdZq4frFUqRhP2pHRtFqD7+YANJHspuOOg4lnqZt9AWz3 LP3kW+NdrI29BCGlt5tR9ZJUggCaF0vqSCq0UBxz3Mr0uFg8XWMV3JTyFcHFzwmoQhJD ej0p9aDJTE+Fw9tKi4USuyt7lxBxhnkpken6pFiredomkvM4QbWfzUxAS6VlN/LPV+iR GtOIzFYe+eBpdQClgOiQ5Lqds/PbtXMu9LdnWPnsONaj1EvBoYIyhKInejCRf1WDxoLJ a9lMgIYQUyHUdslPYcvuMUffoTJcoxCBSMfbJHlTknPaXBuc4YzW+iUPCqwmngjMWrDs 8fTw== X-Gm-Message-State: AOAM53006I3p3/KfvgGhYF+TWi/Z0C5Zg3hiO5hAwRnzqQmGia8gDV3u cwIfS9HQLrdy6+r78XxtC4PnKA== X-Google-Smtp-Source: ABdhPJyfS7sG1ItRoGo2m20r8vhB47EXPGK0Qy9fOfm5yN9s8qx5qB50fptn8+CQbBgByjupLlzaxQ== X-Received: by 2002:a17:902:e889:b0:167:523c:6011 with SMTP id w9-20020a170902e88900b00167523c6011mr15889647plg.114.1654529091208; Mon, 06 Jun 2022 08:24:51 -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.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 08:24:50 -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 4/8] drm/panel: lvds: Implement .get_orientation callback Date: Mon, 6 Jun 2022 23:24:27 +0800 Message-Id: <20220606152431.1889185-5-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220606_082452_140239_7965A342 X-CRM114-Status: GOOD ( 13.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org To return the orientation property to drm/kms driver. Signed-off-by: Hsin-Yi Wang Reviewed-by: Hans de Goede Reviewed-by: Douglas Anderson --- v3->v4: rebase to latest linux-next to solve conflict. --- drivers/gpu/drm/panel/panel-lvds.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c index f11252fb00fe..491b64c2c8d6 100644 --- a/drivers/gpu/drm/panel/panel-lvds.c +++ b/drivers/gpu/drm/panel/panel-lvds.c @@ -99,15 +99,30 @@ static int panel_lvds_get_modes(struct drm_panel *panel, drm_display_info_set_bus_formats(&connector->display_info, &lvds->bus_format, 1); connector->display_info.bus_flags = lvds->bus_flags; + + /* + * drm drivers are expected to call drm_panel_get_orientation() to get + * panel's orientation then drm_connector_set_panel_orientation() to + * set the property before drm_dev_register(). Otherwise there will be + * a WARN_ON if orientation is set after drm is registered. + */ drm_connector_set_panel_orientation(connector, lvds->orientation); return 1; } +static enum drm_panel_orientation panel_lvds_get_orientation,(struct drm_panel *panel) +{ + struct panel_lvds *lvds = to_panel_lvds(panel); + + return lvds->orientation; +} + static const struct drm_panel_funcs panel_lvds_funcs = { .unprepare = panel_lvds_unprepare, .prepare = panel_lvds_prepare, .get_modes = panel_lvds_get_modes, + .get_orientation = panel_lvds_get_orientation, }; static int panel_lvds_parse_dt(struct panel_lvds *lvds) From patchwork Mon Jun 6 15:24:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12870541 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 32005C43334 for ; Mon, 6 Jun 2022 15:27:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nt1h09FCvpC/3n+T+txVsMXlIDQlQpxDKIxZ+Sny2I0=; b=hn3JIXp0UTjUgj /ukShXuGfqyXgXrMuMBGZWMPD6UBfWRzaxhBqZZ8+MmPv1jOZf7h2yoTVCmHxBXRoBZonBMidcVrw rriNuTOn9vhzKVeCMXxF70JNibA0YJoI4kPL0gR95khv/nma8eNUrAV680Z/c1wk58dXiB6Hnr/3e 2/SlpHbLDcpQc+As4xOT1TnK5k+kOeK6nmbagNtYDUlEPu3FGLUX6b4C5Jpy2VJF1uflY2zQlXiCG +UjXk0Fsr/Y23THuFZdOieMl29AuPHV1fXda9fM8xxRtdSMQvOH0/GiV7PPBgszQZdHL3n2Lsf3sp nLQNkf63KpKiKEa8Xcuw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyEce-001nKi-2q; Mon, 06 Jun 2022 15:26:29 +0000 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyEbB-001mKB-17 for linux-arm-kernel@lists.infradead.org; Mon, 06 Jun 2022 15:24:58 +0000 Received: by mail-pl1-x62a.google.com with SMTP id n8so12387958plh.1 for ; Mon, 06 Jun 2022 08:24:55 -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=a1lnjY8i/+WS666XDlnuCv9IyvqUonnUraywvJyMjlI=; b=Yg7NCIfTyeYWU95xPrJ7gstR8zKeMvxvOcu6rI98w5bCid2+Yxt48QhFQi3SGE0wBW eV+CFEsv3wJ7eJHTzBRHd8LxWfOnVWesx12yf+tMymjIcOzkVwUTHC0xtQQnDerV8Sry YMcSV4DVWPXO4rBZt5BDf6zsZlk09roWCNyRk= 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=a1lnjY8i/+WS666XDlnuCv9IyvqUonnUraywvJyMjlI=; b=nyg2ejl+umrFov+MzF5OAGFljSIf4g8PoVV1wGYg2OmRHFXjb8rwFxucf8Y/czqPyA vtVI8mI9RWf27SWtJSLIS/2MFIoexp7ZmsHnOaUPvTsSl7SjbFIdM554yruMvudjmqVt GQnFUIy9b5C6Pc4MHy87cuHsnJg2Cv6Cm/lZCJC8VztVdXqtCokyjQO3qZVfhYxvqQAN IbhC+wP9+k0X37wz06+E57RS04fLclODAhsC0HxvzVWZKPVoHnAdnhaBeCd0XmAYaQJX f7FZJ7PQqcidzPjyIEXmp1G1vbp816pYIc2cj2d6FIaIet3wRA/6BbcOCBzhe+r/Rzmh PkwA== X-Gm-Message-State: AOAM530nsc+7kUS0gY74Yd5MA94h9LQaXnNzD+8uukdRMOi0Kz11aJ3Z cTwtA1Y4D3Aqu7mF0HHTn7aF6Q== X-Google-Smtp-Source: ABdhPJywwp7pRhhliSH9owLMvrc3WOxzZZGXiapJ20kmflDYyQShHfCrO6yi2UNKEJawzzwv33KgGQ== X-Received: by 2002:a17:902:b581:b0:161:5f37:6688 with SMTP id a1-20020a170902b58100b001615f376688mr24315575pls.145.1654529094611; Mon, 06 Jun 2022 08:24:54 -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.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 08:24:54 -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 5/8] drm/panel: panel-simple: Implement .get_orientation callback Date: Mon, 6 Jun 2022 23:24:28 +0800 Message-Id: <20220606152431.1889185-6-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220606_082457_120076_D312543B X-CRM114-Status: GOOD ( 15.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org To return the orientation property to drm/kms driver. Signed-off-by: Hsin-Yi Wang Reviewed-by: Hans de Goede Reviewed-by: Douglas Anderson Reviewed-by: Sam Ravnborg --- drivers/gpu/drm/panel/panel-simple.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index 4a2e580a2f7b..f232b8cf4075 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -411,7 +411,12 @@ static int panel_simple_get_modes(struct drm_panel *panel, /* add hard-coded panel modes */ num += panel_simple_get_non_edid_modes(p, connector); - /* set up connector's "panel orientation" property */ + /* + * drm drivers are expected to call drm_panel_get_orientation() to get + * panel's orientation then drm_connector_set_panel_orientation() to + * set the property before drm_dev_register(). Otherwise there will be + * a WARN_ON if orientation is set after drm is registered. + */ drm_connector_set_panel_orientation(connector, p->orientation); return num; @@ -434,6 +439,14 @@ static int panel_simple_get_timings(struct drm_panel *panel, return p->desc->num_timings; } +static enum drm_panel_orientation panel_simple_get_orientation(struct drm_panel *panel) +{ + struct panel_simple *p = to_panel_simple(panel); + + return p->orientation; +} + + static const struct drm_panel_funcs panel_simple_funcs = { .disable = panel_simple_disable, .unprepare = panel_simple_unprepare, @@ -441,6 +454,7 @@ static const struct drm_panel_funcs panel_simple_funcs = { .enable = panel_simple_enable, .get_modes = panel_simple_get_modes, .get_timings = panel_simple_get_timings, + .get_orientation = panel_simple_get_orientation, }; static struct panel_desc panel_dpi; From patchwork Mon Jun 6 15:24:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12870581 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id A27F8C433EF for ; Mon, 6 Jun 2022 15:28:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CybPiFXUfeMTGb2gXEiIh9ZgUpwN4glM3L25u1aATpg=; b=jgAG0qdPjhUyS0 AneINiMKz3SniANwV5lHBIrfFyIDLQdDV6YXwM1eVuR9gEOP779+2SiYmDSj0S6TFBC23LLdJtFOr 5ye3Em0yecVCE1O0+5zJkBhOGU36/ZmOsz04yUpSYtLVeqT9IyaGQTAUlHNa92zRVUKaC1dVIQPzS nWn2Bc3MEbE2vMBTQBHdsJ9QU7cWdwuGJ4sQ+VvfNuu2Izo4j0sAzH7ImJfN8pTE0mjuFutqPk168 y9V5j13O7lN1hCMXLEUl1eqYhpxBqxP6xb+LlKGRSp/+lAaZVWCkwrP5hOzbVxm4/DgMvr067QOc3 UVCso95Aw2iSNXzKWfnw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyEdD-001ncF-Mf; Mon, 06 Jun 2022 15:27:04 +0000 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyEbE-001mMv-22 for linux-arm-kernel@lists.infradead.org; Mon, 06 Jun 2022 15:25:01 +0000 Received: by mail-pj1-x1033.google.com with SMTP id k5-20020a17090a404500b001e8875e6242so2075533pjg.5 for ; Mon, 06 Jun 2022 08:24:58 -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=YL/lrHRCDaMsktsmCvu5YRB9LM1inDC2pOHgWJCndXw=; b=D1Z5KQS2HSLEvMtB2j3LAhR5NcmnjnaRakAOctNY/fTtjy6NJh9M/naWqqKJFMw1aD ftJxyHyWX2BaMF+GgrZvKktG7a0W4ygHBP4JLSRdjeUYzuH55ulRLZwJWhNBOqXdleCC u4gEGUizOSUZZfXcgjF2AXmGtp2hBT5JWMOXA= 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=YL/lrHRCDaMsktsmCvu5YRB9LM1inDC2pOHgWJCndXw=; b=hr5mObG3/AQ3li/jgIzlhK5sr0r81Qas7f8H4qt4IvRdYDqq313vdgpOBdHgFPiXbY Q24InV678p/fluuP/ugOv5Bhs4CNcTmgmGNjlwBRCrtLQwH4Vuil/VFPGzv8afTr6FoN AE3zKMfmIyssarpfQyD/lvE8M/E9z9X07AlEu58QrvnzBGEkvOEkj43TEkSxygzrFWo2 5fd229zYpQ4UhovK99pq9wxyPoNtap3HgpRs1VbJDKYMQGEfpv4xQTyozJa2aiiFcEbh JBGoF8IrQKk2t7wrac6DmrCzm43QbqVJzakPe6+iYmttsgO4oWmsWXbicE6datNtzxRa ZJnw== X-Gm-Message-State: AOAM533iVju0AK04fbFxFIKUwaxm/eUtVAUIz7SyrTlaQgIVEsHOTMXE viyFP9VEU44Ulvqtky9bVGtj3w== X-Google-Smtp-Source: ABdhPJxjbZpEemJMQlqSYXCJpgXeUA7eJzzobDUSHMTnQ1O4rJ9DQ16x3dGz7G127Y3Adt9gtA60bQ== X-Received: by 2002:a17:90a:930b:b0:1d5:684b:8e13 with SMTP id p11-20020a17090a930b00b001d5684b8e13mr27078340pjo.153.1654529098014; Mon, 06 Jun 2022 08:24:58 -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.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 08:24:57 -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 6/8] drm/panel: ili9881c: Implement .get_orientation callback Date: Mon, 6 Jun 2022 23:24:29 +0800 Message-Id: <20220606152431.1889185-7-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220606_082500_156897_DD45D188 X-CRM114-Status: GOOD ( 13.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org To return the orientation property to drm/kms driver. Signed-off-by: Hsin-Yi Wang Reviewed-by: Hans de Goede Reviewed-by: Douglas Anderson --- drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c index ba30d11547ad..c098a0ed6be7 100644 --- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c @@ -853,17 +853,31 @@ static int ili9881c_get_modes(struct drm_panel *panel, connector->display_info.width_mm = mode->width_mm; connector->display_info.height_mm = mode->height_mm; + /* + * drm drivers are expected to call drm_panel_get_orientation() to get + * panel's orientation then drm_connector_set_panel_orientation() to + * set the property before drm_dev_register(). Otherwise there will be + * a WARN_ON if orientation is set after drm is registered. + */ drm_connector_set_panel_orientation(connector, ctx->orientation); return 1; } +static enum drm_panel_orientation ili9881c_get_orientation(struct drm_panel *panel) +{ + struct ili9881c *ctx = panel_to_ili9881c(panel); + + return ctx->orientation; +} + static const struct drm_panel_funcs ili9881c_funcs = { .prepare = ili9881c_prepare, .unprepare = ili9881c_unprepare, .enable = ili9881c_enable, .disable = ili9881c_disable, .get_modes = ili9881c_get_modes, + .get_orientation = ili9881c_get_orientation, }; static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi) From patchwork Mon Jun 6 15:24:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12870582 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 9659BC433EF for ; Mon, 6 Jun 2022 15:28:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HFRQsu2dnmTSSKaRbj4N/DzTeHob8ONMTHyalVPMvXk=; b=0fbKtLSJwZdGt/ Tr4FQgK3PKK5j9ZO4lHLxiBfQDfzXPxJ63IThHX2A+cBGjJDR+ALJN5FbgkWhqL1x0rUAqBFCvZpB NS7ZTceVBZKOzA6LFu/3bAz5a2x9kVFzX/DJKRk2FtTs8GU9Zd+8KjRN/0LQoVMn0LUDvjWMi2q3s Iy8sPO24VXL3T65rG8cdHsHW2wVq5+R0HXVi0W+oT8qNqYrmr+OjGP0u+CMerNoZFBsLTGgfwRygY +b/kh5gY9HXqHuQQC26gDhWNcxIMXnEly4xkKbkJCayEzvbLBeuTES5ZmF9miNo1Pu/9PrOU3nPdn 3atzC57W0wNH4QveoG1A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyEdW-001nmk-31; Mon, 06 Jun 2022 15:27:22 +0000 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyEbH-001mPZ-5s for linux-arm-kernel@lists.infradead.org; Mon, 06 Jun 2022 15:25:04 +0000 Received: by mail-pg1-x532.google.com with SMTP id g186so4286830pgc.1 for ; Mon, 06 Jun 2022 08:25:01 -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=pK8Pia3oWcO6LvRo8JULHgdKZyhIvY64SIstYz7E0T8=; b=j8KrEYwzpTl5wHCO3UxGm1TqLbk/MMUjBXH7zs5T2HtQD/NymmchMMT2FhwajxbvDA /NGiGjbOKNhODqs6sZLzSOIu7dkS7XzlyhcmJNGvmaouF1zHr6tpgxhRc544Z15q2oF9 L+qG4WbV8zWJL+HU6jxVCj6uINhkvLcAgNEFI= 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=pK8Pia3oWcO6LvRo8JULHgdKZyhIvY64SIstYz7E0T8=; b=eVIljvSXJdOyL0ksolbFENj06fqfYBfEdZgCrvYv41J/yaCVVZZscjIdaZBjigJUfq UeCk738ku/Z1FES82QENb8wNtEg89cdeH6JDVzqeIGY29TYOilwVNQGtayojgnEIwO8A 06jZ2j57pQwj6oq+3kTwsLDTQsnf5vbsIFZRLvhxdstQOti7WwFiUOJbJ/FthcUgG9ui kTJkd5vRvhY6zI8CVTSiNhhuQoUacvgax9lAmdPubG+q0uZFyDRSRgUSZD4+V0b/Lro6 3vuFSGkzbFRkzpHoPcFzPPicKmNrLAGqNImBK4poAcKB2imuU6HvGXdCCZ8rtsytJ7Zu pCFA== X-Gm-Message-State: AOAM533oE1X2LATyD2QXs7QWJjQLxlPVivBcwHnNpbeUz3MMMYsBL0M+ /LwEj5ZiO85wDBBG6HMrKLYK9A== X-Google-Smtp-Source: ABdhPJze2xpVhRS2YvADrwZ5t2z07QcQ7pjO+EuDJqVX6Oxw8Uzy747DsOh3B4OxKDgctHwtGwZUxg== X-Received: by 2002:a05:6a00:338e:b0:51b:c452:4210 with SMTP id cm14-20020a056a00338e00b0051bc4524210mr24166501pfb.69.1654529101396; Mon, 06 Jun 2022 08:25:01 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 08:25:01 -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 7/8] drm/panel: elida-kd35t133: Implement .get_orientation callback Date: Mon, 6 Jun 2022 23:24:30 +0800 Message-Id: <20220606152431.1889185-8-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220606_082503_254152_9936135A X-CRM114-Status: GOOD ( 13.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org To return the orientation property to drm/kms driver. Signed-off-by: Hsin-Yi Wang Reviewed-by: Hans de Goede Reviewed-by: Douglas Anderson --- drivers/gpu/drm/panel/panel-elida-kd35t133.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c b/drivers/gpu/drm/panel/panel-elida-kd35t133.c index 80227617a4d6..fa85a288afdc 100644 --- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c +++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c @@ -217,15 +217,29 @@ static int kd35t133_get_modes(struct drm_panel *panel, connector->display_info.width_mm = mode->width_mm; connector->display_info.height_mm = mode->height_mm; drm_mode_probed_add(connector, mode); + /* + * drm drivers are expected to call drm_panel_get_orientation() to get + * panel's orientation then drm_connector_set_panel_orientation() to + * set the property before drm_dev_register(). Otherwise there will be + * a WARN_ON if orientation is set after drm is registered. + */ drm_connector_set_panel_orientation(connector, ctx->orientation); return 1; } +static enum drm_panel_orientation kd35t133_get_orientation(struct drm_panel *panel) +{ + struct kd35t133 *ctx = panel_to_kd35t133(panel); + + return ctx->orientation; +} + static const struct drm_panel_funcs kd35t133_funcs = { .unprepare = kd35t133_unprepare, .prepare = kd35t133_prepare, .get_modes = kd35t133_get_modes, + .get_orientation = kd35t133_get_orientation, }; static int kd35t133_probe(struct mipi_dsi_device *dsi) From patchwork Mon Jun 6 15:24:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12870583 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id A835FC43334 for ; Mon, 6 Jun 2022 15:29:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=M3HSTsf7uO/Jn7ofZtqiB3fo5f6MMm689bPDZWz7eKg=; b=HTTJ6z1paXaKus 0q3gdhP4w6QPROue7gK38C+FTyv4DzUUK60gWJAq1U1HoYcDlYrrgu8f+mTGpbWl8CvfZ7/y+L6+l HkUNOpHQ62nX+4p6oEyGzDyHSfQL7Abtl1XYmVpJsrdzbc3SzZrRclLc5t7MSsxzbRsy9ADQiokAb V7Fm2htKCQxXOQFvbnmxZR3Vs/xH9Znp8t0L56VV+/dkXH/+N9+n63JYJfgjRzJWR0LdcBgLdztbL HcNCO0TKNX0N0+3nPKm9ynMdOfVn2MRaXs86HT9nWYAJ5znkNJveQcdm40HFXBRLV+pAogKl2eVWk MJJHWxWBambLYjmJCZSA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyEe4-001o1i-EG; Mon, 06 Jun 2022 15:27:56 +0000 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyEbN-001mS6-9w for linux-arm-kernel@lists.infradead.org; Mon, 06 Jun 2022 15:25:10 +0000 Received: by mail-pf1-x42b.google.com with SMTP id j6so12937537pfe.13 for ; Mon, 06 Jun 2022 08:25:05 -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=i0tXsXMGjaecgqX3jWpPhbYuXc4NjomTM5fJCVscSk0=; b=a/ZhaRa9zo0Z+8UTqr4oxABM0QmsWfKwzfWfEdvvhnN7Kt79x0XsK9jl0J5IM9yQgp b7jru9uewrcIzSerXlyuYqTRy1pNQeDmmpu5FQRcXa3YM8E55k+kbzDJQHWPunqxd7vA uWSj9XuO4JXDZUEQ94DhrV+B3k8FRVN8nJIUk= 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=i0tXsXMGjaecgqX3jWpPhbYuXc4NjomTM5fJCVscSk0=; b=ITtpOmhCG7j1fTpkemTYYnH1gomy3gKLnroelWZCu6T0s/qvgMvJM6+Wm45CSZric1 xq9kF1QptZhBV3erYsR9h+1WToQFQIvbpTHQNk2Zz4by23jSRo9KISUqGSB7YpqMcRpE peANJpBrrcQnOhbriIzrGFLAVU72mqSd5Hi7slxtamCPytKbylnwiEjV96B/pnOYF+p4 DCgY19uawEsiki4VYGpBqMdCcqx5yjAfGIFe7ck/IUs5uKn5MphEUnoEjGXIEcHR8u0t a9QTszJmqqcmajk1JQ06IIqQP0PDo1NGrNGGBolCUPWFus9iJPn6XiBvWbW10MM7jVqM Tf4g== X-Gm-Message-State: AOAM532zdQJ5VdQBVGeWfrgooSkv+W+OjjiOj2I6bRLyzRdxKFTBuu6q 29JEjmGL5n2UIRgQZhe8vEosnA== X-Google-Smtp-Source: ABdhPJwqPPpmDUkcXjmB6V/bMm8g+iVPCzngOYGUAR97PXSflEMdb1TJJvgiKirHO/VjPQebLdJxnw== X-Received: by 2002:a62:d101:0:b0:51b:eed5:8c91 with SMTP id z1-20020a62d101000000b0051beed58c91mr14876270pfg.32.1654529104777; Mon, 06 Jun 2022 08:25:04 -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.25.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 08:25:04 -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 8/8] drm/mediatek: Config orientation property if panel provides it Date: Mon, 6 Jun 2022 23:24:31 +0800 Message-Id: <20220606152431.1889185-9-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220606_082509_354231_44FF7F89 X-CRM114-Status: GOOD ( 18.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Panel orientation property should be set before drm_dev_register(). Mediatek drm driver calls drm_dev_register() in .bind(). However, most panels sets orientation property relatively late, mostly in .get_modes() callback, since this is when they are able to get the connector and binds the orientation property to it, though the value should be known when the panel is probed. Let the drm driver check if the remote end point is a panel and if it contains the orientation property. If it does, set it before drm_dev_register() is called. Signed-off-by: Hsin-Yi Wang Reviewed-by: Hans de Goede Reviewed-by: AngeloGioacchino Del Regno --- drivers/gpu/drm/mediatek/mtk_dsi.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c index d9f10a33e6fa..c56282412bfa 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -185,6 +185,7 @@ struct mtk_dsi { struct drm_encoder encoder; struct drm_bridge bridge; struct drm_bridge *next_bridge; + struct drm_panel *panel; struct drm_connector *connector; struct phy *phy; @@ -822,6 +823,12 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi) ret = PTR_ERR(dsi->connector); goto err_cleanup_encoder; } + + /* Read panel orientation */ + if (dsi->panel) + drm_connector_set_panel_orientation(dsi->connector, + drm_panel_get_orientation(dsi->panel)); + drm_connector_attach_encoder(dsi->connector, &dsi->encoder); return 0; @@ -837,6 +844,9 @@ static int mtk_dsi_bind(struct device *dev, struct device *master, void *data) struct drm_device *drm = data; struct mtk_dsi *dsi = dev_get_drvdata(dev); + /* Get panel if existed */ + drm_of_find_panel_or_bridge(dev->of_node, 0, 0, &dsi->panel, NULL); + ret = mtk_dsi_encoder_init(drm, dsi); if (ret) return ret;