OMAP: DSS2: Clean up stallmode and io pad mode selection
authorArchit Taneja <archit@ti.com>
Mon, 22 Aug 2011 12:11:57 +0000 (17:41 +0530)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 30 Sep 2011 13:16:28 +0000 (16:16 +0300)
Split the function dispc_set_parallel_interface_mode() into 2 separate
functions called dispc_mgr_set_io_pad_mode() and dispc_mgr_enable_stallmode().
The current function tries to set 2 different modes(io pad mode and stall mode)
based on a parameter omap_parallel_interface_mode which loosely corresponds to
the panel interface type.

This isn't correct because a) these 2 modes are independent to some extent,
b) we are currently configuring gpout0/gpout1 for DSI panels which is
unnecessary, c) a DSI Video mode panel won't get configured correctly.

Splitting the functions allows the interface driver to set these modes
independently and hence allow more flexibility.

Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/video/omap2/dss/dispc.c
drivers/video/omap2/dss/dpi.c
drivers/video/omap2/dss/dsi.c
drivers/video/omap2/dss/dss.h
drivers/video/omap2/dss/rfbi.c
drivers/video/omap2/dss/sdi.c

index de209361c2d986fe81612c5d6c28ecc118df50d2..b4a16cf9be1ccf52670a5f3a380f43359060134c 100644 (file)
@@ -2205,46 +2205,41 @@ void dispc_mgr_set_tft_data_lines(enum omap_channel channel, u8 data_lines)
                REG_FLD_MOD(DISPC_CONTROL, code, 9, 8);
 }
 
