aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/omap/omap_vout.c21
-rw-r--r--drivers/media/platform/omap/omap_voutlib.c38
-rw-r--r--drivers/media/platform/omap/omap_voutlib.h3
3 files changed, 46 insertions, 16 deletions
diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c
index 202d1b4b9bee..35cc526e6c93 100644
--- a/drivers/media/platform/omap/omap_vout.c
+++ b/drivers/media/platform/omap/omap_vout.c
@@ -44,8 +44,6 @@
44#include <media/v4l2-device.h> 44#include <media/v4l2-device.h>
45#include <media/v4l2-ioctl.h> 45#include <media/v4l2-ioctl.h>
46 46
47#include <plat/cpu.h>
48#include <linux/omap-dma.h>
49#include <video/omapvrfb.h> 47#include <video/omapvrfb.h>
50#include <video/omapdss.h> 48#include <video/omapdss.h>
51 49
@@ -2043,7 +2041,7 @@ static int __init omap_vout_create_video_devices(struct platform_device *pdev)
2043 vout->vid_info.id = k + 1; 2041 vout->vid_info.id = k + 1;
2044 2042
2045 /* Set VRFB as rotation_type for omap2 and omap3 */ 2043 /* Set VRFB as rotation_type for omap2 and omap3 */
2046 if (cpu_is_omap24xx() || cpu_is_omap34xx()) 2044 if (omap_vout_dss_omap24xx() || omap_vout_dss_omap34xx())
2047 vout->vid_info.rotation_type = VOUT_ROT_VRFB; 2045 vout->vid_info.rotation_type = VOUT_ROT_VRFB;
2048 2046
2049 /* Setup the default configuration for the video devices 2047 /* Setup the default configuration for the video devices
@@ -2160,14 +2158,23 @@ static int __init omap_vout_probe(struct platform_device *pdev)
2160 struct omap_dss_device *def_display; 2158 struct omap_dss_device *def_display;
2161 struct omap2video_device *vid_dev = NULL; 2159 struct omap2video_device *vid_dev = NULL;
2162 2160
2161 ret = omapdss_compat_init();
2162 if (ret) {
2163 dev_err(&pdev->dev, "failed to init dss\n");
2164 return ret;
2165 }
2166
2163 if (pdev->num_resources == 0) { 2167 if (pdev->num_resources == 0) {
2164 dev_err(&pdev->dev, "probed for an unknown device\n"); 2168 dev_err(&pdev->dev, "probed for an unknown device\n");
2165 return -ENODEV; 2169 ret = -ENODEV;
2170 goto err_dss_init;
2166 } 2171 }
2167 2172
2168 vid_dev = kzalloc(sizeof(struct omap2video_device), GFP_KERNEL); 2173 vid_dev = kzalloc(sizeof(struct omap2video_device), GFP_KERNEL);
2169 if (vid_dev == NULL) 2174 if (vid_dev == NULL) {
2170 return -ENOMEM; 2175 ret = -ENOMEM;
2176 goto err_dss_init;
2177 }
2171 2178
2172 vid_dev->num_displays = 0; 2179 vid_dev->num_displays = 0;
2173 for_each_dss_dev(dssdev) { 2180 for_each_dss_dev(dssdev) {
@@ -2262,6 +2269,8 @@ probe_err1:
2262 } 2269 }
2263probe_err0: 2270probe_err0:
2264 kfree(vid_dev); 2271 kfree(vid_dev);
2272err_dss_init:
2273 omapdss_compat_uninit();
2265 return ret; 2274 return ret;
2266} 2275}
2267 2276
diff --git a/drivers/media/platform/omap/omap_voutlib.c b/drivers/media/platform/omap/omap_voutlib.c
index 115408b9274f..80b0d88f125c 100644
--- a/drivers/media/platform/omap/omap_voutlib.c
+++ b/drivers/media/platform/omap/omap_voutlib.c
@@ -26,7 +26,7 @@
26 26
27#include <linux/dma-mapping.h> 27#include <linux/dma-mapping.h>
28 28
29#include <plat/cpu.h> 29#include <video/omapdss.h>
30 30
31#include "omap_voutlib.h" 31#include "omap_voutlib.h"
32 32
@@ -124,7 +124,7 @@ int omap_vout_new_window(struct v4l2_rect *crop,
124 win->chromakey = new_win->chromakey; 124 win->chromakey = new_win->chromakey;
125 125
126 /* Adjust the cropping window to allow for resizing limitation */ 126 /* Adjust the cropping window to allow for resizing limitation */
127 if (cpu_is_omap24xx()) { 127 if (omap_vout_dss_omap24xx()) {
128 /* For 24xx limit is 8x to 1/2x scaling. */ 128 /* For 24xx limit is 8x to 1/2x scaling. */
129 if ((crop->height/win->w.height) >= 2) 129 if ((crop->height/win->w.height) >= 2)
130 crop->height = win->w.height * 2; 130 crop->height = win->w.height * 2;
@@ -140,7 +140,7 @@ int omap_vout_new_window(struct v4l2_rect *crop,
140 if (crop->height != win->w.height) 140 if (crop->height != win->w.height)
141 crop->width = 768; 141 crop->width = 768;
142 } 142 }
143 } else if (cpu_is_omap34xx()) { 143 } else if (omap_vout_dss_omap34xx()) {
144 /* For 34xx limit is 8x to 1/4x scaling. */ 144 /* For 34xx limit is 8x to 1/4x scaling. */
145 if ((crop->height/win->w.height) >= 4) 145 if ((crop->height/win->w.height) >= 4)
146 crop->height = win->w.height * 4; 146 crop->height = win->w.height * 4;
@@ -196,7 +196,7 @@ int omap_vout_new_crop(struct v4l2_pix_format *pix,
196 if (try_crop.width <= 0 || try_crop.height <= 0) 196 if (try_crop.width <= 0 || try_crop.height <= 0)
197 return -EINVAL; 197 return -EINVAL;
198 198
199 if (cpu_is_omap24xx()) { 199 if (omap_vout_dss_omap24xx()) {
200 if (try_crop.height != win->w.height) { 200 if (try_crop.height != win->w.height) {
201 /* If we're resizing vertically, we can't support a 201 /* If we're resizing vertically, we can't support a
202 * crop width wider than 768 pixels. 202 * crop width wider than 768 pixels.
@@ -207,9 +207,9 @@ int omap_vout_new_crop(struct v4l2_pix_format *pix,
207 } 207 }
208 /* vertical resizing */ 208 /* vertical resizing */
209 vresize = (1024 * try_crop.height) / win->w.height; 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 vresize = 2048; 211 vresize = 2048;
212 else if (cpu_is_omap34xx() && (vresize > 4096)) 212 else if (omap_vout_dss_omap34xx() && (vresize > 4096))
213 vresize = 4096; 213 vresize = 4096;
214 214
215 win->w.height = ((1024 * try_crop.height) / vresize) & ~1; 215 win->w.height = ((1024 * try_crop.height) / vresize) & ~1;
@@ -226,9 +226,9 @@ int omap_vout_new_crop(struct v4l2_pix_format *pix,
226 } 226 }
227 /* horizontal resizing */ 227 /* horizontal resizing */
228 hresize = (1024 * try_crop.width) / win->w.width; 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 hresize = 2048; 230 hresize = 2048;
231 else if (cpu_is_omap34xx() && (hresize > 4096)) 231 else if (omap_vout_dss_omap34xx() && (hresize > 4096))
232 hresize = 4096; 232 hresize = 4096;
233 233
234 win->w.width = ((1024 * try_crop.width) / hresize) & ~1; 234 win->w.width = ((1024 * try_crop.width) / hresize) & ~1;
@@ -243,7 +243,7 @@ int omap_vout_new_crop(struct v4l2_pix_format *pix,
243 if (try_crop.width == 0) 243 if (try_crop.width == 0)
244 try_crop.width = 2; 244 try_crop.width = 2;
245 } 245 }
246 if (cpu_is_omap24xx()) { 246 if (omap_vout_dss_omap24xx()) {
247 if ((try_crop.height/win->w.height) >= 2) 247 if ((try_crop.height/win->w.height) >= 2)
248 try_crop.height = win->w.height * 2; 248 try_crop.height = win->w.height * 2;
249 249
@@ -258,7 +258,7 @@ int omap_vout_new_crop(struct v4l2_pix_format *pix,
258 if (try_crop.height != win->w.height) 258 if (try_crop.height != win->w.height)
259 try_crop.width = 768; 259 try_crop.width = 768;
260 } 260 }
261 } else if (cpu_is_omap34xx()) { 261 } else if (omap_vout_dss_omap34xx()) {
262 if ((try_crop.height/win->w.height) >= 4) 262 if ((try_crop.height/win->w.height) >= 4)
263 try_crop.height = win->w.height * 4; 263 try_crop.height = win->w.height * 4;
264 264
@@ -337,3 +337,21 @@ void omap_vout_free_buffer(unsigned long virtaddr, u32 buf_size)
337 } 337 }
338 free_pages((unsigned long) virtaddr, order); 338 free_pages((unsigned long) virtaddr, order);
339} 339}
340
341bool omap_vout_dss_omap24xx(void)
342{
343 return omapdss_get_version() == OMAPDSS_VER_OMAP24xx;
344}
345
346bool 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 }
357}
diff --git a/drivers/media/platform/omap/omap_voutlib.h b/drivers/media/platform/omap/omap_voutlib.h
index e51750a597e3..f9d1c0779f33 100644
--- a/drivers/media/platform/omap/omap_voutlib.h
+++ b/drivers/media/platform/omap/omap_voutlib.h
@@ -32,5 +32,8 @@ void omap_vout_new_format(struct v4l2_pix_format *pix,
32 struct v4l2_window *win); 32 struct v4l2_window *win);
33unsigned long omap_vout_alloc_buffer(u32 buf_size, u32 *phys_addr); 33unsigned long omap_vout_alloc_buffer(u32 buf_size, u32 *phys_addr);
34void omap_vout_free_buffer(unsigned long virtaddr, u32 buf_size); 34void omap_vout_free_buffer(unsigned long virtaddr, u32 buf_size);
35
36bool omap_vout_dss_omap24xx(void);
37bool omap_vout_dss_omap34xx(void);
35#endif /* #ifndef OMAP_VOUTLIB_H */ 38#endif /* #ifndef OMAP_VOUTLIB_H */
36 39