diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2010-12-25 04:58:01 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-12-29 05:17:07 -0500 |
commit | ad1ecf8639e51ab8066cd4f37fd36b6b7cbdd8b3 (patch) | |
tree | 094cd457f4db08760e20fccc169029a0779bf6d0 | |
parent | 08af245de0cf6ab5f4ed008ee2bb99273774fce0 (diff) |
[media] zoran: remove V4L1 compat code and zoran custom ioctls
All the functionality is now handled through V4L2.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | Documentation/video4linux/Zoran | 74 | ||||
-rw-r--r-- | drivers/media/video/zoran/zoran.h | 107 | ||||
-rw-r--r-- | drivers/media/video/zoran/zoran_card.c | 2 | ||||
-rw-r--r-- | drivers/media/video/zoran/zoran_driver.c | 321 |
4 files changed, 4 insertions, 500 deletions
diff --git a/Documentation/video4linux/Zoran b/Documentation/video4linux/Zoran index 00e3f9267814..699b60e070d2 100644 --- a/Documentation/video4linux/Zoran +++ b/Documentation/video4linux/Zoran | |||
@@ -322,76 +322,11 @@ your IRQs and make sure the card has its own interrupts. | |||
322 | 322 | ||
323 | 4. Programming interface | 323 | 4. Programming interface |
324 | 324 | ||
325 | This driver conforms to video4linux and video4linux2, both can be used to | 325 | This driver conforms to video4linux2. Support for V4L1 and for the custom |
326 | use the driver. Since video4linux didn't provide adequate calls to fully | 326 | zoran ioctls has been removed in kernel 2.6.38. |
327 | use the cards' features, we've introduced several programming extensions, | ||
328 | which are currently officially accepted in the 2.4.x branch of the kernel. | ||
329 | These extensions are known as the v4l/mjpeg extensions. See zoran.h for | ||
330 | details (structs/ioctls). | ||
331 | |||
332 | Information - video4linux: | ||
333 | http://linux.bytesex.org/v4l2/API.html | ||
334 | Documentation/video4linux/API.html | ||
335 | /usr/include/linux/videodev.h | ||
336 | |||
337 | Information - video4linux/mjpeg extensions: | ||
338 | ./zoran.h | ||
339 | (also see below) | ||
340 | |||
341 | Information - video4linux2: | ||
342 | http://linuxtv.org | ||
343 | http://v4l2spec.bytesex.org/ | ||
344 | /usr/include/linux/videodev2.h | ||
345 | |||
346 | More information on the video4linux/mjpeg extensions, by Serguei | ||
347 | Miridonovi and Rainer Johanni: | ||
348 | -- | ||
349 | The ioctls for that interface are as follows: | ||
350 | |||
351 | BUZIOC_G_PARAMS | ||
352 | BUZIOC_S_PARAMS | ||
353 | |||
354 | Get and set the parameters of the buz. The user should always do a | ||
355 | BUZIOC_G_PARAMS (with a struct buz_params) to obtain the default | ||
356 | settings, change what he likes and then make a BUZIOC_S_PARAMS call. | ||
357 | |||
358 | BUZIOC_REQBUFS | ||
359 | |||
360 | Before being able to capture/playback, the user has to request | ||
361 | the buffers he is wanting to use. Fill the structure | ||
362 | zoran_requestbuffers with the size (recommended: 256*1024) and | ||
363 | the number (recommended 32 up to 256). There are no such restrictions | ||
364 | as for the Video for Linux buffers, you should LEAVE SUFFICIENT | ||
365 | MEMORY for your system however, else strange things will happen .... | ||
366 | On return, the zoran_requestbuffers structure contains number and | ||
367 | size of the actually allocated buffers. | ||
368 | You should use these numbers for doing a mmap of the buffers | ||
369 | into the user space. | ||
370 | The BUZIOC_REQBUFS ioctl also makes it happen, that the next mmap | ||
371 | maps the MJPEG buffer instead of the V4L buffers. | ||
372 | |||
373 | BUZIOC_QBUF_CAPT | ||
374 | BUZIOC_QBUF_PLAY | ||
375 | |||
376 | Queue a buffer for capture or playback. The first call also starts | ||
377 | streaming capture. When streaming capture is going on, you may | ||
378 | only queue further buffers or issue syncs until streaming | ||
379 | capture is switched off again with a argument of -1 to | ||
380 | a BUZIOC_QBUF_CAPT/BUZIOC_QBUF_PLAY ioctl. | ||
381 | |||
382 | BUZIOC_SYNC | ||
383 | |||
384 | Issue this ioctl when all buffers are queued. This ioctl will | ||
385 | block until the first buffer becomes free for saving its | ||
386 | data to disk (after BUZIOC_QBUF_CAPT) or for reuse (after BUZIOC_QBUF_PLAY). | ||
387 | |||
388 | BUZIOC_G_STATUS | ||
389 | |||
390 | Get the status of the input lines (video source connected/norm). | ||
391 | 327 | ||
392 | For programming example, please, look at lavrec.c and lavplay.c code in | 328 | For programming example, please, look at lavrec.c and lavplay.c code in |
393 | lavtools-1.2p2 package (URL: http://www.cicese.mx/) | 329 | the MJPEG-tools (http://mjpeg.sf.net/). |
394 | and the 'examples' directory in the original Buz driver distribution. | ||
395 | 330 | ||
396 | Additional notes for software developers: | 331 | Additional notes for software developers: |
397 | 332 | ||
@@ -402,9 +337,6 @@ Additional notes for software developers: | |||
402 | standard is "more constant" for current country than geometry | 337 | standard is "more constant" for current country than geometry |
403 | settings of a variety of TV capture cards which may work in ITU or | 338 | settings of a variety of TV capture cards which may work in ITU or |
404 | square pixel format. | 339 | square pixel format. |
405 | -- | ||
406 | Please note that lavplay/lavrec are also included in the MJPEG-tools | ||
407 | (http://mjpeg.sf.net/). | ||
408 | 340 | ||
409 | =========================== | 341 | =========================== |
410 | 342 | ||
diff --git a/drivers/media/video/zoran/zoran.h b/drivers/media/video/zoran/zoran.h index 27f05551183f..4bb368e6fd47 100644 --- a/drivers/media/video/zoran/zoran.h +++ b/drivers/media/video/zoran/zoran.h | |||
@@ -33,15 +33,6 @@ | |||
33 | 33 | ||
34 | #include <media/v4l2-device.h> | 34 | #include <media/v4l2-device.h> |
35 | 35 | ||
36 | #define ZORAN_VIDMODE_PAL 0 | ||
37 | #define ZORAN_VIDMODE_NTSC 1 | ||
38 | #define ZORAN_VIDMODE_SECAM 2 | ||
39 | |||
40 | struct zoran_requestbuffers { | ||
41 | unsigned long count; /* Number of buffers for MJPEG grabbing */ | ||
42 | unsigned long size; /* Size PER BUFFER in bytes */ | ||
43 | }; | ||
44 | |||
45 | struct zoran_sync { | 36 | struct zoran_sync { |
46 | unsigned long frame; /* number of buffer that has been free'd */ | 37 | unsigned long frame; /* number of buffer that has been free'd */ |
47 | unsigned long length; /* number of code bytes in buffer (capture only) */ | 38 | unsigned long length; /* number of code bytes in buffer (capture only) */ |
@@ -49,102 +40,6 @@ struct zoran_sync { | |||
49 | struct timeval timestamp; /* timestamp */ | 40 | struct timeval timestamp; /* timestamp */ |
50 | }; | 41 | }; |
51 | 42 | ||
52 | struct zoran_status { | ||
53 | int input; /* Input channel, has to be set prior to BUZIOC_G_STATUS */ | ||
54 | int signal; /* Returned: 1 if valid video signal detected */ | ||
55 | int norm; /* Returned: ZORAN_VIDMODE_PAL or ZORAN_VIDMODE_NTSC */ | ||
56 | int color; /* Returned: 1 if color signal detected */ | ||
57 | }; | ||
58 | |||
59 | struct zoran_params { | ||
60 | |||
61 | /* The following parameters can only be queried */ | ||
62 | |||
63 | int major_version; /* Major version number of driver */ | ||
64 | int minor_version; /* Minor version number of driver */ | ||
65 | |||
66 | /* Main control parameters */ | ||
67 | |||
68 | int input; /* Input channel: 0 = Composite, 1 = S-VHS */ | ||
69 | int norm; /* Norm: ZORAN_VIDMODE_PAL or ZORAN_VIDMODE_NTSC */ | ||
70 | int decimation; /* decimation of captured video, | ||
71 | * enlargement of video played back. | ||
72 | * Valid values are 1, 2, 4 or 0. | ||
73 | * 0 is a special value where the user | ||
74 | * has full control over video scaling */ | ||
75 | |||
76 | /* The following parameters only have to be set if decimation==0, | ||
77 | * for other values of decimation they provide the data how the image is captured */ | ||
78 | |||
79 | int HorDcm; /* Horizontal decimation: 1, 2 or 4 */ | ||
80 | int VerDcm; /* Vertical decimation: 1 or 2 */ | ||
81 | int TmpDcm; /* Temporal decimation: 1 or 2, | ||
82 | * if TmpDcm==2 in capture every second frame is dropped, | ||
83 | * in playback every frame is played twice */ | ||
84 | int field_per_buff; /* Number of fields per buffer: 1 or 2 */ | ||
85 | int img_x; /* start of image in x direction */ | ||
86 | int img_y; /* start of image in y direction */ | ||
87 | int img_width; /* image width BEFORE decimation, | ||
88 | * must be a multiple of HorDcm*16 */ | ||
89 | int img_height; /* image height BEFORE decimation, | ||
90 | * must be a multiple of VerDcm*8 */ | ||
91 | |||
92 | /* --- End of parameters for decimation==0 only --- */ | ||
93 | |||
94 | /* JPEG control parameters */ | ||
95 | |||
96 | int quality; /* Measure for quality of compressed images. | ||
97 | * Scales linearly with the size of the compressed images. | ||
98 | * Must be beetween 0 and 100, 100 is a compression | ||
99 | * ratio of 1:4 */ | ||
100 | |||
101 | int odd_even; /* Which field should come first ??? */ | ||
102 | |||
103 | int APPn; /* Number of APP segment to be written, must be 0..15 */ | ||
104 | int APP_len; /* Length of data in JPEG APPn segment */ | ||
105 | char APP_data[60]; /* Data in the JPEG APPn segment. */ | ||
106 | |||
107 | int COM_len; /* Length of data in JPEG COM segment */ | ||
108 | char COM_data[60]; /* Data in JPEG COM segment */ | ||
109 | |||
110 | unsigned long jpeg_markers; /* Which markers should go into the JPEG output. | ||
111 | * Unless you exactly know what you do, leave them untouched. | ||
112 | * Inluding less markers will make the resulting code | ||
113 | * smaller, but there will be fewer applications | ||
114 | * which can read it. | ||
115 | * The presence of the APP and COM marker is | ||
116 | * influenced by APP0_len and COM_len ONLY! */ | ||
117 | #define JPEG_MARKER_DHT (1<<3) /* Define Huffman Tables */ | ||
118 | #define JPEG_MARKER_DQT (1<<4) /* Define Quantization Tables */ | ||
119 | #define JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */ | ||
120 | #define JPEG_MARKER_COM (1<<6) /* Comment segment */ | ||
121 | #define JPEG_MARKER_APP (1<<7) /* App segment, driver will allways use APP0 */ | ||
122 | |||
123 | int VFIFO_FB; /* Flag for enabling Video Fifo Feedback. | ||
124 | * If this flag is turned on and JPEG decompressing | ||
125 | * is going to the screen, the decompress process | ||
126 | * is stopped every time the Video Fifo is full. | ||
127 | * This enables a smooth decompress to the screen | ||
128 | * but the video output signal will get scrambled */ | ||
129 | |||
130 | /* Misc */ | ||
131 | |||
132 | char reserved[312]; /* Makes 512 bytes for this structure */ | ||
133 | }; | ||
134 | |||
135 | /* | ||
136 | Private IOCTL to set up for displaying MJPEG | ||
137 | */ | ||
138 | #define BUZIOC_G_PARAMS _IOR ('v', BASE_VIDIOC_PRIVATE+0, struct zoran_params) | ||
139 | #define BUZIOC_S_PARAMS _IOWR('v', BASE_VIDIOC_PRIVATE+1, struct zoran_params) | ||
140 | #define BUZIOC_REQBUFS _IOWR('v', BASE_VIDIOC_PRIVATE+2, struct zoran_requestbuffers) | ||
141 | #define BUZIOC_QBUF_CAPT _IOW ('v', BASE_VIDIOC_PRIVATE+3, int) | ||
142 | #define BUZIOC_QBUF_PLAY _IOW ('v', BASE_VIDIOC_PRIVATE+4, int) | ||
143 | #define BUZIOC_SYNC _IOR ('v', BASE_VIDIOC_PRIVATE+5, struct zoran_sync) | ||
144 | #define BUZIOC_G_STATUS _IOWR('v', BASE_VIDIOC_PRIVATE+6, struct zoran_status) | ||
145 | |||
146 | |||
147 | #ifdef __KERNEL__ | ||
148 | 43 | ||
149 | #define MAJOR_VERSION 0 /* driver major version */ | 44 | #define MAJOR_VERSION 0 /* driver major version */ |
150 | #define MINOR_VERSION 10 /* driver minor version */ | 45 | #define MINOR_VERSION 10 /* driver minor version */ |
@@ -507,6 +402,4 @@ static inline struct zoran *to_zoran(struct v4l2_device *v4l2_dev) | |||
507 | #define btor(dat,adr) btwrite((dat) | btread(adr), adr) | 402 | #define btor(dat,adr) btwrite((dat) | btread(adr), adr) |
508 | #define btaor(dat,mask,adr) btwrite((dat) | ((mask) & btread(adr)), adr) | 403 | #define btaor(dat,mask,adr) btwrite((dat) | ((mask) & btread(adr)), adr) |
509 | 404 | ||
510 | #endif /* __kernel__ */ | ||
511 | |||
512 | #endif | 405 | #endif |
diff --git a/drivers/media/video/zoran/zoran_card.c b/drivers/media/video/zoran/zoran_card.c index e520abf9f4c3..9cdc3bb15b15 100644 --- a/drivers/media/video/zoran/zoran_card.c +++ b/drivers/media/video/zoran/zoran_card.c | |||
@@ -943,7 +943,7 @@ zoran_open_init_params (struct zoran *zr) | |||
943 | memset(zr->jpg_settings.jpg_comp.COM_data, 0, | 943 | memset(zr->jpg_settings.jpg_comp.COM_data, 0, |
944 | sizeof(zr->jpg_settings.jpg_comp.COM_data)); | 944 | sizeof(zr->jpg_settings.jpg_comp.COM_data)); |
945 | zr->jpg_settings.jpg_comp.jpeg_markers = | 945 | zr->jpg_settings.jpg_comp.jpeg_markers = |
946 | JPEG_MARKER_DHT | JPEG_MARKER_DQT; | 946 | V4L2_JPEG_MARKER_DHT | V4L2_JPEG_MARKER_DQT; |
947 | i = zoran_check_jpg_settings(zr, &zr->jpg_settings, 0); | 947 | i = zoran_check_jpg_settings(zr, &zr->jpg_settings, 0); |
948 | if (i) | 948 | if (i) |
949 | dprintk(1, KERN_ERR "%s: %s internal error\n", | 949 | dprintk(1, KERN_ERR "%s: %s internal error\n", |
diff --git a/drivers/media/video/zoran/zoran_driver.c b/drivers/media/video/zoran/zoran_driver.c index 67a52e844ae6..1b67b1914038 100644 --- a/drivers/media/video/zoran/zoran_driver.c +++ b/drivers/media/video/zoran/zoran_driver.c | |||
@@ -1528,323 +1528,6 @@ zoran_set_input (struct zoran *zr, | |||
1528 | * ioctl routine | 1528 | * ioctl routine |
1529 | */ | 1529 | */ |
1530 | 1530 | ||
1531 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
1532 | static long zoran_default(struct file *file, void *__fh, int cmd, void *arg) | ||
1533 | { | ||
1534 | struct zoran_fh *fh = __fh; | ||
1535 | struct zoran *zr = fh->zr; | ||
1536 | struct zoran_jpg_settings settings; | ||
1537 | |||
1538 | switch (cmd) { | ||
1539 | case BUZIOC_G_PARAMS: | ||
1540 | { | ||
1541 | struct zoran_params *bparams = arg; | ||
1542 | |||
1543 | dprintk(3, KERN_DEBUG "%s: BUZIOC_G_PARAMS\n", ZR_DEVNAME(zr)); | ||
1544 | |||
1545 | memset(bparams, 0, sizeof(struct zoran_params)); | ||
1546 | bparams->major_version = MAJOR_VERSION; | ||
1547 | bparams->minor_version = MINOR_VERSION; | ||
1548 | |||
1549 | mutex_lock(&zr->resource_lock); | ||
1550 | |||
1551 | if (zr->norm & V4L2_STD_NTSC) | ||
1552 | bparams->norm = ZORAN_VIDMODE_NTSC; | ||
1553 | else if (zr->norm & V4L2_STD_SECAM) | ||
1554 | bparams->norm = ZORAN_VIDMODE_SECAM; | ||
1555 | else | ||
1556 | bparams->norm = ZORAN_VIDMODE_PAL; | ||
1557 | |||
1558 | bparams->input = zr->input; | ||
1559 | |||
1560 | bparams->decimation = fh->jpg_settings.decimation; | ||
1561 | bparams->HorDcm = fh->jpg_settings.HorDcm; | ||
1562 | bparams->VerDcm = fh->jpg_settings.VerDcm; | ||
1563 | bparams->TmpDcm = fh->jpg_settings.TmpDcm; | ||
1564 | bparams->field_per_buff = fh->jpg_settings.field_per_buff; | ||
1565 | bparams->img_x = fh->jpg_settings.img_x; | ||
1566 | bparams->img_y = fh->jpg_settings.img_y; | ||
1567 | bparams->img_width = fh->jpg_settings.img_width; | ||
1568 | bparams->img_height = fh->jpg_settings.img_height; | ||
1569 | bparams->odd_even = fh->jpg_settings.odd_even; | ||
1570 | |||
1571 | bparams->quality = fh->jpg_settings.jpg_comp.quality; | ||
1572 | bparams->APPn = fh->jpg_settings.jpg_comp.APPn; | ||
1573 | bparams->APP_len = fh->jpg_settings.jpg_comp.APP_len; | ||
1574 | memcpy(bparams->APP_data, | ||
1575 | fh->jpg_settings.jpg_comp.APP_data, | ||
1576 | sizeof(bparams->APP_data)); | ||
1577 | bparams->COM_len = zr->jpg_settings.jpg_comp.COM_len; | ||
1578 | memcpy(bparams->COM_data, | ||
1579 | fh->jpg_settings.jpg_comp.COM_data, | ||
1580 | sizeof(bparams->COM_data)); | ||
1581 | bparams->jpeg_markers = | ||
1582 | fh->jpg_settings.jpg_comp.jpeg_markers; | ||
1583 | |||
1584 | mutex_unlock(&zr->resource_lock); | ||
1585 | |||
1586 | bparams->VFIFO_FB = 0; | ||
1587 | |||
1588 | return 0; | ||
1589 | } | ||
1590 | |||
1591 | case BUZIOC_S_PARAMS: | ||
1592 | { | ||
1593 | struct zoran_params *bparams = arg; | ||
1594 | int res = 0; | ||
1595 | |||
1596 | dprintk(3, KERN_DEBUG "%s: BUZIOC_S_PARAMS\n", ZR_DEVNAME(zr)); | ||
1597 | |||
1598 | settings.decimation = bparams->decimation; | ||
1599 | settings.HorDcm = bparams->HorDcm; | ||
1600 | settings.VerDcm = bparams->VerDcm; | ||
1601 | settings.TmpDcm = bparams->TmpDcm; | ||
1602 | settings.field_per_buff = bparams->field_per_buff; | ||
1603 | settings.img_x = bparams->img_x; | ||
1604 | settings.img_y = bparams->img_y; | ||
1605 | settings.img_width = bparams->img_width; | ||
1606 | settings.img_height = bparams->img_height; | ||
1607 | settings.odd_even = bparams->odd_even; | ||
1608 | |||
1609 | settings.jpg_comp.quality = bparams->quality; | ||
1610 | settings.jpg_comp.APPn = bparams->APPn; | ||
1611 | settings.jpg_comp.APP_len = bparams->APP_len; | ||
1612 | memcpy(settings.jpg_comp.APP_data, bparams->APP_data, | ||
1613 | sizeof(bparams->APP_data)); | ||
1614 | settings.jpg_comp.COM_len = bparams->COM_len; | ||
1615 | memcpy(settings.jpg_comp.COM_data, bparams->COM_data, | ||
1616 | sizeof(bparams->COM_data)); | ||
1617 | settings.jpg_comp.jpeg_markers = bparams->jpeg_markers; | ||
1618 | |||
1619 | mutex_lock(&zr->resource_lock); | ||
1620 | |||
1621 | if (zr->codec_mode != BUZ_MODE_IDLE) { | ||
1622 | dprintk(1, | ||
1623 | KERN_ERR | ||
1624 | "%s: BUZIOC_S_PARAMS called, but Buz in capture/playback mode\n", | ||
1625 | ZR_DEVNAME(zr)); | ||
1626 | res = -EINVAL; | ||
1627 | goto sparams_unlock_and_return; | ||
1628 | } | ||
1629 | |||
1630 | /* Check the params first before overwriting our | ||
1631 | * nternal values */ | ||
1632 | if (zoran_check_jpg_settings(zr, &settings, 0)) { | ||
1633 | res = -EINVAL; | ||
1634 | goto sparams_unlock_and_return; | ||
1635 | } | ||
1636 | |||
1637 | fh->jpg_settings = settings; | ||
1638 | sparams_unlock_and_return: | ||
1639 | mutex_unlock(&zr->resource_lock); | ||
1640 | |||
1641 | return res; | ||
1642 | } | ||
1643 | |||
1644 | case BUZIOC_REQBUFS: | ||
1645 | { | ||
1646 | struct zoran_requestbuffers *breq = arg; | ||
1647 | int res = 0; | ||
1648 | |||
1649 | dprintk(3, | ||
1650 | KERN_DEBUG | ||
1651 | "%s: BUZIOC_REQBUFS - count=%lu, size=%lu\n", | ||
1652 | ZR_DEVNAME(zr), breq->count, breq->size); | ||
1653 | |||
1654 | /* Enforce reasonable lower and upper limits */ | ||
1655 | if (breq->count < 4) | ||
1656 | breq->count = 4; /* Could be choosen smaller */ | ||
1657 | if (breq->count > jpg_nbufs) | ||
1658 | breq->count = jpg_nbufs; | ||
1659 | breq->size = PAGE_ALIGN(breq->size); | ||
1660 | if (breq->size < 8192) | ||
1661 | breq->size = 8192; /* Arbitrary */ | ||
1662 | /* breq->size is limited by 1 page for the stat_com | ||
1663 | * tables to a Maximum of 2 MB */ | ||
1664 | if (breq->size > jpg_bufsize) | ||
1665 | breq->size = jpg_bufsize; | ||
1666 | |||
1667 | mutex_lock(&zr->resource_lock); | ||
1668 | |||
1669 | if (fh->buffers.allocated) { | ||
1670 | dprintk(1, | ||
1671 | KERN_ERR | ||
1672 | "%s: BUZIOC_REQBUFS - buffers already allocated\n", | ||
1673 | ZR_DEVNAME(zr)); | ||
1674 | res = -EBUSY; | ||
1675 | goto jpgreqbuf_unlock_and_return; | ||
1676 | } | ||
1677 | |||
1678 | /* The next mmap will map the MJPEG buffers - could | ||
1679 | * also be *_PLAY, but it doesn't matter here */ | ||
1680 | map_mode_jpg(fh, 0); | ||
1681 | fh->buffers.num_buffers = breq->count; | ||
1682 | fh->buffers.buffer_size = breq->size; | ||
1683 | |||
1684 | if (jpg_fbuffer_alloc(fh)) { | ||
1685 | res = -ENOMEM; | ||
1686 | goto jpgreqbuf_unlock_and_return; | ||
1687 | } | ||
1688 | |||
1689 | jpgreqbuf_unlock_and_return: | ||
1690 | mutex_unlock(&zr->resource_lock); | ||
1691 | |||
1692 | return res; | ||
1693 | } | ||
1694 | |||
1695 | case BUZIOC_QBUF_CAPT: | ||
1696 | { | ||
1697 | int *frame = arg, res; | ||
1698 | |||
1699 | dprintk(3, KERN_DEBUG "%s: BUZIOC_QBUF_CAPT - frame=%d\n", | ||
1700 | ZR_DEVNAME(zr), *frame); | ||
1701 | |||
1702 | mutex_lock(&zr->resource_lock); | ||
1703 | res = jpg_qbuf(fh, *frame, BUZ_MODE_MOTION_COMPRESS); | ||
1704 | mutex_unlock(&zr->resource_lock); | ||
1705 | |||
1706 | return res; | ||
1707 | } | ||
1708 | |||
1709 | case BUZIOC_QBUF_PLAY: | ||
1710 | { | ||
1711 | int *frame = arg, res; | ||
1712 | |||
1713 | dprintk(3, KERN_DEBUG "%s: BUZIOC_QBUF_PLAY - frame=%d\n", | ||
1714 | ZR_DEVNAME(zr), *frame); | ||
1715 | |||
1716 | mutex_lock(&zr->resource_lock); | ||
1717 | res = jpg_qbuf(fh, *frame, BUZ_MODE_MOTION_DECOMPRESS); | ||
1718 | mutex_unlock(&zr->resource_lock); | ||
1719 | |||
1720 | return res; | ||
1721 | } | ||
1722 | |||
1723 | case BUZIOC_SYNC: | ||
1724 | { | ||
1725 | struct zoran_sync *bsync = arg; | ||
1726 | int res; | ||
1727 | |||
1728 | dprintk(3, KERN_DEBUG "%s: BUZIOC_SYNC\n", ZR_DEVNAME(zr)); | ||
1729 | |||
1730 | mutex_lock(&zr->resource_lock); | ||
1731 | |||
1732 | if (fh->map_mode == ZORAN_MAP_MODE_RAW) { | ||
1733 | dprintk(2, KERN_WARNING | ||
1734 | "%s: %s - not in jpg capture mode\n", | ||
1735 | ZR_DEVNAME(zr), __func__); | ||
1736 | res = -EINVAL; | ||
1737 | } else { | ||
1738 | res = jpg_sync(fh, bsync); | ||
1739 | } | ||
1740 | mutex_unlock(&zr->resource_lock); | ||
1741 | |||
1742 | return res; | ||
1743 | } | ||
1744 | |||
1745 | case BUZIOC_G_STATUS: | ||
1746 | { | ||
1747 | struct zoran_status *bstat = arg; | ||
1748 | int status = 0, res = 0; | ||
1749 | v4l2_std_id norm; | ||
1750 | |||
1751 | dprintk(3, KERN_DEBUG "%s: BUZIOC_G_STATUS\n", ZR_DEVNAME(zr)); | ||
1752 | |||
1753 | if (zr->codec_mode != BUZ_MODE_IDLE) { | ||
1754 | dprintk(1, | ||
1755 | KERN_ERR | ||
1756 | "%s: BUZIOC_G_STATUS called but Buz in capture/playback mode\n", | ||
1757 | ZR_DEVNAME(zr)); | ||
1758 | return -EINVAL; | ||
1759 | } | ||
1760 | |||
1761 | mutex_lock(&zr->resource_lock); | ||
1762 | |||
1763 | if (zr->codec_mode != BUZ_MODE_IDLE) { | ||
1764 | dprintk(1, | ||
1765 | KERN_ERR | ||
1766 | "%s: BUZIOC_G_STATUS called, but Buz in capture/playback mode\n", | ||
1767 | ZR_DEVNAME(zr)); | ||
1768 | res = -EINVAL; | ||
1769 | goto gstat_unlock_and_return; | ||
1770 | } | ||
1771 | |||
1772 | decoder_call(zr, video, s_routing, | ||
1773 | zr->card.input[bstat->input].muxsel, 0, 0); | ||
1774 | |||
1775 | /* sleep 1 second */ | ||
1776 | ssleep(1); | ||
1777 | |||
1778 | /* Get status of video decoder */ | ||
1779 | decoder_call(zr, video, querystd, &norm); | ||
1780 | decoder_call(zr, video, g_input_status, &status); | ||
1781 | |||
1782 | /* restore previous input and norm */ | ||
1783 | decoder_call(zr, video, s_routing, | ||
1784 | zr->card.input[zr->input].muxsel, 0, 0); | ||
1785 | gstat_unlock_and_return: | ||
1786 | mutex_unlock(&zr->resource_lock); | ||
1787 | |||
1788 | if (!res) { | ||
1789 | bstat->signal = | ||
1790 | (status & V4L2_IN_ST_NO_SIGNAL) ? 0 : 1; | ||
1791 | if (norm & V4L2_STD_NTSC) | ||
1792 | bstat->norm = ZORAN_VIDMODE_NTSC; | ||
1793 | else if (norm & V4L2_STD_SECAM) | ||
1794 | bstat->norm = ZORAN_VIDMODE_SECAM; | ||
1795 | else | ||
1796 | bstat->norm = ZORAN_VIDMODE_PAL; | ||
1797 | |||
1798 | bstat->color = | ||
1799 | (status & V4L2_IN_ST_NO_COLOR) ? 0 : 1; | ||
1800 | } | ||
1801 | |||
1802 | return res; | ||
1803 | } | ||
1804 | |||
1805 | default: | ||
1806 | return -EINVAL; | ||
1807 | } | ||
1808 | } | ||
1809 | |||
1810 | static int zoran_vidiocgmbuf(struct file *file, void *__fh, struct video_mbuf *vmbuf) | ||
1811 | { | ||
1812 | struct zoran_fh *fh = __fh; | ||
1813 | struct zoran *zr = fh->zr; | ||
1814 | int i, res = 0; | ||
1815 | |||
1816 | |||
1817 | mutex_lock(&zr->resource_lock); | ||
1818 | |||
1819 | if (fh->buffers.allocated) { | ||
1820 | dprintk(1, | ||
1821 | KERN_ERR | ||
1822 | "%s: VIDIOCGMBUF - buffers already allocated\n", | ||
1823 | ZR_DEVNAME(zr)); | ||
1824 | res = -EINVAL; | ||
1825 | goto v4l1reqbuf_unlock_and_return; | ||
1826 | } | ||
1827 | |||
1828 | /* The next mmap will map the V4L buffers */ | ||
1829 | map_mode_raw(fh); | ||
1830 | |||
1831 | if (v4l_fbuffer_alloc(fh)) { | ||
1832 | res = -ENOMEM; | ||
1833 | goto v4l1reqbuf_unlock_and_return; | ||
1834 | } | ||
1835 | |||
1836 | vmbuf->size = fh->buffers.num_buffers * fh->buffers.buffer_size; | ||
1837 | vmbuf->frames = fh->buffers.num_buffers; | ||
1838 | for (i = 0; i < vmbuf->frames; i++) | ||
1839 | vmbuf->offsets[i] = i * fh->buffers.buffer_size; | ||
1840 | |||
1841 | v4l1reqbuf_unlock_and_return: | ||
1842 | mutex_unlock(&zr->resource_lock); | ||
1843 | |||
1844 | return res; | ||
1845 | } | ||
1846 | #endif | ||
1847 | |||
1848 | static int zoran_querycap(struct file *file, void *__fh, struct v4l2_capability *cap) | 1531 | static int zoran_querycap(struct file *file, void *__fh, struct v4l2_capability *cap) |
1849 | { | 1532 | { |
1850 | struct zoran_fh *fh = __fh; | 1533 | struct zoran_fh *fh = __fh; |
@@ -3364,10 +3047,6 @@ static const struct v4l2_ioctl_ops zoran_ioctl_ops = { | |||
3364 | .vidioc_queryctrl = zoran_queryctrl, | 3047 | .vidioc_queryctrl = zoran_queryctrl, |
3365 | .vidioc_s_ctrl = zoran_s_ctrl, | 3048 | .vidioc_s_ctrl = zoran_s_ctrl, |
3366 | .vidioc_g_ctrl = zoran_g_ctrl, | 3049 | .vidioc_g_ctrl = zoran_g_ctrl, |
3367 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
3368 | .vidioc_default = zoran_default, | ||
3369 | .vidiocgmbuf = zoran_vidiocgmbuf, | ||
3370 | #endif | ||
3371 | }; | 3050 | }; |
3372 | 3051 | ||
3373 | /* please use zr->resource_lock consistently and kill this wrapper */ | 3052 | /* please use zr->resource_lock consistently and kill this wrapper */ |