summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2013-04-13 12:14:06 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-04-16 17:08:44 -0400
commit7704cfb9cde649d514029a180cdfb7ccf0a36032 (patch)
tree2994621ff4e93929a359144555be515b300f3a64 /drivers/media
parent988f7b80ab6e541aef5972d347d6cc7d905abd21 (diff)
[media] cx25821: remove custom ioctls that duplicate v4l2 ioctls
No idea why these custom ioctls exist: they have perfectly normal v4l2 counterparts which are already implemented. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/pci/cx25821/cx25821-video.c128
-rw-r--r--drivers/media/pci/cx25821/cx25821-video.h8
-rw-r--r--drivers/media/pci/cx25821/cx25821.h13
3 files changed, 6 insertions, 143 deletions
diff --git a/drivers/media/pci/cx25821/cx25821-video.c b/drivers/media/pci/cx25821/cx25821-video.c
index aec6fdfe944d..d3aa166740cd 100644
--- a/drivers/media/pci/cx25821/cx25821-video.c
+++ b/drivers/media/pci/cx25821/cx25821-video.c
@@ -1038,134 +1038,18 @@ static long video_ioctl_upstream11(struct file *file, unsigned int cmd,
1038 return 0; 1038 return 0;
1039} 1039}
1040 1040
1041static long video_ioctl_set(struct file *file, unsigned int cmd,
1042 unsigned long arg)
1043{
1044 struct cx25821_channel *chan = video_drvdata(file);
1045 struct cx25821_dev *dev = chan->dev;
1046 struct downstream_user_struct *data_from_user;
1047 int command;
1048 int width = 720;
1049 int selected_channel = 0;
1050 int pix_format = 0;
1051 int i = 0;
1052 int cif_enable = 0;
1053 int cif_width = 0;
1054
1055 data_from_user = (struct downstream_user_struct *)arg;
1056
1057 if (!data_from_user) {
1058 pr_err("%s(): User data is INVALID. Returning\n", __func__);
1059 return 0;
1060 }
1061
1062 command = data_from_user->command;
1063
1064 if (command != SET_VIDEO_STD && command != SET_PIXEL_FORMAT
1065 && command != ENABLE_CIF_RESOLUTION && command != REG_READ
1066 && command != REG_WRITE && command != MEDUSA_READ
1067 && command != MEDUSA_WRITE) {
1068 return 0;
1069 }
1070
1071 switch (command) {
1072 case SET_VIDEO_STD:
1073 if (!strcmp(data_from_user->vid_stdname, "PAL"))
1074 dev->tvnorm = V4L2_STD_PAL_BG;
1075 else
1076 dev->tvnorm = V4L2_STD_NTSC_M;
1077 medusa_set_videostandard(dev);
1078 break;
1079
1080 case SET_PIXEL_FORMAT:
1081 selected_channel = data_from_user->decoder_select;
1082 pix_format = data_from_user->pixel_format;
1083
1084 if (!(selected_channel <= 7 && selected_channel >= 0)) {
1085 selected_channel -= 4;
1086 selected_channel = selected_channel % 8;
1087 }
1088
1089 if (selected_channel >= 0)
1090 cx25821_set_pixel_format(dev, selected_channel,
1091 pix_format);
1092
1093 break;
1094
1095 case ENABLE_CIF_RESOLUTION:
1096 selected_channel = data_from_user->decoder_select;
1097 cif_enable = data_from_user->cif_resolution_enable;
1098 cif_width = data_from_user->cif_width;
1099
1100 if (cif_enable) {
1101 if (dev->tvnorm & V4L2_STD_PAL_BG
1102 || dev->tvnorm & V4L2_STD_PAL_DK) {
1103 width = 352;
1104 } else {
1105 width = cif_width;
1106 if (cif_width != 320 && cif_width != 352)
1107 width = 320;
1108 }
1109 }
1110
1111 if (!(selected_channel <= 7 && selected_channel >= 0)) {
1112 selected_channel -= 4;
1113 selected_channel = selected_channel % 8;
1114 }
1115
1116 if (selected_channel <= 7 && selected_channel >= 0) {
1117 dev->channels[selected_channel].use_cif_resolution =
1118 cif_enable;
1119 dev->channels[selected_channel].cif_width = width;
1120 } else {
1121 for (i = 0; i < VID_CHANNEL_NUM; i++) {
1122 dev->channels[i].use_cif_resolution =
1123 cif_enable;
1124 dev->channels[i].cif_width = width;
1125 }
1126 }
1127
1128 medusa_set_resolution(dev, width, selected_channel);
1129 break;
1130 case REG_READ:
1131 data_from_user->reg_data = cx_read(data_from_user->reg_address);
1132 break;
1133 case REG_WRITE:
1134 cx_write(data_from_user->reg_address, data_from_user->reg_data);
1135 break;
1136 case MEDUSA_READ:
1137 cx25821_i2c_read(&dev->i2c_bus[0],
1138 (u16) data_from_user->reg_address,
1139 &data_from_user->reg_data);
1140 break;
1141 case MEDUSA_WRITE:
1142 cx25821_i2c_write(&dev->i2c_bus[0],
1143 (u16) data_from_user->reg_address,
1144 data_from_user->reg_data);
1145 break;
1146 }
1147
1148 return 0;
1149}
1150
1151static long cx25821_video_ioctl(struct file *file, 1041static long cx25821_video_ioctl(struct file *file,
1152 unsigned int cmd, unsigned long arg) 1042 unsigned int cmd, unsigned long arg)
1153{ 1043{
1154 struct cx25821_channel *chan = video_drvdata(file); 1044 struct cx25821_channel *chan = video_drvdata(file);
1155 int ret = 0;
1156 1045
1157 /* check to see if it's the video upstream */ 1046 /* check to see if it's the video upstream */
1158 if (chan->id == SRAM_CH09) { 1047 if (chan->id == SRAM_CH09)
1159 ret = video_ioctl_upstream9(file, cmd, arg); 1048 return video_ioctl_upstream9(file, cmd, arg);
1160 return ret; 1049 if (chan->id == SRAM_CH10)
1161 } else if (chan->id == SRAM_CH10) { 1050 return video_ioctl_upstream10(file, cmd, arg);
1162 ret = video_ioctl_upstream10(file, cmd, arg); 1051 if (chan->id == SRAM_CH11)
1163 return ret; 1052 return video_ioctl_upstream11(file, cmd, arg);
1164 } else if (chan->id == SRAM_CH11) {
1165 ret = video_ioctl_upstream11(file, cmd, arg);
1166 ret = video_ioctl_set(file, cmd, arg);
1167 return ret;
1168 }
1169 1053
1170 return video_ioctl2(file, cmd, arg); 1054 return video_ioctl2(file, cmd, arg);
1171} 1055}
diff --git a/drivers/media/pci/cx25821/cx25821-video.h b/drivers/media/pci/cx25821/cx25821-video.h
index eb54e5347cc4..8871c4e737e8 100644
--- a/drivers/media/pci/cx25821/cx25821-video.h
+++ b/drivers/media/pci/cx25821/cx25821-video.h
@@ -55,14 +55,6 @@ do { \
55#define UPSTREAM_START_AUDIO 702 55#define UPSTREAM_START_AUDIO 702
56#define UPSTREAM_STOP_AUDIO 703 56#define UPSTREAM_STOP_AUDIO 703
57#define UPSTREAM_DUMP_REGISTERS 702 57#define UPSTREAM_DUMP_REGISTERS 702
58#define SET_VIDEO_STD 800
59#define SET_PIXEL_FORMAT 1000
60#define ENABLE_CIF_RESOLUTION 1001
61
62#define REG_READ 900
63#define REG_WRITE 901
64#define MEDUSA_READ 910
65#define MEDUSA_WRITE 911
66 58
67#define FORMAT_FLAGS_PACKED 0x01 59#define FORMAT_FLAGS_PACKED 0x01
68extern void cx25821_video_wakeup(struct cx25821_dev *dev, 60extern void cx25821_video_wakeup(struct cx25821_dev *dev,
diff --git a/drivers/media/pci/cx25821/cx25821.h b/drivers/media/pci/cx25821/cx25821.h
index 40b16b01349b..cfda5ac4faaa 100644
--- a/drivers/media/pci/cx25821/cx25821.h
+++ b/drivers/media/pci/cx25821/cx25821.h
@@ -360,19 +360,6 @@ struct upstream_user_struct {
360 int command; 360 int command;
361}; 361};
362 362
363struct downstream_user_struct {
364 char *vid_stdname;
365 int pixel_format;
366 int cif_resolution_enable;
367 int cif_width;
368 int decoder_select;
369 int command;
370 int reg_address;
371 int reg_data;
372};
373
374extern struct upstream_user_struct *up_data;
375
376static inline struct cx25821_dev *get_cx25821(struct v4l2_device *v4l2_dev) 363static inline struct cx25821_dev *get_cx25821(struct v4l2_device *v4l2_dev)
377{ 364{
378 return container_of(v4l2_dev, struct cx25821_dev, v4l2_dev); 365 return container_of(v4l2_dev, struct cx25821_dev, v4l2_dev);