[PATCH v10 06/11] drm/sun4i: dsi: Probe tcon0 during dsi_bind

From: Jagan Teki
Date: Mon May 20 2019 - 05:10:07 EST


Probe tcon0 during dsi_bind, so-that the tcon attributes like
divider value, clock rates are available whenever it required.

Tested-by: Merlijn Wajer <merlijn@xxxxxxxxxx>
Signed-off-by: Jagan Teki <jagan@xxxxxxxxxxxxxxxxxxxx>
---
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 6 ++++++
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 1 +
2 files changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index 47d571d97600..1f9ed2642a47 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -1045,6 +1045,7 @@ static int sun6i_dsi_bind(struct device *dev, struct device *master,
struct drm_device *drm = data;
struct sun4i_drv *drv = drm->dev_private;
struct sun6i_dsi *dsi = dev_get_drvdata(dev);
+ struct sun4i_tcon *tcon0 = sun4i_get_tcon0(drm);
int ret;

if (!(dsi->panel || dsi->bridge)) {
@@ -1054,6 +1055,11 @@ static int sun6i_dsi_bind(struct device *dev, struct device *master,

dsi->drv = drv;

+ if (!tcon0)
+ return -EINVAL;
+
+ dsi->tcon = tcon0;
+
drm_encoder_helper_add(&dsi->encoder,
&sun6i_dsi_enc_helper_funcs);
ret = drm_encoder_init(drm,
diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h
index 9c140f55b822..f2826e3ea165 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h
@@ -28,6 +28,7 @@ struct sun6i_dsi {

struct device *dev;
struct sun4i_drv *drv;
+ struct sun4i_tcon *tcon;
struct mipi_dsi_device *device;
struct drm_panel *panel;
struct drm_bridge *bridge;
--
2.18.0.321.gffc6fa0e3