diff options
Diffstat (limited to 'drivers/gpu/drm/tilcdc/tilcdc_drv.c')
-rw-r--r-- | drivers/gpu/drm/tilcdc/tilcdc_drv.c | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index 2b5461bcd9fb..40b71da5a214 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include "drm_fb_helper.h" | 26 | #include "drm_fb_helper.h" |
27 | 27 | ||
28 | static LIST_HEAD(module_list); | 28 | static LIST_HEAD(module_list); |
29 | static bool slave_probing; | ||
29 | 30 | ||
30 | void tilcdc_module_init(struct tilcdc_module *mod, const char *name, | 31 | void tilcdc_module_init(struct tilcdc_module *mod, const char *name, |
31 | const struct tilcdc_module_ops *funcs) | 32 | const struct tilcdc_module_ops *funcs) |
@@ -41,6 +42,11 @@ void tilcdc_module_cleanup(struct tilcdc_module *mod) | |||
41 | list_del(&mod->list); | 42 | list_del(&mod->list); |
42 | } | 43 | } |
43 | 44 | ||
45 | void tilcdc_slave_probedefer(bool defered) | ||
46 | { | ||
47 | slave_probing = defered; | ||
48 | } | ||
49 | |||
44 | static struct of_device_id tilcdc_of_match[]; | 50 | static struct of_device_id tilcdc_of_match[]; |
45 | 51 | ||
46 | static struct drm_framebuffer *tilcdc_fb_create(struct drm_device *dev, | 52 | static struct drm_framebuffer *tilcdc_fb_create(struct drm_device *dev, |
@@ -157,7 +163,9 @@ static int tilcdc_load(struct drm_device *dev, unsigned long flags) | |||
157 | struct platform_device *pdev = dev->platformdev; | 163 | struct platform_device *pdev = dev->platformdev; |
158 | struct device_node *node = pdev->dev.of_node; | 164 | struct device_node *node = pdev->dev.of_node; |
159 | struct tilcdc_drm_private *priv; | 165 | struct tilcdc_drm_private *priv; |
166 | struct tilcdc_module *mod; | ||
160 | struct resource *res; | 167 | struct resource *res; |
168 | u32 bpp = 0; | ||
161 | int ret; | 169 | int ret; |
162 | 170 | ||
163 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | 171 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
@@ -210,7 +218,20 @@ static int tilcdc_load(struct drm_device *dev, unsigned long flags) | |||
210 | #endif | 218 | #endif |
211 | 219 | ||
212 | if (of_property_read_u32(node, "max-bandwidth", &priv->max_bandwidth)) | 220 | if (of_property_read_u32(node, "max-bandwidth", &priv->max_bandwidth)) |
213 | priv->max_bandwidth = 1280 * 1024 * 60; | 221 | priv->max_bandwidth = TILCDC_DEFAULT_MAX_BANDWIDTH; |
222 | |||
223 | DBG("Maximum Bandwidth Value %d", priv->max_bandwidth); | ||
224 | |||
225 | if (of_property_read_u32(node, "ti,max-width", &priv->max_width)) | ||
226 | priv->max_width = TILCDC_DEFAULT_MAX_WIDTH; | ||
227 | |||
228 | DBG("Maximum Horizontal Pixel Width Value %dpixels", priv->max_width); | ||
229 | |||
230 | if (of_property_read_u32(node, "ti,max-pixelclock", | ||
231 | &priv->max_pixelclock)) | ||
232 | priv->max_pixelclock = TILCDC_DEFAULT_MAX_PIXELCLOCK; | ||
233 | |||
234 | DBG("Maximum Pixel Clock Value %dKHz", priv->max_pixelclock); | ||
214 | 235 | ||
215 | pm_runtime_enable(dev->dev); | 236 | pm_runtime_enable(dev->dev); |
216 | 237 | ||
@@ -256,7 +277,15 @@ static int tilcdc_load(struct drm_device *dev, unsigned long flags) | |||
256 | 277 | ||
257 | platform_set_drvdata(pdev, dev); | 278 | platform_set_drvdata(pdev, dev); |
258 | 279 | ||
259 | priv->fbdev = drm_fbdev_cma_init(dev, 16, | 280 | |
281 | list_for_each_entry(mod, &module_list, list) { | ||
282 | DBG("%s: preferred_bpp: %d", mod->name, mod->preferred_bpp); | ||
283 | bpp = mod->preferred_bpp; | ||
284 | if (bpp > 0) | ||
285 | break; | ||
286 | } | ||
287 | |||
288 | priv->fbdev = drm_fbdev_cma_init(dev, bpp, | ||
260 | dev->mode_config.num_crtc, | 289 | dev->mode_config.num_crtc, |
261 | dev->mode_config.num_connector); | 290 | dev->mode_config.num_connector); |
262 | 291 | ||
@@ -557,6 +586,10 @@ static int tilcdc_pdev_probe(struct platform_device *pdev) | |||
557 | return -ENXIO; | 586 | return -ENXIO; |
558 | } | 587 | } |
559 | 588 | ||
589 | /* defer probing if slave is in deferred probing */ | ||
590 | if (slave_probing == true) | ||
591 | return -EPROBE_DEFER; | ||
592 | |||
560 | return drm_platform_init(&tilcdc_driver, pdev); | 593 | return drm_platform_init(&tilcdc_driver, pdev); |
561 | } | 594 | } |
562 | 595 | ||