summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
diff options
context:
space:
mode:
authorDarren Etheridge <detheridge@ti.com>2013-06-21 13:52:23 -0500
committerDave Airlie <airlied@redhat.com>2013-06-28 09:12:23 +1000
commit4e5643468715260209e42b715e8cd9643456d2bd (patch)
treebe1c3dace6b7c53cfe8b928acca2f13ffe79f487 /drivers/gpu/drm/tilcdc/tilcdc_crtc.c
parent6bf02c66b97379609a05bc715b96f874f2cefb33 (diff)
downloadlinux-4e5643468715260209e42b715e8cd9643456d2bd.tar.gz
linux-4e5643468715260209e42b715e8cd9643456d2bd.tar.bz2
linux-4e5643468715260209e42b715e8cd9643456d2bd.zip
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/tilcdc_crtc.c')
-rw-r--r--drivers/gpu/drm/tilcdc/tilcdc_crtc.c23
1 files changed, 21 insertions, 2 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)
if (mode->vdisplay > 2048)
return MODE_VIRTUAL_Y;
+ /*
+ * some devices have a maximum allowed pixel clock
+ * configured from the DT
+ */
+ if (mode->clock > priv->max_pixelclock) {
+ DBG("Pruning mode, pixel clock too high");
+ return MODE_CLOCK_HIGH;
+ }
+
+ /*
+ * some devices further limit the max horizontal resolution
+ * configured from the DT
+ */
+ if (mode->hdisplay > priv->max_width)
+ return MODE_BAD_WIDTH;
+
/* filter out modes that would require too much memory bandwidth: */
- bandwidth = mode->hdisplay * mode->vdisplay * drm_mode_vrefresh(mode);
- if (bandwidth > priv->max_bandwidth)
+ bandwidth = mode->hdisplay * mode->vdisplay *
+ drm_mode_vrefresh(mode);
+ if (bandwidth > priv->max_bandwidth) {
+ DBG("Pruning mode, exceeds defined bandwidth limit");
return MODE_BAD;
+ }
return MODE_OK;
}