OMAP: DSS2: Create an enum for DSI pixel formats
authorArchit Taneja <archit@ti.com>
Thu, 8 Sep 2011 13:12:16 +0000 (18:42 +0530)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 30 Sep 2011 13:16:29 +0000 (16:16 +0300)
Currently, DSI pixel info is only represented by the pixel size in bits using
the pixel_size parameter in omap_dss_device struct's ctrl member.

This is not sufficient information for DSI video mode usage, as two of the
supported formats(RGB666 loosely packed, and RGB888) have the same pixel
container size, but different data_type values for the video mode packet header.

Create enum "omap_dss_dsi_pixel_format" which describes the pixel data format
the panel is configured for. Create helper function dsi_get_pixel_size() which
returns the pixel size of the given pixel format.

Modify functions omapdss_default_get_recommended_bpp() and dss_use_replication()
to use dsi_get_pixel_size().

Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/video/omap2/displays/panel-taal.c
drivers/video/omap2/dss/display.c
drivers/video/omap2/dss/dsi.c
drivers/video/omap2/dss/dss.h
include/video/omapdss.h

index 7675687c6fe4db09379a154e97bc60c12dc4cb9c..ddc696d52abe506a9deebde43c07f5fe91c20c1e 100644 (file)
@@ -976,7 +976,7 @@ static int taal_probe(struct omap_dss_device *dssdev)
 
        dssdev->panel.config = OMAP_DSS_LCD_TFT;
        dssdev->panel.timings = panel_config->timings;
-       dssdev->ctrl.pixel_size = 24;
+       dssdev->panel.dsi_pix_fmt = OMAP_DSS_DSI_FMT_RGB888;
 
        td = kzalloc(sizeof(*td), GFP_KERNEL);
        if (!td) {
index 2c6e2bc5e207ed20481be0b0b452b8680bf7fb87..be331dc5a61bc04404f607c202315a26c668e50f 100644 (file)
@@ -299,11 +299,15 @@ int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev)
                        return 16;
 
        case OMAP_DISPLAY_TYPE_DBI:
-       case OMAP_DISPLAY_TYPE_DSI:
                if (dssdev->ctrl.pixel_size == 24)
                        return 24;
                else
                        return 16;
+       case OMAP_DISPLAY_TYPE_DSI:
+               if (dsi_get_pixel_size(dssdev->panel.dsi_pix_fmt) > 16)
+                       return 24;
+               else
+                       return 16;
        case OMAP_DISPLAY_TYPE_VENC:
        case OMAP_DISPLAY_TYPE_SDI:
        case OMAP_DISPLAY_TYPE_HDMI:
@@ -339,9 +343,11 @@ bool dss_use_replication(struct omap_dss_device *dssdev,
                bpp = 24;
                break;
        case OMAP_DISPLAY_TYPE_DBI:
-       case OMAP_DISPLAY_TYPE_DSI:
                bpp = dssdev->ctrl.pixel_size;
                break;
+       case OMAP_DISPLAY_TYPE_DSI:
+               bpp = dsi_get_pixel_size(dssdev->panel.dsi_pix_fmt);
+               break;
        default:
                BUG();
        }
index c2c2fa778b3931b6f8e89cb13d6dac9f12bc60c5..2b7d17b7812ccbb06ac74b94e849d303e781fe5b 100644 (file)
@@ -422,6 +422,21 @@ static inline int wait_for_bit_change(struct platform_device *dsidev,
        return value;
 }
 
