aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxime Ripard <maxime.ripard@free-electrons.com>2016-07-20 04:35:06 -0400
committerMaxime Ripard <maxime.ripard@free-electrons.com>2016-08-22 09:34:16 -0400
commita8444c7ee2c02b567731a6edcd5d328f85aac1b1 (patch)
tree955b9c4e23adc51d594223e8b1a62c46351d23dc
parentae558110e51737b3596f400505ee598acbbf6713 (diff)
drm/sun4i: Move panel retrieval in RGB connector
In order to properly support bridges and use drm_encoder's bridge pointer, move the panel (and bridge eventually) retrieval code in the RGB output init function. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_rgb.c10
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_tcon.c8
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_tcon.h2
3 files changed, 9 insertions, 11 deletions
diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c b/drivers/gpu/drm/sun4i/sun4i_rgb.c
index f5bbac6efb4c..d32f08f9ce5f 100644
--- a/drivers/gpu/drm/sun4i/sun4i_rgb.c
+++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c
@@ -206,15 +206,17 @@ int sun4i_rgb_init(struct drm_device *drm)
206 struct sun4i_rgb *rgb; 206 struct sun4i_rgb *rgb;
207 int ret; 207 int ret;
208 208
209 /* If we don't have a panel, there's no point in going on */
210 if (IS_ERR(tcon->panel))
211 return -ENODEV;
212
213 rgb = devm_kzalloc(drm->dev, sizeof(*rgb), GFP_KERNEL); 209 rgb = devm_kzalloc(drm->dev, sizeof(*rgb), GFP_KERNEL);
214 if (!rgb) 210 if (!rgb)
215 return -ENOMEM; 211 return -ENOMEM;
216 rgb->drv = drv; 212 rgb->drv = drv;
217 213
214 tcon->panel = sun4i_tcon_find_panel(tcon->dev->of_node);
215 if (IS_ERR(tcon->panel)) {
216 dev_info(drm->dev, "No panel found... RGB output disabled\n");
217 return 0;
218 }
219
218 drm_encoder_helper_add(&rgb->encoder, 220 drm_encoder_helper_add(&rgb->encoder,
219 &sun4i_rgb_enc_helper_funcs); 221 &sun4i_rgb_enc_helper_funcs);
220 ret = drm_encoder_init(drm, 222 ret = drm_encoder_init(drm,
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index af136dfc206e..d2f7489d29a5 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -398,7 +398,7 @@ static int sun4i_tcon_init_regmap(struct device *dev,
398 return 0; 398 return 0;
399} 399}
400 400
401static struct drm_panel *sun4i_tcon_find_panel(struct device_node *node) 401struct drm_panel *sun4i_tcon_find_panel(struct device_node *node)
402{ 402{
403 struct device_node *port, *remote, *child; 403 struct device_node *port, *remote, *child;
404 struct device_node *end_node = NULL; 404 struct device_node *end_node = NULL;
@@ -485,12 +485,6 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
485 goto err_free_clocks; 485 goto err_free_clocks;
486 } 486 }
487 487
488 tcon->panel = sun4i_tcon_find_panel(dev->of_node);
489 if (IS_ERR(tcon->panel)) {
490 dev_info(dev, "No panel found... RGB output disabled\n");
491 return 0;
492 }
493
494 ret = sun4i_rgb_init(drm); 488 ret = sun4i_rgb_init(drm);
495 if (ret < 0) 489 if (ret < 0)
496 goto err_free_clocks; 490 goto err_free_clocks;
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h
index 230550b720f1..4f81d86ee5a4 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.h
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h
@@ -166,6 +166,8 @@ struct sun4i_tcon {
166 struct drm_panel *panel; 166 struct drm_panel *panel;
167}; 167};
168 168
169struct drm_panel *sun4i_tcon_find_panel(struct device_node *node);
170
169/* Global Control */ 171/* Global Control */
170void sun4i_tcon_disable(struct sun4i_tcon *tcon); 172void sun4i_tcon_disable(struct sun4i_tcon *tcon);
171void sun4i_tcon_enable(struct sun4i_tcon *tcon); 173void sun4i_tcon_enable(struct sun4i_tcon *tcon);