aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2009-02-18 15:39:45 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:42:57 -0400
commit602dd48a35e8697be441d1749103187e6b5a922a (patch)
tree67d32ec27169b63f344097c4858e715e4e1f2e79 /drivers
parent107063c6156a0cbf055e771baafc28a3e3c0fb9b (diff)
V4L/DVB (10715): zoran: clean up some old V4L1 left-overs and remove the MAP_NR macro.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/zoran/zoran.h3
-rw-r--r--drivers/media/video/zoran/zoran_driver.c130
2 files changed, 43 insertions, 90 deletions
diff --git a/drivers/media/video/zoran/zoran.h b/drivers/media/video/zoran/zoran.h
index ee31bfc3428f..a323eb66e7cf 100644
--- a/drivers/media/video/zoran/zoran.h
+++ b/drivers/media/video/zoran/zoran.h
@@ -238,9 +238,6 @@ enum gpcs_type {
238 238
239struct zoran_format { 239struct zoran_format {
240 char *name; 240 char *name;
241#ifdef CONFIG_VIDEO_V4L1_COMPAT
242 int palette;
243#endif
244 __u32 fourcc; 241 __u32 fourcc;
245 int colorspace; 242 int colorspace;
246 int depth; 243 int depth;
diff --git a/drivers/media/video/zoran/zoran_driver.c b/drivers/media/video/zoran/zoran_driver.c
index ed8ac660a0c1..a3a6f61187b0 100644
--- a/drivers/media/video/zoran/zoran_driver.c
+++ b/drivers/media/video/zoran/zoran_driver.c
@@ -58,16 +58,6 @@
58#include <linux/i2c-algo-bit.h> 58#include <linux/i2c-algo-bit.h>
59 59
60#include <linux/spinlock.h> 60#include <linux/spinlock.h>
61#define MAP_NR(x) virt_to_page(x)
62#define ZORAN_VID_TYPE ( \
63 VID_TYPE_CAPTURE | \
64 VID_TYPE_OVERLAY | \
65 VID_TYPE_CLIPPING | \
66 VID_TYPE_FRAMERAM | \
67 VID_TYPE_SCALES | \
68 VID_TYPE_MJPEG_DECODER | \
69 VID_TYPE_MJPEG_ENCODER \
70 )
71 61
72#include <linux/videodev.h> 62#include <linux/videodev.h>
73#include <media/v4l2-common.h> 63#include <media/v4l2-common.h>
@@ -86,29 +76,12 @@
86#include "zoran_device.h" 76#include "zoran_device.h"
87#include "zoran_card.h" 77#include "zoran_card.h"
88 78
89 /* we declare some card type definitions here, they mean
90 * the same as the v4l1 ZORAN_VID_TYPE above, except it's v4l2 */
91#define ZORAN_V4L2_VID_FLAGS ( \
92 V4L2_CAP_STREAMING |\
93 V4L2_CAP_VIDEO_CAPTURE |\
94 V4L2_CAP_VIDEO_OUTPUT |\
95 V4L2_CAP_VIDEO_OVERLAY \
96 )
97
98
99#if defined(CONFIG_VIDEO_V4L1_COMPAT)
100#define ZFMT(pal, fcc, cs) \
101 .palette = (pal), .fourcc = (fcc), .colorspace = (cs)
102#else
103#define ZFMT(pal, fcc, cs) \
104 .fourcc = (fcc), .colorspace = (cs)
105#endif
106 79
107const struct zoran_format zoran_formats[] = { 80const struct zoran_format zoran_formats[] = {
108 { 81 {
109 .name = "15-bit RGB LE", 82 .name = "15-bit RGB LE",
110 ZFMT(VIDEO_PALETTE_RGB555, 83 .fourcc = V4L2_PIX_FMT_RGB555,
111 V4L2_PIX_FMT_RGB555, V4L2_COLORSPACE_SRGB), 84 .colorspace = V4L2_COLORSPACE_SRGB,
112 .depth = 15, 85 .depth = 15,
113 .flags = ZORAN_FORMAT_CAPTURE | 86 .flags = ZORAN_FORMAT_CAPTURE |
114 ZORAN_FORMAT_OVERLAY, 87 ZORAN_FORMAT_OVERLAY,
@@ -116,16 +89,16 @@ const struct zoran_format zoran_formats[] = {
116 ZR36057_VFESPFR_LittleEndian, 89 ZR36057_VFESPFR_LittleEndian,
117 }, { 90 }, {
118 .name = "15-bit RGB BE", 91 .name = "15-bit RGB BE",
119 ZFMT(-1, 92 .fourcc = V4L2_PIX_FMT_RGB555X,
120 V4L2_PIX_FMT_RGB555X, V4L2_COLORSPACE_SRGB), 93 .colorspace = V4L2_COLORSPACE_SRGB,
121 .depth = 15, 94 .depth = 15,
122 .flags = ZORAN_FORMAT_CAPTURE | 95 .flags = ZORAN_FORMAT_CAPTURE |
123 ZORAN_FORMAT_OVERLAY, 96 ZORAN_FORMAT_OVERLAY,
124 .vfespfr = ZR36057_VFESPFR_RGB555|ZR36057_VFESPFR_ErrDif, 97 .vfespfr = ZR36057_VFESPFR_RGB555|ZR36057_VFESPFR_ErrDif,
125 }, { 98 }, {
126 .name = "16-bit RGB LE", 99 .name = "16-bit RGB LE",
127 ZFMT(VIDEO_PALETTE_RGB565, 100 .fourcc = V4L2_PIX_FMT_RGB565,
128 V4L2_PIX_FMT_RGB565, V4L2_COLORSPACE_SRGB), 101 .colorspace = V4L2_COLORSPACE_SRGB,
129 .depth = 16, 102 .depth = 16,
130 .flags = ZORAN_FORMAT_CAPTURE | 103 .flags = ZORAN_FORMAT_CAPTURE |
131 ZORAN_FORMAT_OVERLAY, 104 ZORAN_FORMAT_OVERLAY,
@@ -133,56 +106,56 @@ const struct zoran_format zoran_formats[] = {
133 ZR36057_VFESPFR_LittleEndian, 106 ZR36057_VFESPFR_LittleEndian,
134 }, { 107 }, {
135 .name = "16-bit RGB BE", 108 .name = "16-bit RGB BE",
136 ZFMT(-1, 109 .fourcc = V4L2_PIX_FMT_RGB565X,
137 V4L2_PIX_FMT_RGB565X, V4L2_COLORSPACE_SRGB), 110 .colorspace = V4L2_COLORSPACE_SRGB,
138 .depth = 16, 111 .depth = 16,
139 .flags = ZORAN_FORMAT_CAPTURE | 112 .flags = ZORAN_FORMAT_CAPTURE |
140 ZORAN_FORMAT_OVERLAY, 113 ZORAN_FORMAT_OVERLAY,
141 .vfespfr = ZR36057_VFESPFR_RGB565|ZR36057_VFESPFR_ErrDif, 114 .vfespfr = ZR36057_VFESPFR_RGB565|ZR36057_VFESPFR_ErrDif,
142 }, { 115 }, {
143 .name = "24-bit RGB", 116 .name = "24-bit RGB",
144 ZFMT(VIDEO_PALETTE_RGB24, 117 .fourcc = V4L2_PIX_FMT_BGR24,
145 V4L2_PIX_FMT_BGR24, V4L2_COLORSPACE_SRGB), 118 .colorspace = V4L2_COLORSPACE_SRGB,
146 .depth = 24, 119 .depth = 24,
147 .flags = ZORAN_FORMAT_CAPTURE | 120 .flags = ZORAN_FORMAT_CAPTURE |
148 ZORAN_FORMAT_OVERLAY, 121 ZORAN_FORMAT_OVERLAY,
149 .vfespfr = ZR36057_VFESPFR_RGB888|ZR36057_VFESPFR_Pack24, 122 .vfespfr = ZR36057_VFESPFR_RGB888|ZR36057_VFESPFR_Pack24,
150 }, { 123 }, {
151 .name = "32-bit RGB LE", 124 .name = "32-bit RGB LE",
152 ZFMT(VIDEO_PALETTE_RGB32, 125 .fourcc = V4L2_PIX_FMT_BGR32,
153 V4L2_PIX_FMT_BGR32, V4L2_COLORSPACE_SRGB), 126 .colorspace = V4L2_COLORSPACE_SRGB,
154 .depth = 32, 127 .depth = 32,
155 .flags = ZORAN_FORMAT_CAPTURE | 128 .flags = ZORAN_FORMAT_CAPTURE |
156 ZORAN_FORMAT_OVERLAY, 129 ZORAN_FORMAT_OVERLAY,
157 .vfespfr = ZR36057_VFESPFR_RGB888|ZR36057_VFESPFR_LittleEndian, 130 .vfespfr = ZR36057_VFESPFR_RGB888|ZR36057_VFESPFR_LittleEndian,
158 }, { 131 }, {
159 .name = "32-bit RGB BE", 132 .name = "32-bit RGB BE",
160 ZFMT(-1, 133 .fourcc = V4L2_PIX_FMT_RGB32,
161 V4L2_PIX_FMT_RGB32, V4L2_COLORSPACE_SRGB), 134 .colorspace = V4L2_COLORSPACE_SRGB,
162 .depth = 32, 135 .depth = 32,
163 .flags = ZORAN_FORMAT_CAPTURE | 136 .flags = ZORAN_FORMAT_CAPTURE |
164 ZORAN_FORMAT_OVERLAY, 137 ZORAN_FORMAT_OVERLAY,
165 .vfespfr = ZR36057_VFESPFR_RGB888, 138 .vfespfr = ZR36057_VFESPFR_RGB888,
166 }, { 139 }, {
167 .name = "4:2:2, packed, YUYV", 140 .name = "4:2:2, packed, YUYV",
168 ZFMT(VIDEO_PALETTE_YUV422, 141 .fourcc = V4L2_PIX_FMT_YUYV,
169 V4L2_PIX_FMT_YUYV, V4L2_COLORSPACE_SMPTE170M), 142 .colorspace = V4L2_COLORSPACE_SMPTE170M,
170 .depth = 16, 143 .depth = 16,
171 .flags = ZORAN_FORMAT_CAPTURE | 144 .flags = ZORAN_FORMAT_CAPTURE |
172 ZORAN_FORMAT_OVERLAY, 145 ZORAN_FORMAT_OVERLAY,
173 .vfespfr = ZR36057_VFESPFR_YUV422, 146 .vfespfr = ZR36057_VFESPFR_YUV422,
174 }, { 147 }, {
175 .name = "4:2:2, packed, UYVY", 148 .name = "4:2:2, packed, UYVY",
176 ZFMT(VIDEO_PALETTE_UYVY, 149 .fourcc = V4L2_PIX_FMT_UYVY,
177 V4L2_PIX_FMT_UYVY, V4L2_COLORSPACE_SMPTE170M), 150 .colorspace = V4L2_COLORSPACE_SMPTE170M,
178 .depth = 16, 151 .depth = 16,
179 .flags = ZORAN_FORMAT_CAPTURE | 152 .flags = ZORAN_FORMAT_CAPTURE |
180 ZORAN_FORMAT_OVERLAY, 153 ZORAN_FORMAT_OVERLAY,
181 .vfespfr = ZR36057_VFESPFR_YUV422|ZR36057_VFESPFR_LittleEndian, 154 .vfespfr = ZR36057_VFESPFR_YUV422|ZR36057_VFESPFR_LittleEndian,
182 }, { 155 }, {
183 .name = "Hardware-encoded Motion-JPEG", 156 .name = "Hardware-encoded Motion-JPEG",
184 ZFMT(-1, 157 .fourcc = V4L2_PIX_FMT_MJPEG,
185 V4L2_PIX_FMT_MJPEG, V4L2_COLORSPACE_SMPTE170M), 158 .colorspace = V4L2_COLORSPACE_SMPTE170M,
186 .depth = 0, 159 .depth = 0,
187 .flags = ZORAN_FORMAT_CAPTURE | 160 .flags = ZORAN_FORMAT_CAPTURE |
188 ZORAN_FORMAT_PLAYBACK | 161 ZORAN_FORMAT_PLAYBACK |
@@ -260,7 +233,7 @@ v4l_fbuffer_alloc (struct file *file)
260 virt_to_bus(mem); 233 virt_to_bus(mem);
261 for (off = 0; off < fh->v4l_buffers.buffer_size; 234 for (off = 0; off < fh->v4l_buffers.buffer_size;
262 off += PAGE_SIZE) 235 off += PAGE_SIZE)
263 SetPageReserved(MAP_NR(mem + off)); 236 SetPageReserved(virt_to_page(mem + off));
264 dprintk(4, 237 dprintk(4,
265 KERN_INFO 238 KERN_INFO
266 "%s: v4l_fbuffer_alloc() - V4L frame %d mem 0x%lx (bus: 0x%lx)\n", 239 "%s: v4l_fbuffer_alloc() - V4L frame %d mem 0x%lx (bus: 0x%lx)\n",
@@ -291,7 +264,7 @@ v4l_fbuffer_free (struct file *file)
291 mem = fh->v4l_buffers.buffer[i].fbuffer; 264 mem = fh->v4l_buffers.buffer[i].fbuffer;
292 for (off = 0; off < fh->v4l_buffers.buffer_size; 265 for (off = 0; off < fh->v4l_buffers.buffer_size;
293 off += PAGE_SIZE) 266 off += PAGE_SIZE)
294 ClearPageReserved(MAP_NR(mem + off)); 267 ClearPageReserved(virt_to_page(mem + off));
295 kfree((void *) fh->v4l_buffers.buffer[i].fbuffer); 268 kfree((void *) fh->v4l_buffers.buffer[i].fbuffer);
296 fh->v4l_buffers.buffer[i].fbuffer = NULL; 269 fh->v4l_buffers.buffer[i].fbuffer = NULL;
297 } 270 }
@@ -377,7 +350,7 @@ jpg_fbuffer_alloc (struct file *file)
377 cpu_to_le32(((fh->jpg_buffers.buffer_size / 4) << 1) | 1); 350 cpu_to_le32(((fh->jpg_buffers.buffer_size / 4) << 1) | 1);
378 for (off = 0; off < fh->jpg_buffers.buffer_size; 351 for (off = 0; off < fh->jpg_buffers.buffer_size;
379 off += PAGE_SIZE) 352 off += PAGE_SIZE)
380 SetPageReserved(MAP_NR(mem + off)); 353 SetPageReserved(virt_to_page(mem + off));
381 } else { 354 } else {
382 /* jpg_bufsize is already page aligned */ 355 /* jpg_bufsize is already page aligned */
383 for (j = 0; 356 for (j = 0;
@@ -398,7 +371,7 @@ jpg_fbuffer_alloc (struct file *file)
398 fh->jpg_buffers.buffer[i].frag_tab[2 * j + 371 fh->jpg_buffers.buffer[i].frag_tab[2 * j +
399 1] = 372 1] =
400 cpu_to_le32((PAGE_SIZE / 4) << 1); 373 cpu_to_le32((PAGE_SIZE / 4) << 1);
401 SetPageReserved(MAP_NR(mem)); 374 SetPageReserved(virt_to_page(mem));
402 } 375 }
403 376
404 fh->jpg_buffers.buffer[i].frag_tab[2 * j - 1] |= cpu_to_le32(1); 377 fh->jpg_buffers.buffer[i].frag_tab[2 * j - 1] |= cpu_to_le32(1);
@@ -424,6 +397,7 @@ jpg_fbuffer_free (struct file *file)
424 struct zoran *zr = fh->zr; 397 struct zoran *zr = fh->zr;
425 int i, j, off; 398 int i, j, off;
426 unsigned char *mem; 399 unsigned char *mem;
400 __le32 frag_tab;
427 401
428 dprintk(4, KERN_DEBUG "%s: jpg_fbuffer_free()\n", ZR_DEVNAME(zr)); 402 dprintk(4, KERN_DEBUG "%s: jpg_fbuffer_free()\n", ZR_DEVNAME(zr));
429 403
@@ -431,48 +405,31 @@ jpg_fbuffer_free (struct file *file)
431 if (!fh->jpg_buffers.buffer[i].frag_tab) 405 if (!fh->jpg_buffers.buffer[i].frag_tab)
432 continue; 406 continue;
433 407
434 //if (alloc_contig) {
435 if (fh->jpg_buffers.need_contiguous) { 408 if (fh->jpg_buffers.need_contiguous) {
436 if (fh->jpg_buffers.buffer[i].frag_tab[0]) { 409 frag_tab = fh->jpg_buffers.buffer[i].frag_tab[0];
437 mem = (unsigned char *) bus_to_virt(le32_to_cpu( 410
438 fh->jpg_buffers.buffer[i].frag_tab[0])); 411 if (frag_tab) {
439 for (off = 0; 412 mem = (unsigned char *)bus_to_virt(le32_to_cpu(frag_tab));
440 off < fh->jpg_buffers.buffer_size; 413 for (off = 0; off < fh->jpg_buffers.buffer_size; off += PAGE_SIZE)
441 off += PAGE_SIZE) 414 ClearPageReserved(virt_to_page(mem + off));
442 ClearPageReserved(MAP_NR
443 (mem + off));
444 kfree(mem); 415 kfree(mem);
445 fh->jpg_buffers.buffer[i].frag_tab[0] = 0; 416 fh->jpg_buffers.buffer[i].frag_tab[0] = 0;
446 fh->jpg_buffers.buffer[i].frag_tab[1] = 0; 417 fh->jpg_buffers.buffer[i].frag_tab[1] = 0;
447 } 418 }
448 } else { 419 } else {
449 for (j = 0; 420 for (j = 0; j < fh->jpg_buffers.buffer_size / PAGE_SIZE; j++) {
450 j < fh->jpg_buffers.buffer_size / PAGE_SIZE; 421 frag_tab = fh->jpg_buffers.buffer[i].frag_tab[2 * j];
451 j++) { 422
452 if (!fh->jpg_buffers.buffer[i]. 423 if (!frag_tab)
453 frag_tab[2 * j])
454 break; 424 break;
455 ClearPageReserved(MAP_NR 425 ClearPageReserved(virt_to_page(bus_to_virt(le32_to_cpu(frag_tab))));
456 (bus_to_virt 426 free_page((unsigned long)bus_to_virt(le32_to_cpu(frag_tab)));
457 (le32_to_cpu 427 fh->jpg_buffers.buffer[i].frag_tab[2 * j] = 0;
458 (fh->jpg_buffers. 428 fh->jpg_buffers.buffer[i].frag_tab[2 * j + 1] = 0;
459 buffer[i].frag_tab[2 *
460 j]))));
461 free_page((unsigned long)
462 bus_to_virt
463 (le32_to_cpu
464 (fh->jpg_buffers.
465 buffer[i].
466 frag_tab[2 * j])));
467 fh->jpg_buffers.buffer[i].frag_tab[2 * j] =
468 0;
469 fh->jpg_buffers.buffer[i].frag_tab[2 * j +
470 1] = 0;
471 } 429 }
472 } 430 }
473 431
474 free_page((unsigned long) fh->jpg_buffers.buffer[i]. 432 free_page((unsigned long)fh->jpg_buffers.buffer[i].frag_tab);
475 frag_tab);
476 fh->jpg_buffers.buffer[i].frag_tab = NULL; 433 fh->jpg_buffers.buffer[i].frag_tab = NULL;
477 } 434 }
478 435
@@ -2016,11 +1973,10 @@ static int zoran_querycap(struct file *file, void *__fh, struct v4l2_capability
2016 strncpy(cap->driver, "zoran", sizeof(cap->driver)-1); 1973 strncpy(cap->driver, "zoran", sizeof(cap->driver)-1);
2017 snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s", 1974 snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s",
2018 pci_name(zr->pci_dev)); 1975 pci_name(zr->pci_dev));
2019 cap->version = 1976 cap->version = KERNEL_VERSION(MAJOR_VERSION, MINOR_VERSION,
2020 KERNEL_VERSION(MAJOR_VERSION, MINOR_VERSION,
2021 RELEASE_VERSION); 1977 RELEASE_VERSION);
2022 cap->capabilities = ZORAN_V4L2_VID_FLAGS; 1978 cap->capabilities = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_CAPTURE |
2023 1979 V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_VIDEO_OVERLAY;
2024 return 0; 1980 return 0;
2025} 1981}
2026 1982