diff options
author | Darren Etheridge <detheridge@ti.com> | 2013-06-21 14:52:23 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2013-06-27 19:12:23 -0400 |
commit | 4e5643468715260209e42b715e8cd9643456d2bd (patch) | |
tree | be1c3dace6b7c53cfe8b928acca2f13ffe79f487 /drivers/gpu/drm/tilcdc | |
parent | 6bf02c66b97379609a05bc715b96f874f2cefb33 (diff) |
drm/tilcdc: adding some more devicetree config
Adding support for max-pixelclock and max-width device tree
entries. As some devices that use the tilcdc hardware module
have restrictions on the allowed/tested values. Also update DT
bindings document to reflect new parameters.
Signed-off-by: Darren Etheridge <detheridge@ti.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/tilcdc')
-rw-r--r-- | drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 23 | ||||
-rw-r--r-- | drivers/gpu/drm/tilcdc/tilcdc_drv.c | 15 | ||||
-rw-r--r-- | drivers/gpu/drm/tilcdc/tilcdc_drv.h | 22 |
3 files changed, 57 insertions, 3 deletions
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c index 5b68fe59e437..b5b865f4f92b 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c | |||
@@ -443,10 +443,29 @@ int tilcdc_crtc_mode_valid(struct drm_crtc *crtc, struct drm_display_mode *mode) | |||
443 | if (mode->vdisplay > 2048) | 443 | if (mode->vdisplay > 2048) |
444 | return MODE_VIRTUAL_Y; | 444 | return MODE_VIRTUAL_Y; |
445 | 445 | ||
446 | /* | ||
447 | * some devices have a maximum allowed pixel clock | ||
448 | * configured from the DT | ||
449 | */ | ||
450 | if (mode->clock > priv->max_pixelclock) { | ||
451 | DBG("Pruning mode, pixel clock too high"); | ||
452 | return MODE_CLOCK_HIGH; | ||
453 | } | ||
454 | |||
455 | /* | ||
456 | * some devices further limit the max horizontal resolution | ||
457 | * configured from the DT | ||
458 | */ | ||
459 | if (mode->hdisplay > priv->max_width) | ||
460 | return MODE_BAD_WIDTH; | ||
461 | |||
446 | /* filter out modes that would require too much memory bandwidth: */ | 462 | /* filter out modes that would require too much memory bandwidth: */ |
447 | bandwidth = mode->hdisplay * mode->vdisplay * drm_mode_vrefresh(mode); | 463 | bandwidth = mode->hdisplay * mode->vdisplay * |
448 | if (bandwidth > priv->max_bandwidth) | 464 | drm_mode_vrefresh(mode); |
465 | if (bandwidth > priv->max_bandwidth) { | ||
466 | DBG("Pruning mode, exceeds defined bandwidth limit"); | ||
449 | return MODE_BAD; | 467 | return MODE_BAD; |
468 | } | ||
450 | 469 | ||
451 | return MODE_OK; | 470 | return MODE_OK; |
452 | } | 471 | } |
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index f2a6528ddef0..1e8f273f7c8b 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c | |||
@@ -212,7 +212,20 @@ static int tilcdc_load(struct drm_device *dev, unsigned long flags) | |||
212 | #endif | 212 | #endif |
213 | 213 | ||
214 | if (of_property_read_u32(node, "max-bandwidth", &priv->max_bandwidth)) | 214 | if (of_property_read_u32(node, "max-bandwidth", &priv->max_bandwidth)) |
215 | priv->max_bandwidth = 1280 * 1024 * 60; | 215 | priv->max_bandwidth = TILCDC_DEFAULT_MAX_BANDWIDTH; |
216 | |||
217 | DBG("Maximum Bandwidth Value %d", priv->max_bandwidth); | ||
218 | |||
219 | if (of_property_read_u32(node, "ti,max-width", &priv->max_width)) | ||
220 | priv->max_width = TILCDC_DEFAULT_MAX_WIDTH; | ||
221 | |||
222 | DBG("Maximum Horizontal Pixel Width Value %dpixels", priv->max_width); | ||
223 | |||
224 | if (of_property_read_u32(node, "ti,max-pixelclock", | ||
225 | &priv->max_pixelclock)) | ||
226 | priv->max_pixelclock = TILCDC_DEFAULT_MAX_PIXELCLOCK; | ||
227 | |||
228 | DBG("Maximum Pixel Clock Value %dKHz", priv->max_pixelclock); | ||
216 | 229 | ||
217 | pm_runtime_enable(dev->dev); | 230 | pm_runtime_enable(dev->dev); |
218 | 231 | ||
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.h b/drivers/gpu/drm/tilcdc/tilcdc_drv.h index 090684341fdb..66df316ca434 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.h +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.h | |||
@@ -34,6 +34,18 @@ | |||
34 | #include <drm/drm_gem_cma_helper.h> | 34 | #include <drm/drm_gem_cma_helper.h> |
35 | #include <drm/drm_fb_cma_helper.h> | 35 | #include <drm/drm_fb_cma_helper.h> |
36 | 36 | ||
37 | /* Defaulting to pixel clock defined on AM335x */ | ||
38 | #define TILCDC_DEFAULT_MAX_PIXELCLOCK 126000 | ||
39 | /* Defaulting to max width as defined on AM335x */ | ||
40 | #define TILCDC_DEFAULT_MAX_WIDTH 2048 | ||
41 | /* | ||
42 | * This may need some tweaking, but want to allow at least 1280x1024@60 | ||
43 | * with optimized DDR & EMIF settings tweaked 1920x1080@24 appears to | ||
44 | * be supportable | ||
45 | */ | ||
46 | #define TILCDC_DEFAULT_MAX_BANDWIDTH (1280*1024*60) | ||
47 | |||
48 | |||
37 | struct tilcdc_drm_private { | 49 | struct tilcdc_drm_private { |
38 | void __iomem *mmio; | 50 | void __iomem *mmio; |
39 | 51 | ||
@@ -43,6 +55,16 @@ struct tilcdc_drm_private { | |||
43 | 55 | ||
44 | /* don't attempt resolutions w/ higher W * H * Hz: */ | 56 | /* don't attempt resolutions w/ higher W * H * Hz: */ |
45 | uint32_t max_bandwidth; | 57 | uint32_t max_bandwidth; |
58 | /* | ||
59 | * Pixel Clock will be restricted to some value as | ||
60 | * defined in the device datasheet measured in KHz | ||
61 | */ | ||
62 | uint32_t max_pixelclock; | ||
63 | /* | ||
64 | * Max allowable width is limited on a per device basis | ||
65 | * measured in pixels | ||
66 | */ | ||
67 | uint32_t max_width; | ||
46 | 68 | ||
47 | /* register contents saved across suspend/resume: */ | 69 | /* register contents saved across suspend/resume: */ |
48 | u32 saved_register[12]; | 70 | u32 saved_register[12]; |