From patchwork Fri Apr 9 04:53:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12193035 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 910A3C433B4 for ; Fri, 9 Apr 2021 04:53:21 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 4C84761165 for ; Fri, 9 Apr 2021 04:53:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4C84761165 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B63D86E0CB; Fri, 9 Apr 2021 04:53:20 +0000 (UTC) Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3B2126E457 for ; Fri, 9 Apr 2021 04:53:19 +0000 (UTC) Received: by mail-pj1-x102b.google.com with SMTP id cu16so283815pjb.4 for ; Thu, 08 Apr 2021 21:53:19 -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:mime-version :content-transfer-encoding; bh=U8tMg25UODn9zLUOH4J81Emc3aCsG/EQSjte3RxVFwU=; b=VOyYiA7av5Bi6O4IQeERXt8QsT+l7zDqkusCiXRR6I6d6aEWWRveSCJzo+jMpzWMYX 995UQaizcAn0Gn1/TUm1Zbpoun/QWNaS3N/MUEX8ihV9QpVgJ4tWnFL/PkYWQMetjf9y H8qMY2CgRr0JwIhO6HKkNQFHQWMMulSZkXb4M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=U8tMg25UODn9zLUOH4J81Emc3aCsG/EQSjte3RxVFwU=; b=A+IifjjOL4ttte1amOj+xb1FAYSunQYTR40ipdIeoAiDRzRYuLOvguj+HOWhQ5hcMG bmW3ybThGDQqzoCTSQn83JFtT8Mj6SH5F8dgqRm1+ANt0BoZvM3tvrfIO2sQVFqxYqAz xDnvhz3u+P2dcAEjBmyKjVBsjNMHu+84arNkaaw7ZQ8FHXlI9FjkIVTI9nzRuTD2FS0W XYjp3RkgeDAEHck9hEoS8sFar//bpTrjX/PJBUw7NG1k6aGm506hlDEcxwzg1WF6af+j qCRQoQyT8wnxtKvO1S9Aef5wiKUUBHTboJaBNWtmRnghZjGUNhllhyE2ff6ZKbPblFf9 7A8w== X-Gm-Message-State: AOAM532wMaAPNXSAv7VbkCdPf0vUdznGmHiEFEQFYcd2D6dQboPXRi9P QiMUtE/sDj2Pc7QipDgs3xXOyw== X-Google-Smtp-Source: ABdhPJyiCXafNiJ32rllXnQwLlA8TSdl0M9YXElPFDmX+now4Elzlf3lVZHWQ6cxIai9C+eZPZH4fA== X-Received: by 2002:a17:902:6f10:b029:e9:7fdf:4902 with SMTP id w16-20020a1709026f10b02900e97fdf4902mr8114984plk.41.1617943998661; Thu, 08 Apr 2021 21:53:18 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:f9f6:696:a955:72e9]) by smtp.gmail.com with ESMTPSA id p2sm900696pgm.24.2021.04.08.21.53.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Apr 2021 21:53:18 -0700 (PDT) From: Hsin-Yi Wang To: Chun-Kuang Hu , Matthias Brugger , Enric Balletbo i Serra Subject: [PATCH 1/2] drm/mediatek: set panel orientation before drm_dev_register(). Date: Fri, 9 Apr 2021 12:53:13 +0800 Message-Id: <20210409045314.3420733-1-hsinyi@chromium.org> X-Mailer: git-send-email 2.31.1.295.g9ea45b61b8-goog 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: devicetree@vger.kernel.org, David Airlie , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Rob Herring , linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" drm_dev_register() sets connector->registration_state to DRM_CONNECTOR_REGISTERED and dev->registered to true. If drm_connector_set_panel_orientation() is first called after drm_dev_register(), it will fail several checks and results in following warning. So set panel orientation in dsi before drm_dev_register() is called. [ 4.480976] ------------[ cut here ]------------ [ 4.485603] WARNING: CPU: 5 PID: 369 at drivers/gpu/drm/drm_mode_object.c:45 __drm_mode_object_add+0xb4/0xbc [ 4.609772] Call trace: [ 4.612208] __drm_mode_object_add+0xb4/0xbc [ 4.616466] drm_mode_object_add+0x20/0x2c [ 4.620552] drm_property_create+0xdc/0x174 [ 4.624723] drm_property_create_enum+0x34/0x98 [ 4.629241] drm_connector_set_panel_orientation+0x64/0xa0 [ 4.634716] boe_panel_get_modes+0x88/0xd8 [ 4.638802] drm_panel_get_modes+0x2c/0x48 [ 4.642887] panel_bridge_get_modes+0x1c/0x28 [ 4.647233] drm_bridge_connector_get_modes+0xa0/0xd4 [ 4.652273] drm_helper_probe_single_connector_modes+0x218/0x700 [ 4.658266] drm_mode_getconnector+0x1b4/0x45c [ 4.662699] drm_ioctl_kernel+0xac/0x128 [ 4.666611] drm_ioctl+0x268/0x410 [ 4.670002] drm_compat_ioctl+0xdc/0xf0 [ 4.673829] __arm64_compat_sys_ioctl+0xc8/0x100 [ 4.678436] el0_svc_common+0xf4/0x1c0 [ 4.682174] do_el0_svc_compat+0x28/0x3c [ 4.686088] el0_svc_compat+0x10/0x1c [ 4.689738] el0_sync_compat_handler+0xa8/0xcc [ 4.694171] el0_sync_compat+0x178/0x180 [ 4.698082] ---[ end trace b4f2db9d9c88610b ]--- [ 4.702721] ------------[ cut here ]------------ [ 4.707329] WARNING: CPU: 5 PID: 369 at drivers/gpu/drm/drm_mode_object.c:243 drm_object_attach_property+0x48/0xb8 [ 4.833830] Call trace: [ 4.836266] drm_object_attach_property+0x48/0xb8 [ 4.840958] drm_connector_set_panel_orientation+0x84/0xa0 [ 4.846432] boe_panel_get_modes+0x88/0xd8 [ 4.850516] drm_panel_get_modes+0x2c/0x48 [ 4.854600] panel_bridge_get_modes+0x1c/0x28 [ 4.858946] drm_bridge_connector_get_modes+0xa0/0xd4 [ 4.863984] drm_helper_probe_single_connector_modes+0x218/0x700 [ 4.869978] drm_mode_getconnector+0x1b4/0x45c [ 4.874410] drm_ioctl_kernel+0xac/0x128 [ 4.878320] drm_ioctl+0x268/0x410 [ 4.881711] drm_compat_ioctl+0xdc/0xf0 [ 4.885536] __arm64_compat_sys_ioctl+0xc8/0x100 [ 4.890142] el0_svc_common+0xf4/0x1c0 [ 4.893879] do_el0_svc_compat+0x28/0x3c [ 4.897791] el0_svc_compat+0x10/0x1c [ 4.901441] el0_sync_compat_handler+0xa8/0xcc [ 4.905873] el0_sync_compat+0x178/0x180 [ 4.909783] ---[ end trace b4f2db9d9c88610c ]--- Signed-off-by: Hsin-Yi Wang --- drivers/gpu/drm/mediatek/mtk_dsi.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c index ae403c67cbd9..45a702ee09f3 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -205,6 +205,7 @@ struct mtk_dsi { u32 irq_data; wait_queue_head_t irq_wait_queue; const struct mtk_dsi_driver_data *driver_data; + enum drm_panel_orientation orientation; }; static inline struct mtk_dsi *bridge_to_dsi(struct drm_bridge *b) @@ -966,6 +967,8 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi) } drm_connector_attach_encoder(dsi->connector, &dsi->encoder); + drm_connector_set_panel_orientation(dsi->connector, dsi->orientation); + return 0; err_cleanup_encoder: @@ -1029,6 +1032,12 @@ static int mtk_dsi_probe(struct platform_device *pdev) ret = PTR_ERR(dsi->next_bridge); goto err_unregister_host; } + + ret = of_drm_get_panel_orientation(panel->dev->of_node, &dsi->orientation); + if (ret) { + dev_err(dev, "failed to get panel orientation %d\n", ret); + return ret; + } } dsi->driver_data = of_device_get_match_data(dev); From patchwork Fri Apr 9 04:53:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12193037 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5FC0C433B4 for ; Fri, 9 Apr 2021 04:53:25 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 8498661178 for ; Fri, 9 Apr 2021 04:53:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8498661178 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7C38D6E455; Fri, 9 Apr 2021 04:53:23 +0000 (UTC) Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by gabe.freedesktop.org (Postfix) with ESMTPS id 537156E456 for ; Fri, 9 Apr 2021 04:53:21 +0000 (UTC) Received: by mail-pg1-x529.google.com with SMTP id l76so2978067pga.6 for ; Thu, 08 Apr 2021 21:53:21 -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=OS7lcaPxknITZLvovVkA4QPXgon3j/mJxiD24igJRqo=; b=h4zcLAdWfRJgihK2lfSX3Ypml2LDDqkOCQxP1jzvewO4jhVm55tUwaYfZcqvP2cxZG +p00cv2fniK5dn64pXL/DD4rWqhDqCXJA/Hy890kQH2cKfRb6uQHe8wlmXMWoHg65I/s 0ddH48c2OC/fmk1+1JQ6/j6A3800tbq4+63TA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OS7lcaPxknITZLvovVkA4QPXgon3j/mJxiD24igJRqo=; b=G3znR+3UDbak0G2vCehokIbFYB5RXZlduIzTd+2sYlNKLtmldDc14sIH/rrczHI8N6 7TLtdmeDixCyRpbt67HAdE+tIpTxjiEEIoM5ujbwdfUYfdyLQx0+8g5Y/YGa0TpKEVDn fWd9t6Vi4M1+MHhtDlEEHLvA4K4kvCsCqX9U27pikPQzOZlYyHUvaz+/a9kR3XZU5v1L XSiMwpfQLZr2AbyDrbUqdQnKCssdHhDNlwhU6HqAZ08xuG1lXROdc4S1kzgx8eDTHy5c GOyM6t0TUW+lYa+US5GiPRCJdXTu9IS8Jfp+QPLQiDJBiG2qFTpoG3spkYg/vLplYIqr V0Ow== X-Gm-Message-State: AOAM5318Jf9k9zxEFXhX1JZsP6OGYE0oCkL4FwpYX78kLltY8INxvxfs ZH3sJdSS3DEUJUtkNWCRemi6MQ== X-Google-Smtp-Source: ABdhPJwvi9n1MpPr9EbApqw4tpal6rn4nFHgDRv5qpHpDXeyET2KUNc94sSla03g7YL6LJLDGwmMDw== X-Received: by 2002:a05:6a00:1c77:b029:241:5c43:8cf5 with SMTP id s55-20020a056a001c77b02902415c438cf5mr10989642pfw.10.1617944000932; Thu, 08 Apr 2021 21:53:20 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:f9f6:696:a955:72e9]) by smtp.gmail.com with ESMTPSA id p2sm900696pgm.24.2021.04.08.21.53.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Apr 2021 21:53:20 -0700 (PDT) From: Hsin-Yi Wang To: Chun-Kuang Hu , Matthias Brugger , Enric Balletbo i Serra Subject: [PATCH 2/2] arm64: dts: mt8183: Add panel rotation Date: Fri, 9 Apr 2021 12:53:14 +0800 Message-Id: <20210409045314.3420733-2-hsinyi@chromium.org> X-Mailer: git-send-email 2.31.1.295.g9ea45b61b8-goog In-Reply-To: <20210409045314.3420733-1-hsinyi@chromium.org> References: <20210409045314.3420733-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: devicetree@vger.kernel.org, David Airlie , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Rob Herring , linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" krane, kakadu, and kodama boards have a default panel rotation. Signed-off-by: Hsin-Yi Wang --- arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi index ff56bcfa3370..793cc9501337 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi @@ -263,6 +263,7 @@ panel: panel@0 { avee-supply = <&ppvarp_lcd>; pp1800-supply = <&pp1800_lcd>; backlight = <&backlight_lcd0>; + rotation = <270>; port { panel_in: endpoint { remote-endpoint = <&dsi_out>;