aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@nokia.com>2010-01-20 05:11:25 -0500
committerTomi Valkeinen <tomi.valkeinen@nokia.com>2010-02-24 07:31:28 -0500
commit69b2048f44ead2d278e25d12adf0494b469ffb1c (patch)
tree3f2b462aa04ecd131d2fb4936e61c59a75a5a50c /drivers/video/omap2
parent3651131268d7eae63efdffe6fa4a361abd44d747 (diff)
OMAP: DSS2: move timing functions
Move check/set/get_timings() 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/omap2')
-rw-r--r--drivers/video/omap2/displays/panel-taal.c4
-rw-r--r--drivers/video/omap2/dss/display.c10
-rw-r--r--drivers/video/omap2/dss/dpi.c16
-rw-r--r--drivers/video/omap2/dss/sdi.c8
-rw-r--r--drivers/video/omap2/dss/venc.c82
-rw-r--r--drivers/video/omap2/omapfb/omapfb-main.c10
6 files changed, 57 insertions, 73 deletions
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index 484a61844763..a722733106b1 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -516,8 +516,6 @@ static int taal_probe(struct omap_dss_device *dssdev)
516 516
517 dev_set_drvdata(&dssdev->dev, td); 517 dev_set_drvdata(&dssdev->dev, td);
518 518
519 dssdev->get_timings = taal_get_timings;
520
521 /* if no platform set_backlight() defined, presume DSI backlight 519 /* if no platform set_backlight() defined, presume DSI backlight
522 * control */ 520 * control */
523 if (!dssdev->set_backlight) 521 if (!dssdev->set_backlight)
@@ -1118,6 +1116,8 @@ static struct omap_dss_driver taal_driver = {
1118 .run_test = taal_run_test, 1116 .run_test = taal_run_test,
1119 .memory_read = taal_memory_read, 1117 .memory_read = taal_memory_read,
1120 1118
1119 .get_timings = taal_get_timings,
1120
1121 .driver = { 1121 .driver = {
1122 .name = "taal", 1122 .name = "taal",
1123 .owner = THIS_MODULE, 1123 .owner = THIS_MODULE,
diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c
index 351c8abae0b2..6a74ea116d29 100644
--- a/drivers/video/omap2/dss/display.c
+++ b/drivers/video/omap2/dss/display.c
@@ -135,10 +135,10 @@ static ssize_t display_timings_show(struct device *dev,
135 struct omap_dss_device *dssdev = to_dss_device(dev); 135 struct omap_dss_device *dssdev = to_dss_device(dev);
136 struct omap_video_timings t; 136 struct omap_video_timings t;
137 137
138 if (!dssdev->get_timings) 138 if (!dssdev->driver->get_timings)
139 return -ENOENT; 139 return -ENOENT;
140 140
141 dssdev->get_timings(dssdev, &t); 141 dssdev->driver->get_timings(dssdev, &t);
142 142
143 return snprintf(buf, PAGE_SIZE, "%u,%u/%u/%u/%u,%u/%u/%u/%u\n", 143 return snprintf(buf, PAGE_SIZE, "%u,%u/%u/%u/%u,%u/%u/%u/%u\n",
144 t.pixel_clock, 144 t.pixel_clock,
@@ -153,7 +153,7 @@ static ssize_t display_timings_store(struct device *dev,
153 struct omap_video_timings t; 153 struct omap_video_timings t;
154 int r, found; 154 int r, found;
155 155
156 if (!dssdev->set_timings || !dssdev->check_timings) 156 if (!dssdev->driver->set_timings || !dssdev->driver->check_timings)
157 return -ENOENT; 157 return -ENOENT;
158 158
159 found = 0; 159 found = 0;
@@ -172,11 +172,11 @@ static ssize_t display_timings_store(struct device *dev,
172 &t.y_res, &t.vfp, &t.vbp, &t.vsw) != 9) 172 &t.y_res, &t.vfp, &t.vbp, &t.vsw) != 9)
173 return -EINVAL; 173 return -EINVAL;
174 174
175 r = dssdev->check_timings(dssdev, &t); 175 r = dssdev->driver->check_timings(dssdev, &t);
176 if (r) 176 if (r)
177 return r; 177 return r;
178 178
179 dssdev->set_timings(dssdev, &t); 179 dssdev->driver->set_timings(dssdev, &t);
180 180
181 return size; 181 return size;
182} 182}
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index 1eef8b72dbb9..960e977a8bf0 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -227,7 +227,7 @@ void omapdss_dpi_display_disable(struct omap_dss_device *dssdev)
227} 227}
228EXPORT_SYMBOL(omapdss_dpi_display_disable); 228EXPORT_SYMBOL(omapdss_dpi_display_disable);
229 229
230static void dpi_set_timings(struct omap_dss_device *dssdev, 230void dpi_set_timings(struct omap_dss_device *dssdev,
231 struct omap_video_timings *timings) 231 struct omap_video_timings *timings)
232{ 232{
233 DSSDBG("dpi_set_timings\n"); 233 DSSDBG("dpi_set_timings\n");
@@ -237,8 +237,9 @@ static void dpi_set_timings(struct omap_dss_device *dssdev,
237 dispc_go(OMAP_DSS_CHANNEL_LCD); 237 dispc_go(OMAP_DSS_CHANNEL_LCD);
238 } 238 }
239} 239}
240EXPORT_SYMBOL(dpi_set_timings);
240 241
241static int dpi_check_timings(struct omap_dss_device *dssdev, 242int dpi_check_timings(struct omap_dss_device *dssdev,
242 struct omap_video_timings *timings) 243 struct omap_video_timings *timings)
243{ 244{
244 bool is_tft; 245 bool is_tft;
@@ -292,21 +293,12 @@ static int dpi_check_timings(struct omap_dss_device *dssdev,
292 293
293 return 0; 294 return 0;
294} 295}
295 296EXPORT_SYMBOL(dpi_check_timings);
296static void dpi_get_timings(struct omap_dss_device *dssdev,
297 struct omap_video_timings *timings)
298{
299 *timings = dssdev->panel.timings;
300}
301 297
302int dpi_init_display(struct omap_dss_device *dssdev) 298int dpi_init_display(struct omap_dss_device *dssdev)
303{ 299{
304 DSSDBG("init_display\n"); 300 DSSDBG("init_display\n");
305 301
306 dssdev->set_timings = dpi_set_timings;
307 dssdev->check_timings = dpi_check_timings;
308 dssdev->get_timings = dpi_get_timings;
309
310 return 0; 302 return 0;
311} 303}
312 304
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index 929ceb3ddd9d..12eb4042dd82 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -150,18 +150,10 @@ void omapdss_sdi_display_disable(struct omap_dss_device *dssdev)
150} 150}
151EXPORT_SYMBOL(omapdss_sdi_display_disable); 151EXPORT_SYMBOL(omapdss_sdi_display_disable);
152 152
153static void sdi_get_timings(struct omap_dss_device *dssdev,
154 struct omap_video_timings *timings)
155{
156 *timings = dssdev->panel.timings;
157}
158
159int sdi_init_display(struct omap_dss_device *dssdev) 153int sdi_init_display(struct omap_dss_device *dssdev)
160{ 154{
161 DSSDBG("SDI init\n"); 155 DSSDBG("SDI init\n");
162 156
163 dssdev->get_timings = sdi_get_timings;
164
165 return 0; 157 return 0;
166} 158}
167 159
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index 5c6e98bbb663..f0ba5732d84a 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -557,6 +557,43 @@ static int venc_set_update_mode(struct omap_dss_device *dssdev,
557 return 0; 557 return 0;
558} 558}
559 559
560static void venc_get_timings(struct omap_dss_device *dssdev,
561 struct omap_video_timings *timings)
562{
563 *timings = dssdev->panel.timings;
564}
565
566static void venc_set_timings(struct omap_dss_device *dssdev,
567 struct omap_video_timings *timings)
568{
569 DSSDBG("venc_set_timings\n");
570
571 /* Reset WSS data when the TV standard changes. */
572 if (memcmp(&dssdev->panel.timings, timings, sizeof(*timings)))
573 venc.wss_data = 0;
574
575 dssdev->panel.timings = *timings;
576 if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) {
577 /* turn the venc off and on to get new timings to use */
578 venc_panel_disable(dssdev);
579 venc_panel_enable(dssdev);
580 }
581}
582
583static int venc_check_timings(struct omap_dss_device *dssdev,
584 struct omap_video_timings *timings)
585{
586 DSSDBG("venc_check_timings\n");
587
588 if (memcmp(&omap_dss_pal_timings, timings, sizeof(*timings)) == 0)
589 return 0;
590
591 if (memcmp(&omap_dss_ntsc_timings, timings, sizeof(*timings)) == 0)
592 return 0;
593
594 return -EINVAL;
595}
596
560static u32 venc_get_wss(struct omap_dss_device *dssdev) 597static u32 venc_get_wss(struct omap_dss_device *dssdev)
561{ 598{
562 /* Invert due to VENC_L21_WC_CTL:INV=1 */ 599 /* Invert due to VENC_L21_WC_CTL:INV=1 */
@@ -603,6 +640,10 @@ static struct omap_dss_driver venc_driver = {
603 .set_update_mode = venc_set_update_mode, 640 .set_update_mode = venc_set_update_mode,
604 .get_update_mode = venc_get_update_mode, 641 .get_update_mode = venc_get_update_mode,
605 642
643 .get_timings = venc_get_timings,
644 .set_timings = venc_set_timings,
645 .check_timings = venc_check_timings,
646
606 .get_wss = venc_get_wss, 647 .get_wss = venc_get_wss,
607 .set_wss = venc_set_wss, 648 .set_wss = venc_set_wss,
608 649
@@ -653,51 +694,10 @@ void venc_exit(void)
653 iounmap(venc.base); 694 iounmap(venc.base);
654} 695}
655 696
656static void venc_get_timings(struct omap_dss_device *dssdev,
657 struct omap_video_timings *timings)
658{
659 *timings = dssdev->panel.timings;
660}
661
662static void venc_set_timings(struct omap_dss_device *dssdev,
663 struct omap_video_timings *timings)
664{
665 DSSDBG("venc_set_timings\n");
666
667 /* Reset WSS data when the TV standard changes. */
668 if (memcmp(&dssdev->panel.timings, timings, sizeof(*timings)))
669 venc.wss_data = 0;
670
671 dssdev->panel.timings = *timings;
672 if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) {
673 /* turn the venc off and on to get new timings to use */
674 venc_panel_disable(dssdev);
675 venc_panel_enable(dssdev);
676 }
677}
678
679static int venc_check_timings(struct omap_dss_device *dssdev,
680 struct omap_video_timings *timings)
681{
682 DSSDBG("venc_check_timings\n");
683
684 if (memcmp(&omap_dss_pal_timings, timings, sizeof(*timings)) == 0)
685 return 0;
686
687 if (memcmp(&omap_dss_ntsc_timings, timings, sizeof(*timings)) == 0)
688 return 0;
689
690 return -EINVAL;
691}
692
693int venc_init_display(struct omap_dss_device *dssdev) 697int venc_init_display(struct omap_dss_device *dssdev)
694{ 698{
695 DSSDBG("init_display\n"); 699 DSSDBG("init_display\n");
696 700
697 dssdev->get_timings = venc_get_timings;
698 dssdev->set_timings = venc_set_timings;
699 dssdev->check_timings = venc_check_timings;
700
701 return 0; 701 return 0;
702} 702}
703 703
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c
index b327ee0e60d5..8aed12a1ce2f 100644
--- a/drivers/video/omap2/omapfb/omapfb-main.c
+++ b/drivers/video/omap2/omapfb/omapfb-main.c
@@ -705,9 +705,9 @@ int check_fb_var(struct fb_info *fbi, struct fb_var_screeninfo *var)
705 var->width = -1; 705 var->width = -1;
706 var->grayscale = 0; 706 var->grayscale = 0;
707 707
708 if (display && display->get_timings) { 708 if (display && display->driver->get_timings) {
709 struct omap_video_timings timings; 709 struct omap_video_timings timings;
710 display->get_timings(display, &timings); 710 display->driver->get_timings(display, &timings);
711 711
712 /* pixclock in ps, the rest in pixclock */ 712 /* pixclock in ps, the rest in pixclock */
713 var->pixclock = timings.pixel_clock != 0 ? 713 var->pixclock = timings.pixel_clock != 0 ?
@@ -2029,14 +2029,14 @@ static int omapfb_set_def_mode(struct omapfb2_device *fbdev,
2029 fbdev->bpp_overrides[fbdev->num_bpp_overrides].bpp = bpp; 2029 fbdev->bpp_overrides[fbdev->num_bpp_overrides].bpp = bpp;
2030 ++fbdev->num_bpp_overrides; 2030 ++fbdev->num_bpp_overrides;
2031 2031
2032 if (!display->check_timings || !display->set_timings) 2032 if (!display->driver->check_timings || !display->driver->set_timings)
2033 return -EINVAL; 2033 return -EINVAL;
2034 2034
2035 r = display->check_timings(display, &timings); 2035 r = display->driver->check_timings(display, &timings);
2036 if (r) 2036 if (r)
2037 return r; 2037 return r;
2038 2038
2039 display->set_timings(display, &timings); 2039 display->driver->set_timings(display, &timings);
2040 2040
2041 return 0; 2041 return 0;
2042} 2042}