]> git.karo-electronics.de Git - linux-beck.git/commitdiff
OMAP: DSS2: move get_recommended_bpp()
authorTomi Valkeinen <tomi.valkeinen@nokia.com>
Mon, 11 Jan 2010 12:33:40 +0000 (14:33 +0200)
committerTomi Valkeinen <tomi.valkeinen@nokia.com>
Wed, 24 Feb 2010 12:31:27 +0000 (14:31 +0200)
Move get_recommended_bpp() from omap_dss_device to omap_dss_driver.

This is part of a larger patch-set, which moves the control from omapdss
driver to the display driver.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
arch/arm/plat-omap/include/plat/display.h
drivers/video/omap2/displays/panel-taal.c
drivers/video/omap2/dss/core.c
drivers/video/omap2/dss/display.c
drivers/video/omap2/dss/venc.c
drivers/video/omap2/omapfb/omapfb-main.c
drivers/video/omap2/omapfb/omapfb.h

index 70a9dd318ef9dea3678ceaf24df1846c017c0fa0..aadea59b69bc5342174635b349194190031dd744 100644 (file)
@@ -433,8 +433,6 @@ struct omap_dss_device {
                int acb;        /* ac-bias pin frequency */
 
                enum omap_panel_config config;
-
-               u8 recommended_bpp;
        } panel;
 
        struct {
@@ -470,8 +468,6 @@ struct omap_dss_device {
        int (*suspend)(struct omap_dss_device *dssdev);
        int (*resume)(struct omap_dss_device *dssdev);
 
-       int (*get_recommended_bpp)(struct omap_dss_device *dssdev);
-
        int (*check_timings)(struct omap_dss_device *dssdev,
                        struct omap_video_timings *timings);
        void (*set_timings)(struct omap_dss_device *dssdev,
@@ -530,6 +526,7 @@ struct omap_dss_driver {
 
        void (*get_resolution)(struct omap_dss_device *dssdev,
                        u16 *xres, u16 *yres);
+       int (*get_recommended_bpp)(struct omap_dss_device *dssdev);
 };
 
 int omap_dss_register_driver(struct omap_dss_driver *);
@@ -556,6 +553,8 @@ struct omap_overlay *omap_dss_get_overlay(int num);
 
 void omapdss_default_get_resolution(struct omap_dss_device *dssdev,
                u16 *xres, u16 *yres);
+int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev);
+
 typedef void (*omap_dispc_isr_t) (void *arg, u32 mask);
 int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
 int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
index 11d69b67a903a7d53ddc97dedec5ca0fb9e701d5..e00502ea46e58d91dfc9a6981d721862c3a935a8 100644 (file)
@@ -990,6 +990,8 @@ static struct omap_dss_driver taal_driver = {
 
        .setup_update   = taal_setup_update,
        .get_resolution = taal_get_resolution,
+       .get_recommended_bpp = omapdss_default_get_recommended_bpp,
+
        .enable_te      = taal_enable_te,
        .wait_for_te    = taal_wait_te,
        .set_rotate     = taal_rotate,
index 2e6ce835ae5cde2b6271b318e3a6089a62d59f4a..7ebe50b335ed963fce253779b4a5610bb1d0c1a1 100644 (file)
@@ -814,6 +814,9 @@ int omap_dss_register_driver(struct omap_dss_driver *dssdriver)
 
        if (dssdriver->get_resolution == NULL)
                dssdriver->get_resolution = omapdss_default_get_resolution;
+       if (dssdriver->get_recommended_bpp == NULL)
+               dssdriver->get_recommended_bpp =
+                       omapdss_default_get_recommended_bpp;
 
        return driver_register(&dssdriver->driver);
 }
index 3888c191c8a7310b98463e4321bb02da7f3c7a4d..af8aae7ef814ea035133ec9978454dc28077e7ef 100644 (file)
@@ -324,11 +324,8 @@ void default_get_overlay_fifo_thresholds(enum omap_plane plane,
        *fifo_low = fifo_size - burst_size_bytes;
 }
 
-static int default_get_recommended_bpp(struct omap_dss_device *dssdev)
+int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev)
 {
-       if (dssdev->panel.recommended_bpp)
-               return dssdev->panel.recommended_bpp;
-
        switch (dssdev->type) {
        case OMAP_DISPLAY_TYPE_DPI:
                if (dssdev->phy.dpi.data_lines == 24)
@@ -350,6 +347,7 @@ static int default_get_recommended_bpp(struct omap_dss_device *dssdev)
                BUG();
        }
 }
+EXPORT_SYMBOL(omapdss_default_get_recommended_bpp);
 
 /* Checks if replication logic should be used. Only use for active matrix,
  * when overlay is in RGB12U or RGB16 mode, and LCD interface is
@@ -413,8 +411,6 @@ void dss_init_device(struct platform_device *pdev,
                return;
        }
 
-       dssdev->get_recommended_bpp = default_get_recommended_bpp;
-
        switch (dssdev->type) {
        case OMAP_DISPLAY_TYPE_DPI:
                r = dpi_init_display(dssdev);
index 65514f0f52fd5880ac7e3ed5f827dbb012aeca12..d13071dd46e5b887bc63ddf9261e56160e43dbe8 100644 (file)
@@ -460,6 +460,7 @@ static struct omap_dss_driver venc_driver = {
        .resume         = venc_panel_resume,
 
        .get_resolution = omapdss_default_get_resolution,
+       .get_recommended_bpp = omapdss_default_get_recommended_bpp,
 
        .driver         = {
                .name   = "venc",
index 212d2efb380cac89975773ba2434e78cbe40efce..216ed80293b854dacdad1f7c8699bba021c96b15 100644 (file)
@@ -54,6 +54,8 @@ module_param_named(test, omapfb_test_pattern, bool, 0644);
 #endif
 
 static int omapfb_fb_init(struct omapfb2_device *fbdev, struct fb_info *fbi);
+static int omapfb_get_recommended_bpp(struct omapfb2_device *fbdev,
+               struct omap_dss_device *dssdev);
 
 #ifdef DEBUG
 static void draw_pixel(struct fb_info *fbi, int x, int y, unsigned color)
@@ -1404,6 +1406,7 @@ static int omapfb_alloc_fbmem_display(struct fb_info *fbi, unsigned long size,
                unsigned long paddr)
 {
        struct omapfb_info *ofbi = FB2OFB(fbi);
+       struct omapfb2_device *fbdev = ofbi->fbdev;
        struct omap_dss_device *display;
        int bytespp;
 
@@ -1412,7 +1415,7 @@ static int omapfb_alloc_fbmem_display(struct fb_info *fbi, unsigned long size,
        if (!display)
                return 0;
 
-       switch (display->get_recommended_bpp(display)) {
+       switch (omapfb_get_recommended_bpp(fbdev, display)) {
        case 16:
                bytespp = 2;
                break;
@@ -1760,7 +1763,7 @@ static int omapfb_fb_init(struct omapfb2_device *fbdev, struct fb_info *fbi)
                var->yres_virtual = var->yres;
 
                if (!var->bits_per_pixel) {
-                       switch (display->get_recommended_bpp(display)) {
+                       switch (omapfb_get_recommended_bpp(fbdev, display)) {
                        case 16:
                                var->bits_per_pixel = 16;
                                break;
@@ -2011,7 +2014,8 @@ static int omapfb_mode_to_timings(const char *mode_str,
        }
 }
 
-static int omapfb_set_def_mode(struct omap_dss_device *display, char *mode_str)
+static int omapfb_set_def_mode(struct omapfb2_device *fbdev,
+               struct omap_dss_device *display, char *mode_str)
 {
        int r;
        u8 bpp;
@@ -2021,7 +2025,9 @@ static int omapfb_set_def_mode(struct omap_dss_device *display, char *mode_str)
        if (r)
                return r;
 
-       display->panel.recommended_bpp = bpp;
+       fbdev->bpp_overrides[fbdev->num_bpp_overrides].dssdev = display;
+       fbdev->bpp_overrides[fbdev->num_bpp_overrides].bpp = bpp;
+       ++fbdev->num_bpp_overrides;
 
        if (!display->check_timings || !display->set_timings)
                return -EINVAL;
@@ -2035,6 +2041,21 @@ static int omapfb_set_def_mode(struct omap_dss_device *display, char *mode_str)
        return 0;
 }
 
+static int omapfb_get_recommended_bpp(struct omapfb2_device *fbdev,
+               struct omap_dss_device *dssdev)
+{
+       int i;
+
+       BUG_ON(dssdev->driver->get_recommended_bpp == NULL);
+
+       for (i = 0; i < fbdev->num_bpp_overrides; ++i) {
+               if (dssdev == fbdev->bpp_overrides[i].dssdev)
+                       return fbdev->bpp_overrides[i].bpp;
+       }
+
+       return dssdev->driver->get_recommended_bpp(dssdev);
+}
+
 static int omapfb_parse_def_modes(struct omapfb2_device *fbdev)
 {
        char *str, *options, *this_opt;
@@ -2073,7 +2094,7 @@ static int omapfb_parse_def_modes(struct omapfb2_device *fbdev)
                        break;
                }
 
-               r = omapfb_set_def_mode(display, mode_str);
+               r = omapfb_set_def_mode(fbdev, display, mode_str);
                if (r)
                        break;
        }
index 4ae0b64b3f432ada31a3e9a390cc7447d679da8b..cd54fdbfd8bb6bdcd2bec59815cd2be7747b3a33 100644 (file)
@@ -83,6 +83,12 @@ struct omapfb2_device {
        struct omap_overlay *overlays[10];
        unsigned num_managers;
        struct omap_overlay_manager *managers[10];
+
+       unsigned num_bpp_overrides;
+       struct {
+               struct omap_dss_device *dssdev;
+               u8 bpp;
+       } bpp_overrides[10];
 };
 
 struct omapfb_colormode {