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: 12870563 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 D6673C43334 for ; Mon, 6 Jun 2022 15:24:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EF4D21122F0; Mon, 6 Jun 2022 15:24:41 +0000 (UTC) Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 687C61122F0 for ; Mon, 6 Jun 2022 15:24:41 +0000 (UTC) Received: by mail-pl1-x62b.google.com with SMTP id f9so1912591plg.0 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=J97nnJbBTndsGqNCuM48qfH/OqktBA377lplvy0ZarqguM5YO3kOf62NPYezjpA5q4 oNYTJZcbZRatMoLmuiM8cxroifyilKcjw3hT72jrkmHJuHfgtgYrsa9ONU51zNIPYihN y29PJsJ1K3FHe43yXzbnOJcgUDgdw0wtIy+ZwTL51GXdI7g3kDTbbqrZxhxu1KSCJs5e OBT1Bj9atrKDSddNb1S+/7OB5Df/7MZLd07Ncg1BUaYQGetdOWdy4lUbVweGkrDHA303 PR3r0W3TqNd/UMq+DkPLLsax93UAiFz44Ayn5adUPqdG6dSH8UXRsQYHuKsWv8GSNJ1j 6/WQ== X-Gm-Message-State: AOAM531qFxPr5rFttncDeYp+OnD+uNEx0+tUm0ZaVS5yOC1VxXD3pTIf JSNaqvaId7clKLZ9Gx5+nDXZ/A== 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 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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Clark , Rob Herring , David Airlie , linux-kernel@vger.kernel.org, Douglas Anderson , Stephen Boyd , Hans de Goede , Thierry Reding , linux-mediatek@lists.infradead.org, dri-devel@lists.freedesktop.org, Thomas Zimmermann , Matthias Brugger , Sam Ravnborg , linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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: 12870564 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 F1400C43334 for ; Mon, 6 Jun 2022 15:24:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1AFED11230C; Mon, 6 Jun 2022 15:24:46 +0000 (UTC) Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by gabe.freedesktop.org (Postfix) with ESMTPS id CABF51122CB for ; Mon, 6 Jun 2022 15:24:44 +0000 (UTC) Received: by mail-pg1-x536.google.com with SMTP id 7so12369896pga.12 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=POH7iSu0XUAm2Sb4nausTphLWp9LuBkgRgkdXsQU9BRACqjYeadg4Nel6Z7qEwixQK g6Fqg0/GTqj0cTEN9vDBrSfcnwmY5VzrE2J3ehXKdhU7FOiMEcoVsMZXdnOJp5F4QHJj +7c9MbTUJidIith9zCY41zqfQ7ge3xXKGZQbQrFIY4RddcsEFKFzuI/gZAHyqnuGqej1 6642ODVzR/1GlNbueQUqa+DVujcMFfF7m0rR6BQlTNhCCvLD6Ye+G2YgibvseeOVBdhb hZWfROscORRtauH9wPJ9gm5G56ZCC6qJFmgjbjeLPznDFdwTpV15MRARXl9JxDR/N2lm zcEQ== X-Gm-Message-State: AOAM5306IiErNE3PB0uVZ6h7gPyCxrxeANkHN3Nt/yA5Cg4gXAM2ANHG iKs7qtRXlUaYhFXLZ2yqIt5cBtoD9COGSg== 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 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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Clark , Rob Herring , David Airlie , linux-kernel@vger.kernel.org, Douglas Anderson , Stephen Boyd , Hans de Goede , Thierry Reding , linux-mediatek@lists.infradead.org, dri-devel@lists.freedesktop.org, Thomas Zimmermann , Matthias Brugger , Sam Ravnborg , linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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: 12870565 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 10F94C43334 for ; Mon, 6 Jun 2022 15:24:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1DA0311232A; Mon, 6 Jun 2022 15:24:49 +0000 (UTC) Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5A39311232A for ; Mon, 6 Jun 2022 15:24:48 +0000 (UTC) Received: by mail-pj1-x1030.google.com with SMTP id d12-20020a17090abf8c00b001e2eb431ce4so12844836pjs.1 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=vt/CPRsOcN/BOJAgVo4iYC+Vq+pySIvxiWL2iQLDJXSm3Cpe6WdVA+GK4I8F+SG5T/ wN0uiy0QRZ+1yX067pZlOm9fXYSBktS4m90jh0kCKf/npWX6Vwt9jI/K+BZrWkNMwk33 TtoPY+OiAJMredekmGjCSIvcoGQS2PH3usIZwY7s0XB+9L3op8E9ZfTNJFL8QRI6G7TL m//0u2+D0flcK7D4+4tTXgi0SFOKtFKe3TKBRH4Qb0a52RIz2k/3JgOVCgF/NbtAyipQ nATv9jGdf3T0dwpBF4g5gDKvD8HzqVheUhADAWr985DX9MX9Ctx+xebjW1w0TzLN1lFj 5sGQ== X-Gm-Message-State: AOAM5337TOGe85zI6qMaJuVg35gxCGv+BE86s3QwE5gl8Y5BcIAUBAzR NK3IG10NRlr8iHb+zS/XxxnrNQ== 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 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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Clark , Rob Herring , David Airlie , linux-kernel@vger.kernel.org, Douglas Anderson , Stephen Boyd , Hans de Goede , Thierry Reding , linux-mediatek@lists.infradead.org, dri-devel@lists.freedesktop.org, Thomas Zimmermann , Matthias Brugger , Sam Ravnborg , linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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: 12870566 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 6AC53C433EF for ; Mon, 6 Jun 2022 15:24:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A517811232E; Mon, 6 Jun 2022 15:24:52 +0000 (UTC) Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by gabe.freedesktop.org (Postfix) with ESMTPS id AEA6D11232E for ; Mon, 6 Jun 2022 15:24:51 +0000 (UTC) Received: by mail-pl1-x62a.google.com with SMTP id b5so12347733plx.10 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=fdXVkC8UWikA/GLKfD0P2JZC6OUSzatVyn+K84j0C3oCNSIalLV20ubEbtldq9LLQC fUw7evIqfcfl5SO7GWu5ZlsNladYsYYfugwjtKD8a/C22Pxw3QcHcXqKI6HI3LoU41BS H49bRN/WAcHoT9mA0FW6ZyrlfecKdNNC/U3qPES40g/XmX/FK3dt5YokxqIWFtC+IwpC oBApKS7lWJ8F90P5ECOl4ARm78aaZ3U1SijniQ0ojCAbvHYR9OPICjWl+cP8/0Zcm2mb j3K1EPgYifwSbWI041WXiCzA8im3U4tCLSeOUyjnhlv3l5Rd8RDhsqG9G7H46rqwCA/R 7Dqg== X-Gm-Message-State: AOAM530kHmUk5uTpU6rR6i7TqQFc35P23x84RgYxASa+y1g6MYMlQBdY 6ZnnCun6nQeJ8wKaaAiIsXjs/g== 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 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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Clark , Rob Herring , David Airlie , linux-kernel@vger.kernel.org, Douglas Anderson , Stephen Boyd , Hans de Goede , Thierry Reding , linux-mediatek@lists.infradead.org, dri-devel@lists.freedesktop.org, Thomas Zimmermann , Matthias Brugger , Sam Ravnborg , linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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: 12870567 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 050F3C433EF for ; Mon, 6 Jun 2022 15:24:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3BEAD11233B; Mon, 6 Jun 2022 15:24:56 +0000 (UTC) Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0EC68112323 for ; Mon, 6 Jun 2022 15:24:55 +0000 (UTC) Received: by mail-pl1-x62b.google.com with SMTP id o6so7285959plg.2 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=H4qURcCuZ7cLpNDTseqXxRIOK2MtMUfW2e0+tcdsX2F+W5+yczkiqPTwifk6b5lrK+ FJ3VXKTycQ6t55KkMMj0XOXYEnxR07X80+wx0Rxilcrb5I0xqHyFBxKzfBmFA4yriq3F oHhT9mDVdCC7v6U/94n7IIgi6dGAMRmdcmh2GOW1wnGca/nmuRLpP1XfzXxdNQnw0gjZ AN7ZyjWAkqxWX3luj/4kiytqIHWicRmOrUtgLn3gnna3oDHIAhT4ZKbPCSAsAd9EK7Yg ybM9vxac3gDKb8+hZi099CleD8a0oYhOdb8JpHOVtYxE7drg4IkVkaTUVhPo/W0iwn6I /dGQ== X-Gm-Message-State: AOAM531kXUua4Rdd8/q/vXOYjimwm7HykAJYeCiNeVXC9YUaZ6gBePcu qCBy4VugVyXgn1xq7oPg1sNZlw== 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 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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Clark , Rob Herring , David Airlie , linux-kernel@vger.kernel.org, Douglas Anderson , Stephen Boyd , Hans de Goede , Thierry Reding , linux-mediatek@lists.infradead.org, dri-devel@lists.freedesktop.org, Thomas Zimmermann , Matthias Brugger , Sam Ravnborg , linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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: 12870568 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 981D7C433EF for ; Mon, 6 Jun 2022 15:25:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A30AC11236E; Mon, 6 Jun 2022 15:24:59 +0000 (UTC) Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7E8D611235B for ; Mon, 6 Jun 2022 15:24:58 +0000 (UTC) Received: by mail-pj1-x1034.google.com with SMTP id gc3-20020a17090b310300b001e33092c737so12824241pjb.3 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=uOP5zITZvkF3tIW3Nrcr6VtDWxJGfWRtl31kV6a2yTkzatAbVAv+1n8nVPMFZeuE0I tJCzgPI7PQ1m9qcjuZUgdJu+446J4kRZMPP17gozXLiV3Mlin4wo1gq8ItKqZbC4Bsas oLJPRQDOPr4+rJF7QyOD4/OtIY7b4hhLxM0ebVEXWqoBoHVhKXMGJ57W/mKb0RH13G8s Sq44v3BE2IdxlUhb1ptAD5lc8fgrFKZp9rBRgMbwqX0Sun6Nq9LmJzATbyJUQcwZbxG4 G1bs9DYnN5ygCuyDkUBh4CYky0gxkaW7GdG0JZvMdRAsoVNPu+p5p1LBRYWDOuUnMvAW WElg== X-Gm-Message-State: AOAM532ZhS2LKTAurIY76DHKy/M+w0mxaM2OcbaTv0LEghX+pqi4l1rm wP4cQf0IpClnvvSruMiZ2HTslSLTO7LonA== 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 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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Clark , Rob Herring , David Airlie , linux-kernel@vger.kernel.org, Douglas Anderson , Stephen Boyd , Hans de Goede , Thierry Reding , linux-mediatek@lists.infradead.org, dri-devel@lists.freedesktop.org, Thomas Zimmermann , Matthias Brugger , Sam Ravnborg , linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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: 12870569 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 8A4A8C43334 for ; Mon, 6 Jun 2022 15:25:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B507C11235B; Mon, 6 Jun 2022 15:25:02 +0000 (UTC) Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by gabe.freedesktop.org (Postfix) with ESMTPS id CB21E11235B for ; Mon, 6 Jun 2022 15:25:01 +0000 (UTC) Received: by mail-pg1-x52f.google.com with SMTP id 129so13181613pgc.2 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=dFk1TrnnrcjWij+P5yAff/8VlOap1V9S3tEN/kNP+l2HwraFHbuaaR5/Ho5ncamVOX TNwHQb/ARzNkOMxqUKwEJUWuyqxL2L7/H+UXd5hy29htWKVxogIi3HHmXqRt2hJgIjAF TokSP5oepaC5CgrV7yQtn5I11PLBKR4CKa+31mEyTAbKBHVapg9tQsFtRk6ZwuSC14Fb McmQHr8Rjk20U36W2LHvUDLQYp0fgIGKPmiArAyVTpM4mt5wWDbOmQUiOqZUO0ui1fKp aSfVa+BBchDMMz9lB/YzI40JTtnYuKTwHIgm4ligRXAalvRexIJQ5Djg7VQ7zTxu7ZEc ARkQ== X-Gm-Message-State: AOAM532YEulxnETSXl6/VY98eCz5tIVku6DNYBf8mpR2r7km6zjTEDpA 9Rb0PkPrRJqeo5MuvvRbq0rfvA== 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 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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Clark , Rob Herring , David Airlie , linux-kernel@vger.kernel.org, Douglas Anderson , Stephen Boyd , Hans de Goede , Thierry Reding , linux-mediatek@lists.infradead.org, dri-devel@lists.freedesktop.org, Thomas Zimmermann , Matthias Brugger , Sam Ravnborg , linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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: 12870570 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 4434ACCA473 for ; Mon, 6 Jun 2022 15:25:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 68807112342; Mon, 6 Jun 2022 15:25:06 +0000 (UTC) Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3434C112369 for ; Mon, 6 Jun 2022 15:25:05 +0000 (UTC) Received: by mail-pg1-x52f.google.com with SMTP id r71so13204725pgr.0 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=Wl9teteiDWlNDsxAMjReI7rkOBhG5TdrC5iLycS/qTNjR1cr9tFvGkSR9+LYoweNcu QWEeVkrl2vvuvreQez7gy2XOcv4nhd2fmEWaUFPgBdmwsJ57mxPI0SFVjUKNfVqzrGkk rC/jEj8PSyS3D3pArcV4qCbHTEsKYTDBV80Gwf9c181R0IethGw3E/M4Bu79vXaxqPxJ 7f349i89kHQcqX/qgXgS7ZFyRJike/7kb/8vLcRvjyTI1jrhBSQSZzGvZdY/FC759qth NPgidRtofYbrJVcQxwUTDKwkc1aaoFI+Xtisvvo8vRh9bcobOPzcKbR0LnDi3Ze5Fcak P2Ng== X-Gm-Message-State: AOAM531EU1zgJ/0QP7BF3hDst/M/MKviInzoHHPZ/1q3k7qlvcdX2aSC kgniSrVHcnTRLw9g77sXKVJlEg== 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 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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Clark , Rob Herring , David Airlie , linux-kernel@vger.kernel.org, Douglas Anderson , Stephen Boyd , Hans de Goede , Thierry Reding , linux-mediatek@lists.infradead.org, dri-devel@lists.freedesktop.org, Thomas Zimmermann , Matthias Brugger , Sam Ravnborg , linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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;