From patchwork Thu Apr 16 15:57:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enric Balletbo i Serra X-Patchwork-Id: 11493299 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 35F9381 for ; Thu, 16 Apr 2020 15:58:02 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id E9B76214AF for ; Thu, 16 Apr 2020 15:58:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bIgT/AmZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E9B76214AF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gmXrOuxUu+wyEXryknhfH74NHNtOPRSo0j2yf34+p8w=; b=bIgT/AmZ+1aVpK 492VUEs6FstJRbgQxasGD0aUT7fQoOt6AEHNCUbxgtYLO8IUQ+VLRVl/P7IKgRMd4V28E//Iug4Rg a7gY2xZ/bPfSZUHaNiSOboJnqVAgY5QZUXNvM8BfncPC0yPmMfa4LcxYCumuKQt2DhG+qc5hj1LqN U5YXYRUG6k8k7JF4Ao3+vkQDTF7FTf7fnwE/7kG1SW3M0MxUQ5Fdun7og4Wgw3Bxzo1Tu4X95OxMJ romyxs3cF2evfTaH9EsFRFx/YATw9mYCvwp/6Aehjj4bQ2gkdxki+ROouUn7Ok9wSm+QXYgDXGRF0 kOJPThiY2v+bKLXkIPYg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jP6tm-0007rH-BG; Thu, 16 Apr 2020 15:57:54 +0000 Received: from bhuna.collabora.co.uk ([46.235.227.227]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jP6tQ-0007W3-8x; Thu, 16 Apr 2020 15:57:33 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id E4AD32A22A9 From: Enric Balletbo i Serra To: linux-kernel@vger.kernel.org Subject: [PATCH v2 3/7] drm/mediatek: mtk_dsi: Rename bridge to next_bridge Date: Thu, 16 Apr 2020 17:57:15 +0200 Message-Id: <20200416155720.2360443-4-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200416155720.2360443-1-enric.balletbo@collabora.com> References: <20200416155720.2360443-1-enric.balletbo@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200416_085732_444620_D7416C8C X-CRM114-Status: GOOD ( 11.47 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [46.235.227.227 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chun-Kuang Hu , drinkcat@chromium.org, Philipp Zabel , David Airlie , dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, laurent.pinchart@ideasonboard.com, Daniel Vetter , hsinyi@chromium.org, matthias.bgg@gmail.com, Collabora Kernel ML , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This is really a cosmetic change just to make a bit more readable the code after convert the driver to drm_bridge. The bridge variable name will be used by the encoder drm_bridge, and the chained bridge will be named next_bridge. Signed-off-by: Enric Balletbo i Serra Reviewed-by: Laurent Pinchart --- Changes in v2: None drivers/gpu/drm/mediatek/mtk_dsi.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c index cfa45d6abd74..44ee884cc31c 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -182,7 +182,7 @@ struct mtk_dsi { struct drm_encoder encoder; struct drm_connector conn; struct drm_panel *panel; - struct drm_bridge *bridge; + struct drm_bridge *next_bridge; struct phy *phy; void __iomem *regs; @@ -903,8 +903,9 @@ static int mtk_dsi_create_conn_enc(struct drm_device *drm, struct mtk_dsi *dsi) dsi->encoder.possible_crtcs = 1; /* If there's a bridge, attach to it and let it create the connector */ - if (dsi->bridge) { - ret = drm_bridge_attach(&dsi->encoder, dsi->bridge, NULL, 0); + if (dsi->next_bridge) { + ret = drm_bridge_attach(&dsi->encoder, dsi->next_bridge, NULL, + 0); if (ret) { DRM_ERROR("Failed to attach bridge to drm\n"); goto err_encoder_cleanup; @@ -1185,7 +1186,7 @@ static int mtk_dsi_probe(struct platform_device *pdev) } ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0, - &dsi->panel, &dsi->bridge); + &dsi->panel, &dsi->next_bridge); if (ret) goto err_unregister_host; From patchwork Thu Apr 16 15:57:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enric Balletbo i Serra X-Patchwork-Id: 11493305 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6141181 for ; Thu, 16 Apr 2020 15:58:29 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 3CA7E21927 for ; Thu, 16 Apr 2020 15:58:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qPVRnQfr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3CA7E21927 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZUkYfSxOZb/iYC+6c0+oJmxtWHxx6MeSgJtD91MBMuc=; b=qPVRnQfrvJzhgh v5iK78O8zcOnVI+MF/arKv4U3ObHuQ0l4CrY/6JC7ybQu/nygsnKfO/Zl+DohwWxa5cU7FdXQis1w 4SAuOOHiuOafVvC9Dh8ZVvPSv/HqpPJJogrVBcJ7lpjNB8RqiI5ruuiDSMUfjK8PdrV1swpToiyIH IQt0OMstmDT/Qvk4VpkWLihlRjVpHZJxjTKVH/Ahheyt9MQ/t+2uF8+oWpQITtxTYpX/dXlEgRQpY ayqzo7eDis80y2LEXPGSxalpl30IAvDkUIHa19s3FI6ejH6x1B+PQK6SYj7zdDSpQObP1K0ubjgck vkuI+RD7Du7SJaDhvUOA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jP6uG-0008KS-KQ; Thu, 16 Apr 2020 15:58:24 +0000 Received: from bhuna.collabora.co.uk ([46.235.227.227]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jP6tR-0007WL-4m; Thu, 16 Apr 2020 15:57:36 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 06F8D2A22AB From: Enric Balletbo i Serra To: linux-kernel@vger.kernel.org Subject: [PATCH v2 4/7] drm/mediatek: mtk_dsi: Convert to bridge driver Date: Thu, 16 Apr 2020 17:57:16 +0200 Message-Id: <20200416155720.2360443-5-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200416155720.2360443-1-enric.balletbo@collabora.com> References: <20200416155720.2360443-1-enric.balletbo@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200416_085733_476532_7CCDCC93 X-CRM114-Status: GOOD ( 15.62 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [46.235.227.227 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chun-Kuang Hu , drinkcat@chromium.org, Philipp Zabel , David Airlie , dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, laurent.pinchart@ideasonboard.com, Daniel Vetter , hsinyi@chromium.org, matthias.bgg@gmail.com, Collabora Kernel ML , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Convert mtk_dsi to a bridge driver with built-in encoder support for compatibility with existing component drivers. Signed-off-by: Enric Balletbo i Serra --- Changes in v2: None drivers/gpu/drm/mediatek/mtk_dsi.c | 106 ++++++++++++++++++----------- 1 file changed, 68 insertions(+), 38 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c index 44ee884cc31c..3400d6686c85 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -180,6 +180,7 @@ struct mtk_dsi { struct device *dev; struct mipi_dsi_host host; struct drm_encoder encoder; + struct drm_bridge bridge; struct drm_connector conn; struct drm_panel *panel; struct drm_bridge *next_bridge; @@ -205,9 +206,9 @@ struct mtk_dsi { const struct mtk_dsi_driver_data *driver_data; }; -static inline struct mtk_dsi *encoder_to_dsi(struct drm_encoder *e) +static inline struct mtk_dsi *bridge_to_dsi(struct drm_bridge *b) { - return container_of(e, struct mtk_dsi, encoder); + return container_of(b, struct mtk_dsi, bridge); } static inline struct mtk_dsi *connector_to_dsi(struct drm_connector *c) @@ -796,32 +797,43 @@ static const struct drm_encoder_funcs mtk_dsi_encoder_funcs = { .destroy = mtk_dsi_encoder_destroy, }; -static bool mtk_dsi_encoder_mode_fixup(struct drm_encoder *encoder, - const struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) +static int mtk_dsi_create_conn_enc(struct drm_device *drm, struct mtk_dsi *dsi); +static void mtk_dsi_destroy_conn_enc(struct mtk_dsi *dsi); + +static int mtk_dsi_bridge_attach(struct drm_bridge *bridge, + enum drm_bridge_attach_flags flags) { - return true; + struct mtk_dsi *dsi = bridge_to_dsi(bridge); + + return mtk_dsi_create_conn_enc(bridge->dev, dsi); +} + +static void mtk_dsi_bridge_detach(struct drm_bridge *bridge) +{ + struct mtk_dsi *dsi = bridge_to_dsi(bridge); + + mtk_dsi_destroy_conn_enc(dsi); } -static void mtk_dsi_encoder_mode_set(struct drm_encoder *encoder, - struct drm_display_mode *mode, - struct drm_display_mode *adjusted) +static void mtk_dsi_bridge_mode_set(struct drm_bridge *bridge, + const struct drm_display_mode *mode, + const struct drm_display_mode *adjusted) { - struct mtk_dsi *dsi = encoder_to_dsi(encoder); + struct mtk_dsi *dsi = bridge_to_dsi(bridge); drm_display_mode_to_videomode(adjusted, &dsi->vm); } -static void mtk_dsi_encoder_disable(struct drm_encoder *encoder) +static void mtk_dsi_bridge_disable(struct drm_bridge *bridge) { - struct mtk_dsi *dsi = encoder_to_dsi(encoder); + struct mtk_dsi *dsi = bridge_to_dsi(bridge); mtk_output_dsi_disable(dsi); } -static void mtk_dsi_encoder_enable(struct drm_encoder *encoder) +static void mtk_dsi_bridge_enable(struct drm_bridge *bridge) { - struct mtk_dsi *dsi = encoder_to_dsi(encoder); + struct mtk_dsi *dsi = bridge_to_dsi(bridge); mtk_output_dsi_enable(dsi); } @@ -833,11 +845,12 @@ static int mtk_dsi_connector_get_modes(struct drm_connector *connector) return drm_panel_get_modes(dsi->panel, connector); } -static const struct drm_encoder_helper_funcs mtk_dsi_encoder_helper_funcs = { - .mode_fixup = mtk_dsi_encoder_mode_fixup, - .mode_set = mtk_dsi_encoder_mode_set, - .disable = mtk_dsi_encoder_disable, - .enable = mtk_dsi_encoder_enable, +static const struct drm_bridge_funcs mtk_dsi_bridge_funcs = { + .attach = mtk_dsi_bridge_attach, + .detach = mtk_dsi_bridge_detach, + .disable = mtk_dsi_bridge_disable, + .enable = mtk_dsi_bridge_enable, + .mode_set = mtk_dsi_bridge_mode_set, }; static const struct drm_connector_funcs mtk_dsi_connector_funcs = { @@ -888,20 +901,6 @@ static int mtk_dsi_create_conn_enc(struct drm_device *drm, struct mtk_dsi *dsi) { int ret; - ret = drm_encoder_init(drm, &dsi->encoder, &mtk_dsi_encoder_funcs, - DRM_MODE_ENCODER_DSI, NULL); - if (ret) { - DRM_ERROR("Failed to encoder init to drm\n"); - return ret; - } - drm_encoder_helper_add(&dsi->encoder, &mtk_dsi_encoder_helper_funcs); - - /* - * Currently display data paths are statically assigned to a crtc each. - * crtc 0 is OVL0 -> COLOR0 -> AAL -> OD -> RDMA0 -> UFOE -> DSI0 - */ - dsi->encoder.possible_crtcs = 1; - /* If there's a bridge, attach to it and let it create the connector */ if (dsi->next_bridge) { ret = drm_bridge_attach(&dsi->encoder, dsi->next_bridge, NULL, @@ -1123,6 +1122,34 @@ static const struct mipi_dsi_host_ops mtk_dsi_ops = { .transfer = mtk_dsi_host_transfer, }; +static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi) +{ + int ret; + + ret = drm_encoder_init(drm, &dsi->encoder, &mtk_dsi_encoder_funcs, + DRM_MODE_ENCODER_DSI, NULL); + if (ret) { + DRM_ERROR("Failed to encoder init to drm\n"); + return ret; + } + + /* + * Currently display data paths are statically assigned to a crtc each. + * crtc 0 is OVL0 -> COLOR0 -> AAL -> OD -> RDMA0 -> UFOE -> DSI0 + */ + dsi->encoder.possible_crtcs = 1; + + ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL, 0); + if (ret) + goto err_cleanup_encoder; + + return 0; + +err_cleanup_encoder: + drm_encoder_cleanup(&dsi->encoder); + return ret; +} + static int mtk_dsi_bind(struct device *dev, struct device *master, void *data) { int ret; @@ -1136,11 +1163,9 @@ static int mtk_dsi_bind(struct device *dev, struct device *master, void *data) return ret; } - ret = mtk_dsi_create_conn_enc(drm, dsi); - if (ret) { - DRM_ERROR("Encoder create failed with %d\n", ret); + ret = mtk_dsi_encoder_init(drm, dsi); + if (ret) goto err_unregister; - } return 0; @@ -1155,7 +1180,6 @@ static void mtk_dsi_unbind(struct device *dev, struct device *master, struct drm_device *drm = data; struct mtk_dsi *dsi = dev_get_drvdata(dev); - mtk_dsi_destroy_conn_enc(dsi); mtk_ddp_comp_unregister(drm, &dsi->ddp_comp); } @@ -1265,6 +1289,11 @@ static int mtk_dsi_probe(struct platform_device *pdev) platform_set_drvdata(pdev, dsi); + dsi->bridge.funcs = &mtk_dsi_bridge_funcs; + dsi->bridge.of_node = dev->of_node; + + drm_bridge_add(&dsi->bridge); + ret = component_add(&pdev->dev, &mtk_dsi_component_ops); if (ret) { dev_err(&pdev->dev, "failed to add component: %d\n", ret); @@ -1283,6 +1312,7 @@ static int mtk_dsi_remove(struct platform_device *pdev) struct mtk_dsi *dsi = platform_get_drvdata(pdev); mtk_output_dsi_disable(dsi); + drm_bridge_remove(&dsi->bridge); component_del(&pdev->dev, &mtk_dsi_component_ops); mipi_dsi_host_unregister(&dsi->host); From patchwork Thu Apr 16 15:57:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enric Balletbo i Serra X-Patchwork-Id: 11493303 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DDC0481 for ; Thu, 16 Apr 2020 15:58:17 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 933FD21927 for ; Thu, 16 Apr 2020 15:58:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="heDT48RY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 933FD21927 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Ni1JVx2kZhzvJ3xf1Df8hStbdoJu9TxB3gKjDEEzT1U=; b=heDT48RYRFqg8D 2n4EX93Xk06qK+wq3w2HJDWD+qndMcckGmtclPc5uNRISMZgMDub2hfvKExZ+0KVQeH/NeWBvG6W3 oTwNhtENs6HcF9PdcX70kO4w/cBXp+QfDz3cQsPwgcAhuGY6FtOYIxVfn3thHXvniJIQWpcsofSVP U+UsqkymUAaH3eUhOKjhUSOn80bvVyo+apGvGMq6n3k1hF+MZyMW/wTTznRFK2iRdYRH0AL72jthy kLeshhJmbHz0neeuwpYYyMNYLmvo8nvS/WcJo6vQ+3KvAD8vxM9qmPzm41KXnE2Oo3chL2mQZZRqp rwp0vzHg8iME8+bWNaEA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jP6u2-00084x-DV; Thu, 16 Apr 2020 15:58:10 +0000 Received: from bhuna.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e3e3]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jP6tS-0007XC-4q; Thu, 16 Apr 2020 15:57:36 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 24C312A22A7 From: Enric Balletbo i Serra To: linux-kernel@vger.kernel.org Subject: [PATCH v2 5/7] drm/mediatek: mtk_dsi: Use simple encoder Date: Thu, 16 Apr 2020 17:57:17 +0200 Message-Id: <20200416155720.2360443-6-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200416155720.2360443-1-enric.balletbo@collabora.com> References: <20200416155720.2360443-1-enric.balletbo@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200416_085734_330328_9CADF21D X-CRM114-Status: GOOD ( 10.23 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chun-Kuang Hu , drinkcat@chromium.org, Philipp Zabel , David Airlie , dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, laurent.pinchart@ideasonboard.com, Daniel Vetter , hsinyi@chromium.org, matthias.bgg@gmail.com, Collabora Kernel ML , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The mtk_dsi driver uses an empty implementation for its encoder. Replace the code with the generic simple encoder. Signed-off-by: Enric Balletbo i Serra Reviewed-by: Laurent Pinchart --- Changes in v2: None drivers/gpu/drm/mediatek/mtk_dsi.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c index 3400d6686c85..48361c1e9f34 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "mtk_drm_ddp_comp.h" @@ -788,15 +789,6 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi) dsi->enabled = false; } -static void mtk_dsi_encoder_destroy(struct drm_encoder *encoder) -{ - drm_encoder_cleanup(encoder); -} - -static const struct drm_encoder_funcs mtk_dsi_encoder_funcs = { - .destroy = mtk_dsi_encoder_destroy, -}; - static int mtk_dsi_create_conn_enc(struct drm_device *drm, struct mtk_dsi *dsi); static void mtk_dsi_destroy_conn_enc(struct mtk_dsi *dsi); @@ -1126,8 +1118,8 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi) { int ret; - ret = drm_encoder_init(drm, &dsi->encoder, &mtk_dsi_encoder_funcs, - DRM_MODE_ENCODER_DSI, NULL); + ret = drm_simple_encoder_init(drm, &dsi->encoder, + DRM_MODE_ENCODER_DSI); if (ret) { DRM_ERROR("Failed to encoder init to drm\n"); return ret; From patchwork Thu Apr 16 15:57:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enric Balletbo i Serra X-Patchwork-Id: 11493309 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 541F581 for ; Thu, 16 Apr 2020 15:58:57 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 2C47B208E4 for ; Thu, 16 Apr 2020 15:58:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ANV/+COc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2C47B208E4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JG5Yg0QWIja6ypzfuBaN9fNaA9LoCxYnUl5AvCTIUuA=; b=ANV/+COc9XcaUL iUv4yH1v7ZUu3tVkCxTNJghsj8CoOoCBiH3GuEDXDGXtcMYZLXajsjuJuf84l4lNGoQTBUvGhh6W0 vlp21jUklnhbkT+9HOCNhtnzAOPYawb4AU9n3UULTBeJPQGLSFUPLwBLKRswQD/tRKCcshVxB9eKN zDJTMEZcCSKFzKKvsR9C0LO5SEx3PGuSzLlhIpj2o0vrgIbq4HQyug1xV5h2bUktQ64yMEg6aBfTs WOIAcDXx0XZi23zKjmVQ0pSsOGTBZMLVdNXbsosHJXivMPH3WkHUI9g4Vq3y5q/WzjbgOIwyAk7jO ppCtJsAyjAD9DS8oC06g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jP6ue-0000Md-Ou; Thu, 16 Apr 2020 15:58:49 +0000 Received: from bhuna.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e3e3]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jP6tT-0007ZU-AR; Thu, 16 Apr 2020 15:57:39 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 333572A22A6 From: Enric Balletbo i Serra To: linux-kernel@vger.kernel.org Subject: [PATCH v2 6/7] drm/mediatek: mtk_dsi: Use the drm_panel_bridge API Date: Thu, 16 Apr 2020 17:57:18 +0200 Message-Id: <20200416155720.2360443-7-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200416155720.2360443-1-enric.balletbo@collabora.com> References: <20200416155720.2360443-1-enric.balletbo@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200416_085735_664890_EFDE6DD0 X-CRM114-Status: GOOD ( 16.03 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chun-Kuang Hu , drinkcat@chromium.org, Philipp Zabel , David Airlie , dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, laurent.pinchart@ideasonboard.com, Daniel Vetter , hsinyi@chromium.org, matthias.bgg@gmail.com, Collabora Kernel ML , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Replace the manual panel handling code by a drm_panel_bridge. This simplifies the driver and allows all components in the display pipeline to be treated as bridges, paving the way to generic connector handling. Signed-off-by: Enric Balletbo i Serra Reviewed-by: Laurent Pinchart --- Changes in v2: - Do not set connector_type for panel here. (Sam Ravnborg) drivers/gpu/drm/mediatek/mtk_dsi.c | 177 ++++------------------------- 1 file changed, 19 insertions(+), 158 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c index 48361c1e9f34..44718fa3d1ca 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -182,8 +182,7 @@ struct mtk_dsi { struct mipi_dsi_host host; struct drm_encoder encoder; struct drm_bridge bridge; - struct drm_connector conn; - struct drm_panel *panel; + struct drm_bridge *panel_bridge; struct drm_bridge *next_bridge; struct phy *phy; @@ -212,11 +211,6 @@ static inline struct mtk_dsi *bridge_to_dsi(struct drm_bridge *b) return container_of(b, struct mtk_dsi, bridge); } -static inline struct mtk_dsi *connector_to_dsi(struct drm_connector *c) -{ - return container_of(c, struct mtk_dsi, conn); -} - static inline struct mtk_dsi *host_to_dsi(struct mipi_dsi_host *h) { return container_of(h, struct mtk_dsi, host); @@ -682,16 +676,7 @@ static int mtk_dsi_poweron(struct mtk_dsi *dsi) mtk_dsi_lane0_ulp_mode_leave(dsi); mtk_dsi_clk_hs_mode(dsi, 0); - if (dsi->panel) { - if (drm_panel_prepare(dsi->panel)) { - DRM_ERROR("failed to prepare the panel\n"); - goto err_disable_digital_clk; - } - } - return 0; -err_disable_digital_clk: - clk_disable_unprepare(dsi->digital_clk); err_disable_engine_clk: clk_disable_unprepare(dsi->engine_clk); err_phy_power_off: @@ -718,15 +703,7 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi) */ mtk_dsi_stop(dsi); - if (!mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500)) { - if (dsi->panel) { - if (drm_panel_unprepare(dsi->panel)) { - DRM_ERROR("failed to unprepare the panel\n"); - return; - } - } - } - + mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500); mtk_dsi_reset_engine(dsi); mtk_dsi_lane0_ulp_mode_enter(dsi); mtk_dsi_clk_ulp_mode_enter(dsi); @@ -757,19 +734,7 @@ static void mtk_output_dsi_enable(struct mtk_dsi *dsi) mtk_dsi_start(dsi); - if (dsi->panel) { - if (drm_panel_enable(dsi->panel)) { - DRM_ERROR("failed to enable the panel\n"); - goto err_dsi_power_off; - } - } - dsi->enabled = true; - - return; -err_dsi_power_off: - mtk_dsi_stop(dsi); - mtk_dsi_poweroff(dsi); } static void mtk_output_dsi_disable(struct mtk_dsi *dsi) @@ -777,34 +742,24 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi) if (!dsi->enabled) return; - if (dsi->panel) { - if (drm_panel_disable(dsi->panel)) { - DRM_ERROR("failed to disable the panel\n"); - return; - } - } - mtk_dsi_poweroff(dsi); dsi->enabled = false; } -static int mtk_dsi_create_conn_enc(struct drm_device *drm, struct mtk_dsi *dsi); -static void mtk_dsi_destroy_conn_enc(struct mtk_dsi *dsi); - static int mtk_dsi_bridge_attach(struct drm_bridge *bridge, enum drm_bridge_attach_flags flags) { struct mtk_dsi *dsi = bridge_to_dsi(bridge); + struct drm_bridge *next; - return mtk_dsi_create_conn_enc(bridge->dev, dsi); -} - -static void mtk_dsi_bridge_detach(struct drm_bridge *bridge) -{ - struct mtk_dsi *dsi = bridge_to_dsi(bridge); + if (dsi->next_bridge) + next = dsi->next_bridge; + else + next = dsi->panel_bridge; - mtk_dsi_destroy_conn_enc(dsi); + /* Attach the panel or bridge to the dsi bridge */ + return drm_bridge_attach(bridge->encoder, next, &dsi->bridge, flags); } static void mtk_dsi_bridge_mode_set(struct drm_bridge *bridge, @@ -830,101 +785,13 @@ static void mtk_dsi_bridge_enable(struct drm_bridge *bridge) mtk_output_dsi_enable(dsi); } -static int mtk_dsi_connector_get_modes(struct drm_connector *connector) -{ - struct mtk_dsi *dsi = connector_to_dsi(connector); - - return drm_panel_get_modes(dsi->panel, connector); -} - static const struct drm_bridge_funcs mtk_dsi_bridge_funcs = { .attach = mtk_dsi_bridge_attach, - .detach = mtk_dsi_bridge_detach, .disable = mtk_dsi_bridge_disable, .enable = mtk_dsi_bridge_enable, .mode_set = mtk_dsi_bridge_mode_set, }; -static const struct drm_connector_funcs mtk_dsi_connector_funcs = { - .fill_modes = drm_helper_probe_single_connector_modes, - .destroy = drm_connector_cleanup, - .reset = drm_atomic_helper_connector_reset, - .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, - .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, -}; - -static const struct drm_connector_helper_funcs - mtk_dsi_connector_helper_funcs = { - .get_modes = mtk_dsi_connector_get_modes, -}; - -static int mtk_dsi_create_connector(struct drm_device *drm, struct mtk_dsi *dsi) -{ - int ret; - - ret = drm_connector_init(drm, &dsi->conn, &mtk_dsi_connector_funcs, - DRM_MODE_CONNECTOR_DSI); - if (ret) { - DRM_ERROR("Failed to connector init to drm\n"); - return ret; - } - - drm_connector_helper_add(&dsi->conn, &mtk_dsi_connector_helper_funcs); - - dsi->conn.dpms = DRM_MODE_DPMS_OFF; - drm_connector_attach_encoder(&dsi->conn, &dsi->encoder); - - if (dsi->panel) { - ret = drm_panel_attach(dsi->panel, &dsi->conn); - if (ret) { - DRM_ERROR("Failed to attach panel to drm\n"); - goto err_connector_cleanup; - } - } - - return 0; - -err_connector_cleanup: - drm_connector_cleanup(&dsi->conn); - return ret; -} - -static int mtk_dsi_create_conn_enc(struct drm_device *drm, struct mtk_dsi *dsi) -{ - int ret; - - /* If there's a bridge, attach to it and let it create the connector */ - if (dsi->next_bridge) { - ret = drm_bridge_attach(&dsi->encoder, dsi->next_bridge, NULL, - 0); - if (ret) { - DRM_ERROR("Failed to attach bridge to drm\n"); - goto err_encoder_cleanup; - } - } else { - /* Otherwise create our own connector and attach to a panel */ - ret = mtk_dsi_create_connector(drm, dsi); - if (ret) - goto err_encoder_cleanup; - } - - return 0; - -err_encoder_cleanup: - drm_encoder_cleanup(&dsi->encoder); - return ret; -} - -static void mtk_dsi_destroy_conn_enc(struct mtk_dsi *dsi) -{ - drm_encoder_cleanup(&dsi->encoder); - /* Skip connector cleanup if creation was delegated to the bridge */ - if (dsi->conn.dev) - drm_connector_cleanup(&dsi->conn); - if (dsi->panel) - drm_panel_detach(dsi->panel); -} - static void mtk_dsi_ddp_start(struct mtk_ddp_comp *comp) { struct mtk_dsi *dsi = container_of(comp, struct mtk_dsi, ddp_comp); @@ -953,20 +820,6 @@ static int mtk_dsi_host_attach(struct mipi_dsi_host *host, dsi->format = device->format; dsi->mode_flags = device->mode_flags; - if (dsi->conn.dev) - drm_helper_hpd_irq_event(dsi->conn.dev); - - return 0; -} - -static int mtk_dsi_host_detach(struct mipi_dsi_host *host, - struct mipi_dsi_device *device) -{ - struct mtk_dsi *dsi = host_to_dsi(host); - - if (dsi->conn.dev) - drm_helper_hpd_irq_event(dsi->conn.dev); - return 0; } @@ -1110,7 +963,6 @@ static ssize_t mtk_dsi_host_transfer(struct mipi_dsi_host *host, static const struct mipi_dsi_host_ops mtk_dsi_ops = { .attach = mtk_dsi_host_attach, - .detach = mtk_dsi_host_detach, .transfer = mtk_dsi_host_transfer, }; @@ -1184,6 +1036,7 @@ static int mtk_dsi_probe(struct platform_device *pdev) { struct mtk_dsi *dsi; struct device *dev = &pdev->dev; + struct drm_panel *panel; struct resource *regs; int irq_num; int comp_id; @@ -1202,10 +1055,18 @@ static int mtk_dsi_probe(struct platform_device *pdev) } ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0, - &dsi->panel, &dsi->next_bridge); + &panel, &dsi->next_bridge); if (ret) goto err_unregister_host; + if (panel) { + dsi->panel_bridge = devm_drm_panel_bridge_add(dev, panel); + if (IS_ERR(dsi->panel_bridge)) { + ret = PTR_ERR(dsi->panel_bridge); + goto err_unregister_host; + } + } + dsi->driver_data = of_device_get_match_data(dev); dsi->engine_clk = devm_clk_get(dev, "engine"); From patchwork Thu Apr 16 15:57:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enric Balletbo i Serra X-Patchwork-Id: 11493307 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EA4851392 for ; Thu, 16 Apr 2020 15:58:44 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id C550D207FC for ; Thu, 16 Apr 2020 15:58:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="VlKwydWn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C550D207FC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Kam7VuVGtGDQQicLGEpfjCAyobsavHklgAPUgmHvwBE=; b=VlKwydWn8HbL99 IVY0bJvdVpc8o9cP8CpEfC3SvglwYk697kbOzfbv7CIsQImCsDS+n1xI5blKpHLqtWfALnZQOVc0G 8UOSsOtarmWZhtw4ungpDg5vqDJfWy1DVrRc3EIRg9r0KCHgtD9nJoEUWN2TGEMy0/GJkCSlWpZkN MrV/n+9bskvVALPdCOmyG++P5WwyTMRhUOyX21a10cdks5yivpJkVpinFPru06ind017v9TOGFvbf Rvx2nHRJV3rGZcXf3DxVRqgLXLx3sy3xXeJ54OzCk/RCt99IZqffkndUXSXhC14vV4hkxMyWAwn3F VPcnMFlZyPQM1dw4laag==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jP6uU-00009Y-2F; Thu, 16 Apr 2020 15:58:38 +0000 Received: from bhuna.collabora.co.uk ([46.235.227.227]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jP6tU-0007aL-CF; Thu, 16 Apr 2020 15:57:38 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 4E96C2A22B0 From: Enric Balletbo i Serra To: linux-kernel@vger.kernel.org Subject: [PATCH v2 7/7] drm/mediatek: mtk_dsi: Create connector for bridges Date: Thu, 16 Apr 2020 17:57:19 +0200 Message-Id: <20200416155720.2360443-8-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200416155720.2360443-1-enric.balletbo@collabora.com> References: <20200416155720.2360443-1-enric.balletbo@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200416_085736_558542_15314394 X-CRM114-Status: GOOD ( 10.89 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [46.235.227.227 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chun-Kuang Hu , drinkcat@chromium.org, Philipp Zabel , David Airlie , dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, laurent.pinchart@ideasonboard.com, Daniel Vetter , hsinyi@chromium.org, matthias.bgg@gmail.com, Collabora Kernel ML , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Use the drm_bridge_connector helper to create a connector for pipelines that use drm_bridge. This allows splitting connector operations across multiple bridges when necessary, instead of having the last bridge in the chain creating the connector and handling all connector operations internally. Signed-off-by: Enric Balletbo i Serra --- Changes in v2: None drivers/gpu/drm/mediatek/mtk_dsi.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c index 44718fa3d1ca..2f8876c32864 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -184,6 +185,7 @@ struct mtk_dsi { struct drm_bridge bridge; struct drm_bridge *panel_bridge; struct drm_bridge *next_bridge; + struct drm_connector *connector; struct phy *phy; void __iomem *regs; @@ -983,10 +985,19 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi) */ dsi->encoder.possible_crtcs = 1; - ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL, 0); + ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL, + DRM_BRIDGE_ATTACH_NO_CONNECTOR); if (ret) goto err_cleanup_encoder; + dsi->connector = drm_bridge_connector_init(drm, &dsi->encoder); + if (IS_ERR(dsi->connector)) { + DRM_ERROR("Unable to create bridge connector\n"); + ret = PTR_ERR(dsi->connector); + goto err_cleanup_encoder; + } + drm_connector_attach_encoder(dsi->connector, &dsi->encoder); + return 0; err_cleanup_encoder: @@ -1144,6 +1155,7 @@ static int mtk_dsi_probe(struct platform_device *pdev) dsi->bridge.funcs = &mtk_dsi_bridge_funcs; dsi->bridge.of_node = dev->of_node; + dsi->bridge.type = DRM_MODE_CONNECTOR_DSI; drm_bridge_add(&dsi->bridge);