aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pwc/pwc-misc.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-06-25 13:09:31 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-25 13:09:31 -0400
commit25581ad107be24b89d805da51a03d616f8f3d1be (patch)
tree36e2bd32667b5dd5a39e1939c1c5162f18967715 /drivers/media/video/pwc/pwc-misc.c
parent72cf2709bf8e0410800f118c4298bfbf8715b303 (diff)
parent7477ddaa4d2d69bbcd49e12990af158dbb03f2f2 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb
* master.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb: (244 commits) V4L/DVB (4210b): git-dvb: tea575x-tuner build fix V4L/DVB (4210a): git-dvb versus matroxfb V4L/DVB (4209): Added some BTTV PCI IDs for newer boards Fixes some sync issues between V4L/DVB development and GIT V4L/DVB (4206): Cx88-blackbird: always set encoder height based on tvnorm->id V4L/DVB (4205): Merge tda9887 module into tuner. V4L/DVB (4203): Explicitly set the enum values. V4L/DVB (4202): allow selecting CX2341x port mode V4L/DVB (4200): Disable bitrate_mode when encoding mpeg-1. V4L/DVB (4199): Add cx2341x-specific control array to cx2341x.c V4L/DVB (4198): Avoid newer usages of obsoleted experimental MPEGCOMP API V4L/DVB (4197): Port new MPEG API to saa7134-empress with saa6752hs V4L/DVB (4196): Port cx88-blackbird to the new MPEG API. V4L/DVB (4193): Update cx2341x fw encoding API doc. V4L/DVB (4192): Use control helpers for saa7115, cx25840, msp3400. V4L/DVB (4191): Add CX2341X MPEG encoder module. V4L/DVB (4190): Add helper functions for control processing to v4l2-common. V4L/DVB (4189): Add videodev support for VIDIOC_S/G/TRY_EXT_CTRLS. V4L/DVB (4188): Add new MPEG control/ioctl definitions to videodev2.h V4L/DVB (4186): Add support for the DNTV Live! mini DVB-T card. ...
Diffstat (limited to 'drivers/media/video/pwc/pwc-misc.c')
-rw-r--r--drivers/media/video/pwc/pwc-misc.c67
1 files changed, 30 insertions, 37 deletions
diff --git a/drivers/media/video/pwc/pwc-misc.c b/drivers/media/video/pwc/pwc-misc.c
index 58fe79747992..589c687439da 100644
--- a/drivers/media/video/pwc/pwc-misc.c
+++ b/drivers/media/video/pwc/pwc-misc.c
@@ -1,7 +1,7 @@
1/* Linux driver for Philips webcam 1/* Linux driver for Philips webcam
2 Various miscellaneous functions and tables. 2 Various miscellaneous functions and tables.
3 (C) 1999-2003 Nemosoft Unv. 3 (C) 1999-2003 Nemosoft Unv.
4 (C) 2004 Luc Saillard (luc@saillard.org) 4 (C) 2004-2006 Luc Saillard (luc@saillard.org)
5 5
6 NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx 6 NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx
7 driver and thus may have bugs that are not present in the original version. 7 driver and thus may have bugs that are not present in the original version.
@@ -24,18 +24,17 @@
24 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25*/ 25*/
26 26
27#include <linux/slab.h>
28 27
29#include "pwc.h" 28#include "pwc.h"
30 29
31struct pwc_coord pwc_image_sizes[PSZ_MAX] = 30const struct pwc_coord pwc_image_sizes[PSZ_MAX] =
32{ 31{
33 { 128, 96, 0 }, 32 { 128, 96, 0 }, /* sqcif */
34 { 160, 120, 0 }, 33 { 160, 120, 0 }, /* qsif */
35 { 176, 144, 0 }, 34 { 176, 144, 0 }, /* qcif */
36 { 320, 240, 0 }, 35 { 320, 240, 0 }, /* sif */
37 { 352, 288, 0 }, 36 { 352, 288, 0 }, /* cif */
38 { 640, 480, 0 }, 37 { 640, 480, 0 }, /* vga */
39}; 38};
40 39
41/* x,y -> PSZ_ */ 40/* x,y -> PSZ_ */
@@ -52,7 +51,7 @@ int pwc_decode_size(struct pwc_device *pdev, int width, int height)
52 { 51 {
53 if (width > pdev->abs_max.x || height > pdev->abs_max.y) 52 if (width > pdev->abs_max.x || height > pdev->abs_max.y)
54 { 53 {
55 Debug("VIDEO_PALETTE_RAW: going beyond abs_max.\n"); 54 PWC_DEBUG_SIZE("VIDEO_PALETTE_RAW: going beyond abs_max.\n");
56 return -1; 55 return -1;
57 } 56 }
58 } 57 }
@@ -60,7 +59,7 @@ int pwc_decode_size(struct pwc_device *pdev, int width, int height)
60 { 59 {
61 if (width > pdev->view_max.x || height > pdev->view_max.y) 60 if (width > pdev->view_max.x || height > pdev->view_max.y)
62 { 61 {
63 Debug("VIDEO_PALETTE_ not RAW: going beyond view_max.\n"); 62 PWC_DEBUG_SIZE("VIDEO_PALETTE_not RAW: going beyond view_max.\n");
64 return -1; 63 return -1;
65 } 64 }
66 } 65 }
@@ -81,9 +80,8 @@ int pwc_decode_size(struct pwc_device *pdev, int width, int height)
81/* initialize variables depending on type and decompressor*/ 80/* initialize variables depending on type and decompressor*/
82void pwc_construct(struct pwc_device *pdev) 81void pwc_construct(struct pwc_device *pdev)
83{ 82{
84 switch(pdev->type) { 83 if (DEVICE_USE_CODEC1(pdev->type)) {
85 case 645: 84
86 case 646:
87 pdev->view_min.x = 128; 85 pdev->view_min.x = 128;
88 pdev->view_min.y = 96; 86 pdev->view_min.y = 96;
89 pdev->view_max.x = 352; 87 pdev->view_max.x = 352;
@@ -95,10 +93,23 @@ void pwc_construct(struct pwc_device *pdev)
95 pdev->vendpoint = 4; 93 pdev->vendpoint = 4;
96 pdev->frame_header_size = 0; 94 pdev->frame_header_size = 0;
97 pdev->frame_trailer_size = 0; 95 pdev->frame_trailer_size = 0;
98 break; 96
99 case 675: 97 } else if (DEVICE_USE_CODEC3(pdev->type)) {
100 case 680: 98
101 case 690: 99 pdev->view_min.x = 160;
100 pdev->view_min.y = 120;
101 pdev->view_max.x = 640;
102 pdev->view_max.y = 480;
103 pdev->image_mask = 1 << PSZ_QSIF | 1 << PSZ_SIF | 1 << PSZ_VGA;
104 pdev->abs_max.x = 640;
105 pdev->abs_max.y = 480;
106 pdev->vcinterface = 3;
107 pdev->vendpoint = 5;
108 pdev->frame_header_size = TOUCAM_HEADER_SIZE;
109 pdev->frame_trailer_size = TOUCAM_TRAILER_SIZE;
110
111 } else /* if (DEVICE_USE_CODEC2(pdev->type)) */ {
112
102 pdev->view_min.x = 128; 113 pdev->view_min.x = 128;
103 pdev->view_min.y = 96; 114 pdev->view_min.y = 96;
104 /* Anthill bug #38: PWC always reports max size, even without PWCX */ 115 /* Anthill bug #38: PWC always reports max size, even without PWCX */
@@ -111,30 +122,12 @@ void pwc_construct(struct pwc_device *pdev)
111 pdev->vendpoint = 4; 122 pdev->vendpoint = 4;
112 pdev->frame_header_size = 0; 123 pdev->frame_header_size = 0;
113 pdev->frame_trailer_size = 0; 124 pdev->frame_trailer_size = 0;
114 break;
115 case 720:
116 case 730:
117 case 740:
118 case 750:
119 pdev->view_min.x = 160;
120 pdev->view_min.y = 120;
121 pdev->view_max.x = 640;
122 pdev->view_max.y = 480;
123 pdev->image_mask = 1 << PSZ_QSIF | 1 << PSZ_SIF | 1 << PSZ_VGA;
124 pdev->abs_max.x = 640;
125 pdev->abs_max.y = 480;
126 pdev->vcinterface = 3;
127 pdev->vendpoint = 5;
128 pdev->frame_header_size = TOUCAM_HEADER_SIZE;
129 pdev->frame_trailer_size = TOUCAM_TRAILER_SIZE;
130 break;
131 } 125 }
132 Debug("type = %d\n",pdev->type);
133 pdev->vpalette = VIDEO_PALETTE_YUV420P; /* default */ 126 pdev->vpalette = VIDEO_PALETTE_YUV420P; /* default */
134 pdev->view_min.size = pdev->view_min.x * pdev->view_min.y; 127 pdev->view_min.size = pdev->view_min.x * pdev->view_min.y;
135 pdev->view_max.size = pdev->view_max.x * pdev->view_max.y; 128 pdev->view_max.size = pdev->view_max.x * pdev->view_max.y;
136 /* length of image, in YUV format; always allocate enough memory. */ 129 /* length of image, in YUV format; always allocate enough memory. */
137 pdev->len_per_image = (pdev->abs_max.x * pdev->abs_max.y * 3) / 2; 130 pdev->len_per_image = PAGE_ALIGN((pdev->abs_max.x * pdev->abs_max.y * 3) / 2);
138} 131}
139 132
140 133