diff options
Diffstat (limited to 'drivers/media/video/pwc/pwc-ctrl.c')
-rw-r--r-- | drivers/media/video/pwc/pwc-ctrl.c | 374 |
1 files changed, 187 insertions, 187 deletions
diff --git a/drivers/media/video/pwc/pwc-ctrl.c b/drivers/media/video/pwc/pwc-ctrl.c index 0398b812e0ce..4ba549bfa0e0 100644 --- a/drivers/media/video/pwc/pwc-ctrl.c +++ b/drivers/media/video/pwc/pwc-ctrl.c | |||
@@ -31,17 +31,17 @@ | |||
31 | 31 | ||
32 | /* | 32 | /* |
33 | Changes | 33 | Changes |
34 | 2001/08/03 Alvarado Added methods for changing white balance and | 34 | 2001/08/03 Alvarado Added methods for changing white balance and |
35 | red/green gains | 35 | red/green gains |
36 | */ | 36 | */ |
37 | 37 | ||
38 | /* Control functions for the cam; brightness, contrast, video mode, etc. */ | 38 | /* Control functions for the cam; brightness, contrast, video mode, etc. */ |
39 | 39 | ||
40 | #ifdef __KERNEL__ | 40 | #ifdef __KERNEL__ |
41 | #include <asm/uaccess.h> | 41 | #include <asm/uaccess.h> |
42 | #endif | 42 | #endif |
43 | #include <asm/errno.h> | 43 | #include <asm/errno.h> |
44 | 44 | ||
45 | #include "pwc.h" | 45 | #include "pwc.h" |
46 | #include "pwc-ioctl.h" | 46 | #include "pwc-ioctl.h" |
47 | #include "pwc-uncompress.h" | 47 | #include "pwc-uncompress.h" |
@@ -116,13 +116,13 @@ static const char *size2name[PSZ_MAX] = | |||
116 | "SIF", | 116 | "SIF", |
117 | "CIF", | 117 | "CIF", |
118 | "VGA", | 118 | "VGA", |
119 | }; | 119 | }; |
120 | 120 | ||
121 | /********/ | 121 | /********/ |
122 | 122 | ||
123 | /* Entries for the Nala (645/646) camera; the Nala doesn't have compression | 123 | /* Entries for the Nala (645/646) camera; the Nala doesn't have compression |
124 | preferences, so you either get compressed or non-compressed streams. | 124 | preferences, so you either get compressed or non-compressed streams. |
125 | 125 | ||
126 | An alternate value of 0 means this mode is not available at all. | 126 | An alternate value of 0 means this mode is not available at all. |
127 | */ | 127 | */ |
128 | 128 | ||
@@ -205,13 +205,13 @@ static inline int set_video_mode_Nala(struct pwc_device *pdev, int size, int fra | |||
205 | { /* closest match of framerate */ | 205 | { /* closest match of framerate */ |
206 | 0, 0, 0, 0, 4, /* 0-4 */ | 206 | 0, 0, 0, 0, 4, /* 0-4 */ |
207 | 5, 5, 7, 7, 10, /* 5-9 */ | 207 | 5, 5, 7, 7, 10, /* 5-9 */ |
208 | 10, 10, 12, 12, 15, /* 10-14 */ | 208 | 10, 10, 12, 12, 15, /* 10-14 */ |
209 | 15, 15, 15, 20, 20, /* 15-19 */ | 209 | 15, 15, 15, 20, 20, /* 15-19 */ |
210 | 20, 20, 20, 24, 24, /* 20-24 */ | 210 | 20, 20, 20, 24, 24, /* 20-24 */ |
211 | 24, 24, 24, 24, 24, /* 25-29 */ | 211 | 24, 24, 24, 24, 24, /* 25-29 */ |
212 | 24 /* 30 */ | 212 | 24 /* 30 */ |
213 | }; | 213 | }; |
214 | int frames2table[31] = | 214 | int frames2table[31] = |
215 | { 0, 0, 0, 0, 0, /* 0-4 */ | 215 | { 0, 0, 0, 0, 0, /* 0-4 */ |
216 | 1, 1, 1, 2, 2, /* 5-9 */ | 216 | 1, 1, 1, 2, 2, /* 5-9 */ |
217 | 3, 3, 4, 4, 4, /* 10-14 */ | 217 | 3, 3, 4, 4, 4, /* 10-14 */ |
@@ -220,7 +220,7 @@ static inline int set_video_mode_Nala(struct pwc_device *pdev, int size, int fra | |||
220 | 7, 7, 7, 7, 7, /* 25-29 */ | 220 | 7, 7, 7, 7, 7, /* 25-29 */ |
221 | 7 /* 30 */ | 221 | 7 /* 30 */ |
222 | }; | 222 | }; |
223 | 223 | ||
224 | if (size < 0 || size > PSZ_CIF || frames < 4 || frames > 25) | 224 | if (size < 0 || size > PSZ_CIF || frames < 4 || frames > 25) |
225 | return -EINVAL; | 225 | return -EINVAL; |
226 | frames = frames2frames[frames]; | 226 | frames = frames2frames[frames]; |
@@ -232,7 +232,7 @@ static inline int set_video_mode_Nala(struct pwc_device *pdev, int size, int fra | |||
232 | if (pEntry->compressed) | 232 | if (pEntry->compressed) |
233 | return -ENOENT; /* Not supported. */ | 233 | return -ENOENT; /* Not supported. */ |
234 | 234 | ||
235 | memcpy(buf, pEntry->mode, 3); | 235 | memcpy(buf, pEntry->mode, 3); |
236 | ret = send_video_command(pdev->udev, pdev->vendpoint, buf, 3); | 236 | ret = send_video_command(pdev->udev, pdev->vendpoint, buf, 3); |
237 | if (ret < 0) { | 237 | if (ret < 0) { |
238 | Debug("Failed to send video command... %d\n", ret); | 238 | Debug("Failed to send video command... %d\n", ret); |
@@ -257,7 +257,7 @@ static inline int set_video_mode_Nala(struct pwc_device *pdev, int size, int fra | |||
257 | break; | 257 | break; |
258 | } | 258 | } |
259 | } | 259 | } |
260 | 260 | ||
261 | pdev->cmd_len = 3; | 261 | pdev->cmd_len = 3; |
262 | memcpy(pdev->cmd_buf, buf, 3); | 262 | memcpy(pdev->cmd_buf, buf, 3); |
263 | 263 | ||
@@ -352,13 +352,13 @@ static inline int set_video_mode_Kiara(struct pwc_device *pdev, int size, int fr | |||
352 | /* special case: VGA @ 5 fps and snapshot is raw bayer mode */ | 352 | /* special case: VGA @ 5 fps and snapshot is raw bayer mode */ |
353 | if (size == PSZ_VGA && frames == 5 && snapshot) | 353 | if (size == PSZ_VGA && frames == 5 && snapshot) |
354 | { | 354 | { |
355 | /* Only available in case the raw palette is selected or | 355 | /* Only available in case the raw palette is selected or |
356 | we have the decompressor available. This mode is | 356 | we have the decompressor available. This mode is |
357 | only available in compressed form | 357 | only available in compressed form |
358 | */ | 358 | */ |
359 | if (pdev->vpalette == VIDEO_PALETTE_RAW) | 359 | if (pdev->vpalette == VIDEO_PALETTE_RAW) |
360 | { | 360 | { |
361 | Info("Choosing VGA/5 BAYER mode (%d).\n", pdev->vpalette); | 361 | Info("Choosing VGA/5 BAYER mode (%d).\n", pdev->vpalette); |
362 | pChoose = &RawEntry; | 362 | pChoose = &RawEntry; |
363 | } | 363 | } |
364 | else | 364 | else |
@@ -368,9 +368,9 @@ static inline int set_video_mode_Kiara(struct pwc_device *pdev, int size, int fr | |||
368 | } | 368 | } |
369 | else | 369 | else |
370 | { | 370 | { |
371 | /* Find a supported framerate with progressively higher compression ratios | 371 | /* Find a supported framerate with progressively higher compression ratios |
372 | if the preferred ratio is not available. | 372 | if the preferred ratio is not available. |
373 | Skip this step when using RAW modes. | 373 | Skip this step when using RAW modes. |
374 | */ | 374 | */ |
375 | while (compression <= 3) { | 375 | while (compression <= 3) { |
376 | pChoose = &Kiara_table[size][fps][compression]; | 376 | pChoose = &Kiara_table[size][fps][compression]; |
@@ -383,7 +383,7 @@ static inline int set_video_mode_Kiara(struct pwc_device *pdev, int size, int fr | |||
383 | return -ENOENT; /* Not supported. */ | 383 | return -ENOENT; /* Not supported. */ |
384 | 384 | ||
385 | Debug("Using alternate setting %d.\n", pChoose->alternate); | 385 | Debug("Using alternate setting %d.\n", pChoose->alternate); |
386 | 386 | ||
387 | /* usb_control_msg won't take staticly allocated arrays as argument?? */ | 387 | /* usb_control_msg won't take staticly allocated arrays as argument?? */ |
388 | memcpy(buf, pChoose->mode, 12); | 388 | memcpy(buf, pChoose->mode, 12); |
389 | if (snapshot) | 389 | if (snapshot) |
@@ -463,9 +463,9 @@ static void pwc_set_image_buffer_size(struct pwc_device *pdev) | |||
463 | */ | 463 | */ |
464 | int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frames, int compression, int snapshot) | 464 | int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frames, int compression, int snapshot) |
465 | { | 465 | { |
466 | int ret, size; | 466 | int ret, size; |
467 | 467 | ||
468 | Trace(TRACE_FLOW, "set_video_mode(%dx%d @ %d, palette %d).\n", width, height, frames, pdev->vpalette); | 468 | Trace(TRACE_FLOW, "set_video_mode(%dx%d @ %d, palette %d).\n", width, height, frames, pdev->vpalette); |
469 | size = pwc_decode_size(pdev, width, height); | 469 | size = pwc_decode_size(pdev, width, height); |
470 | if (size < 0) { | 470 | if (size < 0) { |
471 | Debug("Could not find suitable size.\n"); | 471 | Debug("Could not find suitable size.\n"); |
@@ -473,7 +473,7 @@ int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frame | |||
473 | } | 473 | } |
474 | Debug("decode_size = %d.\n", size); | 474 | Debug("decode_size = %d.\n", size); |
475 | 475 | ||
476 | ret = -EINVAL; | 476 | ret = -EINVAL; |
477 | switch(pdev->type) { | 477 | switch(pdev->type) { |
478 | case 645: | 478 | case 645: |
479 | case 646: | 479 | case 646: |
@@ -485,7 +485,7 @@ int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frame | |||
485 | case 690: | 485 | case 690: |
486 | ret = set_video_mode_Timon(pdev, size, frames, compression, snapshot); | 486 | ret = set_video_mode_Timon(pdev, size, frames, compression, snapshot); |
487 | break; | 487 | break; |
488 | 488 | ||
489 | case 720: | 489 | case 720: |
490 | case 730: | 490 | case 730: |
491 | case 740: | 491 | case 740: |
@@ -517,7 +517,7 @@ int pwc_get_brightness(struct pwc_device *pdev) | |||
517 | char buf; | 517 | char buf; |
518 | int ret; | 518 | int ret; |
519 | 519 | ||
520 | ret = RecvControlMsg(GET_LUM_CTL, BRIGHTNESS_FORMATTER, 1); | 520 | ret = RecvControlMsg(GET_LUM_CTL, BRIGHTNESS_FORMATTER, 1); |
521 | if (ret < 0) | 521 | if (ret < 0) |
522 | return ret; | 522 | return ret; |
523 | return buf << 9; | 523 | return buf << 9; |
@@ -566,7 +566,7 @@ int pwc_get_gamma(struct pwc_device *pdev) | |||
566 | { | 566 | { |
567 | char buf; | 567 | char buf; |
568 | int ret; | 568 | int ret; |
569 | 569 | ||
570 | ret = RecvControlMsg(GET_LUM_CTL, GAMMA_FORMATTER, 1); | 570 | ret = RecvControlMsg(GET_LUM_CTL, GAMMA_FORMATTER, 1); |
571 | if (ret < 0) | 571 | if (ret < 0) |
572 | return ret; | 572 | return ret; |
@@ -622,14 +622,14 @@ static inline int pwc_set_agc(struct pwc_device *pdev, int mode, int value) | |||
622 | { | 622 | { |
623 | char buf; | 623 | char buf; |
624 | int ret; | 624 | int ret; |
625 | 625 | ||
626 | if (mode) | 626 | if (mode) |
627 | buf = 0x0; /* auto */ | 627 | buf = 0x0; /* auto */ |
628 | else | 628 | else |
629 | buf = 0xff; /* fixed */ | 629 | buf = 0xff; /* fixed */ |
630 | 630 | ||
631 | ret = SendControlMsg(SET_LUM_CTL, AGC_MODE_FORMATTER, 1); | 631 | ret = SendControlMsg(SET_LUM_CTL, AGC_MODE_FORMATTER, 1); |
632 | 632 | ||
633 | if (!mode && ret >= 0) { | 633 | if (!mode && ret >= 0) { |
634 | if (value < 0) | 634 | if (value < 0) |
635 | value = 0; | 635 | value = 0; |
@@ -647,7 +647,7 @@ static inline int pwc_get_agc(struct pwc_device *pdev, int *value) | |||
647 | { | 647 | { |
648 | unsigned char buf; | 648 | unsigned char buf; |
649 | int ret; | 649 | int ret; |
650 | 650 | ||
651 | ret = RecvControlMsg(GET_LUM_CTL, AGC_MODE_FORMATTER, 1); | 651 | ret = RecvControlMsg(GET_LUM_CTL, AGC_MODE_FORMATTER, 1); |
652 | if (ret < 0) | 652 | if (ret < 0) |
653 | return ret; | 653 | return ret; |
@@ -658,7 +658,7 @@ static inline int pwc_get_agc(struct pwc_device *pdev, int *value) | |||
658 | return ret; | 658 | return ret; |
659 | if (buf > 0x3F) | 659 | if (buf > 0x3F) |
660 | buf = 0x3F; | 660 | buf = 0x3F; |
661 | *value = (buf << 10); | 661 | *value = (buf << 10); |
662 | } | 662 | } |
663 | else { /* auto */ | 663 | else { /* auto */ |
664 | ret = RecvControlMsg(GET_STATUS_CTL, READ_AGC_FORMATTER, 1); | 664 | ret = RecvControlMsg(GET_STATUS_CTL, READ_AGC_FORMATTER, 1); |
@@ -683,7 +683,7 @@ static inline int pwc_set_shutter_speed(struct pwc_device *pdev, int mode, int v | |||
683 | buf[0] = 0x0; /* auto */ | 683 | buf[0] = 0x0; /* auto */ |
684 | else | 684 | else |
685 | buf[0] = 0xff; /* fixed */ | 685 | buf[0] = 0xff; /* fixed */ |
686 | 686 | ||
687 | ret = SendControlMsg(SET_LUM_CTL, SHUTTER_MODE_FORMATTER, 1); | 687 | ret = SendControlMsg(SET_LUM_CTL, SHUTTER_MODE_FORMATTER, 1); |
688 | 688 | ||
689 | if (!mode && ret >= 0) { | 689 | if (!mode && ret >= 0) { |
@@ -713,7 +713,7 @@ static inline int pwc_set_shutter_speed(struct pwc_device *pdev, int mode, int v | |||
713 | ret = SendControlMsg(SET_LUM_CTL, PRESET_SHUTTER_FORMATTER, 2); | 713 | ret = SendControlMsg(SET_LUM_CTL, PRESET_SHUTTER_FORMATTER, 2); |
714 | } | 714 | } |
715 | return ret; | 715 | return ret; |
716 | } | 716 | } |
717 | 717 | ||
718 | 718 | ||
719 | /* POWER */ | 719 | /* POWER */ |
@@ -765,22 +765,22 @@ static inline int pwc_restore_factory(struct pwc_device *pdev) | |||
765 | * 02: fluorescent lighting | 765 | * 02: fluorescent lighting |
766 | * 03: manual | 766 | * 03: manual |
767 | * 04: auto | 767 | * 04: auto |
768 | */ | 768 | */ |
769 | static inline int pwc_set_awb(struct pwc_device *pdev, int mode) | 769 | static inline int pwc_set_awb(struct pwc_device *pdev, int mode) |
770 | { | 770 | { |
771 | char buf; | 771 | char buf; |
772 | int ret; | 772 | int ret; |
773 | 773 | ||
774 | if (mode < 0) | 774 | if (mode < 0) |
775 | mode = 0; | 775 | mode = 0; |
776 | 776 | ||
777 | if (mode > 4) | 777 | if (mode > 4) |
778 | mode = 4; | 778 | mode = 4; |
779 | 779 | ||
780 | buf = mode & 0x07; /* just the lowest three bits */ | 780 | buf = mode & 0x07; /* just the lowest three bits */ |
781 | 781 | ||
782 | ret = SendControlMsg(SET_CHROM_CTL, WB_MODE_FORMATTER, 1); | 782 | ret = SendControlMsg(SET_CHROM_CTL, WB_MODE_FORMATTER, 1); |
783 | 783 | ||
784 | if (ret < 0) | 784 | if (ret < 0) |
785 | return ret; | 785 | return ret; |
786 | return 0; | 786 | return 0; |
@@ -790,17 +790,17 @@ static inline int pwc_get_awb(struct pwc_device *pdev) | |||
790 | { | 790 | { |
791 | unsigned char buf; | 791 | unsigned char buf; |
792 | int ret; | 792 | int ret; |
793 | 793 | ||
794 | ret = RecvControlMsg(GET_CHROM_CTL, WB_MODE_FORMATTER, 1); | 794 | ret = RecvControlMsg(GET_CHROM_CTL, WB_MODE_FORMATTER, 1); |
795 | 795 | ||
796 | if (ret < 0) | 796 | if (ret < 0) |
797 | return ret; | 797 | return ret; |
798 | return buf; | 798 | return buf; |
799 | } | 799 | } |
800 | 800 | ||
801 | static inline int pwc_set_red_gain(struct pwc_device *pdev, int value) | 801 | static inline int pwc_set_red_gain(struct pwc_device *pdev, int value) |
802 | { | 802 | { |
803 | unsigned char buf; | 803 | unsigned char buf; |
804 | 804 | ||
805 | if (value < 0) | 805 | if (value < 0) |
806 | value = 0; | 806 | value = 0; |
@@ -815,7 +815,7 @@ static inline int pwc_get_red_gain(struct pwc_device *pdev, int *value) | |||
815 | { | 815 | { |
816 | unsigned char buf; | 816 | unsigned char buf; |
817 | int ret; | 817 | int ret; |
818 | 818 | ||
819 | ret = RecvControlMsg(GET_CHROM_CTL, PRESET_MANUAL_RED_GAIN_FORMATTER, 1); | 819 | ret = RecvControlMsg(GET_CHROM_CTL, PRESET_MANUAL_RED_GAIN_FORMATTER, 1); |
820 | if (ret < 0) | 820 | if (ret < 0) |
821 | return ret; | 821 | return ret; |
@@ -841,7 +841,7 @@ static inline int pwc_get_blue_gain(struct pwc_device *pdev, int *value) | |||
841 | { | 841 | { |
842 | unsigned char buf; | 842 | unsigned char buf; |
843 | int ret; | 843 | int ret; |
844 | 844 | ||
845 | ret = RecvControlMsg(GET_CHROM_CTL, PRESET_MANUAL_BLUE_GAIN_FORMATTER, 1); | 845 | ret = RecvControlMsg(GET_CHROM_CTL, PRESET_MANUAL_BLUE_GAIN_FORMATTER, 1); |
846 | if (ret < 0) | 846 | if (ret < 0) |
847 | return ret; | 847 | return ret; |
@@ -851,14 +851,14 @@ static inline int pwc_get_blue_gain(struct pwc_device *pdev, int *value) | |||
851 | 851 | ||
852 | 852 | ||
853 | /* The following two functions are different, since they only read the | 853 | /* The following two functions are different, since they only read the |
854 | internal red/blue gains, which may be different from the manual | 854 | internal red/blue gains, which may be different from the manual |
855 | gains set or read above. | 855 | gains set or read above. |
856 | */ | 856 | */ |
857 | static inline int pwc_read_red_gain(struct pwc_device *pdev, int *value) | 857 | static inline int pwc_read_red_gain(struct pwc_device *pdev, int *value) |
858 | { | 858 | { |
859 | unsigned char buf; | 859 | unsigned char buf; |
860 | int ret; | 860 | int ret; |
861 | 861 | ||
862 | ret = RecvControlMsg(GET_STATUS_CTL, READ_RED_GAIN_FORMATTER, 1); | 862 | ret = RecvControlMsg(GET_STATUS_CTL, READ_RED_GAIN_FORMATTER, 1); |
863 | if (ret < 0) | 863 | if (ret < 0) |
864 | return ret; | 864 | return ret; |
@@ -870,7 +870,7 @@ static inline int pwc_read_blue_gain(struct pwc_device *pdev, int *value) | |||
870 | { | 870 | { |
871 | unsigned char buf; | 871 | unsigned char buf; |
872 | int ret; | 872 | int ret; |
873 | 873 | ||
874 | ret = RecvControlMsg(GET_STATUS_CTL, READ_BLUE_GAIN_FORMATTER, 1); | 874 | ret = RecvControlMsg(GET_STATUS_CTL, READ_BLUE_GAIN_FORMATTER, 1); |
875 | if (ret < 0) | 875 | if (ret < 0) |
876 | return ret; | 876 | return ret; |
@@ -882,7 +882,7 @@ static inline int pwc_read_blue_gain(struct pwc_device *pdev, int *value) | |||
882 | static inline int pwc_set_wb_speed(struct pwc_device *pdev, int speed) | 882 | static inline int pwc_set_wb_speed(struct pwc_device *pdev, int speed) |
883 | { | 883 | { |
884 | unsigned char buf; | 884 | unsigned char buf; |
885 | 885 | ||
886 | /* useful range is 0x01..0x20 */ | 886 | /* useful range is 0x01..0x20 */ |
887 | buf = speed / 0x7f0; | 887 | buf = speed / 0x7f0; |
888 | return SendControlMsg(SET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, 1); | 888 | return SendControlMsg(SET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, 1); |
@@ -892,7 +892,7 @@ static inline int pwc_get_wb_speed(struct pwc_device *pdev, int *value) | |||
892 | { | 892 | { |
893 | unsigned char buf; | 893 | unsigned char buf; |
894 | int ret; | 894 | int ret; |
895 | 895 | ||
896 | ret = RecvControlMsg(GET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, 1); | 896 | ret = RecvControlMsg(GET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, 1); |
897 | if (ret < 0) | 897 | if (ret < 0) |
898 | return ret; | 898 | return ret; |
@@ -904,7 +904,7 @@ static inline int pwc_get_wb_speed(struct pwc_device *pdev, int *value) | |||
904 | static inline int pwc_set_wb_delay(struct pwc_device *pdev, int delay) | 904 | static inline int pwc_set_wb_delay(struct pwc_device *pdev, int delay) |
905 | { | 905 | { |
906 | unsigned char buf; | 906 | unsigned char buf; |
907 | 907 | ||
908 | /* useful range is 0x01..0x3F */ | 908 | /* useful range is 0x01..0x3F */ |
909 | buf = (delay >> 10); | 909 | buf = (delay >> 10); |
910 | return SendControlMsg(SET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, 1); | 910 | return SendControlMsg(SET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, 1); |
@@ -914,7 +914,7 @@ static inline int pwc_get_wb_delay(struct pwc_device *pdev, int *value) | |||
914 | { | 914 | { |
915 | unsigned char buf; | 915 | unsigned char buf; |
916 | int ret; | 916 | int ret; |
917 | 917 | ||
918 | ret = RecvControlMsg(GET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, 1); | 918 | ret = RecvControlMsg(GET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, 1); |
919 | if (ret < 0) | 919 | if (ret < 0) |
920 | return ret; | 920 | return ret; |
@@ -950,7 +950,7 @@ static int pwc_get_leds(struct pwc_device *pdev, int *on_value, int *off_value) | |||
950 | { | 950 | { |
951 | unsigned char buf[2]; | 951 | unsigned char buf[2]; |
952 | int ret; | 952 | int ret; |
953 | 953 | ||
954 | if (pdev->type < 730) { | 954 | if (pdev->type < 730) { |
955 | *on_value = -1; | 955 | *on_value = -1; |
956 | *off_value = -1; | 956 | *off_value = -1; |
@@ -969,7 +969,7 @@ static inline int pwc_set_contour(struct pwc_device *pdev, int contour) | |||
969 | { | 969 | { |
970 | unsigned char buf; | 970 | unsigned char buf; |
971 | int ret; | 971 | int ret; |
972 | 972 | ||
973 | if (contour < 0) | 973 | if (contour < 0) |
974 | buf = 0xff; /* auto contour on */ | 974 | buf = 0xff; /* auto contour on */ |
975 | else | 975 | else |
@@ -977,16 +977,16 @@ static inline int pwc_set_contour(struct pwc_device *pdev, int contour) | |||
977 | ret = SendControlMsg(SET_LUM_CTL, AUTO_CONTOUR_FORMATTER, 1); | 977 | ret = SendControlMsg(SET_LUM_CTL, AUTO_CONTOUR_FORMATTER, 1); |
978 | if (ret < 0) | 978 | if (ret < 0) |
979 | return ret; | 979 | return ret; |
980 | 980 | ||
981 | if (contour < 0) | 981 | if (contour < 0) |
982 | return 0; | 982 | return 0; |
983 | if (contour > 0xffff) | 983 | if (contour > 0xffff) |
984 | contour = 0xffff; | 984 | contour = 0xffff; |
985 | 985 | ||
986 | buf = (contour >> 10); /* contour preset is [0..3f] */ | 986 | buf = (contour >> 10); /* contour preset is [0..3f] */ |
987 | ret = SendControlMsg(SET_LUM_CTL, PRESET_CONTOUR_FORMATTER, 1); | 987 | ret = SendControlMsg(SET_LUM_CTL, PRESET_CONTOUR_FORMATTER, 1); |
988 | if (ret < 0) | 988 | if (ret < 0) |
989 | return ret; | 989 | return ret; |
990 | return 0; | 990 | return 0; |
991 | } | 991 | } |
992 | 992 | ||
@@ -994,7 +994,7 @@ static inline int pwc_get_contour(struct pwc_device *pdev, int *contour) | |||
994 | { | 994 | { |
995 | unsigned char buf; | 995 | unsigned char buf; |
996 | int ret; | 996 | int ret; |
997 | 997 | ||
998 | ret = RecvControlMsg(GET_LUM_CTL, AUTO_CONTOUR_FORMATTER, 1); | 998 | ret = RecvControlMsg(GET_LUM_CTL, AUTO_CONTOUR_FORMATTER, 1); |
999 | if (ret < 0) | 999 | if (ret < 0) |
1000 | return ret; | 1000 | return ret; |
@@ -1002,7 +1002,7 @@ static inline int pwc_get_contour(struct pwc_device *pdev, int *contour) | |||
1002 | if (buf == 0) { | 1002 | if (buf == 0) { |
1003 | /* auto mode off, query current preset value */ | 1003 | /* auto mode off, query current preset value */ |
1004 | ret = RecvControlMsg(GET_LUM_CTL, PRESET_CONTOUR_FORMATTER, 1); | 1004 | ret = RecvControlMsg(GET_LUM_CTL, PRESET_CONTOUR_FORMATTER, 1); |
1005 | if (ret < 0) | 1005 | if (ret < 0) |
1006 | return ret; | 1006 | return ret; |
1007 | *contour = buf << 10; | 1007 | *contour = buf << 10; |
1008 | } | 1008 | } |
@@ -1015,7 +1015,7 @@ static inline int pwc_get_contour(struct pwc_device *pdev, int *contour) | |||
1015 | static inline int pwc_set_backlight(struct pwc_device *pdev, int backlight) | 1015 | static inline int pwc_set_backlight(struct pwc_device *pdev, int backlight) |
1016 | { | 1016 | { |
1017 | unsigned char buf; | 1017 | unsigned char buf; |
1018 | 1018 | ||
1019 | if (backlight) | 1019 | if (backlight) |
1020 | buf = 0xff; | 1020 | buf = 0xff; |
1021 | else | 1021 | else |
@@ -1027,7 +1027,7 @@ static inline int pwc_get_backlight(struct pwc_device *pdev, int *backlight) | |||
1027 | { | 1027 | { |
1028 | int ret; | 1028 | int ret; |
1029 | unsigned char buf; | 1029 | unsigned char buf; |
1030 | 1030 | ||
1031 | ret = RecvControlMsg(GET_LUM_CTL, BACK_LIGHT_COMPENSATION_FORMATTER, 1); | 1031 | ret = RecvControlMsg(GET_LUM_CTL, BACK_LIGHT_COMPENSATION_FORMATTER, 1); |
1032 | if (ret < 0) | 1032 | if (ret < 0) |
1033 | return ret; | 1033 | return ret; |
@@ -1039,7 +1039,7 @@ static inline int pwc_get_backlight(struct pwc_device *pdev, int *backlight) | |||
1039 | static inline int pwc_set_flicker(struct pwc_device *pdev, int flicker) | 1039 | static inline int pwc_set_flicker(struct pwc_device *pdev, int flicker) |
1040 | { | 1040 | { |
1041 | unsigned char buf; | 1041 | unsigned char buf; |
1042 | 1042 | ||
1043 | if (flicker) | 1043 | if (flicker) |
1044 | buf = 0xff; | 1044 | buf = 0xff; |
1045 | else | 1045 | else |
@@ -1051,7 +1051,7 @@ static inline int pwc_get_flicker(struct pwc_device *pdev, int *flicker) | |||
1051 | { | 1051 | { |
1052 | int ret; | 1052 | int ret; |
1053 | unsigned char buf; | 1053 | unsigned char buf; |
1054 | 1054 | ||
1055 | ret = RecvControlMsg(GET_LUM_CTL, FLICKERLESS_MODE_FORMATTER, 1); | 1055 | ret = RecvControlMsg(GET_LUM_CTL, FLICKERLESS_MODE_FORMATTER, 1); |
1056 | if (ret < 0) | 1056 | if (ret < 0) |
1057 | return ret; | 1057 | return ret; |
@@ -1076,7 +1076,7 @@ static inline int pwc_get_dynamic_noise(struct pwc_device *pdev, int *noise) | |||
1076 | { | 1076 | { |
1077 | int ret; | 1077 | int ret; |
1078 | unsigned char buf; | 1078 | unsigned char buf; |
1079 | 1079 | ||
1080 | ret = RecvControlMsg(GET_LUM_CTL, DYNAMIC_NOISE_CONTROL_FORMATTER, 1); | 1080 | ret = RecvControlMsg(GET_LUM_CTL, DYNAMIC_NOISE_CONTROL_FORMATTER, 1); |
1081 | if (ret < 0) | 1081 | if (ret < 0) |
1082 | return ret; | 1082 | return ret; |
@@ -1087,7 +1087,7 @@ static inline int pwc_get_dynamic_noise(struct pwc_device *pdev, int *noise) | |||
1087 | static int pwc_mpt_reset(struct pwc_device *pdev, int flags) | 1087 | static int pwc_mpt_reset(struct pwc_device *pdev, int flags) |
1088 | { | 1088 | { |
1089 | unsigned char buf; | 1089 | unsigned char buf; |
1090 | 1090 | ||
1091 | buf = flags & 0x03; // only lower two bits are currently used | 1091 | buf = flags & 0x03; // only lower two bits are currently used |
1092 | return SendControlMsg(SET_MPT_CTL, PT_RESET_CONTROL_FORMATTER, 1); | 1092 | return SendControlMsg(SET_MPT_CTL, PT_RESET_CONTROL_FORMATTER, 1); |
1093 | } | 1093 | } |
@@ -1095,7 +1095,7 @@ static int pwc_mpt_reset(struct pwc_device *pdev, int flags) | |||
1095 | static inline int pwc_mpt_set_angle(struct pwc_device *pdev, int pan, int tilt) | 1095 | static inline int pwc_mpt_set_angle(struct pwc_device *pdev, int pan, int tilt) |
1096 | { | 1096 | { |
1097 | unsigned char buf[4]; | 1097 | unsigned char buf[4]; |
1098 | 1098 | ||
1099 | /* set new relative angle; angles are expressed in degrees * 100, | 1099 | /* set new relative angle; angles are expressed in degrees * 100, |
1100 | but cam as .5 degree resolution, hence divide by 200. Also | 1100 | but cam as .5 degree resolution, hence divide by 200. Also |
1101 | the angle must be multiplied by 64 before it's send to | 1101 | the angle must be multiplied by 64 before it's send to |
@@ -1114,7 +1114,7 @@ static inline int pwc_mpt_get_status(struct pwc_device *pdev, struct pwc_mpt_sta | |||
1114 | { | 1114 | { |
1115 | int ret; | 1115 | int ret; |
1116 | unsigned char buf[5]; | 1116 | unsigned char buf[5]; |
1117 | 1117 | ||
1118 | ret = RecvControlMsg(GET_MPT_CTL, PT_STATUS_FORMATTER, 5); | 1118 | ret = RecvControlMsg(GET_MPT_CTL, PT_STATUS_FORMATTER, 5); |
1119 | if (ret < 0) | 1119 | if (ret < 0) |
1120 | return ret; | 1120 | return ret; |
@@ -1129,14 +1129,14 @@ int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor) | |||
1129 | { | 1129 | { |
1130 | unsigned char buf; | 1130 | unsigned char buf; |
1131 | int ret = -1, request; | 1131 | int ret = -1, request; |
1132 | 1132 | ||
1133 | if (pdev->type < 675) | 1133 | if (pdev->type < 675) |
1134 | request = SENSOR_TYPE_FORMATTER1; | 1134 | request = SENSOR_TYPE_FORMATTER1; |
1135 | else if (pdev->type < 730) | 1135 | else if (pdev->type < 730) |
1136 | return -1; /* The Vesta series doesn't have this call */ | 1136 | return -1; /* The Vesta series doesn't have this call */ |
1137 | else | 1137 | else |
1138 | request = SENSOR_TYPE_FORMATTER2; | 1138 | request = SENSOR_TYPE_FORMATTER2; |
1139 | 1139 | ||
1140 | ret = RecvControlMsg(GET_STATUS_CTL, request, 1); | 1140 | ret = RecvControlMsg(GET_STATUS_CTL, request, 1); |
1141 | if (ret < 0) | 1141 | if (ret < 0) |
1142 | return ret; | 1142 | return ret; |
@@ -1163,23 +1163,23 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1163 | ret = -EINVAL; | 1163 | ret = -EINVAL; |
1164 | break; | 1164 | break; |
1165 | } | 1165 | } |
1166 | 1166 | ||
1167 | case VIDIOCPWCSUSER: | 1167 | case VIDIOCPWCSUSER: |
1168 | { | 1168 | { |
1169 | if (pwc_save_user(pdev)) | 1169 | if (pwc_save_user(pdev)) |
1170 | ret = -EINVAL; | 1170 | ret = -EINVAL; |
1171 | break; | 1171 | break; |
1172 | } | 1172 | } |
1173 | 1173 | ||
1174 | case VIDIOCPWCFACTORY: | 1174 | case VIDIOCPWCFACTORY: |
1175 | { | 1175 | { |
1176 | if (pwc_restore_factory(pdev)) | 1176 | if (pwc_restore_factory(pdev)) |
1177 | ret = -EINVAL; | 1177 | ret = -EINVAL; |
1178 | break; | 1178 | break; |
1179 | } | 1179 | } |
1180 | 1180 | ||
1181 | case VIDIOCPWCSCQUAL: | 1181 | case VIDIOCPWCSCQUAL: |
1182 | { | 1182 | { |
1183 | int *qual = arg; | 1183 | int *qual = arg; |
1184 | 1184 | ||
1185 | if (*qual < 0 || *qual > 3) | 1185 | if (*qual < 0 || *qual > 3) |
@@ -1190,14 +1190,14 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1190 | pdev->vcompression = *qual; | 1190 | pdev->vcompression = *qual; |
1191 | break; | 1191 | break; |
1192 | } | 1192 | } |
1193 | 1193 | ||
1194 | case VIDIOCPWCGCQUAL: | 1194 | case VIDIOCPWCGCQUAL: |
1195 | { | 1195 | { |
1196 | int *qual = arg; | 1196 | int *qual = arg; |
1197 | *qual = pdev->vcompression; | 1197 | *qual = pdev->vcompression; |
1198 | break; | 1198 | break; |
1199 | } | 1199 | } |
1200 | 1200 | ||
1201 | case VIDIOCPWCPROBE: | 1201 | case VIDIOCPWCPROBE: |
1202 | { | 1202 | { |
1203 | struct pwc_probe *probe = arg; | 1203 | struct pwc_probe *probe = arg; |
@@ -1220,27 +1220,27 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1220 | ret = -EINVAL; | 1220 | ret = -EINVAL; |
1221 | break; | 1221 | break; |
1222 | } | 1222 | } |
1223 | 1223 | ||
1224 | case VIDIOCPWCGAGC: | 1224 | case VIDIOCPWCGAGC: |
1225 | { | 1225 | { |
1226 | int *agc = arg; | 1226 | int *agc = arg; |
1227 | 1227 | ||
1228 | if (pwc_get_agc(pdev, agc)) | 1228 | if (pwc_get_agc(pdev, agc)) |
1229 | ret = -EINVAL; | 1229 | ret = -EINVAL; |
1230 | break; | 1230 | break; |
1231 | } | 1231 | } |
1232 | 1232 | ||
1233 | case VIDIOCPWCSSHUTTER: | 1233 | case VIDIOCPWCSSHUTTER: |
1234 | { | 1234 | { |
1235 | int *shutter_speed = arg; | 1235 | int *shutter_speed = arg; |
1236 | ret = pwc_set_shutter_speed(pdev, *shutter_speed < 0 ? 1 : 0, *shutter_speed); | 1236 | ret = pwc_set_shutter_speed(pdev, *shutter_speed < 0 ? 1 : 0, *shutter_speed); |
1237 | break; | 1237 | break; |
1238 | } | 1238 | } |
1239 | 1239 | ||
1240 | case VIDIOCPWCSAWB: | 1240 | case VIDIOCPWCSAWB: |
1241 | { | 1241 | { |
1242 | struct pwc_whitebalance *wb = arg; | 1242 | struct pwc_whitebalance *wb = arg; |
1243 | 1243 | ||
1244 | ret = pwc_set_awb(pdev, wb->mode); | 1244 | ret = pwc_set_awb(pdev, wb->mode); |
1245 | if (ret >= 0 && wb->mode == PWC_WB_MANUAL) { | 1245 | if (ret >= 0 && wb->mode == PWC_WB_MANUAL) { |
1246 | pwc_set_red_gain(pdev, wb->manual_red); | 1246 | pwc_set_red_gain(pdev, wb->manual_red); |
@@ -1270,18 +1270,18 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1270 | ret = pwc_read_red_gain(pdev, &wb->read_red); | 1270 | ret = pwc_read_red_gain(pdev, &wb->read_red); |
1271 | if (ret < 0) | 1271 | if (ret < 0) |
1272 | break; | 1272 | break; |
1273 | ret = pwc_read_blue_gain(pdev, &wb->read_blue); | 1273 | ret = pwc_read_blue_gain(pdev, &wb->read_blue); |
1274 | if (ret < 0) | 1274 | if (ret < 0) |
1275 | break; | 1275 | break; |
1276 | } | 1276 | } |
1277 | } | 1277 | } |
1278 | break; | 1278 | break; |
1279 | } | 1279 | } |
1280 | 1280 | ||
1281 | case VIDIOCPWCSAWBSPEED: | 1281 | case VIDIOCPWCSAWBSPEED: |
1282 | { | 1282 | { |
1283 | struct pwc_wb_speed *wbs = arg; | 1283 | struct pwc_wb_speed *wbs = arg; |
1284 | 1284 | ||
1285 | if (wbs->control_speed > 0) { | 1285 | if (wbs->control_speed > 0) { |
1286 | ret = pwc_set_wb_speed(pdev, wbs->control_speed); | 1286 | ret = pwc_set_wb_speed(pdev, wbs->control_speed); |
1287 | } | 1287 | } |
@@ -1290,11 +1290,11 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1290 | } | 1290 | } |
1291 | break; | 1291 | break; |
1292 | } | 1292 | } |
1293 | 1293 | ||
1294 | case VIDIOCPWCGAWBSPEED: | 1294 | case VIDIOCPWCGAWBSPEED: |
1295 | { | 1295 | { |
1296 | struct pwc_wb_speed *wbs = arg; | 1296 | struct pwc_wb_speed *wbs = arg; |
1297 | 1297 | ||
1298 | ret = pwc_get_wb_speed(pdev, &wbs->control_speed); | 1298 | ret = pwc_get_wb_speed(pdev, &wbs->control_speed); |
1299 | if (ret < 0) | 1299 | if (ret < 0) |
1300 | break; | 1300 | break; |
@@ -1304,7 +1304,7 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1304 | break; | 1304 | break; |
1305 | } | 1305 | } |
1306 | 1306 | ||
1307 | case VIDIOCPWCSLED: | 1307 | case VIDIOCPWCSLED: |
1308 | { | 1308 | { |
1309 | struct pwc_leds *leds = arg; | 1309 | struct pwc_leds *leds = arg; |
1310 | ret = pwc_set_leds(pdev, leds->led_on, leds->led_off); | 1310 | ret = pwc_set_leds(pdev, leds->led_on, leds->led_off); |
@@ -1325,14 +1325,14 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1325 | ret = pwc_set_contour(pdev, *contour); | 1325 | ret = pwc_set_contour(pdev, *contour); |
1326 | break; | 1326 | break; |
1327 | } | 1327 | } |
1328 | 1328 | ||
1329 | case VIDIOCPWCGCONTOUR: | 1329 | case VIDIOCPWCGCONTOUR: |
1330 | { | 1330 | { |
1331 | int *contour = arg; | 1331 | int *contour = arg; |
1332 | ret = pwc_get_contour(pdev, contour); | 1332 | ret = pwc_get_contour(pdev, contour); |
1333 | break; | 1333 | break; |
1334 | } | 1334 | } |
1335 | 1335 | ||
1336 | case VIDIOCPWCSBACKLIGHT: | 1336 | case VIDIOCPWCSBACKLIGHT: |
1337 | { | 1337 | { |
1338 | int *backlight = arg; | 1338 | int *backlight = arg; |
@@ -1346,7 +1346,7 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1346 | ret = pwc_get_backlight(pdev, backlight); | 1346 | ret = pwc_get_backlight(pdev, backlight); |
1347 | break; | 1347 | break; |
1348 | } | 1348 | } |
1349 | 1349 | ||
1350 | case VIDIOCPWCSFLICKER: | 1350 | case VIDIOCPWCSFLICKER: |
1351 | { | 1351 | { |
1352 | int *flicker = arg; | 1352 | int *flicker = arg; |
@@ -1360,14 +1360,14 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1360 | ret = pwc_get_flicker(pdev, flicker); | 1360 | ret = pwc_get_flicker(pdev, flicker); |
1361 | break; | 1361 | break; |
1362 | } | 1362 | } |
1363 | 1363 | ||
1364 | case VIDIOCPWCSDYNNOISE: | 1364 | case VIDIOCPWCSDYNNOISE: |
1365 | { | 1365 | { |
1366 | int *dynnoise = arg; | 1366 | int *dynnoise = arg; |
1367 | ret = pwc_set_dynamic_noise(pdev, *dynnoise); | 1367 | ret = pwc_set_dynamic_noise(pdev, *dynnoise); |
1368 | break; | 1368 | break; |
1369 | } | 1369 | } |
1370 | 1370 | ||
1371 | case VIDIOCPWCGDYNNOISE: | 1371 | case VIDIOCPWCGDYNNOISE: |
1372 | { | 1372 | { |
1373 | int *dynnoise = arg; | 1373 | int *dynnoise = arg; |
@@ -1381,61 +1381,61 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1381 | size->width = pdev->image.x; | 1381 | size->width = pdev->image.x; |
1382 | size->height = pdev->image.y; | 1382 | size->height = pdev->image.y; |
1383 | break; | 1383 | break; |
1384 | } | 1384 | } |
1385 | 1385 | ||
1386 | case VIDIOCPWCMPTRESET: | 1386 | case VIDIOCPWCMPTRESET: |
1387 | { | 1387 | { |
1388 | if (pdev->features & FEATURE_MOTOR_PANTILT) | 1388 | if (pdev->features & FEATURE_MOTOR_PANTILT) |
1389 | { | 1389 | { |
1390 | int *flags = arg; | 1390 | int *flags = arg; |
1391 | 1391 | ||
1392 | ret = pwc_mpt_reset(pdev, *flags); | 1392 | ret = pwc_mpt_reset(pdev, *flags); |
1393 | if (ret >= 0) | 1393 | if (ret >= 0) |
1394 | { | 1394 | { |
1395 | pdev->pan_angle = 0; | 1395 | pdev->pan_angle = 0; |
1396 | pdev->tilt_angle = 0; | 1396 | pdev->tilt_angle = 0; |
1397 | } | 1397 | } |
1398 | } | 1398 | } |
1399 | else | 1399 | else |
1400 | { | 1400 | { |
1401 | ret = -ENXIO; | 1401 | ret = -ENXIO; |
1402 | } | 1402 | } |
1403 | break; | 1403 | break; |
1404 | } | 1404 | } |
1405 | 1405 | ||
1406 | case VIDIOCPWCMPTGRANGE: | 1406 | case VIDIOCPWCMPTGRANGE: |
1407 | { | 1407 | { |
1408 | if (pdev->features & FEATURE_MOTOR_PANTILT) | 1408 | if (pdev->features & FEATURE_MOTOR_PANTILT) |
1409 | { | 1409 | { |
1410 | struct pwc_mpt_range *range = arg; | 1410 | struct pwc_mpt_range *range = arg; |
1411 | *range = pdev->angle_range; | 1411 | *range = pdev->angle_range; |
1412 | } | 1412 | } |
1413 | else | 1413 | else |
1414 | { | 1414 | { |
1415 | ret = -ENXIO; | 1415 | ret = -ENXIO; |
1416 | } | 1416 | } |
1417 | break; | 1417 | break; |
1418 | } | 1418 | } |
1419 | 1419 | ||
1420 | case VIDIOCPWCMPTSANGLE: | 1420 | case VIDIOCPWCMPTSANGLE: |
1421 | { | 1421 | { |
1422 | int new_pan, new_tilt; | 1422 | int new_pan, new_tilt; |
1423 | 1423 | ||
1424 | if (pdev->features & FEATURE_MOTOR_PANTILT) | 1424 | if (pdev->features & FEATURE_MOTOR_PANTILT) |
1425 | { | 1425 | { |
1426 | struct pwc_mpt_angles *angles = arg; | 1426 | struct pwc_mpt_angles *angles = arg; |
1427 | /* The camera can only set relative angles, so | 1427 | /* The camera can only set relative angles, so |
1428 | do some calculations when getting an absolute angle . | 1428 | do some calculations when getting an absolute angle . |
1429 | */ | 1429 | */ |
1430 | if (angles->absolute) | 1430 | if (angles->absolute) |
1431 | { | 1431 | { |
1432 | new_pan = angles->pan; | 1432 | new_pan = angles->pan; |
1433 | new_tilt = angles->tilt; | 1433 | new_tilt = angles->tilt; |
1434 | } | 1434 | } |
1435 | else | 1435 | else |
1436 | { | 1436 | { |
1437 | new_pan = pdev->pan_angle + angles->pan; | 1437 | new_pan = pdev->pan_angle + angles->pan; |
1438 | new_tilt = pdev->tilt_angle + angles->tilt; | 1438 | new_tilt = pdev->tilt_angle + angles->tilt; |
1439 | } | 1439 | } |
1440 | /* check absolute ranges */ | 1440 | /* check absolute ranges */ |
1441 | if (new_pan < pdev->angle_range.pan_min || | 1441 | if (new_pan < pdev->angle_range.pan_min || |
@@ -1463,53 +1463,53 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1463 | pdev->tilt_angle += new_tilt; | 1463 | pdev->tilt_angle += new_tilt; |
1464 | } | 1464 | } |
1465 | if (ret == -EPIPE) /* stall -> out of range */ | 1465 | if (ret == -EPIPE) /* stall -> out of range */ |
1466 | ret = -ERANGE; | 1466 | ret = -ERANGE; |
1467 | } | 1467 | } |
1468 | } | 1468 | } |
1469 | else | 1469 | else |
1470 | { | 1470 | { |
1471 | ret = -ENXIO; | 1471 | ret = -ENXIO; |
1472 | } | 1472 | } |
1473 | break; | 1473 | break; |
1474 | } | 1474 | } |
1475 | 1475 | ||
1476 | case VIDIOCPWCMPTGANGLE: | 1476 | case VIDIOCPWCMPTGANGLE: |
1477 | { | 1477 | { |
1478 | 1478 | ||
1479 | if (pdev->features & FEATURE_MOTOR_PANTILT) | 1479 | if (pdev->features & FEATURE_MOTOR_PANTILT) |
1480 | { | 1480 | { |
1481 | struct pwc_mpt_angles *angles = arg; | 1481 | struct pwc_mpt_angles *angles = arg; |
1482 | 1482 | ||
1483 | angles->absolute = 1; | 1483 | angles->absolute = 1; |
1484 | angles->pan = pdev->pan_angle; | 1484 | angles->pan = pdev->pan_angle; |
1485 | angles->tilt = pdev->tilt_angle; | 1485 | angles->tilt = pdev->tilt_angle; |
1486 | } | 1486 | } |
1487 | else | 1487 | else |
1488 | { | 1488 | { |
1489 | ret = -ENXIO; | 1489 | ret = -ENXIO; |
1490 | } | 1490 | } |
1491 | break; | 1491 | break; |
1492 | } | 1492 | } |
1493 | 1493 | ||
1494 | case VIDIOCPWCMPTSTATUS: | 1494 | case VIDIOCPWCMPTSTATUS: |
1495 | { | 1495 | { |
1496 | if (pdev->features & FEATURE_MOTOR_PANTILT) | 1496 | if (pdev->features & FEATURE_MOTOR_PANTILT) |
1497 | { | 1497 | { |
1498 | struct pwc_mpt_status *status = arg; | 1498 | struct pwc_mpt_status *status = arg; |
1499 | ret = pwc_mpt_get_status(pdev, status); | 1499 | ret = pwc_mpt_get_status(pdev, status); |
1500 | } | 1500 | } |
1501 | else | 1501 | else |
1502 | { | 1502 | { |
1503 | ret = -ENXIO; | 1503 | ret = -ENXIO; |
1504 | } | 1504 | } |
1505 | break; | 1505 | break; |
1506 | } | 1506 | } |
1507 | 1507 | ||
1508 | case VIDIOCPWCGVIDCMD: | 1508 | case VIDIOCPWCGVIDCMD: |
1509 | { | 1509 | { |
1510 | struct pwc_video_command *cmd = arg; | 1510 | struct pwc_video_command *cmd = arg; |
1511 | 1511 | ||
1512 | cmd->type = pdev->type; | 1512 | cmd->type = pdev->type; |
1513 | cmd->release = pdev->release; | 1513 | cmd->release = pdev->release; |
1514 | cmd->command_len = pdev->cmd_len; | 1514 | cmd->command_len = pdev->cmd_len; |
1515 | memcpy(&cmd->command_buf, pdev->cmd_buf, pdev->cmd_len); | 1515 | memcpy(&cmd->command_buf, pdev->cmd_buf, pdev->cmd_len); |
@@ -1531,7 +1531,7 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1531 | ret = -ENOIOCTLCMD; | 1531 | ret = -ENOIOCTLCMD; |
1532 | break; | 1532 | break; |
1533 | } | 1533 | } |
1534 | 1534 | ||
1535 | if (ret > 0) | 1535 | if (ret > 0) |
1536 | return 0; | 1536 | return 0; |
1537 | return ret; | 1537 | return ret; |