From patchwork Wed Jul 25 15:46:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 10544199 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3504E1822 for ; Wed, 25 Jul 2018 15:47:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 242452A4FC for ; Wed, 25 Jul 2018 15:47:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 175E42A519; Wed, 25 Jul 2018 15:47:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 112F72A527 for ; Wed, 25 Jul 2018 15:47:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728580AbeGYQ7Q (ORCPT ); Wed, 25 Jul 2018 12:59:16 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:50559 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728514AbeGYQ7Q (ORCPT ); Wed, 25 Jul 2018 12:59:16 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20180725154701euoutp0230e9cc5ecbfcbe650d8606b22c9f2c27~EpzVtooMK0392203922euoutp02O; Wed, 25 Jul 2018 15:47:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180725154701euoutp0230e9cc5ecbfcbe650d8606b22c9f2c27~EpzVtooMK0392203922euoutp02O DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1532533621; bh=rBR4kD4pMBRoVVd/kEMUCj88ftg0K/pS6ge9tI60sUw=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=NTcwZcduvyuQOLYzt/9jtmIoZJ8nKHyNEWs63hcD3FOHhkIjn18M81X40IsI/2Joj skumtk9wBeXtajt3FHbCUL+CUjeSbg+U1AVEOejMdn3Q9gWm7p2GLmptjSuE4P4EGQ q2XRBFxuYpL5zvYR2QPPdGFrk4VYmeJeFRhGaqTA= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180725154700eucas1p20f3d8e799f2974729fdba12a0052801c~EpzVTFTtP2172521725eucas1p2K; Wed, 25 Jul 2018 15:47:00 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id F2.A6.61560.47B985B5; Wed, 25 Jul 2018 16:47:00 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180725154659eucas1p116f3a5e735333b07bcf9808f00694f3c~EpzUgbE5K0824808248eucas1p1-; Wed, 25 Jul 2018 15:46:59 +0000 (GMT) X-AuditID: cbfec7f5-207ff7000002f078-9f-5b589b74a2c8 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id D9.B1.04183.37B985B5; Wed, 25 Jul 2018 16:46:59 +0100 (BST) Received: from AMDC2768.DIGITAL.local ([106.120.43.17]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PCF00M07IIAVC60@eusync4.samsung.com>; Wed, 25 Jul 2018 16:46:59 +0100 (BST) From: Andrzej Hajda To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, Inki Dae Cc: Maciej Purski , Bartlomiej Zolnierkiewicz , Marek Szyprowski , Andrzej Hajda , Rob Herring , Thierry Reding , Krzysztof Kozlowski , Archit Taneja , Laurent Pinchart Subject: [PATCH v5 2/9] drm/exynos: move connector creation to attach callback Date: Wed, 25 Jul 2018 17:46:37 +0200 Message-id: <20180725154644.25412-3-a.hajda@samsung.com> X-Mailer: git-send-email 2.18.0 In-reply-to: <20180725154644.25412-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrNIsWRmVeSWpSXmKPExsWy7djP87olsyOiDRbPErW4te4cq0VTx1tW i40z1rNaXPn6ns1i0v0JLBbnz29gt+icuITdYsb5fUwWC17eYrFYe+Quu0Xr3iPsFj93zWNx 4PG43NfL5LFz1l12j9kdM1k9Nq3qZPO4332cyaNvyypGj8+b5ALYo7hsUlJzMstSi/TtErgy Hp0/z1ZwTqHi86rnrA2MXdJdjJwcEgImEk/W7WXpYuTiEBJYwSjx7e5KRpCEkMBnRokpRxRg ilZOvMQEUbSMUWJu4x1WCOc/o8TBo+dYQarYBDQl/m6+yQZiiwhkSmw4uJAdpIhZoIdZ4tzp O0wgCWGBAIn3S+6BrWARUJXo2H4RLM4rYCGxe/M7Voh18hIPj7eD1XAKWEpc2X+IDWSQhMAO Non+OyeBEhxAjovElPsxEPXCEq+Ob2GHsGUkLk/uZoGw6yWaZl5hhujtYJQ4sXg5G0TCWuLw 8Ytgy5gF+CQmbZvODDGTV6KjTQjC9JB4364L8WQPo8SVN9vZJzBKLmBkWMUonlpanJueWmyc l1quV5yYW1yal66XnJ+7iREYxaf/Hf+6g3Hfn6RDjAIcjEo8vBdmRkQLsSaWFVfmHmKU4GBW EuF1ORweLcSbklhZlVqUH19UmpNafIhRmoNFSZxX2geoWiA9sSQ1OzW1ILUIJsvEwSnVwFge nzjpypW/tnLr/JeYn6qtrrjg6HRv2sqjMSndvi9P/MnMP8Rkst/4aP6y5yfsSrcnqYU8ysif f0V2y2IRke66wN8bH/gbKveqWUgIBV0vm9E0OWbz3RUVWRfNV11QC70n7GU8576S9byuow0O ktF7o+b8fdsUGn/W9cyeqm3xodvaxFQSdiixFGckGmoxFxUnAgBOny0M3gIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrFLMWRmVeSWpSXmKPExsVy+t/xa7rFsyOiDV536lncWneO1aKp4y2r xcYZ61ktrnx9z2Yx6f4EFovz5zewW3ROXMJuMeP8PiaLBS9vsVisPXKX3aJ17xF2i5+75rE4 8Hhc7utl8tg56y67x+yOmawem1Z1snnc7z7O5NG3ZRWjx+dNcgHsUVw2Kak5mWWpRfp2CVwZ j86fZys4p1DxedVz1gbGLukuRk4OCQETiZUTLzF1MXJxCAksYZSYO3MtG0hCSKCRSeJfawGI zSagKfF3802wuIhApsSlta3MIA3MAn3MEnu/rWQCSQgL+EncXfiaGcRmEVCV6Nh+ESzOK2Ah sXvzO1aIbfISD4+3M4LYnAKWElf2H4JaZiFxYOM6tgmMPAsYGVYxiqSWFuem5xYb6RUn5haX 5qXrJefnbmIEhuC2Yz+37GDsehd8iFGAg1GJh/fCzIhoIdbEsuLK3EOMEhzMSiK8LofDo4V4 UxIrq1KL8uOLSnNSiw8xSnOwKInznjeojBISSE8sSc1OTS1ILYLJMnFwSjUwul6Uas3qd1um Kjlr7+sgxYLMe4uMxEU0Nk3PK2ixEMg7/Tww1kncnb2pKYRxoxufTXjTQ8Xn1dnFS627fI8s a2lffuv55K2XHk1Z9WhXw4dIUc89j/2rp/7lLS3tcjEz6t2SkH9J63/p977m6nv6h9an+K9t OFbD2/foZrfk1Kmfj5mlfm1XYinOSDTUYi4qTgQAaePaHD0CAAA= X-CMS-MailID: 20180725154659eucas1p116f3a5e735333b07bcf9808f00694f3c X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180725154659eucas1p116f3a5e735333b07bcf9808f00694f3c References: <20180725154644.25412-1-a.hajda@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Maciej Purski The current implementation assumes that the only possible peripheral device for DSIM is a panel. Using an output bridge child device should also be possible. If an output bridge is available, don't create a new connector. Instead, call drm_bridge_attach() and set encoder's bridge to NULL in order to avoid an out bridge from being visible by the framework, as the DSI bus needs control on enabling its child output bridge. Such sequence is required by Toshiba TC358764 bridge, which is a DSI peripheral bridge device. changed in v5: - detach bridge in mipi_dsi detach callback Signed-off-by: Maciej Purski [ a.hajda@samsung.com: v5 ] Signed-off-by: Andrzej Hajda --- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 50 ++++++++++++++++--------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index 351403f9d245..f5f51f584fa0 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -255,6 +255,7 @@ struct exynos_dsi { struct mipi_dsi_host dsi_host; struct drm_connector connector; struct drm_panel *panel; + struct drm_bridge *out_bridge; struct device *dev; void __iomem *reg_base; @@ -1499,7 +1500,30 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host, struct mipi_dsi_device *device) { struct exynos_dsi *dsi = host_to_dsi(host); - struct drm_device *drm = dsi->connector.dev; + struct drm_encoder *encoder = &dsi->encoder; + struct drm_device *drm = encoder->dev; + struct drm_bridge *out_bridge; + + out_bridge = of_drm_find_bridge(device->dev.of_node); + if (out_bridge) { + drm_bridge_attach(encoder, out_bridge, NULL); + dsi->out_bridge = out_bridge; + encoder->bridge = NULL; + } else { + int ret = exynos_dsi_create_connector(encoder); + + if (ret) { + DRM_ERROR("failed to create connector ret = %d\n", ret); + drm_encoder_cleanup(encoder); + return ret; + } + + dsi->panel = of_drm_find_panel(device->dev.of_node); + if (dsi->panel) { + drm_panel_attach(dsi->panel, &dsi->connector); + dsi->connector.status = connector_status_connected; + } + } /* * This is a temporary solution and should be made by more generic way. @@ -1518,11 +1542,6 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host, dsi->lanes = device->lanes; dsi->format = device->format; dsi->mode_flags = device->mode_flags; - dsi->panel = of_drm_find_panel(device->dev.of_node); - if (dsi->panel) { - drm_panel_attach(dsi->panel, &dsi->connector); - dsi->connector.status = connector_status_connected; - } exynos_drm_crtc_get_by_type(drm, EXYNOS_DISPLAY_TYPE_LCD)->i80_mode = !(dsi->mode_flags & MIPI_DSI_MODE_VIDEO); @@ -1538,19 +1557,21 @@ static int exynos_dsi_host_detach(struct mipi_dsi_host *host, struct mipi_dsi_device *device) { struct exynos_dsi *dsi = host_to_dsi(host); - struct drm_device *drm = dsi->connector.dev; - - mutex_lock(&drm->mode_config.mutex); + struct drm_device *drm = dsi->encoder.dev; if (dsi->panel) { + mutex_lock(&drm->mode_config.mutex); exynos_dsi_disable(&dsi->encoder); drm_panel_detach(dsi->panel); dsi->panel = NULL; dsi->connector.status = connector_status_disconnected; + mutex_unlock(&drm->mode_config.mutex); + } else { + if (dsi->out_bridge->funcs->detach) + dsi->out_bridge->funcs->detach(dsi->out_bridge); + dsi->out_bridge = NULL; } - mutex_unlock(&drm->mode_config.mutex); - if (drm->mode_config.poll_enabled) drm_kms_helper_hotplug_event(drm); @@ -1654,13 +1675,6 @@ static int exynos_dsi_bind(struct device *dev, struct device *master, if (ret < 0) return ret; - ret = exynos_dsi_create_connector(encoder); - if (ret) { - DRM_ERROR("failed to create connector ret = %d\n", ret); - drm_encoder_cleanup(encoder); - return ret; - } - if (dsi->in_bridge_node) { in_bridge = of_drm_find_bridge(dsi->in_bridge_node); if (in_bridge)