From patchwork Thu Jan 27 11:42:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?WGlubGVpIExlZSAo5p2O5piV56OKKQ==?= X-Patchwork-Id: 12726657 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 28A58C433EF for ; Thu, 27 Jan 2022 11:45:28 +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=8131nqZNeMtqElAI9XJAv6Uyrb1LDut6z5GyFw8KBrE=; b=2WgCi+IWzIdOO/ Ojkxe/1q57Oj58YAeXYMxcI0OoeBzgTLuQj1VKmHuZgZytvhC/OuS8iRR4fczLaARZ3RowupSu2Pz stOeJOf77K/JQcQEITrjhHZmzJQRHnx0VencTq7jcg1md9RtyXNwIMUcPVxPfzICf7sD44eEszc5R JLSKDJfV/k0JcyfA6Zw5HZsWC66sONX2cYe9F/TJncghKTI0YWXF1httjhbfJsvIPQiUXRHBx0UmP v1o920nPLLA3VJlIm5WtL4DRuBwfrtJWqIX9qRJUXEzdGxewHWxnzxsP7JuvGx7If1O3VK9UZFFfG HJJ8uz9YadN/80JxF5Mg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nD3C9-00FX69-UA; Thu, 27 Jan 2022 11:44:06 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nD3BL-00FWli-WF; Thu, 27 Jan 2022 11:43:17 +0000 X-UUID: cb09727f9fff470c9800589f9ca6c361-20220127 X-UUID: cb09727f9fff470c9800589f9ca6c361-20220127 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 774251508; Thu, 27 Jan 2022 04:43:14 -0700 Received: from mtkmbs10n2.mediatek.inc (172.21.101.183) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 27 Jan 2022 03:43:12 -0800 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.3; Thu, 27 Jan 2022 19:43:10 +0800 Received: from mszsdaap41.gcn.mediatek.inc (10.16.6.141) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 27 Jan 2022 19:43:10 +0800 From: To: , , , , CC: , , , , , , xinlei lee Subject: [v1, 3/3] drm/mediatek: Move the getting bridge node function to mtk_dsi_bind Date: Thu, 27 Jan 2022 19:42:53 +0800 Message-ID: <1643283773-7081-4-git-send-email-xinlei.lee@mediatek.com> X-Mailer: git-send-email 2.6.4 In-Reply-To: <1643283773-7081-1-git-send-email-xinlei.lee@mediatek.com> References: <1643283773-7081-1-git-send-email-xinlei.lee@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220127_034316_124892_2DAED3B0 X-CRM114-Status: GOOD ( 13.02 ) 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 From: xinlei lee The order of probe function for bridge drivers and dsi drivers is uncertain. To avoid the dsi probe cannot be executed, we place getting bridge node function in mtk_dsi_bind. Signed-off-by:Xinlei Lee --- drivers/gpu/drm/mediatek/mtk_dsi.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c index 62af60d..a390f26 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -991,6 +991,21 @@ 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; + + ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0, + &panel, &dsi->next_bridge); + if (ret) + return ret; + + if (panel) { + dsi->next_bridge = devm_drm_panel_bridge_add(dev, panel); + if (IS_ERR(dsi->next_bridge)) { + ret = PTR_ERR(dsi->next_bridge); + dev_err(dev, "failed to add bridge: %d\n", ret); + return ret; + } + } ret = mtk_dsi_encoder_init(drm, dsi); if (ret) @@ -1016,7 +1031,6 @@ 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 ret; @@ -1033,19 +1047,6 @@ static int mtk_dsi_probe(struct platform_device *pdev) return ret; } - ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0, - &panel, &dsi->next_bridge); - if (ret) - goto err_unregister_host; - - if (panel) { - dsi->next_bridge = devm_drm_panel_bridge_add(dev, panel); - if (IS_ERR(dsi->next_bridge)) { - ret = PTR_ERR(dsi->next_bridge); - goto err_unregister_host; - } - } - dsi->driver_data = of_device_get_match_data(dev); dsi->engine_clk = devm_clk_get(dev, "engine");