[PATCH/RFC] drm: tilcdc: Evaluate pixelclk-active property from display-timings

Teresa Remmet t.remmet at phytec.de
Mon Aug 29 08:51:46 UTC 2016


The pixel clock "polarity" is set for tilcdc panels with
the invert-pxl-clk property. But if we have several display-timings
with different pixel clock setups we need to set the values depending
on the selected display-timing. Check for the pixelclk-active property
and invert the value if invert-pxl-clk is set. The pixelclk-active
is not included in the drm_display_mode and has to be taken from the
drm bus flags.

Signed-off-by: Teresa Remmet <t.remmet at phytec.de>
---
This is probably not the right way to go. As I just took some unused
private flag to pass the bus flags. I appreciate a hint to the right
direction.

Regards,
Teresa

 drivers/gpu/drm/tilcdc/tilcdc_crtc.c  | 13 ++++++++++++-
 drivers/gpu/drm/tilcdc/tilcdc_panel.c |  1 +
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
index 25d6b220..3334dd1 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
@@ -305,6 +305,7 @@ static void tilcdc_crtc_mode_set_nofb(struct drm_crtc *crtc)
 	uint32_t reg, hbp, hfp, hsw, vbp, vfp, vsw;
 	struct drm_display_mode *mode = &crtc->state->adjusted_mode;
 	struct drm_framebuffer *fb = crtc->primary->state->fb;
+	bool invert_pxlclk = 0;
 
 	if (WARN_ON(!info))
 		return;
@@ -424,7 +425,17 @@ static void tilcdc_crtc_mode_set_nofb(struct drm_crtc *crtc)
 	reg |= info->fdd < 12;
 	tilcdc_write(dev, LCDC_RASTER_CTRL_REG, reg);
 
-	if (info->invert_pxl_clk)
+	/* The invert_pxl_clk property sets up the pixel clock for all available
+	 * display-timings. But in some cases a per display-timing pixel clock
+	 * setup is needed. Check the "pixelclk-active" property and invert this
+	 * value if invert_pxl_clk is set.
+	 */
+	if (mode->private_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
+		invert_pxlclk = 1;
+
+	invert_pxlclk = (info->invert_pxl_clk ? !invert_pxlclk : invert_pxlclk);
+
+	if (invert_pxlclk)
 		tilcdc_set(dev, LCDC_RASTER_TIMING_2_REG, LCDC_INVERT_PIXEL_CLOCK);
 	else
 		tilcdc_clear(dev, LCDC_RASTER_TIMING_2_REG, LCDC_INVERT_PIXEL_CLOCK);
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
index 4ac1d25..2e12d871 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c
@@ -165,6 +165,7 @@ static int panel_connector_get_modes(struct drm_connector *connector)
 			break;
 
 		drm_display_mode_from_videomode(&vm, mode);
+		drm_bus_flags_from_videomode(&vm, &(mode->private_flags));
 
 		mode->type = DRM_MODE_TYPE_DRIVER;
 
-- 
1.9.1



More information about the dri-devel mailing list