aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/media/pwc/pwc-misc.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-03-25 11:37:36 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-25 11:37:36 -0500
commit368d17e068f691dba5a4f122c271db5ec9b2ebd6 (patch)
tree69954cea09e5efd4ad1b8268be0e1733a13b4fae /drivers/usb/media/pwc/pwc-misc.c
parenta9312fb839e90668d05a90024f3a7e7ff646a4a3 (diff)
parent22fe087f0139e2f5cbe004f24f84cb1c08b4711e (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb
* master.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb: (33 commits) V4L/DVB (3604): V4l printk fix V4L/DVB (3599c): Whitespace cleanups under Documentation/video4linux V4L/DVB (3599b): Whitespace cleanups under drivers/media V4L/DVB (3599a): Move drivers/usb/media to drivers/media/video V4L/DVB (3599): Implement new routing commands for wm8775 and cs53l32a. V4L/DVB (3598): Add bit algorithm adapter for the Conexant CX2341X boards. V4L/DVB (3597): Vivi: fix warning: implicit declaration of function 'in_interrupt' V4L/DVB (3588): Remove VIDIOC_G/S_AUDOUT from msp3400 V4L/DVB (3587): Always wake thread after routing change. V4L/DVB (3584): Implement V4L2_TUNER_MODE_LANG1_LANG2 audio mode V4L/DVB (3582): Implement correct msp3400 input/output routing V4L/DVB (3581): Add new media/msp3400.h header containing the routing macros V4L/DVB (3580): Last round of msp3400 cleanups before adding routing commands V4L/DVB (3579): Move msp_modus to msp3400-kthreads, add JP and KR std detection V4L/DVB (3578): Make scart definitions easier to handle V4L/DVB (3577): Cleanup audio input handling V4L/DVB (3575): Cxusb: fix i2c debug messages for bluebird devices V4L/DVB (3574): Cxusb: fix debug messages V4L/DVB (3573): Cxusb: remove FIXME: comment in bluebird_patch_dvico_firmware_download V4L/DVB (3572): Cxusb: conditionalize gpio write for the medion box ...
Diffstat (limited to 'drivers/usb/media/pwc/pwc-misc.c')
-rw-r--r--drivers/usb/media/pwc/pwc-misc.c140
1 files changed, 0 insertions, 140 deletions
diff --git a/drivers/usb/media/pwc/pwc-misc.c b/drivers/usb/media/pwc/pwc-misc.c
deleted file mode 100644
index b7a4bd3524c7..000000000000
--- a/drivers/usb/media/pwc/pwc-misc.c
+++ /dev/null
@@ -1,140 +0,0 @@
1/* Linux driver for Philips webcam
2 Various miscellaneous functions and tables.
3 (C) 1999-2003 Nemosoft Unv.
4 (C) 2004 Luc Saillard (luc@saillard.org)
5
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.
8 Please send bug reports and support requests to <luc@saillard.org>.
9 The decompression routines have been implemented by reverse-engineering the
10 Nemosoft binary pwcx module. Caveat emptor.
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25*/
26
27#include <linux/slab.h>
28
29#include "pwc.h"
30
31struct pwc_coord pwc_image_sizes[PSZ_MAX] =
32{
33 { 128, 96, 0 },
34 { 160, 120, 0 },
35 { 176, 144, 0 },
36 { 320, 240, 0 },
37 { 352, 288, 0 },
38 { 640, 480, 0 },
39};
40
41/* x,y -> PSZ_ */
42int pwc_decode_size(struct pwc_device *pdev, int width, int height)
43{
44 int i, find;
45
46 /* Make sure we don't go beyond our max size.
47 NB: we have different limits for RAW and normal modes. In case
48 you don't have the decompressor loaded or use RAW mode,
49 the maximum viewable size is smaller.
50 */
51 if (pdev->vpalette == VIDEO_PALETTE_RAW)
52 {
53 if (width > pdev->abs_max.x || height > pdev->abs_max.y)
54 {
55 Debug("VIDEO_PALETTE_RAW: going beyond abs_max.\n");
56 return -1;
57 }
58 }
59 else
60 {
61 if (width > pdev->view_max.x || height > pdev->view_max.y)
62 {
63 Debug("VIDEO_PALETTE_ not RAW: going beyond view_max.\n");
64 return -1;
65 }
66 }
67
68 /* Find the largest size supported by the camera that fits into the
69 requested size.
70 */
71 find = -1;
72 for (i = 0; i < PSZ_MAX; i++) {
73 if (pdev->image_mask & (1 << i)) {
74 if (pwc_image_sizes[i].x <= width && pwc_image_sizes[i].y <= height)
75 find = i;
76 }
77 }
78 return find;
79}
80
81/* initialize variables depending on type and decompressor*/
82void pwc_construct(struct pwc_device *pdev)
83{
84 switch(pdev->type) {
85 case 645:
86 case 646:
87 pdev->view_min.x = 128;
88 pdev->view_min.y = 96;
89 pdev->view_max.x = 352;
90 pdev->view_max.y = 288;
91 pdev->abs_max.x = 352;
92 pdev->abs_max.y = 288;
93 pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QCIF | 1 << PSZ_CIF;
94 pdev->vcinterface = 2;
95 pdev->vendpoint = 4;
96 pdev->frame_header_size = 0;
97 pdev->frame_trailer_size = 0;
98 break;
99 case 675:
100 case 680:
101 case 690:
102 pdev->view_min.x = 128;
103 pdev->view_min.y = 96;
104 /* Anthill bug #38: PWC always reports max size, even without PWCX */
105 pdev->view_max.x = 640;
106 pdev->view_max.y = 480;
107 pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QSIF | 1 << PSZ_QCIF | 1 << PSZ_SIF | 1 << PSZ_CIF | 1 << PSZ_VGA;
108 pdev->abs_max.x = 640;
109 pdev->abs_max.y = 480;
110 pdev->vcinterface = 3;
111 pdev->vendpoint = 4;
112 pdev->frame_header_size = 0;
113 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 }
132 Debug("type = %d\n",pdev->type);
133 pdev->vpalette = VIDEO_PALETTE_YUV420P; /* default */
134 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;
136 /* 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;
138}
139
140