1 From c09f1a0642fd58a1b081594ea36dfd1bf71aec52 Mon Sep 17 00:00:00 2001
2 From: Hardik Shah <hardik.shah@ti.com>
3 Date: Thu, 9 Apr 2009 12:13:07 +0530
4 Subject: [PATCH] DSS2: OMAPFB: Added support for the YUV VRFB rotation and mirroring.
6 DSS2 now requires roatation_type to be specified by driver.
7 Added support for that.
8 DSS2 OMAPFB: Modified to pass the dss mode to omap_vrfb_setup function.
10 VRFB size register requires the width to be halved when the
11 mode is YUV or UYVY. So VRFB is modifed to pass the mode to omap_vrfb_setup
14 Few changes done by Tim Yamin
15 Signed-off-by: Tim Yamin <plasm@roo.me.uk>
16 Signed-off-by: Hardik Shah <hardik.shah@ti.com>
18 arch/arm/plat-omap/vrfb.c | 4 +-
19 drivers/video/omap2/omapfb/omapfb-main.c | 59 ++++++++++++++----------------
20 drivers/video/omap2/omapfb/omapfb.h | 7 +---
21 3 files changed, 30 insertions(+), 40 deletions(-)
23 diff --git a/arch/arm/plat-omap/vrfb.c b/arch/arm/plat-omap/vrfb.c
24 index 2f08f6d..2ae0d68 100644
25 --- a/arch/arm/plat-omap/vrfb.c
26 +++ b/arch/arm/plat-omap/vrfb.c
27 @@ -88,9 +88,9 @@ void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr,
28 color_mode == OMAP_DSS_COLOR_UYVY)
34 - } else if (bytespp == 2)
35 + else if (bytespp == 2)
39 diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c
40 index 67c67c2..57f5900 100644
41 --- a/drivers/video/omap2/omapfb/omapfb-main.c
42 +++ b/drivers/video/omap2/omapfb/omapfb-main.c
43 @@ -176,15 +176,9 @@ static unsigned omapfb_get_vrfb_offset(struct omapfb_info *ofbi, int rot)
45 static u32 omapfb_get_region_rot_paddr(struct omapfb_info *ofbi)
47 - if (ofbi->rotation_type == OMAPFB_ROT_VRFB) {
51 - rot = ofbi->rotation;
53 - offset = omapfb_get_vrfb_offset(ofbi, rot);
55 - return ofbi->region.vrfb.paddr[rot] + offset;
56 + if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
57 + return ofbi->region.vrfb.paddr[ofbi->rotation]
58 + + omapfb_get_vrfb_offset(ofbi, ofbi->rotation);
60 return ofbi->region.paddr;
62 @@ -192,7 +186,7 @@ static u32 omapfb_get_region_rot_paddr(struct omapfb_info *ofbi)
64 u32 omapfb_get_region_paddr(struct omapfb_info *ofbi)
66 - if (ofbi->rotation_type == OMAPFB_ROT_VRFB)
67 + if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
68 return ofbi->region.vrfb.paddr[0];
70 return ofbi->region.paddr;
71 @@ -200,7 +194,7 @@ u32 omapfb_get_region_paddr(struct omapfb_info *ofbi)
73 void __iomem *omapfb_get_region_vaddr(struct omapfb_info *ofbi)
75 - if (ofbi->rotation_type == OMAPFB_ROT_VRFB)
76 + if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
77 return ofbi->region.vrfb.vaddr[0];
79 return ofbi->region.vaddr;
80 @@ -398,7 +392,7 @@ void set_fb_fix(struct fb_info *fbi)
81 fbi->screen_base = (char __iomem *)omapfb_get_region_vaddr(ofbi);
83 /* used by mmap in fbmem.c */
84 - if (ofbi->rotation_type == OMAPFB_ROT_VRFB)
85 + if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
87 (OMAP_VRFB_LINE_LEN * var->bits_per_pixel) >> 3;
89 @@ -434,11 +428,14 @@ void set_fb_fix(struct fb_info *fbi)
94 - if (ofbi->rotation_type == OMAPFB_ROT_VRFB)
95 - omap_vrfb_setup(&rg->vrfb, rg->paddr,
96 - var->xres_virtual, var->yres_virtual,
97 - var->bits_per_pixel >> 3);
98 + if (rg->size && ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
99 + enum omap_color_mode mode = 0;
100 + mode = fb_mode_to_dss_mode(var);
102 + omap_vrfb_setup(&rg->vrfb, rg->paddr,
109 @@ -527,7 +524,7 @@ int check_fb_var(struct fb_info *fbi, struct fb_var_screeninfo *var)
110 if (var->yres > var->yres_virtual)
111 var->yres = var->yres_virtual;
113 - if (ofbi->rotation_type == OMAPFB_ROT_VRFB)
114 + if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
115 line_size = OMAP_VRFB_LINE_LEN * bytespp;
117 line_size = var->xres_virtual * bytespp;
118 @@ -549,7 +546,7 @@ int check_fb_var(struct fb_info *fbi, struct fb_var_screeninfo *var)
120 if (line_size * var->yres_virtual > max_frame_size) {
121 DBG("can't fit FB into memory, reducing x\n");
122 - if (ofbi->rotation_type == OMAPFB_ROT_VRFB)
123 + if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
126 var->xres_virtual = max_frame_size / var->yres_virtual /
127 @@ -672,7 +669,7 @@ static int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl,
128 struct omap_overlay_info info;
134 DBG("setup_overlay %d, posx %d, posy %d, outw %d, outh %d\n", ofbi->id,
135 posx, posy, outw, outh);
136 @@ -688,7 +685,7 @@ static int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl,
137 offset = ((var->yoffset * var->xres_virtual +
138 var->xoffset) * var->bits_per_pixel) >> 3;
140 - if (ofbi->rotation_type == OMAPFB_ROT_VRFB) {
141 + if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
142 data_start_p = omapfb_get_region_rot_paddr(ofbi);
145 @@ -711,13 +708,10 @@ static int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl,
147 ovl->get_overlay_info(ovl, &info);
149 - if (ofbi->rotation_type == OMAPFB_ROT_VRFB) {
151 + if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
154 - rot = ofbi->rotation;
156 mirror = ofbi->mirror;
159 info.paddr = data_start_p;
160 info.vaddr = data_start_v;
161 @@ -725,7 +719,8 @@ static int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl,
164 info.color_mode = mode;
165 - info.rotation = rot;
166 + info.rotation_type = ofbi->rotation_type;
167 + info.rotation = ofbi->rotation;
168 info.mirror = mirror;
171 @@ -1121,7 +1116,7 @@ static void omapfb_free_fbmem(struct fb_info *fbi)
175 - if (ofbi->rotation_type == OMAPFB_ROT_VRFB) {
176 + if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
177 /* unmap the 0 angle rotation */
178 if (rg->vrfb.vaddr[0]) {
179 iounmap(rg->vrfb.vaddr[0]);
180 @@ -1181,7 +1176,7 @@ static int omapfb_alloc_fbmem(struct fb_info *fbi, unsigned long size,
184 - if (ofbi->rotation_type != OMAPFB_ROT_VRFB) {
185 + if (ofbi->rotation_type != OMAP_DSS_ROT_VRFB) {
186 vaddr = ioremap_wc(paddr, size);
189 @@ -1260,7 +1255,7 @@ static int omapfb_alloc_fbmem_display(struct fb_info *fbi, unsigned long size,
191 display->get_resolution(display, &w, &h);
193 - if (ofbi->rotation_type == OMAPFB_ROT_VRFB) {
194 + if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
196 int oldw = w, oldh = h;
198 @@ -1701,8 +1696,8 @@ static int omapfb_create_framebuffers(struct omapfb2_device *fbdev)
201 /* assign these early, so that fb alloc can use them */
202 - ofbi->rotation_type = def_vrfb ? OMAPFB_ROT_VRFB :
204 + ofbi->rotation_type = def_vrfb ? OMAP_DSS_ROT_VRFB :
206 ofbi->rotation = def_rotate;
207 ofbi->mirror = def_mirror;
209 diff --git a/drivers/video/omap2/omapfb/omapfb.h b/drivers/video/omap2/omapfb/omapfb.h
210 index 2607def..43f6922 100644
211 --- a/drivers/video/omap2/omapfb/omapfb.h
212 +++ b/drivers/video/omap2/omapfb/omapfb.h
213 @@ -53,11 +53,6 @@ struct omapfb2_mem_region {
214 bool map; /* kernel mapped by the driver */
217 -enum omapfb_rotation_type {
218 - OMAPFB_ROT_DMA = 0,
219 - OMAPFB_ROT_VRFB = 1,
222 /* appended to fb_info */
225 @@ -66,7 +61,7 @@ struct omapfb_info {
227 struct omap_overlay *overlays[OMAPFB_MAX_OVL_PER_FB];
228 struct omapfb2_device *fbdev;
229 - enum omapfb_rotation_type rotation_type;
230 + enum omap_dss_rotation_type rotation_type;