aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pwc/pwc-misc.c
diff options
context:
space:
mode:
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