+u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt)
+{
+       switch (fmt) {
+       case OMAP_DSS_DSI_FMT_RGB888:
+       case OMAP_DSS_DSI_FMT_RGB666:
+               return 24;
+       case OMAP_DSS_DSI_FMT_RGB666_PACKED:
+               return 18;
+       case OMAP_DSS_DSI_FMT_RGB565:
+               return 16;
+       default:
+               BUG();
+       }
+}
+
 #ifdef DEBUG
 static void dsi_perf_mark_setup(struct platform_device *dsidev)
 {
@@ -438,6 +453,7 @@ static void dsi_perf_mark_start(struct platform_device *dsidev)
 static void dsi_perf_show(struct platform_device *dsidev, const char *name)
 {
        struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
+       struct omap_dss_device *dssdev = dsi->update_region.device;
        ktime_t t, setup_time, trans_time;
        u32 total_bytes;
        u32 setup_us, trans_us, total_us;
@@ -461,7 +477,7 @@ static void dsi_perf_show(struct platform_device *dsidev, const char *name)
 
        total_bytes = dsi->update_region.w *
                dsi->update_region.h *
-               dsi->update_region.device->ctrl.pixel_size / 8;
+               dsi_get_pixel_size(dssdev->panel.dsi_pix_fmt) / 8;
 
        printk(KERN_INFO "DSI(%s): %u us + %u us = %u us (%uHz), "
                        "%u bytes, %u kbytes/sec\n",
@@ -3689,7 +3705,7 @@ static int dsi_proto_config(struct omap_dss_device *dssdev)
        dsi_set_lp_rx_timeout(dsidev, 0x1fff, true, true);
        dsi_set_hs_tx_timeout(dsidev, 0x1fff, true, true);
 
-       switch (dssdev->ctrl.pixel_size) {
+       switch (dsi_get_pixel_size(dssdev->panel.dsi_pix_fmt)) {
        case 16:
                buswidth = 0;
                break;
@@ -3814,7 +3830,7 @@ static void dsi_update_screen_dispc(struct omap_dss_device *dssdev,
 
        dsi_vc_config_source(dsidev, channel, DSI_VC_SOURCE_VP);
 
-       bytespp = dssdev->ctrl.pixel_size / 8;
+       bytespp = dsi_get_pixel_size(dssdev->panel.dsi_pix_fmt) / 8;
        bytespl = w * bytespp;
        bytespf = bytespl * h;
 
@@ -4023,7 +4039,7 @@ static int dsi_display_init_dispc(struct omap_dss_device *dssdev)
        dispc_mgr_enable_fifohandcheck(dssdev->manager->id, 1);
 
        dispc_mgr_set_tft_data_lines(dssdev->manager->id,
-                       dssdev->ctrl.pixel_size);
+                       dsi_get_pixel_size(dssdev->panel.dsi_pix_fmt));
 
        {
                struct omap_video_timings timings = {
index f4196f5d70019f5b82cda28cdef18635ee522206..eb716521d77562e80054fa7ae0766f9874d9d7d2 100644 (file)
@@ -282,6 +282,8 @@ void dsi_create_debugfs_files_reg(struct dentry *debugfs_dir,
 
 int dsi_init_display(struct omap_dss_device *display);
 void dsi_irq_handler(void);
+u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt);
+
 unsigned long dsi_get_pll_hsdiv_dispc_rate(struct platform_device *dsidev);
 int dsi_pll_set_clock_div(struct platform_device *dsidev,
                struct dsi_clock_info *cinfo);
@@ -312,6 +314,11 @@ static inline int dsi_runtime_get(struct platform_device *dsidev)
 static inline void dsi_runtime_put(struct platform_device *dsidev)
 {
 }
+static inline u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt)
+{
+       WARN("%s: DSI not compiled in, returning pixel_size as 0\n", __func__);
+       return 0;
+}
 static inline unsigned long dsi_get_pll_hsdiv_dispc_rate(struct platform_device *dsidev)
 {
        WARN("%s: DSI not compiled in, returning rate as 0\n", __func__);
index abe8b1e51529a27c365fe32262092a1510d5da91..89a9c290cf5d1942d3d1607a2c076fb26aa434a4 100644 (file)
@@ -129,6 +129,13 @@ enum omap_dss_venc_type {
        OMAP_DSS_VENC_TYPE_SVIDEO,
 };
 
+enum omap_dss_dsi_pixel_format {
+       OMAP_DSS_DSI_FMT_RGB888,
+       OMAP_DSS_DSI_FMT_RGB666,
+       OMAP_DSS_DSI_FMT_RGB666_PACKED,
+       OMAP_DSS_DSI_FMT_RGB565,
+};
+
 enum omap_dss_dsi_mode {
        OMAP_DSS_DSI_CMD_MODE = 0,
        OMAP_DSS_DSI_VIDEO_MODE,
@@ -496,6 +503,7 @@ struct omap_dss_device {
 
                enum omap_panel_config config;
 
+               enum omap_dss_dsi_pixel_format dsi_pix_fmt;
                enum omap_dss_dsi_mode dsi_mode;
        } panel;