-void dispc_mgr_set_parallel_interface_mode(enum omap_channel channel,
-               enum omap_parallel_interface_mode mode)
+void dispc_mgr_set_io_pad_mode(enum dss_io_pad_mode mode)
 {
        u32 l;
-       int stallmode;
-       int gpout0 = 1;
-       int gpout1;
+       int gpout0, gpout1;
 
        switch (mode) {
-       case OMAP_DSS_PARALLELMODE_BYPASS:
-               stallmode = 0;
-               gpout1 = 1;
+       case DSS_IO_PAD_MODE_RESET:
+               gpout0 = 0;
+               gpout1 = 0;
                break;
-
-       case OMAP_DSS_PARALLELMODE_RFBI:
-               stallmode = 1;
+       case DSS_IO_PAD_MODE_RFBI:
+               gpout0 = 1;
                gpout1 = 0;
                break;
-
-       case OMAP_DSS_PARALLELMODE_DSI:
-               stallmode = 1;
+       case DSS_IO_PAD_MODE_BYPASS:
+               gpout0 = 1;
                gpout1 = 1;
                break;
-
        default:
                BUG();
                return;
        }
 
-       if (channel == OMAP_DSS_CHANNEL_LCD2) {
-               l = dispc_read_reg(DISPC_CONTROL2);
-               l = FLD_MOD(l, stallmode, 11, 11);
-               dispc_write_reg(DISPC_CONTROL2, l);
-       } else {
-               l = dispc_read_reg(DISPC_CONTROL);
-               l = FLD_MOD(l, stallmode, 11, 11);
-               l = FLD_MOD(l, gpout0, 15, 15);
-               l = FLD_MOD(l, gpout1, 16, 16);
-               dispc_write_reg(DISPC_CONTROL, l);
-       }
+       l = dispc_read_reg(DISPC_CONTROL);
+       l = FLD_MOD(l, gpout0, 15, 15);
+       l = FLD_MOD(l, gpout1, 16, 16);
+       dispc_write_reg(DISPC_CONTROL, l);
+}
+
+void dispc_mgr_enable_stallmode(enum omap_channel channel, bool enable)
+{
+       if (channel == OMAP_DSS_CHANNEL_LCD2)
+               REG_FLD_MOD(DISPC_CONTROL2, enable, 11, 11);
+       else
+               REG_FLD_MOD(DISPC_CONTROL, enable, 11, 11);
 }
 
 static bool _dispc_lcd_timings_ok(int hsw, int hfp, int hbp,
index 1edc832377f50a52a53f454e84e31808c8bb6c3e..483888a85cfdbb78d5101193f67d171cc21ca451 100644 (file)
@@ -166,8 +166,9 @@ static void dpi_basic_init(struct omap_dss_device *dssdev)
 
        is_tft = (dssdev->panel.config & OMAP_DSS_LCD_TFT) != 0;
 
-       dispc_mgr_set_parallel_interface_mode(dssdev->manager->id,
-                       OMAP_DSS_PARALLELMODE_BYPASS);
+       dispc_mgr_set_io_pad_mode(DSS_IO_PAD_MODE_BYPASS);
+       dispc_mgr_enable_stallmode(dssdev->manager->id, false);
+
        dispc_mgr_set_lcd_display_type(dssdev->manager->id, is_tft ?
                        OMAP_DSS_LCD_DISPLAY_TFT : OMAP_DSS_LCD_DISPLAY_STN);
        dispc_mgr_set_tft_data_lines(dssdev->manager->id,
index 20cad1b529bd6a08d061d6e39aeaeed24d06be88..c2c2fa778b3931b6f8e89cb13d6dac9f12bc60c5 100644 (file)
@@ -4019,8 +4019,7 @@ static int dsi_display_init_dispc(struct omap_dss_device *dssdev)
        dispc_mgr_set_lcd_display_type(dssdev->manager->id,
                        OMAP_DSS_LCD_DISPLAY_TFT);
 
-       dispc_mgr_set_parallel_interface_mode(dssdev->manager->id,
-                       OMAP_DSS_PARALLELMODE_DSI);
+       dispc_mgr_enable_stallmode(dssdev->manager->id, true);
        dispc_mgr_enable_fifohandcheck(dssdev->manager->id, 1);
 
        dispc_mgr_set_tft_data_lines(dssdev->manager->id,
index 3ec8dd7066a29bd3b2c9a0e61e80226fa92f6aa9..f4196f5d70019f5b82cda28cdef18635ee522206 100644 (file)
@@ -97,10 +97,10 @@ extern unsigned int dss_debug;
 #define FLD_MOD(orig, val, start, end) \
        (((orig) & ~FLD_MASK(start, end)) | FLD_VAL(val, start, end))
 
-enum omap_parallel_interface_mode {
-       OMAP_DSS_PARALLELMODE_BYPASS,           /* MIPI DPI */
-       OMAP_DSS_PARALLELMODE_RFBI,             /* MIPI DBI */
-       OMAP_DSS_PARALLELMODE_DSI,
+enum dss_io_pad_mode {
+       DSS_IO_PAD_MODE_RESET,
+       DSS_IO_PAD_MODE_RFBI,
+       DSS_IO_PAD_MODE_BYPASS,
 };
 
 enum dss_hdmi_venc_clk_source_select {
@@ -429,8 +429,8 @@ bool dispc_mgr_go_busy(enum omap_channel channel);
 void dispc_mgr_go(enum omap_channel channel);
 void dispc_mgr_enable(enum omap_channel channel, bool enable);
 bool dispc_mgr_is_channel_enabled(enum omap_channel channel);
-void dispc_mgr_set_parallel_interface_mode(enum omap_channel channel,
-               enum omap_parallel_interface_mode mode);
+void dispc_mgr_set_io_pad_mode(enum dss_io_pad_mode mode);
+void dispc_mgr_enable_stallmode(enum omap_channel channel, bool enable);
 void dispc_mgr_set_tft_data_lines(enum omap_channel channel, u8 data_lines);
 void dispc_mgr_set_lcd_display_type(enum omap_channel channel,
                enum omap_lcd_display_type type);
index b4a131a8d2ec38e1c8be0fcf8dbe56fc4935cf59..1bd3703e42ffef0c7e8368564a0c2f97007023fc 100644 (file)
@@ -868,8 +868,8 @@ int omapdss_rfbi_display_enable(struct omap_dss_device *dssdev)
        dispc_mgr_set_lcd_display_type(dssdev->manager->id,
                        OMAP_DSS_LCD_DISPLAY_TFT);
 
-       dispc_mgr_set_parallel_interface_mode(dssdev->manager->id,
-                       OMAP_DSS_PARALLELMODE_RFBI);
+       dispc_mgr_set_io_pad_mode(DSS_IO_PAD_MODE_RFBI);
+       dispc_mgr_enable_stallmode(dssdev->manager->id, true);
 
        dispc_mgr_set_tft_data_lines(dssdev->manager->id, dssdev->ctrl.pixel_size);
 
index e2f35c059afd2f4fc10c6628eea1c9e0e3a8d789..695dc04cabbae4a5ec42acda1dbf35850cb2d078 100644 (file)
@@ -35,8 +35,8 @@ static struct {
 static void sdi_basic_init(struct omap_dss_device *dssdev)
 
 {
-       dispc_mgr_set_parallel_interface_mode(dssdev->manager->id,
-                       OMAP_DSS_PARALLELMODE_BYPASS);
+       dispc_mgr_set_io_pad_mode(DSS_IO_PAD_MODE_BYPASS);
+       dispc_mgr_enable_stallmode(dssdev->manager->id, false);
 
        dispc_mgr_set_lcd_display_type(dssdev->manager->id,
                        OMAP_DSS_LCD_DISPLAY_TFT);