aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pwc/pwc-ctrl.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-27 17:18:45 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-27 17:18:45 -0400
commitaa5bc2b58e3344da57f26b62e99e13e91c9e0a94 (patch)
treec6e9ea1b3ee8af88b3a050b3fba160ea2f77e404 /drivers/media/video/pwc/pwc-ctrl.c
parentd868772fff6c4b881d66af8640251714e1aefa98 (diff)
parentd455cf5d0db9e3eb1b204cd4a61d8c5ccfe4305f (diff)
Merge branch 'master' of ssh://master.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb
* 'master' of ssh://master.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb: (184 commits) V4L/DVB (5563): Radio-maestro.c Replace radio_ioctl to use video_ioctl2 V4L/DVB (5562): Radio-gemtek-pci.c Replace gemtek_pci_ioctl to use video_ioctl2 V4L/DVB (5560): Ivtv: fix incorrect bitwise-and for command flags. V4L/DVB (5558): Opera: use 7-bit i2c addresses V4L/DVB (5557): Cafe_ccic: check return value of pci_enable_device V4L/DVB (5556): Radio-gemtek.c Replace gemtek_ioctl to use video_ioctl2 V4L/DVB (5555): Radio-aimslab.c Replace rt_ioctl to use video_ioctl2 V4L/DVB (5554): Fix: vidioc_g_parm were not zeroing the memory V4L/DVB (5553): Replace typhoon_do_ioctl to use video_ioctl2 V4L/DVB (5552): Plan-b: Switch to refcounting PCI API V4L/DVB (5551): Plan-b: header change V4L/DVB (5550): Radio-sf16fmi.c Replace fmi_do_ioctl to use video_ioctl2 V4L/DVB (5549): Radio-sf16fmr2.c Replace fmr2_do_ioctl to use video_ioctl2 V4L/DVB (5548): Fix v4l2 buffer to the length V4L/DVB (5547): Add ENUM_FRAMESIZES and ENUM_FRAMEINTERVALS ioctls V4L/DVB (5546): Radio-terratec.c Replace tt_do_ioctl to use video_ioctl2 V4L/DVB (5545): Saa7146: Release capture buffers on device close V4L/DVB (5544): Budget-av: Make inversion setting configurable, add KNC ONE V1.0 card V4L/DVB (5543): Tda10023: Add support for frontend TDA10023 V4L/DVB (5542): Budget-av: Remove polarity switching of the clock for DVB-C ...
Diffstat (limited to 'drivers/media/video/pwc/pwc-ctrl.c')
-rw-r--r--drivers/media/video/pwc/pwc-ctrl.c61
1 files changed, 59 insertions, 2 deletions
diff --git a/drivers/media/video/pwc/pwc-ctrl.c b/drivers/media/video/pwc/pwc-ctrl.c
index 0bd115588f31..338ced7188f2 100644
--- a/drivers/media/video/pwc/pwc-ctrl.c
+++ b/drivers/media/video/pwc/pwc-ctrl.c
@@ -140,6 +140,8 @@ static const char *size2name[PSZ_MAX] =
140 An alternate value of 0 means this mode is not available at all. 140 An alternate value of 0 means this mode is not available at all.
141 */ 141 */
142 142
143#define PWC_FPS_MAX_NALA 8
144
143struct Nala_table_entry { 145struct Nala_table_entry {
144 char alternate; /* USB alternate setting */ 146 char alternate; /* USB alternate setting */
145 int compressed; /* Compressed yes/no */ 147 int compressed; /* Compressed yes/no */
@@ -147,7 +149,9 @@ struct Nala_table_entry {
147 unsigned char mode[3]; /* precomputed mode table */ 149 unsigned char mode[3]; /* precomputed mode table */
148}; 150};
149 151
150static struct Nala_table_entry Nala_table[PSZ_MAX][8] = 152static unsigned int Nala_fps_vector[PWC_FPS_MAX_NALA] = { 4, 5, 7, 10, 12, 15, 20, 24 };
153
154static struct Nala_table_entry Nala_table[PSZ_MAX][PWC_FPS_MAX_NALA] =
151{ 155{
152#include "pwc-nala.h" 156#include "pwc-nala.h"
153}; 157};
@@ -423,6 +427,59 @@ int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frame
423 return 0; 427 return 0;
424} 428}
425 429
430static unsigned int pwc_get_fps_Nala(struct pwc_device *pdev, unsigned int index, unsigned int size)
431{
432 unsigned int i;
433
434 for (i = 0; i < PWC_FPS_MAX_NALA; i++) {
435 if (Nala_table[size][i].alternate) {
436 if (index--==0) return Nala_fps_vector[i];
437 }
438 }
439 return 0;
440}
441
442static unsigned int pwc_get_fps_Kiara(struct pwc_device *pdev, unsigned int index, unsigned int size)
443{
444 unsigned int i;
445
446 for (i = 0; i < PWC_FPS_MAX_KIARA; i++) {
447 if (Kiara_table[size][i][3].alternate) {
448 if (index--==0) return Kiara_fps_vector[i];
449 }
450 }
451 return 0;
452}
453
454static unsigned int pwc_get_fps_Timon(struct pwc_device *pdev, unsigned int index, unsigned int size)
455{
456 unsigned int i;
457
458 for (i=0; i < PWC_FPS_MAX_TIMON; i++) {
459 if (Timon_table[size][i][3].alternate) {
460 if (index--==0) return Timon_fps_vector[i];
461 }
462 }
463 return 0;
464}
465
466unsigned int pwc_get_fps(struct pwc_device *pdev, unsigned int index, unsigned int size)
467{
468 unsigned int ret;
469
470 if (DEVICE_USE_CODEC1(pdev->type)) {
471 ret = pwc_get_fps_Nala(pdev, index, size);
472
473 } else if (DEVICE_USE_CODEC3(pdev->type)) {
474 ret = pwc_get_fps_Kiara(pdev, index, size);
475
476 } else {
477 ret = pwc_get_fps_Timon(pdev, index, size);
478 }
479
480 return ret;
481}
482
426#define BLACK_Y 0 483#define BLACK_Y 0
427#define BLACK_U 128 484#define BLACK_U 128
428#define BLACK_V 128 485#define BLACK_V 128
@@ -1343,7 +1400,7 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg)
1343 ret = pwc_read_red_gain(pdev, &ARGR(wb).read_red); 1400 ret = pwc_read_red_gain(pdev, &ARGR(wb).read_red);
1344 if (ret < 0) 1401 if (ret < 0)
1345 break; 1402 break;
1346 ret =pwc_read_blue_gain(pdev, &ARGR(wb).read_blue); 1403 ret = pwc_read_blue_gain(pdev, &ARGR(wb).read_blue);
1347 if (ret < 0) 1404 if (ret < 0)
1348 break; 1405 break;
1349 } 1406 }