aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/em28xx
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2006-03-13 11:31:31 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-21 11:53:40 -0500
commitf5762e441d5022ecc5b66b5fe54e41e2ac5d02be (patch)
tree6afff3bc33f4d8a2dca15a681902316d230eb811 /drivers/media/video/em28xx
parentc04e89b1f2c624fbb1e57874062491c2b987c7e2 (diff)
V4L/DVB (3513): Remove saa711x driver
Now, em28xx uses saa7115 instead of saa711x. saa7115 driver is capable of handling saa 7113, 7114 and 7115. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/em28xx')
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c218
1 files changed, 14 insertions, 204 deletions
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 78f0f7a706ea..780342f7b239 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -101,23 +101,6 @@ static struct em28xx_tvnorm tvnorms[] = {
101 } 101 }
102}; 102};
103 103
104static const unsigned char saa7114_i2c_init[] = {
105 0x00,0x00,0x01,0x08,0x02,0xc4,0x03,0x30,0x04,0x90,0x05,0x90,0x06,0xeb,0x07,0xe0,
106 0x08,0x88,0x09,0x40,0x0a,0x80,0x0b,0x44,0x0c,0x40,0x0d,0x00,0x0e,0x81,0x0f,0x2a,
107 0x10,0x06,0x11,0x00,0x12,0xc8,0x13,0x80,0x14,0x00,0x15,0x11,0x16,0x01,0x17,0x42,
108 0x18,0x40,0x19,0x80,0x40,0x00,0x41,0xff,0x42,0xff,0x43,0xff,0x44,0xff,0x45,0xff,
109 0x46,0xff,0x47,0xff,0x48,0xff,0x49,0xff,0x4a,0xff,0x4b,0xff,0x4c,0xff,0x4d,0xff,
110 0x4e,0xff,0x4f,0xff,0x50,0xff,0x51,0xff,0x52,0xff,0x53,0xff,0x54,0x5f,0x55,0xff,
111 0x56,0xff,0x57,0xff,0x58,0x00,0x59,0x47,0x5a,0x03,0x5b,0x03,0x5d,0x3e,0x5e,0x00,
112 0x80,0x1c,0x83,0x01,0x84,0xa5,0x85,0x10,0x86,0x45,0x87,0x41,0x88,0xf0,0x88,0x00,
113 0x88,0xf0,0x90,0x00,0x91,0x08,0x92,0x00,0x93,0x80,0x94,0x08,0x95,0x00,0x96,0xc0,
114 0x97,0x02,0x98,0x13,0x99,0x00,0x9a,0x38,0x9b,0x01,0x9c,0x80,0x9d,0x02,0x9e,0x06,
115 0x9f,0x01,0xa0,0x01,0xa1,0x00,0xa2,0x00,0xa4,0x80,0xa5,0x36,0xa6,0x36,0xa8,0x67,
116 0xa9,0x04,0xaa,0x00,0xac,0x33,0xad,0x02,0xae,0x00,0xb0,0xcd,0xb1,0x04,0xb2,0xcd,
117 0xb3,0x04,0xb4,0x01,0xb8,0x00,0xb9,0x00,0xba,0x00,0xbb,0x00,0xbc,0x00,0xbd,0x00,
118 0xbe,0x00,0xbf,0x00
119};
120
121#define TVNORMS ARRAY_SIZE(tvnorms) 104#define TVNORMS ARRAY_SIZE(tvnorms)
122 105
123/* supported controls */ 106/* supported controls */
@@ -144,65 +127,6 @@ static struct v4l2_queryctrl em28xx_qctrl[] = {
144 } 127 }
145}; 128};
146 129
147/* FIXME: These are specific to saa711x - should be moved to its code */
148static struct v4l2_queryctrl saa711x_qctrl[] = {
149 {
150 .id = V4L2_CID_BRIGHTNESS,
151 .type = V4L2_CTRL_TYPE_INTEGER,
152 .name = "Brightness",
153 .minimum = -128,
154 .maximum = 127,
155 .step = 1,
156 .default_value = 0,
157 .flags = 0,
158 },{
159 .id = V4L2_CID_CONTRAST,
160 .type = V4L2_CTRL_TYPE_INTEGER,
161 .name = "Contrast",
162 .minimum = 0x0,
163 .maximum = 0x1f,
164 .step = 0x1,
165 .default_value = 0x10,
166 .flags = 0,
167 },{
168 .id = V4L2_CID_SATURATION,
169 .type = V4L2_CTRL_TYPE_INTEGER,
170 .name = "Saturation",
171 .minimum = 0x0,
172 .maximum = 0x1f,
173 .step = 0x1,
174 .default_value = 0x10,
175 .flags = 0,
176 },{
177 .id = V4L2_CID_RED_BALANCE,
178 .type = V4L2_CTRL_TYPE_INTEGER,
179 .name = "Red chroma balance",
180 .minimum = -128,
181 .maximum = 127,
182 .step = 1,
183 .default_value = 0,
184 .flags = 0,
185 },{
186 .id = V4L2_CID_BLUE_BALANCE,
187 .type = V4L2_CTRL_TYPE_INTEGER,
188 .name = "Blue chroma balance",
189 .minimum = -128,
190 .maximum = 127,
191 .step = 1,
192 .default_value = 0,
193 .flags = 0,
194 },{
195 .id = V4L2_CID_GAMMA,
196 .type = V4L2_CTRL_TYPE_INTEGER,
197 .name = "Gamma",
198 .minimum = 0x0,
199 .maximum = 0x3f,
200 .step = 0x1,
201 .default_value = 0x20,
202 .flags = 0,
203 }
204};
205
206static struct usb_driver em28xx_usb_driver; 130static struct usb_driver em28xx_usb_driver;
207 131
208static DEFINE_MUTEX(em28xx_sysfs_lock); 132static DEFINE_MUTEX(em28xx_sysfs_lock);
@@ -245,22 +169,9 @@ static int em28xx_config(struct em28xx *dev)
245static void em28xx_config_i2c(struct em28xx *dev) 169static void em28xx_config_i2c(struct em28xx *dev)
246{ 170{
247 struct v4l2_frequency f; 171 struct v4l2_frequency f;
248 struct video_decoder_init em28xx_vdi = {.data = NULL }; 172 em28xx_i2c_call_clients(dev, VIDIOC_INT_RESET, NULL);
249 173 em28xx_i2c_call_clients(dev, VIDIOC_S_INPUT, &dev->ctl_input);
250 174 em28xx_i2c_call_clients(dev, VIDIOC_STREAMON, NULL);
251 /* configure decoder */
252 if(dev->model == EM2820_BOARD_MSI_VOX_USB_2){
253 em28xx_vdi.data=saa7114_i2c_init;
254 em28xx_vdi.len=sizeof(saa7114_i2c_init);
255 }
256
257
258 em28xx_i2c_call_clients(dev, DECODER_INIT, &em28xx_vdi);
259 em28xx_i2c_call_clients(dev, DECODER_SET_INPUT, &dev->ctl_input);
260/* em28xx_i2c_call_clients(dev,DECODER_SET_PICTURE, &dev->vpic); */
261/* em28xx_i2c_call_clients(dev,DECODER_SET_NORM,&dev->tvnorm->id); */
262/* em28xx_i2c_call_clients(dev,DECODER_ENABLE_OUTPUT,&output); */
263/* em28xx_i2c_call_clients(dev,DECODER_DUMP, NULL); */
264 175
265 /* configure tuner */ 176 /* configure tuner */
266 f.tuner = 0; 177 f.tuner = 0;
@@ -300,8 +211,7 @@ static void video_mux(struct em28xx *dev, int index)
300 dev->ctl_input = index; 211 dev->ctl_input = index;
301 dev->ctl_ainput = INPUT(index)->amux; 212 dev->ctl_ainput = INPUT(index)->amux;
302 213
303 em28xx_i2c_call_clients(dev, DECODER_SET_INPUT, &input); 214 em28xx_i2c_call_clients(dev, VIDIOC_S_INPUT, &input);
304
305 215
306 em28xx_videodbg("Setting input index=%d, vmux=%d, amux=%d\n",index,input,dev->ctl_ainput); 216 em28xx_videodbg("Setting input index=%d, vmux=%d, amux=%d\n",index,input,dev->ctl_ainput);
307 217
@@ -747,43 +657,6 @@ static int em28xx_get_ctrl(struct em28xx *dev, struct v4l2_control *ctrl)
747 } 657 }
748} 658}
749 659
750/*FIXME: should be moved to saa711x */
751static int saa711x_get_ctrl(struct em28xx *dev, struct v4l2_control *ctrl)
752{
753 s32 tmp;
754 switch (ctrl->id) {
755 case V4L2_CID_BRIGHTNESS:
756 if ((tmp = em28xx_brightness_get(dev)) < 0)
757 return -EIO;
758 ctrl->value = (s32) ((s8) tmp); /* FIXME: clenaer way to extend sign? */
759 return 0;
760 case V4L2_CID_CONTRAST:
761 if ((ctrl->value = em28xx_contrast_get(dev)) < 0)
762 return -EIO;
763 return 0;
764 case V4L2_CID_SATURATION:
765 if ((ctrl->value = em28xx_saturation_get(dev)) < 0)
766 return -EIO;
767 return 0;
768 case V4L2_CID_RED_BALANCE:
769 if ((tmp = em28xx_v_balance_get(dev)) < 0)
770 return -EIO;
771 ctrl->value = (s32) ((s8) tmp); /* FIXME: clenaer way to extend sign? */
772 return 0;
773 case V4L2_CID_BLUE_BALANCE:
774 if ((tmp = em28xx_u_balance_get(dev)) < 0)
775 return -EIO;
776 ctrl->value = (s32) ((s8) tmp); /* FIXME: clenaer way to extend sign? */
777 return 0;
778 case V4L2_CID_GAMMA:
779 if ((ctrl->value = em28xx_gamma_get(dev)) < 0)
780 return -EIO;
781 return 0;
782 default:
783 return -EINVAL;
784 }
785}
786
787/* 660/*
788 * em28xx_set_ctrl() 661 * em28xx_set_ctrl()
789 * mute or set new saturation, brightness or contrast 662 * mute or set new saturation, brightness or contrast
@@ -806,27 +679,6 @@ static int em28xx_set_ctrl(struct em28xx *dev, const struct v4l2_control *ctrl)
806 } 679 }
807} 680}
808 681
809/*FIXME: should be moved to saa711x */
810static int saa711x_set_ctrl(struct em28xx *dev, const struct v4l2_control *ctrl)
811{
812 switch (ctrl->id) {
813 case V4L2_CID_BRIGHTNESS:
814 return em28xx_brightness_set(dev, ctrl->value);
815 case V4L2_CID_CONTRAST:
816 return em28xx_contrast_set(dev, ctrl->value);
817 case V4L2_CID_SATURATION:
818 return em28xx_saturation_set(dev, ctrl->value);
819 case V4L2_CID_RED_BALANCE:
820 return em28xx_v_balance_set(dev, ctrl->value);
821 case V4L2_CID_BLUE_BALANCE:
822 return em28xx_u_balance_set(dev, ctrl->value);
823 case V4L2_CID_GAMMA:
824 return em28xx_gamma_set(dev, ctrl->value);
825 default:
826 return -EINVAL;
827 }
828}
829
830/* 682/*
831 * em28xx_stream_interrupt() 683 * em28xx_stream_interrupt()
832 * stops streaming 684 * stops streaming
@@ -1130,8 +982,6 @@ static int em28xx_do_ioctl(struct inode *inode, struct file *filp,
1130 982
1131 em28xx_set_norm(dev, dev->width, dev->height); 983 em28xx_set_norm(dev, dev->width, dev->height);
1132 984
1133 em28xx_i2c_call_clients(dev, DECODER_SET_NORM,
1134 &tvnorms[i].mode);
1135 em28xx_i2c_call_clients(dev, VIDIOC_S_STD, 985 em28xx_i2c_call_clients(dev, VIDIOC_S_STD,
1136 &dev->tvnorm->id); 986 &dev->tvnorm->id);
1137 987
@@ -1242,22 +1092,11 @@ static int em28xx_do_ioctl(struct inode *inode, struct file *filp,
1242 } 1092 }
1243 } 1093 }
1244 } 1094 }
1245 if (dev->decoder == EM28XX_TVP5150) { 1095 em28xx_i2c_call_clients(dev,cmd,qc);
1246 em28xx_i2c_call_clients(dev,cmd,qc); 1096 if (qc->type)
1247 if (qc->type) 1097 return 0;
1248 return 0; 1098 else
1249 else 1099 return -EINVAL;
1250 return -EINVAL;
1251 }
1252 for (i = 0; i < ARRAY_SIZE(saa711x_qctrl); i++) {
1253 if (qc->id && qc->id == saa711x_qctrl[i].id) {
1254 memcpy(qc, &(saa711x_qctrl[i]),
1255 sizeof(*qc));
1256 return 0;
1257 }
1258 }
1259
1260 return -EINVAL;
1261 } 1100 }
1262 case VIDIOC_G_CTRL: 1101 case VIDIOC_G_CTRL:
1263 { 1102 {
@@ -1267,12 +1106,8 @@ static int em28xx_do_ioctl(struct inode *inode, struct file *filp,
1267 if (!dev->has_msp34xx) 1106 if (!dev->has_msp34xx)
1268 retval=em28xx_get_ctrl(dev, ctrl); 1107 retval=em28xx_get_ctrl(dev, ctrl);
1269 if (retval==-EINVAL) { 1108 if (retval==-EINVAL) {
1270 if (dev->decoder == EM28XX_TVP5150) { 1109 em28xx_i2c_call_clients(dev,cmd,arg);
1271 em28xx_i2c_call_clients(dev,cmd,arg); 1110 return 0;
1272 return 0;
1273 }
1274
1275 return saa711x_get_ctrl(dev, ctrl);
1276 } else return retval; 1111 } else return retval;
1277 } 1112 }
1278 case VIDIOC_S_CTRL: 1113 case VIDIOC_S_CTRL:
@@ -1293,33 +1128,8 @@ static int em28xx_do_ioctl(struct inode *inode, struct file *filp,
1293 } 1128 }
1294 } 1129 }
1295 1130
1296 if (dev->decoder == EM28XX_TVP5150) { 1131 em28xx_i2c_call_clients(dev,cmd,arg);
1297 em28xx_i2c_call_clients(dev,cmd,arg); 1132 return 0;
1298 return 0;
1299 } else if (!dev->has_msp34xx) {
1300 for (i = 0; i < ARRAY_SIZE(em28xx_qctrl); i++) {
1301 if (ctrl->id == em28xx_qctrl[i].id) {
1302 if (ctrl->value <
1303 em28xx_qctrl[i].minimum
1304 || ctrl->value >
1305 em28xx_qctrl[i].maximum)
1306 return -ERANGE;
1307 return em28xx_set_ctrl(dev, ctrl);
1308 }
1309 }
1310 for (i = 0; i < ARRAY_SIZE(saa711x_qctrl); i++) {
1311 if (ctrl->id == saa711x_qctrl[i].id) {
1312 if (ctrl->value <
1313 saa711x_qctrl[i].minimum
1314 || ctrl->value >
1315 saa711x_qctrl[i].maximum)
1316 return -ERANGE;
1317 return saa711x_set_ctrl(dev, ctrl);
1318 }
1319 }
1320 }
1321
1322 return -EINVAL;
1323 } 1133 }
1324 /* --- tuner ioctls ------------------------------------------ */ 1134 /* --- tuner ioctls ------------------------------------------ */
1325 case VIDIOC_G_TUNER: 1135 case VIDIOC_G_TUNER:
@@ -1772,7 +1582,7 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
1772#ifdef CONFIG_MODULES 1582#ifdef CONFIG_MODULES
1773 /* request some modules */ 1583 /* request some modules */
1774 if (dev->decoder == EM28XX_SAA7113 || dev->decoder == EM28XX_SAA7114) 1584 if (dev->decoder == EM28XX_SAA7113 || dev->decoder == EM28XX_SAA7114)
1775 request_module("saa711x"); 1585 request_module("saa7115");
1776 if (dev->decoder == EM28XX_TVP5150) 1586 if (dev->decoder == EM28XX_TVP5150)
1777 request_module("tvp5150"); 1587 request_module("tvp5150");
1778 if (dev->has_tuner) 1588 if (dev->has_tuner)