diff options
author | Tomi Valkeinen <tomi.valkeinen@nokia.com> | 2010-01-11 07:33:40 -0500 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@nokia.com> | 2010-02-24 07:31:27 -0500 |
commit | a269950405ab17ce3a604ddcd939709a4a7a747c (patch) | |
tree | 612c0cdda13f1703f6b9c5c0c5431b6db1f63ab0 /drivers/video | |
parent | 96adceceedefff9b849d25ff582bc6f516903994 (diff) |
OMAP: DSS2: move get_recommended_bpp()
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>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/omap2/displays/panel-taal.c | 2 | ||||
-rw-r--r-- | drivers/video/omap2/dss/core.c | 3 | ||||
-rw-r--r-- | drivers/video/omap2/dss/display.c | 8 | ||||
-rw-r--r-- | drivers/video/omap2/dss/venc.c | 1 | ||||
-rw-r--r-- | drivers/video/omap2/omapfb/omapfb-main.c | 31 | ||||
-rw-r--r-- | drivers/video/omap2/omapfb/omapfb.h | 6 |
6 files changed, 40 insertions, 11 deletions
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c index 11d69b67a903..e00502ea46e5 100644 --- a/drivers/video/omap2/displays/panel-taal.c +++ b/drivers/video/omap2/displays/panel-taal.c | |||
@@ -990,6 +990,8 @@ static struct omap_dss_driver taal_driver = { | |||
990 | 990 | ||
991 | .setup_update = taal_setup_update, | 991 | .setup_update = taal_setup_update, |
992 | .get_resolution = taal_get_resolution, | 992 | .get_resolution = taal_get_resolution, |
993 | .get_recommended_bpp = omapdss_default_get_recommended_bpp, | ||
994 | |||
993 | .enable_te = taal_enable_te, | 995 | .enable_te = taal_enable_te, |
994 | .wait_for_te = taal_wait_te, | 996 | .wait_for_te = taal_wait_te, |
995 | .set_rotate = taal_rotate, | 997 | .set_rotate = taal_rotate, |
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c index 2e6ce835ae5c..7ebe50b335ed 100644 --- a/drivers/video/omap2/dss/core.c +++ b/drivers/video/omap2/dss/core.c | |||
@@ -814,6 +814,9 @@ int omap_dss_register_driver(struct omap_dss_driver *dssdriver) | |||
814 | 814 | ||
815 | if (dssdriver->get_resolution == NULL) | 815 | if (dssdriver->get_resolution == NULL) |
816 | dssdriver->get_resolution = omapdss_default_get_resolution; | 816 | dssdriver->get_resolution = omapdss_default_get_resolution; |
817 | if (dssdriver->get_recommended_bpp == NULL) | ||
818 | dssdriver->get_recommended_bpp = | ||
819 | omapdss_default_get_recommended_bpp; | ||
817 | 820 | ||
818 | return driver_register(&dssdriver->driver); | 821 | return driver_register(&dssdriver->driver); |
819 | } | 822 | } |
diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c index 3888c191c8a7..af8aae7ef814 100644 --- a/drivers/video/omap2/dss/display.c +++ b/drivers/video/omap2/dss/display.c | |||
@@ -324,11 +324,8 @@ void default_get_overlay_fifo_thresholds(enum omap_plane plane, | |||
324 | *fifo_low = fifo_size - burst_size_bytes; | 324 | *fifo_low = fifo_size - burst_size_bytes; |
325 | } | 325 | } |
326 | 326 | ||
327 | static int default_get_recommended_bpp(struct omap_dss_device *dssdev) | 327 | int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev) |
328 | { | 328 | { |
329 | if (dssdev->panel.recommended_bpp) | ||
330 | return dssdev->panel.recommended_bpp; | ||
331 | |||
332 | switch (dssdev->type) { | 329 | switch (dssdev->type) { |
333 | case OMAP_DISPLAY_TYPE_DPI: | 330 | case OMAP_DISPLAY_TYPE_DPI: |
334 | if (dssdev->phy.dpi.data_lines == 24) | 331 | if (dssdev->phy.dpi.data_lines == 24) |
@@ -350,6 +347,7 @@ static int default_get_recommended_bpp(struct omap_dss_device *dssdev) | |||
350 | BUG(); | 347 | BUG(); |
351 | } | 348 | } |
352 | } | 349 | } |
350 | EXPORT_SYMBOL(omapdss_default_get_recommended_bpp); | ||
353 | 351 | ||
354 | /* Checks if replication logic should be used. Only use for active matrix, | 352 | /* Checks if replication logic should be used. Only use for active matrix, |
355 | * when overlay is in RGB12U or RGB16 mode, and LCD interface is | 353 | * when overlay is in RGB12U or RGB16 mode, and LCD interface is |
@@ -413,8 +411,6 @@ void dss_init_device(struct platform_device *pdev, | |||
413 | return; | 411 | return; |
414 | } | 412 | } |
415 | 413 | ||
416 | dssdev->get_recommended_bpp = default_get_recommended_bpp; | ||
417 | |||
418 | switch (dssdev->type) { | 414 | switch (dssdev->type) { |
419 | case OMAP_DISPLAY_TYPE_DPI: | 415 | case OMAP_DISPLAY_TYPE_DPI: |
420 | r = dpi_init_display(dssdev); | 416 | r = dpi_init_display(dssdev); |
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index 65514f0f52fd..d13071dd46e5 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c | |||
@@ -460,6 +460,7 @@ static struct omap_dss_driver venc_driver = { | |||
460 | .resume = venc_panel_resume, | 460 | .resume = venc_panel_resume, |
461 | 461 | ||
462 | .get_resolution = omapdss_default_get_resolution, | 462 | .get_resolution = omapdss_default_get_resolution, |
463 | .get_recommended_bpp = omapdss_default_get_recommended_bpp, | ||
463 | 464 | ||
464 | .driver = { | 465 | .driver = { |
465 | .name = "venc", | 466 | .name = "venc", |
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c index 212d2efb380c..216ed80293b8 100644 --- a/drivers/video/omap2/omapfb/omapfb-main.c +++ b/drivers/video/omap2/omapfb/omapfb-main.c | |||
@@ -54,6 +54,8 @@ module_param_named(test, omapfb_test_pattern, bool, 0644); | |||
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | static int omapfb_fb_init(struct omapfb2_device *fbdev, struct fb_info *fbi); | 56 | static int omapfb_fb_init(struct omapfb2_device *fbdev, struct fb_info *fbi); |
57 | static int omapfb_get_recommended_bpp(struct omapfb2_device *fbdev, | ||
58 | struct omap_dss_device *dssdev); | ||
57 | 59 | ||
58 | #ifdef DEBUG | 60 | #ifdef DEBUG |
59 | static void draw_pixel(struct fb_info *fbi, int x, int y, unsigned color) | 61 | 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, | |||
1404 | unsigned long paddr) | 1406 | unsigned long paddr) |
1405 | { | 1407 | { |
1406 | struct omapfb_info *ofbi = FB2OFB(fbi); | 1408 | struct omapfb_info *ofbi = FB2OFB(fbi); |
1409 | struct omapfb2_device *fbdev = ofbi->fbdev; | ||
1407 | struct omap_dss_device *display; | 1410 | struct omap_dss_device *display; |
1408 | int bytespp; | 1411 | int bytespp; |
1409 | 1412 | ||
@@ -1412,7 +1415,7 @@ static int omapfb_alloc_fbmem_display(struct fb_info *fbi, unsigned long size, | |||
1412 | if (!display) | 1415 | if (!display) |
1413 | return 0; | 1416 | return 0; |
1414 | 1417 | ||
1415 | switch (display->get_recommended_bpp(display)) { | 1418 | switch (omapfb_get_recommended_bpp(fbdev, display)) { |
1416 | case 16: | 1419 | case 16: |
1417 | bytespp = 2; | 1420 | bytespp = 2; |
1418 | break; | 1421 | break; |
@@ -1760,7 +1763,7 @@ static int omapfb_fb_init(struct omapfb2_device *fbdev, struct fb_info *fbi) | |||
1760 | var->yres_virtual = var->yres; | 1763 | var->yres_virtual = var->yres; |
1761 | 1764 | ||
1762 | if (!var->bits_per_pixel) { | 1765 | if (!var->bits_per_pixel) { |
1763 | switch (display->get_recommended_bpp(display)) { | 1766 | switch (omapfb_get_recommended_bpp(fbdev, display)) { |
1764 | case 16: | 1767 | case 16: |
1765 | var->bits_per_pixel = 16; | 1768 | var->bits_per_pixel = 16; |
1766 | break; | 1769 | break; |
@@ -2011,7 +2014,8 @@ static int omapfb_mode_to_timings(const char *mode_str, | |||
2011 | } | 2014 | } |
2012 | } | 2015 | } |
2013 | 2016 | ||
2014 | static int omapfb_set_def_mode(struct omap_dss_device *display, char *mode_str) | 2017 | static int omapfb_set_def_mode(struct omapfb2_device *fbdev, |
2018 | struct omap_dss_device *display, char *mode_str) | ||
2015 | { | 2019 | { |
2016 | int r; | 2020 | int r; |
2017 | u8 bpp; | 2021 | u8 bpp; |
@@ -2021,7 +2025,9 @@ static int omapfb_set_def_mode(struct omap_dss_device *display, char *mode_str) | |||
2021 | if (r) | 2025 | if (r) |
2022 | return r; | 2026 | return r; |
2023 | 2027 | ||
2024 | display->panel.recommended_bpp = bpp; | 2028 | fbdev->bpp_overrides[fbdev->num_bpp_overrides].dssdev = display; |
2029 | fbdev->bpp_overrides[fbdev->num_bpp_overrides].bpp = bpp; | ||
2030 | ++fbdev->num_bpp_overrides; | ||
2025 | 2031 | ||
2026 | if (!display->check_timings || !display->set_timings) | 2032 | if (!display->check_timings || !display->set_timings) |
2027 | return -EINVAL; | 2033 | return -EINVAL; |
@@ -2035,6 +2041,21 @@ static int omapfb_set_def_mode(struct omap_dss_device *display, char *mode_str) | |||
2035 | return 0; | 2041 | return 0; |
2036 | } | 2042 | } |
2037 | 2043 | ||
2044 | static int omapfb_get_recommended_bpp(struct omapfb2_device *fbdev, | ||
2045 | struct omap_dss_device *dssdev) | ||
2046 | { | ||
2047 | int i; | ||
2048 | |||
2049 | BUG_ON(dssdev->driver->get_recommended_bpp == NULL); | ||
2050 | |||
2051 | for (i = 0; i < fbdev->num_bpp_overrides; ++i) { | ||
2052 | if (dssdev == fbdev->bpp_overrides[i].dssdev) | ||
2053 | return fbdev->bpp_overrides[i].bpp; | ||
2054 | } | ||
2055 | |||
2056 | return dssdev->driver->get_recommended_bpp(dssdev); | ||
2057 | } | ||
2058 | |||
2038 | static int omapfb_parse_def_modes(struct omapfb2_device *fbdev) | 2059 | static int omapfb_parse_def_modes(struct omapfb2_device *fbdev) |
2039 | { | 2060 | { |
2040 | char *str, *options, *this_opt; | 2061 | char *str, *options, *this_opt; |
@@ -2073,7 +2094,7 @@ static int omapfb_parse_def_modes(struct omapfb2_device *fbdev) | |||
2073 | break; | 2094 | break; |
2074 | } | 2095 | } |
2075 | 2096 | ||
2076 | r = omapfb_set_def_mode(display, mode_str); | 2097 | r = omapfb_set_def_mode(fbdev, display, mode_str); |
2077 | if (r) | 2098 | if (r) |
2078 | break; | 2099 | break; |
2079 | } | 2100 | } |
diff --git a/drivers/video/omap2/omapfb/omapfb.h b/drivers/video/omap2/omapfb/omapfb.h index 4ae0b64b3f43..cd54fdbfd8bb 100644 --- a/drivers/video/omap2/omapfb/omapfb.h +++ b/drivers/video/omap2/omapfb/omapfb.h | |||
@@ -83,6 +83,12 @@ struct omapfb2_device { | |||
83 | struct omap_overlay *overlays[10]; | 83 | struct omap_overlay *overlays[10]; |
84 | unsigned num_managers; | 84 | unsigned num_managers; |
85 | struct omap_overlay_manager *managers[10]; | 85 | struct omap_overlay_manager *managers[10]; |
86 | |||
87 | unsigned num_bpp_overrides; | ||
88 | struct { | ||
89 | struct omap_dss_device *dssdev; | ||
90 | u8 bpp; | ||
91 | } bpp_overrides[10]; | ||
86 | }; | 92 | }; |
87 | 93 | ||
88 | struct omapfb_colormode { | 94 | struct omapfb_colormode { |