staging: imx_drm: imx_ldb: fix 18 bit format
authorMarkus Niebel <Markus.Niebel@tqs.de>
Tue, 18 Jun 2013 01:23:58 +0000 (09:23 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Jun 2013 18:22:58 +0000 (11:22 -0700)
Since 18 bit is supported as datawidth in device tree it should be
supported in driver. Beside the LDB channel the IPU channel has also
to be configured to use BGR666.

Signed-off-by: Markus Niebel <Markus.Niebel@tqs.de>
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/imx-drm/imx-ldb.c

index 75607b39d08b1be41b961cd9e7773e15468b064a..8af7f3b40baec4997422eb50912a10d1e80abf60 100644 (file)
@@ -177,6 +177,7 @@ static void imx_ldb_encoder_prepare(struct drm_encoder *encoder)
        struct imx_ldb_channel *imx_ldb_ch = enc_to_imx_ldb_ch(encoder);
        struct imx_ldb *ldb = imx_ldb_ch->ldb;
        struct drm_display_mode *mode = &encoder->crtc->mode;
+       u32 pixel_fmt;
        unsigned long serial_clk;
        unsigned long di_clk = mode->clock * 1000;
        int mux = imx_drm_encoder_get_mux_id(imx_ldb_ch->imx_drm_encoder,
@@ -192,8 +193,23 @@ static void imx_ldb_encoder_prepare(struct drm_encoder *encoder)
                imx_ldb_set_clock(ldb, mux, imx_ldb_ch->chno, serial_clk, di_clk);
        }
 
+       switch (imx_ldb_ch->chno) {
+       case 0:
+               pixel_fmt = (ldb->ldb_ctrl & LDB_DATA_WIDTH_CH0_24) ?
+                       V4L2_PIX_FMT_RGB24 : V4L2_PIX_FMT_BGR666;
+               break;
+       case 1:
+               pixel_fmt = (ldb->ldb_ctrl & LDB_DATA_WIDTH_CH1_24) ?
+                       V4L2_PIX_FMT_RGB24 : V4L2_PIX_FMT_BGR666;
+               break;
+       default:
+               dev_err(ldb->dev, "unable to config di%d panel format\n",
+                       imx_ldb_ch->chno);
+               pixel_fmt = V4L2_PIX_FMT_RGB24;
+       }
+
        imx_drm_crtc_panel_format(encoder->crtc, DRM_MODE_ENCODER_LVDS,
-                       V4L2_PIX_FMT_RGB24);
+                       pixel_fmt);
 }
 
 static void imx_ldb_encoder_commit(struct drm_encoder *encoder)