Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] omap_vout: use omapdss's version instead of cpu_is_*

cpu_is_* class functions create a dependency to OMAP platform code.
omapdss driver, which omap_vout uses, exposes a function to get the
version of the DSS hardware.

To remove the dependency to OMAP platform code this patch changes
omap_vout to use the omapdss version. For most of the checks, the ones
dealing with DSS differences, this is actually more correct than using
cpu_is_* functions. For the check whether VRFB is available or not this
is not really correct, but still works fine.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>

+32 -12
+1 -2
drivers/media/platform/omap/omap_vout.c
··· 44 44 #include <media/v4l2-device.h> 45 45 #include <media/v4l2-ioctl.h> 46 46 47 - #include <plat/cpu.h> 48 47 #include <plat/dma.h> 49 48 #include <video/omapvrfb.h> 50 49 #include <video/omapdss.h> ··· 2063 2064 vout->vid_info.id = k + 1; 2064 2065 2065 2066 /* Set VRFB as rotation_type for omap2 and omap3 */ 2066 - if (cpu_is_omap24xx() || cpu_is_omap34xx()) 2067 + if (omap_vout_dss_omap24xx() || omap_vout_dss_omap34xx()) 2067 2068 vout->vid_info.rotation_type = VOUT_ROT_VRFB; 2068 2069 2069 2070 /* Setup the default configuration for the video devices
+28 -10
drivers/media/platform/omap/omap_voutlib.c
··· 26 26 27 27 #include <linux/dma-mapping.h> 28 28 29 - #include <plat/cpu.h> 29 + #include <video/omapdss.h> 30 30 31 31 #include "omap_voutlib.h" 32 32 ··· 124 124 win->chromakey = new_win->chromakey; 125 125 126 126 /* Adjust the cropping window to allow for resizing limitation */ 127 - if (cpu_is_omap24xx()) { 127 + if (omap_vout_dss_omap24xx()) { 128 128 /* For 24xx limit is 8x to 1/2x scaling. */ 129 129 if ((crop->height/win->w.height) >= 2) 130 130 crop->height = win->w.height * 2; ··· 140 140 if (crop->height != win->w.height) 141 141 crop->width = 768; 142 142 } 143 - } else if (cpu_is_omap34xx()) { 143 + } else if (omap_vout_dss_omap34xx()) { 144 144 /* For 34xx limit is 8x to 1/4x scaling. */ 145 145 if ((crop->height/win->w.height) >= 4) 146 146 crop->height = win->w.height * 4; ··· 196 196 if (try_crop.width <= 0 || try_crop.height <= 0) 197 197 return -EINVAL; 198 198 199 - if (cpu_is_omap24xx()) { 199 + if (omap_vout_dss_omap24xx()) { 200 200 if (try_crop.height != win->w.height) { 201 201 /* If we're resizing vertically, we can't support a 202 202 * crop width wider than 768 pixels. ··· 207 207 } 208 208 /* vertical resizing */ 209 209 vresize = (1024 * try_crop.height) / win->w.height; 210 - if (cpu_is_omap24xx() && (vresize > 2048)) 210 + if (omap_vout_dss_omap24xx() && (vresize > 2048)) 211 211 vresize = 2048; 212 - else if (cpu_is_omap34xx() && (vresize > 4096)) 212 + else if (omap_vout_dss_omap34xx() && (vresize > 4096)) 213 213 vresize = 4096; 214 214 215 215 win->w.height = ((1024 * try_crop.height) / vresize) & ~1; ··· 226 226 } 227 227 /* horizontal resizing */ 228 228 hresize = (1024 * try_crop.width) / win->w.width; 229 - if (cpu_is_omap24xx() && (hresize > 2048)) 229 + if (omap_vout_dss_omap24xx() && (hresize > 2048)) 230 230 hresize = 2048; 231 - else if (cpu_is_omap34xx() && (hresize > 4096)) 231 + else if (omap_vout_dss_omap34xx() && (hresize > 4096)) 232 232 hresize = 4096; 233 233 234 234 win->w.width = ((1024 * try_crop.width) / hresize) & ~1; ··· 243 243 if (try_crop.width == 0) 244 244 try_crop.width = 2; 245 245 } 246 - if (cpu_is_omap24xx()) { 246 + if (omap_vout_dss_omap24xx()) { 247 247 if ((try_crop.height/win->w.height) >= 2) 248 248 try_crop.height = win->w.height * 2; 249 249 ··· 258 258 if (try_crop.height != win->w.height) 259 259 try_crop.width = 768; 260 260 } 261 - } else if (cpu_is_omap34xx()) { 261 + } else if (omap_vout_dss_omap34xx()) { 262 262 if ((try_crop.height/win->w.height) >= 4) 263 263 try_crop.height = win->w.height * 4; 264 264 ··· 336 336 size -= PAGE_SIZE; 337 337 } 338 338 free_pages((unsigned long) virtaddr, order); 339 + } 340 + 341 + bool omap_vout_dss_omap24xx(void) 342 + { 343 + return omapdss_get_version() == OMAPDSS_VER_OMAP24xx; 344 + } 345 + 346 + bool omap_vout_dss_omap34xx(void) 347 + { 348 + switch (omapdss_get_version()) { 349 + case OMAPDSS_VER_OMAP34xx_ES1: 350 + case OMAPDSS_VER_OMAP34xx_ES3: 351 + case OMAPDSS_VER_OMAP3630: 352 + case OMAPDSS_VER_AM35xx: 353 + return true; 354 + default: 355 + return false; 356 + } 339 357 }
+3
drivers/media/platform/omap/omap_voutlib.h
··· 32 32 struct v4l2_window *win); 33 33 unsigned long omap_vout_alloc_buffer(u32 buf_size, u32 *phys_addr); 34 34 void omap_vout_free_buffer(unsigned long virtaddr, u32 buf_size); 35 + 36 + bool omap_vout_dss_omap24xx(void); 37 + bool omap_vout_dss_omap34xx(void); 35 38 #endif /* #ifndef OMAP_VOUTLIB_H */ 36 39