Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Darren Etheridge and committed by
Dave Airlie
4e564346 6bf02c66

+65 -3
+8
Documentation/devicetree/bindings/drm/tilcdc/tilcdc.txt
··· 10 10 services interrupts for this device. 11 11 - ti,hwmods: Name of the hwmod associated to the LCDC 12 12 13 + Optional properties: 14 + - max-bandwidth: The maximum pixels per second that the memory 15 + interface / lcd controller combination can sustain 16 + - max-width: The maximum horizontal pixel width supported by 17 + the lcd controller. 18 + - max-pixelclock: The maximum pixel clock that can be supported 19 + by the lcd controller in KHz. 20 + 13 21 Example: 14 22 15 23 fb: fb@4830e000 {
+21 -2
drivers/gpu/drm/tilcdc/tilcdc_crtc.c
··· 443 443 if (mode->vdisplay > 2048) 444 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 462 /* filter out modes that would require too much memory bandwidth: */ 447 - bandwidth = mode->hdisplay * mode->vdisplay * drm_mode_vrefresh(mode); 448 - if (bandwidth > priv->max_bandwidth) 463 + bandwidth = mode->hdisplay * mode->vdisplay * 464 + drm_mode_vrefresh(mode); 465 + if (bandwidth > priv->max_bandwidth) { 466 + DBG("Pruning mode, exceeds defined bandwidth limit"); 449 467 return MODE_BAD; 468 + } 450 469 451 470 return MODE_OK; 452 471 }
+14 -1
drivers/gpu/drm/tilcdc/tilcdc_drv.c
··· 212 212 #endif 213 213 214 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 230 pm_runtime_enable(dev->dev); 218 231
+22
drivers/gpu/drm/tilcdc/tilcdc_drv.h
··· 34 34 #include <drm/drm_gem_cma_helper.h> 35 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 49 struct tilcdc_drm_private { 38 50 void __iomem *mmio; 39 51 ··· 55 43 56 44 /* don't attempt resolutions w/ higher W * H * Hz: */ 57 45 uint32_t max_bandwidth; 46 + /* 47 + * Pixel Clock will be restricted to some value as 48 + * defined in the device datasheet measured in KHz 49 + */ 50 + uint32_t max_pixelclock; 51 + /* 52 + * Max allowable width is limited on a per device basis 53 + * measured in pixels 54 + */ 55 + uint32_t max_width; 58 56 59 57 /* register contents saved across suspend/resume: */ 60 58 u32 saved_register[12];