From patchwork Mon May 30 11:30:32 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: 12864544 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 E6095C433F5 for ; Mon, 30 May 2022 11:32:09 +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: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:In-Reply-To:References: List-Owner; bh=0giHBVmldycQtu5gZO0HtBh9Wpyn3CaqfKEt/hjesB0=; b=vcfxb8+E/PpbOU BW5hRdRs5VLReItTZD9eho+L65kQACvthedN8yJ8PMsEBzLNfbddKVIJqRwcl8SLzvluFGcU33aaI pYA+rl8qyo8WtZTLD3oGYhQy0Z4Ub7/EZKNClTp2w2gJECHZr9RoJ5XvXB3phCLRAhn6khRDuWLJs eDmNryGnflyAI0gfcVH7vsAKI1gQAh3J6gjgCXfBOU/ulZtfWCk367+PAhrOt8uji1Utv0yc5rzbf OEgSXKvrgOqYAmfNCCMqBC1XJ5X4lLg5Of8wiBFeZ7T3RdRrHGQf3hyVoY3k1ljPAWP9YcAi3Z6BE bwPEVzVCDiPZnWMhuDuw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nvdbf-006LaO-Up; Mon, 30 May 2022 11:30:44 +0000 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nvdbd-006LYo-0q for linux-arm-kernel@lists.infradead.org; Mon, 30 May 2022 11:30:42 +0000 Received: by mail-pj1-x102d.google.com with SMTP id pq9-20020a17090b3d8900b001df622bf81dso10467824pjb.3 for ; Mon, 30 May 2022 04:30:40 -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=1LR1Tu5dH4Zqx/bEdD15yjr+iCH9O5A3630Rxdr7ufM=; b=iq8hfF07jpOTw9vnza7dhu2R3VgXuYuWFbQJXvXUywAg2a7FwiOA9DZqik/AY+Iw9c dc/xqzKTnSpkG4Gh/1+wb2Uql6MKGJ0DAAuxrH9DZ4Da2i1MSSRBR+OHp1JrCV9OcEq4 Ow/85pl2hxvu+EJ2Ie5FMtST8Go1YBa+6Npvo= 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:mime-version :content-transfer-encoding; bh=1LR1Tu5dH4Zqx/bEdD15yjr+iCH9O5A3630Rxdr7ufM=; b=ectHymjGjwFLrynl1520fKij5saHqbKog/C8ZmWS60yVTqW080388wVECqZW3mwtkB 8Vuhr2pyKNefeXlk8o6J6DzeV1edTyb+GWTBsg5kyKOIGBKYaTq76yi1YGCeRnY1er4J qNLGxWKjO514fZbmjKIIBMr9Jxl9hiu4TOie2tIch89YlAZIf+46Faat8OUGa75KzbtK pguiATbdDz45ke1g6njuAfEs7ac5UQIdl3TDmFGEqyyFmDCBVfQVp0cCzBBjEpXbfpnY DRepiBu6LKNzMCZfbHDiZj4s9SANwytqbnMuCyOZNZ0WUKqeFIEVvRltOe0YbP0feXkh 17vg== X-Gm-Message-State: AOAM531UM3kT/IaFnaS/k5ofHSk20Lsek4H3aFmC9GX6mrBQXomlMhje cuWRi9rDqQYsCgYGrM+RLh2gsg== X-Google-Smtp-Source: ABdhPJyNeD8LmDCsvC/XVQPkRq4HOHV0lgFLmaOFAz25EFxhZMA8/4iMeqygIHLdjPqRtFlwHfwzuQ== X-Received: by 2002:a17:902:b688:b0:162:3124:cde2 with SMTP id c8-20020a170902b68800b001623124cde2mr36157868pls.166.1653910239861; Mon, 30 May 2022 04:30:39 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:ae1c:3d63:abec:1097]) by smtp.gmail.com with ESMTPSA id o3-20020a654583000000b003fa5b550303sm8384222pgq.68.2022.05.30.04.30.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 May 2022 04:30:39 -0700 (PDT) From: Hsin-Yi Wang To: Chun-Kuang Hu Cc: Hans de Goede , 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 1/2] drm/mediatek: Config orientation property if panel provides it Date: Mon, 30 May 2022 19:30:32 +0800 Message-Id: <20220530113033.124072-1-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.1.124.g0e6072fb45-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220530_043041_103328_7762828D X-CRM114-Status: GOOD ( 18.63 ) 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 --- This patch is to solve the same problem as [1] [1] https://patchwork.kernel.org/project/linux-mediatek/patch/20220530081910.3947168-2-hsinyi@chromium.org/ --- drivers/gpu/drm/mediatek/mtk_dsi.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c index d9f10a33e6fa..091107f97ccc 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -198,6 +198,7 @@ struct mtk_dsi { unsigned long mode_flags; enum mipi_dsi_pixel_format format; + enum drm_panel_orientation orientation; unsigned int lanes; struct videomode vm; struct mtk_phy_timing phy_timing; @@ -822,6 +823,10 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi) ret = PTR_ERR(dsi->connector); goto err_cleanup_encoder; } + + if (dsi->orientation != DRM_MODE_PANEL_ORIENTATION_UNKNOWN) + drm_connector_set_panel_orientation(dsi->connector, dsi->orientation); + drm_connector_attach_encoder(dsi->connector, &dsi->encoder); return 0; @@ -836,6 +841,14 @@ static int mtk_dsi_bind(struct device *dev, struct device *master, void *data) int ret; struct drm_device *drm = data; struct mtk_dsi *dsi = dev_get_drvdata(dev); + struct drm_panel *panel; + + /* Read panel orientation if existed */ + dsi->orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN; + ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0, &panel, NULL); + if (!ret && panel && panel->dev) { + of_drm_get_panel_orientation(panel->dev->of_node, &dsi->orientation); + } ret = mtk_dsi_encoder_init(drm, dsi); if (ret) From patchwork Mon May 30 11:30:33 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: 12864545 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 B3FE5C433EF for ; Mon, 30 May 2022 11:32:30 +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=qfXMFGD8kfEqPtb4mFZjESU6u5i5ZYaDKdITnSJ91o8=; b=Fc2pP19M24ZRqc CkQ4Va1Yo/H9n2ON9eZjfT3I1jyZOWAEj7+526s4425m/+wbYECFBTA0wljyGUPunywYc600WNtP3 dtvK7td2q93Ym8lGub+mA/xqxZPhGYKWqfsBr+nEORxQf8g3cgyAEqGPyVl4cDHc94w5SJvqlFfiD WH3Dq8kVYtf+ZdQAg4sVxVbkKj3UaSnFGLNGYJidlwGJfwrLbm1Ntoku+U0dsj/nOxYX/Gy/eDVf8 pr74uWvsG6kSDFguoG/kS5d3dKFOesv4f5rkxsRnFNA8JZvpqVWlV81XrvQDwMeecYE1hianvghYB hSLDHL2aRlS5rBQsIfAA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nvdbq-006LfQ-TO; Mon, 30 May 2022 11:30:55 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nvdbf-006LaI-W6 for linux-arm-kernel@lists.infradead.org; Mon, 30 May 2022 11:30:45 +0000 Received: by mail-pj1-x1029.google.com with SMTP id nn3-20020a17090b38c300b001e0e091cf03so7547634pjb.1 for ; Mon, 30 May 2022 04:30:43 -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=0FDANzoD+ved+kLqkfGfvHR/pdrWdYCkcffUnS1gfwU=; b=Fu3f0elDLJOB2qbC/WiNHHrnzhkyIj+M6hmuWqiHDK3vOkYLQvzCSrr7LVh4m3XTYw zHYE0cnTsfWTDpSMBzpspezMLKffVInpKtx6Q6xL1bYNG/62ysHWflZJ8iUZZwz2DmLa LESrtBQuLJ1bR/V4bpVZuA5UHrSfe0QY1yOHo= 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=0FDANzoD+ved+kLqkfGfvHR/pdrWdYCkcffUnS1gfwU=; b=6hpWzSaHupIkeO0mLhBQQXr8+fmgd5Yb1dVDPY7NXBqRwAy/uA05Zh9+S/x7RhnsUH P0Snsl3SDSAZmZm4EPk8BR1pzLEkrh1u+OvnzM4k+ZiempU+PQ7UqdAQ3B4rPqWU+gpj DQuYi0MqQ1/Isy1HD2/0zds5GN01yU+0S6cBGiK2jXrpzCmTnbhsMubHn5A6t0HK7n1h ZvgKZc1yEtHZyEmTFtlS1OJtsfOX8sv5vzjlS7ESMCHSVHyfpWyIDrOAw6QP8qWwaNKM 3Lrq8i6rvLEEYh0WfwiCQqescf2bzXtkoXFi5RsCY+Om16gK95nhBAf07LPK4PS26Iub tw+A== X-Gm-Message-State: AOAM531dh4OHyONH8imLYKMyEyeMSVL18zw7kzQGb4vvOWjF6JSkOuj8 iwke5XKJkA8DFXwu54Ba+b6biA== X-Google-Smtp-Source: ABdhPJxub7eHxeB4mlpr+M6AT+c0bGpa7kjAzy63YjDOWYW87ck7sC0r1LTX1UfyD0/ZFy7H+5i/oQ== X-Received: by 2002:a17:903:1c1:b0:163:ef7b:e11a with SMTP id e1-20020a17090301c100b00163ef7be11amr2002458plh.76.1653910242646; Mon, 30 May 2022 04:30:42 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:ae1c:3d63:abec:1097]) by smtp.gmail.com with ESMTPSA id o3-20020a654583000000b003fa5b550303sm8384222pgq.68.2022.05.30.04.30.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 May 2022 04:30:42 -0700 (PDT) From: Hsin-Yi Wang To: Chun-Kuang Hu Cc: Hans de Goede , 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 2/2] arm64: dts: mt8183: Add panel rotation Date: Mon, 30 May 2022 19:30:33 +0800 Message-Id: <20220530113033.124072-2-hsinyi@chromium.org> X-Mailer: git-send-email 2.36.1.124.g0e6072fb45-goog In-Reply-To: <20220530113033.124072-1-hsinyi@chromium.org> References: <20220530113033.124072-1-hsinyi@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220530_043044_081634_2581015A X-CRM114-Status: GOOD ( 11.59 ) 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 krane, kakadu, and kodama boards have a default panel rotation. Signed-off-by: Hsin-Yi Wang Reviewed-by: Enric Balletbo i Serra Tested-by: Enric Balletbo i Serra --- 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 8d5bf73a9099..f0dd5a06629d 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi @@ -276,6 +276,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>;