diff options
author | Luc Saillard <luc@saillard.org> | 2007-04-22 22:54:36 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-04-27 14:45:50 -0400 |
commit | 9ee6d78cd4112c0f5a257a01383c64dadbf66da9 (patch) | |
tree | 6a240c9938d7970c5d13c40dcc21b20fb3c3369e /drivers/media/video/pwc/pwc-ctrl.c | |
parent | 1de69238111a65283a4548d8fd4727397873a02f (diff) |
V4L/DVB (5547): Add ENUM_FRAMESIZES and ENUM_FRAMEINTERVALS ioctls
This patch add support for the VIDIOC_ENUM_FRAMESIZES and
VIDIOC_ENUM_FRAMEINTERVALS ioctl.
* check if the maximum native framesize for raw mode is correct
* raw mode framerates for all three chipset types
Signed-off-by: Gregor Jasny <gjasny@web.de>
Signed-off-by: Luc Saillard <luc@saillard.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/pwc/pwc-ctrl.c')
-rw-r--r-- | drivers/media/video/pwc/pwc-ctrl.c | 61 |
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 | |||
143 | struct Nala_table_entry { | 145 | struct 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 | ||
150 | static struct Nala_table_entry Nala_table[PSZ_MAX][8] = | 152 | static unsigned int Nala_fps_vector[PWC_FPS_MAX_NALA] = { 4, 5, 7, 10, 12, 15, 20, 24 }; |
153 | |||
154 | static 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 | ||
430 | static 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 | |||
442 | static 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 | |||
454 | static 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 | |||
466 | unsigned 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 | } |