Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3534158yba; Tue, 7 May 2019 02:53:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqw1eNx8T6eEplovCZ+zFyaVasj73havH5RExEnSwjxH1CUPxzt9ld4L+Jea48aDpzEXMYNg X-Received: by 2002:a63:e003:: with SMTP id e3mr39236057pgh.0.1557222814961; Tue, 07 May 2019 02:53:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557222814; cv=none; d=google.com; s=arc-20160816; b=0CfXBfHpYMr+DkQ8gZOt7q5NEQR0K+rhb4++BfkM9Qz+MtaWEKbGXbeFYa815cjl5K LrtPoX9q499UUaAEjh7ocD3I7MovF1SX2UDnFce13uiyiiYcNZZKEQycwsTVor2JleGO Xs/vHOidOrERRT+2l6sGCmdYy5bXPPUO77CJVRlOqFOc3ENzvc9Q/ig/72d7uauO7YhY 2hE30SaohqyqEc3oTs0wP8k3mS9HDNfVo5TNkjCtwAE/TykhFNPcnUyEgdU2rcrleRbb oSUvIRzFOSaFExyDb/2Argb32wpXhhYx1ZyZA4akc9HQCq33XG1/nh8rbkhQla3Cxk+V y5lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=0q0plVKGrnOzaqsSw1+4bz+uENxE+a+Qs9thoJEzvdk=; b=I5bEtoEfiFmW2Tu79VQHZ9i33BAVx/q0VCnzt1MGzgvaPMt24vSDk9dUt+dFQzvpu/ 5dUqtd+nevd3zq8lElOJiIBG9iPXlryVLG4KegJtCgDYznJC6wg5v+/F7sXMDUdYwiT5 gO24DK5kkSOEsj6bHimlgpB3I/DEXPxtSwjY7fIuMJKQgXOM5t8t4W8m/1XuqF8Bc/fn 9zlvdfmUbLvGNcBYBr6Way/h5iiviou8I0QYG4zs3jRFCDCxEQrrCNk2dHDT/jrVJZ8j 7kOvK0lyfq3ewX6e2i4JvWBwv5/CEUi0NmVpahcg5FbOw/1x3F5qqpkQH3m6Y+gpG/Sy Vaiw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u6si19369802pgj.225.2019.05.07.02.53.19; Tue, 07 May 2019 02:53:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726953AbfEGJw2 (ORCPT + 99 others); Tue, 7 May 2019 05:52:28 -0400 Received: from Mailgw01.mediatek.com ([1.203.163.78]:8473 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726063AbfEGJw2 (ORCPT ); Tue, 7 May 2019 05:52:28 -0400 X-UUID: 703808d8e3e34ab59b7730dc354c3c30-20190507 X-UUID: 703808d8e3e34ab59b7730dc354c3c30-20190507 Received: from mtkcas34.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 1425543058; Tue, 07 May 2019 17:52:18 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by MTKMBS33N1.mediatek.inc (172.27.4.75) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 7 May 2019 17:52:15 +0800 Received: from [172.21.77.4] (172.21.77.4) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 7 May 2019 17:52:15 +0800 Message-ID: <1557222735.3498.11.camel@mtksdaap41> Subject: Re: [v2 1/5] drm/mediatek: move mipi_dsi_host_register to probe From: CK Hu To: Jitao Shi CC: Rob Herring , Pawel Moll , "Mark Rutland" , Ian Campbell , Kumar Gala , , David Airlie , "Matthias Brugger" , Thierry Reding , "Ajay Kumar" , Inki Dae , "Rahul Sharma" , Sean Paul , Vincent Palatin , Andy Yan , Philipp Zabel , "Russell King" , , , , , , , Sascha Hauer , , , , , Date: Tue, 7 May 2019 17:52:15 +0800 In-Reply-To: <20190416060501.76276-2-jitao.shi@mediatek.com> References: <20190416060501.76276-1-jitao.shi@mediatek.com> <20190416060501.76276-2-jitao.shi@mediatek.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Jitao: On Tue, 2019-04-16 at 14:04 +0800, Jitao Shi wrote: > DSI panel driver need attach function which is inculde in > mipi_dsi_host_ops. > > If mipi_dsi_host_register is not in probe, dsi panel will > probe fail or more delay. I think this patch just prevent delay, not to prevent dsi panel probe fail. In [1], you mention mipi_dsi_attach() is called in panel_simple_dsi_probe(), but panel_simple_dsi_probe() is trigger by mipi_dsi_host_register(), so the probe would success. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/panel/panel-simple.c?h=v5.0-rc6#n2987 > > So move the mipi_dsi_host_register to probe from bind. > > Signed-off-by: Jitao Shi > --- > drivers/gpu/drm/mediatek/mtk_dsi.c | 50 ++++++++++++++++++------------ > 1 file changed, 30 insertions(+), 20 deletions(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c > index b00eb2d2e086..6c4ac37f983d 100644 > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c > @@ -1045,12 +1045,6 @@ static int mtk_dsi_bind(struct device *dev, struct device *master, void *data) > return ret; > } > > - ret = mipi_dsi_host_register(&dsi->host); > - if (ret < 0) { > - dev_err(dev, "failed to register DSI host: %d\n", ret); > - goto err_ddp_comp_unregister; > - } > - > ret = mtk_dsi_create_conn_enc(drm, dsi); > if (ret) { > DRM_ERROR("Encoder create failed with %d\n", ret); > @@ -1060,8 +1054,6 @@ static int mtk_dsi_bind(struct device *dev, struct device *master, void *data) > return 0; > > err_unregister: > - mipi_dsi_host_unregister(&dsi->host); > -err_ddp_comp_unregister: > mtk_ddp_comp_unregister(drm, &dsi->ddp_comp); > return ret; > } > @@ -1097,31 +1089,37 @@ static int mtk_dsi_probe(struct platform_device *pdev) > > dsi->host.ops = &mtk_dsi_ops; > dsi->host.dev = dev; > + dsi->dev = dev; Why do this? Regards, CK > + ret = mipi_dsi_host_register(&dsi->host); > + if (ret < 0) { > + dev_err(dev, "failed to register DSI host: %d\n", ret); > + return ret; > + } > > ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0, > &dsi->panel, &dsi->bridge); > if (ret) > - return ret; > + goto err_unregister_host; > > dsi->engine_clk = devm_clk_get(dev, "engine"); > if (IS_ERR(dsi->engine_clk)) { > ret = PTR_ERR(dsi->engine_clk); > dev_err(dev, "Failed to get engine clock: %d\n", ret); > - return ret; > + goto err_unregister_host; > } > > dsi->digital_clk = devm_clk_get(dev, "digital"); > if (IS_ERR(dsi->digital_clk)) { > ret = PTR_ERR(dsi->digital_clk); > dev_err(dev, "Failed to get digital clock: %d\n", ret); > - return ret; > + goto err_unregister_host; > } > > dsi->hs_clk = devm_clk_get(dev, "hs"); > if (IS_ERR(dsi->hs_clk)) { > ret = PTR_ERR(dsi->hs_clk); > dev_err(dev, "Failed to get hs clock: %d\n", ret); > - return ret; > + goto err_unregister_host; > } > > regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);