Message ID | 20190527045054.113259-2-hsinyi@chromium.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | fix mediatek drm, dis, and disp-* unbind/bind | expand |
Hi, Hsin-yi: On Mon, 2019-05-27 at 12:50 +0800, Hsin-Yi Wang wrote: > move mipi_dsi_host_unregister() to .remove since mipi_dsi_host_register() > is called in .probe. In the latest kernel [1], mipi_dsi_host_register() is called in mtk_dsi_bind(), I think we don't need this part. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/mediatek/mtk_dsi.c?h=v5.2-rc2 > > detatch panel in mtk_dsi_destroy_conn_enc(), since .bind will try to > attach it again. > > Fixes: 2e54c14e310f ("drm/mediatek: Add DSI sub driver") > Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org> > --- > drivers/gpu/drm/mediatek/mtk_dsi.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c > index b00eb2d2e086..c9b6d3a68c8b 100644 > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c > @@ -844,6 +844,8 @@ static void mtk_dsi_destroy_conn_enc(struct mtk_dsi *dsi) > /* 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); I think mtk_dsi_destroy_conn_enc() has much thing to do and I would like you to do more. You could refer to [2] for complete implementation. [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/exynos/exynos_drm_dsi.c?h=v5.2-rc2#n1575 Regards, CK > } > > static void mtk_dsi_ddp_start(struct mtk_ddp_comp *comp) > @@ -1073,7 +1075,6 @@ static void mtk_dsi_unbind(struct device *dev, struct device *master, > struct mtk_dsi *dsi = dev_get_drvdata(dev); > > mtk_dsi_destroy_conn_enc(dsi); > - mipi_dsi_host_unregister(&dsi->host); > mtk_ddp_comp_unregister(drm, &dsi->ddp_comp); > } > > @@ -1179,6 +1180,7 @@ static int mtk_dsi_remove(struct platform_device *pdev) > > mtk_output_dsi_disable(dsi); > component_del(&pdev->dev, &mtk_dsi_component_ops); > + mipi_dsi_host_unregister(&dsi->host); > > return 0; > }
On Wed, May 29, 2019 at 9:35 AM CK Hu <ck.hu@mediatek.com> wrote: > > Hi, Hsin-yi: > > On Mon, 2019-05-27 at 12:50 +0800, Hsin-Yi Wang wrote: > > move mipi_dsi_host_unregister() to .remove since mipi_dsi_host_register() > > is called in .probe. > > In the latest kernel [1], mipi_dsi_host_register() is called in > mtk_dsi_bind(), I think we don't need this part. > > [1] > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/mediatek/mtk_dsi.c?h=v5.2-rc2 This patch https://patchwork.kernel.org/patch/10949305/ moves mipi_dsi_host_register() from .bind to .probe. I'll reply there to ask the owner to do this. > > > > > detatch panel in mtk_dsi_destroy_conn_enc(), since .bind will try to > > attach it again. > > > > Fixes: 2e54c14e310f ("drm/mediatek: Add DSI sub driver") > > Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org> > > --- > > drivers/gpu/drm/mediatek/mtk_dsi.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c > > index b00eb2d2e086..c9b6d3a68c8b 100644 > > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c > > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c > > @@ -844,6 +844,8 @@ static void mtk_dsi_destroy_conn_enc(struct mtk_dsi *dsi) > > /* 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); > > I think mtk_dsi_destroy_conn_enc() has much thing to do and I would like > you to do more. You could refer to [2] for complete implementation. > > [2] > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/exynos/exynos_drm_dsi.c?h=v5.2-rc2#n1575 Will update in next version. Thanks
On Wed, May 29, 2019 at 9:35 AM CK Hu <ck.hu@mediatek.com> wrote: > > I think mtk_dsi_destroy_conn_enc() has much thing to do and I would like > you to do more. You could refer to [2] for complete implementation. > > [2] > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/exynos/exynos_drm_dsi.c?h=v5.2-rc2#n1575 > Hi CK, Since drm_encoder_cleanup() would already call drm_bridge_detach() to detach bridge, I think we only need to handle panel case here. We don't need to call mtk_dsi_encoder_disable() since mtk_output_dsi_disable() is called in mtk_dsi_remove() and dsi->enabled will be set to false. Calling second time will just returns immediately. So, besides setting dsi->panel = NULL; dsi->conn.status = connector_status_disconnected; are there other things we need to do here? Original code doesn't have drm_kms_helper_hotplug_event(), and I'm not sure if mtk dsi would need this. Also, mtk_dsi_stop() would also stop irq. Thanks
Hi, Hsin-Yi: On Wed, 2019-05-29 at 15:06 +0800, Hsin-Yi Wang wrote: > On Wed, May 29, 2019 at 9:35 AM CK Hu <ck.hu@mediatek.com> wrote: > > > > > I think mtk_dsi_destroy_conn_enc() has much thing to do and I would like > > you to do more. You could refer to [2] for complete implementation. > > > > [2] > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/exynos/exynos_drm_dsi.c?h=v5.2-rc2#n1575 > > > Hi CK, > > Since drm_encoder_cleanup() would already call drm_bridge_detach() to > detach bridge, I think we only need to handle panel case here. > We don't need to call mtk_dsi_encoder_disable() since > mtk_output_dsi_disable() is called in mtk_dsi_remove() and > dsi->enabled will be set to false. Calling second time will just > returns immediately. > So, besides setting > > dsi->panel = NULL; > dsi->conn.status = connector_status_disconnected; Sorry, I think your original patch is good enough, and you need not to do the besides setting. Regards, CK > > are there other things we need to do here? > > Original code doesn't have drm_kms_helper_hotplug_event(), and I'm not > sure if mtk dsi would need this. > Also, mtk_dsi_stop() would also stop irq. > > Thanks
diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c index b00eb2d2e086..c9b6d3a68c8b 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -844,6 +844,8 @@ static void mtk_dsi_destroy_conn_enc(struct mtk_dsi *dsi) /* 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) @@ -1073,7 +1075,6 @@ static void mtk_dsi_unbind(struct device *dev, struct device *master, struct mtk_dsi *dsi = dev_get_drvdata(dev); mtk_dsi_destroy_conn_enc(dsi); - mipi_dsi_host_unregister(&dsi->host); mtk_ddp_comp_unregister(drm, &dsi->ddp_comp); } @@ -1179,6 +1180,7 @@ static int mtk_dsi_remove(struct platform_device *pdev) mtk_output_dsi_disable(dsi); component_del(&pdev->dev, &mtk_dsi_component_ops); + mipi_dsi_host_unregister(&dsi->host); return 0; }
move mipi_dsi_host_unregister() to .remove since mipi_dsi_host_register() is called in .probe. detatch panel in mtk_dsi_destroy_conn_enc(), since .bind will try to attach it again. Fixes: 2e54c14e310f ("drm/mediatek: Add DSI sub driver") Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org> --- drivers/gpu/drm/mediatek/mtk_dsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)