aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/feature-removal-schedule.txt9
-rw-r--r--drivers/media/video/pwc/pwc-ctrl.c571
-rw-r--r--drivers/media/video/pwc/pwc-dec23.c1
-rw-r--r--drivers/media/video/pwc/pwc-if.c10
-rw-r--r--drivers/media/video/pwc/pwc-kiara.h2
-rw-r--r--drivers/media/video/pwc/pwc-timon.h2
-rw-r--r--drivers/media/video/pwc/pwc-v4l.c12
-rw-r--r--drivers/media/video/pwc/pwc.h36
-rw-r--r--include/media/pwc-ioctl.h323
9 files changed, 26 insertions, 940 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index b7d96e148393..821e3c29ec83 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -460,15 +460,6 @@ Who: Jean Delvare <khali@linux-fr.org>
460 460
461---------------------------- 461----------------------------
462 462
463What: Support for driver specific ioctls in the pwc driver (everything
464 defined in media/pwc-ioctl.h)
465When: 3.3
466Why: This stems from the v4l1 era, with v4l2 everything can be done with
467 standardized v4l2 API calls
468Who: Hans de Goede <hdegoede@redhat.com>
469
470----------------------------
471
472What: Software emulation of arbritary resolutions in the pwc driver 463What: Software emulation of arbritary resolutions in the pwc driver
473When: 3.3 464When: 3.3
474Why: The pwc driver claims to support any resolution between 160x120 465Why: The pwc driver claims to support any resolution between 160x120
diff --git a/drivers/media/video/pwc/pwc-ctrl.c b/drivers/media/video/pwc/pwc-ctrl.c
index 2cf77001804d..684b7c50eea9 100644
--- a/drivers/media/video/pwc/pwc-ctrl.c
+++ b/drivers/media/video/pwc/pwc-ctrl.c
@@ -604,136 +604,6 @@ int pwc_set_leds(struct pwc_device *pdev, int on_value, int off_value)
604 return r; 604 return r;
605} 605}
606 606
607static int pwc_get_leds(struct pwc_device *pdev, int *on_value, int *off_value)
608{
609 unsigned char buf[2];
610 int ret;
611
612 if (pdev->type < 730) {
613 *on_value = -1;
614 *off_value = -1;
615 return 0;
616 }
617
618 ret = recv_control_msg(pdev,
619 GET_STATUS_CTL, LED_FORMATTER, &buf, sizeof(buf));
620 if (ret < 0)
621 return ret;
622 *on_value = buf[0] * 100;
623 *off_value = buf[1] * 100;
624 return 0;
625}
626
627static int _pwc_mpt_reset(struct pwc_device *pdev, int flags)
628{
629 unsigned char buf;
630 int r;
631
632 mutex_lock(&pdev->udevlock);
633 if (!pdev->udev) {
634 r = -ENODEV;
635 goto leave;
636 }
637
638 buf = flags & 0x03; // only lower two bits are currently used
639 r = send_control_msg(pdev,
640 SET_MPT_CTL, PT_RESET_CONTROL_FORMATTER, &buf, sizeof(buf));
641leave:
642 mutex_unlock(&pdev->udevlock);
643 return r;
644}
645
646int pwc_mpt_reset(struct pwc_device *pdev, int flags)
647{
648 int ret;
649 ret = _pwc_mpt_reset(pdev, flags);
650 if (ret >= 0) {
651 pdev->pan_angle = 0;
652 pdev->tilt_angle = 0;
653 }
654 return ret;
655}
656
657static int _pwc_mpt_set_angle(struct pwc_device *pdev, int pan, int tilt)
658{
659 unsigned char buf[4];
660 int r;
661
662 mutex_lock(&pdev->udevlock);
663 if (!pdev->udev) {
664 r = -ENODEV;
665 goto leave;
666 }
667
668 /* set new relative angle; angles are expressed in degrees * 100,
669 but cam as .5 degree resolution, hence divide by 200. Also
670 the angle must be multiplied by 64 before it's send to
671 the cam (??)
672 */
673 pan = 64 * pan / 100;
674 tilt = -64 * tilt / 100; /* positive tilt is down, which is not what the user would expect */
675 buf[0] = pan & 0xFF;
676 buf[1] = (pan >> 8) & 0xFF;
677 buf[2] = tilt & 0xFF;
678 buf[3] = (tilt >> 8) & 0xFF;
679 r = send_control_msg(pdev,
680 SET_MPT_CTL, PT_RELATIVE_CONTROL_FORMATTER, &buf, sizeof(buf));
681leave:
682 mutex_unlock(&pdev->udevlock);
683 return r;
684}
685
686int pwc_mpt_set_angle(struct pwc_device *pdev, int pan, int tilt)
687{
688 int ret;
689
690 /* check absolute ranges */
691 if (pan < pdev->angle_range.pan_min ||
692 pan > pdev->angle_range.pan_max ||
693 tilt < pdev->angle_range.tilt_min ||
694 tilt > pdev->angle_range.tilt_max)
695 return -ERANGE;
696
697 /* go to relative range, check again */
698 pan -= pdev->pan_angle;
699 tilt -= pdev->tilt_angle;
700 /* angles are specified in degrees * 100, thus the limit = 36000 */
701 if (pan < -36000 || pan > 36000 || tilt < -36000 || tilt > 36000)
702 return -ERANGE;
703
704 ret = _pwc_mpt_set_angle(pdev, pan, tilt);
705 if (ret >= 0) {
706 pdev->pan_angle += pan;
707 pdev->tilt_angle += tilt;
708 }
709 if (ret == -EPIPE) /* stall -> out of range */
710 ret = -ERANGE;
711 return ret;
712}
713
714static int pwc_mpt_get_status(struct pwc_device *pdev, struct pwc_mpt_status *status)
715{
716 int ret;
717 unsigned char buf[5];
718
719 mutex_lock(&pdev->udevlock);
720 if (!pdev->udev) {
721 ret = -ENODEV;
722 goto leave;
723 }
724
725 ret = recv_control_msg(pdev,
726 GET_MPT_CTL, PT_STATUS_FORMATTER, &buf, sizeof(buf));
727 if (ret < 0)
728 goto leave;
729 status->status = buf[0] & 0x7; // 3 bits are used for reporting
730 status->time_pan = (buf[1] << 8) + buf[2];
731 status->time_tilt = (buf[3] << 8) + buf[4];
732leave:
733 mutex_unlock(&pdev->udevlock);
734 return ret;
735}
736
737#ifdef CONFIG_USB_PWC_DEBUG 607#ifdef CONFIG_USB_PWC_DEBUG
738int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor) 608int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor)
739{ 609{
@@ -758,444 +628,3 @@ int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor)
758 return 0; 628 return 0;
759} 629}
760#endif 630#endif
761
762 /* End of Add-Ons */
763 /* ************************************************* */
764
765/* Linux 2.5.something and 2.6 pass direct pointers to arguments of
766 ioctl() calls. With 2.4, you have to do tedious copy_from_user()
767 and copy_to_user() calls. With these macros we circumvent this,
768 and let me maintain only one source file. The functionality is
769 exactly the same otherwise.
770 */
771
772/* define local variable for arg */
773#define ARG_DEF(ARG_type, ARG_name)\
774 ARG_type *ARG_name = arg;
775/* copy arg to local variable */
776#define ARG_IN(ARG_name) /* nothing */
777/* argument itself (referenced) */
778#define ARGR(ARG_name) (*ARG_name)
779/* argument address */
780#define ARGA(ARG_name) ARG_name
781/* copy local variable to arg */
782#define ARG_OUT(ARG_name) /* nothing */
783
784/*
785 * Our ctrls use native values, but the old custom pwc ioctl interface expects
786 * values from 0 - 65535, define 2 helper functions to scale things. */
787static int pwc_ioctl_g_ctrl(struct v4l2_ctrl *ctrl)
788{
789 return v4l2_ctrl_g_ctrl(ctrl) * 65535 / ctrl->maximum;
790}
791
792static int pwc_ioctl_s_ctrl(struct v4l2_ctrl *ctrl, int val)
793{
794 return v4l2_ctrl_s_ctrl(ctrl, val * ctrl->maximum / 65535);
795}
796
797long pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg)
798{
799 long ret = 0;
800
801 switch(cmd) {
802 case VIDIOCPWCRUSER:
803 ret = v4l2_ctrl_s_ctrl(pdev->restore_user, 0);
804 break;
805
806 case VIDIOCPWCSUSER:
807 ret = v4l2_ctrl_s_ctrl(pdev->save_user, 0);
808 break;
809
810 case VIDIOCPWCFACTORY:
811 ret = v4l2_ctrl_s_ctrl(pdev->restore_factory, 0);
812 break;
813
814 case VIDIOCPWCSCQUAL:
815 {
816 ARG_DEF(int, qual)
817
818 mutex_lock(&pdev->udevlock);
819 if (!pdev->udev) {
820 ret = -ENODEV;
821 goto leave;
822 }
823
824 if (pdev->iso_init) {
825 ret = -EBUSY;
826 goto leave;
827 }
828
829 ARG_IN(qual)
830 if (ARGR(qual) < 0 || ARGR(qual) > 3)
831 ret = -EINVAL;
832 else
833 ret = pwc_set_video_mode(pdev,
834 pdev->view.x, pdev->view.y,
835 pdev->vframes, ARGR(qual));
836leave:
837 mutex_unlock(&pdev->udevlock);
838 break;
839 }
840
841 case VIDIOCPWCGCQUAL:
842 {
843 ARG_DEF(int, qual)
844
845 ARGR(qual) = pdev->vcompression;
846 ARG_OUT(qual)
847 break;
848 }
849
850 case VIDIOCPWCPROBE:
851 {
852 ARG_DEF(struct pwc_probe, probe)
853
854 strcpy(ARGR(probe).name, pdev->vdev.name);
855 ARGR(probe).type = pdev->type;
856 ARG_OUT(probe)
857 break;
858 }
859
860 case VIDIOCPWCGSERIAL:
861 {
862 ARG_DEF(struct pwc_serial, serial)
863
864 strcpy(ARGR(serial).serial, pdev->serial);
865 ARG_OUT(serial)
866 break;
867 }
868
869 case VIDIOCPWCSAGC:
870 {
871 ARG_DEF(int, agc)
872 ARG_IN(agc)
873 ret = v4l2_ctrl_s_ctrl(pdev->autogain, ARGR(agc) < 0);
874 if (ret == 0 && ARGR(agc) >= 0)
875 ret = pwc_ioctl_s_ctrl(pdev->gain, ARGR(agc));
876 break;
877 }
878
879 case VIDIOCPWCGAGC:
880 {
881 ARG_DEF(int, agc)
882 if (v4l2_ctrl_g_ctrl(pdev->autogain))
883 ARGR(agc) = -1;
884 else
885 ARGR(agc) = pwc_ioctl_g_ctrl(pdev->gain);
886 ARG_OUT(agc)
887 break;
888 }
889
890 case VIDIOCPWCSSHUTTER:
891 {
892 ARG_DEF(int, shutter)
893 ARG_IN(shutter)
894 ret = v4l2_ctrl_s_ctrl(pdev->exposure_auto,
895 /* Menu idx 0 = auto, idx 1 = manual */
896 ARGR(shutter) >= 0);
897 if (ret == 0 && ARGR(shutter) >= 0)
898 ret = pwc_ioctl_s_ctrl(pdev->exposure, ARGR(shutter));
899 break;
900 }
901
902 case VIDIOCPWCSAWB:
903 {
904 ARG_DEF(struct pwc_whitebalance, wb)
905 ARG_IN(wb)
906 ret = v4l2_ctrl_s_ctrl(pdev->auto_white_balance,
907 ARGR(wb).mode);
908 if (ret == 0 && ARGR(wb).mode == PWC_WB_MANUAL)
909 ret = pwc_ioctl_s_ctrl(pdev->red_balance,
910 ARGR(wb).manual_red);
911 if (ret == 0 && ARGR(wb).mode == PWC_WB_MANUAL)
912 ret = pwc_ioctl_s_ctrl(pdev->blue_balance,
913 ARGR(wb).manual_blue);
914 break;
915 }
916
917 case VIDIOCPWCGAWB:
918 {
919 ARG_DEF(struct pwc_whitebalance, wb)
920 ARGR(wb).mode = v4l2_ctrl_g_ctrl(pdev->auto_white_balance);
921 ARGR(wb).manual_red = ARGR(wb).read_red =
922 pwc_ioctl_g_ctrl(pdev->red_balance);
923 ARGR(wb).manual_blue = ARGR(wb).read_blue =
924 pwc_ioctl_g_ctrl(pdev->blue_balance);
925 ARG_OUT(wb)
926 break;
927 }
928
929 case VIDIOCPWCSAWBSPEED:
930 {
931 ARG_DEF(struct pwc_wb_speed, wbs)
932
933 if (ARGR(wbs).control_speed > 0) {
934 ret = pwc_ioctl_s_ctrl(pdev->awb_speed,
935 ARGR(wbs).control_speed);
936 }
937 if (ret == 0 && ARGR(wbs).control_delay > 0) {
938 ret = pwc_ioctl_s_ctrl(pdev->awb_delay,
939 ARGR(wbs).control_delay);
940 }
941 break;
942 }
943
944 case VIDIOCPWCGAWBSPEED:
945 {
946 ARG_DEF(struct pwc_wb_speed, wbs)
947
948 ARGR(wbs).control_speed = v4l2_ctrl_g_ctrl(pdev->awb_speed);
949 ARGR(wbs).control_delay = v4l2_ctrl_g_ctrl(pdev->awb_delay);
950 ARG_OUT(wbs)
951 break;
952 }
953
954 case VIDIOCPWCSLED:
955 {
956 ARG_DEF(struct pwc_leds, leds)
957
958 mutex_lock(&pdev->udevlock);
959 if (!pdev->udev) {
960 ret = -ENODEV;
961 break;
962 }
963
964 ARG_IN(leds)
965 ret = pwc_set_leds(pdev, ARGR(leds).led_on, ARGR(leds).led_off);
966
967 mutex_unlock(&pdev->udevlock);
968 break;
969 }
970
971
972 case VIDIOCPWCGLED:
973 {
974 ARG_DEF(struct pwc_leds, leds)
975
976 mutex_lock(&pdev->udevlock);
977 if (!pdev->udev) {
978 ret = -ENODEV;
979 break;
980 }
981
982 ret = pwc_get_leds(pdev, &ARGR(leds).led_on, &ARGR(leds).led_off);
983 ARG_OUT(leds)
984
985 mutex_unlock(&pdev->udevlock);
986 break;
987 }
988
989 case VIDIOCPWCSCONTOUR:
990 {
991 ARG_DEF(int, contour)
992 ARG_IN(contour)
993 ret = v4l2_ctrl_s_ctrl(pdev->autocontour, ARGR(contour) < 0);
994 if (ret == 0 && ARGR(contour) >= 0)
995 ret = pwc_ioctl_s_ctrl(pdev->contour, ARGR(contour));
996 break;
997 }
998
999 case VIDIOCPWCGCONTOUR:
1000 {
1001 ARG_DEF(int, contour)
1002 if (v4l2_ctrl_g_ctrl(pdev->autocontour))
1003 ARGR(contour) = -1;
1004 else
1005 ARGR(contour) = pwc_ioctl_g_ctrl(pdev->contour);
1006 ARG_OUT(contour)
1007 break;
1008 }
1009
1010 case VIDIOCPWCSBACKLIGHT:
1011 {
1012 ARG_DEF(int, backlight)
1013 ARG_IN(backlight)
1014 ret = v4l2_ctrl_s_ctrl(pdev->backlight, ARGR(backlight));
1015 break;
1016 }
1017
1018 case VIDIOCPWCGBACKLIGHT:
1019 {
1020 ARG_DEF(int, backlight)
1021 ARGR(backlight) = v4l2_ctrl_g_ctrl(pdev->backlight);
1022 ARG_OUT(backlight)
1023 break;
1024 }
1025
1026 case VIDIOCPWCSFLICKER:
1027 {
1028 ARG_DEF(int, flicker)
1029 ARG_IN(flicker)
1030 ret = v4l2_ctrl_s_ctrl(pdev->flicker, ARGR(flicker));
1031 break;
1032 }
1033
1034 case VIDIOCPWCGFLICKER:
1035 {
1036 ARG_DEF(int, flicker)
1037 ARGR(flicker) = v4l2_ctrl_g_ctrl(pdev->flicker);
1038 ARG_OUT(flicker)
1039 break;
1040 }
1041
1042 case VIDIOCPWCSDYNNOISE:
1043 {
1044 ARG_DEF(int, dynnoise)
1045 ARG_IN(dynnoise)
1046 ret = v4l2_ctrl_s_ctrl(pdev->noise_reduction, ARGR(dynnoise));
1047 break;
1048 }
1049
1050 case VIDIOCPWCGDYNNOISE:
1051 {
1052 ARG_DEF(int, dynnoise)
1053 ARGR(dynnoise) = v4l2_ctrl_g_ctrl(pdev->noise_reduction);
1054 ARG_OUT(dynnoise);
1055 break;
1056 }
1057
1058 case VIDIOCPWCGREALSIZE:
1059 {
1060 ARG_DEF(struct pwc_imagesize, size)
1061
1062 ARGR(size).width = pdev->image.x;
1063 ARGR(size).height = pdev->image.y;
1064 ARG_OUT(size)
1065 break;
1066 }
1067
1068 case VIDIOCPWCMPTRESET:
1069 {
1070 if (pdev->features & FEATURE_MOTOR_PANTILT)
1071 {
1072 ARG_DEF(int, flags)
1073
1074 ARG_IN(flags)
1075 ret = pwc_mpt_reset(pdev, ARGR(flags));
1076 }
1077 else
1078 {
1079 ret = -ENXIO;
1080 }
1081 break;
1082 }
1083
1084 case VIDIOCPWCMPTGRANGE:
1085 {
1086 if (pdev->features & FEATURE_MOTOR_PANTILT)
1087 {
1088 ARG_DEF(struct pwc_mpt_range, range)
1089
1090 ARGR(range) = pdev->angle_range;
1091 ARG_OUT(range)
1092 }
1093 else
1094 {
1095 ret = -ENXIO;
1096 }
1097 break;
1098 }
1099
1100 case VIDIOCPWCMPTSANGLE:
1101 {
1102 int new_pan, new_tilt;
1103
1104 if (pdev->features & FEATURE_MOTOR_PANTILT)
1105 {
1106 ARG_DEF(struct pwc_mpt_angles, angles)
1107
1108 ARG_IN(angles)
1109 /* The camera can only set relative angles, so
1110 do some calculations when getting an absolute angle .
1111 */
1112 if (ARGR(angles).absolute)
1113 {
1114 new_pan = ARGR(angles).pan;
1115 new_tilt = ARGR(angles).tilt;
1116 }
1117 else
1118 {
1119 new_pan = pdev->pan_angle + ARGR(angles).pan;
1120 new_tilt = pdev->tilt_angle + ARGR(angles).tilt;
1121 }
1122 ret = pwc_mpt_set_angle(pdev, new_pan, new_tilt);
1123 }
1124 else
1125 {
1126 ret = -ENXIO;
1127 }
1128 break;
1129 }
1130
1131 case VIDIOCPWCMPTGANGLE:
1132 {
1133
1134 if (pdev->features & FEATURE_MOTOR_PANTILT)
1135 {
1136 ARG_DEF(struct pwc_mpt_angles, angles)
1137
1138 ARGR(angles).absolute = 1;
1139 ARGR(angles).pan = pdev->pan_angle;
1140 ARGR(angles).tilt = pdev->tilt_angle;
1141 ARG_OUT(angles)
1142 }
1143 else
1144 {
1145 ret = -ENXIO;
1146 }
1147 break;
1148 }
1149
1150 case VIDIOCPWCMPTSTATUS:
1151 {
1152 if (pdev->features & FEATURE_MOTOR_PANTILT)
1153 {
1154 ARG_DEF(struct pwc_mpt_status, status)
1155
1156 ret = pwc_mpt_get_status(pdev, ARGA(status));
1157 ARG_OUT(status)
1158 }
1159 else
1160 {
1161 ret = -ENXIO;
1162 }
1163 break;
1164 }
1165
1166 case VIDIOCPWCGVIDCMD:
1167 {
1168 ARG_DEF(struct pwc_video_command, vcmd);
1169
1170 ARGR(vcmd).type = pdev->type;
1171 ARGR(vcmd).release = pdev->release;
1172 ARGR(vcmd).command_len = pdev->cmd_len;
1173 memcpy(&ARGR(vcmd).command_buf, pdev->cmd_buf, pdev->cmd_len);
1174 ARGR(vcmd).bandlength = pdev->vbandlength;
1175 ARGR(vcmd).frame_size = pdev->frame_size;
1176 ARG_OUT(vcmd)
1177 break;
1178 }
1179 /*
1180 case VIDIOCPWCGVIDTABLE:
1181 {
1182 ARG_DEF(struct pwc_table_init_buffer, table);
1183 ARGR(table).len = pdev->cmd_len;
1184 memcpy(&ARGR(table).buffer, pdev->decompress_data, pdev->decompressor->table_size);
1185 ARG_OUT(table)
1186 break;
1187 }
1188 */
1189
1190 default:
1191 ret = -ENOIOCTLCMD;
1192 break;
1193 }
1194
1195 if (ret > 0)
1196 return 0;
1197 return ret;
1198}
1199
1200
1201/* vim: set cinoptions= formatoptions=croql cindent shiftwidth=8 tabstop=8: */
diff --git a/drivers/media/video/pwc/pwc-dec23.c b/drivers/media/video/pwc/pwc-dec23.c
index bce3d9bfd035..e531f85460c1 100644
--- a/drivers/media/video/pwc/pwc-dec23.c
+++ b/drivers/media/video/pwc/pwc-dec23.c
@@ -27,7 +27,6 @@
27#include "pwc-timon.h" 27#include "pwc-timon.h"
28#include "pwc-kiara.h" 28#include "pwc-kiara.h"
29#include "pwc-dec23.h" 29#include "pwc-dec23.h"
30#include <media/pwc-ioctl.h>
31 30
32#include <linux/string.h> 31#include <linux/string.h>
33#include <linux/slab.h> 32#include <linux/slab.h>
diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c
index a66f60cb8c3b..963b4a55ec75 100644
--- a/drivers/media/video/pwc/pwc-if.c
+++ b/drivers/media/video/pwc/pwc-if.c
@@ -1058,16 +1058,6 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
1058 pdev->vframes = default_fps; 1058 pdev->vframes = default_fps;
1059 strcpy(pdev->serial, serial_number); 1059 strcpy(pdev->serial, serial_number);
1060 pdev->features = features; 1060 pdev->features = features;
1061 if (vendor_id == 0x046D && product_id == 0x08B5) {
1062 /* Logitech QuickCam Orbit
1063 The ranges have been determined experimentally; they may differ from cam to cam.
1064 Also, the exact ranges left-right and up-down are different for my cam
1065 */
1066 pdev->angle_range.pan_min = -7000;
1067 pdev->angle_range.pan_max = 7000;
1068 pdev->angle_range.tilt_min = -3000;
1069 pdev->angle_range.tilt_max = 2500;
1070 }
1071 pwc_construct(pdev); /* set min/max sizes correct */ 1061 pwc_construct(pdev); /* set min/max sizes correct */
1072 1062
1073 mutex_init(&pdev->capt_file_lock); 1063 mutex_init(&pdev->capt_file_lock);
diff --git a/drivers/media/video/pwc/pwc-kiara.h b/drivers/media/video/pwc/pwc-kiara.h
index 047dad8c15f7..8e02b7ac2139 100644
--- a/drivers/media/video/pwc/pwc-kiara.h
+++ b/drivers/media/video/pwc/pwc-kiara.h
@@ -27,7 +27,7 @@
27#ifndef PWC_KIARA_H 27#ifndef PWC_KIARA_H
28#define PWC_KIARA_H 28#define PWC_KIARA_H
29 29
30#include <media/pwc-ioctl.h> 30#include "pwc.h"
31 31
32#define PWC_FPS_MAX_KIARA 6 32#define PWC_FPS_MAX_KIARA 6
33 33
diff --git a/drivers/media/video/pwc/pwc-timon.h b/drivers/media/video/pwc/pwc-timon.h
index a6e22224c95f..270c5b9010f6 100644
--- a/drivers/media/video/pwc/pwc-timon.h
+++ b/drivers/media/video/pwc/pwc-timon.h
@@ -42,7 +42,7 @@
42#ifndef PWC_TIMON_H 42#ifndef PWC_TIMON_H
43#define PWC_TIMON_H 43#define PWC_TIMON_H
44 44
45#include <media/pwc-ioctl.h> 45#include "pwc.h"
46 46
47#define PWC_FPS_MAX_TIMON 6 47#define PWC_FPS_MAX_TIMON 6
48 48
diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c
index c4dc820b9dd7..87457b53f495 100644
--- a/drivers/media/video/pwc/pwc-v4l.c
+++ b/drivers/media/video/pwc/pwc-v4l.c
@@ -1122,14 +1122,6 @@ static int pwc_log_status(struct file *file, void *priv)
1122 return 0; 1122 return 0;
1123} 1123}
1124 1124
1125static long pwc_default(struct file *file, void *fh, bool valid_prio,
1126 int cmd, void *arg)
1127{
1128 struct pwc_device *pdev = video_drvdata(file);
1129
1130 return pwc_ioctl(pdev, cmd, arg);
1131}
1132
1133const struct v4l2_ioctl_ops pwc_ioctl_ops = { 1125const struct v4l2_ioctl_ops pwc_ioctl_ops = {
1134 .vidioc_querycap = pwc_querycap, 1126 .vidioc_querycap = pwc_querycap,
1135 .vidioc_enum_input = pwc_enum_input, 1127 .vidioc_enum_input = pwc_enum_input,
@@ -1148,8 +1140,4 @@ const struct v4l2_ioctl_ops pwc_ioctl_ops = {
1148 .vidioc_log_status = pwc_log_status, 1140 .vidioc_log_status = pwc_log_status,
1149 .vidioc_enum_framesizes = pwc_enum_framesizes, 1141 .vidioc_enum_framesizes = pwc_enum_framesizes,
1150 .vidioc_enum_frameintervals = pwc_enum_frameintervals, 1142 .vidioc_enum_frameintervals = pwc_enum_frameintervals,
1151 .vidioc_default = pwc_default,
1152}; 1143};
1153
1154
1155/* vim: set cino= formatoptions=croql cindent shiftwidth=8 tabstop=8: */
diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h
index ae0b7bf12e07..19c692c186fe 100644
--- a/drivers/media/video/pwc/pwc.h
+++ b/drivers/media/video/pwc/pwc.h
@@ -45,8 +45,6 @@
45#include <linux/input.h> 45#include <linux/input.h>
46#endif 46#endif
47 47
48#include <media/pwc-ioctl.h>
49
50/* Version block */ 48/* Version block */
51#define PWC_VERSION "10.0.15" 49#define PWC_VERSION "10.0.15"
52#define PWC_NAME "pwc" 50#define PWC_NAME "pwc"
@@ -189,6 +187,30 @@
189#define PT_RESET_CONTROL_FORMATTER 0x02 187#define PT_RESET_CONTROL_FORMATTER 0x02
190#define PT_STATUS_FORMATTER 0x03 188#define PT_STATUS_FORMATTER 0x03
191 189
190/* Enumeration of image sizes */
191#define PSZ_SQCIF 0x00
192#define PSZ_QSIF 0x01
193#define PSZ_QCIF 0x02
194#define PSZ_SIF 0x03
195#define PSZ_CIF 0x04
196#define PSZ_VGA 0x05
197#define PSZ_MAX 6
198
199struct pwc_raw_frame {
200 __le16 type; /* type of the webcam */
201 __le16 vbandlength; /* Size of 4 lines compressed (used by the
202 decompressor) */
203 __u8 cmd[4]; /* the four byte of the command (in case of
204 nala, only the first 3 bytes is filled) */
205 __u8 rawframe[0]; /* frame_size = H / 4 * vbandlength */
206} __packed;
207
208/* structure for transferring x & y coordinates */
209struct pwc_coord {
210 int x, y; /* guess what */
211 int size; /* size, or offset */
212};
213
192/* intermediate buffers with raw data from the USB cam */ 214/* intermediate buffers with raw data from the USB cam */
193struct pwc_frame_buf 215struct pwc_frame_buf
194{ 216{
@@ -269,11 +291,6 @@ struct pwc_device
269 struct pwc_coord image, view; /* image and viewport size */ 291 struct pwc_coord image, view; /* image and viewport size */
270 struct pwc_coord offset; /* offset of the viewport */ 292 struct pwc_coord offset; /* offset of the viewport */
271 293
272 /*** motorized pan/tilt feature */
273 struct pwc_mpt_range angle_range;
274 int pan_angle; /* in degrees * 100 */
275 int tilt_angle; /* absolute angle; 0,0 is home */
276
277#ifdef CONFIG_USB_PWC_INPUT_EVDEV 294#ifdef CONFIG_USB_PWC_INPUT_EVDEV
278 struct input_dev *button_dev; /* webcam snapshot button input */ 295 struct input_dev *button_dev; /* webcam snapshot button input */
279 char button_phys[64]; 296 char button_phys[64];
@@ -357,8 +374,6 @@ void pwc_construct(struct pwc_device *pdev);
357extern int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, 374extern int pwc_set_video_mode(struct pwc_device *pdev, int width, int height,
358 int frames, int compression); 375 int frames, int compression);
359extern unsigned int pwc_get_fps(struct pwc_device *pdev, unsigned int index, unsigned int size); 376extern unsigned int pwc_get_fps(struct pwc_device *pdev, unsigned int index, unsigned int size);
360extern int pwc_mpt_reset(struct pwc_device *pdev, int flags);
361extern int pwc_mpt_set_angle(struct pwc_device *pdev, int pan, int tilt);
362extern int pwc_set_leds(struct pwc_device *pdev, int on_value, int off_value); 377extern int pwc_set_leds(struct pwc_device *pdev, int on_value, int off_value);
363extern int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor); 378extern int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor);
364extern int send_control_msg(struct pwc_device *pdev, 379extern int send_control_msg(struct pwc_device *pdev,
@@ -377,9 +392,6 @@ int pwc_init_controls(struct pwc_device *pdev);
377/* Power down or up the camera; not supported by all models */ 392/* Power down or up the camera; not supported by all models */
378extern void pwc_camera_power(struct pwc_device *pdev, int power); 393extern void pwc_camera_power(struct pwc_device *pdev, int power);
379 394
380/* Private ioctl()s; see pwc-ioctl.h */
381extern long pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg);
382
383extern const struct v4l2_ioctl_ops pwc_ioctl_ops; 395extern const struct v4l2_ioctl_ops pwc_ioctl_ops;
384 396
385/** pwc-uncompress.c */ 397/** pwc-uncompress.c */
diff --git a/include/media/pwc-ioctl.h b/include/media/pwc-ioctl.h
deleted file mode 100644
index 1ed1e616fe33..000000000000
--- a/include/media/pwc-ioctl.h
+++ /dev/null
@@ -1,323 +0,0 @@
1#ifndef PWC_IOCTL_H
2#define PWC_IOCTL_H
3
4/* (C) 2001-2004 Nemosoft Unv.
5 (C) 2004-2006 Luc Saillard (luc@saillard.org)
6
7 NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx
8 driver and thus may have bugs that are not present in the original version.
9 Please send bug reports and support requests to <luc@saillard.org>.
10 The decompression routines have been implemented by reverse-engineering the
11 Nemosoft binary pwcx module. Caveat emptor.
12
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26*/
27
28/* This is pwc-ioctl.h belonging to PWC 10.0.10
29 It contains structures and defines to communicate from user space
30 directly to the driver.
31 */
32
33/*
34 Changes
35 2001/08/03 Alvarado Added ioctl constants to access methods for
36 changing white balance and red/blue gains
37 2002/12/15 G. H. Fernandez-Toribio VIDIOCGREALSIZE
38 2003/12/13 Nemosft Unv. Some modifications to make interfacing to
39 PWCX easier
40 2006/01/01 Luc Saillard Add raw format definition
41 */
42
43/* These are private ioctl() commands, specific for the Philips webcams.
44 They contain functions not found in other webcams, and settings not
45 specified in the Video4Linux API.
46
47 The #define names are built up like follows:
48 VIDIOC VIDeo IOCtl prefix
49 PWC Philps WebCam
50 G optional: Get
51 S optional: Set
52 ... the function
53 */
54
55#include <linux/types.h>
56
57/* Enumeration of image sizes */
58#define PSZ_SQCIF 0x00
59#define PSZ_QSIF 0x01
60#define PSZ_QCIF 0x02
61#define PSZ_SIF 0x03
62#define PSZ_CIF 0x04
63#define PSZ_VGA 0x05
64#define PSZ_MAX 6
65
66
67/* The frame rate is encoded in the video_window.flags parameter using
68 the upper 16 bits, since some flags are defined nowadays. The following
69 defines provide a mask and shift to filter out this value.
70 This value can also be passing using the private flag when using v4l2 and
71 VIDIOC_S_FMT ioctl.
72
73 In 'Snapshot' mode the camera freezes its automatic exposure and colour
74 balance controls.
75 */
76#define PWC_FPS_SHIFT 16
77#define PWC_FPS_MASK 0x00FF0000
78#define PWC_FPS_FRMASK 0x003F0000
79#define PWC_FPS_SNAPSHOT 0x00400000
80#define PWC_QLT_MASK 0x03000000
81#define PWC_QLT_SHIFT 24
82
83
84/* structure for transferring x & y coordinates */
85struct pwc_coord
86{
87 int x, y; /* guess what */
88 int size; /* size, or offset */
89};
90
91
92/* Used with VIDIOCPWCPROBE */
93struct pwc_probe
94{
95 char name[32];
96 int type;
97};
98
99struct pwc_serial
100{
101 char serial[30]; /* String with serial number. Contains terminating 0 */
102};
103
104/* pwc_whitebalance.mode values */
105#define PWC_WB_INDOOR 0
106#define PWC_WB_OUTDOOR 1
107#define PWC_WB_FL 2
108#define PWC_WB_MANUAL 3
109#define PWC_WB_AUTO 4
110
111/* Used with VIDIOCPWC[SG]AWB (Auto White Balance).
112 Set mode to one of the PWC_WB_* values above.
113 *red and *blue are the respective gains of these colour components inside
114 the camera; range 0..65535
115 When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read;
116 otherwise undefined.
117 'read_red' and 'read_blue' are read-only.
118*/
119struct pwc_whitebalance
120{
121 int mode;
122 int manual_red, manual_blue; /* R/W */
123 int read_red, read_blue; /* R/O */
124};
125
126/*
127 'control_speed' and 'control_delay' are used in automatic whitebalance mode,
128 and tell the camera how fast it should react to changes in lighting, and
129 with how much delay. Valid values are 0..65535.
130*/
131struct pwc_wb_speed
132{
133 int control_speed;
134 int control_delay;
135
136};
137
138/* Used with VIDIOCPWC[SG]LED */
139struct pwc_leds
140{
141 int led_on; /* Led on-time; range = 0..25000 */
142 int led_off; /* Led off-time; range = 0..25000 */
143};
144
145/* Image size (used with GREALSIZE) */
146struct pwc_imagesize
147{
148 int width;
149 int height;
150};
151
152/* Defines and structures for Motorized Pan & Tilt */
153#define PWC_MPT_PAN 0x01
154#define PWC_MPT_TILT 0x02
155#define PWC_MPT_TIMEOUT 0x04 /* for status */
156
157/* Set angles; when absolute != 0, the angle is absolute and the
158 driver calculates the relative offset for you. This can only
159 be used with VIDIOCPWCSANGLE; VIDIOCPWCGANGLE always returns
160 absolute angles.
161 */
162struct pwc_mpt_angles
163{
164 int absolute; /* write-only */
165 int pan; /* degrees * 100 */
166 int tilt; /* degress * 100 */
167};
168
169/* Range of angles of the camera, both horizontally and vertically.
170 */
171struct pwc_mpt_range
172{
173 int pan_min, pan_max; /* degrees * 100 */
174 int tilt_min, tilt_max;
175};
176
177struct pwc_mpt_status
178{
179 int status;
180 int time_pan;
181 int time_tilt;
182};
183
184
185/* This is used for out-of-kernel decompression. With it, you can get
186 all the necessary information to initialize and use the decompressor
187 routines in standalone applications.
188 */
189struct pwc_video_command
190{
191 int type; /* camera type (645, 675, 730, etc.) */
192 int release; /* release number */
193
194 int size; /* one of PSZ_* */
195 int alternate;
196 int command_len; /* length of USB video command */
197 unsigned char command_buf[13]; /* Actual USB video command */
198 int bandlength; /* >0 = compressed */
199 int frame_size; /* Size of one (un)compressed frame */
200};
201
202/* Flags for PWCX subroutines. Not all modules honour all flags. */
203#define PWCX_FLAG_PLANAR 0x0001
204#define PWCX_FLAG_BAYER 0x0008
205
206
207/* IOCTL definitions */
208
209 /* Restore user settings */
210#define VIDIOCPWCRUSER _IO('v', 192)
211 /* Save user settings */
212#define VIDIOCPWCSUSER _IO('v', 193)
213 /* Restore factory settings */
214#define VIDIOCPWCFACTORY _IO('v', 194)
215
216 /* You can manipulate the compression factor. A compression preference of 0
217 means use uncompressed modes when available; 1 is low compression, 2 is
218 medium and 3 is high compression preferred. Of course, the higher the
219 compression, the lower the bandwidth used but more chance of artefacts
220 in the image. The driver automatically chooses a higher compression when
221 the preferred mode is not available.
222 */
223 /* Set preferred compression quality (0 = uncompressed, 3 = highest compression) */
224#define VIDIOCPWCSCQUAL _IOW('v', 195, int)
225 /* Get preferred compression quality */
226#define VIDIOCPWCGCQUAL _IOR('v', 195, int)
227
228
229/* Retrieve serial number of camera */
230#define VIDIOCPWCGSERIAL _IOR('v', 198, struct pwc_serial)
231
232 /* This is a probe function; since so many devices are supported, it
233 becomes difficult to include all the names in programs that want to
234 check for the enhanced Philips stuff. So in stead, try this PROBE;
235 it returns a structure with the original name, and the corresponding
236 Philips type.
237 To use, fill the structure with zeroes, call PROBE and if that succeeds,
238 compare the name with that returned from VIDIOCGCAP; they should be the
239 same. If so, you can be assured it is a Philips (OEM) cam and the type
240 is valid.
241 */
242#define VIDIOCPWCPROBE _IOR('v', 199, struct pwc_probe)
243
244 /* Set AGC (Automatic Gain Control); int < 0 = auto, 0..65535 = fixed */
245#define VIDIOCPWCSAGC _IOW('v', 200, int)
246 /* Get AGC; int < 0 = auto; >= 0 = fixed, range 0..65535 */
247#define VIDIOCPWCGAGC _IOR('v', 200, int)
248 /* Set shutter speed; int < 0 = auto; >= 0 = fixed, range 0..65535 */
249#define VIDIOCPWCSSHUTTER _IOW('v', 201, int)
250
251 /* Color compensation (Auto White Balance) */
252#define VIDIOCPWCSAWB _IOW('v', 202, struct pwc_whitebalance)
253#define VIDIOCPWCGAWB _IOR('v', 202, struct pwc_whitebalance)
254
255 /* Auto WB speed */
256#define VIDIOCPWCSAWBSPEED _IOW('v', 203, struct pwc_wb_speed)
257#define VIDIOCPWCGAWBSPEED _IOR('v', 203, struct pwc_wb_speed)
258
259 /* LEDs on/off/blink; int range 0..65535 */
260#define VIDIOCPWCSLED _IOW('v', 205, struct pwc_leds)
261#define VIDIOCPWCGLED _IOR('v', 205, struct pwc_leds)
262
263 /* Contour (sharpness); int < 0 = auto, 0..65536 = fixed */
264#define VIDIOCPWCSCONTOUR _IOW('v', 206, int)
265#define VIDIOCPWCGCONTOUR _IOR('v', 206, int)
266
267 /* Backlight compensation; 0 = off, otherwise on */
268#define VIDIOCPWCSBACKLIGHT _IOW('v', 207, int)
269#define VIDIOCPWCGBACKLIGHT _IOR('v', 207, int)
270
271 /* Flickerless mode; = 0 off, otherwise on */
272#define VIDIOCPWCSFLICKER _IOW('v', 208, int)
273#define VIDIOCPWCGFLICKER _IOR('v', 208, int)
274
275 /* Dynamic noise reduction; 0 off, 3 = high noise reduction */
276#define VIDIOCPWCSDYNNOISE _IOW('v', 209, int)
277#define VIDIOCPWCGDYNNOISE _IOR('v', 209, int)
278
279 /* Real image size as used by the camera; tells you whether or not there's a gray border around the image */
280#define VIDIOCPWCGREALSIZE _IOR('v', 210, struct pwc_imagesize)
281
282 /* Motorized pan & tilt functions */
283#define VIDIOCPWCMPTRESET _IOW('v', 211, int)
284#define VIDIOCPWCMPTGRANGE _IOR('v', 211, struct pwc_mpt_range)
285#define VIDIOCPWCMPTSANGLE _IOW('v', 212, struct pwc_mpt_angles)
286#define VIDIOCPWCMPTGANGLE _IOR('v', 212, struct pwc_mpt_angles)
287#define VIDIOCPWCMPTSTATUS _IOR('v', 213, struct pwc_mpt_status)
288
289 /* Get the USB set-video command; needed for initializing libpwcx */
290#define VIDIOCPWCGVIDCMD _IOR('v', 215, struct pwc_video_command)
291struct pwc_table_init_buffer {
292 int len;
293 char *buffer;
294
295};
296#define VIDIOCPWCGVIDTABLE _IOR('v', 216, struct pwc_table_init_buffer)
297
298/*
299 * This is private command used when communicating with v4l2.
300 * In the future all private ioctl will be remove/replace to
301 * use interface offer by v4l2.
302 */
303
304#define V4L2_CID_PRIVATE_SAVE_USER (V4L2_CID_PRIVATE_BASE + 0)
305#define V4L2_CID_PRIVATE_RESTORE_USER (V4L2_CID_PRIVATE_BASE + 1)
306#define V4L2_CID_PRIVATE_RESTORE_FACTORY (V4L2_CID_PRIVATE_BASE + 2)
307#define V4L2_CID_PRIVATE_COLOUR_MODE (V4L2_CID_PRIVATE_BASE + 3)
308#define V4L2_CID_PRIVATE_AUTOCONTOUR (V4L2_CID_PRIVATE_BASE + 4)
309#define V4L2_CID_PRIVATE_CONTOUR (V4L2_CID_PRIVATE_BASE + 5)
310#define V4L2_CID_PRIVATE_BACKLIGHT (V4L2_CID_PRIVATE_BASE + 6)
311#define V4L2_CID_PRIVATE_FLICKERLESS (V4L2_CID_PRIVATE_BASE + 7)
312#define V4L2_CID_PRIVATE_NOISE_REDUCTION (V4L2_CID_PRIVATE_BASE + 8)
313
314struct pwc_raw_frame {
315 __le16 type; /* type of the webcam */
316 __le16 vbandlength; /* Size of 4lines compressed (used by the decompressor) */
317 __u8 cmd[4]; /* the four byte of the command (in case of nala,
318 only the first 3 bytes is filled) */
319 __u8 rawframe[0]; /* frame_size = H/4*vbandlength */
320} __attribute__ ((packed));
321
322
323#endif