diff options
Diffstat (limited to 'drivers/media')
121 files changed, 2051 insertions, 2351 deletions
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c index 982f000a57ff..9f47e383c57a 100644 --- a/drivers/media/common/saa7146_core.c +++ b/drivers/media/common/saa7146_core.c | |||
@@ -452,7 +452,7 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent | |||
452 | INFO(("found saa7146 @ mem %p (revision %d, irq %d) (0x%04x,0x%04x).\n", dev->mem, dev->revision, pci->irq, pci->subsystem_vendor, pci->subsystem_device)); | 452 | INFO(("found saa7146 @ mem %p (revision %d, irq %d) (0x%04x,0x%04x).\n", dev->mem, dev->revision, pci->irq, pci->subsystem_vendor, pci->subsystem_device)); |
453 | dev->ext = ext; | 453 | dev->ext = ext; |
454 | 454 | ||
455 | mutex_init(&dev->lock); | 455 | mutex_init(&dev->v4l2_lock); |
456 | spin_lock_init(&dev->int_slock); | 456 | spin_lock_init(&dev->int_slock); |
457 | spin_lock_init(&dev->slock); | 457 | spin_lock_init(&dev->slock); |
458 | 458 | ||
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c index e3fedc60fe77..1bd3dd762c6b 100644 --- a/drivers/media/common/saa7146_fops.c +++ b/drivers/media/common/saa7146_fops.c | |||
@@ -15,18 +15,15 @@ int saa7146_res_get(struct saa7146_fh *fh, unsigned int bit) | |||
15 | } | 15 | } |
16 | 16 | ||
17 | /* is it free? */ | 17 | /* is it free? */ |
18 | mutex_lock(&dev->lock); | ||
19 | if (vv->resources & bit) { | 18 | if (vv->resources & bit) { |
20 | DEB_D(("locked! vv->resources:0x%02x, we want:0x%02x\n",vv->resources,bit)); | 19 | DEB_D(("locked! vv->resources:0x%02x, we want:0x%02x\n",vv->resources,bit)); |
21 | /* no, someone else uses it */ | 20 | /* no, someone else uses it */ |
22 | mutex_unlock(&dev->lock); | ||
23 | return 0; | 21 | return 0; |
24 | } | 22 | } |
25 | /* it's free, grab it */ | 23 | /* it's free, grab it */ |
26 | fh->resources |= bit; | 24 | fh->resources |= bit; |
27 | vv->resources |= bit; | 25 | vv->resources |= bit; |
28 | DEB_D(("res: get 0x%02x, cur:0x%02x\n",bit,vv->resources)); | 26 | DEB_D(("res: get 0x%02x, cur:0x%02x\n",bit,vv->resources)); |
29 | mutex_unlock(&dev->lock); | ||
30 | return 1; | 27 | return 1; |
31 | } | 28 | } |
32 | 29 | ||
@@ -37,11 +34,9 @@ void saa7146_res_free(struct saa7146_fh *fh, unsigned int bits) | |||
37 | 34 | ||
38 | BUG_ON((fh->resources & bits) != bits); | 35 | BUG_ON((fh->resources & bits) != bits); |
39 | 36 | ||
40 | mutex_lock(&dev->lock); | ||
41 | fh->resources &= ~bits; | 37 | fh->resources &= ~bits; |
42 | vv->resources &= ~bits; | 38 | vv->resources &= ~bits; |
43 | DEB_D(("res: put 0x%02x, cur:0x%02x\n",bits,vv->resources)); | 39 | DEB_D(("res: put 0x%02x, cur:0x%02x\n",bits,vv->resources)); |
44 | mutex_unlock(&dev->lock); | ||
45 | } | 40 | } |
46 | 41 | ||
47 | 42 | ||
@@ -396,7 +391,7 @@ static const struct v4l2_file_operations video_fops = | |||
396 | .write = fops_write, | 391 | .write = fops_write, |
397 | .poll = fops_poll, | 392 | .poll = fops_poll, |
398 | .mmap = fops_mmap, | 393 | .mmap = fops_mmap, |
399 | .ioctl = video_ioctl2, | 394 | .unlocked_ioctl = video_ioctl2, |
400 | }; | 395 | }; |
401 | 396 | ||
402 | static void vv_callback(struct saa7146_dev *dev, unsigned long status) | 397 | static void vv_callback(struct saa7146_dev *dev, unsigned long status) |
@@ -505,6 +500,7 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, | |||
505 | vfd->fops = &video_fops; | 500 | vfd->fops = &video_fops; |
506 | vfd->ioctl_ops = &dev->ext_vv_data->ops; | 501 | vfd->ioctl_ops = &dev->ext_vv_data->ops; |
507 | vfd->release = video_device_release; | 502 | vfd->release = video_device_release; |
503 | vfd->lock = &dev->v4l2_lock; | ||
508 | vfd->tvnorms = 0; | 504 | vfd->tvnorms = 0; |
509 | for (i = 0; i < dev->ext_vv_data->num_stds; i++) | 505 | for (i = 0; i < dev->ext_vv_data->num_stds; i++) |
510 | vfd->tvnorms |= dev->ext_vv_data->stds[i].id; | 506 | vfd->tvnorms |= dev->ext_vv_data->stds[i].id; |
diff --git a/drivers/media/common/saa7146_vbi.c b/drivers/media/common/saa7146_vbi.c index 2d4533ab22b7..afe85801d6ca 100644 --- a/drivers/media/common/saa7146_vbi.c +++ b/drivers/media/common/saa7146_vbi.c | |||
@@ -412,7 +412,7 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file) | |||
412 | V4L2_BUF_TYPE_VBI_CAPTURE, | 412 | V4L2_BUF_TYPE_VBI_CAPTURE, |
413 | V4L2_FIELD_SEQ_TB, // FIXME: does this really work? | 413 | V4L2_FIELD_SEQ_TB, // FIXME: does this really work? |
414 | sizeof(struct saa7146_buf), | 414 | sizeof(struct saa7146_buf), |
415 | file, NULL); | 415 | file, &dev->v4l2_lock); |
416 | 416 | ||
417 | init_timer(&fh->vbi_read_timeout); | 417 | init_timer(&fh->vbi_read_timeout); |
418 | fh->vbi_read_timeout.function = vbi_read_timeout; | 418 | fh->vbi_read_timeout.function = vbi_read_timeout; |
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c index 0ac5c619aecf..9aafa4e969a8 100644 --- a/drivers/media/common/saa7146_video.c +++ b/drivers/media/common/saa7146_video.c | |||
@@ -553,8 +553,6 @@ static int vidioc_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *f | |||
553 | } | 553 | } |
554 | } | 554 | } |
555 | 555 | ||
556 | mutex_lock(&dev->lock); | ||
557 | |||
558 | /* ok, accept it */ | 556 | /* ok, accept it */ |
559 | vv->ov_fb = *fb; | 557 | vv->ov_fb = *fb; |
560 | vv->ov_fmt = fmt; | 558 | vv->ov_fmt = fmt; |
@@ -563,8 +561,6 @@ static int vidioc_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *f | |||
563 | vv->ov_fb.fmt.bytesperline = vv->ov_fb.fmt.width * fmt->depth / 8; | 561 | vv->ov_fb.fmt.bytesperline = vv->ov_fb.fmt.width * fmt->depth / 8; |
564 | DEB_D(("setting bytesperline to %d\n", vv->ov_fb.fmt.bytesperline)); | 562 | DEB_D(("setting bytesperline to %d\n", vv->ov_fb.fmt.bytesperline)); |
565 | } | 563 | } |
566 | |||
567 | mutex_unlock(&dev->lock); | ||
568 | return 0; | 564 | return 0; |
569 | } | 565 | } |
570 | 566 | ||
@@ -649,8 +645,6 @@ static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *c) | |||
649 | return -EINVAL; | 645 | return -EINVAL; |
650 | } | 646 | } |
651 | 647 | ||
652 | mutex_lock(&dev->lock); | ||
653 | |||
654 | switch (ctrl->type) { | 648 | switch (ctrl->type) { |
655 | case V4L2_CTRL_TYPE_BOOLEAN: | 649 | case V4L2_CTRL_TYPE_BOOLEAN: |
656 | case V4L2_CTRL_TYPE_MENU: | 650 | case V4L2_CTRL_TYPE_MENU: |
@@ -693,7 +687,6 @@ static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *c) | |||
693 | /* fixme: we can support changing VFLIP and HFLIP here... */ | 687 | /* fixme: we can support changing VFLIP and HFLIP here... */ |
694 | if (IS_CAPTURE_ACTIVE(fh) != 0) { | 688 | if (IS_CAPTURE_ACTIVE(fh) != 0) { |
695 | DEB_D(("V4L2_CID_HFLIP while active capture.\n")); | 689 | DEB_D(("V4L2_CID_HFLIP while active capture.\n")); |
696 | mutex_unlock(&dev->lock); | ||
697 | return -EBUSY; | 690 | return -EBUSY; |
698 | } | 691 | } |
699 | vv->hflip = c->value; | 692 | vv->hflip = c->value; |
@@ -701,16 +694,13 @@ static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *c) | |||
701 | case V4L2_CID_VFLIP: | 694 | case V4L2_CID_VFLIP: |
702 | if (IS_CAPTURE_ACTIVE(fh) != 0) { | 695 | if (IS_CAPTURE_ACTIVE(fh) != 0) { |
703 | DEB_D(("V4L2_CID_VFLIP while active capture.\n")); | 696 | DEB_D(("V4L2_CID_VFLIP while active capture.\n")); |
704 | mutex_unlock(&dev->lock); | ||
705 | return -EBUSY; | 697 | return -EBUSY; |
706 | } | 698 | } |
707 | vv->vflip = c->value; | 699 | vv->vflip = c->value; |
708 | break; | 700 | break; |
709 | default: | 701 | default: |
710 | mutex_unlock(&dev->lock); | ||
711 | return -EINVAL; | 702 | return -EINVAL; |
712 | } | 703 | } |
713 | mutex_unlock(&dev->lock); | ||
714 | 704 | ||
715 | if (IS_OVERLAY_ACTIVE(fh) != 0) { | 705 | if (IS_OVERLAY_ACTIVE(fh) != 0) { |
716 | saa7146_stop_preview(fh); | 706 | saa7146_stop_preview(fh); |
@@ -902,22 +892,18 @@ static int vidioc_s_fmt_vid_overlay(struct file *file, void *__fh, struct v4l2_f | |||
902 | err = vidioc_try_fmt_vid_overlay(file, fh, f); | 892 | err = vidioc_try_fmt_vid_overlay(file, fh, f); |
903 | if (0 != err) | 893 | if (0 != err) |
904 | return err; | 894 | return err; |
905 | mutex_lock(&dev->lock); | ||
906 | fh->ov.win = f->fmt.win; | 895 | fh->ov.win = f->fmt.win; |
907 | fh->ov.nclips = f->fmt.win.clipcount; | 896 | fh->ov.nclips = f->fmt.win.clipcount; |
908 | if (fh->ov.nclips > 16) | 897 | if (fh->ov.nclips > 16) |
909 | fh->ov.nclips = 16; | 898 | fh->ov.nclips = 16; |
910 | if (copy_from_user(fh->ov.clips, f->fmt.win.clips, | 899 | if (copy_from_user(fh->ov.clips, f->fmt.win.clips, |
911 | sizeof(struct v4l2_clip) * fh->ov.nclips)) { | 900 | sizeof(struct v4l2_clip) * fh->ov.nclips)) { |
912 | mutex_unlock(&dev->lock); | ||
913 | return -EFAULT; | 901 | return -EFAULT; |
914 | } | 902 | } |
915 | 903 | ||
916 | /* fh->ov.fh is used to indicate that we have valid overlay informations, too */ | 904 | /* fh->ov.fh is used to indicate that we have valid overlay informations, too */ |
917 | fh->ov.fh = fh; | 905 | fh->ov.fh = fh; |
918 | 906 | ||
919 | mutex_unlock(&dev->lock); | ||
920 | |||
921 | /* check if our current overlay is active */ | 907 | /* check if our current overlay is active */ |
922 | if (IS_OVERLAY_ACTIVE(fh) != 0) { | 908 | if (IS_OVERLAY_ACTIVE(fh) != 0) { |
923 | saa7146_stop_preview(fh); | 909 | saa7146_stop_preview(fh); |
@@ -976,8 +962,6 @@ static int vidioc_s_std(struct file *file, void *fh, v4l2_std_id *id) | |||
976 | } | 962 | } |
977 | } | 963 | } |
978 | 964 | ||
979 | mutex_lock(&dev->lock); | ||
980 | |||
981 | for (i = 0; i < dev->ext_vv_data->num_stds; i++) | 965 | for (i = 0; i < dev->ext_vv_data->num_stds; i++) |
982 | if (*id & dev->ext_vv_data->stds[i].id) | 966 | if (*id & dev->ext_vv_data->stds[i].id) |
983 | break; | 967 | break; |
@@ -988,8 +972,6 @@ static int vidioc_s_std(struct file *file, void *fh, v4l2_std_id *id) | |||
988 | found = 1; | 972 | found = 1; |
989 | } | 973 | } |
990 | 974 | ||
991 | mutex_unlock(&dev->lock); | ||
992 | |||
993 | if (vv->ov_suspend != NULL) { | 975 | if (vv->ov_suspend != NULL) { |
994 | saa7146_start_preview(vv->ov_suspend); | 976 | saa7146_start_preview(vv->ov_suspend); |
995 | vv->ov_suspend = NULL; | 977 | vv->ov_suspend = NULL; |
@@ -1354,7 +1336,7 @@ static int video_open(struct saa7146_dev *dev, struct file *file) | |||
1354 | V4L2_BUF_TYPE_VIDEO_CAPTURE, | 1336 | V4L2_BUF_TYPE_VIDEO_CAPTURE, |
1355 | V4L2_FIELD_INTERLACED, | 1337 | V4L2_FIELD_INTERLACED, |
1356 | sizeof(struct saa7146_buf), | 1338 | sizeof(struct saa7146_buf), |
1357 | file, NULL); | 1339 | file, &dev->v4l2_lock); |
1358 | 1340 | ||
1359 | return 0; | 1341 | return 0; |
1360 | } | 1342 | } |
diff --git a/drivers/media/common/tuners/Kconfig b/drivers/media/common/tuners/Kconfig index 78b089526e02..6fc79f15dcbc 100644 --- a/drivers/media/common/tuners/Kconfig +++ b/drivers/media/common/tuners/Kconfig | |||
@@ -34,7 +34,7 @@ config MEDIA_TUNER | |||
34 | config MEDIA_TUNER_CUSTOMISE | 34 | config MEDIA_TUNER_CUSTOMISE |
35 | bool "Customize analog and hybrid tuner modules to build" | 35 | bool "Customize analog and hybrid tuner modules to build" |
36 | depends on MEDIA_TUNER | 36 | depends on MEDIA_TUNER |
37 | default y if EMBEDDED | 37 | default y if EXPERT |
38 | help | 38 | help |
39 | This allows the user to deselect tuner drivers unnecessary | 39 | This allows the user to deselect tuner drivers unnecessary |
40 | for their hardware from the build. Use this option with care | 40 | for their hardware from the build. Use this option with care |
diff --git a/drivers/media/common/tuners/tda8290.c b/drivers/media/common/tuners/tda8290.c index c9062ceddc71..bc6a67768af1 100644 --- a/drivers/media/common/tuners/tda8290.c +++ b/drivers/media/common/tuners/tda8290.c | |||
@@ -95,8 +95,7 @@ static int tda8295_i2c_bridge(struct dvb_frontend *fe, int close) | |||
95 | msleep(20); | 95 | msleep(20); |
96 | } else { | 96 | } else { |
97 | msg = disable; | 97 | msg = disable; |
98 | tuner_i2c_xfer_send(&priv->i2c_props, msg, 1); | 98 | tuner_i2c_xfer_send_recv(&priv->i2c_props, msg, 1, &msg[1], 1); |
99 | tuner_i2c_xfer_recv(&priv->i2c_props, &msg[1], 1); | ||
100 | 99 | ||
101 | buf[2] = msg[1]; | 100 | buf[2] = msg[1]; |
102 | buf[2] &= ~0x04; | 101 | buf[2] &= ~0x04; |
@@ -233,19 +232,22 @@ static void tda8290_set_params(struct dvb_frontend *fe, | |||
233 | tuner_i2c_xfer_send(&priv->i2c_props, pll_bw_nom, 2); | 232 | tuner_i2c_xfer_send(&priv->i2c_props, pll_bw_nom, 2); |
234 | } | 233 | } |
235 | 234 | ||
235 | |||
236 | tda8290_i2c_bridge(fe, 1); | 236 | tda8290_i2c_bridge(fe, 1); |
237 | 237 | ||
238 | if (fe->ops.tuner_ops.set_analog_params) | 238 | if (fe->ops.tuner_ops.set_analog_params) |
239 | fe->ops.tuner_ops.set_analog_params(fe, params); | 239 | fe->ops.tuner_ops.set_analog_params(fe, params); |
240 | 240 | ||
241 | for (i = 0; i < 3; i++) { | 241 | for (i = 0; i < 3; i++) { |
242 | tuner_i2c_xfer_send(&priv->i2c_props, &addr_pll_stat, 1); | 242 | tuner_i2c_xfer_send_recv(&priv->i2c_props, |
243 | tuner_i2c_xfer_recv(&priv->i2c_props, &pll_stat, 1); | 243 | &addr_pll_stat, 1, &pll_stat, 1); |
244 | if (pll_stat & 0x80) { | 244 | if (pll_stat & 0x80) { |
245 | tuner_i2c_xfer_send(&priv->i2c_props, &addr_adc_sat, 1); | 245 | tuner_i2c_xfer_send_recv(&priv->i2c_props, |
246 | tuner_i2c_xfer_recv(&priv->i2c_props, &adc_sat, 1); | 246 | &addr_adc_sat, 1, |
247 | tuner_i2c_xfer_send(&priv->i2c_props, &addr_agc_stat, 1); | 247 | &adc_sat, 1); |
248 | tuner_i2c_xfer_recv(&priv->i2c_props, &agc_stat, 1); | 248 | tuner_i2c_xfer_send_recv(&priv->i2c_props, |
249 | &addr_agc_stat, 1, | ||
250 | &agc_stat, 1); | ||
249 | tuner_dbg("tda8290 is locked, AGC: %d\n", agc_stat); | 251 | tuner_dbg("tda8290 is locked, AGC: %d\n", agc_stat); |
250 | break; | 252 | break; |
251 | } else { | 253 | } else { |
@@ -259,20 +261,22 @@ static void tda8290_set_params(struct dvb_frontend *fe, | |||
259 | agc_stat, adc_sat, pll_stat & 0x80); | 261 | agc_stat, adc_sat, pll_stat & 0x80); |
260 | tuner_i2c_xfer_send(&priv->i2c_props, gainset_2, 2); | 262 | tuner_i2c_xfer_send(&priv->i2c_props, gainset_2, 2); |
261 | msleep(100); | 263 | msleep(100); |
262 | tuner_i2c_xfer_send(&priv->i2c_props, &addr_agc_stat, 1); | 264 | tuner_i2c_xfer_send_recv(&priv->i2c_props, |
263 | tuner_i2c_xfer_recv(&priv->i2c_props, &agc_stat, 1); | 265 | &addr_agc_stat, 1, &agc_stat, 1); |
264 | tuner_i2c_xfer_send(&priv->i2c_props, &addr_pll_stat, 1); | 266 | tuner_i2c_xfer_send_recv(&priv->i2c_props, |
265 | tuner_i2c_xfer_recv(&priv->i2c_props, &pll_stat, 1); | 267 | &addr_pll_stat, 1, &pll_stat, 1); |
266 | if ((agc_stat > 115) || !(pll_stat & 0x80)) { | 268 | if ((agc_stat > 115) || !(pll_stat & 0x80)) { |
267 | tuner_dbg("adjust gain, step 2. Agc: %d, lock: %d\n", | 269 | tuner_dbg("adjust gain, step 2. Agc: %d, lock: %d\n", |
268 | agc_stat, pll_stat & 0x80); | 270 | agc_stat, pll_stat & 0x80); |
269 | if (priv->cfg.agcf) | 271 | if (priv->cfg.agcf) |
270 | priv->cfg.agcf(fe); | 272 | priv->cfg.agcf(fe); |
271 | msleep(100); | 273 | msleep(100); |
272 | tuner_i2c_xfer_send(&priv->i2c_props, &addr_agc_stat, 1); | 274 | tuner_i2c_xfer_send_recv(&priv->i2c_props, |
273 | tuner_i2c_xfer_recv(&priv->i2c_props, &agc_stat, 1); | 275 | &addr_agc_stat, 1, |
274 | tuner_i2c_xfer_send(&priv->i2c_props, &addr_pll_stat, 1); | 276 | &agc_stat, 1); |
275 | tuner_i2c_xfer_recv(&priv->i2c_props, &pll_stat, 1); | 277 | tuner_i2c_xfer_send_recv(&priv->i2c_props, |
278 | &addr_pll_stat, 1, | ||
279 | &pll_stat, 1); | ||
276 | if((agc_stat > 115) || !(pll_stat & 0x80)) { | 280 | if((agc_stat > 115) || !(pll_stat & 0x80)) { |
277 | tuner_dbg("adjust gain, step 3. Agc: %d\n", agc_stat); | 281 | tuner_dbg("adjust gain, step 3. Agc: %d\n", agc_stat); |
278 | tuner_i2c_xfer_send(&priv->i2c_props, adc_head_12, 2); | 282 | tuner_i2c_xfer_send(&priv->i2c_props, adc_head_12, 2); |
@@ -284,10 +288,12 @@ static void tda8290_set_params(struct dvb_frontend *fe, | |||
284 | 288 | ||
285 | /* l/ l' deadlock? */ | 289 | /* l/ l' deadlock? */ |
286 | if(priv->tda8290_easy_mode & 0x60) { | 290 | if(priv->tda8290_easy_mode & 0x60) { |
287 | tuner_i2c_xfer_send(&priv->i2c_props, &addr_adc_sat, 1); | 291 | tuner_i2c_xfer_send_recv(&priv->i2c_props, |
288 | tuner_i2c_xfer_recv(&priv->i2c_props, &adc_sat, 1); | 292 | &addr_adc_sat, 1, |
289 | tuner_i2c_xfer_send(&priv->i2c_props, &addr_pll_stat, 1); | 293 | &adc_sat, 1); |
290 | tuner_i2c_xfer_recv(&priv->i2c_props, &pll_stat, 1); | 294 | tuner_i2c_xfer_send_recv(&priv->i2c_props, |
295 | &addr_pll_stat, 1, | ||
296 | &pll_stat, 1); | ||
291 | if ((adc_sat > 20) || !(pll_stat & 0x80)) { | 297 | if ((adc_sat > 20) || !(pll_stat & 0x80)) { |
292 | tuner_dbg("trying to resolve SECAM L deadlock\n"); | 298 | tuner_dbg("trying to resolve SECAM L deadlock\n"); |
293 | tuner_i2c_xfer_send(&priv->i2c_props, agc_rst_on, 2); | 299 | tuner_i2c_xfer_send(&priv->i2c_props, agc_rst_on, 2); |
@@ -307,8 +313,7 @@ static void tda8295_power(struct dvb_frontend *fe, int enable) | |||
307 | struct tda8290_priv *priv = fe->analog_demod_priv; | 313 | struct tda8290_priv *priv = fe->analog_demod_priv; |
308 | unsigned char buf[] = { 0x30, 0x00 }; /* clb_stdbt */ | 314 | unsigned char buf[] = { 0x30, 0x00 }; /* clb_stdbt */ |
309 | 315 | ||
310 | tuner_i2c_xfer_send(&priv->i2c_props, &buf[0], 1); | 316 | tuner_i2c_xfer_send_recv(&priv->i2c_props, &buf[0], 1, &buf[1], 1); |
311 | tuner_i2c_xfer_recv(&priv->i2c_props, &buf[1], 1); | ||
312 | 317 | ||
313 | if (enable) | 318 | if (enable) |
314 | buf[1] = 0x01; | 319 | buf[1] = 0x01; |
@@ -323,8 +328,7 @@ static void tda8295_set_easy_mode(struct dvb_frontend *fe, int enable) | |||
323 | struct tda8290_priv *priv = fe->analog_demod_priv; | 328 | struct tda8290_priv *priv = fe->analog_demod_priv; |
324 | unsigned char buf[] = { 0x01, 0x00 }; | 329 | unsigned char buf[] = { 0x01, 0x00 }; |
325 | 330 | ||
326 | tuner_i2c_xfer_send(&priv->i2c_props, &buf[0], 1); | 331 | tuner_i2c_xfer_send_recv(&priv->i2c_props, &buf[0], 1, &buf[1], 1); |
327 | tuner_i2c_xfer_recv(&priv->i2c_props, &buf[1], 1); | ||
328 | 332 | ||
329 | if (enable) | 333 | if (enable) |
330 | buf[1] = 0x01; /* rising edge sets regs 0x02 - 0x23 */ | 334 | buf[1] = 0x01; /* rising edge sets regs 0x02 - 0x23 */ |
@@ -353,8 +357,7 @@ static void tda8295_agc1_out(struct dvb_frontend *fe, int enable) | |||
353 | struct tda8290_priv *priv = fe->analog_demod_priv; | 357 | struct tda8290_priv *priv = fe->analog_demod_priv; |
354 | unsigned char buf[] = { 0x02, 0x00 }; /* DIV_FUNC */ | 358 | unsigned char buf[] = { 0x02, 0x00 }; /* DIV_FUNC */ |
355 | 359 | ||
356 | tuner_i2c_xfer_send(&priv->i2c_props, &buf[0], 1); | 360 | tuner_i2c_xfer_send_recv(&priv->i2c_props, &buf[0], 1, &buf[1], 1); |
357 | tuner_i2c_xfer_recv(&priv->i2c_props, &buf[1], 1); | ||
358 | 361 | ||
359 | if (enable) | 362 | if (enable) |
360 | buf[1] &= ~0x40; | 363 | buf[1] &= ~0x40; |
@@ -370,10 +373,10 @@ static void tda8295_agc2_out(struct dvb_frontend *fe, int enable) | |||
370 | unsigned char set_gpio_cf[] = { 0x44, 0x00 }; | 373 | unsigned char set_gpio_cf[] = { 0x44, 0x00 }; |
371 | unsigned char set_gpio_val[] = { 0x46, 0x00 }; | 374 | unsigned char set_gpio_val[] = { 0x46, 0x00 }; |
372 | 375 | ||
373 | tuner_i2c_xfer_send(&priv->i2c_props, &set_gpio_cf[0], 1); | 376 | tuner_i2c_xfer_send_recv(&priv->i2c_props, |
374 | tuner_i2c_xfer_recv(&priv->i2c_props, &set_gpio_cf[1], 1); | 377 | &set_gpio_cf[0], 1, &set_gpio_cf[1], 1); |
375 | tuner_i2c_xfer_send(&priv->i2c_props, &set_gpio_val[0], 1); | 378 | tuner_i2c_xfer_send_recv(&priv->i2c_props, |
376 | tuner_i2c_xfer_recv(&priv->i2c_props, &set_gpio_val[1], 1); | 379 | &set_gpio_val[0], 1, &set_gpio_val[1], 1); |
377 | 380 | ||
378 | set_gpio_cf[1] &= 0xf0; /* clear GPIO_0 bits 3-0 */ | 381 | set_gpio_cf[1] &= 0xf0; /* clear GPIO_0 bits 3-0 */ |
379 | 382 | ||
@@ -392,8 +395,7 @@ static int tda8295_has_signal(struct dvb_frontend *fe) | |||
392 | unsigned char hvpll_stat = 0x26; | 395 | unsigned char hvpll_stat = 0x26; |
393 | unsigned char ret; | 396 | unsigned char ret; |
394 | 397 | ||
395 | tuner_i2c_xfer_send(&priv->i2c_props, &hvpll_stat, 1); | 398 | tuner_i2c_xfer_send_recv(&priv->i2c_props, &hvpll_stat, 1, &ret, 1); |
396 | tuner_i2c_xfer_recv(&priv->i2c_props, &ret, 1); | ||
397 | return (ret & 0x01) ? 65535 : 0; | 399 | return (ret & 0x01) ? 65535 : 0; |
398 | } | 400 | } |
399 | 401 | ||
@@ -413,8 +415,8 @@ static void tda8295_set_params(struct dvb_frontend *fe, | |||
413 | tda8295_power(fe, 1); | 415 | tda8295_power(fe, 1); |
414 | tda8295_agc1_out(fe, 1); | 416 | tda8295_agc1_out(fe, 1); |
415 | 417 | ||
416 | tuner_i2c_xfer_send(&priv->i2c_props, &blanking_mode[0], 1); | 418 | tuner_i2c_xfer_send_recv(&priv->i2c_props, |
417 | tuner_i2c_xfer_recv(&priv->i2c_props, &blanking_mode[1], 1); | 419 | &blanking_mode[0], 1, &blanking_mode[1], 1); |
418 | 420 | ||
419 | tda8295_set_video_std(fe); | 421 | tda8295_set_video_std(fe); |
420 | 422 | ||
@@ -447,8 +449,8 @@ static int tda8290_has_signal(struct dvb_frontend *fe) | |||
447 | unsigned char i2c_get_afc[1] = { 0x1B }; | 449 | unsigned char i2c_get_afc[1] = { 0x1B }; |
448 | unsigned char afc = 0; | 450 | unsigned char afc = 0; |
449 | 451 | ||
450 | tuner_i2c_xfer_send(&priv->i2c_props, i2c_get_afc, ARRAY_SIZE(i2c_get_afc)); | 452 | tuner_i2c_xfer_send_recv(&priv->i2c_props, |
451 | tuner_i2c_xfer_recv(&priv->i2c_props, &afc, 1); | 453 | i2c_get_afc, ARRAY_SIZE(i2c_get_afc), &afc, 1); |
452 | return (afc & 0x80)? 65535:0; | 454 | return (afc & 0x80)? 65535:0; |
453 | } | 455 | } |
454 | 456 | ||
@@ -654,20 +656,26 @@ static int tda829x_find_tuner(struct dvb_frontend *fe) | |||
654 | static int tda8290_probe(struct tuner_i2c_props *i2c_props) | 656 | static int tda8290_probe(struct tuner_i2c_props *i2c_props) |
655 | { | 657 | { |
656 | #define TDA8290_ID 0x89 | 658 | #define TDA8290_ID 0x89 |
657 | unsigned char tda8290_id[] = { 0x1f, 0x00 }; | 659 | u8 reg = 0x1f, id; |
660 | struct i2c_msg msg_read[] = { | ||
661 | { .addr = 0x4b, .flags = 0, .len = 1, .buf = ® }, | ||
662 | { .addr = 0x4b, .flags = I2C_M_RD, .len = 1, .buf = &id }, | ||
663 | }; | ||
658 | 664 | ||
659 | /* detect tda8290 */ | 665 | /* detect tda8290 */ |
660 | tuner_i2c_xfer_send(i2c_props, &tda8290_id[0], 1); | 666 | if (i2c_transfer(i2c_props->adap, msg_read, 2) != 2) { |
661 | tuner_i2c_xfer_recv(i2c_props, &tda8290_id[1], 1); | 667 | printk(KERN_WARNING "%s: tda8290 couldn't read register 0x%02x\n", |
668 | __func__, reg); | ||
669 | return -ENODEV; | ||
670 | } | ||
662 | 671 | ||
663 | if (tda8290_id[1] == TDA8290_ID) { | 672 | if (id == TDA8290_ID) { |
664 | if (debug) | 673 | if (debug) |
665 | printk(KERN_DEBUG "%s: tda8290 detected @ %d-%04x\n", | 674 | printk(KERN_DEBUG "%s: tda8290 detected @ %d-%04x\n", |
666 | __func__, i2c_adapter_id(i2c_props->adap), | 675 | __func__, i2c_adapter_id(i2c_props->adap), |
667 | i2c_props->addr); | 676 | i2c_props->addr); |
668 | return 0; | 677 | return 0; |
669 | } | 678 | } |
670 | |||
671 | return -ENODEV; | 679 | return -ENODEV; |
672 | } | 680 | } |
673 | 681 | ||
@@ -675,16 +683,23 @@ static int tda8295_probe(struct tuner_i2c_props *i2c_props) | |||
675 | { | 683 | { |
676 | #define TDA8295_ID 0x8a | 684 | #define TDA8295_ID 0x8a |
677 | #define TDA8295C2_ID 0x8b | 685 | #define TDA8295C2_ID 0x8b |
678 | unsigned char tda8295_id[] = { 0x2f, 0x00 }; | 686 | u8 reg = 0x2f, id; |
687 | struct i2c_msg msg_read[] = { | ||
688 | { .addr = 0x4b, .flags = 0, .len = 1, .buf = ® }, | ||
689 | { .addr = 0x4b, .flags = I2C_M_RD, .len = 1, .buf = &id }, | ||
690 | }; | ||
679 | 691 | ||
680 | /* detect tda8295 */ | 692 | /* detect tda8290 */ |
681 | tuner_i2c_xfer_send(i2c_props, &tda8295_id[0], 1); | 693 | if (i2c_transfer(i2c_props->adap, msg_read, 2) != 2) { |
682 | tuner_i2c_xfer_recv(i2c_props, &tda8295_id[1], 1); | 694 | printk(KERN_WARNING "%s: tda8290 couldn't read register 0x%02x\n", |
695 | __func__, reg); | ||
696 | return -ENODEV; | ||
697 | } | ||
683 | 698 | ||
684 | if ((tda8295_id[1] & 0xfe) == TDA8295_ID) { | 699 | if ((id & 0xfe) == TDA8295_ID) { |
685 | if (debug) | 700 | if (debug) |
686 | printk(KERN_DEBUG "%s: %s detected @ %d-%04x\n", | 701 | printk(KERN_DEBUG "%s: %s detected @ %d-%04x\n", |
687 | __func__, (tda8295_id[1] == TDA8295_ID) ? | 702 | __func__, (id == TDA8295_ID) ? |
688 | "tda8295c1" : "tda8295c2", | 703 | "tda8295c1" : "tda8295c2", |
689 | i2c_adapter_id(i2c_props->adap), | 704 | i2c_adapter_id(i2c_props->adap), |
690 | i2c_props->addr); | 705 | i2c_props->addr); |
@@ -740,9 +755,11 @@ struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe, | |||
740 | sizeof(struct analog_demod_ops)); | 755 | sizeof(struct analog_demod_ops)); |
741 | } | 756 | } |
742 | 757 | ||
743 | if ((!(cfg) || (TDA829X_PROBE_TUNER == cfg->probe_tuner)) && | 758 | if (!(cfg) || (TDA829X_PROBE_TUNER == cfg->probe_tuner)) { |
744 | (tda829x_find_tuner(fe) < 0)) | 759 | tda8295_power(fe, 1); |
745 | goto fail; | 760 | if (tda829x_find_tuner(fe) < 0) |
761 | goto fail; | ||
762 | } | ||
746 | 763 | ||
747 | switch (priv->ver) { | 764 | switch (priv->ver) { |
748 | case TDA8290: | 765 | case TDA8290: |
@@ -786,6 +803,8 @@ struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe, | |||
786 | return fe; | 803 | return fe; |
787 | 804 | ||
788 | fail: | 805 | fail: |
806 | memset(&fe->ops.analog_ops, 0, sizeof(struct analog_demod_ops)); | ||
807 | |||
789 | tda829x_release(fe); | 808 | tda829x_release(fe); |
790 | return NULL; | 809 | return NULL; |
791 | } | 810 | } |
@@ -809,8 +828,8 @@ int tda829x_probe(struct i2c_adapter *i2c_adap, u8 i2c_addr) | |||
809 | int i; | 828 | int i; |
810 | 829 | ||
811 | /* rule out tda9887, which would return the same byte repeatedly */ | 830 | /* rule out tda9887, which would return the same byte repeatedly */ |
812 | tuner_i2c_xfer_send(&i2c_props, soft_reset, 1); | 831 | tuner_i2c_xfer_send_recv(&i2c_props, |
813 | tuner_i2c_xfer_recv(&i2c_props, buf, PROBE_BUFFER_SIZE); | 832 | soft_reset, 1, buf, PROBE_BUFFER_SIZE); |
814 | for (i = 1; i < PROBE_BUFFER_SIZE; i++) { | 833 | for (i = 1; i < PROBE_BUFFER_SIZE; i++) { |
815 | if (buf[i] != buf[0]) | 834 | if (buf[i] != buf[0]) |
816 | break; | 835 | break; |
@@ -827,13 +846,12 @@ int tda829x_probe(struct i2c_adapter *i2c_adap, u8 i2c_addr) | |||
827 | /* fall back to old probing method */ | 846 | /* fall back to old probing method */ |
828 | tuner_i2c_xfer_send(&i2c_props, easy_mode_b, 2); | 847 | tuner_i2c_xfer_send(&i2c_props, easy_mode_b, 2); |
829 | tuner_i2c_xfer_send(&i2c_props, soft_reset, 2); | 848 | tuner_i2c_xfer_send(&i2c_props, soft_reset, 2); |
830 | tuner_i2c_xfer_send(&i2c_props, &addr_dto_lsb, 1); | 849 | tuner_i2c_xfer_send_recv(&i2c_props, &addr_dto_lsb, 1, &data, 1); |
831 | tuner_i2c_xfer_recv(&i2c_props, &data, 1); | ||
832 | if (data == 0) { | 850 | if (data == 0) { |
833 | tuner_i2c_xfer_send(&i2c_props, easy_mode_g, 2); | 851 | tuner_i2c_xfer_send(&i2c_props, easy_mode_g, 2); |
834 | tuner_i2c_xfer_send(&i2c_props, soft_reset, 2); | 852 | tuner_i2c_xfer_send(&i2c_props, soft_reset, 2); |
835 | tuner_i2c_xfer_send(&i2c_props, &addr_dto_lsb, 1); | 853 | tuner_i2c_xfer_send_recv(&i2c_props, |
836 | tuner_i2c_xfer_recv(&i2c_props, &data, 1); | 854 | &addr_dto_lsb, 1, &data, 1); |
837 | if (data == 0x7b) { | 855 | if (data == 0x7b) { |
838 | return 0; | 856 | return 0; |
839 | } | 857 | } |
diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c index 8ca48f76dfa9..98ffb40728e3 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_core.c +++ b/drivers/media/dvb/dvb-usb/dib0700_core.c | |||
@@ -514,8 +514,8 @@ struct dib0700_rc_response { | |||
514 | union { | 514 | union { |
515 | u16 system16; | 515 | u16 system16; |
516 | struct { | 516 | struct { |
517 | u8 system; | ||
518 | u8 not_system; | 517 | u8 not_system; |
518 | u8 system; | ||
519 | }; | 519 | }; |
520 | }; | 520 | }; |
521 | u8 data; | 521 | u8 data; |
@@ -575,7 +575,7 @@ static void dib0700_rc_urb_completion(struct urb *purb) | |||
575 | if ((poll_reply->system ^ poll_reply->not_system) != 0xff) { | 575 | if ((poll_reply->system ^ poll_reply->not_system) != 0xff) { |
576 | deb_data("NEC extended protocol\n"); | 576 | deb_data("NEC extended protocol\n"); |
577 | /* NEC extended code - 24 bits */ | 577 | /* NEC extended code - 24 bits */ |
578 | keycode = poll_reply->system16 << 8 | poll_reply->data; | 578 | keycode = be16_to_cpu(poll_reply->system16) << 8 | poll_reply->data; |
579 | } else { | 579 | } else { |
580 | deb_data("NEC normal protocol\n"); | 580 | deb_data("NEC normal protocol\n"); |
581 | /* normal NEC code - 16 bits */ | 581 | /* normal NEC code - 16 bits */ |
@@ -587,7 +587,7 @@ static void dib0700_rc_urb_completion(struct urb *purb) | |||
587 | deb_data("RC5 protocol\n"); | 587 | deb_data("RC5 protocol\n"); |
588 | /* RC5 Protocol */ | 588 | /* RC5 Protocol */ |
589 | toggle = poll_reply->report_id; | 589 | toggle = poll_reply->report_id; |
590 | keycode = poll_reply->system16 << 8 | poll_reply->data; | 590 | keycode = poll_reply->system << 8 | poll_reply->data; |
591 | 591 | ||
592 | break; | 592 | break; |
593 | } | 593 | } |
diff --git a/drivers/media/dvb/firewire/firedtv-rc.c b/drivers/media/dvb/firewire/firedtv-rc.c index fcf3828472b8..f82d4a93feb3 100644 --- a/drivers/media/dvb/firewire/firedtv-rc.c +++ b/drivers/media/dvb/firewire/firedtv-rc.c | |||
@@ -172,7 +172,8 @@ void fdtv_unregister_rc(struct firedtv *fdtv) | |||
172 | 172 | ||
173 | void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code) | 173 | void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code) |
174 | { | 174 | { |
175 | u16 *keycode = fdtv->remote_ctrl_dev->keycode; | 175 | struct input_dev *idev = fdtv->remote_ctrl_dev; |
176 | u16 *keycode = idev->keycode; | ||
176 | 177 | ||
177 | if (code >= 0x0300 && code <= 0x031f) | 178 | if (code >= 0x0300 && code <= 0x031f) |
178 | code = keycode[code - 0x0300]; | 179 | code = keycode[code - 0x0300]; |
@@ -188,6 +189,8 @@ void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code) | |||
188 | return; | 189 | return; |
189 | } | 190 | } |
190 | 191 | ||
191 | input_report_key(fdtv->remote_ctrl_dev, code, 1); | 192 | input_report_key(idev, code, 1); |
192 | input_report_key(fdtv->remote_ctrl_dev, code, 0); | 193 | input_sync(idev); |
194 | input_report_key(idev, code, 0); | ||
195 | input_sync(idev); | ||
193 | } | 196 | } |
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig index ef3e43a03199..b8519ba511e5 100644 --- a/drivers/media/dvb/frontends/Kconfig +++ b/drivers/media/dvb/frontends/Kconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | config DVB_FE_CUSTOMISE | 1 | config DVB_FE_CUSTOMISE |
2 | bool "Customise the frontend modules to build" | 2 | bool "Customise the frontend modules to build" |
3 | depends on DVB_CORE | 3 | depends on DVB_CORE |
4 | default y if EMBEDDED | 4 | default y if EXPERT |
5 | help | 5 | help |
6 | This allows the user to select/deselect frontend drivers for their | 6 | This allows the user to select/deselect frontend drivers for their |
7 | hardware from the build. | 7 | hardware from the build. |
diff --git a/drivers/media/dvb/frontends/af9013.c b/drivers/media/dvb/frontends/af9013.c index ce222055526d..ba25fa0b0fc2 100644 --- a/drivers/media/dvb/frontends/af9013.c +++ b/drivers/media/dvb/frontends/af9013.c | |||
@@ -334,11 +334,11 @@ static int af9013_set_freq_ctrl(struct af9013_state *state, fe_bandwidth_t bw) | |||
334 | if_sample_freq = 3300000; /* 3.3 MHz */ | 334 | if_sample_freq = 3300000; /* 3.3 MHz */ |
335 | break; | 335 | break; |
336 | case BANDWIDTH_7_MHZ: | 336 | case BANDWIDTH_7_MHZ: |
337 | if_sample_freq = 3800000; /* 3.8 MHz */ | 337 | if_sample_freq = 3500000; /* 3.5 MHz */ |
338 | break; | 338 | break; |
339 | case BANDWIDTH_8_MHZ: | 339 | case BANDWIDTH_8_MHZ: |
340 | default: | 340 | default: |
341 | if_sample_freq = 4300000; /* 4.3 MHz */ | 341 | if_sample_freq = 4000000; /* 4.0 MHz */ |
342 | break; | 342 | break; |
343 | } | 343 | } |
344 | } else if (state->config.tuner == AF9013_TUNER_TDA18218) { | 344 | } else if (state->config.tuner == AF9013_TUNER_TDA18218) { |
diff --git a/drivers/media/dvb/frontends/ix2505v.c b/drivers/media/dvb/frontends/ix2505v.c index 6360c681ded9..6c2e929bd79f 100644 --- a/drivers/media/dvb/frontends/ix2505v.c +++ b/drivers/media/dvb/frontends/ix2505v.c | |||
@@ -311,7 +311,7 @@ struct dvb_frontend *ix2505v_attach(struct dvb_frontend *fe, | |||
311 | return fe; | 311 | return fe; |
312 | 312 | ||
313 | error: | 313 | error: |
314 | ix2505v_release(fe); | 314 | kfree(state); |
315 | return NULL; | 315 | return NULL; |
316 | } | 316 | } |
317 | EXPORT_SYMBOL(ix2505v_attach); | 317 | EXPORT_SYMBOL(ix2505v_attach); |
diff --git a/drivers/media/dvb/frontends/mb86a20s.c b/drivers/media/dvb/frontends/mb86a20s.c index d3ad3e75a35a..cc4acd2f920d 100644 --- a/drivers/media/dvb/frontends/mb86a20s.c +++ b/drivers/media/dvb/frontends/mb86a20s.c | |||
@@ -43,6 +43,8 @@ struct mb86a20s_state { | |||
43 | const struct mb86a20s_config *config; | 43 | const struct mb86a20s_config *config; |
44 | 44 | ||
45 | struct dvb_frontend frontend; | 45 | struct dvb_frontend frontend; |
46 | |||
47 | bool need_init; | ||
46 | }; | 48 | }; |
47 | 49 | ||
48 | struct regdata { | 50 | struct regdata { |
@@ -318,7 +320,7 @@ static int mb86a20s_i2c_writereg(struct mb86a20s_state *state, | |||
318 | 320 | ||
319 | rc = i2c_transfer(state->i2c, &msg, 1); | 321 | rc = i2c_transfer(state->i2c, &msg, 1); |
320 | if (rc != 1) { | 322 | if (rc != 1) { |
321 | printk("%s: writereg rcor(rc == %i, reg == 0x%02x," | 323 | printk("%s: writereg error (rc == %i, reg == 0x%02x," |
322 | " data == 0x%02x)\n", __func__, rc, reg, data); | 324 | " data == 0x%02x)\n", __func__, rc, reg, data); |
323 | return rc; | 325 | return rc; |
324 | } | 326 | } |
@@ -353,7 +355,7 @@ static int mb86a20s_i2c_readreg(struct mb86a20s_state *state, | |||
353 | rc = i2c_transfer(state->i2c, msg, 2); | 355 | rc = i2c_transfer(state->i2c, msg, 2); |
354 | 356 | ||
355 | if (rc != 2) { | 357 | if (rc != 2) { |
356 | rc("%s: reg=0x%x (rcor=%d)\n", __func__, reg, rc); | 358 | rc("%s: reg=0x%x (error=%d)\n", __func__, reg, rc); |
357 | return rc; | 359 | return rc; |
358 | } | 360 | } |
359 | 361 | ||
@@ -382,23 +384,31 @@ static int mb86a20s_initfe(struct dvb_frontend *fe) | |||
382 | /* Initialize the frontend */ | 384 | /* Initialize the frontend */ |
383 | rc = mb86a20s_writeregdata(state, mb86a20s_init); | 385 | rc = mb86a20s_writeregdata(state, mb86a20s_init); |
384 | if (rc < 0) | 386 | if (rc < 0) |
385 | return rc; | 387 | goto err; |
386 | 388 | ||
387 | if (!state->config->is_serial) { | 389 | if (!state->config->is_serial) { |
388 | regD5 &= ~1; | 390 | regD5 &= ~1; |
389 | 391 | ||
390 | rc = mb86a20s_writereg(state, 0x50, 0xd5); | 392 | rc = mb86a20s_writereg(state, 0x50, 0xd5); |
391 | if (rc < 0) | 393 | if (rc < 0) |
392 | return rc; | 394 | goto err; |
393 | rc = mb86a20s_writereg(state, 0x51, regD5); | 395 | rc = mb86a20s_writereg(state, 0x51, regD5); |
394 | if (rc < 0) | 396 | if (rc < 0) |
395 | return rc; | 397 | goto err; |
396 | } | 398 | } |
397 | 399 | ||
398 | if (fe->ops.i2c_gate_ctrl) | 400 | if (fe->ops.i2c_gate_ctrl) |
399 | fe->ops.i2c_gate_ctrl(fe, 1); | 401 | fe->ops.i2c_gate_ctrl(fe, 1); |
400 | 402 | ||
401 | return 0; | 403 | err: |
404 | if (rc < 0) { | ||
405 | state->need_init = true; | ||
406 | printk(KERN_INFO "mb86a20s: Init failed. Will try again later\n"); | ||
407 | } else { | ||
408 | state->need_init = false; | ||
409 | dprintk("Initialization succeded.\n"); | ||
410 | } | ||
411 | return rc; | ||
402 | } | 412 | } |
403 | 413 | ||
404 | static int mb86a20s_read_signal_strength(struct dvb_frontend *fe, u16 *strength) | 414 | static int mb86a20s_read_signal_strength(struct dvb_frontend *fe, u16 *strength) |
@@ -485,8 +495,22 @@ static int mb86a20s_set_frontend(struct dvb_frontend *fe, | |||
485 | 495 | ||
486 | if (fe->ops.i2c_gate_ctrl) | 496 | if (fe->ops.i2c_gate_ctrl) |
487 | fe->ops.i2c_gate_ctrl(fe, 1); | 497 | fe->ops.i2c_gate_ctrl(fe, 1); |
498 | dprintk("Calling tuner set parameters\n"); | ||
488 | fe->ops.tuner_ops.set_params(fe, p); | 499 | fe->ops.tuner_ops.set_params(fe, p); |
489 | 500 | ||
501 | /* | ||
502 | * Make it more reliable: if, for some reason, the initial | ||
503 | * device initialization doesn't happen, initialize it when | ||
504 | * a SBTVD parameters are adjusted. | ||
505 | * | ||
506 | * Unfortunately, due to a hard to track bug at tda829x/tda18271, | ||
507 | * the agc callback logic is not called during DVB attach time, | ||
508 | * causing mb86a20s to not be initialized with Kworld SBTVD. | ||
509 | * So, this hack is needed, in order to make Kworld SBTVD to work. | ||
510 | */ | ||
511 | if (state->need_init) | ||
512 | mb86a20s_initfe(fe); | ||
513 | |||
490 | if (fe->ops.i2c_gate_ctrl) | 514 | if (fe->ops.i2c_gate_ctrl) |
491 | fe->ops.i2c_gate_ctrl(fe, 0); | 515 | fe->ops.i2c_gate_ctrl(fe, 0); |
492 | rc = mb86a20s_writeregdata(state, mb86a20s_reset_reception); | 516 | rc = mb86a20s_writeregdata(state, mb86a20s_reset_reception); |
diff --git a/drivers/media/dvb/ttpci/av7110_ca.c b/drivers/media/dvb/ttpci/av7110_ca.c index 122c72806916..9fc1dd0ba4c3 100644 --- a/drivers/media/dvb/ttpci/av7110_ca.c +++ b/drivers/media/dvb/ttpci/av7110_ca.c | |||
@@ -277,7 +277,7 @@ static int dvb_ca_ioctl(struct file *file, unsigned int cmd, void *parg) | |||
277 | { | 277 | { |
278 | ca_slot_info_t *info=(ca_slot_info_t *)parg; | 278 | ca_slot_info_t *info=(ca_slot_info_t *)parg; |
279 | 279 | ||
280 | if (info->num > 1) | 280 | if (info->num < 0 || info->num > 1) |
281 | return -EINVAL; | 281 | return -EINVAL; |
282 | av7110->ci_slot[info->num].num = info->num; | 282 | av7110->ci_slot[info->num].num = info->num; |
283 | av7110->ci_slot[info->num].type = FW_CI_LL_SUPPORT(av7110->arm_app) ? | 283 | av7110->ci_slot[info->num].type = FW_CI_LL_SUPPORT(av7110->arm_app) ? |
diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig index 3c5a4739ed70..ecdffa6aac66 100644 --- a/drivers/media/radio/Kconfig +++ b/drivers/media/radio/Kconfig | |||
@@ -151,20 +151,6 @@ config RADIO_GEMTEK_PROBE | |||
151 | following ports will be probed: 0x20c, 0x30c, 0x24c, 0x34c, 0x248 and | 151 | following ports will be probed: 0x20c, 0x30c, 0x24c, 0x34c, 0x248 and |
152 | 0x28c. | 152 | 0x28c. |
153 | 153 | ||
154 | config RADIO_GEMTEK_PCI | ||
155 | tristate "GemTek PCI Radio Card support" | ||
156 | depends on VIDEO_V4L2 && PCI | ||
157 | ---help--- | ||
158 | Choose Y here if you have this PCI FM radio card. | ||
159 | |||
160 | In order to control your radio card, you will need to use programs | ||
161 | that are compatible with the Video for Linux API. Information on | ||
162 | this API and pointers to "v4l" programs may be found at | ||
163 | <file:Documentation/video4linux/API.html>. | ||
164 | |||
165 | To compile this driver as a module, choose M here: the | ||
166 | module will be called radio-gemtek-pci. | ||
167 | |||
168 | config RADIO_MAXIRADIO | 154 | config RADIO_MAXIRADIO |
169 | tristate "Guillemot MAXI Radio FM 2000 radio" | 155 | tristate "Guillemot MAXI Radio FM 2000 radio" |
170 | depends on VIDEO_V4L2 && PCI | 156 | depends on VIDEO_V4L2 && PCI |
diff --git a/drivers/media/radio/Makefile b/drivers/media/radio/Makefile index d2970748a69f..717656d2f749 100644 --- a/drivers/media/radio/Makefile +++ b/drivers/media/radio/Makefile | |||
@@ -13,7 +13,6 @@ obj-$(CONFIG_RADIO_MAXIRADIO) += radio-maxiradio.o | |||
13 | obj-$(CONFIG_RADIO_RTRACK) += radio-aimslab.o | 13 | obj-$(CONFIG_RADIO_RTRACK) += radio-aimslab.o |
14 | obj-$(CONFIG_RADIO_ZOLTRIX) += radio-zoltrix.o | 14 | obj-$(CONFIG_RADIO_ZOLTRIX) += radio-zoltrix.o |
15 | obj-$(CONFIG_RADIO_GEMTEK) += radio-gemtek.o | 15 | obj-$(CONFIG_RADIO_GEMTEK) += radio-gemtek.o |
16 | obj-$(CONFIG_RADIO_GEMTEK_PCI) += radio-gemtek-pci.o | ||
17 | obj-$(CONFIG_RADIO_TRUST) += radio-trust.o | 16 | obj-$(CONFIG_RADIO_TRUST) += radio-trust.o |
18 | obj-$(CONFIG_I2C_SI4713) += si4713-i2c.o | 17 | obj-$(CONFIG_I2C_SI4713) += si4713-i2c.o |
19 | obj-$(CONFIG_RADIO_SI4713) += radio-si4713.o | 18 | obj-$(CONFIG_RADIO_SI4713) += radio-si4713.o |
diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c index 6cc5d130fbc8..4ce10dbeadd8 100644 --- a/drivers/media/radio/radio-aimslab.c +++ b/drivers/media/radio/radio-aimslab.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/module.h> /* Modules */ | 31 | #include <linux/module.h> /* Modules */ |
32 | #include <linux/init.h> /* Initdata */ | 32 | #include <linux/init.h> /* Initdata */ |
33 | #include <linux/ioport.h> /* request_region */ | 33 | #include <linux/ioport.h> /* request_region */ |
34 | #include <linux/delay.h> /* msleep */ | ||
34 | #include <linux/videodev2.h> /* kernel radio structs */ | 35 | #include <linux/videodev2.h> /* kernel radio structs */ |
35 | #include <linux/version.h> /* for KERNEL_VERSION MACRO */ | 36 | #include <linux/version.h> /* for KERNEL_VERSION MACRO */ |
36 | #include <linux/io.h> /* outb, outb_p */ | 37 | #include <linux/io.h> /* outb, outb_p */ |
diff --git a/drivers/media/radio/radio-gemtek-pci.c b/drivers/media/radio/radio-gemtek-pci.c deleted file mode 100644 index 28fa85ba2087..000000000000 --- a/drivers/media/radio/radio-gemtek-pci.c +++ /dev/null | |||
@@ -1,478 +0,0 @@ | |||
1 | /* | ||
2 | *************************************************************************** | ||
3 | * | ||
4 | * radio-gemtek-pci.c - Gemtek PCI Radio driver | ||
5 | * (C) 2001 Vladimir Shebordaev <vshebordaev@mail.ru> | ||
6 | * | ||
7 | *************************************************************************** | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License as | ||
11 | * published by the Free Software Foundation; either version 2 of | ||
12 | * the License, or (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public | ||
20 | * License along with this program; if not, write to the Free | ||
21 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, | ||
22 | * USA. | ||
23 | * | ||
24 | *************************************************************************** | ||
25 | * | ||
26 | * Gemtek Corp still silently refuses to release any specifications | ||
27 | * of their multimedia devices, so the protocol still has to be | ||
28 | * reverse engineered. | ||
29 | * | ||
30 | * The v4l code was inspired by Jonas Munsin's Gemtek serial line | ||
31 | * radio device driver. | ||
32 | * | ||
33 | * Please, let me know if this piece of code was useful :) | ||
34 | * | ||
35 | * TODO: multiple device support and portability were not tested | ||
36 | * | ||
37 | * Converted to V4L2 API by Mauro Carvalho Chehab <mchehab@infradead.org> | ||
38 | * | ||
39 | *************************************************************************** | ||
40 | */ | ||
41 | |||
42 | #include <linux/types.h> | ||
43 | #include <linux/list.h> | ||
44 | #include <linux/module.h> | ||
45 | #include <linux/init.h> | ||
46 | #include <linux/pci.h> | ||
47 | #include <linux/videodev2.h> | ||
48 | #include <linux/errno.h> | ||
49 | #include <linux/version.h> /* for KERNEL_VERSION MACRO */ | ||
50 | #include <linux/io.h> | ||
51 | #include <linux/slab.h> | ||
52 | #include <media/v4l2-device.h> | ||
53 | #include <media/v4l2-ioctl.h> | ||
54 | |||
55 | MODULE_AUTHOR("Vladimir Shebordaev <vshebordaev@mail.ru>"); | ||
56 | MODULE_DESCRIPTION("The video4linux driver for the Gemtek PCI Radio Card"); | ||
57 | MODULE_LICENSE("GPL"); | ||
58 | |||
59 | static int nr_radio = -1; | ||
60 | static int mx = 1; | ||
61 | |||
62 | module_param(mx, bool, 0); | ||
63 | MODULE_PARM_DESC(mx, "single digit: 1 - turn off the turner upon module exit (default), 0 - do not"); | ||
64 | module_param(nr_radio, int, 0); | ||
65 | MODULE_PARM_DESC(nr_radio, "video4linux device number to use"); | ||
66 | |||
67 | #define RADIO_VERSION KERNEL_VERSION(0, 0, 2) | ||
68 | |||
69 | #ifndef PCI_VENDOR_ID_GEMTEK | ||
70 | #define PCI_VENDOR_ID_GEMTEK 0x5046 | ||
71 | #endif | ||
72 | |||
73 | #ifndef PCI_DEVICE_ID_GEMTEK_PR103 | ||
74 | #define PCI_DEVICE_ID_GEMTEK_PR103 0x1001 | ||
75 | #endif | ||
76 | |||
77 | #ifndef GEMTEK_PCI_RANGE_LOW | ||
78 | #define GEMTEK_PCI_RANGE_LOW (87*16000) | ||
79 | #endif | ||
80 | |||
81 | #ifndef GEMTEK_PCI_RANGE_HIGH | ||
82 | #define GEMTEK_PCI_RANGE_HIGH (108*16000) | ||
83 | #endif | ||
84 | |||
85 | struct gemtek_pci { | ||
86 | struct v4l2_device v4l2_dev; | ||
87 | struct video_device vdev; | ||
88 | struct mutex lock; | ||
89 | struct pci_dev *pdev; | ||
90 | |||
91 | u32 iobase; | ||
92 | u32 length; | ||
93 | |||
94 | u32 current_frequency; | ||
95 | u8 mute; | ||
96 | }; | ||
97 | |||
98 | static inline struct gemtek_pci *to_gemtek_pci(struct v4l2_device *v4l2_dev) | ||
99 | { | ||
100 | return container_of(v4l2_dev, struct gemtek_pci, v4l2_dev); | ||
101 | } | ||
102 | |||
103 | static inline u8 gemtek_pci_out(u16 value, u32 port) | ||
104 | { | ||
105 | outw(value, port); | ||
106 | |||
107 | return (u8)value; | ||
108 | } | ||
109 | |||
110 | #define _b0(v) (*((u8 *)&v)) | ||
111 | |||
112 | static void __gemtek_pci_cmd(u16 value, u32 port, u8 *last_byte, int keep) | ||
113 | { | ||
114 | u8 byte = *last_byte; | ||
115 | |||
116 | if (!value) { | ||
117 | if (!keep) | ||
118 | value = (u16)port; | ||
119 | byte &= 0xfd; | ||
120 | } else | ||
121 | byte |= 2; | ||
122 | |||
123 | _b0(value) = byte; | ||
124 | outw(value, port); | ||
125 | byte |= 1; | ||
126 | _b0(value) = byte; | ||
127 | outw(value, port); | ||
128 | byte &= 0xfe; | ||
129 | _b0(value) = byte; | ||
130 | outw(value, port); | ||
131 | |||
132 | *last_byte = byte; | ||
133 | } | ||
134 | |||
135 | static inline void gemtek_pci_nil(u32 port, u8 *last_byte) | ||
136 | { | ||
137 | __gemtek_pci_cmd(0x00, port, last_byte, false); | ||
138 | } | ||
139 | |||
140 | static inline void gemtek_pci_cmd(u16 cmd, u32 port, u8 *last_byte) | ||
141 | { | ||
142 | __gemtek_pci_cmd(cmd, port, last_byte, true); | ||
143 | } | ||
144 | |||
145 | static void gemtek_pci_setfrequency(struct gemtek_pci *card, unsigned long frequency) | ||
146 | { | ||
147 | int i; | ||
148 | u32 value = frequency / 200 + 856; | ||
149 | u16 mask = 0x8000; | ||
150 | u8 last_byte; | ||
151 | u32 port = card->iobase; | ||
152 | |||
153 | mutex_lock(&card->lock); | ||
154 | card->current_frequency = frequency; | ||
155 | last_byte = gemtek_pci_out(0x06, port); | ||
156 | |||
157 | i = 0; | ||
158 | do { | ||
159 | gemtek_pci_nil(port, &last_byte); | ||
160 | i++; | ||
161 | } while (i < 9); | ||
162 | |||
163 | i = 0; | ||
164 | do { | ||
165 | gemtek_pci_cmd(value & mask, port, &last_byte); | ||
166 | mask >>= 1; | ||
167 | i++; | ||
168 | } while (i < 16); | ||
169 | |||
170 | outw(0x10, port); | ||
171 | mutex_unlock(&card->lock); | ||
172 | } | ||
173 | |||
174 | |||
175 | static void gemtek_pci_mute(struct gemtek_pci *card) | ||
176 | { | ||
177 | mutex_lock(&card->lock); | ||
178 | outb(0x1f, card->iobase); | ||
179 | card->mute = true; | ||
180 | mutex_unlock(&card->lock); | ||
181 | } | ||
182 | |||
183 | static void gemtek_pci_unmute(struct gemtek_pci *card) | ||
184 | { | ||
185 | if (card->mute) { | ||
186 | gemtek_pci_setfrequency(card, card->current_frequency); | ||
187 | card->mute = false; | ||
188 | } | ||
189 | } | ||
190 | |||
191 | static int gemtek_pci_getsignal(struct gemtek_pci *card) | ||
192 | { | ||
193 | int sig; | ||
194 | |||
195 | mutex_lock(&card->lock); | ||
196 | sig = (inb(card->iobase) & 0x08) ? 0 : 1; | ||
197 | mutex_unlock(&card->lock); | ||
198 | return sig; | ||
199 | } | ||
200 | |||
201 | static int vidioc_querycap(struct file *file, void *priv, | ||
202 | struct v4l2_capability *v) | ||
203 | { | ||
204 | struct gemtek_pci *card = video_drvdata(file); | ||
205 | |||
206 | strlcpy(v->driver, "radio-gemtek-pci", sizeof(v->driver)); | ||
207 | strlcpy(v->card, "GemTek PCI Radio", sizeof(v->card)); | ||
208 | snprintf(v->bus_info, sizeof(v->bus_info), "PCI:%s", pci_name(card->pdev)); | ||
209 | v->version = RADIO_VERSION; | ||
210 | v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO; | ||
211 | return 0; | ||
212 | } | ||
213 | |||
214 | static int vidioc_g_tuner(struct file *file, void *priv, | ||
215 | struct v4l2_tuner *v) | ||
216 | { | ||
217 | struct gemtek_pci *card = video_drvdata(file); | ||
218 | |||
219 | if (v->index > 0) | ||
220 | return -EINVAL; | ||
221 | |||
222 | strlcpy(v->name, "FM", sizeof(v->name)); | ||
223 | v->type = V4L2_TUNER_RADIO; | ||
224 | v->rangelow = GEMTEK_PCI_RANGE_LOW; | ||
225 | v->rangehigh = GEMTEK_PCI_RANGE_HIGH; | ||
226 | v->rxsubchans = V4L2_TUNER_SUB_MONO; | ||
227 | v->capability = V4L2_TUNER_CAP_LOW; | ||
228 | v->audmode = V4L2_TUNER_MODE_MONO; | ||
229 | v->signal = 0xffff * gemtek_pci_getsignal(card); | ||
230 | return 0; | ||
231 | } | ||
232 | |||
233 | static int vidioc_s_tuner(struct file *file, void *priv, | ||
234 | struct v4l2_tuner *v) | ||
235 | { | ||
236 | return v->index ? -EINVAL : 0; | ||
237 | } | ||
238 | |||
239 | static int vidioc_s_frequency(struct file *file, void *priv, | ||
240 | struct v4l2_frequency *f) | ||
241 | { | ||
242 | struct gemtek_pci *card = video_drvdata(file); | ||
243 | |||
244 | if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO) | ||
245 | return -EINVAL; | ||
246 | if (f->frequency < GEMTEK_PCI_RANGE_LOW || | ||
247 | f->frequency > GEMTEK_PCI_RANGE_HIGH) | ||
248 | return -EINVAL; | ||
249 | gemtek_pci_setfrequency(card, f->frequency); | ||
250 | card->mute = false; | ||
251 | return 0; | ||
252 | } | ||
253 | |||
254 | static int vidioc_g_frequency(struct file *file, void *priv, | ||
255 | struct v4l2_frequency *f) | ||
256 | { | ||
257 | struct gemtek_pci *card = video_drvdata(file); | ||
258 | |||
259 | if (f->tuner != 0) | ||
260 | return -EINVAL; | ||
261 | f->type = V4L2_TUNER_RADIO; | ||
262 | f->frequency = card->current_frequency; | ||
263 | return 0; | ||
264 | } | ||
265 | |||
266 | static int vidioc_queryctrl(struct file *file, void *priv, | ||
267 | struct v4l2_queryctrl *qc) | ||
268 | { | ||
269 | switch (qc->id) { | ||
270 | case V4L2_CID_AUDIO_MUTE: | ||
271 | return v4l2_ctrl_query_fill(qc, 0, 1, 1, 1); | ||
272 | case V4L2_CID_AUDIO_VOLUME: | ||
273 | return v4l2_ctrl_query_fill(qc, 0, 65535, 65535, 65535); | ||
274 | } | ||
275 | return -EINVAL; | ||
276 | } | ||
277 | |||
278 | static int vidioc_g_ctrl(struct file *file, void *priv, | ||
279 | struct v4l2_control *ctrl) | ||
280 | { | ||
281 | struct gemtek_pci *card = video_drvdata(file); | ||
282 | |||
283 | switch (ctrl->id) { | ||
284 | case V4L2_CID_AUDIO_MUTE: | ||
285 | ctrl->value = card->mute; | ||
286 | return 0; | ||
287 | case V4L2_CID_AUDIO_VOLUME: | ||
288 | if (card->mute) | ||
289 | ctrl->value = 0; | ||
290 | else | ||
291 | ctrl->value = 65535; | ||
292 | return 0; | ||
293 | } | ||
294 | return -EINVAL; | ||
295 | } | ||
296 | |||
297 | static int vidioc_s_ctrl(struct file *file, void *priv, | ||
298 | struct v4l2_control *ctrl) | ||
299 | { | ||
300 | struct gemtek_pci *card = video_drvdata(file); | ||
301 | |||
302 | switch (ctrl->id) { | ||
303 | case V4L2_CID_AUDIO_MUTE: | ||
304 | if (ctrl->value) | ||
305 | gemtek_pci_mute(card); | ||
306 | else | ||
307 | gemtek_pci_unmute(card); | ||
308 | return 0; | ||
309 | case V4L2_CID_AUDIO_VOLUME: | ||
310 | if (ctrl->value) | ||
311 | gemtek_pci_unmute(card); | ||
312 | else | ||
313 | gemtek_pci_mute(card); | ||
314 | return 0; | ||
315 | } | ||
316 | return -EINVAL; | ||
317 | } | ||
318 | |||
319 | static int vidioc_g_input(struct file *filp, void *priv, unsigned int *i) | ||
320 | { | ||
321 | *i = 0; | ||
322 | return 0; | ||
323 | } | ||
324 | |||
325 | static int vidioc_s_input(struct file *filp, void *priv, unsigned int i) | ||
326 | { | ||
327 | return i ? -EINVAL : 0; | ||
328 | } | ||
329 | |||
330 | static int vidioc_g_audio(struct file *file, void *priv, | ||
331 | struct v4l2_audio *a) | ||
332 | { | ||
333 | a->index = 0; | ||
334 | strlcpy(a->name, "Radio", sizeof(a->name)); | ||
335 | a->capability = V4L2_AUDCAP_STEREO; | ||
336 | return 0; | ||
337 | } | ||
338 | |||
339 | static int vidioc_s_audio(struct file *file, void *priv, | ||
340 | struct v4l2_audio *a) | ||
341 | { | ||
342 | return a->index ? -EINVAL : 0; | ||
343 | } | ||
344 | |||
345 | enum { | ||
346 | GEMTEK_PR103 | ||
347 | }; | ||
348 | |||
349 | static char *card_names[] __devinitdata = { | ||
350 | "GEMTEK_PR103" | ||
351 | }; | ||
352 | |||
353 | static struct pci_device_id gemtek_pci_id[] = | ||
354 | { | ||
355 | { PCI_VENDOR_ID_GEMTEK, PCI_DEVICE_ID_GEMTEK_PR103, | ||
356 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, GEMTEK_PR103 }, | ||
357 | { 0 } | ||
358 | }; | ||
359 | |||
360 | MODULE_DEVICE_TABLE(pci, gemtek_pci_id); | ||
361 | |||
362 | static const struct v4l2_file_operations gemtek_pci_fops = { | ||
363 | .owner = THIS_MODULE, | ||
364 | .unlocked_ioctl = video_ioctl2, | ||
365 | }; | ||
366 | |||
367 | static const struct v4l2_ioctl_ops gemtek_pci_ioctl_ops = { | ||
368 | .vidioc_querycap = vidioc_querycap, | ||
369 | .vidioc_g_tuner = vidioc_g_tuner, | ||
370 | .vidioc_s_tuner = vidioc_s_tuner, | ||
371 | .vidioc_g_audio = vidioc_g_audio, | ||
372 | .vidioc_s_audio = vidioc_s_audio, | ||
373 | .vidioc_g_input = vidioc_g_input, | ||
374 | .vidioc_s_input = vidioc_s_input, | ||
375 | .vidioc_g_frequency = vidioc_g_frequency, | ||
376 | .vidioc_s_frequency = vidioc_s_frequency, | ||
377 | .vidioc_queryctrl = vidioc_queryctrl, | ||
378 | .vidioc_g_ctrl = vidioc_g_ctrl, | ||
379 | .vidioc_s_ctrl = vidioc_s_ctrl, | ||
380 | }; | ||
381 | |||
382 | static int __devinit gemtek_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) | ||
383 | { | ||
384 | struct gemtek_pci *card; | ||
385 | struct v4l2_device *v4l2_dev; | ||
386 | int res; | ||
387 | |||
388 | card = kzalloc(sizeof(struct gemtek_pci), GFP_KERNEL); | ||
389 | if (card == NULL) { | ||
390 | dev_err(&pdev->dev, "out of memory\n"); | ||
391 | return -ENOMEM; | ||
392 | } | ||
393 | |||
394 | v4l2_dev = &card->v4l2_dev; | ||
395 | mutex_init(&card->lock); | ||
396 | card->pdev = pdev; | ||
397 | |||
398 | strlcpy(v4l2_dev->name, "gemtek_pci", sizeof(v4l2_dev->name)); | ||
399 | |||
400 | res = v4l2_device_register(&pdev->dev, v4l2_dev); | ||
401 | if (res < 0) { | ||
402 | v4l2_err(v4l2_dev, "Could not register v4l2_device\n"); | ||
403 | kfree(card); | ||
404 | return res; | ||
405 | } | ||
406 | |||
407 | if (pci_enable_device(pdev)) | ||
408 | goto err_pci; | ||
409 | |||
410 | card->iobase = pci_resource_start(pdev, 0); | ||
411 | card->length = pci_resource_len(pdev, 0); | ||
412 | |||
413 | if (request_region(card->iobase, card->length, card_names[pci_id->driver_data]) == NULL) { | ||
414 | v4l2_err(v4l2_dev, "i/o port already in use\n"); | ||
415 | goto err_pci; | ||
416 | } | ||
417 | |||
418 | strlcpy(card->vdev.name, v4l2_dev->name, sizeof(card->vdev.name)); | ||
419 | card->vdev.v4l2_dev = v4l2_dev; | ||
420 | card->vdev.fops = &gemtek_pci_fops; | ||
421 | card->vdev.ioctl_ops = &gemtek_pci_ioctl_ops; | ||
422 | card->vdev.release = video_device_release_empty; | ||
423 | video_set_drvdata(&card->vdev, card); | ||
424 | |||
425 | gemtek_pci_mute(card); | ||
426 | |||
427 | if (video_register_device(&card->vdev, VFL_TYPE_RADIO, nr_radio) < 0) | ||
428 | goto err_video; | ||
429 | |||
430 | v4l2_info(v4l2_dev, "Gemtek PCI Radio (rev. %d) found at 0x%04x-0x%04x.\n", | ||
431 | pdev->revision, card->iobase, card->iobase + card->length - 1); | ||
432 | |||
433 | return 0; | ||
434 | |||
435 | err_video: | ||
436 | release_region(card->iobase, card->length); | ||
437 | |||
438 | err_pci: | ||
439 | v4l2_device_unregister(v4l2_dev); | ||
440 | kfree(card); | ||
441 | return -ENODEV; | ||
442 | } | ||
443 | |||
444 | static void __devexit gemtek_pci_remove(struct pci_dev *pdev) | ||
445 | { | ||
446 | struct v4l2_device *v4l2_dev = dev_get_drvdata(&pdev->dev); | ||
447 | struct gemtek_pci *card = to_gemtek_pci(v4l2_dev); | ||
448 | |||
449 | video_unregister_device(&card->vdev); | ||
450 | v4l2_device_unregister(v4l2_dev); | ||
451 | |||
452 | release_region(card->iobase, card->length); | ||
453 | |||
454 | if (mx) | ||
455 | gemtek_pci_mute(card); | ||
456 | |||
457 | kfree(card); | ||
458 | } | ||
459 | |||
460 | static struct pci_driver gemtek_pci_driver = { | ||
461 | .name = "gemtek_pci", | ||
462 | .id_table = gemtek_pci_id, | ||
463 | .probe = gemtek_pci_probe, | ||
464 | .remove = __devexit_p(gemtek_pci_remove), | ||
465 | }; | ||
466 | |||
467 | static int __init gemtek_pci_init(void) | ||
468 | { | ||
469 | return pci_register_driver(&gemtek_pci_driver); | ||
470 | } | ||
471 | |||
472 | static void __exit gemtek_pci_exit(void) | ||
473 | { | ||
474 | pci_unregister_driver(&gemtek_pci_driver); | ||
475 | } | ||
476 | |||
477 | module_init(gemtek_pci_init); | ||
478 | module_exit(gemtek_pci_exit); | ||
diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c index 6459a220b0dd..5c2a9058c09f 100644 --- a/drivers/media/radio/radio-maxiradio.c +++ b/drivers/media/radio/radio-maxiradio.c | |||
@@ -77,8 +77,8 @@ MODULE_PARM_DESC(debug, "activates debug info"); | |||
77 | /* TEA5757 pin mappings */ | 77 | /* TEA5757 pin mappings */ |
78 | static const int clk = 1, data = 2, wren = 4, mo_st = 8, power = 16; | 78 | static const int clk = 1, data = 2, wren = 4, mo_st = 8, power = 16; |
79 | 79 | ||
80 | #define FREQ_LO (50 * 16000) | 80 | #define FREQ_LO (87 * 16000) |
81 | #define FREQ_HI (150 * 16000) | 81 | #define FREQ_HI (108 * 16000) |
82 | 82 | ||
83 | #define FREQ_IF 171200 /* 10.7*16000 */ | 83 | #define FREQ_IF 171200 /* 10.7*16000 */ |
84 | #define FREQ_STEP 200 /* 12.5*16 */ | 84 | #define FREQ_STEP 200 /* 12.5*16 */ |
diff --git a/drivers/media/radio/radio-wl1273.c b/drivers/media/radio/radio-wl1273.c index dd6bd364efa0..7ecc8e657663 100644 --- a/drivers/media/radio/radio-wl1273.c +++ b/drivers/media/radio/radio-wl1273.c | |||
@@ -1407,7 +1407,7 @@ static const struct v4l2_file_operations wl1273_fops = { | |||
1407 | .read = wl1273_fm_fops_read, | 1407 | .read = wl1273_fm_fops_read, |
1408 | .write = wl1273_fm_fops_write, | 1408 | .write = wl1273_fm_fops_write, |
1409 | .poll = wl1273_fm_fops_poll, | 1409 | .poll = wl1273_fm_fops_poll, |
1410 | .ioctl = video_ioctl2, | 1410 | .unlocked_ioctl = video_ioctl2, |
1411 | .open = wl1273_fm_fops_open, | 1411 | .open = wl1273_fm_fops_open, |
1412 | .release = wl1273_fm_fops_release, | 1412 | .release = wl1273_fm_fops_release, |
1413 | }; | 1413 | }; |
diff --git a/drivers/media/radio/si470x/radio-si470x-common.c b/drivers/media/radio/si470x/radio-si470x-common.c index ac76dfe5b3fa..60c176fe328e 100644 --- a/drivers/media/radio/si470x/radio-si470x-common.c +++ b/drivers/media/radio/si470x/radio-si470x-common.c | |||
@@ -357,7 +357,8 @@ int si470x_start(struct si470x_device *radio) | |||
357 | goto done; | 357 | goto done; |
358 | 358 | ||
359 | /* sysconfig 1 */ | 359 | /* sysconfig 1 */ |
360 | radio->registers[SYSCONFIG1] = SYSCONFIG1_DE; | 360 | radio->registers[SYSCONFIG1] = |
361 | (de << 11) & SYSCONFIG1_DE; /* DE*/ | ||
361 | retval = si470x_set_register(radio, SYSCONFIG1); | 362 | retval = si470x_set_register(radio, SYSCONFIG1); |
362 | if (retval < 0) | 363 | if (retval < 0) |
363 | goto done; | 364 | goto done; |
@@ -687,12 +688,8 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv, | |||
687 | /* driver constants */ | 688 | /* driver constants */ |
688 | strcpy(tuner->name, "FM"); | 689 | strcpy(tuner->name, "FM"); |
689 | tuner->type = V4L2_TUNER_RADIO; | 690 | tuner->type = V4L2_TUNER_RADIO; |
690 | #if defined(CONFIG_USB_SI470X) || defined(CONFIG_USB_SI470X_MODULE) | ||
691 | tuner->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO | | 691 | tuner->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO | |
692 | V4L2_TUNER_CAP_RDS | V4L2_TUNER_CAP_RDS_BLOCK_IO; | 692 | V4L2_TUNER_CAP_RDS | V4L2_TUNER_CAP_RDS_BLOCK_IO; |
693 | #else | ||
694 | tuner->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; | ||
695 | #endif | ||
696 | 693 | ||
697 | /* range limits */ | 694 | /* range limits */ |
698 | switch ((radio->registers[SYSCONFIG2] & SYSCONFIG2_BAND) >> 6) { | 695 | switch ((radio->registers[SYSCONFIG2] & SYSCONFIG2_BAND) >> 6) { |
@@ -718,12 +715,10 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv, | |||
718 | tuner->rxsubchans = V4L2_TUNER_SUB_MONO; | 715 | tuner->rxsubchans = V4L2_TUNER_SUB_MONO; |
719 | else | 716 | else |
720 | tuner->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; | 717 | tuner->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; |
721 | #if defined(CONFIG_USB_SI470X) || defined(CONFIG_USB_SI470X_MODULE) | ||
722 | /* If there is a reliable method of detecting an RDS channel, | 718 | /* If there is a reliable method of detecting an RDS channel, |
723 | then this code should check for that before setting this | 719 | then this code should check for that before setting this |
724 | RDS subchannel. */ | 720 | RDS subchannel. */ |
725 | tuner->rxsubchans |= V4L2_TUNER_SUB_RDS; | 721 | tuner->rxsubchans |= V4L2_TUNER_SUB_RDS; |
726 | #endif | ||
727 | 722 | ||
728 | /* mono/stereo selector */ | 723 | /* mono/stereo selector */ |
729 | if ((radio->registers[POWERCFG] & POWERCFG_MONO) == 0) | 724 | if ((radio->registers[POWERCFG] & POWERCFG_MONO) == 0) |
diff --git a/drivers/media/rc/ene_ir.c b/drivers/media/rc/ene_ir.c index 80b3c319f698..1ac49139158d 100644 --- a/drivers/media/rc/ene_ir.c +++ b/drivers/media/rc/ene_ir.c | |||
@@ -446,27 +446,27 @@ static void ene_rx_setup(struct ene_device *dev) | |||
446 | 446 | ||
447 | select_timeout: | 447 | select_timeout: |
448 | if (dev->rx_fan_input_inuse) { | 448 | if (dev->rx_fan_input_inuse) { |
449 | dev->rdev->rx_resolution = MS_TO_NS(ENE_FW_SAMPLE_PERIOD_FAN); | 449 | dev->rdev->rx_resolution = US_TO_NS(ENE_FW_SAMPLE_PERIOD_FAN); |
450 | 450 | ||
451 | /* Fan input doesn't support timeouts, it just ends the | 451 | /* Fan input doesn't support timeouts, it just ends the |
452 | input with a maximum sample */ | 452 | input with a maximum sample */ |
453 | dev->rdev->min_timeout = dev->rdev->max_timeout = | 453 | dev->rdev->min_timeout = dev->rdev->max_timeout = |
454 | MS_TO_NS(ENE_FW_SMPL_BUF_FAN_MSK * | 454 | US_TO_NS(ENE_FW_SMPL_BUF_FAN_MSK * |
455 | ENE_FW_SAMPLE_PERIOD_FAN); | 455 | ENE_FW_SAMPLE_PERIOD_FAN); |
456 | } else { | 456 | } else { |
457 | dev->rdev->rx_resolution = MS_TO_NS(sample_period); | 457 | dev->rdev->rx_resolution = US_TO_NS(sample_period); |
458 | 458 | ||
459 | /* Theoreticly timeout is unlimited, but we cap it | 459 | /* Theoreticly timeout is unlimited, but we cap it |
460 | * because it was seen that on one device, it | 460 | * because it was seen that on one device, it |
461 | * would stop sending spaces after around 250 msec. | 461 | * would stop sending spaces after around 250 msec. |
462 | * Besides, this is close to 2^32 anyway and timeout is u32. | 462 | * Besides, this is close to 2^32 anyway and timeout is u32. |
463 | */ | 463 | */ |
464 | dev->rdev->min_timeout = MS_TO_NS(127 * sample_period); | 464 | dev->rdev->min_timeout = US_TO_NS(127 * sample_period); |
465 | dev->rdev->max_timeout = MS_TO_NS(200000); | 465 | dev->rdev->max_timeout = US_TO_NS(200000); |
466 | } | 466 | } |
467 | 467 | ||
468 | if (dev->hw_learning_and_tx_capable) | 468 | if (dev->hw_learning_and_tx_capable) |
469 | dev->rdev->tx_resolution = MS_TO_NS(sample_period); | 469 | dev->rdev->tx_resolution = US_TO_NS(sample_period); |
470 | 470 | ||
471 | if (dev->rdev->timeout > dev->rdev->max_timeout) | 471 | if (dev->rdev->timeout > dev->rdev->max_timeout) |
472 | dev->rdev->timeout = dev->rdev->max_timeout; | 472 | dev->rdev->timeout = dev->rdev->max_timeout; |
@@ -801,7 +801,7 @@ static irqreturn_t ene_isr(int irq, void *data) | |||
801 | 801 | ||
802 | dbg("RX: %d (%s)", hw_sample, pulse ? "pulse" : "space"); | 802 | dbg("RX: %d (%s)", hw_sample, pulse ? "pulse" : "space"); |
803 | 803 | ||
804 | ev.duration = MS_TO_NS(hw_sample); | 804 | ev.duration = US_TO_NS(hw_sample); |
805 | ev.pulse = pulse; | 805 | ev.pulse = pulse; |
806 | ir_raw_event_store_with_filter(dev->rdev, &ev); | 806 | ir_raw_event_store_with_filter(dev->rdev, &ev); |
807 | } | 807 | } |
@@ -821,7 +821,7 @@ static void ene_setup_default_settings(struct ene_device *dev) | |||
821 | dev->learning_mode_enabled = learning_mode_force; | 821 | dev->learning_mode_enabled = learning_mode_force; |
822 | 822 | ||
823 | /* Set reasonable default timeout */ | 823 | /* Set reasonable default timeout */ |
824 | dev->rdev->timeout = MS_TO_NS(150000); | 824 | dev->rdev->timeout = US_TO_NS(150000); |
825 | } | 825 | } |
826 | 826 | ||
827 | /* Upload all hardware settings at once. Used at load and resume time */ | 827 | /* Upload all hardware settings at once. Used at load and resume time */ |
@@ -1004,6 +1004,10 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) | |||
1004 | /* validate resources */ | 1004 | /* validate resources */ |
1005 | error = -ENODEV; | 1005 | error = -ENODEV; |
1006 | 1006 | ||
1007 | /* init these to -1, as 0 is valid for both */ | ||
1008 | dev->hw_io = -1; | ||
1009 | dev->irq = -1; | ||
1010 | |||
1007 | if (!pnp_port_valid(pnp_dev, 0) || | 1011 | if (!pnp_port_valid(pnp_dev, 0) || |
1008 | pnp_port_len(pnp_dev, 0) < ENE_IO_SIZE) | 1012 | pnp_port_len(pnp_dev, 0) < ENE_IO_SIZE) |
1009 | goto error; | 1013 | goto error; |
@@ -1072,6 +1076,8 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) | |||
1072 | rdev->input_name = "ENE eHome Infrared Remote Transceiver"; | 1076 | rdev->input_name = "ENE eHome Infrared Remote Transceiver"; |
1073 | } | 1077 | } |
1074 | 1078 | ||
1079 | dev->rdev = rdev; | ||
1080 | |||
1075 | ene_rx_setup_hw_buffer(dev); | 1081 | ene_rx_setup_hw_buffer(dev); |
1076 | ene_setup_default_settings(dev); | 1082 | ene_setup_default_settings(dev); |
1077 | ene_setup_hw_settings(dev); | 1083 | ene_setup_hw_settings(dev); |
@@ -1083,7 +1089,6 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) | |||
1083 | if (error < 0) | 1089 | if (error < 0) |
1084 | goto error; | 1090 | goto error; |
1085 | 1091 | ||
1086 | dev->rdev = rdev; | ||
1087 | ene_notice("driver has been succesfully loaded"); | 1092 | ene_notice("driver has been succesfully loaded"); |
1088 | return 0; | 1093 | return 0; |
1089 | error: | 1094 | error: |
diff --git a/drivers/media/rc/ene_ir.h b/drivers/media/rc/ene_ir.h index c179baf34cb4..337a41d4450b 100644 --- a/drivers/media/rc/ene_ir.h +++ b/drivers/media/rc/ene_ir.h | |||
@@ -201,8 +201,6 @@ | |||
201 | #define dbg_verbose(format, ...) __dbg(2, format, ## __VA_ARGS__) | 201 | #define dbg_verbose(format, ...) __dbg(2, format, ## __VA_ARGS__) |
202 | #define dbg_regs(format, ...) __dbg(3, format, ## __VA_ARGS__) | 202 | #define dbg_regs(format, ...) __dbg(3, format, ## __VA_ARGS__) |
203 | 203 | ||
204 | #define MS_TO_NS(msec) ((msec) * 1000) | ||
205 | |||
206 | struct ene_device { | 204 | struct ene_device { |
207 | struct pnp_dev *pnp_dev; | 205 | struct pnp_dev *pnp_dev; |
208 | struct rc_dev *rdev; | 206 | struct rc_dev *rdev; |
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index 6811512b4e83..e7dc6b46fdfa 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c | |||
@@ -988,7 +988,6 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type) | |||
988 | int retval; | 988 | int retval; |
989 | struct imon_context *ictx = rc->priv; | 989 | struct imon_context *ictx = rc->priv; |
990 | struct device *dev = ictx->dev; | 990 | struct device *dev = ictx->dev; |
991 | bool pad_mouse; | ||
992 | unsigned char ir_proto_packet[] = { | 991 | unsigned char ir_proto_packet[] = { |
993 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 }; | 992 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 }; |
994 | 993 | ||
@@ -1000,29 +999,20 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type) | |||
1000 | case RC_TYPE_RC6: | 999 | case RC_TYPE_RC6: |
1001 | dev_dbg(dev, "Configuring IR receiver for MCE protocol\n"); | 1000 | dev_dbg(dev, "Configuring IR receiver for MCE protocol\n"); |
1002 | ir_proto_packet[0] = 0x01; | 1001 | ir_proto_packet[0] = 0x01; |
1003 | pad_mouse = false; | ||
1004 | break; | 1002 | break; |
1005 | case RC_TYPE_UNKNOWN: | 1003 | case RC_TYPE_UNKNOWN: |
1006 | case RC_TYPE_OTHER: | 1004 | case RC_TYPE_OTHER: |
1007 | dev_dbg(dev, "Configuring IR receiver for iMON protocol\n"); | 1005 | dev_dbg(dev, "Configuring IR receiver for iMON protocol\n"); |
1008 | if (pad_stabilize && !nomouse) | 1006 | if (!pad_stabilize) |
1009 | pad_mouse = true; | ||
1010 | else { | ||
1011 | dev_dbg(dev, "PAD stabilize functionality disabled\n"); | 1007 | dev_dbg(dev, "PAD stabilize functionality disabled\n"); |
1012 | pad_mouse = false; | ||
1013 | } | ||
1014 | /* ir_proto_packet[0] = 0x00; // already the default */ | 1008 | /* ir_proto_packet[0] = 0x00; // already the default */ |
1015 | rc_type = RC_TYPE_OTHER; | 1009 | rc_type = RC_TYPE_OTHER; |
1016 | break; | 1010 | break; |
1017 | default: | 1011 | default: |
1018 | dev_warn(dev, "Unsupported IR protocol specified, overriding " | 1012 | dev_warn(dev, "Unsupported IR protocol specified, overriding " |
1019 | "to iMON IR protocol\n"); | 1013 | "to iMON IR protocol\n"); |
1020 | if (pad_stabilize && !nomouse) | 1014 | if (!pad_stabilize) |
1021 | pad_mouse = true; | ||
1022 | else { | ||
1023 | dev_dbg(dev, "PAD stabilize functionality disabled\n"); | 1015 | dev_dbg(dev, "PAD stabilize functionality disabled\n"); |
1024 | pad_mouse = false; | ||
1025 | } | ||
1026 | /* ir_proto_packet[0] = 0x00; // already the default */ | 1016 | /* ir_proto_packet[0] = 0x00; // already the default */ |
1027 | rc_type = RC_TYPE_OTHER; | 1017 | rc_type = RC_TYPE_OTHER; |
1028 | break; | 1018 | break; |
@@ -1035,7 +1025,7 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type) | |||
1035 | goto out; | 1025 | goto out; |
1036 | 1026 | ||
1037 | ictx->rc_type = rc_type; | 1027 | ictx->rc_type = rc_type; |
1038 | ictx->pad_mouse = pad_mouse; | 1028 | ictx->pad_mouse = false; |
1039 | 1029 | ||
1040 | out: | 1030 | out: |
1041 | return retval; | 1031 | return retval; |
@@ -1517,7 +1507,7 @@ static void imon_incoming_packet(struct imon_context *ictx, | |||
1517 | spin_unlock_irqrestore(&ictx->kc_lock, flags); | 1507 | spin_unlock_irqrestore(&ictx->kc_lock, flags); |
1518 | return; | 1508 | return; |
1519 | } else { | 1509 | } else { |
1520 | ictx->pad_mouse = 0; | 1510 | ictx->pad_mouse = false; |
1521 | dev_dbg(dev, "mouse mode disabled, passing key value\n"); | 1511 | dev_dbg(dev, "mouse mode disabled, passing key value\n"); |
1522 | } | 1512 | } |
1523 | } | 1513 | } |
@@ -1756,7 +1746,6 @@ static void imon_get_ffdc_type(struct imon_context *ictx) | |||
1756 | printk(KERN_CONT " (id 0x%02x)\n", ffdc_cfg_byte); | 1746 | printk(KERN_CONT " (id 0x%02x)\n", ffdc_cfg_byte); |
1757 | 1747 | ||
1758 | ictx->display_type = detected_display_type; | 1748 | ictx->display_type = detected_display_type; |
1759 | ictx->rdev->allowed_protos = allowed_protos; | ||
1760 | ictx->rc_type = allowed_protos; | 1749 | ictx->rc_type = allowed_protos; |
1761 | } | 1750 | } |
1762 | 1751 | ||
@@ -1839,10 +1828,6 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx) | |||
1839 | rdev->allowed_protos = RC_TYPE_OTHER | RC_TYPE_RC6; /* iMON PAD or MCE */ | 1828 | rdev->allowed_protos = RC_TYPE_OTHER | RC_TYPE_RC6; /* iMON PAD or MCE */ |
1840 | rdev->change_protocol = imon_ir_change_protocol; | 1829 | rdev->change_protocol = imon_ir_change_protocol; |
1841 | rdev->driver_name = MOD_NAME; | 1830 | rdev->driver_name = MOD_NAME; |
1842 | if (ictx->rc_type == RC_TYPE_RC6) | ||
1843 | rdev->map_name = RC_MAP_IMON_MCE; | ||
1844 | else | ||
1845 | rdev->map_name = RC_MAP_IMON_PAD; | ||
1846 | 1831 | ||
1847 | /* Enable front-panel buttons and/or knobs */ | 1832 | /* Enable front-panel buttons and/or knobs */ |
1848 | memcpy(ictx->usb_tx_buf, &fp_packet, sizeof(fp_packet)); | 1833 | memcpy(ictx->usb_tx_buf, &fp_packet, sizeof(fp_packet)); |
@@ -1851,11 +1836,18 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx) | |||
1851 | if (ret) | 1836 | if (ret) |
1852 | dev_info(ictx->dev, "panel buttons/knobs setup failed\n"); | 1837 | dev_info(ictx->dev, "panel buttons/knobs setup failed\n"); |
1853 | 1838 | ||
1854 | if (ictx->product == 0xffdc) | 1839 | if (ictx->product == 0xffdc) { |
1855 | imon_get_ffdc_type(ictx); | 1840 | imon_get_ffdc_type(ictx); |
1841 | rdev->allowed_protos = ictx->rc_type; | ||
1842 | } | ||
1856 | 1843 | ||
1857 | imon_set_display_type(ictx); | 1844 | imon_set_display_type(ictx); |
1858 | 1845 | ||
1846 | if (ictx->rc_type == RC_TYPE_RC6) | ||
1847 | rdev->map_name = RC_MAP_IMON_MCE; | ||
1848 | else | ||
1849 | rdev->map_name = RC_MAP_IMON_PAD; | ||
1850 | |||
1859 | ret = rc_register_device(rdev); | 1851 | ret = rc_register_device(rdev); |
1860 | if (ret < 0) { | 1852 | if (ret < 0) { |
1861 | dev_err(ictx->dev, "remote input dev register failed\n"); | 1853 | dev_err(ictx->dev, "remote input dev register failed\n"); |
@@ -2108,18 +2100,6 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf) | |||
2108 | goto find_endpoint_failed; | 2100 | goto find_endpoint_failed; |
2109 | } | 2101 | } |
2110 | 2102 | ||
2111 | ictx->idev = imon_init_idev(ictx); | ||
2112 | if (!ictx->idev) { | ||
2113 | dev_err(dev, "%s: input device setup failed\n", __func__); | ||
2114 | goto idev_setup_failed; | ||
2115 | } | ||
2116 | |||
2117 | ictx->rdev = imon_init_rdev(ictx); | ||
2118 | if (!ictx->rdev) { | ||
2119 | dev_err(dev, "%s: rc device setup failed\n", __func__); | ||
2120 | goto rdev_setup_failed; | ||
2121 | } | ||
2122 | |||
2123 | usb_fill_int_urb(ictx->rx_urb_intf0, ictx->usbdev_intf0, | 2103 | usb_fill_int_urb(ictx->rx_urb_intf0, ictx->usbdev_intf0, |
2124 | usb_rcvintpipe(ictx->usbdev_intf0, | 2104 | usb_rcvintpipe(ictx->usbdev_intf0, |
2125 | ictx->rx_endpoint_intf0->bEndpointAddress), | 2105 | ictx->rx_endpoint_intf0->bEndpointAddress), |
@@ -2133,13 +2113,25 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf) | |||
2133 | goto urb_submit_failed; | 2113 | goto urb_submit_failed; |
2134 | } | 2114 | } |
2135 | 2115 | ||
2116 | ictx->idev = imon_init_idev(ictx); | ||
2117 | if (!ictx->idev) { | ||
2118 | dev_err(dev, "%s: input device setup failed\n", __func__); | ||
2119 | goto idev_setup_failed; | ||
2120 | } | ||
2121 | |||
2122 | ictx->rdev = imon_init_rdev(ictx); | ||
2123 | if (!ictx->rdev) { | ||
2124 | dev_err(dev, "%s: rc device setup failed\n", __func__); | ||
2125 | goto rdev_setup_failed; | ||
2126 | } | ||
2127 | |||
2136 | return ictx; | 2128 | return ictx; |
2137 | 2129 | ||
2138 | urb_submit_failed: | ||
2139 | rc_unregister_device(ictx->rdev); | ||
2140 | rdev_setup_failed: | 2130 | rdev_setup_failed: |
2141 | input_unregister_device(ictx->idev); | 2131 | input_unregister_device(ictx->idev); |
2142 | idev_setup_failed: | 2132 | idev_setup_failed: |
2133 | usb_kill_urb(ictx->rx_urb_intf0); | ||
2134 | urb_submit_failed: | ||
2143 | find_endpoint_failed: | 2135 | find_endpoint_failed: |
2144 | mutex_unlock(&ictx->lock); | 2136 | mutex_unlock(&ictx->lock); |
2145 | usb_free_urb(tx_urb); | 2137 | usb_free_urb(tx_urb); |
diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c index f011c5d9dea1..1c5cc65ea1e1 100644 --- a/drivers/media/rc/ir-lirc-codec.c +++ b/drivers/media/rc/ir-lirc-codec.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* ir-lirc-codec.c - ir-core to classic lirc interface bridge | 1 | /* ir-lirc-codec.c - rc-core to classic lirc interface bridge |
2 | * | 2 | * |
3 | * Copyright (C) 2010 by Jarod Wilson <jarod@redhat.com> | 3 | * Copyright (C) 2010 by Jarod Wilson <jarod@redhat.com> |
4 | * | 4 | * |
@@ -47,6 +47,7 @@ static int ir_lirc_decode(struct rc_dev *dev, struct ir_raw_event ev) | |||
47 | /* Carrier reports */ | 47 | /* Carrier reports */ |
48 | if (ev.carrier_report) { | 48 | if (ev.carrier_report) { |
49 | sample = LIRC_FREQUENCY(ev.carrier); | 49 | sample = LIRC_FREQUENCY(ev.carrier); |
50 | IR_dprintk(2, "carrier report (freq: %d)\n", sample); | ||
50 | 51 | ||
51 | /* Packet end */ | 52 | /* Packet end */ |
52 | } else if (ev.timeout) { | 53 | } else if (ev.timeout) { |
@@ -62,6 +63,7 @@ static int ir_lirc_decode(struct rc_dev *dev, struct ir_raw_event ev) | |||
62 | return 0; | 63 | return 0; |
63 | 64 | ||
64 | sample = LIRC_TIMEOUT(ev.duration / 1000); | 65 | sample = LIRC_TIMEOUT(ev.duration / 1000); |
66 | IR_dprintk(2, "timeout report (duration: %d)\n", sample); | ||
65 | 67 | ||
66 | /* Normal sample */ | 68 | /* Normal sample */ |
67 | } else { | 69 | } else { |
@@ -85,6 +87,8 @@ static int ir_lirc_decode(struct rc_dev *dev, struct ir_raw_event ev) | |||
85 | 87 | ||
86 | sample = ev.pulse ? LIRC_PULSE(ev.duration / 1000) : | 88 | sample = ev.pulse ? LIRC_PULSE(ev.duration / 1000) : |
87 | LIRC_SPACE(ev.duration / 1000); | 89 | LIRC_SPACE(ev.duration / 1000); |
90 | IR_dprintk(2, "delivering %uus %s to lirc_dev\n", | ||
91 | TO_US(ev.duration), TO_STR(ev.pulse)); | ||
88 | } | 92 | } |
89 | 93 | ||
90 | lirc_buffer_write(dev->raw->lirc.drv->rbuf, | 94 | lirc_buffer_write(dev->raw->lirc.drv->rbuf, |
diff --git a/drivers/media/rc/ir-raw.c b/drivers/media/rc/ir-raw.c index 185baddcbf14..73230ff93b8a 100644 --- a/drivers/media/rc/ir-raw.c +++ b/drivers/media/rc/ir-raw.c | |||
@@ -233,7 +233,7 @@ EXPORT_SYMBOL_GPL(ir_raw_event_handle); | |||
233 | 233 | ||
234 | /* used internally by the sysfs interface */ | 234 | /* used internally by the sysfs interface */ |
235 | u64 | 235 | u64 |
236 | ir_raw_get_allowed_protocols() | 236 | ir_raw_get_allowed_protocols(void) |
237 | { | 237 | { |
238 | u64 protocols; | 238 | u64 protocols; |
239 | mutex_lock(&ir_raw_handler_lock); | 239 | mutex_lock(&ir_raw_handler_lock); |
diff --git a/drivers/media/rc/keymaps/rc-dib0700-nec.c b/drivers/media/rc/keymaps/rc-dib0700-nec.c index c59851b203da..7a5f5300caf9 100644 --- a/drivers/media/rc/keymaps/rc-dib0700-nec.c +++ b/drivers/media/rc/keymaps/rc-dib0700-nec.c | |||
@@ -19,35 +19,35 @@ | |||
19 | 19 | ||
20 | static struct rc_map_table dib0700_nec_table[] = { | 20 | static struct rc_map_table dib0700_nec_table[] = { |
21 | /* Key codes for the Pixelview SBTVD remote */ | 21 | /* Key codes for the Pixelview SBTVD remote */ |
22 | { 0x8613, KEY_MUTE }, | 22 | { 0x866b13, KEY_MUTE }, |
23 | { 0x8612, KEY_POWER }, | 23 | { 0x866b12, KEY_POWER }, |
24 | { 0x8601, KEY_1 }, | 24 | { 0x866b01, KEY_1 }, |
25 | { 0x8602, KEY_2 }, | 25 | { 0x866b02, KEY_2 }, |
26 | { 0x8603, KEY_3 }, | 26 | { 0x866b03, KEY_3 }, |
27 | { 0x8604, KEY_4 }, | 27 | { 0x866b04, KEY_4 }, |
28 | { 0x8605, KEY_5 }, | 28 | { 0x866b05, KEY_5 }, |
29 | { 0x8606, KEY_6 }, | 29 | { 0x866b06, KEY_6 }, |
30 | { 0x8607, KEY_7 }, | 30 | { 0x866b07, KEY_7 }, |
31 | { 0x8608, KEY_8 }, | 31 | { 0x866b08, KEY_8 }, |
32 | { 0x8609, KEY_9 }, | 32 | { 0x866b09, KEY_9 }, |
33 | { 0x8600, KEY_0 }, | 33 | { 0x866b00, KEY_0 }, |
34 | { 0x860d, KEY_CHANNELUP }, | 34 | { 0x866b0d, KEY_CHANNELUP }, |
35 | { 0x8619, KEY_CHANNELDOWN }, | 35 | { 0x866b19, KEY_CHANNELDOWN }, |
36 | { 0x8610, KEY_VOLUMEUP }, | 36 | { 0x866b10, KEY_VOLUMEUP }, |
37 | { 0x860c, KEY_VOLUMEDOWN }, | 37 | { 0x866b0c, KEY_VOLUMEDOWN }, |
38 | 38 | ||
39 | { 0x860a, KEY_CAMERA }, | 39 | { 0x866b0a, KEY_CAMERA }, |
40 | { 0x860b, KEY_ZOOM }, | 40 | { 0x866b0b, KEY_ZOOM }, |
41 | { 0x861b, KEY_BACKSPACE }, | 41 | { 0x866b1b, KEY_BACKSPACE }, |
42 | { 0x8615, KEY_ENTER }, | 42 | { 0x866b15, KEY_ENTER }, |
43 | 43 | ||
44 | { 0x861d, KEY_UP }, | 44 | { 0x866b1d, KEY_UP }, |
45 | { 0x861e, KEY_DOWN }, | 45 | { 0x866b1e, KEY_DOWN }, |
46 | { 0x860e, KEY_LEFT }, | 46 | { 0x866b0e, KEY_LEFT }, |
47 | { 0x860f, KEY_RIGHT }, | 47 | { 0x866b0f, KEY_RIGHT }, |
48 | 48 | ||
49 | { 0x8618, KEY_RECORD }, | 49 | { 0x866b18, KEY_RECORD }, |
50 | { 0x861a, KEY_STOP }, | 50 | { 0x866b1a, KEY_STOP }, |
51 | 51 | ||
52 | /* Key codes for the EvolutePC TVWay+ remote */ | 52 | /* Key codes for the EvolutePC TVWay+ remote */ |
53 | { 0x7a00, KEY_MENU }, | 53 | { 0x7a00, KEY_MENU }, |
diff --git a/drivers/media/rc/keymaps/rc-rc6-mce.c b/drivers/media/rc/keymaps/rc-rc6-mce.c index 3bf3337875d1..2f5dc0622b94 100644 --- a/drivers/media/rc/keymaps/rc-rc6-mce.c +++ b/drivers/media/rc/keymaps/rc-rc6-mce.c | |||
@@ -3,6 +3,9 @@ | |||
3 | * | 3 | * |
4 | * Copyright (c) 2010 by Jarod Wilson <jarod@redhat.com> | 4 | * Copyright (c) 2010 by Jarod Wilson <jarod@redhat.com> |
5 | * | 5 | * |
6 | * See http://mediacenterguides.com/book/export/html/31 for details on | ||
7 | * key mappings. | ||
8 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License as published by |
8 | * the Free Software Foundation; either version 2 of the License, or | 11 | * the Free Software Foundation; either version 2 of the License, or |
@@ -60,6 +63,9 @@ static struct rc_map_table rc6_mce[] = { | |||
60 | { 0x800f0426, KEY_EPG }, /* Guide */ | 63 | { 0x800f0426, KEY_EPG }, /* Guide */ |
61 | { 0x800f0427, KEY_ZOOM }, /* Aspect */ | 64 | { 0x800f0427, KEY_ZOOM }, /* Aspect */ |
62 | 65 | ||
66 | { 0x800f0432, KEY_MODE }, /* Visualization */ | ||
67 | { 0x800f0433, KEY_PRESENTATION }, /* Slide Show */ | ||
68 | { 0x800f0434, KEY_EJECTCD }, | ||
63 | { 0x800f043a, KEY_BRIGHTNESSUP }, | 69 | { 0x800f043a, KEY_BRIGHTNESSUP }, |
64 | 70 | ||
65 | { 0x800f0446, KEY_TV }, | 71 | { 0x800f0446, KEY_TV }, |
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c index 0fef6efad537..6df0a4980645 100644 --- a/drivers/media/rc/mceusb.c +++ b/drivers/media/rc/mceusb.c | |||
@@ -48,7 +48,6 @@ | |||
48 | #define USB_BUFLEN 32 /* USB reception buffer length */ | 48 | #define USB_BUFLEN 32 /* USB reception buffer length */ |
49 | #define USB_CTRL_MSG_SZ 2 /* Size of usb ctrl msg on gen1 hw */ | 49 | #define USB_CTRL_MSG_SZ 2 /* Size of usb ctrl msg on gen1 hw */ |
50 | #define MCE_G1_INIT_MSGS 40 /* Init messages on gen1 hw to throw out */ | 50 | #define MCE_G1_INIT_MSGS 40 /* Init messages on gen1 hw to throw out */ |
51 | #define MS_TO_NS(msec) ((msec) * 1000) | ||
52 | 51 | ||
53 | /* MCE constants */ | 52 | /* MCE constants */ |
54 | #define MCE_CMDBUF_SIZE 384 /* MCE Command buffer length */ | 53 | #define MCE_CMDBUF_SIZE 384 /* MCE Command buffer length */ |
@@ -817,7 +816,7 @@ static void mceusb_handle_command(struct mceusb_dev *ir, int index) | |||
817 | switch (ir->buf_in[index]) { | 816 | switch (ir->buf_in[index]) { |
818 | /* 2-byte return value commands */ | 817 | /* 2-byte return value commands */ |
819 | case MCE_CMD_S_TIMEOUT: | 818 | case MCE_CMD_S_TIMEOUT: |
820 | ir->rc->timeout = MS_TO_NS((hi << 8 | lo) / 2); | 819 | ir->rc->timeout = US_TO_NS((hi << 8 | lo) / 2); |
821 | break; | 820 | break; |
822 | 821 | ||
823 | /* 1-byte return value commands */ | 822 | /* 1-byte return value commands */ |
@@ -856,9 +855,10 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) | |||
856 | break; | 855 | break; |
857 | case PARSE_IRDATA: | 856 | case PARSE_IRDATA: |
858 | ir->rem--; | 857 | ir->rem--; |
858 | init_ir_raw_event(&rawir); | ||
859 | rawir.pulse = ((ir->buf_in[i] & MCE_PULSE_BIT) != 0); | 859 | rawir.pulse = ((ir->buf_in[i] & MCE_PULSE_BIT) != 0); |
860 | rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK) | 860 | rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK) |
861 | * MS_TO_NS(MCE_TIME_UNIT); | 861 | * US_TO_NS(MCE_TIME_UNIT); |
862 | 862 | ||
863 | dev_dbg(ir->dev, "Storing %s with duration %d\n", | 863 | dev_dbg(ir->dev, "Storing %s with duration %d\n", |
864 | rawir.pulse ? "pulse" : "space", | 864 | rawir.pulse ? "pulse" : "space", |
@@ -884,6 +884,8 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) | |||
884 | i, ir->rem + 1, false); | 884 | i, ir->rem + 1, false); |
885 | if (ir->rem) | 885 | if (ir->rem) |
886 | ir->parser_state = PARSE_IRDATA; | 886 | ir->parser_state = PARSE_IRDATA; |
887 | else | ||
888 | ir_raw_event_reset(ir->rc); | ||
887 | break; | 889 | break; |
888 | } | 890 | } |
889 | 891 | ||
@@ -1061,7 +1063,7 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir) | |||
1061 | rc->priv = ir; | 1063 | rc->priv = ir; |
1062 | rc->driver_type = RC_DRIVER_IR_RAW; | 1064 | rc->driver_type = RC_DRIVER_IR_RAW; |
1063 | rc->allowed_protos = RC_TYPE_ALL; | 1065 | rc->allowed_protos = RC_TYPE_ALL; |
1064 | rc->timeout = MS_TO_NS(1000); | 1066 | rc->timeout = US_TO_NS(1000); |
1065 | if (!ir->flags.no_tx) { | 1067 | if (!ir->flags.no_tx) { |
1066 | rc->s_tx_mask = mceusb_set_tx_mask; | 1068 | rc->s_tx_mask = mceusb_set_tx_mask; |
1067 | rc->s_tx_carrier = mceusb_set_tx_carrier; | 1069 | rc->s_tx_carrier = mceusb_set_tx_carrier; |
diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index dd4caf8ef80b..273d9d674792 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c | |||
@@ -460,7 +460,7 @@ static u32 nvt_rx_carrier_detect(struct nvt_dev *nvt) | |||
460 | return 0; | 460 | return 0; |
461 | } | 461 | } |
462 | 462 | ||
463 | carrier = (count * 1000000) / duration; | 463 | carrier = MS_TO_NS(count) / duration; |
464 | 464 | ||
465 | if ((carrier > MAX_CARRIER) || (carrier < MIN_CARRIER)) | 465 | if ((carrier > MAX_CARRIER) || (carrier < MIN_CARRIER)) |
466 | nvt_dbg("WTF? Carrier frequency out of range!"); | 466 | nvt_dbg("WTF? Carrier frequency out of range!"); |
@@ -612,8 +612,8 @@ static void nvt_process_rx_ir_data(struct nvt_dev *nvt) | |||
612 | sample = nvt->buf[i]; | 612 | sample = nvt->buf[i]; |
613 | 613 | ||
614 | rawir.pulse = ((sample & BUF_PULSE_BIT) != 0); | 614 | rawir.pulse = ((sample & BUF_PULSE_BIT) != 0); |
615 | rawir.duration = (sample & BUF_LEN_MASK) | 615 | rawir.duration = US_TO_NS((sample & BUF_LEN_MASK) |
616 | * SAMPLE_PERIOD * 1000; | 616 | * SAMPLE_PERIOD); |
617 | 617 | ||
618 | if ((sample & BUF_LEN_MASK) == BUF_LEN_MASK) { | 618 | if ((sample & BUF_LEN_MASK) == BUF_LEN_MASK) { |
619 | if (nvt->rawir.pulse == rawir.pulse) | 619 | if (nvt->rawir.pulse == rawir.pulse) |
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 72be8a02118c..512a2f4ada0e 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c | |||
@@ -458,21 +458,27 @@ static int ir_getkeycode(struct input_dev *idev, | |||
458 | index = ir_lookup_by_scancode(rc_map, scancode); | 458 | index = ir_lookup_by_scancode(rc_map, scancode); |
459 | } | 459 | } |
460 | 460 | ||
461 | if (index >= rc_map->len) { | 461 | if (index < rc_map->len) { |
462 | if (!(ke->flags & INPUT_KEYMAP_BY_INDEX)) | 462 | entry = &rc_map->scan[index]; |
463 | IR_dprintk(1, "unknown key for scancode 0x%04x\n", | 463 | |
464 | scancode); | 464 | ke->index = index; |
465 | ke->keycode = entry->keycode; | ||
466 | ke->len = sizeof(entry->scancode); | ||
467 | memcpy(ke->scancode, &entry->scancode, sizeof(entry->scancode)); | ||
468 | |||
469 | } else if (!(ke->flags & INPUT_KEYMAP_BY_INDEX)) { | ||
470 | /* | ||
471 | * We do not really know the valid range of scancodes | ||
472 | * so let's respond with KEY_RESERVED to anything we | ||
473 | * do not have mapping for [yet]. | ||
474 | */ | ||
475 | ke->index = index; | ||
476 | ke->keycode = KEY_RESERVED; | ||
477 | } else { | ||
465 | retval = -EINVAL; | 478 | retval = -EINVAL; |
466 | goto out; | 479 | goto out; |
467 | } | 480 | } |
468 | 481 | ||
469 | entry = &rc_map->scan[index]; | ||
470 | |||
471 | ke->index = index; | ||
472 | ke->keycode = entry->keycode; | ||
473 | ke->len = sizeof(entry->scancode); | ||
474 | memcpy(ke->scancode, &entry->scancode, sizeof(entry->scancode)); | ||
475 | |||
476 | retval = 0; | 482 | retval = 0; |
477 | 483 | ||
478 | out: | 484 | out: |
diff --git a/drivers/media/rc/streamzap.c b/drivers/media/rc/streamzap.c index 6e2911c2abfb..e435d94c0776 100644 --- a/drivers/media/rc/streamzap.c +++ b/drivers/media/rc/streamzap.c | |||
@@ -164,7 +164,7 @@ static void sz_push_full_pulse(struct streamzap_ir *sz, | |||
164 | sz->signal_start.tv_usec - | 164 | sz->signal_start.tv_usec - |
165 | sz->signal_last.tv_usec); | 165 | sz->signal_last.tv_usec); |
166 | rawir.duration -= sz->sum; | 166 | rawir.duration -= sz->sum; |
167 | rawir.duration *= 1000; | 167 | rawir.duration = US_TO_NS(rawir.duration); |
168 | rawir.duration &= IR_MAX_DURATION; | 168 | rawir.duration &= IR_MAX_DURATION; |
169 | } | 169 | } |
170 | sz_push(sz, rawir); | 170 | sz_push(sz, rawir); |
@@ -177,7 +177,7 @@ static void sz_push_full_pulse(struct streamzap_ir *sz, | |||
177 | rawir.duration = ((int) value) * SZ_RESOLUTION; | 177 | rawir.duration = ((int) value) * SZ_RESOLUTION; |
178 | rawir.duration += SZ_RESOLUTION / 2; | 178 | rawir.duration += SZ_RESOLUTION / 2; |
179 | sz->sum += rawir.duration; | 179 | sz->sum += rawir.duration; |
180 | rawir.duration *= 1000; | 180 | rawir.duration = US_TO_NS(rawir.duration); |
181 | rawir.duration &= IR_MAX_DURATION; | 181 | rawir.duration &= IR_MAX_DURATION; |
182 | sz_push(sz, rawir); | 182 | sz_push(sz, rawir); |
183 | } | 183 | } |
@@ -197,7 +197,7 @@ static void sz_push_full_space(struct streamzap_ir *sz, | |||
197 | rawir.duration = ((int) value) * SZ_RESOLUTION; | 197 | rawir.duration = ((int) value) * SZ_RESOLUTION; |
198 | rawir.duration += SZ_RESOLUTION / 2; | 198 | rawir.duration += SZ_RESOLUTION / 2; |
199 | sz->sum += rawir.duration; | 199 | sz->sum += rawir.duration; |
200 | rawir.duration *= 1000; | 200 | rawir.duration = US_TO_NS(rawir.duration); |
201 | sz_push(sz, rawir); | 201 | sz_push(sz, rawir); |
202 | } | 202 | } |
203 | 203 | ||
@@ -273,6 +273,7 @@ static void streamzap_callback(struct urb *urb) | |||
273 | if (sz->timeout_enabled) | 273 | if (sz->timeout_enabled) |
274 | sz_push(sz, rawir); | 274 | sz_push(sz, rawir); |
275 | ir_raw_event_handle(sz->rdev); | 275 | ir_raw_event_handle(sz->rdev); |
276 | ir_raw_event_reset(sz->rdev); | ||
276 | } else { | 277 | } else { |
277 | sz_push_full_space(sz, sz->buf_in[i]); | 278 | sz_push_full_space(sz, sz->buf_in[i]); |
278 | } | 279 | } |
@@ -290,6 +291,7 @@ static void streamzap_callback(struct urb *urb) | |||
290 | } | 291 | } |
291 | } | 292 | } |
292 | 293 | ||
294 | ir_raw_event_handle(sz->rdev); | ||
293 | usb_submit_urb(urb, GFP_ATOMIC); | 295 | usb_submit_urb(urb, GFP_ATOMIC); |
294 | 296 | ||
295 | return; | 297 | return; |
@@ -430,13 +432,13 @@ static int __devinit streamzap_probe(struct usb_interface *intf, | |||
430 | sz->decoder_state = PulseSpace; | 432 | sz->decoder_state = PulseSpace; |
431 | /* FIXME: don't yet have a way to set this */ | 433 | /* FIXME: don't yet have a way to set this */ |
432 | sz->timeout_enabled = true; | 434 | sz->timeout_enabled = true; |
433 | sz->rdev->timeout = (((SZ_TIMEOUT * SZ_RESOLUTION * 1000) & | 435 | sz->rdev->timeout = ((US_TO_NS(SZ_TIMEOUT * SZ_RESOLUTION) & |
434 | IR_MAX_DURATION) | 0x03000000); | 436 | IR_MAX_DURATION) | 0x03000000); |
435 | #if 0 | 437 | #if 0 |
436 | /* not yet supported, depends on patches from maxim */ | 438 | /* not yet supported, depends on patches from maxim */ |
437 | /* see also: LIRC_GET_REC_RESOLUTION and LIRC_SET_REC_TIMEOUT */ | 439 | /* see also: LIRC_GET_REC_RESOLUTION and LIRC_SET_REC_TIMEOUT */ |
438 | sz->min_timeout = SZ_TIMEOUT * SZ_RESOLUTION * 1000; | 440 | sz->min_timeout = US_TO_NS(SZ_TIMEOUT * SZ_RESOLUTION); |
439 | sz->max_timeout = SZ_TIMEOUT * SZ_RESOLUTION * 1000; | 441 | sz->max_timeout = US_TO_NS(SZ_TIMEOUT * SZ_RESOLUTION); |
440 | #endif | 442 | #endif |
441 | 443 | ||
442 | do_gettimeofday(&sz->signal_start); | 444 | do_gettimeofday(&sz->signal_start); |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index eb875af05e79..aa021600e9df 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -78,7 +78,7 @@ config VIDEO_FIXED_MINOR_RANGES | |||
78 | 78 | ||
79 | config VIDEO_HELPER_CHIPS_AUTO | 79 | config VIDEO_HELPER_CHIPS_AUTO |
80 | bool "Autoselect pertinent encoders/decoders and other helper chips" | 80 | bool "Autoselect pertinent encoders/decoders and other helper chips" |
81 | default y if !EMBEDDED | 81 | default y if !EXPERT |
82 | ---help--- | 82 | ---help--- |
83 | Most video cards may require additional modules to encode or | 83 | Most video cards may require additional modules to encode or |
84 | decode audio/video standards. This option will autoselect | 84 | decode audio/video standards. This option will autoselect |
@@ -141,15 +141,6 @@ config VIDEO_TDA9840 | |||
141 | To compile this driver as a module, choose M here: the | 141 | To compile this driver as a module, choose M here: the |
142 | module will be called tda9840. | 142 | module will be called tda9840. |
143 | 143 | ||
144 | config VIDEO_TDA9875 | ||
145 | tristate "Philips TDA9875 audio processor" | ||
146 | depends on VIDEO_V4L2 && I2C | ||
147 | ---help--- | ||
148 | Support for tda9875 audio decoder chip found on some bt8xx boards. | ||
149 | |||
150 | To compile this driver as a module, choose M here: the | ||
151 | module will be called tda9875. | ||
152 | |||
153 | config VIDEO_TEA6415C | 144 | config VIDEO_TEA6415C |
154 | tristate "Philips TEA6415C audio processor" | 145 | tristate "Philips TEA6415C audio processor" |
155 | depends on I2C | 146 | depends on I2C |
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 81e38cb0b846..a509d317e258 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile | |||
@@ -27,7 +27,6 @@ obj-$(CONFIG_VIDEO_V4L2_COMMON) += v4l2-common.o | |||
27 | obj-$(CONFIG_VIDEO_TUNER) += tuner.o | 27 | obj-$(CONFIG_VIDEO_TUNER) += tuner.o |
28 | obj-$(CONFIG_VIDEO_TVAUDIO) += tvaudio.o | 28 | obj-$(CONFIG_VIDEO_TVAUDIO) += tvaudio.o |
29 | obj-$(CONFIG_VIDEO_TDA7432) += tda7432.o | 29 | obj-$(CONFIG_VIDEO_TDA7432) += tda7432.o |
30 | obj-$(CONFIG_VIDEO_TDA9875) += tda9875.o | ||
31 | obj-$(CONFIG_VIDEO_SAA6588) += saa6588.o | 30 | obj-$(CONFIG_VIDEO_SAA6588) += saa6588.o |
32 | obj-$(CONFIG_VIDEO_TDA9840) += tda9840.o | 31 | obj-$(CONFIG_VIDEO_TDA9840) += tda9840.o |
33 | obj-$(CONFIG_VIDEO_TEA6415C) += tea6415c.o | 32 | obj-$(CONFIG_VIDEO_TEA6415C) += tea6415c.o |
diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c index f318b51448b3..d2327dbb473f 100644 --- a/drivers/media/video/adv7175.c +++ b/drivers/media/video/adv7175.c | |||
@@ -303,11 +303,22 @@ static int adv7175_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ide | |||
303 | return v4l2_chip_ident_i2c_client(client, chip, V4L2_IDENT_ADV7175, 0); | 303 | return v4l2_chip_ident_i2c_client(client, chip, V4L2_IDENT_ADV7175, 0); |
304 | } | 304 | } |
305 | 305 | ||
306 | static int adv7175_s_power(struct v4l2_subdev *sd, int on) | ||
307 | { | ||
308 | if (on) | ||
309 | adv7175_write(sd, 0x01, 0x00); | ||
310 | else | ||
311 | adv7175_write(sd, 0x01, 0x78); | ||
312 | |||
313 | return 0; | ||
314 | } | ||
315 | |||
306 | /* ----------------------------------------------------------------------- */ | 316 | /* ----------------------------------------------------------------------- */ |
307 | 317 | ||
308 | static const struct v4l2_subdev_core_ops adv7175_core_ops = { | 318 | static const struct v4l2_subdev_core_ops adv7175_core_ops = { |
309 | .g_chip_ident = adv7175_g_chip_ident, | 319 | .g_chip_ident = adv7175_g_chip_ident, |
310 | .init = adv7175_init, | 320 | .init = adv7175_init, |
321 | .s_power = adv7175_s_power, | ||
311 | }; | 322 | }; |
312 | 323 | ||
313 | static const struct v4l2_subdev_video_ops adv7175_video_ops = { | 324 | static const struct v4l2_subdev_video_ops adv7175_video_ops = { |
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c index 49efcf660ba6..7f58756d72c8 100644 --- a/drivers/media/video/bt8xx/bttv-cards.c +++ b/drivers/media/video/bt8xx/bttv-cards.c | |||
@@ -1373,7 +1373,6 @@ struct tvcard bttv_tvcards[] = { | |||
1373 | .gpiomute = 0x1800, | 1373 | .gpiomute = 0x1800, |
1374 | .audio_mode_gpio= fv2000s_audio, | 1374 | .audio_mode_gpio= fv2000s_audio, |
1375 | .no_msp34xx = 1, | 1375 | .no_msp34xx = 1, |
1376 | .no_tda9875 = 1, | ||
1377 | .needs_tvaudio = 1, | 1376 | .needs_tvaudio = 1, |
1378 | .pll = PLL_28, | 1377 | .pll = PLL_28, |
1379 | .tuner_type = TUNER_PHILIPS_PAL, | 1378 | .tuner_type = TUNER_PHILIPS_PAL, |
@@ -1511,7 +1510,6 @@ struct tvcard bttv_tvcards[] = { | |||
1511 | .gpiomute = 0x09, | 1510 | .gpiomute = 0x09, |
1512 | .needs_tvaudio = 1, | 1511 | .needs_tvaudio = 1, |
1513 | .no_msp34xx = 1, | 1512 | .no_msp34xx = 1, |
1514 | .no_tda9875 = 1, | ||
1515 | .pll = PLL_28, | 1513 | .pll = PLL_28, |
1516 | .tuner_type = TUNER_PHILIPS_PAL, | 1514 | .tuner_type = TUNER_PHILIPS_PAL, |
1517 | .tuner_addr = ADDR_UNSET, | 1515 | .tuner_addr = ADDR_UNSET, |
@@ -1550,7 +1548,6 @@ struct tvcard bttv_tvcards[] = { | |||
1550 | .gpiomask2 = 0x07ff, | 1548 | .gpiomask2 = 0x07ff, |
1551 | .muxsel = MUXSEL(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3), | 1549 | .muxsel = MUXSEL(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3), |
1552 | .no_msp34xx = 1, | 1550 | .no_msp34xx = 1, |
1553 | .no_tda9875 = 1, | ||
1554 | .tuner_type = TUNER_ABSENT, | 1551 | .tuner_type = TUNER_ABSENT, |
1555 | .tuner_addr = ADDR_UNSET, | 1552 | .tuner_addr = ADDR_UNSET, |
1556 | .muxsel_hook = rv605_muxsel, | 1553 | .muxsel_hook = rv605_muxsel, |
@@ -1686,7 +1683,6 @@ struct tvcard bttv_tvcards[] = { | |||
1686 | .tuner_type = TUNER_ABSENT, | 1683 | .tuner_type = TUNER_ABSENT, |
1687 | .tuner_addr = ADDR_UNSET, | 1684 | .tuner_addr = ADDR_UNSET, |
1688 | .no_msp34xx = 1, | 1685 | .no_msp34xx = 1, |
1689 | .no_tda9875 = 1, | ||
1690 | .no_tda7432 = 1, | 1686 | .no_tda7432 = 1, |
1691 | }, | 1687 | }, |
1692 | [BTTV_BOARD_OSPREY1x0_848] = { | 1688 | [BTTV_BOARD_OSPREY1x0_848] = { |
@@ -1699,7 +1695,6 @@ struct tvcard bttv_tvcards[] = { | |||
1699 | .tuner_type = TUNER_ABSENT, | 1695 | .tuner_type = TUNER_ABSENT, |
1700 | .tuner_addr = ADDR_UNSET, | 1696 | .tuner_addr = ADDR_UNSET, |
1701 | .no_msp34xx = 1, | 1697 | .no_msp34xx = 1, |
1702 | .no_tda9875 = 1, | ||
1703 | .no_tda7432 = 1, | 1698 | .no_tda7432 = 1, |
1704 | }, | 1699 | }, |
1705 | 1700 | ||
@@ -1714,7 +1709,6 @@ struct tvcard bttv_tvcards[] = { | |||
1714 | .tuner_type = TUNER_ABSENT, | 1709 | .tuner_type = TUNER_ABSENT, |
1715 | .tuner_addr = ADDR_UNSET, | 1710 | .tuner_addr = ADDR_UNSET, |
1716 | .no_msp34xx = 1, | 1711 | .no_msp34xx = 1, |
1717 | .no_tda9875 = 1, | ||
1718 | .no_tda7432 = 1, | 1712 | .no_tda7432 = 1, |
1719 | }, | 1713 | }, |
1720 | [BTTV_BOARD_OSPREY1x1] = { | 1714 | [BTTV_BOARD_OSPREY1x1] = { |
@@ -1727,7 +1721,6 @@ struct tvcard bttv_tvcards[] = { | |||
1727 | .tuner_type = TUNER_ABSENT, | 1721 | .tuner_type = TUNER_ABSENT, |
1728 | .tuner_addr = ADDR_UNSET, | 1722 | .tuner_addr = ADDR_UNSET, |
1729 | .no_msp34xx = 1, | 1723 | .no_msp34xx = 1, |
1730 | .no_tda9875 = 1, | ||
1731 | .no_tda7432 = 1, | 1724 | .no_tda7432 = 1, |
1732 | }, | 1725 | }, |
1733 | [BTTV_BOARD_OSPREY1x1_SVID] = { | 1726 | [BTTV_BOARD_OSPREY1x1_SVID] = { |
@@ -1740,7 +1733,6 @@ struct tvcard bttv_tvcards[] = { | |||
1740 | .tuner_type = TUNER_ABSENT, | 1733 | .tuner_type = TUNER_ABSENT, |
1741 | .tuner_addr = ADDR_UNSET, | 1734 | .tuner_addr = ADDR_UNSET, |
1742 | .no_msp34xx = 1, | 1735 | .no_msp34xx = 1, |
1743 | .no_tda9875 = 1, | ||
1744 | .no_tda7432 = 1, | 1736 | .no_tda7432 = 1, |
1745 | }, | 1737 | }, |
1746 | [BTTV_BOARD_OSPREY2xx] = { | 1738 | [BTTV_BOARD_OSPREY2xx] = { |
@@ -1753,7 +1745,6 @@ struct tvcard bttv_tvcards[] = { | |||
1753 | .tuner_type = TUNER_ABSENT, | 1745 | .tuner_type = TUNER_ABSENT, |
1754 | .tuner_addr = ADDR_UNSET, | 1746 | .tuner_addr = ADDR_UNSET, |
1755 | .no_msp34xx = 1, | 1747 | .no_msp34xx = 1, |
1756 | .no_tda9875 = 1, | ||
1757 | .no_tda7432 = 1, | 1748 | .no_tda7432 = 1, |
1758 | }, | 1749 | }, |
1759 | 1750 | ||
@@ -1768,7 +1759,6 @@ struct tvcard bttv_tvcards[] = { | |||
1768 | .tuner_type = TUNER_ABSENT, | 1759 | .tuner_type = TUNER_ABSENT, |
1769 | .tuner_addr = ADDR_UNSET, | 1760 | .tuner_addr = ADDR_UNSET, |
1770 | .no_msp34xx = 1, | 1761 | .no_msp34xx = 1, |
1771 | .no_tda9875 = 1, | ||
1772 | .no_tda7432 = 1, | 1762 | .no_tda7432 = 1, |
1773 | }, | 1763 | }, |
1774 | [BTTV_BOARD_OSPREY2x0] = { | 1764 | [BTTV_BOARD_OSPREY2x0] = { |
@@ -1781,7 +1771,6 @@ struct tvcard bttv_tvcards[] = { | |||
1781 | .tuner_type = TUNER_ABSENT, | 1771 | .tuner_type = TUNER_ABSENT, |
1782 | .tuner_addr = ADDR_UNSET, | 1772 | .tuner_addr = ADDR_UNSET, |
1783 | .no_msp34xx = 1, | 1773 | .no_msp34xx = 1, |
1784 | .no_tda9875 = 1, | ||
1785 | .no_tda7432 = 1, | 1774 | .no_tda7432 = 1, |
1786 | }, | 1775 | }, |
1787 | [BTTV_BOARD_OSPREY500] = { | 1776 | [BTTV_BOARD_OSPREY500] = { |
@@ -1794,7 +1783,6 @@ struct tvcard bttv_tvcards[] = { | |||
1794 | .tuner_type = TUNER_ABSENT, | 1783 | .tuner_type = TUNER_ABSENT, |
1795 | .tuner_addr = ADDR_UNSET, | 1784 | .tuner_addr = ADDR_UNSET, |
1796 | .no_msp34xx = 1, | 1785 | .no_msp34xx = 1, |
1797 | .no_tda9875 = 1, | ||
1798 | .no_tda7432 = 1, | 1786 | .no_tda7432 = 1, |
1799 | }, | 1787 | }, |
1800 | [BTTV_BOARD_OSPREY540] = { | 1788 | [BTTV_BOARD_OSPREY540] = { |
@@ -1805,7 +1793,6 @@ struct tvcard bttv_tvcards[] = { | |||
1805 | .tuner_type = TUNER_ABSENT, | 1793 | .tuner_type = TUNER_ABSENT, |
1806 | .tuner_addr = ADDR_UNSET, | 1794 | .tuner_addr = ADDR_UNSET, |
1807 | .no_msp34xx = 1, | 1795 | .no_msp34xx = 1, |
1808 | .no_tda9875 = 1, | ||
1809 | .no_tda7432 = 1, | 1796 | .no_tda7432 = 1, |
1810 | }, | 1797 | }, |
1811 | 1798 | ||
@@ -1820,7 +1807,6 @@ struct tvcard bttv_tvcards[] = { | |||
1820 | .tuner_type = TUNER_ABSENT, | 1807 | .tuner_type = TUNER_ABSENT, |
1821 | .tuner_addr = ADDR_UNSET, | 1808 | .tuner_addr = ADDR_UNSET, |
1822 | .no_msp34xx = 1, | 1809 | .no_msp34xx = 1, |
1823 | .no_tda9875 = 1, | ||
1824 | .no_tda7432 = 1, /* must avoid, conflicts with the bt860 */ | 1810 | .no_tda7432 = 1, /* must avoid, conflicts with the bt860 */ |
1825 | }, | 1811 | }, |
1826 | [BTTV_BOARD_IDS_EAGLE] = { | 1812 | [BTTV_BOARD_IDS_EAGLE] = { |
@@ -1835,7 +1821,6 @@ struct tvcard bttv_tvcards[] = { | |||
1835 | .muxsel = MUXSEL(2, 2, 2, 2), | 1821 | .muxsel = MUXSEL(2, 2, 2, 2), |
1836 | .muxsel_hook = eagle_muxsel, | 1822 | .muxsel_hook = eagle_muxsel, |
1837 | .no_msp34xx = 1, | 1823 | .no_msp34xx = 1, |
1838 | .no_tda9875 = 1, | ||
1839 | .pll = PLL_28, | 1824 | .pll = PLL_28, |
1840 | }, | 1825 | }, |
1841 | [BTTV_BOARD_PINNACLESAT] = { | 1826 | [BTTV_BOARD_PINNACLESAT] = { |
@@ -1846,7 +1831,6 @@ struct tvcard bttv_tvcards[] = { | |||
1846 | .tuner_type = TUNER_ABSENT, | 1831 | .tuner_type = TUNER_ABSENT, |
1847 | .tuner_addr = ADDR_UNSET, | 1832 | .tuner_addr = ADDR_UNSET, |
1848 | .no_msp34xx = 1, | 1833 | .no_msp34xx = 1, |
1849 | .no_tda9875 = 1, | ||
1850 | .no_tda7432 = 1, | 1834 | .no_tda7432 = 1, |
1851 | .muxsel = MUXSEL(3, 1), | 1835 | .muxsel = MUXSEL(3, 1), |
1852 | .pll = PLL_28, | 1836 | .pll = PLL_28, |
@@ -1897,7 +1881,6 @@ struct tvcard bttv_tvcards[] = { | |||
1897 | .svhs = 2, | 1881 | .svhs = 2, |
1898 | .gpiomask = 0, | 1882 | .gpiomask = 0, |
1899 | .no_msp34xx = 1, | 1883 | .no_msp34xx = 1, |
1900 | .no_tda9875 = 1, | ||
1901 | .no_tda7432 = 1, | 1884 | .no_tda7432 = 1, |
1902 | .muxsel = MUXSEL(2, 0, 1), | 1885 | .muxsel = MUXSEL(2, 0, 1), |
1903 | .pll = PLL_28, | 1886 | .pll = PLL_28, |
@@ -1970,7 +1953,6 @@ struct tvcard bttv_tvcards[] = { | |||
1970 | /* Tuner, CVid, SVid, CVid over SVid connector */ | 1953 | /* Tuner, CVid, SVid, CVid over SVid connector */ |
1971 | .muxsel = MUXSEL(2, 3, 1, 1), | 1954 | .muxsel = MUXSEL(2, 3, 1, 1), |
1972 | .gpiomask = 0, | 1955 | .gpiomask = 0, |
1973 | .no_tda9875 = 1, | ||
1974 | .no_tda7432 = 1, | 1956 | .no_tda7432 = 1, |
1975 | .tuner_type = TUNER_PHILIPS_PAL_I, | 1957 | .tuner_type = TUNER_PHILIPS_PAL_I, |
1976 | .tuner_addr = ADDR_UNSET, | 1958 | .tuner_addr = ADDR_UNSET, |
@@ -2017,7 +1999,6 @@ struct tvcard bttv_tvcards[] = { | |||
2017 | .muxsel = MUXSEL(2,2,2,2, 3,3,3,3, 1,1,1,1, 0,0,0,0), | 1999 | .muxsel = MUXSEL(2,2,2,2, 3,3,3,3, 1,1,1,1, 0,0,0,0), |
2018 | .muxsel_hook = xguard_muxsel, | 2000 | .muxsel_hook = xguard_muxsel, |
2019 | .no_msp34xx = 1, | 2001 | .no_msp34xx = 1, |
2020 | .no_tda9875 = 1, | ||
2021 | .no_tda7432 = 1, | 2002 | .no_tda7432 = 1, |
2022 | .pll = PLL_28, | 2003 | .pll = PLL_28, |
2023 | }, | 2004 | }, |
@@ -2029,7 +2010,6 @@ struct tvcard bttv_tvcards[] = { | |||
2029 | .svhs = NO_SVHS, | 2010 | .svhs = NO_SVHS, |
2030 | .muxsel = MUXSEL(2, 3, 1, 0), | 2011 | .muxsel = MUXSEL(2, 3, 1, 0), |
2031 | .no_msp34xx = 1, | 2012 | .no_msp34xx = 1, |
2032 | .no_tda9875 = 1, | ||
2033 | .no_tda7432 = 1, | 2013 | .no_tda7432 = 1, |
2034 | .pll = PLL_28, | 2014 | .pll = PLL_28, |
2035 | .tuner_type = TUNER_ABSENT, | 2015 | .tuner_type = TUNER_ABSENT, |
@@ -2134,7 +2114,6 @@ struct tvcard bttv_tvcards[] = { | |||
2134 | .svhs = NO_SVHS, /* card has no svhs */ | 2114 | .svhs = NO_SVHS, /* card has no svhs */ |
2135 | .needs_tvaudio = 0, | 2115 | .needs_tvaudio = 0, |
2136 | .no_msp34xx = 1, | 2116 | .no_msp34xx = 1, |
2137 | .no_tda9875 = 1, | ||
2138 | .no_tda7432 = 1, | 2117 | .no_tda7432 = 1, |
2139 | .gpiomask = 0x00, | 2118 | .gpiomask = 0x00, |
2140 | .muxsel = MUXSEL(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), | 2119 | .muxsel = MUXSEL(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), |
@@ -2156,7 +2135,6 @@ struct tvcard bttv_tvcards[] = { | |||
2156 | [BTTV_BOARD_TWINHAN_DST] = { | 2135 | [BTTV_BOARD_TWINHAN_DST] = { |
2157 | .name = "Twinhan DST + clones", | 2136 | .name = "Twinhan DST + clones", |
2158 | .no_msp34xx = 1, | 2137 | .no_msp34xx = 1, |
2159 | .no_tda9875 = 1, | ||
2160 | .no_tda7432 = 1, | 2138 | .no_tda7432 = 1, |
2161 | .tuner_type = TUNER_ABSENT, | 2139 | .tuner_type = TUNER_ABSENT, |
2162 | .tuner_addr = ADDR_UNSET, | 2140 | .tuner_addr = ADDR_UNSET, |
@@ -2171,7 +2149,6 @@ struct tvcard bttv_tvcards[] = { | |||
2171 | /* Vid In, SVid In, Vid over SVid in connector */ | 2149 | /* Vid In, SVid In, Vid over SVid in connector */ |
2172 | .muxsel = MUXSEL(3, 1, 1, 3), | 2150 | .muxsel = MUXSEL(3, 1, 1, 3), |
2173 | .no_msp34xx = 1, | 2151 | .no_msp34xx = 1, |
2174 | .no_tda9875 = 1, | ||
2175 | .no_tda7432 = 1, | 2152 | .no_tda7432 = 1, |
2176 | .tuner_type = TUNER_ABSENT, | 2153 | .tuner_type = TUNER_ABSENT, |
2177 | .tuner_addr = ADDR_UNSET, | 2154 | .tuner_addr = ADDR_UNSET, |
@@ -2226,7 +2203,6 @@ struct tvcard bttv_tvcards[] = { | |||
2226 | .svhs = NO_SVHS, | 2203 | .svhs = NO_SVHS, |
2227 | .muxsel = MUXSEL(2, 3, 1, 0), | 2204 | .muxsel = MUXSEL(2, 3, 1, 0), |
2228 | .no_msp34xx = 1, | 2205 | .no_msp34xx = 1, |
2229 | .no_tda9875 = 1, | ||
2230 | .no_tda7432 = 1, | 2206 | .no_tda7432 = 1, |
2231 | .needs_tvaudio = 0, | 2207 | .needs_tvaudio = 0, |
2232 | .tuner_type = TUNER_ABSENT, | 2208 | .tuner_type = TUNER_ABSENT, |
@@ -2278,7 +2254,6 @@ struct tvcard bttv_tvcards[] = { | |||
2278 | .gpiomask = 0, | 2254 | .gpiomask = 0, |
2279 | .gpiomask2 = 0x3C<<16,/*Set the GPIO[18]->GPIO[21] as output pin.==> drive the video inputs through analog multiplexers*/ | 2255 | .gpiomask2 = 0x3C<<16,/*Set the GPIO[18]->GPIO[21] as output pin.==> drive the video inputs through analog multiplexers*/ |
2280 | .no_msp34xx = 1, | 2256 | .no_msp34xx = 1, |
2281 | .no_tda9875 = 1, | ||
2282 | .no_tda7432 = 1, | 2257 | .no_tda7432 = 1, |
2283 | /*878A input is always MUX0, see above.*/ | 2258 | /*878A input is always MUX0, see above.*/ |
2284 | .muxsel = MUXSEL(2, 2, 2, 2), | 2259 | .muxsel = MUXSEL(2, 2, 2, 2), |
@@ -2302,7 +2277,6 @@ struct tvcard bttv_tvcards[] = { | |||
2302 | .tuner_type = TUNER_TEMIC_PAL, | 2277 | .tuner_type = TUNER_TEMIC_PAL, |
2303 | .tuner_addr = ADDR_UNSET, | 2278 | .tuner_addr = ADDR_UNSET, |
2304 | .no_msp34xx = 1, | 2279 | .no_msp34xx = 1, |
2305 | .no_tda9875 = 1, | ||
2306 | }, | 2280 | }, |
2307 | [BTTV_BOARD_AVDVBT_771] = { | 2281 | [BTTV_BOARD_AVDVBT_771] = { |
2308 | /* Wolfram Joost <wojo@frokaschwei.de> */ | 2282 | /* Wolfram Joost <wojo@frokaschwei.de> */ |
@@ -2313,7 +2287,6 @@ struct tvcard bttv_tvcards[] = { | |||
2313 | .tuner_addr = ADDR_UNSET, | 2287 | .tuner_addr = ADDR_UNSET, |
2314 | .muxsel = MUXSEL(3, 3), | 2288 | .muxsel = MUXSEL(3, 3), |
2315 | .no_msp34xx = 1, | 2289 | .no_msp34xx = 1, |
2316 | .no_tda9875 = 1, | ||
2317 | .no_tda7432 = 1, | 2290 | .no_tda7432 = 1, |
2318 | .pll = PLL_28, | 2291 | .pll = PLL_28, |
2319 | .has_dvb = 1, | 2292 | .has_dvb = 1, |
@@ -2329,7 +2302,6 @@ struct tvcard bttv_tvcards[] = { | |||
2329 | .svhs = 1, | 2302 | .svhs = 1, |
2330 | .muxsel = MUXSEL(3, 1, 2, 0), /* Comp0, S-Video, ?, ? */ | 2303 | .muxsel = MUXSEL(3, 1, 2, 0), /* Comp0, S-Video, ?, ? */ |
2331 | .no_msp34xx = 1, | 2304 | .no_msp34xx = 1, |
2332 | .no_tda9875 = 1, | ||
2333 | .no_tda7432 = 1, | 2305 | .no_tda7432 = 1, |
2334 | .pll = PLL_28, | 2306 | .pll = PLL_28, |
2335 | .tuner_type = TUNER_ABSENT, | 2307 | .tuner_type = TUNER_ABSENT, |
@@ -2393,7 +2365,6 @@ struct tvcard bttv_tvcards[] = { | |||
2393 | /* Chris Pascoe <c.pascoe@itee.uq.edu.au> */ | 2365 | /* Chris Pascoe <c.pascoe@itee.uq.edu.au> */ |
2394 | .name = "DViCO FusionHDTV DVB-T Lite", | 2366 | .name = "DViCO FusionHDTV DVB-T Lite", |
2395 | .no_msp34xx = 1, | 2367 | .no_msp34xx = 1, |
2396 | .no_tda9875 = 1, | ||
2397 | .no_tda7432 = 1, | 2368 | .no_tda7432 = 1, |
2398 | .pll = PLL_28, | 2369 | .pll = PLL_28, |
2399 | .no_video = 1, | 2370 | .no_video = 1, |
@@ -2440,7 +2411,6 @@ struct tvcard bttv_tvcards[] = { | |||
2440 | .muxsel = MUXSEL(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), | 2411 | .muxsel = MUXSEL(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), |
2441 | .pll = PLL_28, | 2412 | .pll = PLL_28, |
2442 | .no_msp34xx = 1, | 2413 | .no_msp34xx = 1, |
2443 | .no_tda9875 = 1, | ||
2444 | .no_tda7432 = 1, | 2414 | .no_tda7432 = 1, |
2445 | .tuner_type = TUNER_ABSENT, | 2415 | .tuner_type = TUNER_ABSENT, |
2446 | .tuner_addr = ADDR_UNSET, | 2416 | .tuner_addr = ADDR_UNSET, |
@@ -2478,7 +2448,6 @@ struct tvcard bttv_tvcards[] = { | |||
2478 | .pll = PLL_28, | 2448 | .pll = PLL_28, |
2479 | .no_msp34xx = 1, | 2449 | .no_msp34xx = 1, |
2480 | .no_tda7432 = 1, | 2450 | .no_tda7432 = 1, |
2481 | .no_tda9875 = 1, | ||
2482 | .muxsel_hook = kodicom4400r_muxsel, | 2451 | .muxsel_hook = kodicom4400r_muxsel, |
2483 | }, | 2452 | }, |
2484 | [BTTV_BOARD_KODICOM_4400R_SL] = { | 2453 | [BTTV_BOARD_KODICOM_4400R_SL] = { |
@@ -2500,7 +2469,6 @@ struct tvcard bttv_tvcards[] = { | |||
2500 | .pll = PLL_28, | 2469 | .pll = PLL_28, |
2501 | .no_msp34xx = 1, | 2470 | .no_msp34xx = 1, |
2502 | .no_tda7432 = 1, | 2471 | .no_tda7432 = 1, |
2503 | .no_tda9875 = 1, | ||
2504 | .muxsel_hook = kodicom4400r_muxsel, | 2472 | .muxsel_hook = kodicom4400r_muxsel, |
2505 | }, | 2473 | }, |
2506 | /* ---- card 0x86---------------------------------- */ | 2474 | /* ---- card 0x86---------------------------------- */ |
@@ -2530,7 +2498,6 @@ struct tvcard bttv_tvcards[] = { | |||
2530 | .gpiomux = { 0x00400005, 0, 0x00000001, 0 }, | 2498 | .gpiomux = { 0x00400005, 0, 0x00000001, 0 }, |
2531 | .gpiomute = 0x00c00007, | 2499 | .gpiomute = 0x00c00007, |
2532 | .no_msp34xx = 1, | 2500 | .no_msp34xx = 1, |
2533 | .no_tda9875 = 1, | ||
2534 | .no_tda7432 = 1, | 2501 | .no_tda7432 = 1, |
2535 | .has_dvb = 1, | 2502 | .has_dvb = 1, |
2536 | }, | 2503 | }, |
@@ -2630,7 +2597,6 @@ struct tvcard bttv_tvcards[] = { | |||
2630 | .tuner_type = TUNER_ABSENT, | 2597 | .tuner_type = TUNER_ABSENT, |
2631 | .tuner_addr = ADDR_UNSET, | 2598 | .tuner_addr = ADDR_UNSET, |
2632 | .no_msp34xx = 1, | 2599 | .no_msp34xx = 1, |
2633 | .no_tda9875 = 1, | ||
2634 | .no_tda7432 = 1, | 2600 | .no_tda7432 = 1, |
2635 | }, | 2601 | }, |
2636 | /* ---- card 0x8d ---------------------------------- */ | 2602 | /* ---- card 0x8d ---------------------------------- */ |
@@ -2658,7 +2624,6 @@ struct tvcard bttv_tvcards[] = { | |||
2658 | .muxsel = MUXSEL(2, 3, 1, 1), | 2624 | .muxsel = MUXSEL(2, 3, 1, 1), |
2659 | .gpiomux = { 100000, 100002, 100002, 100000 }, | 2625 | .gpiomux = { 100000, 100002, 100002, 100000 }, |
2660 | .no_msp34xx = 1, | 2626 | .no_msp34xx = 1, |
2661 | .no_tda9875 = 1, | ||
2662 | .no_tda7432 = 1, | 2627 | .no_tda7432 = 1, |
2663 | .pll = PLL_28, | 2628 | .pll = PLL_28, |
2664 | .tuner_type = TUNER_TNF_5335MF, | 2629 | .tuner_type = TUNER_TNF_5335MF, |
@@ -2674,7 +2639,6 @@ struct tvcard bttv_tvcards[] = { | |||
2674 | .gpiomask = 0x0f, /* old: 7 */ | 2639 | .gpiomask = 0x0f, /* old: 7 */ |
2675 | .muxsel = MUXSEL(0, 1, 3, 2), /* Composite 0-3 */ | 2640 | .muxsel = MUXSEL(0, 1, 3, 2), /* Composite 0-3 */ |
2676 | .no_msp34xx = 1, | 2641 | .no_msp34xx = 1, |
2677 | .no_tda9875 = 1, | ||
2678 | .no_tda7432 = 1, | 2642 | .no_tda7432 = 1, |
2679 | .tuner_type = TUNER_ABSENT, | 2643 | .tuner_type = TUNER_ABSENT, |
2680 | .tuner_addr = ADDR_UNSET, | 2644 | .tuner_addr = ADDR_UNSET, |
@@ -2732,7 +2696,6 @@ struct tvcard bttv_tvcards[] = { | |||
2732 | .gpiomux = { 0x00400005, 0, 0x00000001, 0 }, | 2696 | .gpiomux = { 0x00400005, 0, 0x00000001, 0 }, |
2733 | .gpiomute = 0x00c00007, | 2697 | .gpiomute = 0x00c00007, |
2734 | .no_msp34xx = 1, | 2698 | .no_msp34xx = 1, |
2735 | .no_tda9875 = 1, | ||
2736 | .no_tda7432 = 1, | 2699 | .no_tda7432 = 1, |
2737 | }, | 2700 | }, |
2738 | /* ---- card 0x95---------------------------------- */ | 2701 | /* ---- card 0x95---------------------------------- */ |
@@ -2874,7 +2837,6 @@ struct tvcard bttv_tvcards[] = { | |||
2874 | .pll = PLL_28, | 2837 | .pll = PLL_28, |
2875 | .no_msp34xx = 1, | 2838 | .no_msp34xx = 1, |
2876 | .no_tda7432 = 1, | 2839 | .no_tda7432 = 1, |
2877 | .no_tda9875 = 1, | ||
2878 | .muxsel_hook = gv800s_muxsel, | 2840 | .muxsel_hook = gv800s_muxsel, |
2879 | }, | 2841 | }, |
2880 | [BTTV_BOARD_GEOVISION_GV800S_SL] = { | 2842 | [BTTV_BOARD_GEOVISION_GV800S_SL] = { |
@@ -2899,7 +2861,6 @@ struct tvcard bttv_tvcards[] = { | |||
2899 | .pll = PLL_28, | 2861 | .pll = PLL_28, |
2900 | .no_msp34xx = 1, | 2862 | .no_msp34xx = 1, |
2901 | .no_tda7432 = 1, | 2863 | .no_tda7432 = 1, |
2902 | .no_tda9875 = 1, | ||
2903 | .muxsel_hook = gv800s_muxsel, | 2864 | .muxsel_hook = gv800s_muxsel, |
2904 | }, | 2865 | }, |
2905 | [BTTV_BOARD_PV183] = { | 2866 | [BTTV_BOARD_PV183] = { |
diff --git a/drivers/media/video/bt8xx/bttv.h b/drivers/media/video/bt8xx/bttv.h index fd62bf15d779..c6333595c6b9 100644 --- a/drivers/media/video/bt8xx/bttv.h +++ b/drivers/media/video/bt8xx/bttv.h | |||
@@ -234,7 +234,6 @@ struct tvcard { | |||
234 | 234 | ||
235 | /* i2c audio flags */ | 235 | /* i2c audio flags */ |
236 | unsigned int no_msp34xx:1; | 236 | unsigned int no_msp34xx:1; |
237 | unsigned int no_tda9875:1; | ||
238 | unsigned int no_tda7432:1; | 237 | unsigned int no_tda7432:1; |
239 | unsigned int needs_tvaudio:1; | 238 | unsigned int needs_tvaudio:1; |
240 | unsigned int msp34xx_alt:1; | 239 | unsigned int msp34xx_alt:1; |
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c index 49f1b8f1418e..55ffd60ffa7f 100644 --- a/drivers/media/video/cafe_ccic.c +++ b/drivers/media/video/cafe_ccic.c | |||
@@ -2001,6 +2001,11 @@ static int cafe_pci_probe(struct pci_dev *pdev, | |||
2001 | .min_width = 320, | 2001 | .min_width = 320, |
2002 | .min_height = 240, | 2002 | .min_height = 240, |
2003 | }; | 2003 | }; |
2004 | struct i2c_board_info ov7670_info = { | ||
2005 | .type = "ov7670", | ||
2006 | .addr = 0x42, | ||
2007 | .platform_data = &sensor_cfg, | ||
2008 | }; | ||
2004 | 2009 | ||
2005 | /* | 2010 | /* |
2006 | * Start putting together one of our big camera structures. | 2011 | * Start putting together one of our big camera structures. |
@@ -2062,9 +2067,9 @@ static int cafe_pci_probe(struct pci_dev *pdev, | |||
2062 | if (dmi_check_system(olpc_xo1_dmi)) | 2067 | if (dmi_check_system(olpc_xo1_dmi)) |
2063 | sensor_cfg.clock_speed = 45; | 2068 | sensor_cfg.clock_speed = 45; |
2064 | 2069 | ||
2065 | cam->sensor_addr = 0x42; | 2070 | cam->sensor_addr = ov7670_info.addr; |
2066 | cam->sensor = v4l2_i2c_new_subdev_cfg(&cam->v4l2_dev, &cam->i2c_adapter, | 2071 | cam->sensor = v4l2_i2c_new_subdev_board(&cam->v4l2_dev, &cam->i2c_adapter, |
2067 | "ov7670", 0, &sensor_cfg, cam->sensor_addr, NULL); | 2072 | &ov7670_info, NULL); |
2068 | if (cam->sensor == NULL) { | 2073 | if (cam->sensor == NULL) { |
2069 | ret = -ENODEV; | 2074 | ret = -ENODEV; |
2070 | goto out_smbus; | 2075 | goto out_smbus; |
diff --git a/drivers/media/video/cpia2/cpia2.h b/drivers/media/video/cpia2/cpia2.h index 916c13d5cf7d..6d6d1843791c 100644 --- a/drivers/media/video/cpia2/cpia2.h +++ b/drivers/media/video/cpia2/cpia2.h | |||
@@ -378,7 +378,7 @@ struct cpia2_fh { | |||
378 | 378 | ||
379 | struct camera_data { | 379 | struct camera_data { |
380 | /* locks */ | 380 | /* locks */ |
381 | struct mutex busy_lock; /* guard against SMP multithreading */ | 381 | struct mutex v4l2_lock; /* serialize file operations */ |
382 | struct v4l2_prio_state prio; | 382 | struct v4l2_prio_state prio; |
383 | 383 | ||
384 | /* camera status */ | 384 | /* camera status */ |
diff --git a/drivers/media/video/cpia2/cpia2_core.c b/drivers/media/video/cpia2/cpia2_core.c index 9606bc01b803..aaffca8e13fd 100644 --- a/drivers/media/video/cpia2/cpia2_core.c +++ b/drivers/media/video/cpia2/cpia2_core.c | |||
@@ -2247,7 +2247,7 @@ struct camera_data *cpia2_init_camera_struct(void) | |||
2247 | 2247 | ||
2248 | 2248 | ||
2249 | cam->present = 1; | 2249 | cam->present = 1; |
2250 | mutex_init(&cam->busy_lock); | 2250 | mutex_init(&cam->v4l2_lock); |
2251 | init_waitqueue_head(&cam->wq_stream); | 2251 | init_waitqueue_head(&cam->wq_stream); |
2252 | 2252 | ||
2253 | return cam; | 2253 | return cam; |
@@ -2365,9 +2365,9 @@ long cpia2_read(struct camera_data *cam, | |||
2365 | char __user *buf, unsigned long count, int noblock) | 2365 | char __user *buf, unsigned long count, int noblock) |
2366 | { | 2366 | { |
2367 | struct framebuf *frame; | 2367 | struct framebuf *frame; |
2368 | if (!count) { | 2368 | |
2369 | if (!count) | ||
2369 | return 0; | 2370 | return 0; |
2370 | } | ||
2371 | 2371 | ||
2372 | if (!buf) { | 2372 | if (!buf) { |
2373 | ERR("%s: buffer NULL\n",__func__); | 2373 | ERR("%s: buffer NULL\n",__func__); |
@@ -2379,17 +2379,12 @@ long cpia2_read(struct camera_data *cam, | |||
2379 | return -EINVAL; | 2379 | return -EINVAL; |
2380 | } | 2380 | } |
2381 | 2381 | ||
2382 | /* make this _really_ smp and multithread-safe */ | ||
2383 | if (mutex_lock_interruptible(&cam->busy_lock)) | ||
2384 | return -ERESTARTSYS; | ||
2385 | |||
2386 | if (!cam->present) { | 2382 | if (!cam->present) { |
2387 | LOG("%s: camera removed\n",__func__); | 2383 | LOG("%s: camera removed\n",__func__); |
2388 | mutex_unlock(&cam->busy_lock); | ||
2389 | return 0; /* EOF */ | 2384 | return 0; /* EOF */ |
2390 | } | 2385 | } |
2391 | 2386 | ||
2392 | if(!cam->streaming) { | 2387 | if (!cam->streaming) { |
2393 | /* Start streaming */ | 2388 | /* Start streaming */ |
2394 | cpia2_usb_stream_start(cam, | 2389 | cpia2_usb_stream_start(cam, |
2395 | cam->params.camera_state.stream_mode); | 2390 | cam->params.camera_state.stream_mode); |
@@ -2398,42 +2393,31 @@ long cpia2_read(struct camera_data *cam, | |||
2398 | /* Copy cam->curbuff in case it changes while we're processing */ | 2393 | /* Copy cam->curbuff in case it changes while we're processing */ |
2399 | frame = cam->curbuff; | 2394 | frame = cam->curbuff; |
2400 | if (noblock && frame->status != FRAME_READY) { | 2395 | if (noblock && frame->status != FRAME_READY) { |
2401 | mutex_unlock(&cam->busy_lock); | ||
2402 | return -EAGAIN; | 2396 | return -EAGAIN; |
2403 | } | 2397 | } |
2404 | 2398 | ||
2405 | if(frame->status != FRAME_READY) { | 2399 | if (frame->status != FRAME_READY) { |
2406 | mutex_unlock(&cam->busy_lock); | 2400 | mutex_unlock(&cam->v4l2_lock); |
2407 | wait_event_interruptible(cam->wq_stream, | 2401 | wait_event_interruptible(cam->wq_stream, |
2408 | !cam->present || | 2402 | !cam->present || |
2409 | (frame = cam->curbuff)->status == FRAME_READY); | 2403 | (frame = cam->curbuff)->status == FRAME_READY); |
2404 | mutex_lock(&cam->v4l2_lock); | ||
2410 | if (signal_pending(current)) | 2405 | if (signal_pending(current)) |
2411 | return -ERESTARTSYS; | 2406 | return -ERESTARTSYS; |
2412 | /* make this _really_ smp and multithread-safe */ | 2407 | if (!cam->present) |
2413 | if (mutex_lock_interruptible(&cam->busy_lock)) { | ||
2414 | return -ERESTARTSYS; | ||
2415 | } | ||
2416 | if(!cam->present) { | ||
2417 | mutex_unlock(&cam->busy_lock); | ||
2418 | return 0; | 2408 | return 0; |
2419 | } | ||
2420 | } | 2409 | } |
2421 | 2410 | ||
2422 | /* copy data to user space */ | 2411 | /* copy data to user space */ |
2423 | if (frame->length > count) { | 2412 | if (frame->length > count) |
2424 | mutex_unlock(&cam->busy_lock); | ||
2425 | return -EFAULT; | 2413 | return -EFAULT; |
2426 | } | 2414 | if (copy_to_user(buf, frame->data, frame->length)) |
2427 | if (copy_to_user(buf, frame->data, frame->length)) { | ||
2428 | mutex_unlock(&cam->busy_lock); | ||
2429 | return -EFAULT; | 2415 | return -EFAULT; |
2430 | } | ||
2431 | 2416 | ||
2432 | count = frame->length; | 2417 | count = frame->length; |
2433 | 2418 | ||
2434 | frame->status = FRAME_EMPTY; | 2419 | frame->status = FRAME_EMPTY; |
2435 | 2420 | ||
2436 | mutex_unlock(&cam->busy_lock); | ||
2437 | return count; | 2421 | return count; |
2438 | } | 2422 | } |
2439 | 2423 | ||
@@ -2447,17 +2431,13 @@ unsigned int cpia2_poll(struct camera_data *cam, struct file *filp, | |||
2447 | { | 2431 | { |
2448 | unsigned int status=0; | 2432 | unsigned int status=0; |
2449 | 2433 | ||
2450 | if(!cam) { | 2434 | if (!cam) { |
2451 | ERR("%s: Internal error, camera_data not found!\n",__func__); | 2435 | ERR("%s: Internal error, camera_data not found!\n",__func__); |
2452 | return POLLERR; | 2436 | return POLLERR; |
2453 | } | 2437 | } |
2454 | 2438 | ||
2455 | mutex_lock(&cam->busy_lock); | 2439 | if (!cam->present) |
2456 | |||
2457 | if(!cam->present) { | ||
2458 | mutex_unlock(&cam->busy_lock); | ||
2459 | return POLLHUP; | 2440 | return POLLHUP; |
2460 | } | ||
2461 | 2441 | ||
2462 | if(!cam->streaming) { | 2442 | if(!cam->streaming) { |
2463 | /* Start streaming */ | 2443 | /* Start streaming */ |
@@ -2465,16 +2445,13 @@ unsigned int cpia2_poll(struct camera_data *cam, struct file *filp, | |||
2465 | cam->params.camera_state.stream_mode); | 2445 | cam->params.camera_state.stream_mode); |
2466 | } | 2446 | } |
2467 | 2447 | ||
2468 | mutex_unlock(&cam->busy_lock); | ||
2469 | poll_wait(filp, &cam->wq_stream, wait); | 2448 | poll_wait(filp, &cam->wq_stream, wait); |
2470 | mutex_lock(&cam->busy_lock); | ||
2471 | 2449 | ||
2472 | if(!cam->present) | 2450 | if(!cam->present) |
2473 | status = POLLHUP; | 2451 | status = POLLHUP; |
2474 | else if(cam->curbuff->status == FRAME_READY) | 2452 | else if(cam->curbuff->status == FRAME_READY) |
2475 | status = POLLIN | POLLRDNORM; | 2453 | status = POLLIN | POLLRDNORM; |
2476 | 2454 | ||
2477 | mutex_unlock(&cam->busy_lock); | ||
2478 | return status; | 2455 | return status; |
2479 | } | 2456 | } |
2480 | 2457 | ||
@@ -2496,29 +2473,19 @@ int cpia2_remap_buffer(struct camera_data *cam, struct vm_area_struct *vma) | |||
2496 | 2473 | ||
2497 | DBG("mmap offset:%ld size:%ld\n", start_offset, size); | 2474 | DBG("mmap offset:%ld size:%ld\n", start_offset, size); |
2498 | 2475 | ||
2499 | /* make this _really_ smp-safe */ | 2476 | if (!cam->present) |
2500 | if (mutex_lock_interruptible(&cam->busy_lock)) | ||
2501 | return -ERESTARTSYS; | ||
2502 | |||
2503 | if (!cam->present) { | ||
2504 | mutex_unlock(&cam->busy_lock); | ||
2505 | return -ENODEV; | 2477 | return -ENODEV; |
2506 | } | ||
2507 | 2478 | ||
2508 | if (size > cam->frame_size*cam->num_frames || | 2479 | if (size > cam->frame_size*cam->num_frames || |
2509 | (start_offset % cam->frame_size) != 0 || | 2480 | (start_offset % cam->frame_size) != 0 || |
2510 | (start_offset+size > cam->frame_size*cam->num_frames)) { | 2481 | (start_offset+size > cam->frame_size*cam->num_frames)) |
2511 | mutex_unlock(&cam->busy_lock); | ||
2512 | return -EINVAL; | 2482 | return -EINVAL; |
2513 | } | ||
2514 | 2483 | ||
2515 | pos = ((unsigned long) (cam->frame_buffer)) + start_offset; | 2484 | pos = ((unsigned long) (cam->frame_buffer)) + start_offset; |
2516 | while (size > 0) { | 2485 | while (size > 0) { |
2517 | page = kvirt_to_pa(pos); | 2486 | page = kvirt_to_pa(pos); |
2518 | if (remap_pfn_range(vma, start, page >> PAGE_SHIFT, PAGE_SIZE, PAGE_SHARED)) { | 2487 | if (remap_pfn_range(vma, start, page >> PAGE_SHIFT, PAGE_SIZE, PAGE_SHARED)) |
2519 | mutex_unlock(&cam->busy_lock); | ||
2520 | return -EAGAIN; | 2488 | return -EAGAIN; |
2521 | } | ||
2522 | start += PAGE_SIZE; | 2489 | start += PAGE_SIZE; |
2523 | pos += PAGE_SIZE; | 2490 | pos += PAGE_SIZE; |
2524 | if (size > PAGE_SIZE) | 2491 | if (size > PAGE_SIZE) |
@@ -2528,7 +2495,5 @@ int cpia2_remap_buffer(struct camera_data *cam, struct vm_area_struct *vma) | |||
2528 | } | 2495 | } |
2529 | 2496 | ||
2530 | cam->mmapped = true; | 2497 | cam->mmapped = true; |
2531 | mutex_unlock(&cam->busy_lock); | ||
2532 | return 0; | 2498 | return 0; |
2533 | } | 2499 | } |
2534 | |||
diff --git a/drivers/media/video/cpia2/cpia2_v4l.c b/drivers/media/video/cpia2/cpia2_v4l.c index 7edf80b0d01a..9bad39842936 100644 --- a/drivers/media/video/cpia2/cpia2_v4l.c +++ b/drivers/media/video/cpia2/cpia2_v4l.c | |||
@@ -238,59 +238,40 @@ static struct v4l2_queryctrl controls[] = { | |||
238 | static int cpia2_open(struct file *file) | 238 | static int cpia2_open(struct file *file) |
239 | { | 239 | { |
240 | struct camera_data *cam = video_drvdata(file); | 240 | struct camera_data *cam = video_drvdata(file); |
241 | int retval = 0; | 241 | struct cpia2_fh *fh; |
242 | 242 | ||
243 | if (!cam) { | 243 | if (!cam) { |
244 | ERR("Internal error, camera_data not found!\n"); | 244 | ERR("Internal error, camera_data not found!\n"); |
245 | return -ENODEV; | 245 | return -ENODEV; |
246 | } | 246 | } |
247 | 247 | ||
248 | if(mutex_lock_interruptible(&cam->busy_lock)) | 248 | if (!cam->present) |
249 | return -ERESTARTSYS; | 249 | return -ENODEV; |
250 | |||
251 | if(!cam->present) { | ||
252 | retval = -ENODEV; | ||
253 | goto err_return; | ||
254 | } | ||
255 | 250 | ||
256 | if (cam->open_count > 0) { | 251 | if (cam->open_count == 0) { |
257 | goto skip_init; | 252 | if (cpia2_allocate_buffers(cam)) |
258 | } | 253 | return -ENOMEM; |
259 | 254 | ||
260 | if (cpia2_allocate_buffers(cam)) { | 255 | /* reset the camera */ |
261 | retval = -ENOMEM; | 256 | if (cpia2_reset_camera(cam) < 0) |
262 | goto err_return; | 257 | return -EIO; |
263 | } | ||
264 | 258 | ||
265 | /* reset the camera */ | 259 | cam->APP_len = 0; |
266 | if (cpia2_reset_camera(cam) < 0) { | 260 | cam->COM_len = 0; |
267 | retval = -EIO; | ||
268 | goto err_return; | ||
269 | } | 261 | } |
270 | 262 | ||
271 | cam->APP_len = 0; | 263 | fh = kmalloc(sizeof(*fh), GFP_KERNEL); |
272 | cam->COM_len = 0; | 264 | if (!fh) |
273 | 265 | return -ENOMEM; | |
274 | skip_init: | 266 | file->private_data = fh; |
275 | { | 267 | fh->prio = V4L2_PRIORITY_UNSET; |
276 | struct cpia2_fh *fh = kmalloc(sizeof(*fh),GFP_KERNEL); | 268 | v4l2_prio_open(&cam->prio, &fh->prio); |
277 | if(!fh) { | 269 | fh->mmapped = 0; |
278 | retval = -ENOMEM; | ||
279 | goto err_return; | ||
280 | } | ||
281 | file->private_data = fh; | ||
282 | fh->prio = V4L2_PRIORITY_UNSET; | ||
283 | v4l2_prio_open(&cam->prio, &fh->prio); | ||
284 | fh->mmapped = 0; | ||
285 | } | ||
286 | 270 | ||
287 | ++cam->open_count; | 271 | ++cam->open_count; |
288 | 272 | ||
289 | cpia2_dbg_dump_registers(cam); | 273 | cpia2_dbg_dump_registers(cam); |
290 | 274 | return 0; | |
291 | err_return: | ||
292 | mutex_unlock(&cam->busy_lock); | ||
293 | return retval; | ||
294 | } | 275 | } |
295 | 276 | ||
296 | /****************************************************************************** | 277 | /****************************************************************************** |
@@ -304,15 +285,11 @@ static int cpia2_close(struct file *file) | |||
304 | struct camera_data *cam = video_get_drvdata(dev); | 285 | struct camera_data *cam = video_get_drvdata(dev); |
305 | struct cpia2_fh *fh = file->private_data; | 286 | struct cpia2_fh *fh = file->private_data; |
306 | 287 | ||
307 | mutex_lock(&cam->busy_lock); | ||
308 | |||
309 | if (cam->present && | 288 | if (cam->present && |
310 | (cam->open_count == 1 | 289 | (cam->open_count == 1 || fh->prio == V4L2_PRIORITY_RECORD)) { |
311 | || fh->prio == V4L2_PRIORITY_RECORD | ||
312 | )) { | ||
313 | cpia2_usb_stream_stop(cam); | 290 | cpia2_usb_stream_stop(cam); |
314 | 291 | ||
315 | if(cam->open_count == 1) { | 292 | if (cam->open_count == 1) { |
316 | /* save camera state for later open */ | 293 | /* save camera state for later open */ |
317 | cpia2_save_camera_state(cam); | 294 | cpia2_save_camera_state(cam); |
318 | 295 | ||
@@ -321,26 +298,21 @@ static int cpia2_close(struct file *file) | |||
321 | } | 298 | } |
322 | } | 299 | } |
323 | 300 | ||
324 | { | 301 | if (fh->mmapped) |
325 | if(fh->mmapped) | 302 | cam->mmapped = 0; |
326 | cam->mmapped = 0; | 303 | v4l2_prio_close(&cam->prio, fh->prio); |
327 | v4l2_prio_close(&cam->prio, fh->prio); | 304 | file->private_data = NULL; |
328 | file->private_data = NULL; | 305 | kfree(fh); |
329 | kfree(fh); | ||
330 | } | ||
331 | 306 | ||
332 | if (--cam->open_count == 0) { | 307 | if (--cam->open_count == 0) { |
333 | cpia2_free_buffers(cam); | 308 | cpia2_free_buffers(cam); |
334 | if (!cam->present) { | 309 | if (!cam->present) { |
335 | video_unregister_device(dev); | 310 | video_unregister_device(dev); |
336 | mutex_unlock(&cam->busy_lock); | ||
337 | kfree(cam); | 311 | kfree(cam); |
338 | return 0; | 312 | return 0; |
339 | } | 313 | } |
340 | } | 314 | } |
341 | 315 | ||
342 | mutex_unlock(&cam->busy_lock); | ||
343 | |||
344 | return 0; | 316 | return 0; |
345 | } | 317 | } |
346 | 318 | ||
@@ -405,11 +377,11 @@ static int sync(struct camera_data *cam, int frame_nr) | |||
405 | return 0; | 377 | return 0; |
406 | } | 378 | } |
407 | 379 | ||
408 | mutex_unlock(&cam->busy_lock); | 380 | mutex_unlock(&cam->v4l2_lock); |
409 | wait_event_interruptible(cam->wq_stream, | 381 | wait_event_interruptible(cam->wq_stream, |
410 | !cam->streaming || | 382 | !cam->streaming || |
411 | frame->status == FRAME_READY); | 383 | frame->status == FRAME_READY); |
412 | mutex_lock(&cam->busy_lock); | 384 | mutex_lock(&cam->v4l2_lock); |
413 | if (signal_pending(current)) | 385 | if (signal_pending(current)) |
414 | return -ERESTARTSYS; | 386 | return -ERESTARTSYS; |
415 | if(!cam->present) | 387 | if(!cam->present) |
@@ -1293,11 +1265,11 @@ static int ioctl_dqbuf(void *arg,struct camera_data *cam, struct file *file) | |||
1293 | if(frame < 0) { | 1265 | if(frame < 0) { |
1294 | /* Wait for a frame to become available */ | 1266 | /* Wait for a frame to become available */ |
1295 | struct framebuf *cb=cam->curbuff; | 1267 | struct framebuf *cb=cam->curbuff; |
1296 | mutex_unlock(&cam->busy_lock); | 1268 | mutex_unlock(&cam->v4l2_lock); |
1297 | wait_event_interruptible(cam->wq_stream, | 1269 | wait_event_interruptible(cam->wq_stream, |
1298 | !cam->present || | 1270 | !cam->present || |
1299 | (cb=cam->curbuff)->status == FRAME_READY); | 1271 | (cb=cam->curbuff)->status == FRAME_READY); |
1300 | mutex_lock(&cam->busy_lock); | 1272 | mutex_lock(&cam->v4l2_lock); |
1301 | if (signal_pending(current)) | 1273 | if (signal_pending(current)) |
1302 | return -ERESTARTSYS; | 1274 | return -ERESTARTSYS; |
1303 | if(!cam->present) | 1275 | if(!cam->present) |
@@ -1337,14 +1309,8 @@ static long cpia2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
1337 | if (!cam) | 1309 | if (!cam) |
1338 | return -ENOTTY; | 1310 | return -ENOTTY; |
1339 | 1311 | ||
1340 | /* make this _really_ smp-safe */ | 1312 | if (!cam->present) |
1341 | if (mutex_lock_interruptible(&cam->busy_lock)) | ||
1342 | return -ERESTARTSYS; | ||
1343 | |||
1344 | if (!cam->present) { | ||
1345 | mutex_unlock(&cam->busy_lock); | ||
1346 | return -ENODEV; | 1313 | return -ENODEV; |
1347 | } | ||
1348 | 1314 | ||
1349 | /* Priority check */ | 1315 | /* Priority check */ |
1350 | switch (cmd) { | 1316 | switch (cmd) { |
@@ -1352,10 +1318,8 @@ static long cpia2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
1352 | { | 1318 | { |
1353 | struct cpia2_fh *fh = file->private_data; | 1319 | struct cpia2_fh *fh = file->private_data; |
1354 | retval = v4l2_prio_check(&cam->prio, fh->prio); | 1320 | retval = v4l2_prio_check(&cam->prio, fh->prio); |
1355 | if(retval) { | 1321 | if (retval) |
1356 | mutex_unlock(&cam->busy_lock); | ||
1357 | return retval; | 1322 | return retval; |
1358 | } | ||
1359 | break; | 1323 | break; |
1360 | } | 1324 | } |
1361 | default: | 1325 | default: |
@@ -1529,7 +1493,6 @@ static long cpia2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
1529 | break; | 1493 | break; |
1530 | } | 1494 | } |
1531 | 1495 | ||
1532 | mutex_unlock(&cam->busy_lock); | ||
1533 | return retval; | 1496 | return retval; |
1534 | } | 1497 | } |
1535 | 1498 | ||
@@ -1596,7 +1559,7 @@ static const struct v4l2_file_operations cpia2_fops = { | |||
1596 | .release = cpia2_close, | 1559 | .release = cpia2_close, |
1597 | .read = cpia2_v4l_read, | 1560 | .read = cpia2_v4l_read, |
1598 | .poll = cpia2_v4l_poll, | 1561 | .poll = cpia2_v4l_poll, |
1599 | .ioctl = cpia2_ioctl, | 1562 | .unlocked_ioctl = cpia2_ioctl, |
1600 | .mmap = cpia2_mmap, | 1563 | .mmap = cpia2_mmap, |
1601 | }; | 1564 | }; |
1602 | 1565 | ||
@@ -1620,6 +1583,7 @@ int cpia2_register_camera(struct camera_data *cam) | |||
1620 | 1583 | ||
1621 | memcpy(cam->vdev, &cpia2_template, sizeof(cpia2_template)); | 1584 | memcpy(cam->vdev, &cpia2_template, sizeof(cpia2_template)); |
1622 | video_set_drvdata(cam->vdev, cam); | 1585 | video_set_drvdata(cam->vdev, cam); |
1586 | cam->vdev->lock = &cam->v4l2_lock; | ||
1623 | 1587 | ||
1624 | reset_camera_struct_v4l(cam); | 1588 | reset_camera_struct_v4l(cam); |
1625 | 1589 | ||
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c index 133ec2bac180..944af8adbe0c 100644 --- a/drivers/media/video/cx18/cx18-driver.c +++ b/drivers/media/video/cx18/cx18-driver.c | |||
@@ -664,7 +664,7 @@ static int __devinit cx18_create_in_workq(struct cx18 *cx) | |||
664 | { | 664 | { |
665 | snprintf(cx->in_workq_name, sizeof(cx->in_workq_name), "%s-in", | 665 | snprintf(cx->in_workq_name, sizeof(cx->in_workq_name), "%s-in", |
666 | cx->v4l2_dev.name); | 666 | cx->v4l2_dev.name); |
667 | cx->in_work_queue = create_singlethread_workqueue(cx->in_workq_name); | 667 | cx->in_work_queue = alloc_ordered_workqueue(cx->in_workq_name, 0); |
668 | if (cx->in_work_queue == NULL) { | 668 | if (cx->in_work_queue == NULL) { |
669 | CX18_ERR("Unable to create incoming mailbox handler thread\n"); | 669 | CX18_ERR("Unable to create incoming mailbox handler thread\n"); |
670 | return -ENOMEM; | 670 | return -ENOMEM; |
@@ -672,18 +672,6 @@ static int __devinit cx18_create_in_workq(struct cx18 *cx) | |||
672 | return 0; | 672 | return 0; |
673 | } | 673 | } |
674 | 674 | ||
675 | static int __devinit cx18_create_out_workq(struct cx18 *cx) | ||
676 | { | ||
677 | snprintf(cx->out_workq_name, sizeof(cx->out_workq_name), "%s-out", | ||
678 | cx->v4l2_dev.name); | ||
679 | cx->out_work_queue = create_workqueue(cx->out_workq_name); | ||
680 | if (cx->out_work_queue == NULL) { | ||
681 | CX18_ERR("Unable to create outgoing mailbox handler threads\n"); | ||
682 | return -ENOMEM; | ||
683 | } | ||
684 | return 0; | ||
685 | } | ||
686 | |||
687 | static void __devinit cx18_init_in_work_orders(struct cx18 *cx) | 675 | static void __devinit cx18_init_in_work_orders(struct cx18 *cx) |
688 | { | 676 | { |
689 | int i; | 677 | int i; |
@@ -710,15 +698,9 @@ static int __devinit cx18_init_struct1(struct cx18 *cx) | |||
710 | mutex_init(&cx->epu2apu_mb_lock); | 698 | mutex_init(&cx->epu2apu_mb_lock); |
711 | mutex_init(&cx->epu2cpu_mb_lock); | 699 | mutex_init(&cx->epu2cpu_mb_lock); |
712 | 700 | ||
713 | ret = cx18_create_out_workq(cx); | ||
714 | if (ret) | ||
715 | return ret; | ||
716 | |||
717 | ret = cx18_create_in_workq(cx); | 701 | ret = cx18_create_in_workq(cx); |
718 | if (ret) { | 702 | if (ret) |
719 | destroy_workqueue(cx->out_work_queue); | ||
720 | return ret; | 703 | return ret; |
721 | } | ||
722 | 704 | ||
723 | cx18_init_in_work_orders(cx); | 705 | cx18_init_in_work_orders(cx); |
724 | 706 | ||
@@ -1107,7 +1089,6 @@ free_mem: | |||
1107 | release_mem_region(cx->base_addr, CX18_MEM_SIZE); | 1089 | release_mem_region(cx->base_addr, CX18_MEM_SIZE); |
1108 | free_workqueues: | 1090 | free_workqueues: |
1109 | destroy_workqueue(cx->in_work_queue); | 1091 | destroy_workqueue(cx->in_work_queue); |
1110 | destroy_workqueue(cx->out_work_queue); | ||
1111 | err: | 1092 | err: |
1112 | if (retval == 0) | 1093 | if (retval == 0) |
1113 | retval = -ENODEV; | 1094 | retval = -ENODEV; |
@@ -1259,7 +1240,6 @@ static void cx18_remove(struct pci_dev *pci_dev) | |||
1259 | cx18_halt_firmware(cx); | 1240 | cx18_halt_firmware(cx); |
1260 | 1241 | ||
1261 | destroy_workqueue(cx->in_work_queue); | 1242 | destroy_workqueue(cx->in_work_queue); |
1262 | destroy_workqueue(cx->out_work_queue); | ||
1263 | 1243 | ||
1264 | cx18_streams_cleanup(cx, 1); | 1244 | cx18_streams_cleanup(cx, 1); |
1265 | 1245 | ||
diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h index f6f3e50d4bdf..306caac6d3fc 100644 --- a/drivers/media/video/cx18/cx18-driver.h +++ b/drivers/media/video/cx18/cx18-driver.h | |||
@@ -617,9 +617,6 @@ struct cx18 { | |||
617 | struct cx18_in_work_order in_work_order[CX18_MAX_IN_WORK_ORDERS]; | 617 | struct cx18_in_work_order in_work_order[CX18_MAX_IN_WORK_ORDERS]; |
618 | char epu_debug_str[256]; /* CX18_EPU_DEBUG is rare: use shared space */ | 618 | char epu_debug_str[256]; /* CX18_EPU_DEBUG is rare: use shared space */ |
619 | 619 | ||
620 | struct workqueue_struct *out_work_queue; | ||
621 | char out_workq_name[12]; /* "cx18-NN-out" */ | ||
622 | |||
623 | /* i2c */ | 620 | /* i2c */ |
624 | struct i2c_adapter i2c_adap[2]; | 621 | struct i2c_adapter i2c_adap[2]; |
625 | struct i2c_algo_bit_data i2c_algo[2]; | 622 | struct i2c_algo_bit_data i2c_algo[2]; |
diff --git a/drivers/media/video/cx18/cx18-streams.h b/drivers/media/video/cx18/cx18-streams.h index 51765eb12d39..713b0e61536d 100644 --- a/drivers/media/video/cx18/cx18-streams.h +++ b/drivers/media/video/cx18/cx18-streams.h | |||
@@ -42,8 +42,7 @@ static inline bool cx18_stream_enabled(struct cx18_stream *s) | |||
42 | /* Related to submission of mdls to firmware */ | 42 | /* Related to submission of mdls to firmware */ |
43 | static inline void cx18_stream_load_fw_queue(struct cx18_stream *s) | 43 | static inline void cx18_stream_load_fw_queue(struct cx18_stream *s) |
44 | { | 44 | { |
45 | struct cx18 *cx = s->cx; | 45 | schedule_work(&s->out_work_order); |
46 | queue_work(cx->out_work_queue, &s->out_work_order); | ||
47 | } | 46 | } |
48 | 47 | ||
49 | static inline void cx18_stream_put_mdl_fw(struct cx18_stream *s, | 48 | static inline void cx18_stream_put_mdl_fw(struct cx18_stream *s, |
diff --git a/drivers/media/video/cx231xx/cx231xx-dvb.c b/drivers/media/video/cx231xx/cx231xx-dvb.c index fe59a1c3f064..363aa6004221 100644 --- a/drivers/media/video/cx231xx/cx231xx-dvb.c +++ b/drivers/media/video/cx231xx/cx231xx-dvb.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <media/videobuf-vmalloc.h> | 28 | #include <media/videobuf-vmalloc.h> |
29 | 29 | ||
30 | #include "xc5000.h" | 30 | #include "xc5000.h" |
31 | #include "dvb_dummy_fe.h" | ||
32 | #include "s5h1432.h" | 31 | #include "s5h1432.h" |
33 | #include "tda18271.h" | 32 | #include "tda18271.h" |
34 | #include "s5h1411.h" | 33 | #include "s5h1411.h" |
@@ -619,7 +618,7 @@ static int dvb_init(struct cx231xx *dev) | |||
619 | 618 | ||
620 | if (dev->dvb->frontend == NULL) { | 619 | if (dev->dvb->frontend == NULL) { |
621 | printk(DRIVER_NAME | 620 | printk(DRIVER_NAME |
622 | ": Failed to attach dummy front end\n"); | 621 | ": Failed to attach s5h1411 front end\n"); |
623 | result = -EINVAL; | 622 | result = -EINVAL; |
624 | goto out_free; | 623 | goto out_free; |
625 | } | 624 | } |
@@ -665,7 +664,7 @@ static int dvb_init(struct cx231xx *dev) | |||
665 | 664 | ||
666 | if (dev->dvb->frontend == NULL) { | 665 | if (dev->dvb->frontend == NULL) { |
667 | printk(DRIVER_NAME | 666 | printk(DRIVER_NAME |
668 | ": Failed to attach dummy front end\n"); | 667 | ": Failed to attach s5h1411 front end\n"); |
669 | result = -EINVAL; | 668 | result = -EINVAL; |
670 | goto out_free; | 669 | goto out_free; |
671 | } | 670 | } |
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index f16461844c5c..6fc09dd41b9d 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
@@ -1682,20 +1682,6 @@ static int cx25840_log_status(struct v4l2_subdev *sd) | |||
1682 | return 0; | 1682 | return 0; |
1683 | } | 1683 | } |
1684 | 1684 | ||
1685 | static int cx25840_s_config(struct v4l2_subdev *sd, int irq, void *platform_data) | ||
1686 | { | ||
1687 | struct cx25840_state *state = to_state(sd); | ||
1688 | struct i2c_client *client = v4l2_get_subdevdata(sd); | ||
1689 | |||
1690 | if (platform_data) { | ||
1691 | struct cx25840_platform_data *pdata = platform_data; | ||
1692 | |||
1693 | state->pvr150_workaround = pdata->pvr150_workaround; | ||
1694 | set_input(client, state->vid_input, state->aud_input); | ||
1695 | } | ||
1696 | return 0; | ||
1697 | } | ||
1698 | |||
1699 | static int cx23885_irq_handler(struct v4l2_subdev *sd, u32 status, | 1685 | static int cx23885_irq_handler(struct v4l2_subdev *sd, u32 status, |
1700 | bool *handled) | 1686 | bool *handled) |
1701 | { | 1687 | { |
@@ -1787,7 +1773,6 @@ static const struct v4l2_ctrl_ops cx25840_ctrl_ops = { | |||
1787 | 1773 | ||
1788 | static const struct v4l2_subdev_core_ops cx25840_core_ops = { | 1774 | static const struct v4l2_subdev_core_ops cx25840_core_ops = { |
1789 | .log_status = cx25840_log_status, | 1775 | .log_status = cx25840_log_status, |
1790 | .s_config = cx25840_s_config, | ||
1791 | .g_chip_ident = cx25840_g_chip_ident, | 1776 | .g_chip_ident = cx25840_g_chip_ident, |
1792 | .g_ctrl = v4l2_subdev_g_ctrl, | 1777 | .g_ctrl = v4l2_subdev_g_ctrl, |
1793 | .s_ctrl = v4l2_subdev_s_ctrl, | 1778 | .s_ctrl = v4l2_subdev_s_ctrl, |
@@ -1974,7 +1959,6 @@ static int cx25840_probe(struct i2c_client *client, | |||
1974 | state->vid_input = CX25840_COMPOSITE7; | 1959 | state->vid_input = CX25840_COMPOSITE7; |
1975 | state->aud_input = CX25840_AUDIO8; | 1960 | state->aud_input = CX25840_AUDIO8; |
1976 | state->audclk_freq = 48000; | 1961 | state->audclk_freq = 48000; |
1977 | state->pvr150_workaround = 0; | ||
1978 | state->audmode = V4L2_TUNER_MODE_LANG1; | 1962 | state->audmode = V4L2_TUNER_MODE_LANG1; |
1979 | state->vbi_line_offset = 8; | 1963 | state->vbi_line_offset = 8; |
1980 | state->id = id; | 1964 | state->id = id; |
@@ -2034,6 +2018,12 @@ static int cx25840_probe(struct i2c_client *client, | |||
2034 | v4l2_ctrl_cluster(2, &state->volume); | 2018 | v4l2_ctrl_cluster(2, &state->volume); |
2035 | v4l2_ctrl_handler_setup(&state->hdl); | 2019 | v4l2_ctrl_handler_setup(&state->hdl); |
2036 | 2020 | ||
2021 | if (client->dev.platform_data) { | ||
2022 | struct cx25840_platform_data *pdata = client->dev.platform_data; | ||
2023 | |||
2024 | state->pvr150_workaround = pdata->pvr150_workaround; | ||
2025 | } | ||
2026 | |||
2037 | cx25840_ir_probe(sd); | 2027 | cx25840_ir_probe(sd); |
2038 | return 0; | 2028 | return 0; |
2039 | } | 2029 | } |
diff --git a/drivers/media/video/davinci/vpif.c b/drivers/media/video/davinci/vpif.c index 1f532e31cd49..9f3bfc1eb240 100644 --- a/drivers/media/video/davinci/vpif.c +++ b/drivers/media/video/davinci/vpif.c | |||
@@ -41,6 +41,183 @@ spinlock_t vpif_lock; | |||
41 | 41 | ||
42 | void __iomem *vpif_base; | 42 | void __iomem *vpif_base; |
43 | 43 | ||
44 | /** | ||
45 | * ch_params: video standard configuration parameters for vpif | ||
46 | * The table must include all presets from supported subdevices. | ||
47 | */ | ||
48 | const struct vpif_channel_config_params ch_params[] = { | ||
49 | /* HDTV formats */ | ||
50 | { | ||
51 | .name = "480p59_94", | ||
52 | .width = 720, | ||
53 | .height = 480, | ||
54 | .frm_fmt = 1, | ||
55 | .ycmux_mode = 0, | ||
56 | .eav2sav = 138-8, | ||
57 | .sav2eav = 720, | ||
58 | .l1 = 1, | ||
59 | .l3 = 43, | ||
60 | .l5 = 523, | ||
61 | .vsize = 525, | ||
62 | .capture_format = 0, | ||
63 | .vbi_supported = 0, | ||
64 | .hd_sd = 1, | ||
65 | .dv_preset = V4L2_DV_480P59_94, | ||
66 | }, | ||
67 | { | ||
68 | .name = "576p50", | ||
69 | .width = 720, | ||
70 | .height = 576, | ||
71 | .frm_fmt = 1, | ||
72 | .ycmux_mode = 0, | ||
73 | .eav2sav = 144-8, | ||
74 | .sav2eav = 720, | ||
75 | .l1 = 1, | ||
76 | .l3 = 45, | ||
77 | .l5 = 621, | ||
78 | .vsize = 625, | ||
79 | .capture_format = 0, | ||
80 | .vbi_supported = 0, | ||
81 | .hd_sd = 1, | ||
82 | .dv_preset = V4L2_DV_576P50, | ||
83 | }, | ||
84 | { | ||
85 | .name = "720p50", | ||
86 | .width = 1280, | ||
87 | .height = 720, | ||
88 | .frm_fmt = 1, | ||
89 | .ycmux_mode = 0, | ||
90 | .eav2sav = 700-8, | ||
91 | .sav2eav = 1280, | ||
92 | .l1 = 1, | ||
93 | .l3 = 26, | ||
94 | .l5 = 746, | ||
95 | .vsize = 750, | ||
96 | .capture_format = 0, | ||
97 | .vbi_supported = 0, | ||
98 | .hd_sd = 1, | ||
99 | .dv_preset = V4L2_DV_720P50, | ||
100 | }, | ||
101 | { | ||
102 | .name = "720p60", | ||
103 | .width = 1280, | ||
104 | .height = 720, | ||
105 | .frm_fmt = 1, | ||
106 | .ycmux_mode = 0, | ||
107 | .eav2sav = 370 - 8, | ||
108 | .sav2eav = 1280, | ||
109 | .l1 = 1, | ||
110 | .l3 = 26, | ||
111 | .l5 = 746, | ||
112 | .vsize = 750, | ||
113 | .capture_format = 0, | ||
114 | .vbi_supported = 0, | ||
115 | .hd_sd = 1, | ||
116 | .dv_preset = V4L2_DV_720P60, | ||
117 | }, | ||
118 | { | ||
119 | .name = "1080I50", | ||
120 | .width = 1920, | ||
121 | .height = 1080, | ||
122 | .frm_fmt = 0, | ||
123 | .ycmux_mode = 0, | ||
124 | .eav2sav = 720 - 8, | ||
125 | .sav2eav = 1920, | ||
126 | .l1 = 1, | ||
127 | .l3 = 21, | ||
128 | .l5 = 561, | ||
129 | .l7 = 563, | ||
130 | .l9 = 584, | ||
131 | .l11 = 1124, | ||
132 | .vsize = 1125, | ||
133 | .capture_format = 0, | ||
134 | .vbi_supported = 0, | ||
135 | .hd_sd = 1, | ||
136 | .dv_preset = V4L2_DV_1080I50, | ||
137 | }, | ||
138 | { | ||
139 | .name = "1080I60", | ||
140 | .width = 1920, | ||
141 | .height = 1080, | ||
142 | .frm_fmt = 0, | ||
143 | .ycmux_mode = 0, | ||
144 | .eav2sav = 280 - 8, | ||
145 | .sav2eav = 1920, | ||
146 | .l1 = 1, | ||
147 | .l3 = 21, | ||
148 | .l5 = 561, | ||
149 | .l7 = 563, | ||
150 | .l9 = 584, | ||
151 | .l11 = 1124, | ||
152 | .vsize = 1125, | ||
153 | .capture_format = 0, | ||
154 | .vbi_supported = 0, | ||
155 | .hd_sd = 1, | ||
156 | .dv_preset = V4L2_DV_1080I60, | ||
157 | }, | ||
158 | { | ||
159 | .name = "1080p60", | ||
160 | .width = 1920, | ||
161 | .height = 1080, | ||
162 | .frm_fmt = 1, | ||
163 | .ycmux_mode = 0, | ||
164 | .eav2sav = 280 - 8, | ||
165 | .sav2eav = 1920, | ||
166 | .l1 = 1, | ||
167 | .l3 = 42, | ||
168 | .l5 = 1122, | ||
169 | .vsize = 1125, | ||
170 | .capture_format = 0, | ||
171 | .vbi_supported = 0, | ||
172 | .hd_sd = 1, | ||
173 | .dv_preset = V4L2_DV_1080P60, | ||
174 | }, | ||
175 | |||
176 | /* SDTV formats */ | ||
177 | { | ||
178 | .name = "NTSC_M", | ||
179 | .width = 720, | ||
180 | .height = 480, | ||
181 | .frm_fmt = 0, | ||
182 | .ycmux_mode = 1, | ||
183 | .eav2sav = 268, | ||
184 | .sav2eav = 1440, | ||
185 | .l1 = 1, | ||
186 | .l3 = 23, | ||
187 | .l5 = 263, | ||
188 | .l7 = 266, | ||
189 | .l9 = 286, | ||
190 | .l11 = 525, | ||
191 | .vsize = 525, | ||
192 | .capture_format = 0, | ||
193 | .vbi_supported = 1, | ||
194 | .hd_sd = 0, | ||
195 | .stdid = V4L2_STD_525_60, | ||
196 | }, | ||
197 | { | ||
198 | .name = "PAL_BDGHIK", | ||
199 | .width = 720, | ||
200 | .height = 576, | ||
201 | .frm_fmt = 0, | ||
202 | .ycmux_mode = 1, | ||
203 | .eav2sav = 280, | ||
204 | .sav2eav = 1440, | ||
205 | .l1 = 1, | ||
206 | .l3 = 23, | ||
207 | .l5 = 311, | ||
208 | .l7 = 313, | ||
209 | .l9 = 336, | ||
210 | .l11 = 624, | ||
211 | .vsize = 625, | ||
212 | .capture_format = 0, | ||
213 | .vbi_supported = 1, | ||
214 | .hd_sd = 0, | ||
215 | .stdid = V4L2_STD_625_50, | ||
216 | }, | ||
217 | }; | ||
218 | |||
219 | const unsigned int vpif_ch_params_count = ARRAY_SIZE(ch_params); | ||
220 | |||
44 | static inline void vpif_wr_bit(u32 reg, u32 bit, u32 val) | 221 | static inline void vpif_wr_bit(u32 reg, u32 bit, u32 val) |
45 | { | 222 | { |
46 | if (val) | 223 | if (val) |
diff --git a/drivers/media/video/davinci/vpif.h b/drivers/media/video/davinci/vpif.h index ebd5c4338ebb..10550bd93b06 100644 --- a/drivers/media/video/davinci/vpif.h +++ b/drivers/media/video/davinci/vpif.h | |||
@@ -577,12 +577,10 @@ struct vpif_channel_config_params { | |||
577 | char name[VPIF_MAX_NAME]; /* Name of the mode */ | 577 | char name[VPIF_MAX_NAME]; /* Name of the mode */ |
578 | u16 width; /* Indicates width of the image */ | 578 | u16 width; /* Indicates width of the image */ |
579 | u16 height; /* Indicates height of the image */ | 579 | u16 height; /* Indicates height of the image */ |
580 | u8 fps; | 580 | u8 frm_fmt; /* Interlaced (0) or progressive (1) */ |
581 | u8 frm_fmt; /* Indicates whether this is interlaced | 581 | u8 ycmux_mode; /* This mode requires one (0) or two (1) |
582 | * or progressive format */ | 582 | channels */ |
583 | u8 ycmux_mode; /* Indicates whether this mode requires | 583 | u16 eav2sav; /* length of eav 2 sav */ |
584 | * single or two channels */ | ||
585 | u16 eav2sav; /* length of sav 2 eav */ | ||
586 | u16 sav2eav; /* length of sav 2 eav */ | 584 | u16 sav2eav; /* length of sav 2 eav */ |
587 | u16 l1, l3, l5, l7, l9, l11; /* Other parameter configurations */ | 585 | u16 l1, l3, l5, l7, l9, l11; /* Other parameter configurations */ |
588 | u16 vsize; /* Vertical size of the image */ | 586 | u16 vsize; /* Vertical size of the image */ |
@@ -590,10 +588,14 @@ struct vpif_channel_config_params { | |||
590 | * is in BT or in CCD/CMOS */ | 588 | * is in BT or in CCD/CMOS */ |
591 | u8 vbi_supported; /* Indicates whether this mode | 589 | u8 vbi_supported; /* Indicates whether this mode |
592 | * supports capturing vbi or not */ | 590 | * supports capturing vbi or not */ |
593 | u8 hd_sd; | 591 | u8 hd_sd; /* HDTV (1) or SDTV (0) format */ |
594 | v4l2_std_id stdid; | 592 | v4l2_std_id stdid; /* SDTV format */ |
593 | u32 dv_preset; /* HDTV format */ | ||
595 | }; | 594 | }; |
596 | 595 | ||
596 | extern const unsigned int vpif_ch_params_count; | ||
597 | extern const struct vpif_channel_config_params ch_params[]; | ||
598 | |||
597 | struct vpif_video_params; | 599 | struct vpif_video_params; |
598 | struct vpif_params; | 600 | struct vpif_params; |
599 | struct vpif_vbi_params; | 601 | struct vpif_vbi_params; |
diff --git a/drivers/media/video/davinci/vpif_capture.c b/drivers/media/video/davinci/vpif_capture.c index 193abab6b355..d93ad74a34c5 100644 --- a/drivers/media/video/davinci/vpif_capture.c +++ b/drivers/media/video/davinci/vpif_capture.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/slab.h> | 37 | #include <linux/slab.h> |
38 | #include <media/v4l2-device.h> | 38 | #include <media/v4l2-device.h> |
39 | #include <media/v4l2-ioctl.h> | 39 | #include <media/v4l2-ioctl.h> |
40 | #include <media/v4l2-chip-ident.h> | ||
40 | 41 | ||
41 | #include "vpif_capture.h" | 42 | #include "vpif_capture.h" |
42 | #include "vpif.h" | 43 | #include "vpif.h" |
@@ -81,20 +82,6 @@ static struct vpif_device vpif_obj = { {NULL} }; | |||
81 | static struct device *vpif_dev; | 82 | static struct device *vpif_dev; |
82 | 83 | ||
83 | /** | 84 | /** |
84 | * ch_params: video standard configuration parameters for vpif | ||
85 | */ | ||
86 | static const struct vpif_channel_config_params ch_params[] = { | ||
87 | { | ||
88 | "NTSC_M", 720, 480, 30, 0, 1, 268, 1440, 1, 23, 263, 266, | ||
89 | 286, 525, 525, 0, 1, 0, V4L2_STD_525_60, | ||
90 | }, | ||
91 | { | ||
92 | "PAL_BDGHIK", 720, 576, 25, 0, 1, 280, 1440, 1, 23, 311, 313, | ||
93 | 336, 624, 625, 0, 1, 0, V4L2_STD_625_50, | ||
94 | }, | ||
95 | }; | ||
96 | |||
97 | /** | ||
98 | * vpif_uservirt_to_phys : translate user/virtual address to phy address | 85 | * vpif_uservirt_to_phys : translate user/virtual address to phy address |
99 | * @virtp: user/virtual address | 86 | * @virtp: user/virtual address |
100 | * | 87 | * |
@@ -342,7 +329,7 @@ static void vpif_schedule_next_buffer(struct common_obj *common) | |||
342 | * @dev_id: dev_id ptr | 329 | * @dev_id: dev_id ptr |
343 | * | 330 | * |
344 | * It changes status of the captured buffer, takes next buffer from the queue | 331 | * It changes status of the captured buffer, takes next buffer from the queue |
345 | * and sets its address in VPIF registers | 332 | * and sets its address in VPIF registers |
346 | */ | 333 | */ |
347 | static irqreturn_t vpif_channel_isr(int irq, void *dev_id) | 334 | static irqreturn_t vpif_channel_isr(int irq, void *dev_id) |
348 | { | 335 | { |
@@ -435,24 +422,31 @@ static int vpif_update_std_info(struct channel_obj *ch) | |||
435 | struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; | 422 | struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; |
436 | struct vpif_params *vpifparams = &ch->vpifparams; | 423 | struct vpif_params *vpifparams = &ch->vpifparams; |
437 | const struct vpif_channel_config_params *config; | 424 | const struct vpif_channel_config_params *config; |
438 | struct vpif_channel_config_params *std_info; | 425 | struct vpif_channel_config_params *std_info = &vpifparams->std_info; |
439 | struct video_obj *vid_ch = &ch->video; | 426 | struct video_obj *vid_ch = &ch->video; |
440 | int index; | 427 | int index; |
441 | 428 | ||
442 | vpif_dbg(2, debug, "vpif_update_std_info\n"); | 429 | vpif_dbg(2, debug, "vpif_update_std_info\n"); |
443 | 430 | ||
444 | std_info = &vpifparams->std_info; | 431 | for (index = 0; index < vpif_ch_params_count; index++) { |
445 | |||
446 | for (index = 0; index < ARRAY_SIZE(ch_params); index++) { | ||
447 | config = &ch_params[index]; | 432 | config = &ch_params[index]; |
448 | if (config->stdid & vid_ch->stdid) { | 433 | if (config->hd_sd == 0) { |
449 | memcpy(std_info, config, sizeof(*config)); | 434 | vpif_dbg(2, debug, "SD format\n"); |
450 | break; | 435 | if (config->stdid & vid_ch->stdid) { |
436 | memcpy(std_info, config, sizeof(*config)); | ||
437 | break; | ||
438 | } | ||
439 | } else { | ||
440 | vpif_dbg(2, debug, "HD format\n"); | ||
441 | if (config->dv_preset == vid_ch->dv_preset) { | ||
442 | memcpy(std_info, config, sizeof(*config)); | ||
443 | break; | ||
444 | } | ||
451 | } | 445 | } |
452 | } | 446 | } |
453 | 447 | ||
454 | /* standard not found */ | 448 | /* standard not found */ |
455 | if (index == ARRAY_SIZE(ch_params)) | 449 | if (index == vpif_ch_params_count) |
456 | return -EINVAL; | 450 | return -EINVAL; |
457 | 451 | ||
458 | common->fmt.fmt.pix.width = std_info->width; | 452 | common->fmt.fmt.pix.width = std_info->width; |
@@ -462,6 +456,7 @@ static int vpif_update_std_info(struct channel_obj *ch) | |||
462 | common->fmt.fmt.pix.bytesperline = std_info->width; | 456 | common->fmt.fmt.pix.bytesperline = std_info->width; |
463 | vpifparams->video_params.hpitch = std_info->width; | 457 | vpifparams->video_params.hpitch = std_info->width; |
464 | vpifparams->video_params.storage_mode = std_info->frm_fmt; | 458 | vpifparams->video_params.storage_mode = std_info->frm_fmt; |
459 | |||
465 | return 0; | 460 | return 0; |
466 | } | 461 | } |
467 | 462 | ||
@@ -757,7 +752,7 @@ static int vpif_open(struct file *filep) | |||
757 | struct video_obj *vid_ch; | 752 | struct video_obj *vid_ch; |
758 | struct channel_obj *ch; | 753 | struct channel_obj *ch; |
759 | struct vpif_fh *fh; | 754 | struct vpif_fh *fh; |
760 | int i, ret = 0; | 755 | int i; |
761 | 756 | ||
762 | vpif_dbg(2, debug, "vpif_open\n"); | 757 | vpif_dbg(2, debug, "vpif_open\n"); |
763 | 758 | ||
@@ -766,9 +761,6 @@ static int vpif_open(struct file *filep) | |||
766 | vid_ch = &ch->video; | 761 | vid_ch = &ch->video; |
767 | common = &ch->common[VPIF_VIDEO_INDEX]; | 762 | common = &ch->common[VPIF_VIDEO_INDEX]; |
768 | 763 | ||
769 | if (mutex_lock_interruptible(&common->lock)) | ||
770 | return -ERESTARTSYS; | ||
771 | |||
772 | if (NULL == ch->curr_subdev_info) { | 764 | if (NULL == ch->curr_subdev_info) { |
773 | /** | 765 | /** |
774 | * search through the sub device to see a registered | 766 | * search through the sub device to see a registered |
@@ -785,8 +777,7 @@ static int vpif_open(struct file *filep) | |||
785 | } | 777 | } |
786 | if (i == config->subdev_count) { | 778 | if (i == config->subdev_count) { |
787 | vpif_err("No sub device registered\n"); | 779 | vpif_err("No sub device registered\n"); |
788 | ret = -ENOENT; | 780 | return -ENOENT; |
789 | goto exit; | ||
790 | } | 781 | } |
791 | } | 782 | } |
792 | 783 | ||
@@ -794,8 +785,7 @@ static int vpif_open(struct file *filep) | |||
794 | fh = kzalloc(sizeof(struct vpif_fh), GFP_KERNEL); | 785 | fh = kzalloc(sizeof(struct vpif_fh), GFP_KERNEL); |
795 | if (NULL == fh) { | 786 | if (NULL == fh) { |
796 | vpif_err("unable to allocate memory for file handle object\n"); | 787 | vpif_err("unable to allocate memory for file handle object\n"); |
797 | ret = -ENOMEM; | 788 | return -ENOMEM; |
798 | goto exit; | ||
799 | } | 789 | } |
800 | 790 | ||
801 | /* store pointer to fh in private_data member of filep */ | 791 | /* store pointer to fh in private_data member of filep */ |
@@ -815,9 +805,7 @@ static int vpif_open(struct file *filep) | |||
815 | /* Initialize priority of this instance to default priority */ | 805 | /* Initialize priority of this instance to default priority */ |
816 | fh->prio = V4L2_PRIORITY_UNSET; | 806 | fh->prio = V4L2_PRIORITY_UNSET; |
817 | v4l2_prio_open(&ch->prio, &fh->prio); | 807 | v4l2_prio_open(&ch->prio, &fh->prio); |
818 | exit: | 808 | return 0; |
819 | mutex_unlock(&common->lock); | ||
820 | return ret; | ||
821 | } | 809 | } |
822 | 810 | ||
823 | /** | 811 | /** |
@@ -837,9 +825,6 @@ static int vpif_release(struct file *filep) | |||
837 | 825 | ||
838 | common = &ch->common[VPIF_VIDEO_INDEX]; | 826 | common = &ch->common[VPIF_VIDEO_INDEX]; |
839 | 827 | ||
840 | if (mutex_lock_interruptible(&common->lock)) | ||
841 | return -ERESTARTSYS; | ||
842 | |||
843 | /* if this instance is doing IO */ | 828 | /* if this instance is doing IO */ |
844 | if (fh->io_allowed[VPIF_VIDEO_INDEX]) { | 829 | if (fh->io_allowed[VPIF_VIDEO_INDEX]) { |
845 | /* Reset io_usrs member of channel object */ | 830 | /* Reset io_usrs member of channel object */ |
@@ -863,9 +848,6 @@ static int vpif_release(struct file *filep) | |||
863 | /* Decrement channel usrs counter */ | 848 | /* Decrement channel usrs counter */ |
864 | ch->usrs--; | 849 | ch->usrs--; |
865 | 850 | ||
866 | /* unlock mutex on channel object */ | ||
867 | mutex_unlock(&common->lock); | ||
868 | |||
869 | /* Close the priority */ | 851 | /* Close the priority */ |
870 | v4l2_prio_close(&ch->prio, fh->prio); | 852 | v4l2_prio_close(&ch->prio, fh->prio); |
871 | 853 | ||
@@ -890,7 +872,6 @@ static int vpif_reqbufs(struct file *file, void *priv, | |||
890 | struct channel_obj *ch = fh->channel; | 872 | struct channel_obj *ch = fh->channel; |
891 | struct common_obj *common; | 873 | struct common_obj *common; |
892 | u8 index = 0; | 874 | u8 index = 0; |
893 | int ret = 0; | ||
894 | 875 | ||
895 | vpif_dbg(2, debug, "vpif_reqbufs\n"); | 876 | vpif_dbg(2, debug, "vpif_reqbufs\n"); |
896 | 877 | ||
@@ -913,13 +894,8 @@ static int vpif_reqbufs(struct file *file, void *priv, | |||
913 | 894 | ||
914 | common = &ch->common[index]; | 895 | common = &ch->common[index]; |
915 | 896 | ||
916 | if (mutex_lock_interruptible(&common->lock)) | 897 | if (0 != common->io_usrs) |
917 | return -ERESTARTSYS; | 898 | return -EBUSY; |
918 | |||
919 | if (0 != common->io_usrs) { | ||
920 | ret = -EBUSY; | ||
921 | goto reqbuf_exit; | ||
922 | } | ||
923 | 899 | ||
924 | /* Initialize videobuf queue as per the buffer type */ | 900 | /* Initialize videobuf queue as per the buffer type */ |
925 | videobuf_queue_dma_contig_init(&common->buffer_queue, | 901 | videobuf_queue_dma_contig_init(&common->buffer_queue, |
@@ -928,7 +904,7 @@ static int vpif_reqbufs(struct file *file, void *priv, | |||
928 | reqbuf->type, | 904 | reqbuf->type, |
929 | common->fmt.fmt.pix.field, | 905 | common->fmt.fmt.pix.field, |
930 | sizeof(struct videobuf_buffer), fh, | 906 | sizeof(struct videobuf_buffer), fh, |
931 | NULL); | 907 | &common->lock); |
932 | 908 | ||
933 | /* Set io allowed member of file handle to TRUE */ | 909 | /* Set io allowed member of file handle to TRUE */ |
934 | fh->io_allowed[index] = 1; | 910 | fh->io_allowed[index] = 1; |
@@ -939,11 +915,7 @@ static int vpif_reqbufs(struct file *file, void *priv, | |||
939 | INIT_LIST_HEAD(&common->dma_queue); | 915 | INIT_LIST_HEAD(&common->dma_queue); |
940 | 916 | ||
941 | /* Allocate buffers */ | 917 | /* Allocate buffers */ |
942 | ret = videobuf_reqbufs(&common->buffer_queue, reqbuf); | 918 | return videobuf_reqbufs(&common->buffer_queue, reqbuf); |
943 | |||
944 | reqbuf_exit: | ||
945 | mutex_unlock(&common->lock); | ||
946 | return ret; | ||
947 | } | 919 | } |
948 | 920 | ||
949 | /** | 921 | /** |
@@ -1157,11 +1129,6 @@ static int vpif_streamon(struct file *file, void *priv, | |||
1157 | return ret; | 1129 | return ret; |
1158 | } | 1130 | } |
1159 | 1131 | ||
1160 | if (mutex_lock_interruptible(&common->lock)) { | ||
1161 | ret = -ERESTARTSYS; | ||
1162 | goto streamoff_exit; | ||
1163 | } | ||
1164 | |||
1165 | /* If buffer queue is empty, return error */ | 1132 | /* If buffer queue is empty, return error */ |
1166 | if (list_empty(&common->dma_queue)) { | 1133 | if (list_empty(&common->dma_queue)) { |
1167 | vpif_dbg(1, debug, "buffer queue is empty\n"); | 1134 | vpif_dbg(1, debug, "buffer queue is empty\n"); |
@@ -1240,13 +1207,10 @@ static int vpif_streamon(struct file *file, void *priv, | |||
1240 | enable_channel1(1); | 1207 | enable_channel1(1); |
1241 | } | 1208 | } |
1242 | channel_first_int[VPIF_VIDEO_INDEX][ch->channel_id] = 1; | 1209 | channel_first_int[VPIF_VIDEO_INDEX][ch->channel_id] = 1; |
1243 | mutex_unlock(&common->lock); | ||
1244 | return ret; | 1210 | return ret; |
1245 | 1211 | ||
1246 | exit: | 1212 | exit: |
1247 | mutex_unlock(&common->lock); | 1213 | videobuf_streamoff(&common->buffer_queue); |
1248 | streamoff_exit: | ||
1249 | ret = videobuf_streamoff(&common->buffer_queue); | ||
1250 | return ret; | 1214 | return ret; |
1251 | } | 1215 | } |
1252 | 1216 | ||
@@ -1284,9 +1248,6 @@ static int vpif_streamoff(struct file *file, void *priv, | |||
1284 | return -EINVAL; | 1248 | return -EINVAL; |
1285 | } | 1249 | } |
1286 | 1250 | ||
1287 | if (mutex_lock_interruptible(&common->lock)) | ||
1288 | return -ERESTARTSYS; | ||
1289 | |||
1290 | /* disable channel */ | 1251 | /* disable channel */ |
1291 | if (VPIF_CHANNEL0_VIDEO == ch->channel_id) { | 1252 | if (VPIF_CHANNEL0_VIDEO == ch->channel_id) { |
1292 | enable_channel0(0); | 1253 | enable_channel0(0); |
@@ -1304,8 +1265,6 @@ static int vpif_streamoff(struct file *file, void *priv, | |||
1304 | if (ret && (ret != -ENOIOCTLCMD)) | 1265 | if (ret && (ret != -ENOIOCTLCMD)) |
1305 | vpif_dbg(1, debug, "stream off failed in subdev\n"); | 1266 | vpif_dbg(1, debug, "stream off failed in subdev\n"); |
1306 | 1267 | ||
1307 | mutex_unlock(&common->lock); | ||
1308 | |||
1309 | return videobuf_streamoff(&common->buffer_queue); | 1268 | return videobuf_streamoff(&common->buffer_queue); |
1310 | } | 1269 | } |
1311 | 1270 | ||
@@ -1381,21 +1340,16 @@ static int vpif_querystd(struct file *file, void *priv, v4l2_std_id *std_id) | |||
1381 | { | 1340 | { |
1382 | struct vpif_fh *fh = priv; | 1341 | struct vpif_fh *fh = priv; |
1383 | struct channel_obj *ch = fh->channel; | 1342 | struct channel_obj *ch = fh->channel; |
1384 | struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; | ||
1385 | int ret = 0; | 1343 | int ret = 0; |
1386 | 1344 | ||
1387 | vpif_dbg(2, debug, "vpif_querystd\n"); | 1345 | vpif_dbg(2, debug, "vpif_querystd\n"); |
1388 | 1346 | ||
1389 | if (mutex_lock_interruptible(&common->lock)) | ||
1390 | return -ERESTARTSYS; | ||
1391 | |||
1392 | /* Call querystd function of decoder device */ | 1347 | /* Call querystd function of decoder device */ |
1393 | ret = v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index], video, | 1348 | ret = v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index], video, |
1394 | querystd, std_id); | 1349 | querystd, std_id); |
1395 | if (ret < 0) | 1350 | if (ret < 0) |
1396 | vpif_dbg(1, debug, "Failed to set standard for sub devices\n"); | 1351 | vpif_dbg(1, debug, "Failed to set standard for sub devices\n"); |
1397 | 1352 | ||
1398 | mutex_unlock(&common->lock); | ||
1399 | return ret; | 1353 | return ret; |
1400 | } | 1354 | } |
1401 | 1355 | ||
@@ -1451,16 +1405,14 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id *std_id) | |||
1451 | fh->initialized = 1; | 1405 | fh->initialized = 1; |
1452 | 1406 | ||
1453 | /* Call encoder subdevice function to set the standard */ | 1407 | /* Call encoder subdevice function to set the standard */ |
1454 | if (mutex_lock_interruptible(&common->lock)) | ||
1455 | return -ERESTARTSYS; | ||
1456 | |||
1457 | ch->video.stdid = *std_id; | 1408 | ch->video.stdid = *std_id; |
1409 | ch->video.dv_preset = V4L2_DV_INVALID; | ||
1410 | memset(&ch->video.bt_timings, 0, sizeof(ch->video.bt_timings)); | ||
1458 | 1411 | ||
1459 | /* Get the information about the standard */ | 1412 | /* Get the information about the standard */ |
1460 | if (vpif_update_std_info(ch)) { | 1413 | if (vpif_update_std_info(ch)) { |
1461 | ret = -EINVAL; | ||
1462 | vpif_err("Error getting the standard info\n"); | 1414 | vpif_err("Error getting the standard info\n"); |
1463 | goto s_std_exit; | 1415 | return -EINVAL; |
1464 | } | 1416 | } |
1465 | 1417 | ||
1466 | /* Configure the default format information */ | 1418 | /* Configure the default format information */ |
@@ -1471,9 +1423,6 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id *std_id) | |||
1471 | s_std, *std_id); | 1423 | s_std, *std_id); |
1472 | if (ret < 0) | 1424 | if (ret < 0) |
1473 | vpif_dbg(1, debug, "Failed to set standard for sub devices\n"); | 1425 | vpif_dbg(1, debug, "Failed to set standard for sub devices\n"); |
1474 | |||
1475 | s_std_exit: | ||
1476 | mutex_unlock(&common->lock); | ||
1477 | return ret; | 1426 | return ret; |
1478 | } | 1427 | } |
1479 | 1428 | ||
@@ -1567,9 +1516,6 @@ static int vpif_s_input(struct file *file, void *priv, unsigned int index) | |||
1567 | return -EINVAL; | 1516 | return -EINVAL; |
1568 | } | 1517 | } |
1569 | 1518 | ||
1570 | if (mutex_lock_interruptible(&common->lock)) | ||
1571 | return -ERESTARTSYS; | ||
1572 | |||
1573 | /* first setup input path from sub device to vpif */ | 1519 | /* first setup input path from sub device to vpif */ |
1574 | if (config->setup_input_path) { | 1520 | if (config->setup_input_path) { |
1575 | ret = config->setup_input_path(ch->channel_id, | 1521 | ret = config->setup_input_path(ch->channel_id, |
@@ -1578,7 +1524,7 @@ static int vpif_s_input(struct file *file, void *priv, unsigned int index) | |||
1578 | vpif_dbg(1, debug, "couldn't setup input path for the" | 1524 | vpif_dbg(1, debug, "couldn't setup input path for the" |
1579 | " sub device %s, for input index %d\n", | 1525 | " sub device %s, for input index %d\n", |
1580 | subdev_info->name, index); | 1526 | subdev_info->name, index); |
1581 | goto exit; | 1527 | return ret; |
1582 | } | 1528 | } |
1583 | } | 1529 | } |
1584 | 1530 | ||
@@ -1589,7 +1535,7 @@ static int vpif_s_input(struct file *file, void *priv, unsigned int index) | |||
1589 | input, output, 0); | 1535 | input, output, 0); |
1590 | if (ret < 0) { | 1536 | if (ret < 0) { |
1591 | vpif_dbg(1, debug, "Failed to set input\n"); | 1537 | vpif_dbg(1, debug, "Failed to set input\n"); |
1592 | goto exit; | 1538 | return ret; |
1593 | } | 1539 | } |
1594 | } | 1540 | } |
1595 | vid_ch->input_idx = index; | 1541 | vid_ch->input_idx = index; |
@@ -1600,9 +1546,6 @@ static int vpif_s_input(struct file *file, void *priv, unsigned int index) | |||
1600 | 1546 | ||
1601 | /* update tvnorms from the sub device input info */ | 1547 | /* update tvnorms from the sub device input info */ |
1602 | ch->video_dev->tvnorms = chan_cfg->inputs[index].input.std; | 1548 | ch->video_dev->tvnorms = chan_cfg->inputs[index].input.std; |
1603 | |||
1604 | exit: | ||
1605 | mutex_unlock(&common->lock); | ||
1606 | return ret; | 1549 | return ret; |
1607 | } | 1550 | } |
1608 | 1551 | ||
@@ -1671,11 +1614,7 @@ static int vpif_g_fmt_vid_cap(struct file *file, void *priv, | |||
1671 | return -EINVAL; | 1614 | return -EINVAL; |
1672 | 1615 | ||
1673 | /* Fill in the information about format */ | 1616 | /* Fill in the information about format */ |
1674 | if (mutex_lock_interruptible(&common->lock)) | ||
1675 | return -ERESTARTSYS; | ||
1676 | |||
1677 | *fmt = common->fmt; | 1617 | *fmt = common->fmt; |
1678 | mutex_unlock(&common->lock); | ||
1679 | return 0; | 1618 | return 0; |
1680 | } | 1619 | } |
1681 | 1620 | ||
@@ -1694,7 +1633,7 @@ static int vpif_s_fmt_vid_cap(struct file *file, void *priv, | |||
1694 | struct v4l2_pix_format *pixfmt; | 1633 | struct v4l2_pix_format *pixfmt; |
1695 | int ret = 0; | 1634 | int ret = 0; |
1696 | 1635 | ||
1697 | vpif_dbg(2, debug, "VIDIOC_S_FMT\n"); | 1636 | vpif_dbg(2, debug, "%s\n", __func__); |
1698 | 1637 | ||
1699 | /* If streaming is started, return error */ | 1638 | /* If streaming is started, return error */ |
1700 | if (common->started) { | 1639 | if (common->started) { |
@@ -1723,12 +1662,7 @@ static int vpif_s_fmt_vid_cap(struct file *file, void *priv, | |||
1723 | if (ret) | 1662 | if (ret) |
1724 | return ret; | 1663 | return ret; |
1725 | /* store the format in the channel object */ | 1664 | /* store the format in the channel object */ |
1726 | if (mutex_lock_interruptible(&common->lock)) | ||
1727 | return -ERESTARTSYS; | ||
1728 | |||
1729 | common->fmt = *fmt; | 1665 | common->fmt = *fmt; |
1730 | mutex_unlock(&common->lock); | ||
1731 | |||
1732 | return 0; | 1666 | return 0; |
1733 | } | 1667 | } |
1734 | 1668 | ||
@@ -1807,6 +1741,306 @@ static int vpif_cropcap(struct file *file, void *priv, | |||
1807 | return 0; | 1741 | return 0; |
1808 | } | 1742 | } |
1809 | 1743 | ||
1744 | /** | ||
1745 | * vpif_enum_dv_presets() - ENUM_DV_PRESETS handler | ||
1746 | * @file: file ptr | ||
1747 | * @priv: file handle | ||
1748 | * @preset: input preset | ||
1749 | */ | ||
1750 | static int vpif_enum_dv_presets(struct file *file, void *priv, | ||
1751 | struct v4l2_dv_enum_preset *preset) | ||
1752 | { | ||
1753 | struct vpif_fh *fh = priv; | ||
1754 | struct channel_obj *ch = fh->channel; | ||
1755 | |||
1756 | return v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index], | ||
1757 | video, enum_dv_presets, preset); | ||
1758 | } | ||
1759 | |||
1760 | /** | ||
1761 | * vpif_query_dv_presets() - QUERY_DV_PRESET handler | ||
1762 | * @file: file ptr | ||
1763 | * @priv: file handle | ||
1764 | * @preset: input preset | ||
1765 | */ | ||
1766 | static int vpif_query_dv_preset(struct file *file, void *priv, | ||
1767 | struct v4l2_dv_preset *preset) | ||
1768 | { | ||
1769 | struct vpif_fh *fh = priv; | ||
1770 | struct channel_obj *ch = fh->channel; | ||
1771 | |||
1772 | return v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index], | ||
1773 | video, query_dv_preset, preset); | ||
1774 | } | ||
1775 | /** | ||
1776 | * vpif_s_dv_presets() - S_DV_PRESETS handler | ||
1777 | * @file: file ptr | ||
1778 | * @priv: file handle | ||
1779 | * @preset: input preset | ||
1780 | */ | ||
1781 | static int vpif_s_dv_preset(struct file *file, void *priv, | ||
1782 | struct v4l2_dv_preset *preset) | ||
1783 | { | ||
1784 | struct vpif_fh *fh = priv; | ||
1785 | struct channel_obj *ch = fh->channel; | ||
1786 | struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; | ||
1787 | int ret = 0; | ||
1788 | |||
1789 | if (common->started) { | ||
1790 | vpif_dbg(1, debug, "streaming in progress\n"); | ||
1791 | return -EBUSY; | ||
1792 | } | ||
1793 | |||
1794 | if ((VPIF_CHANNEL0_VIDEO == ch->channel_id) || | ||
1795 | (VPIF_CHANNEL1_VIDEO == ch->channel_id)) { | ||
1796 | if (!fh->initialized) { | ||
1797 | vpif_dbg(1, debug, "Channel Busy\n"); | ||
1798 | return -EBUSY; | ||
1799 | } | ||
1800 | } | ||
1801 | |||
1802 | ret = v4l2_prio_check(&ch->prio, fh->prio); | ||
1803 | if (ret) | ||
1804 | return ret; | ||
1805 | |||
1806 | fh->initialized = 1; | ||
1807 | |||
1808 | /* Call encoder subdevice function to set the standard */ | ||
1809 | if (mutex_lock_interruptible(&common->lock)) | ||
1810 | return -ERESTARTSYS; | ||
1811 | |||
1812 | ch->video.dv_preset = preset->preset; | ||
1813 | ch->video.stdid = V4L2_STD_UNKNOWN; | ||
1814 | memset(&ch->video.bt_timings, 0, sizeof(ch->video.bt_timings)); | ||
1815 | |||
1816 | /* Get the information about the standard */ | ||
1817 | if (vpif_update_std_info(ch)) { | ||
1818 | vpif_dbg(1, debug, "Error getting the standard info\n"); | ||
1819 | ret = -EINVAL; | ||
1820 | } else { | ||
1821 | /* Configure the default format information */ | ||
1822 | vpif_config_format(ch); | ||
1823 | |||
1824 | ret = v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index], | ||
1825 | video, s_dv_preset, preset); | ||
1826 | } | ||
1827 | |||
1828 | mutex_unlock(&common->lock); | ||
1829 | |||
1830 | return ret; | ||
1831 | } | ||
1832 | /** | ||
1833 | * vpif_g_dv_presets() - G_DV_PRESETS handler | ||
1834 | * @file: file ptr | ||
1835 | * @priv: file handle | ||
1836 | * @preset: input preset | ||
1837 | */ | ||
1838 | static int vpif_g_dv_preset(struct file *file, void *priv, | ||
1839 | struct v4l2_dv_preset *preset) | ||
1840 | { | ||
1841 | struct vpif_fh *fh = priv; | ||
1842 | struct channel_obj *ch = fh->channel; | ||
1843 | |||
1844 | preset->preset = ch->video.dv_preset; | ||
1845 | |||
1846 | return 0; | ||
1847 | } | ||
1848 | |||
1849 | /** | ||
1850 | * vpif_s_dv_timings() - S_DV_TIMINGS handler | ||
1851 | * @file: file ptr | ||
1852 | * @priv: file handle | ||
1853 | * @timings: digital video timings | ||
1854 | */ | ||
1855 | static int vpif_s_dv_timings(struct file *file, void *priv, | ||
1856 | struct v4l2_dv_timings *timings) | ||
1857 | { | ||
1858 | struct vpif_fh *fh = priv; | ||
1859 | struct channel_obj *ch = fh->channel; | ||
1860 | struct vpif_params *vpifparams = &ch->vpifparams; | ||
1861 | struct vpif_channel_config_params *std_info = &vpifparams->std_info; | ||
1862 | struct video_obj *vid_ch = &ch->video; | ||
1863 | struct v4l2_bt_timings *bt = &vid_ch->bt_timings; | ||
1864 | int ret; | ||
1865 | |||
1866 | if (timings->type != V4L2_DV_BT_656_1120) { | ||
1867 | vpif_dbg(2, debug, "Timing type not defined\n"); | ||
1868 | return -EINVAL; | ||
1869 | } | ||
1870 | |||
1871 | /* Configure subdevice timings, if any */ | ||
1872 | ret = v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index], | ||
1873 | video, s_dv_timings, timings); | ||
1874 | if (ret == -ENOIOCTLCMD) { | ||
1875 | vpif_dbg(2, debug, "Custom DV timings not supported by " | ||
1876 | "subdevice\n"); | ||
1877 | return -EINVAL; | ||
1878 | } | ||
1879 | if (ret < 0) { | ||
1880 | vpif_dbg(2, debug, "Error setting custom DV timings\n"); | ||
1881 | return ret; | ||
1882 | } | ||
1883 | |||
1884 | if (!(timings->bt.width && timings->bt.height && | ||
1885 | (timings->bt.hbackporch || | ||
1886 | timings->bt.hfrontporch || | ||
1887 | timings->bt.hsync) && | ||
1888 | timings->bt.vfrontporch && | ||
1889 | (timings->bt.vbackporch || | ||
1890 | timings->bt.vsync))) { | ||
1891 | vpif_dbg(2, debug, "Timings for width, height, " | ||
1892 | "horizontal back porch, horizontal sync, " | ||
1893 | "horizontal front porch, vertical back porch, " | ||
1894 | "vertical sync and vertical back porch " | ||
1895 | "must be defined\n"); | ||
1896 | return -EINVAL; | ||
1897 | } | ||
1898 | |||
1899 | *bt = timings->bt; | ||
1900 | |||
1901 | /* Configure video port timings */ | ||
1902 | |||
1903 | std_info->eav2sav = bt->hbackporch + bt->hfrontporch + | ||
1904 | bt->hsync - 8; | ||
1905 | std_info->sav2eav = bt->width; | ||
1906 | |||
1907 | std_info->l1 = 1; | ||
1908 | std_info->l3 = bt->vsync + bt->vbackporch + 1; | ||
1909 | |||
1910 | if (bt->interlaced) { | ||
1911 | if (bt->il_vbackporch || bt->il_vfrontporch || bt->il_vsync) { | ||
1912 | std_info->vsize = bt->height * 2 + | ||
1913 | bt->vfrontporch + bt->vsync + bt->vbackporch + | ||
1914 | bt->il_vfrontporch + bt->il_vsync + | ||
1915 | bt->il_vbackporch; | ||
1916 | std_info->l5 = std_info->vsize/2 - | ||
1917 | (bt->vfrontporch - 1); | ||
1918 | std_info->l7 = std_info->vsize/2 + 1; | ||
1919 | std_info->l9 = std_info->l7 + bt->il_vsync + | ||
1920 | bt->il_vbackporch + 1; | ||
1921 | std_info->l11 = std_info->vsize - | ||
1922 | (bt->il_vfrontporch - 1); | ||
1923 | } else { | ||
1924 | vpif_dbg(2, debug, "Required timing values for " | ||
1925 | "interlaced BT format missing\n"); | ||
1926 | return -EINVAL; | ||
1927 | } | ||
1928 | } else { | ||
1929 | std_info->vsize = bt->height + bt->vfrontporch + | ||
1930 | bt->vsync + bt->vbackporch; | ||
1931 | std_info->l5 = std_info->vsize - (bt->vfrontporch - 1); | ||
1932 | } | ||
1933 | strncpy(std_info->name, "Custom timings BT656/1120", VPIF_MAX_NAME); | ||
1934 | std_info->width = bt->width; | ||
1935 | std_info->height = bt->height; | ||
1936 | std_info->frm_fmt = bt->interlaced ? 0 : 1; | ||
1937 | std_info->ycmux_mode = 0; | ||
1938 | std_info->capture_format = 0; | ||
1939 | std_info->vbi_supported = 0; | ||
1940 | std_info->hd_sd = 1; | ||
1941 | std_info->stdid = 0; | ||
1942 | std_info->dv_preset = V4L2_DV_INVALID; | ||
1943 | |||
1944 | vid_ch->stdid = 0; | ||
1945 | vid_ch->dv_preset = V4L2_DV_INVALID; | ||
1946 | return 0; | ||
1947 | } | ||
1948 | |||
1949 | /** | ||
1950 | * vpif_g_dv_timings() - G_DV_TIMINGS handler | ||
1951 | * @file: file ptr | ||
1952 | * @priv: file handle | ||
1953 | * @timings: digital video timings | ||
1954 | */ | ||
1955 | static int vpif_g_dv_timings(struct file *file, void *priv, | ||
1956 | struct v4l2_dv_timings *timings) | ||
1957 | { | ||
1958 | struct vpif_fh *fh = priv; | ||
1959 | struct channel_obj *ch = fh->channel; | ||
1960 | struct video_obj *vid_ch = &ch->video; | ||
1961 | struct v4l2_bt_timings *bt = &vid_ch->bt_timings; | ||
1962 | |||
1963 | timings->bt = *bt; | ||
1964 | |||
1965 | return 0; | ||
1966 | } | ||
1967 | |||
1968 | /* | ||
1969 | * vpif_g_chip_ident() - Identify the chip | ||
1970 | * @file: file ptr | ||
1971 | * @priv: file handle | ||
1972 | * @chip: chip identity | ||
1973 | * | ||
1974 | * Returns zero or -EINVAL if read operations fails. | ||
1975 | */ | ||
1976 | static int vpif_g_chip_ident(struct file *file, void *priv, | ||
1977 | struct v4l2_dbg_chip_ident *chip) | ||
1978 | { | ||
1979 | chip->ident = V4L2_IDENT_NONE; | ||
1980 | chip->revision = 0; | ||
1981 | if (chip->match.type != V4L2_CHIP_MATCH_I2C_DRIVER && | ||
1982 | chip->match.type != V4L2_CHIP_MATCH_I2C_ADDR) { | ||
1983 | vpif_dbg(2, debug, "match_type is invalid.\n"); | ||
1984 | return -EINVAL; | ||
1985 | } | ||
1986 | |||
1987 | return v4l2_device_call_until_err(&vpif_obj.v4l2_dev, 0, core, | ||
1988 | g_chip_ident, chip); | ||
1989 | } | ||
1990 | |||
1991 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
1992 | /* | ||
1993 | * vpif_dbg_g_register() - Read register | ||
1994 | * @file: file ptr | ||
1995 | * @priv: file handle | ||
1996 | * @reg: register to be read | ||
1997 | * | ||
1998 | * Debugging only | ||
1999 | * Returns zero or -EINVAL if read operations fails. | ||
2000 | */ | ||
2001 | static int vpif_dbg_g_register(struct file *file, void *priv, | ||
2002 | struct v4l2_dbg_register *reg){ | ||
2003 | struct vpif_fh *fh = priv; | ||
2004 | struct channel_obj *ch = fh->channel; | ||
2005 | |||
2006 | return v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index], core, | ||
2007 | g_register, reg); | ||
2008 | } | ||
2009 | |||
2010 | /* | ||
2011 | * vpif_dbg_s_register() - Write to register | ||
2012 | * @file: file ptr | ||
2013 | * @priv: file handle | ||
2014 | * @reg: register to be modified | ||
2015 | * | ||
2016 | * Debugging only | ||
2017 | * Returns zero or -EINVAL if write operations fails. | ||
2018 | */ | ||
2019 | static int vpif_dbg_s_register(struct file *file, void *priv, | ||
2020 | struct v4l2_dbg_register *reg){ | ||
2021 | struct vpif_fh *fh = priv; | ||
2022 | struct channel_obj *ch = fh->channel; | ||
2023 | |||
2024 | return v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index], core, | ||
2025 | s_register, reg); | ||
2026 | } | ||
2027 | #endif | ||
2028 | |||
2029 | /* | ||
2030 | * vpif_log_status() - Status information | ||
2031 | * @file: file ptr | ||
2032 | * @priv: file handle | ||
2033 | * | ||
2034 | * Returns zero. | ||
2035 | */ | ||
2036 | static int vpif_log_status(struct file *filep, void *priv) | ||
2037 | { | ||
2038 | /* status for sub devices */ | ||
2039 | v4l2_device_call_all(&vpif_obj.v4l2_dev, 0, core, log_status); | ||
2040 | |||
2041 | return 0; | ||
2042 | } | ||
2043 | |||
1810 | /* vpif capture ioctl operations */ | 2044 | /* vpif capture ioctl operations */ |
1811 | static const struct v4l2_ioctl_ops vpif_ioctl_ops = { | 2045 | static const struct v4l2_ioctl_ops vpif_ioctl_ops = { |
1812 | .vidioc_querycap = vpif_querycap, | 2046 | .vidioc_querycap = vpif_querycap, |
@@ -1829,6 +2063,18 @@ static const struct v4l2_ioctl_ops vpif_ioctl_ops = { | |||
1829 | .vidioc_streamon = vpif_streamon, | 2063 | .vidioc_streamon = vpif_streamon, |
1830 | .vidioc_streamoff = vpif_streamoff, | 2064 | .vidioc_streamoff = vpif_streamoff, |
1831 | .vidioc_cropcap = vpif_cropcap, | 2065 | .vidioc_cropcap = vpif_cropcap, |
2066 | .vidioc_enum_dv_presets = vpif_enum_dv_presets, | ||
2067 | .vidioc_s_dv_preset = vpif_s_dv_preset, | ||
2068 | .vidioc_g_dv_preset = vpif_g_dv_preset, | ||
2069 | .vidioc_query_dv_preset = vpif_query_dv_preset, | ||
2070 | .vidioc_s_dv_timings = vpif_s_dv_timings, | ||
2071 | .vidioc_g_dv_timings = vpif_g_dv_timings, | ||
2072 | .vidioc_g_chip_ident = vpif_g_chip_ident, | ||
2073 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
2074 | .vidioc_g_register = vpif_dbg_g_register, | ||
2075 | .vidioc_s_register = vpif_dbg_s_register, | ||
2076 | #endif | ||
2077 | .vidioc_log_status = vpif_log_status, | ||
1832 | }; | 2078 | }; |
1833 | 2079 | ||
1834 | /* vpif file operations */ | 2080 | /* vpif file operations */ |
@@ -1836,7 +2082,7 @@ static struct v4l2_file_operations vpif_fops = { | |||
1836 | .owner = THIS_MODULE, | 2082 | .owner = THIS_MODULE, |
1837 | .open = vpif_open, | 2083 | .open = vpif_open, |
1838 | .release = vpif_release, | 2084 | .release = vpif_release, |
1839 | .ioctl = video_ioctl2, | 2085 | .unlocked_ioctl = video_ioctl2, |
1840 | .mmap = vpif_mmap, | 2086 | .mmap = vpif_mmap, |
1841 | .poll = vpif_poll | 2087 | .poll = vpif_poll |
1842 | }; | 2088 | }; |
@@ -1979,6 +2225,7 @@ static __init int vpif_probe(struct platform_device *pdev) | |||
1979 | common = &(ch->common[VPIF_VIDEO_INDEX]); | 2225 | common = &(ch->common[VPIF_VIDEO_INDEX]); |
1980 | spin_lock_init(&common->irqlock); | 2226 | spin_lock_init(&common->irqlock); |
1981 | mutex_init(&common->lock); | 2227 | mutex_init(&common->lock); |
2228 | ch->video_dev->lock = &common->lock; | ||
1982 | /* Initialize prio member of channel object */ | 2229 | /* Initialize prio member of channel object */ |
1983 | v4l2_prio_init(&ch->prio); | 2230 | v4l2_prio_init(&ch->prio); |
1984 | err = video_register_device(ch->video_dev, | 2231 | err = video_register_device(ch->video_dev, |
@@ -2026,9 +2273,9 @@ static __init int vpif_probe(struct platform_device *pdev) | |||
2026 | if (vpif_obj.sd[i]) | 2273 | if (vpif_obj.sd[i]) |
2027 | vpif_obj.sd[i]->grp_id = 1 << i; | 2274 | vpif_obj.sd[i]->grp_id = 1 << i; |
2028 | } | 2275 | } |
2029 | v4l2_info(&vpif_obj.v4l2_dev, "DM646x VPIF Capture driver" | ||
2030 | " initialized\n"); | ||
2031 | 2276 | ||
2277 | v4l2_info(&vpif_obj.v4l2_dev, | ||
2278 | "DM646x VPIF capture driver initialized\n"); | ||
2032 | return 0; | 2279 | return 0; |
2033 | 2280 | ||
2034 | probe_subdev_out: | 2281 | probe_subdev_out: |
diff --git a/drivers/media/video/davinci/vpif_capture.h b/drivers/media/video/davinci/vpif_capture.h index 4e12ec8cac6f..7a4196dfdce1 100644 --- a/drivers/media/video/davinci/vpif_capture.h +++ b/drivers/media/video/davinci/vpif_capture.h | |||
@@ -59,6 +59,8 @@ struct video_obj { | |||
59 | enum v4l2_field buf_field; | 59 | enum v4l2_field buf_field; |
60 | /* Currently selected or default standard */ | 60 | /* Currently selected or default standard */ |
61 | v4l2_std_id stdid; | 61 | v4l2_std_id stdid; |
62 | u32 dv_preset; | ||
63 | struct v4l2_bt_timings bt_timings; | ||
62 | /* This is to track the last input that is passed to application */ | 64 | /* This is to track the last input that is passed to application */ |
63 | u32 input_idx; | 65 | u32 input_idx; |
64 | }; | 66 | }; |
diff --git a/drivers/media/video/davinci/vpif_display.c b/drivers/media/video/davinci/vpif_display.c index 412c65d54fe1..cdf659abdc2a 100644 --- a/drivers/media/video/davinci/vpif_display.c +++ b/drivers/media/video/davinci/vpif_display.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <media/adv7343.h> | 38 | #include <media/adv7343.h> |
39 | #include <media/v4l2-device.h> | 39 | #include <media/v4l2-device.h> |
40 | #include <media/v4l2-ioctl.h> | 40 | #include <media/v4l2-ioctl.h> |
41 | #include <media/v4l2-chip-ident.h> | ||
41 | 42 | ||
42 | #include <mach/dm646x.h> | 43 | #include <mach/dm646x.h> |
43 | 44 | ||
@@ -84,17 +85,6 @@ static struct vpif_config_params config_params = { | |||
84 | static struct vpif_device vpif_obj = { {NULL} }; | 85 | static struct vpif_device vpif_obj = { {NULL} }; |
85 | static struct device *vpif_dev; | 86 | static struct device *vpif_dev; |
86 | 87 | ||
87 | static const struct vpif_channel_config_params ch_params[] = { | ||
88 | { | ||
89 | "NTSC", 720, 480, 30, 0, 1, 268, 1440, 1, 23, 263, 266, | ||
90 | 286, 525, 525, 0, 1, 0, V4L2_STD_525_60, | ||
91 | }, | ||
92 | { | ||
93 | "PAL", 720, 576, 25, 0, 1, 280, 1440, 1, 23, 311, 313, | ||
94 | 336, 624, 625, 0, 1, 0, V4L2_STD_625_50, | ||
95 | }, | ||
96 | }; | ||
97 | |||
98 | /* | 88 | /* |
99 | * vpif_uservirt_to_phys: This function is used to convert user | 89 | * vpif_uservirt_to_phys: This function is used to convert user |
100 | * space virtual address to physical address. | 90 | * space virtual address to physical address. |
@@ -373,30 +363,54 @@ static irqreturn_t vpif_channel_isr(int irq, void *dev_id) | |||
373 | return IRQ_HANDLED; | 363 | return IRQ_HANDLED; |
374 | } | 364 | } |
375 | 365 | ||
376 | static int vpif_get_std_info(struct channel_obj *ch) | 366 | static int vpif_update_std_info(struct channel_obj *ch) |
377 | { | 367 | { |
378 | struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; | ||
379 | struct video_obj *vid_ch = &ch->video; | 368 | struct video_obj *vid_ch = &ch->video; |
380 | struct vpif_params *vpifparams = &ch->vpifparams; | 369 | struct vpif_params *vpifparams = &ch->vpifparams; |
381 | struct vpif_channel_config_params *std_info = &vpifparams->std_info; | 370 | struct vpif_channel_config_params *std_info = &vpifparams->std_info; |
382 | const struct vpif_channel_config_params *config; | 371 | const struct vpif_channel_config_params *config; |
383 | 372 | ||
384 | int index; | 373 | int i; |
385 | |||
386 | std_info->stdid = vid_ch->stdid; | ||
387 | if (!std_info->stdid) | ||
388 | return -1; | ||
389 | 374 | ||
390 | for (index = 0; index < ARRAY_SIZE(ch_params); index++) { | 375 | for (i = 0; i < vpif_ch_params_count; i++) { |
391 | config = &ch_params[index]; | 376 | config = &ch_params[i]; |
392 | if (config->stdid & std_info->stdid) { | 377 | if (config->hd_sd == 0) { |
393 | memcpy(std_info, config, sizeof(*config)); | 378 | vpif_dbg(2, debug, "SD format\n"); |
394 | break; | 379 | if (config->stdid & vid_ch->stdid) { |
380 | memcpy(std_info, config, sizeof(*config)); | ||
381 | break; | ||
382 | } | ||
383 | } else { | ||
384 | vpif_dbg(2, debug, "HD format\n"); | ||
385 | if (config->dv_preset == vid_ch->dv_preset) { | ||
386 | memcpy(std_info, config, sizeof(*config)); | ||
387 | break; | ||
388 | } | ||
395 | } | 389 | } |
396 | } | 390 | } |
397 | 391 | ||
398 | if (index == ARRAY_SIZE(ch_params)) | 392 | if (i == vpif_ch_params_count) { |
399 | return -1; | 393 | vpif_dbg(1, debug, "Format not found\n"); |
394 | return -EINVAL; | ||
395 | } | ||
396 | |||
397 | return 0; | ||
398 | } | ||
399 | |||
400 | static int vpif_update_resolution(struct channel_obj *ch) | ||
401 | { | ||
402 | struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; | ||
403 | struct video_obj *vid_ch = &ch->video; | ||
404 | struct vpif_params *vpifparams = &ch->vpifparams; | ||
405 | struct vpif_channel_config_params *std_info = &vpifparams->std_info; | ||
406 | |||
407 | if (!vid_ch->stdid && !vid_ch->dv_preset && !vid_ch->bt_timings.height) | ||
408 | return -EINVAL; | ||
409 | |||
410 | if (vid_ch->stdid || vid_ch->dv_preset) { | ||
411 | if (vpif_update_std_info(ch)) | ||
412 | return -EINVAL; | ||
413 | } | ||
400 | 414 | ||
401 | common->fmt.fmt.pix.width = std_info->width; | 415 | common->fmt.fmt.pix.width = std_info->width; |
402 | common->fmt.fmt.pix.height = std_info->height; | 416 | common->fmt.fmt.pix.height = std_info->height; |
@@ -404,8 +418,8 @@ static int vpif_get_std_info(struct channel_obj *ch) | |||
404 | common->fmt.fmt.pix.width, common->fmt.fmt.pix.height); | 418 | common->fmt.fmt.pix.width, common->fmt.fmt.pix.height); |
405 | 419 | ||
406 | /* Set height and width paramateres */ | 420 | /* Set height and width paramateres */ |
407 | ch->common[VPIF_VIDEO_INDEX].height = std_info->height; | 421 | common->height = std_info->height; |
408 | ch->common[VPIF_VIDEO_INDEX].width = std_info->width; | 422 | common->width = std_info->width; |
409 | 423 | ||
410 | return 0; | 424 | return 0; |
411 | } | 425 | } |
@@ -516,10 +530,8 @@ static int vpif_check_format(struct channel_obj *ch, | |||
516 | else | 530 | else |
517 | sizeimage = config_params.channel_bufsize[ch->channel_id]; | 531 | sizeimage = config_params.channel_bufsize[ch->channel_id]; |
518 | 532 | ||
519 | if (vpif_get_std_info(ch)) { | 533 | if (vpif_update_resolution(ch)) |
520 | vpif_err("Error getting the standard info\n"); | ||
521 | return -EINVAL; | 534 | return -EINVAL; |
522 | } | ||
523 | 535 | ||
524 | hpitch = pixfmt->bytesperline; | 536 | hpitch = pixfmt->bytesperline; |
525 | vpitch = sizeimage / (hpitch * 2); | 537 | vpitch = sizeimage / (hpitch * 2); |
@@ -568,7 +580,10 @@ static void vpif_config_addr(struct channel_obj *ch, int muxmode) | |||
568 | static int vpif_mmap(struct file *filep, struct vm_area_struct *vma) | 580 | static int vpif_mmap(struct file *filep, struct vm_area_struct *vma) |
569 | { | 581 | { |
570 | struct vpif_fh *fh = filep->private_data; | 582 | struct vpif_fh *fh = filep->private_data; |
571 | struct common_obj *common = &fh->channel->common[VPIF_VIDEO_INDEX]; | 583 | struct channel_obj *ch = fh->channel; |
584 | struct common_obj *common = &(ch->common[VPIF_VIDEO_INDEX]); | ||
585 | |||
586 | vpif_dbg(2, debug, "vpif_mmap\n"); | ||
572 | 587 | ||
573 | return videobuf_mmap_mapper(&common->buffer_queue, vma); | 588 | return videobuf_mmap_mapper(&common->buffer_queue, vma); |
574 | } | 589 | } |
@@ -637,9 +652,6 @@ static int vpif_release(struct file *filep) | |||
637 | struct channel_obj *ch = fh->channel; | 652 | struct channel_obj *ch = fh->channel; |
638 | struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; | 653 | struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; |
639 | 654 | ||
640 | if (mutex_lock_interruptible(&common->lock)) | ||
641 | return -ERESTARTSYS; | ||
642 | |||
643 | /* if this instance is doing IO */ | 655 | /* if this instance is doing IO */ |
644 | if (fh->io_allowed[VPIF_VIDEO_INDEX]) { | 656 | if (fh->io_allowed[VPIF_VIDEO_INDEX]) { |
645 | /* Reset io_usrs member of channel object */ | 657 | /* Reset io_usrs member of channel object */ |
@@ -662,8 +674,6 @@ static int vpif_release(struct file *filep) | |||
662 | config_params.numbuffers[ch->channel_id]; | 674 | config_params.numbuffers[ch->channel_id]; |
663 | } | 675 | } |
664 | 676 | ||
665 | mutex_unlock(&common->lock); | ||
666 | |||
667 | /* Decrement channel usrs counter */ | 677 | /* Decrement channel usrs counter */ |
668 | atomic_dec(&ch->usrs); | 678 | atomic_dec(&ch->usrs); |
669 | /* If this file handle has initialize encoder device, reset it */ | 679 | /* If this file handle has initialize encoder device, reset it */ |
@@ -680,7 +690,12 @@ static int vpif_release(struct file *filep) | |||
680 | } | 690 | } |
681 | 691 | ||
682 | /* functions implementing ioctls */ | 692 | /* functions implementing ioctls */ |
683 | 693 | /** | |
694 | * vpif_querycap() - QUERYCAP handler | ||
695 | * @file: file ptr | ||
696 | * @priv: file handle | ||
697 | * @cap: ptr to v4l2_capability structure | ||
698 | */ | ||
684 | static int vpif_querycap(struct file *file, void *priv, | 699 | static int vpif_querycap(struct file *file, void *priv, |
685 | struct v4l2_capability *cap) | 700 | struct v4l2_capability *cap) |
686 | { | 701 | { |
@@ -722,17 +737,9 @@ static int vpif_g_fmt_vid_out(struct file *file, void *priv, | |||
722 | if (common->fmt.type != fmt->type) | 737 | if (common->fmt.type != fmt->type) |
723 | return -EINVAL; | 738 | return -EINVAL; |
724 | 739 | ||
725 | /* Fill in the information about format */ | 740 | if (vpif_update_resolution(ch)) |
726 | if (mutex_lock_interruptible(&common->lock)) | ||
727 | return -ERESTARTSYS; | ||
728 | |||
729 | if (vpif_get_std_info(ch)) { | ||
730 | vpif_err("Error getting the standard info\n"); | ||
731 | return -EINVAL; | 741 | return -EINVAL; |
732 | } | ||
733 | |||
734 | *fmt = common->fmt; | 742 | *fmt = common->fmt; |
735 | mutex_unlock(&common->lock); | ||
736 | return 0; | 743 | return 0; |
737 | } | 744 | } |
738 | 745 | ||
@@ -773,12 +780,7 @@ static int vpif_s_fmt_vid_out(struct file *file, void *priv, | |||
773 | /* store the pix format in the channel object */ | 780 | /* store the pix format in the channel object */ |
774 | common->fmt.fmt.pix = *pixfmt; | 781 | common->fmt.fmt.pix = *pixfmt; |
775 | /* store the format in the channel object */ | 782 | /* store the format in the channel object */ |
776 | if (mutex_lock_interruptible(&common->lock)) | ||
777 | return -ERESTARTSYS; | ||
778 | |||
779 | common->fmt = *fmt; | 783 | common->fmt = *fmt; |
780 | mutex_unlock(&common->lock); | ||
781 | |||
782 | return 0; | 784 | return 0; |
783 | } | 785 | } |
784 | 786 | ||
@@ -808,7 +810,6 @@ static int vpif_reqbufs(struct file *file, void *priv, | |||
808 | struct common_obj *common; | 810 | struct common_obj *common; |
809 | enum v4l2_field field; | 811 | enum v4l2_field field; |
810 | u8 index = 0; | 812 | u8 index = 0; |
811 | int ret = 0; | ||
812 | 813 | ||
813 | /* This file handle has not initialized the channel, | 814 | /* This file handle has not initialized the channel, |
814 | It is not allowed to do settings */ | 815 | It is not allowed to do settings */ |
@@ -826,18 +827,12 @@ static int vpif_reqbufs(struct file *file, void *priv, | |||
826 | index = VPIF_VIDEO_INDEX; | 827 | index = VPIF_VIDEO_INDEX; |
827 | 828 | ||
828 | common = &ch->common[index]; | 829 | common = &ch->common[index]; |
829 | if (mutex_lock_interruptible(&common->lock)) | ||
830 | return -ERESTARTSYS; | ||
831 | 830 | ||
832 | if (common->fmt.type != reqbuf->type) { | 831 | if (common->fmt.type != reqbuf->type) |
833 | ret = -EINVAL; | 832 | return -EINVAL; |
834 | goto reqbuf_exit; | ||
835 | } | ||
836 | 833 | ||
837 | if (0 != common->io_usrs) { | 834 | if (0 != common->io_usrs) |
838 | ret = -EBUSY; | 835 | return -EBUSY; |
839 | goto reqbuf_exit; | ||
840 | } | ||
841 | 836 | ||
842 | if (reqbuf->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) { | 837 | if (reqbuf->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) { |
843 | if (common->fmt.fmt.pix.field == V4L2_FIELD_ANY) | 838 | if (common->fmt.fmt.pix.field == V4L2_FIELD_ANY) |
@@ -854,7 +849,7 @@ static int vpif_reqbufs(struct file *file, void *priv, | |||
854 | &common->irqlock, | 849 | &common->irqlock, |
855 | reqbuf->type, field, | 850 | reqbuf->type, field, |
856 | sizeof(struct videobuf_buffer), fh, | 851 | sizeof(struct videobuf_buffer), fh, |
857 | NULL); | 852 | &common->lock); |
858 | 853 | ||
859 | /* Set io allowed member of file handle to TRUE */ | 854 | /* Set io allowed member of file handle to TRUE */ |
860 | fh->io_allowed[index] = 1; | 855 | fh->io_allowed[index] = 1; |
@@ -865,11 +860,7 @@ static int vpif_reqbufs(struct file *file, void *priv, | |||
865 | INIT_LIST_HEAD(&common->dma_queue); | 860 | INIT_LIST_HEAD(&common->dma_queue); |
866 | 861 | ||
867 | /* Allocate buffers */ | 862 | /* Allocate buffers */ |
868 | ret = videobuf_reqbufs(&common->buffer_queue, reqbuf); | 863 | return videobuf_reqbufs(&common->buffer_queue, reqbuf); |
869 | |||
870 | reqbuf_exit: | ||
871 | mutex_unlock(&common->lock); | ||
872 | return ret; | ||
873 | } | 864 | } |
874 | 865 | ||
875 | static int vpif_querybuf(struct file *file, void *priv, | 866 | static int vpif_querybuf(struct file *file, void *priv, |
@@ -990,22 +981,19 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id *std_id) | |||
990 | } | 981 | } |
991 | 982 | ||
992 | /* Call encoder subdevice function to set the standard */ | 983 | /* Call encoder subdevice function to set the standard */ |
993 | if (mutex_lock_interruptible(&common->lock)) | ||
994 | return -ERESTARTSYS; | ||
995 | |||
996 | ch->video.stdid = *std_id; | 984 | ch->video.stdid = *std_id; |
985 | ch->video.dv_preset = V4L2_DV_INVALID; | ||
986 | memset(&ch->video.bt_timings, 0, sizeof(ch->video.bt_timings)); | ||
987 | |||
997 | /* Get the information about the standard */ | 988 | /* Get the information about the standard */ |
998 | if (vpif_get_std_info(ch)) { | 989 | if (vpif_update_resolution(ch)) |
999 | vpif_err("Error getting the standard info\n"); | ||
1000 | return -EINVAL; | 990 | return -EINVAL; |
1001 | } | ||
1002 | 991 | ||
1003 | if ((ch->vpifparams.std_info.width * | 992 | if ((ch->vpifparams.std_info.width * |
1004 | ch->vpifparams.std_info.height * 2) > | 993 | ch->vpifparams.std_info.height * 2) > |
1005 | config_params.channel_bufsize[ch->channel_id]) { | 994 | config_params.channel_bufsize[ch->channel_id]) { |
1006 | vpif_err("invalid std for this size\n"); | 995 | vpif_err("invalid std for this size\n"); |
1007 | ret = -EINVAL; | 996 | return -EINVAL; |
1008 | goto s_std_exit; | ||
1009 | } | 997 | } |
1010 | 998 | ||
1011 | common->fmt.fmt.pix.bytesperline = common->fmt.fmt.pix.width; | 999 | common->fmt.fmt.pix.bytesperline = common->fmt.fmt.pix.width; |
@@ -1016,16 +1004,13 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id *std_id) | |||
1016 | s_std_output, *std_id); | 1004 | s_std_output, *std_id); |
1017 | if (ret < 0) { | 1005 | if (ret < 0) { |
1018 | vpif_err("Failed to set output standard\n"); | 1006 | vpif_err("Failed to set output standard\n"); |
1019 | goto s_std_exit; | 1007 | return ret; |
1020 | } | 1008 | } |
1021 | 1009 | ||
1022 | ret = v4l2_device_call_until_err(&vpif_obj.v4l2_dev, 1, core, | 1010 | ret = v4l2_device_call_until_err(&vpif_obj.v4l2_dev, 1, core, |
1023 | s_std, *std_id); | 1011 | s_std, *std_id); |
1024 | if (ret < 0) | 1012 | if (ret < 0) |
1025 | vpif_err("Failed to set standard for sub devices\n"); | 1013 | vpif_err("Failed to set standard for sub devices\n"); |
1026 | |||
1027 | s_std_exit: | ||
1028 | mutex_unlock(&common->lock); | ||
1029 | return ret; | 1014 | return ret; |
1030 | } | 1015 | } |
1031 | 1016 | ||
@@ -1090,21 +1075,17 @@ static int vpif_streamon(struct file *file, void *priv, | |||
1090 | if (ret < 0) | 1075 | if (ret < 0) |
1091 | return ret; | 1076 | return ret; |
1092 | 1077 | ||
1093 | /* Call videobuf_streamon to start streaming in videobuf */ | 1078 | /* Call videobuf_streamon to start streaming in videobuf */ |
1094 | ret = videobuf_streamon(&common->buffer_queue); | 1079 | ret = videobuf_streamon(&common->buffer_queue); |
1095 | if (ret < 0) { | 1080 | if (ret < 0) { |
1096 | vpif_err("videobuf_streamon\n"); | 1081 | vpif_err("videobuf_streamon\n"); |
1097 | return ret; | 1082 | return ret; |
1098 | } | 1083 | } |
1099 | 1084 | ||
1100 | if (mutex_lock_interruptible(&common->lock)) | ||
1101 | return -ERESTARTSYS; | ||
1102 | |||
1103 | /* If buffer queue is empty, return error */ | 1085 | /* If buffer queue is empty, return error */ |
1104 | if (list_empty(&common->dma_queue)) { | 1086 | if (list_empty(&common->dma_queue)) { |
1105 | vpif_err("buffer queue is empty\n"); | 1087 | vpif_err("buffer queue is empty\n"); |
1106 | ret = -EIO; | 1088 | return -EIO; |
1107 | goto streamon_exit; | ||
1108 | } | 1089 | } |
1109 | 1090 | ||
1110 | /* Get the next frame from the buffer queue */ | 1091 | /* Get the next frame from the buffer queue */ |
@@ -1130,8 +1111,7 @@ static int vpif_streamon(struct file *file, void *priv, | |||
1130 | || (!ch->vpifparams.std_info.frm_fmt | 1111 | || (!ch->vpifparams.std_info.frm_fmt |
1131 | && (common->fmt.fmt.pix.field == V4L2_FIELD_NONE))) { | 1112 | && (common->fmt.fmt.pix.field == V4L2_FIELD_NONE))) { |
1132 | vpif_err("conflict in field format and std format\n"); | 1113 | vpif_err("conflict in field format and std format\n"); |
1133 | ret = -EINVAL; | 1114 | return -EINVAL; |
1134 | goto streamon_exit; | ||
1135 | } | 1115 | } |
1136 | 1116 | ||
1137 | /* clock settings */ | 1117 | /* clock settings */ |
@@ -1140,13 +1120,13 @@ static int vpif_streamon(struct file *file, void *priv, | |||
1140 | ch->vpifparams.std_info.hd_sd); | 1120 | ch->vpifparams.std_info.hd_sd); |
1141 | if (ret < 0) { | 1121 | if (ret < 0) { |
1142 | vpif_err("can't set clock\n"); | 1122 | vpif_err("can't set clock\n"); |
1143 | goto streamon_exit; | 1123 | return ret; |
1144 | } | 1124 | } |
1145 | 1125 | ||
1146 | /* set the parameters and addresses */ | 1126 | /* set the parameters and addresses */ |
1147 | ret = vpif_set_video_params(vpif, ch->channel_id + 2); | 1127 | ret = vpif_set_video_params(vpif, ch->channel_id + 2); |
1148 | if (ret < 0) | 1128 | if (ret < 0) |
1149 | goto streamon_exit; | 1129 | return ret; |
1150 | 1130 | ||
1151 | common->started = ret; | 1131 | common->started = ret; |
1152 | vpif_config_addr(ch, ret); | 1132 | vpif_config_addr(ch, ret); |
@@ -1171,9 +1151,6 @@ static int vpif_streamon(struct file *file, void *priv, | |||
1171 | } | 1151 | } |
1172 | channel_first_int[VPIF_VIDEO_INDEX][ch->channel_id] = 1; | 1152 | channel_first_int[VPIF_VIDEO_INDEX][ch->channel_id] = 1; |
1173 | } | 1153 | } |
1174 | |||
1175 | streamon_exit: | ||
1176 | mutex_unlock(&common->lock); | ||
1177 | return ret; | 1154 | return ret; |
1178 | } | 1155 | } |
1179 | 1156 | ||
@@ -1199,9 +1176,6 @@ static int vpif_streamoff(struct file *file, void *priv, | |||
1199 | return -EINVAL; | 1176 | return -EINVAL; |
1200 | } | 1177 | } |
1201 | 1178 | ||
1202 | if (mutex_lock_interruptible(&common->lock)) | ||
1203 | return -ERESTARTSYS; | ||
1204 | |||
1205 | if (buftype == V4L2_BUF_TYPE_VIDEO_OUTPUT) { | 1179 | if (buftype == V4L2_BUF_TYPE_VIDEO_OUTPUT) { |
1206 | /* disable channel */ | 1180 | /* disable channel */ |
1207 | if (VPIF_CHANNEL2_VIDEO == ch->channel_id) { | 1181 | if (VPIF_CHANNEL2_VIDEO == ch->channel_id) { |
@@ -1216,8 +1190,6 @@ static int vpif_streamoff(struct file *file, void *priv, | |||
1216 | } | 1190 | } |
1217 | 1191 | ||
1218 | common->started = 0; | 1192 | common->started = 0; |
1219 | mutex_unlock(&common->lock); | ||
1220 | |||
1221 | return videobuf_streamoff(&common->buffer_queue); | 1193 | return videobuf_streamoff(&common->buffer_queue); |
1222 | } | 1194 | } |
1223 | 1195 | ||
@@ -1264,13 +1236,9 @@ static int vpif_s_output(struct file *file, void *priv, unsigned int i) | |||
1264 | struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; | 1236 | struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; |
1265 | int ret = 0; | 1237 | int ret = 0; |
1266 | 1238 | ||
1267 | if (mutex_lock_interruptible(&common->lock)) | ||
1268 | return -ERESTARTSYS; | ||
1269 | |||
1270 | if (common->started) { | 1239 | if (common->started) { |
1271 | vpif_err("Streaming in progress\n"); | 1240 | vpif_err("Streaming in progress\n"); |
1272 | ret = -EBUSY; | 1241 | return -EBUSY; |
1273 | goto s_output_exit; | ||
1274 | } | 1242 | } |
1275 | 1243 | ||
1276 | ret = v4l2_device_call_until_err(&vpif_obj.v4l2_dev, 1, video, | 1244 | ret = v4l2_device_call_until_err(&vpif_obj.v4l2_dev, 1, video, |
@@ -1280,9 +1248,6 @@ static int vpif_s_output(struct file *file, void *priv, unsigned int i) | |||
1280 | vpif_err("Failed to set output standard\n"); | 1248 | vpif_err("Failed to set output standard\n"); |
1281 | 1249 | ||
1282 | vid_ch->output_id = i; | 1250 | vid_ch->output_id = i; |
1283 | |||
1284 | s_output_exit: | ||
1285 | mutex_unlock(&common->lock); | ||
1286 | return ret; | 1251 | return ret; |
1287 | } | 1252 | } |
1288 | 1253 | ||
@@ -1315,6 +1280,287 @@ static int vpif_s_priority(struct file *file, void *priv, enum v4l2_priority p) | |||
1315 | return v4l2_prio_change(&ch->prio, &fh->prio, p); | 1280 | return v4l2_prio_change(&ch->prio, &fh->prio, p); |
1316 | } | 1281 | } |
1317 | 1282 | ||
1283 | /** | ||
1284 | * vpif_enum_dv_presets() - ENUM_DV_PRESETS handler | ||
1285 | * @file: file ptr | ||
1286 | * @priv: file handle | ||
1287 | * @preset: input preset | ||
1288 | */ | ||
1289 | static int vpif_enum_dv_presets(struct file *file, void *priv, | ||
1290 | struct v4l2_dv_enum_preset *preset) | ||
1291 | { | ||
1292 | struct vpif_fh *fh = priv; | ||
1293 | struct channel_obj *ch = fh->channel; | ||
1294 | struct video_obj *vid_ch = &ch->video; | ||
1295 | |||
1296 | return v4l2_subdev_call(vpif_obj.sd[vid_ch->output_id], | ||
1297 | video, enum_dv_presets, preset); | ||
1298 | } | ||
1299 | |||
1300 | /** | ||
1301 | * vpif_s_dv_presets() - S_DV_PRESETS handler | ||
1302 | * @file: file ptr | ||
1303 | * @priv: file handle | ||
1304 | * @preset: input preset | ||
1305 | */ | ||
1306 | static int vpif_s_dv_preset(struct file *file, void *priv, | ||
1307 | struct v4l2_dv_preset *preset) | ||
1308 | { | ||
1309 | struct vpif_fh *fh = priv; | ||
1310 | struct channel_obj *ch = fh->channel; | ||
1311 | struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; | ||
1312 | struct video_obj *vid_ch = &ch->video; | ||
1313 | int ret = 0; | ||
1314 | |||
1315 | if (common->started) { | ||
1316 | vpif_dbg(1, debug, "streaming in progress\n"); | ||
1317 | return -EBUSY; | ||
1318 | } | ||
1319 | |||
1320 | ret = v4l2_prio_check(&ch->prio, fh->prio); | ||
1321 | if (ret != 0) | ||
1322 | return ret; | ||
1323 | |||
1324 | fh->initialized = 1; | ||
1325 | |||
1326 | /* Call encoder subdevice function to set the standard */ | ||
1327 | if (mutex_lock_interruptible(&common->lock)) | ||
1328 | return -ERESTARTSYS; | ||
1329 | |||
1330 | ch->video.dv_preset = preset->preset; | ||
1331 | ch->video.stdid = V4L2_STD_UNKNOWN; | ||
1332 | memset(&ch->video.bt_timings, 0, sizeof(ch->video.bt_timings)); | ||
1333 | |||
1334 | /* Get the information about the standard */ | ||
1335 | if (vpif_update_resolution(ch)) { | ||
1336 | ret = -EINVAL; | ||
1337 | } else { | ||
1338 | /* Configure the default format information */ | ||
1339 | vpif_config_format(ch); | ||
1340 | |||
1341 | ret = v4l2_subdev_call(vpif_obj.sd[vid_ch->output_id], | ||
1342 | video, s_dv_preset, preset); | ||
1343 | } | ||
1344 | |||
1345 | mutex_unlock(&common->lock); | ||
1346 | |||
1347 | return ret; | ||
1348 | } | ||
1349 | /** | ||
1350 | * vpif_g_dv_presets() - G_DV_PRESETS handler | ||
1351 | * @file: file ptr | ||
1352 | * @priv: file handle | ||
1353 | * @preset: input preset | ||
1354 | */ | ||
1355 | static int vpif_g_dv_preset(struct file *file, void *priv, | ||
1356 | struct v4l2_dv_preset *preset) | ||
1357 | { | ||
1358 | struct vpif_fh *fh = priv; | ||
1359 | struct channel_obj *ch = fh->channel; | ||
1360 | |||
1361 | preset->preset = ch->video.dv_preset; | ||
1362 | |||
1363 | return 0; | ||
1364 | } | ||
1365 | /** | ||
1366 | * vpif_s_dv_timings() - S_DV_TIMINGS handler | ||
1367 | * @file: file ptr | ||
1368 | * @priv: file handle | ||
1369 | * @timings: digital video timings | ||
1370 | */ | ||
1371 | static int vpif_s_dv_timings(struct file *file, void *priv, | ||
1372 | struct v4l2_dv_timings *timings) | ||
1373 | { | ||
1374 | struct vpif_fh *fh = priv; | ||
1375 | struct channel_obj *ch = fh->channel; | ||
1376 | struct vpif_params *vpifparams = &ch->vpifparams; | ||
1377 | struct vpif_channel_config_params *std_info = &vpifparams->std_info; | ||
1378 | struct video_obj *vid_ch = &ch->video; | ||
1379 | struct v4l2_bt_timings *bt = &vid_ch->bt_timings; | ||
1380 | int ret; | ||
1381 | |||
1382 | if (timings->type != V4L2_DV_BT_656_1120) { | ||
1383 | vpif_dbg(2, debug, "Timing type not defined\n"); | ||
1384 | return -EINVAL; | ||
1385 | } | ||
1386 | |||
1387 | /* Configure subdevice timings, if any */ | ||
1388 | ret = v4l2_subdev_call(vpif_obj.sd[vid_ch->output_id], | ||
1389 | video, s_dv_timings, timings); | ||
1390 | if (ret == -ENOIOCTLCMD) { | ||
1391 | vpif_dbg(2, debug, "Custom DV timings not supported by " | ||
1392 | "subdevice\n"); | ||
1393 | return -EINVAL; | ||
1394 | } | ||
1395 | if (ret < 0) { | ||
1396 | vpif_dbg(2, debug, "Error setting custom DV timings\n"); | ||
1397 | return ret; | ||
1398 | } | ||
1399 | |||
1400 | if (!(timings->bt.width && timings->bt.height && | ||
1401 | (timings->bt.hbackporch || | ||
1402 | timings->bt.hfrontporch || | ||
1403 | timings->bt.hsync) && | ||
1404 | timings->bt.vfrontporch && | ||
1405 | (timings->bt.vbackporch || | ||
1406 | timings->bt.vsync))) { | ||
1407 | vpif_dbg(2, debug, "Timings for width, height, " | ||
1408 | "horizontal back porch, horizontal sync, " | ||
1409 | "horizontal front porch, vertical back porch, " | ||
1410 | "vertical sync and vertical back porch " | ||
1411 | "must be defined\n"); | ||
1412 | return -EINVAL; | ||
1413 | } | ||
1414 | |||
1415 | *bt = timings->bt; | ||
1416 | |||
1417 | /* Configure video port timings */ | ||
1418 | |||
1419 | std_info->eav2sav = bt->hbackporch + bt->hfrontporch + | ||
1420 | bt->hsync - 8; | ||
1421 | std_info->sav2eav = bt->width; | ||
1422 | |||
1423 | std_info->l1 = 1; | ||
1424 | std_info->l3 = bt->vsync + bt->vbackporch + 1; | ||
1425 | |||
1426 | if (bt->interlaced) { | ||
1427 | if (bt->il_vbackporch || bt->il_vfrontporch || bt->il_vsync) { | ||
1428 | std_info->vsize = bt->height * 2 + | ||
1429 | bt->vfrontporch + bt->vsync + bt->vbackporch + | ||
1430 | bt->il_vfrontporch + bt->il_vsync + | ||
1431 | bt->il_vbackporch; | ||
1432 | std_info->l5 = std_info->vsize/2 - | ||
1433 | (bt->vfrontporch - 1); | ||
1434 | std_info->l7 = std_info->vsize/2 + 1; | ||
1435 | std_info->l9 = std_info->l7 + bt->il_vsync + | ||
1436 | bt->il_vbackporch + 1; | ||
1437 | std_info->l11 = std_info->vsize - | ||
1438 | (bt->il_vfrontporch - 1); | ||
1439 | } else { | ||
1440 | vpif_dbg(2, debug, "Required timing values for " | ||
1441 | "interlaced BT format missing\n"); | ||
1442 | return -EINVAL; | ||
1443 | } | ||
1444 | } else { | ||
1445 | std_info->vsize = bt->height + bt->vfrontporch + | ||
1446 | bt->vsync + bt->vbackporch; | ||
1447 | std_info->l5 = std_info->vsize - (bt->vfrontporch - 1); | ||
1448 | } | ||
1449 | strncpy(std_info->name, "Custom timings BT656/1120", | ||
1450 | VPIF_MAX_NAME); | ||
1451 | std_info->width = bt->width; | ||
1452 | std_info->height = bt->height; | ||
1453 | std_info->frm_fmt = bt->interlaced ? 0 : 1; | ||
1454 | std_info->ycmux_mode = 0; | ||
1455 | std_info->capture_format = 0; | ||
1456 | std_info->vbi_supported = 0; | ||
1457 | std_info->hd_sd = 1; | ||
1458 | std_info->stdid = 0; | ||
1459 | std_info->dv_preset = V4L2_DV_INVALID; | ||
1460 | |||
1461 | vid_ch->stdid = 0; | ||
1462 | vid_ch->dv_preset = V4L2_DV_INVALID; | ||
1463 | |||
1464 | return 0; | ||
1465 | } | ||
1466 | |||
1467 | /** | ||
1468 | * vpif_g_dv_timings() - G_DV_TIMINGS handler | ||
1469 | * @file: file ptr | ||
1470 | * @priv: file handle | ||
1471 | * @timings: digital video timings | ||
1472 | */ | ||
1473 | static int vpif_g_dv_timings(struct file *file, void *priv, | ||
1474 | struct v4l2_dv_timings *timings) | ||
1475 | { | ||
1476 | struct vpif_fh *fh = priv; | ||
1477 | struct channel_obj *ch = fh->channel; | ||
1478 | struct video_obj *vid_ch = &ch->video; | ||
1479 | struct v4l2_bt_timings *bt = &vid_ch->bt_timings; | ||
1480 | |||
1481 | timings->bt = *bt; | ||
1482 | |||
1483 | return 0; | ||
1484 | } | ||
1485 | |||
1486 | /* | ||
1487 | * vpif_g_chip_ident() - Identify the chip | ||
1488 | * @file: file ptr | ||
1489 | * @priv: file handle | ||
1490 | * @chip: chip identity | ||
1491 | * | ||
1492 | * Returns zero or -EINVAL if read operations fails. | ||
1493 | */ | ||
1494 | static int vpif_g_chip_ident(struct file *file, void *priv, | ||
1495 | struct v4l2_dbg_chip_ident *chip) | ||
1496 | { | ||
1497 | chip->ident = V4L2_IDENT_NONE; | ||
1498 | chip->revision = 0; | ||
1499 | if (chip->match.type != V4L2_CHIP_MATCH_I2C_DRIVER && | ||
1500 | chip->match.type != V4L2_CHIP_MATCH_I2C_ADDR) { | ||
1501 | vpif_dbg(2, debug, "match_type is invalid.\n"); | ||
1502 | return -EINVAL; | ||
1503 | } | ||
1504 | |||
1505 | return v4l2_device_call_until_err(&vpif_obj.v4l2_dev, 0, core, | ||
1506 | g_chip_ident, chip); | ||
1507 | } | ||
1508 | |||
1509 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
1510 | /* | ||
1511 | * vpif_dbg_g_register() - Read register | ||
1512 | * @file: file ptr | ||
1513 | * @priv: file handle | ||
1514 | * @reg: register to be read | ||
1515 | * | ||
1516 | * Debugging only | ||
1517 | * Returns zero or -EINVAL if read operations fails. | ||
1518 | */ | ||
1519 | static int vpif_dbg_g_register(struct file *file, void *priv, | ||
1520 | struct v4l2_dbg_register *reg){ | ||
1521 | struct vpif_fh *fh = priv; | ||
1522 | struct channel_obj *ch = fh->channel; | ||
1523 | struct video_obj *vid_ch = &ch->video; | ||
1524 | |||
1525 | return v4l2_subdev_call(vpif_obj.sd[vid_ch->output_id], core, | ||
1526 | g_register, reg); | ||
1527 | } | ||
1528 | |||
1529 | /* | ||
1530 | * vpif_dbg_s_register() - Write to register | ||
1531 | * @file: file ptr | ||
1532 | * @priv: file handle | ||
1533 | * @reg: register to be modified | ||
1534 | * | ||
1535 | * Debugging only | ||
1536 | * Returns zero or -EINVAL if write operations fails. | ||
1537 | */ | ||
1538 | static int vpif_dbg_s_register(struct file *file, void *priv, | ||
1539 | struct v4l2_dbg_register *reg){ | ||
1540 | struct vpif_fh *fh = priv; | ||
1541 | struct channel_obj *ch = fh->channel; | ||
1542 | struct video_obj *vid_ch = &ch->video; | ||
1543 | |||
1544 | return v4l2_subdev_call(vpif_obj.sd[vid_ch->output_id], core, | ||
1545 | s_register, reg); | ||
1546 | } | ||
1547 | #endif | ||
1548 | |||
1549 | /* | ||
1550 | * vpif_log_status() - Status information | ||
1551 | * @file: file ptr | ||
1552 | * @priv: file handle | ||
1553 | * | ||
1554 | * Returns zero. | ||
1555 | */ | ||
1556 | static int vpif_log_status(struct file *filep, void *priv) | ||
1557 | { | ||
1558 | /* status for sub devices */ | ||
1559 | v4l2_device_call_all(&vpif_obj.v4l2_dev, 0, core, log_status); | ||
1560 | |||
1561 | return 0; | ||
1562 | } | ||
1563 | |||
1318 | /* vpif display ioctl operations */ | 1564 | /* vpif display ioctl operations */ |
1319 | static const struct v4l2_ioctl_ops vpif_ioctl_ops = { | 1565 | static const struct v4l2_ioctl_ops vpif_ioctl_ops = { |
1320 | .vidioc_querycap = vpif_querycap, | 1566 | .vidioc_querycap = vpif_querycap, |
@@ -1336,13 +1582,24 @@ static const struct v4l2_ioctl_ops vpif_ioctl_ops = { | |||
1336 | .vidioc_s_output = vpif_s_output, | 1582 | .vidioc_s_output = vpif_s_output, |
1337 | .vidioc_g_output = vpif_g_output, | 1583 | .vidioc_g_output = vpif_g_output, |
1338 | .vidioc_cropcap = vpif_cropcap, | 1584 | .vidioc_cropcap = vpif_cropcap, |
1585 | .vidioc_enum_dv_presets = vpif_enum_dv_presets, | ||
1586 | .vidioc_s_dv_preset = vpif_s_dv_preset, | ||
1587 | .vidioc_g_dv_preset = vpif_g_dv_preset, | ||
1588 | .vidioc_s_dv_timings = vpif_s_dv_timings, | ||
1589 | .vidioc_g_dv_timings = vpif_g_dv_timings, | ||
1590 | .vidioc_g_chip_ident = vpif_g_chip_ident, | ||
1591 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
1592 | .vidioc_g_register = vpif_dbg_g_register, | ||
1593 | .vidioc_s_register = vpif_dbg_s_register, | ||
1594 | #endif | ||
1595 | .vidioc_log_status = vpif_log_status, | ||
1339 | }; | 1596 | }; |
1340 | 1597 | ||
1341 | static const struct v4l2_file_operations vpif_fops = { | 1598 | static const struct v4l2_file_operations vpif_fops = { |
1342 | .owner = THIS_MODULE, | 1599 | .owner = THIS_MODULE, |
1343 | .open = vpif_open, | 1600 | .open = vpif_open, |
1344 | .release = vpif_release, | 1601 | .release = vpif_release, |
1345 | .ioctl = video_ioctl2, | 1602 | .unlocked_ioctl = video_ioctl2, |
1346 | .mmap = vpif_mmap, | 1603 | .mmap = vpif_mmap, |
1347 | .poll = vpif_poll | 1604 | .poll = vpif_poll |
1348 | }; | 1605 | }; |
@@ -1526,6 +1783,7 @@ static __init int vpif_probe(struct platform_device *pdev) | |||
1526 | v4l2_prio_init(&ch->prio); | 1783 | v4l2_prio_init(&ch->prio); |
1527 | ch->common[VPIF_VIDEO_INDEX].fmt.type = | 1784 | ch->common[VPIF_VIDEO_INDEX].fmt.type = |
1528 | V4L2_BUF_TYPE_VIDEO_OUTPUT; | 1785 | V4L2_BUF_TYPE_VIDEO_OUTPUT; |
1786 | ch->video_dev->lock = &common->lock; | ||
1529 | 1787 | ||
1530 | /* register video device */ | 1788 | /* register video device */ |
1531 | vpif_dbg(1, debug, "channel=%x,channel->video_dev=%x\n", | 1789 | vpif_dbg(1, debug, "channel=%x,channel->video_dev=%x\n", |
@@ -1565,6 +1823,8 @@ static __init int vpif_probe(struct platform_device *pdev) | |||
1565 | vpif_obj.sd[i]->grp_id = 1 << i; | 1823 | vpif_obj.sd[i]->grp_id = 1 << i; |
1566 | } | 1824 | } |
1567 | 1825 | ||
1826 | v4l2_info(&vpif_obj.v4l2_dev, | ||
1827 | "DM646x VPIF display driver initialized\n"); | ||
1568 | return 0; | 1828 | return 0; |
1569 | 1829 | ||
1570 | probe_subdev_out: | 1830 | probe_subdev_out: |
diff --git a/drivers/media/video/davinci/vpif_display.h b/drivers/media/video/davinci/vpif_display.h index a2a7cd166bbf..b53aaa883075 100644 --- a/drivers/media/video/davinci/vpif_display.h +++ b/drivers/media/video/davinci/vpif_display.h | |||
@@ -67,6 +67,8 @@ struct video_obj { | |||
67 | * most recent displayed frame only */ | 67 | * most recent displayed frame only */ |
68 | v4l2_std_id stdid; /* Currently selected or default | 68 | v4l2_std_id stdid; /* Currently selected or default |
69 | * standard */ | 69 | * standard */ |
70 | u32 dv_preset; | ||
71 | struct v4l2_bt_timings bt_timings; | ||
70 | u32 output_id; /* Current output id */ | 72 | u32 output_id; /* Current output id */ |
71 | }; | 73 | }; |
72 | 74 | ||
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 099d5df8c572..87f77a34eeab 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <media/saa7115.h> | 33 | #include <media/saa7115.h> |
34 | #include <media/tvp5150.h> | 34 | #include <media/tvp5150.h> |
35 | #include <media/tvaudio.h> | 35 | #include <media/tvaudio.h> |
36 | #include <media/mt9v011.h> | ||
36 | #include <media/i2c-addr.h> | 37 | #include <media/i2c-addr.h> |
37 | #include <media/tveeprom.h> | 38 | #include <media/tveeprom.h> |
38 | #include <media/v4l2-common.h> | 39 | #include <media/v4l2-common.h> |
@@ -1917,11 +1918,6 @@ static unsigned short tvp5150_addrs[] = { | |||
1917 | I2C_CLIENT_END | 1918 | I2C_CLIENT_END |
1918 | }; | 1919 | }; |
1919 | 1920 | ||
1920 | static unsigned short mt9v011_addrs[] = { | ||
1921 | 0xba >> 1, | ||
1922 | I2C_CLIENT_END | ||
1923 | }; | ||
1924 | |||
1925 | static unsigned short msp3400_addrs[] = { | 1921 | static unsigned short msp3400_addrs[] = { |
1926 | 0x80 >> 1, | 1922 | 0x80 >> 1, |
1927 | 0x88 >> 1, | 1923 | 0x88 >> 1, |
@@ -2437,6 +2433,7 @@ void em28xx_register_i2c_ir(struct em28xx *dev) | |||
2437 | dev->init_data.ir_codes = RC_MAP_RC5_HAUPPAUGE_NEW; | 2433 | dev->init_data.ir_codes = RC_MAP_RC5_HAUPPAUGE_NEW; |
2438 | dev->init_data.get_key = em28xx_get_key_em_haup; | 2434 | dev->init_data.get_key = em28xx_get_key_em_haup; |
2439 | dev->init_data.name = "i2c IR (EM2840 Hauppauge)"; | 2435 | dev->init_data.name = "i2c IR (EM2840 Hauppauge)"; |
2436 | break; | ||
2440 | case EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE: | 2437 | case EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE: |
2441 | dev->init_data.ir_codes = RC_MAP_WINFAST_USBII_DELUXE; | 2438 | dev->init_data.ir_codes = RC_MAP_WINFAST_USBII_DELUXE; |
2442 | dev->init_data.get_key = em28xx_get_key_winfast_usbii_deluxe; | 2439 | dev->init_data.get_key = em28xx_get_key_winfast_usbii_deluxe; |
@@ -2623,11 +2620,17 @@ void em28xx_card_setup(struct em28xx *dev) | |||
2623 | "tvp5150", 0, tvp5150_addrs); | 2620 | "tvp5150", 0, tvp5150_addrs); |
2624 | 2621 | ||
2625 | if (dev->em28xx_sensor == EM28XX_MT9V011) { | 2622 | if (dev->em28xx_sensor == EM28XX_MT9V011) { |
2623 | struct mt9v011_platform_data pdata; | ||
2624 | struct i2c_board_info mt9v011_info = { | ||
2625 | .type = "mt9v011", | ||
2626 | .addr = 0xba >> 1, | ||
2627 | .platform_data = &pdata, | ||
2628 | }; | ||
2626 | struct v4l2_subdev *sd; | 2629 | struct v4l2_subdev *sd; |
2627 | 2630 | ||
2628 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, | 2631 | pdata.xtal = dev->sensor_xtal; |
2629 | &dev->i2c_adap, "mt9v011", 0, mt9v011_addrs); | 2632 | sd = v4l2_i2c_new_subdev_board(&dev->v4l2_dev, &dev->i2c_adap, |
2630 | v4l2_subdev_call(sd, core, s_config, 0, &dev->sensor_xtal); | 2633 | &mt9v011_info, NULL); |
2631 | } | 2634 | } |
2632 | 2635 | ||
2633 | 2636 | ||
diff --git a/drivers/media/video/et61x251/et61x251.h b/drivers/media/video/et61x251/et61x251.h index cc77d144df3c..bf66189cb26d 100644 --- a/drivers/media/video/et61x251/et61x251.h +++ b/drivers/media/video/et61x251/et61x251.h | |||
@@ -59,31 +59,7 @@ | |||
59 | /*****************************************************************************/ | 59 | /*****************************************************************************/ |
60 | 60 | ||
61 | static const struct usb_device_id et61x251_id_table[] = { | 61 | static const struct usb_device_id et61x251_id_table[] = { |
62 | { USB_DEVICE(0x102c, 0x6151), }, | ||
63 | { USB_DEVICE(0x102c, 0x6251), }, | 62 | { USB_DEVICE(0x102c, 0x6251), }, |
64 | { USB_DEVICE(0x102c, 0x6253), }, | ||
65 | { USB_DEVICE(0x102c, 0x6254), }, | ||
66 | { USB_DEVICE(0x102c, 0x6255), }, | ||
67 | { USB_DEVICE(0x102c, 0x6256), }, | ||
68 | { USB_DEVICE(0x102c, 0x6257), }, | ||
69 | { USB_DEVICE(0x102c, 0x6258), }, | ||
70 | { USB_DEVICE(0x102c, 0x6259), }, | ||
71 | { USB_DEVICE(0x102c, 0x625a), }, | ||
72 | { USB_DEVICE(0x102c, 0x625b), }, | ||
73 | { USB_DEVICE(0x102c, 0x625c), }, | ||
74 | { USB_DEVICE(0x102c, 0x625d), }, | ||
75 | { USB_DEVICE(0x102c, 0x625e), }, | ||
76 | { USB_DEVICE(0x102c, 0x625f), }, | ||
77 | { USB_DEVICE(0x102c, 0x6260), }, | ||
78 | { USB_DEVICE(0x102c, 0x6261), }, | ||
79 | { USB_DEVICE(0x102c, 0x6262), }, | ||
80 | { USB_DEVICE(0x102c, 0x6263), }, | ||
81 | { USB_DEVICE(0x102c, 0x6264), }, | ||
82 | { USB_DEVICE(0x102c, 0x6265), }, | ||
83 | { USB_DEVICE(0x102c, 0x6266), }, | ||
84 | { USB_DEVICE(0x102c, 0x6267), }, | ||
85 | { USB_DEVICE(0x102c, 0x6268), }, | ||
86 | { USB_DEVICE(0x102c, 0x6269), }, | ||
87 | { } | 63 | { } |
88 | }; | 64 | }; |
89 | 65 | ||
diff --git a/drivers/media/video/gspca/benq.c b/drivers/media/video/gspca/benq.c index 629043933501..a09c4709d613 100644 --- a/drivers/media/video/gspca/benq.c +++ b/drivers/media/video/gspca/benq.c | |||
@@ -276,7 +276,7 @@ static const struct sd_desc sd_desc = { | |||
276 | }; | 276 | }; |
277 | 277 | ||
278 | /* -- module initialisation -- */ | 278 | /* -- module initialisation -- */ |
279 | static const __devinitdata struct usb_device_id device_table[] = { | 279 | static const struct usb_device_id device_table[] = { |
280 | {USB_DEVICE(0x04a5, 0x3035)}, | 280 | {USB_DEVICE(0x04a5, 0x3035)}, |
281 | {} | 281 | {} |
282 | }; | 282 | }; |
diff --git a/drivers/media/video/gspca/conex.c b/drivers/media/video/gspca/conex.c index 1eacb6c7926d..8b398493f96b 100644 --- a/drivers/media/video/gspca/conex.c +++ b/drivers/media/video/gspca/conex.c | |||
@@ -1040,14 +1040,14 @@ static const struct sd_desc sd_desc = { | |||
1040 | }; | 1040 | }; |
1041 | 1041 | ||
1042 | /* -- module initialisation -- */ | 1042 | /* -- module initialisation -- */ |
1043 | static const struct usb_device_id device_table[] __devinitconst = { | 1043 | static const struct usb_device_id device_table[] = { |
1044 | {USB_DEVICE(0x0572, 0x0041)}, | 1044 | {USB_DEVICE(0x0572, 0x0041)}, |
1045 | {} | 1045 | {} |
1046 | }; | 1046 | }; |
1047 | MODULE_DEVICE_TABLE(usb, device_table); | 1047 | MODULE_DEVICE_TABLE(usb, device_table); |
1048 | 1048 | ||
1049 | /* -- device connect -- */ | 1049 | /* -- device connect -- */ |
1050 | static int __devinit sd_probe(struct usb_interface *intf, | 1050 | static int sd_probe(struct usb_interface *intf, |
1051 | const struct usb_device_id *id) | 1051 | const struct usb_device_id *id) |
1052 | { | 1052 | { |
1053 | return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), | 1053 | return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), |
diff --git a/drivers/media/video/gspca/cpia1.c b/drivers/media/video/gspca/cpia1.c index c1ae05f4661f..4bf2cab98d64 100644 --- a/drivers/media/video/gspca/cpia1.c +++ b/drivers/media/video/gspca/cpia1.c | |||
@@ -2088,7 +2088,7 @@ static const struct sd_desc sd_desc = { | |||
2088 | }; | 2088 | }; |
2089 | 2089 | ||
2090 | /* -- module initialisation -- */ | 2090 | /* -- module initialisation -- */ |
2091 | static const __devinitdata struct usb_device_id device_table[] = { | 2091 | static const struct usb_device_id device_table[] = { |
2092 | {USB_DEVICE(0x0553, 0x0002)}, | 2092 | {USB_DEVICE(0x0553, 0x0002)}, |
2093 | {USB_DEVICE(0x0813, 0x0001)}, | 2093 | {USB_DEVICE(0x0813, 0x0001)}, |
2094 | {} | 2094 | {} |
diff --git a/drivers/media/video/gspca/etoms.c b/drivers/media/video/gspca/etoms.c index a594b36d6199..4b2c483fce6f 100644 --- a/drivers/media/video/gspca/etoms.c +++ b/drivers/media/video/gspca/etoms.c | |||
@@ -864,7 +864,7 @@ static const struct sd_desc sd_desc = { | |||
864 | }; | 864 | }; |
865 | 865 | ||
866 | /* -- module initialisation -- */ | 866 | /* -- module initialisation -- */ |
867 | static const struct usb_device_id device_table[] __devinitconst = { | 867 | static const struct usb_device_id device_table[] = { |
868 | {USB_DEVICE(0x102c, 0x6151), .driver_info = SENSOR_PAS106}, | 868 | {USB_DEVICE(0x102c, 0x6151), .driver_info = SENSOR_PAS106}, |
869 | #if !defined CONFIG_USB_ET61X251 && !defined CONFIG_USB_ET61X251_MODULE | 869 | #if !defined CONFIG_USB_ET61X251 && !defined CONFIG_USB_ET61X251_MODULE |
870 | {USB_DEVICE(0x102c, 0x6251), .driver_info = SENSOR_TAS5130CXX}, | 870 | {USB_DEVICE(0x102c, 0x6251), .driver_info = SENSOR_TAS5130CXX}, |
@@ -875,7 +875,7 @@ static const struct usb_device_id device_table[] __devinitconst = { | |||
875 | MODULE_DEVICE_TABLE(usb, device_table); | 875 | MODULE_DEVICE_TABLE(usb, device_table); |
876 | 876 | ||
877 | /* -- device connect -- */ | 877 | /* -- device connect -- */ |
878 | static int __devinit sd_probe(struct usb_interface *intf, | 878 | static int sd_probe(struct usb_interface *intf, |
879 | const struct usb_device_id *id) | 879 | const struct usb_device_id *id) |
880 | { | 880 | { |
881 | return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), | 881 | return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), |
diff --git a/drivers/media/video/gspca/finepix.c b/drivers/media/video/gspca/finepix.c index d78226455d1f..987b4b69d7ab 100644 --- a/drivers/media/video/gspca/finepix.c +++ b/drivers/media/video/gspca/finepix.c | |||
@@ -229,7 +229,7 @@ static void sd_stop0(struct gspca_dev *gspca_dev) | |||
229 | } | 229 | } |
230 | 230 | ||
231 | /* Table of supported USB devices */ | 231 | /* Table of supported USB devices */ |
232 | static const __devinitdata struct usb_device_id device_table[] = { | 232 | static const struct usb_device_id device_table[] = { |
233 | {USB_DEVICE(0x04cb, 0x0104)}, | 233 | {USB_DEVICE(0x04cb, 0x0104)}, |
234 | {USB_DEVICE(0x04cb, 0x0109)}, | 234 | {USB_DEVICE(0x04cb, 0x0109)}, |
235 | {USB_DEVICE(0x04cb, 0x010b)}, | 235 | {USB_DEVICE(0x04cb, 0x010b)}, |
diff --git a/drivers/media/video/gspca/gl860/gl860.c b/drivers/media/video/gspca/gl860/gl860.c index b05bec7321b5..99083038cec3 100644 --- a/drivers/media/video/gspca/gl860/gl860.c +++ b/drivers/media/video/gspca/gl860/gl860.c | |||
@@ -488,7 +488,7 @@ static void sd_callback(struct gspca_dev *gspca_dev) | |||
488 | 488 | ||
489 | /*=================== USB driver structure initialisation ==================*/ | 489 | /*=================== USB driver structure initialisation ==================*/ |
490 | 490 | ||
491 | static const __devinitdata struct usb_device_id device_table[] = { | 491 | static const struct usb_device_id device_table[] = { |
492 | {USB_DEVICE(0x05e3, 0x0503)}, | 492 | {USB_DEVICE(0x05e3, 0x0503)}, |
493 | {USB_DEVICE(0x05e3, 0xf191)}, | 493 | {USB_DEVICE(0x05e3, 0xf191)}, |
494 | {} | 494 | {} |
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index 442970073e8a..f21f2a258ae0 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c | |||
@@ -55,7 +55,7 @@ MODULE_AUTHOR("Jean-François Moine <http://moinejf.free.fr>"); | |||
55 | MODULE_DESCRIPTION("GSPCA USB Camera Driver"); | 55 | MODULE_DESCRIPTION("GSPCA USB Camera Driver"); |
56 | MODULE_LICENSE("GPL"); | 56 | MODULE_LICENSE("GPL"); |
57 | 57 | ||
58 | #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 11, 0) | 58 | #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 12, 0) |
59 | 59 | ||
60 | #ifdef GSPCA_DEBUG | 60 | #ifdef GSPCA_DEBUG |
61 | int gspca_debug = D_ERR | D_PROBE; | 61 | int gspca_debug = D_ERR | D_PROBE; |
@@ -508,8 +508,8 @@ static int gspca_is_compressed(__u32 format) | |||
508 | return 0; | 508 | return 0; |
509 | } | 509 | } |
510 | 510 | ||
511 | static int frame_alloc(struct gspca_dev *gspca_dev, | 511 | static int frame_alloc(struct gspca_dev *gspca_dev, struct file *file, |
512 | unsigned int count) | 512 | enum v4l2_memory memory, unsigned int count) |
513 | { | 513 | { |
514 | struct gspca_frame *frame; | 514 | struct gspca_frame *frame; |
515 | unsigned int frsz; | 515 | unsigned int frsz; |
@@ -519,7 +519,6 @@ static int frame_alloc(struct gspca_dev *gspca_dev, | |||
519 | frsz = gspca_dev->cam.cam_mode[i].sizeimage; | 519 | frsz = gspca_dev->cam.cam_mode[i].sizeimage; |
520 | PDEBUG(D_STREAM, "frame alloc frsz: %d", frsz); | 520 | PDEBUG(D_STREAM, "frame alloc frsz: %d", frsz); |
521 | frsz = PAGE_ALIGN(frsz); | 521 | frsz = PAGE_ALIGN(frsz); |
522 | gspca_dev->frsz = frsz; | ||
523 | if (count >= GSPCA_MAX_FRAMES) | 522 | if (count >= GSPCA_MAX_FRAMES) |
524 | count = GSPCA_MAX_FRAMES - 1; | 523 | count = GSPCA_MAX_FRAMES - 1; |
525 | gspca_dev->frbuf = vmalloc_32(frsz * count); | 524 | gspca_dev->frbuf = vmalloc_32(frsz * count); |
@@ -527,6 +526,9 @@ static int frame_alloc(struct gspca_dev *gspca_dev, | |||
527 | err("frame alloc failed"); | 526 | err("frame alloc failed"); |
528 | return -ENOMEM; | 527 | return -ENOMEM; |
529 | } | 528 | } |
529 | gspca_dev->capt_file = file; | ||
530 | gspca_dev->memory = memory; | ||
531 | gspca_dev->frsz = frsz; | ||
530 | gspca_dev->nframes = count; | 532 | gspca_dev->nframes = count; |
531 | for (i = 0; i < count; i++) { | 533 | for (i = 0; i < count; i++) { |
532 | frame = &gspca_dev->frame[i]; | 534 | frame = &gspca_dev->frame[i]; |
@@ -535,7 +537,7 @@ static int frame_alloc(struct gspca_dev *gspca_dev, | |||
535 | frame->v4l2_buf.flags = 0; | 537 | frame->v4l2_buf.flags = 0; |
536 | frame->v4l2_buf.field = V4L2_FIELD_NONE; | 538 | frame->v4l2_buf.field = V4L2_FIELD_NONE; |
537 | frame->v4l2_buf.length = frsz; | 539 | frame->v4l2_buf.length = frsz; |
538 | frame->v4l2_buf.memory = gspca_dev->memory; | 540 | frame->v4l2_buf.memory = memory; |
539 | frame->v4l2_buf.sequence = 0; | 541 | frame->v4l2_buf.sequence = 0; |
540 | frame->data = gspca_dev->frbuf + i * frsz; | 542 | frame->data = gspca_dev->frbuf + i * frsz; |
541 | frame->v4l2_buf.m.offset = i * frsz; | 543 | frame->v4l2_buf.m.offset = i * frsz; |
@@ -558,6 +560,9 @@ static void frame_free(struct gspca_dev *gspca_dev) | |||
558 | gspca_dev->frame[i].data = NULL; | 560 | gspca_dev->frame[i].data = NULL; |
559 | } | 561 | } |
560 | gspca_dev->nframes = 0; | 562 | gspca_dev->nframes = 0; |
563 | gspca_dev->frsz = 0; | ||
564 | gspca_dev->capt_file = NULL; | ||
565 | gspca_dev->memory = GSPCA_MEMORY_NO; | ||
561 | } | 566 | } |
562 | 567 | ||
563 | static void destroy_urbs(struct gspca_dev *gspca_dev) | 568 | static void destroy_urbs(struct gspca_dev *gspca_dev) |
@@ -1210,29 +1215,15 @@ static void gspca_release(struct video_device *vfd) | |||
1210 | static int dev_open(struct file *file) | 1215 | static int dev_open(struct file *file) |
1211 | { | 1216 | { |
1212 | struct gspca_dev *gspca_dev; | 1217 | struct gspca_dev *gspca_dev; |
1213 | int ret; | ||
1214 | 1218 | ||
1215 | PDEBUG(D_STREAM, "[%s] open", current->comm); | 1219 | PDEBUG(D_STREAM, "[%s] open", current->comm); |
1216 | gspca_dev = (struct gspca_dev *) video_devdata(file); | 1220 | gspca_dev = (struct gspca_dev *) video_devdata(file); |
1217 | if (mutex_lock_interruptible(&gspca_dev->queue_lock)) | 1221 | if (!gspca_dev->present) |
1218 | return -ERESTARTSYS; | 1222 | return -ENODEV; |
1219 | if (!gspca_dev->present) { | ||
1220 | ret = -ENODEV; | ||
1221 | goto out; | ||
1222 | } | ||
1223 | |||
1224 | if (gspca_dev->users > 4) { /* (arbitrary value) */ | ||
1225 | ret = -EBUSY; | ||
1226 | goto out; | ||
1227 | } | ||
1228 | 1223 | ||
1229 | /* protect the subdriver against rmmod */ | 1224 | /* protect the subdriver against rmmod */ |
1230 | if (!try_module_get(gspca_dev->module)) { | 1225 | if (!try_module_get(gspca_dev->module)) |
1231 | ret = -ENODEV; | 1226 | return -ENODEV; |
1232 | goto out; | ||
1233 | } | ||
1234 | |||
1235 | gspca_dev->users++; | ||
1236 | 1227 | ||
1237 | file->private_data = gspca_dev; | 1228 | file->private_data = gspca_dev; |
1238 | #ifdef GSPCA_DEBUG | 1229 | #ifdef GSPCA_DEBUG |
@@ -1244,14 +1235,7 @@ static int dev_open(struct file *file) | |||
1244 | gspca_dev->vdev.debug &= ~(V4L2_DEBUG_IOCTL | 1235 | gspca_dev->vdev.debug &= ~(V4L2_DEBUG_IOCTL |
1245 | | V4L2_DEBUG_IOCTL_ARG); | 1236 | | V4L2_DEBUG_IOCTL_ARG); |
1246 | #endif | 1237 | #endif |
1247 | ret = 0; | 1238 | return 0; |
1248 | out: | ||
1249 | mutex_unlock(&gspca_dev->queue_lock); | ||
1250 | if (ret != 0) | ||
1251 | PDEBUG(D_ERR|D_STREAM, "open failed err %d", ret); | ||
1252 | else | ||
1253 | PDEBUG(D_STREAM, "open done"); | ||
1254 | return ret; | ||
1255 | } | 1239 | } |
1256 | 1240 | ||
1257 | static int dev_close(struct file *file) | 1241 | static int dev_close(struct file *file) |
@@ -1261,7 +1245,6 @@ static int dev_close(struct file *file) | |||
1261 | PDEBUG(D_STREAM, "[%s] close", current->comm); | 1245 | PDEBUG(D_STREAM, "[%s] close", current->comm); |
1262 | if (mutex_lock_interruptible(&gspca_dev->queue_lock)) | 1246 | if (mutex_lock_interruptible(&gspca_dev->queue_lock)) |
1263 | return -ERESTARTSYS; | 1247 | return -ERESTARTSYS; |
1264 | gspca_dev->users--; | ||
1265 | 1248 | ||
1266 | /* if the file did the capture, free the streaming resources */ | 1249 | /* if the file did the capture, free the streaming resources */ |
1267 | if (gspca_dev->capt_file == file) { | 1250 | if (gspca_dev->capt_file == file) { |
@@ -1272,8 +1255,6 @@ static int dev_close(struct file *file) | |||
1272 | mutex_unlock(&gspca_dev->usb_lock); | 1255 | mutex_unlock(&gspca_dev->usb_lock); |
1273 | } | 1256 | } |
1274 | frame_free(gspca_dev); | 1257 | frame_free(gspca_dev); |
1275 | gspca_dev->capt_file = NULL; | ||
1276 | gspca_dev->memory = GSPCA_MEMORY_NO; | ||
1277 | } | 1258 | } |
1278 | file->private_data = NULL; | 1259 | file->private_data = NULL; |
1279 | module_put(gspca_dev->module); | 1260 | module_put(gspca_dev->module); |
@@ -1516,6 +1497,7 @@ static int vidioc_reqbufs(struct file *file, void *priv, | |||
1516 | return -ERESTARTSYS; | 1497 | return -ERESTARTSYS; |
1517 | 1498 | ||
1518 | if (gspca_dev->memory != GSPCA_MEMORY_NO | 1499 | if (gspca_dev->memory != GSPCA_MEMORY_NO |
1500 | && gspca_dev->memory != GSPCA_MEMORY_READ | ||
1519 | && gspca_dev->memory != rb->memory) { | 1501 | && gspca_dev->memory != rb->memory) { |
1520 | ret = -EBUSY; | 1502 | ret = -EBUSY; |
1521 | goto out; | 1503 | goto out; |
@@ -1544,19 +1526,18 @@ static int vidioc_reqbufs(struct file *file, void *priv, | |||
1544 | gspca_stream_off(gspca_dev); | 1526 | gspca_stream_off(gspca_dev); |
1545 | mutex_unlock(&gspca_dev->usb_lock); | 1527 | mutex_unlock(&gspca_dev->usb_lock); |
1546 | } | 1528 | } |
1529 | /* Don't restart the stream when switching from read to mmap mode */ | ||
1530 | if (gspca_dev->memory == GSPCA_MEMORY_READ) | ||
1531 | streaming = 0; | ||
1547 | 1532 | ||
1548 | /* free the previous allocated buffers, if any */ | 1533 | /* free the previous allocated buffers, if any */ |
1549 | if (gspca_dev->nframes != 0) { | 1534 | if (gspca_dev->nframes != 0) |
1550 | frame_free(gspca_dev); | 1535 | frame_free(gspca_dev); |
1551 | gspca_dev->capt_file = NULL; | ||
1552 | } | ||
1553 | if (rb->count == 0) /* unrequest */ | 1536 | if (rb->count == 0) /* unrequest */ |
1554 | goto out; | 1537 | goto out; |
1555 | gspca_dev->memory = rb->memory; | 1538 | ret = frame_alloc(gspca_dev, file, rb->memory, rb->count); |
1556 | ret = frame_alloc(gspca_dev, rb->count); | ||
1557 | if (ret == 0) { | 1539 | if (ret == 0) { |
1558 | rb->count = gspca_dev->nframes; | 1540 | rb->count = gspca_dev->nframes; |
1559 | gspca_dev->capt_file = file; | ||
1560 | if (streaming) | 1541 | if (streaming) |
1561 | ret = gspca_init_transfer(gspca_dev); | 1542 | ret = gspca_init_transfer(gspca_dev); |
1562 | } | 1543 | } |
@@ -1630,11 +1611,15 @@ static int vidioc_streamoff(struct file *file, void *priv, | |||
1630 | 1611 | ||
1631 | if (buf_type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 1612 | if (buf_type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
1632 | return -EINVAL; | 1613 | return -EINVAL; |
1633 | if (!gspca_dev->streaming) | 1614 | |
1634 | return 0; | ||
1635 | if (mutex_lock_interruptible(&gspca_dev->queue_lock)) | 1615 | if (mutex_lock_interruptible(&gspca_dev->queue_lock)) |
1636 | return -ERESTARTSYS; | 1616 | return -ERESTARTSYS; |
1637 | 1617 | ||
1618 | if (!gspca_dev->streaming) { | ||
1619 | ret = 0; | ||
1620 | goto out; | ||
1621 | } | ||
1622 | |||
1638 | /* check the capture file */ | 1623 | /* check the capture file */ |
1639 | if (gspca_dev->capt_file != file) { | 1624 | if (gspca_dev->capt_file != file) { |
1640 | ret = -EBUSY; | 1625 | ret = -EBUSY; |
@@ -1649,6 +1634,8 @@ static int vidioc_streamoff(struct file *file, void *priv, | |||
1649 | gspca_dev->usb_err = 0; | 1634 | gspca_dev->usb_err = 0; |
1650 | gspca_stream_off(gspca_dev); | 1635 | gspca_stream_off(gspca_dev); |
1651 | mutex_unlock(&gspca_dev->usb_lock); | 1636 | mutex_unlock(&gspca_dev->usb_lock); |
1637 | /* In case another thread is waiting in dqbuf */ | ||
1638 | wake_up_interruptible(&gspca_dev->wq); | ||
1652 | 1639 | ||
1653 | /* empty the transfer queues */ | 1640 | /* empty the transfer queues */ |
1654 | atomic_set(&gspca_dev->fr_q, 0); | 1641 | atomic_set(&gspca_dev->fr_q, 0); |
@@ -1827,33 +1814,77 @@ out: | |||
1827 | return ret; | 1814 | return ret; |
1828 | } | 1815 | } |
1829 | 1816 | ||
1817 | static int frame_ready_nolock(struct gspca_dev *gspca_dev, struct file *file, | ||
1818 | enum v4l2_memory memory) | ||
1819 | { | ||
1820 | if (!gspca_dev->present) | ||
1821 | return -ENODEV; | ||
1822 | if (gspca_dev->capt_file != file || gspca_dev->memory != memory || | ||
1823 | !gspca_dev->streaming) | ||
1824 | return -EINVAL; | ||
1825 | |||
1826 | /* check if a frame is ready */ | ||
1827 | return gspca_dev->fr_o != atomic_read(&gspca_dev->fr_i); | ||
1828 | } | ||
1829 | |||
1830 | static int frame_ready(struct gspca_dev *gspca_dev, struct file *file, | ||
1831 | enum v4l2_memory memory) | ||
1832 | { | ||
1833 | int ret; | ||
1834 | |||
1835 | if (mutex_lock_interruptible(&gspca_dev->queue_lock)) | ||
1836 | return -ERESTARTSYS; | ||
1837 | ret = frame_ready_nolock(gspca_dev, file, memory); | ||
1838 | mutex_unlock(&gspca_dev->queue_lock); | ||
1839 | return ret; | ||
1840 | } | ||
1841 | |||
1830 | /* | 1842 | /* |
1831 | * wait for a video frame | 1843 | * dequeue a video buffer |
1832 | * | 1844 | * |
1833 | * If a frame is ready, its index is returned. | 1845 | * If nonblock_ing is false, block until a buffer is available. |
1834 | */ | 1846 | */ |
1835 | static int frame_wait(struct gspca_dev *gspca_dev, | 1847 | static int vidioc_dqbuf(struct file *file, void *priv, |
1836 | int nonblock_ing) | 1848 | struct v4l2_buffer *v4l2_buf) |
1837 | { | 1849 | { |
1838 | int i, ret; | 1850 | struct gspca_dev *gspca_dev = priv; |
1851 | struct gspca_frame *frame; | ||
1852 | int i, j, ret; | ||
1839 | 1853 | ||
1840 | /* check if a frame is ready */ | 1854 | PDEBUG(D_FRAM, "dqbuf"); |
1841 | i = gspca_dev->fr_o; | 1855 | |
1842 | if (i == atomic_read(&gspca_dev->fr_i)) { | 1856 | if (mutex_lock_interruptible(&gspca_dev->queue_lock)) |
1843 | if (nonblock_ing) | 1857 | return -ERESTARTSYS; |
1858 | |||
1859 | for (;;) { | ||
1860 | ret = frame_ready_nolock(gspca_dev, file, v4l2_buf->memory); | ||
1861 | if (ret < 0) | ||
1862 | goto out; | ||
1863 | if (ret > 0) | ||
1864 | break; | ||
1865 | |||
1866 | mutex_unlock(&gspca_dev->queue_lock); | ||
1867 | |||
1868 | if (file->f_flags & O_NONBLOCK) | ||
1844 | return -EAGAIN; | 1869 | return -EAGAIN; |
1845 | 1870 | ||
1846 | /* wait till a frame is ready */ | 1871 | /* wait till a frame is ready */ |
1847 | ret = wait_event_interruptible_timeout(gspca_dev->wq, | 1872 | ret = wait_event_interruptible_timeout(gspca_dev->wq, |
1848 | i != atomic_read(&gspca_dev->fr_i) || | 1873 | frame_ready(gspca_dev, file, v4l2_buf->memory), |
1849 | !gspca_dev->streaming || !gspca_dev->present, | ||
1850 | msecs_to_jiffies(3000)); | 1874 | msecs_to_jiffies(3000)); |
1851 | if (ret < 0) | 1875 | if (ret < 0) |
1852 | return ret; | 1876 | return ret; |
1853 | if (ret == 0 || !gspca_dev->streaming || !gspca_dev->present) | 1877 | if (ret == 0) |
1854 | return -EIO; | 1878 | return -EIO; |
1879 | |||
1880 | if (mutex_lock_interruptible(&gspca_dev->queue_lock)) | ||
1881 | return -ERESTARTSYS; | ||
1855 | } | 1882 | } |
1856 | 1883 | ||
1884 | i = gspca_dev->fr_o; | ||
1885 | j = gspca_dev->fr_queue[i]; | ||
1886 | frame = &gspca_dev->frame[j]; | ||
1887 | |||
1857 | gspca_dev->fr_o = (i + 1) % GSPCA_MAX_FRAMES; | 1888 | gspca_dev->fr_o = (i + 1) % GSPCA_MAX_FRAMES; |
1858 | 1889 | ||
1859 | if (gspca_dev->sd_desc->dq_callback) { | 1890 | if (gspca_dev->sd_desc->dq_callback) { |
@@ -1863,46 +1894,12 @@ static int frame_wait(struct gspca_dev *gspca_dev, | |||
1863 | gspca_dev->sd_desc->dq_callback(gspca_dev); | 1894 | gspca_dev->sd_desc->dq_callback(gspca_dev); |
1864 | mutex_unlock(&gspca_dev->usb_lock); | 1895 | mutex_unlock(&gspca_dev->usb_lock); |
1865 | } | 1896 | } |
1866 | return gspca_dev->fr_queue[i]; | ||
1867 | } | ||
1868 | |||
1869 | /* | ||
1870 | * dequeue a video buffer | ||
1871 | * | ||
1872 | * If nonblock_ing is false, block until a buffer is available. | ||
1873 | */ | ||
1874 | static int vidioc_dqbuf(struct file *file, void *priv, | ||
1875 | struct v4l2_buffer *v4l2_buf) | ||
1876 | { | ||
1877 | struct gspca_dev *gspca_dev = priv; | ||
1878 | struct gspca_frame *frame; | ||
1879 | int i, ret; | ||
1880 | |||
1881 | PDEBUG(D_FRAM, "dqbuf"); | ||
1882 | if (v4l2_buf->memory != gspca_dev->memory) | ||
1883 | return -EINVAL; | ||
1884 | |||
1885 | if (!gspca_dev->present) | ||
1886 | return -ENODEV; | ||
1887 | |||
1888 | /* if not streaming, be sure the application will not loop forever */ | ||
1889 | if (!(file->f_flags & O_NONBLOCK) | ||
1890 | && !gspca_dev->streaming && gspca_dev->users == 1) | ||
1891 | return -EINVAL; | ||
1892 | 1897 | ||
1893 | /* only the capturing file may dequeue */ | 1898 | frame->v4l2_buf.flags &= ~V4L2_BUF_FLAG_DONE; |
1894 | if (gspca_dev->capt_file != file) | 1899 | memcpy(v4l2_buf, &frame->v4l2_buf, sizeof *v4l2_buf); |
1895 | return -EINVAL; | 1900 | PDEBUG(D_FRAM, "dqbuf %d", j); |
1896 | 1901 | ret = 0; | |
1897 | /* only one dequeue / read at a time */ | ||
1898 | if (mutex_lock_interruptible(&gspca_dev->read_lock)) | ||
1899 | return -ERESTARTSYS; | ||
1900 | 1902 | ||
1901 | ret = frame_wait(gspca_dev, file->f_flags & O_NONBLOCK); | ||
1902 | if (ret < 0) | ||
1903 | goto out; | ||
1904 | i = ret; /* frame index */ | ||
1905 | frame = &gspca_dev->frame[i]; | ||
1906 | if (gspca_dev->memory == V4L2_MEMORY_USERPTR) { | 1903 | if (gspca_dev->memory == V4L2_MEMORY_USERPTR) { |
1907 | if (copy_to_user((__u8 __user *) frame->v4l2_buf.m.userptr, | 1904 | if (copy_to_user((__u8 __user *) frame->v4l2_buf.m.userptr, |
1908 | frame->data, | 1905 | frame->data, |
@@ -1910,15 +1907,10 @@ static int vidioc_dqbuf(struct file *file, void *priv, | |||
1910 | PDEBUG(D_ERR|D_STREAM, | 1907 | PDEBUG(D_ERR|D_STREAM, |
1911 | "dqbuf cp to user failed"); | 1908 | "dqbuf cp to user failed"); |
1912 | ret = -EFAULT; | 1909 | ret = -EFAULT; |
1913 | goto out; | ||
1914 | } | 1910 | } |
1915 | } | 1911 | } |
1916 | frame->v4l2_buf.flags &= ~V4L2_BUF_FLAG_DONE; | ||
1917 | memcpy(v4l2_buf, &frame->v4l2_buf, sizeof *v4l2_buf); | ||
1918 | PDEBUG(D_FRAM, "dqbuf %d", i); | ||
1919 | ret = 0; | ||
1920 | out: | 1912 | out: |
1921 | mutex_unlock(&gspca_dev->read_lock); | 1913 | mutex_unlock(&gspca_dev->queue_lock); |
1922 | return ret; | 1914 | return ret; |
1923 | } | 1915 | } |
1924 | 1916 | ||
@@ -2033,9 +2025,7 @@ static unsigned int dev_poll(struct file *file, poll_table *wait) | |||
2033 | poll_wait(file, &gspca_dev->wq, wait); | 2025 | poll_wait(file, &gspca_dev->wq, wait); |
2034 | 2026 | ||
2035 | /* if reqbufs is not done, the user would use read() */ | 2027 | /* if reqbufs is not done, the user would use read() */ |
2036 | if (gspca_dev->nframes == 0) { | 2028 | if (gspca_dev->memory == GSPCA_MEMORY_NO) { |
2037 | if (gspca_dev->memory != GSPCA_MEMORY_NO) | ||
2038 | return POLLERR; /* not the 1st time */ | ||
2039 | ret = read_alloc(gspca_dev, file); | 2029 | ret = read_alloc(gspca_dev, file); |
2040 | if (ret != 0) | 2030 | if (ret != 0) |
2041 | return POLLERR; | 2031 | return POLLERR; |
@@ -2067,18 +2057,10 @@ static ssize_t dev_read(struct file *file, char __user *data, | |||
2067 | PDEBUG(D_FRAM, "read (%zd)", count); | 2057 | PDEBUG(D_FRAM, "read (%zd)", count); |
2068 | if (!gspca_dev->present) | 2058 | if (!gspca_dev->present) |
2069 | return -ENODEV; | 2059 | return -ENODEV; |
2070 | switch (gspca_dev->memory) { | 2060 | if (gspca_dev->memory == GSPCA_MEMORY_NO) { /* first time ? */ |
2071 | case GSPCA_MEMORY_NO: /* first time */ | ||
2072 | ret = read_alloc(gspca_dev, file); | 2061 | ret = read_alloc(gspca_dev, file); |
2073 | if (ret != 0) | 2062 | if (ret != 0) |
2074 | return ret; | 2063 | return ret; |
2075 | break; | ||
2076 | case GSPCA_MEMORY_READ: | ||
2077 | if (gspca_dev->capt_file == file) | ||
2078 | break; | ||
2079 | /* fall thru */ | ||
2080 | default: | ||
2081 | return -EINVAL; | ||
2082 | } | 2064 | } |
2083 | 2065 | ||
2084 | /* get a frame */ | 2066 | /* get a frame */ |
@@ -2266,7 +2248,6 @@ int gspca_dev_probe2(struct usb_interface *intf, | |||
2266 | goto out; | 2248 | goto out; |
2267 | 2249 | ||
2268 | mutex_init(&gspca_dev->usb_lock); | 2250 | mutex_init(&gspca_dev->usb_lock); |
2269 | mutex_init(&gspca_dev->read_lock); | ||
2270 | mutex_init(&gspca_dev->queue_lock); | 2251 | mutex_init(&gspca_dev->queue_lock); |
2271 | init_waitqueue_head(&gspca_dev->wq); | 2252 | init_waitqueue_head(&gspca_dev->wq); |
2272 | 2253 | ||
@@ -2341,12 +2322,11 @@ void gspca_disconnect(struct usb_interface *intf) | |||
2341 | PDEBUG(D_PROBE, "%s disconnect", | 2322 | PDEBUG(D_PROBE, "%s disconnect", |
2342 | video_device_node_name(&gspca_dev->vdev)); | 2323 | video_device_node_name(&gspca_dev->vdev)); |
2343 | mutex_lock(&gspca_dev->usb_lock); | 2324 | mutex_lock(&gspca_dev->usb_lock); |
2325 | |||
2344 | gspca_dev->present = 0; | 2326 | gspca_dev->present = 0; |
2327 | wake_up_interruptible(&gspca_dev->wq); | ||
2345 | 2328 | ||
2346 | if (gspca_dev->streaming) { | 2329 | destroy_urbs(gspca_dev); |
2347 | destroy_urbs(gspca_dev); | ||
2348 | wake_up_interruptible(&gspca_dev->wq); | ||
2349 | } | ||
2350 | 2330 | ||
2351 | #if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE) | 2331 | #if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE) |
2352 | gspca_input_destroy_urb(gspca_dev); | 2332 | gspca_input_destroy_urb(gspca_dev); |
diff --git a/drivers/media/video/gspca/gspca.h b/drivers/media/video/gspca/gspca.h index 97b77a26a2eb..41755226d389 100644 --- a/drivers/media/video/gspca/gspca.h +++ b/drivers/media/video/gspca/gspca.h | |||
@@ -205,14 +205,12 @@ struct gspca_dev { | |||
205 | 205 | ||
206 | wait_queue_head_t wq; /* wait queue */ | 206 | wait_queue_head_t wq; /* wait queue */ |
207 | struct mutex usb_lock; /* usb exchange protection */ | 207 | struct mutex usb_lock; /* usb exchange protection */ |
208 | struct mutex read_lock; /* read protection */ | ||
209 | struct mutex queue_lock; /* ISOC queue protection */ | 208 | struct mutex queue_lock; /* ISOC queue protection */ |
210 | int usb_err; /* USB error - protected by usb_lock */ | 209 | int usb_err; /* USB error - protected by usb_lock */ |
211 | u16 pkt_size; /* ISOC packet size */ | 210 | u16 pkt_size; /* ISOC packet size */ |
212 | #ifdef CONFIG_PM | 211 | #ifdef CONFIG_PM |
213 | char frozen; /* suspend - resume */ | 212 | char frozen; /* suspend - resume */ |
214 | #endif | 213 | #endif |
215 | char users; /* number of opens */ | ||
216 | char present; /* device connected */ | 214 | char present; /* device connected */ |
217 | char nbufread; /* number of buffers for read() */ | 215 | char nbufread; /* number of buffers for read() */ |
218 | char memory; /* memory type (V4L2_MEMORY_xxx) */ | 216 | char memory; /* memory type (V4L2_MEMORY_xxx) */ |
diff --git a/drivers/media/video/gspca/jeilinj.c b/drivers/media/video/gspca/jeilinj.c index a35e87bb0388..06b777f5379e 100644 --- a/drivers/media/video/gspca/jeilinj.c +++ b/drivers/media/video/gspca/jeilinj.c | |||
@@ -314,7 +314,7 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
314 | } | 314 | } |
315 | 315 | ||
316 | /* Table of supported USB devices */ | 316 | /* Table of supported USB devices */ |
317 | static const __devinitdata struct usb_device_id device_table[] = { | 317 | static const struct usb_device_id device_table[] = { |
318 | {USB_DEVICE(0x0979, 0x0280)}, | 318 | {USB_DEVICE(0x0979, 0x0280)}, |
319 | {} | 319 | {} |
320 | }; | 320 | }; |
diff --git a/drivers/media/video/gspca/jpeg.h b/drivers/media/video/gspca/jpeg.h index de63c36806c0..ab54910418b4 100644 --- a/drivers/media/video/gspca/jpeg.h +++ b/drivers/media/video/gspca/jpeg.h | |||
@@ -141,9 +141,9 @@ static void jpeg_define(u8 *jpeg_hdr, | |||
141 | memcpy(jpeg_hdr, jpeg_head, sizeof jpeg_head); | 141 | memcpy(jpeg_hdr, jpeg_head, sizeof jpeg_head); |
142 | #ifndef CONEX_CAM | 142 | #ifndef CONEX_CAM |
143 | jpeg_hdr[JPEG_HEIGHT_OFFSET + 0] = height >> 8; | 143 | jpeg_hdr[JPEG_HEIGHT_OFFSET + 0] = height >> 8; |
144 | jpeg_hdr[JPEG_HEIGHT_OFFSET + 1] = height & 0xff; | 144 | jpeg_hdr[JPEG_HEIGHT_OFFSET + 1] = height; |
145 | jpeg_hdr[JPEG_HEIGHT_OFFSET + 2] = width >> 8; | 145 | jpeg_hdr[JPEG_HEIGHT_OFFSET + 2] = width >> 8; |
146 | jpeg_hdr[JPEG_HEIGHT_OFFSET + 3] = width & 0xff; | 146 | jpeg_hdr[JPEG_HEIGHT_OFFSET + 3] = width; |
147 | jpeg_hdr[JPEG_HEIGHT_OFFSET + 6] = samplesY; | 147 | jpeg_hdr[JPEG_HEIGHT_OFFSET + 6] = samplesY; |
148 | #endif | 148 | #endif |
149 | } | 149 | } |
diff --git a/drivers/media/video/gspca/konica.c b/drivers/media/video/gspca/konica.c index d2ce65dcbfdc..5964691c0e95 100644 --- a/drivers/media/video/gspca/konica.c +++ b/drivers/media/video/gspca/konica.c | |||
@@ -607,7 +607,7 @@ static const struct sd_desc sd_desc = { | |||
607 | }; | 607 | }; |
608 | 608 | ||
609 | /* -- module initialisation -- */ | 609 | /* -- module initialisation -- */ |
610 | static const __devinitdata struct usb_device_id device_table[] = { | 610 | static const struct usb_device_id device_table[] = { |
611 | {USB_DEVICE(0x04c8, 0x0720)}, /* Intel YC 76 */ | 611 | {USB_DEVICE(0x04c8, 0x0720)}, /* Intel YC 76 */ |
612 | {} | 612 | {} |
613 | }; | 613 | }; |
diff --git a/drivers/media/video/gspca/m5602/m5602_core.c b/drivers/media/video/gspca/m5602/m5602_core.c index c872b93a3351..a7722b1aef9b 100644 --- a/drivers/media/video/gspca/m5602/m5602_core.c +++ b/drivers/media/video/gspca/m5602/m5602_core.c | |||
@@ -28,7 +28,7 @@ int force_sensor; | |||
28 | static int dump_bridge; | 28 | static int dump_bridge; |
29 | int dump_sensor; | 29 | int dump_sensor; |
30 | 30 | ||
31 | static const __devinitdata struct usb_device_id m5602_table[] = { | 31 | static const struct usb_device_id m5602_table[] = { |
32 | {USB_DEVICE(0x0402, 0x5602)}, | 32 | {USB_DEVICE(0x0402, 0x5602)}, |
33 | {} | 33 | {} |
34 | }; | 34 | }; |
diff --git a/drivers/media/video/gspca/mars.c b/drivers/media/video/gspca/mars.c index a81536e78698..cb4d0bf0d784 100644 --- a/drivers/media/video/gspca/mars.c +++ b/drivers/media/video/gspca/mars.c | |||
@@ -490,7 +490,7 @@ static const struct sd_desc sd_desc = { | |||
490 | }; | 490 | }; |
491 | 491 | ||
492 | /* -- module initialisation -- */ | 492 | /* -- module initialisation -- */ |
493 | static const __devinitdata struct usb_device_id device_table[] = { | 493 | static const struct usb_device_id device_table[] = { |
494 | {USB_DEVICE(0x093a, 0x050f)}, | 494 | {USB_DEVICE(0x093a, 0x050f)}, |
495 | {} | 495 | {} |
496 | }; | 496 | }; |
diff --git a/drivers/media/video/gspca/mr97310a.c b/drivers/media/video/gspca/mr97310a.c index 7607a288b51c..3884c9d300c5 100644 --- a/drivers/media/video/gspca/mr97310a.c +++ b/drivers/media/video/gspca/mr97310a.c | |||
@@ -1229,7 +1229,7 @@ static const struct sd_desc sd_desc = { | |||
1229 | }; | 1229 | }; |
1230 | 1230 | ||
1231 | /* -- module initialisation -- */ | 1231 | /* -- module initialisation -- */ |
1232 | static const __devinitdata struct usb_device_id device_table[] = { | 1232 | static const struct usb_device_id device_table[] = { |
1233 | {USB_DEVICE(0x08ca, 0x0110)}, /* Trust Spyc@m 100 */ | 1233 | {USB_DEVICE(0x08ca, 0x0110)}, /* Trust Spyc@m 100 */ |
1234 | {USB_DEVICE(0x08ca, 0x0111)}, /* Aiptek Pencam VGA+ */ | 1234 | {USB_DEVICE(0x08ca, 0x0111)}, /* Aiptek Pencam VGA+ */ |
1235 | {USB_DEVICE(0x093a, 0x010f)}, /* All other known MR97310A VGA cams */ | 1235 | {USB_DEVICE(0x093a, 0x010f)}, /* All other known MR97310A VGA cams */ |
diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c index e1c3b9328ace..8ab2c452c25e 100644 --- a/drivers/media/video/gspca/ov519.c +++ b/drivers/media/video/gspca/ov519.c | |||
@@ -488,7 +488,6 @@ static const struct v4l2_pix_format ovfx2_ov3610_mode[] = { | |||
488 | #define R511_SNAP_PXDIV 0x1c | 488 | #define R511_SNAP_PXDIV 0x1c |
489 | #define R511_SNAP_LNDIV 0x1d | 489 | #define R511_SNAP_LNDIV 0x1d |
490 | #define R511_SNAP_UV_EN 0x1e | 490 | #define R511_SNAP_UV_EN 0x1e |
491 | #define R511_SNAP_UV_EN 0x1e | ||
492 | #define R511_SNAP_OPTS 0x1f | 491 | #define R511_SNAP_OPTS 0x1f |
493 | 492 | ||
494 | #define R511_DRAM_FLOW_CTL 0x20 | 493 | #define R511_DRAM_FLOW_CTL 0x20 |
@@ -1847,8 +1846,7 @@ static const struct ov_i2c_regvals norm_7670[] = { | |||
1847 | { 0x6c, 0x0a }, | 1846 | { 0x6c, 0x0a }, |
1848 | { 0x6d, 0x55 }, | 1847 | { 0x6d, 0x55 }, |
1849 | { 0x6e, 0x11 }, | 1848 | { 0x6e, 0x11 }, |
1850 | { 0x6f, 0x9f }, | 1849 | { 0x6f, 0x9f }, /* "9e for advance AWB" */ |
1851 | /* "9e for advance AWB" */ | ||
1852 | { 0x6a, 0x40 }, | 1850 | { 0x6a, 0x40 }, |
1853 | { OV7670_R01_BLUE, 0x40 }, | 1851 | { OV7670_R01_BLUE, 0x40 }, |
1854 | { OV7670_R02_RED, 0x60 }, | 1852 | { OV7670_R02_RED, 0x60 }, |
@@ -3054,7 +3052,7 @@ static void ov519_configure(struct sd *sd) | |||
3054 | { | 3052 | { |
3055 | static const struct ov_regvals init_519[] = { | 3053 | static const struct ov_regvals init_519[] = { |
3056 | { 0x5a, 0x6d }, /* EnableSystem */ | 3054 | { 0x5a, 0x6d }, /* EnableSystem */ |
3057 | { 0x53, 0x9b }, | 3055 | { 0x53, 0x9b }, /* don't enable the microcontroller */ |
3058 | { OV519_R54_EN_CLK1, 0xff }, /* set bit2 to enable jpeg */ | 3056 | { OV519_R54_EN_CLK1, 0xff }, /* set bit2 to enable jpeg */ |
3059 | { 0x5d, 0x03 }, | 3057 | { 0x5d, 0x03 }, |
3060 | { 0x49, 0x01 }, | 3058 | { 0x49, 0x01 }, |
@@ -4747,7 +4745,7 @@ static const struct sd_desc sd_desc = { | |||
4747 | }; | 4745 | }; |
4748 | 4746 | ||
4749 | /* -- module initialisation -- */ | 4747 | /* -- module initialisation -- */ |
4750 | static const __devinitdata struct usb_device_id device_table[] = { | 4748 | static const struct usb_device_id device_table[] = { |
4751 | {USB_DEVICE(0x041e, 0x4003), .driver_info = BRIDGE_W9968CF }, | 4749 | {USB_DEVICE(0x041e, 0x4003), .driver_info = BRIDGE_W9968CF }, |
4752 | {USB_DEVICE(0x041e, 0x4052), .driver_info = BRIDGE_OV519 }, | 4750 | {USB_DEVICE(0x041e, 0x4052), .driver_info = BRIDGE_OV519 }, |
4753 | {USB_DEVICE(0x041e, 0x405f), .driver_info = BRIDGE_OV519 }, | 4751 | {USB_DEVICE(0x041e, 0x405f), .driver_info = BRIDGE_OV519 }, |
diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c index 0edf93973b1c..04da22802736 100644 --- a/drivers/media/video/gspca/ov534.c +++ b/drivers/media/video/gspca/ov534.c | |||
@@ -479,15 +479,20 @@ static void ov534_reg_write(struct gspca_dev *gspca_dev, u16 reg, u8 val) | |||
479 | struct usb_device *udev = gspca_dev->dev; | 479 | struct usb_device *udev = gspca_dev->dev; |
480 | int ret; | 480 | int ret; |
481 | 481 | ||
482 | PDEBUG(D_USBO, "reg=0x%04x, val=0%02x", reg, val); | 482 | if (gspca_dev->usb_err < 0) |
483 | return; | ||
484 | |||
485 | PDEBUG(D_USBO, "SET 01 0000 %04x %02x", reg, val); | ||
483 | gspca_dev->usb_buf[0] = val; | 486 | gspca_dev->usb_buf[0] = val; |
484 | ret = usb_control_msg(udev, | 487 | ret = usb_control_msg(udev, |
485 | usb_sndctrlpipe(udev, 0), | 488 | usb_sndctrlpipe(udev, 0), |
486 | 0x01, | 489 | 0x01, |
487 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 490 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
488 | 0x00, reg, gspca_dev->usb_buf, 1, CTRL_TIMEOUT); | 491 | 0x00, reg, gspca_dev->usb_buf, 1, CTRL_TIMEOUT); |
489 | if (ret < 0) | 492 | if (ret < 0) { |
490 | err("write failed %d", ret); | 493 | err("write failed %d", ret); |
494 | gspca_dev->usb_err = ret; | ||
495 | } | ||
491 | } | 496 | } |
492 | 497 | ||
493 | static u8 ov534_reg_read(struct gspca_dev *gspca_dev, u16 reg) | 498 | static u8 ov534_reg_read(struct gspca_dev *gspca_dev, u16 reg) |
@@ -495,14 +500,18 @@ static u8 ov534_reg_read(struct gspca_dev *gspca_dev, u16 reg) | |||
495 | struct usb_device *udev = gspca_dev->dev; | 500 | struct usb_device *udev = gspca_dev->dev; |
496 | int ret; | 501 | int ret; |
497 | 502 | ||
503 | if (gspca_dev->usb_err < 0) | ||
504 | return 0; | ||
498 | ret = usb_control_msg(udev, | 505 | ret = usb_control_msg(udev, |
499 | usb_rcvctrlpipe(udev, 0), | 506 | usb_rcvctrlpipe(udev, 0), |
500 | 0x01, | 507 | 0x01, |
501 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 508 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
502 | 0x00, reg, gspca_dev->usb_buf, 1, CTRL_TIMEOUT); | 509 | 0x00, reg, gspca_dev->usb_buf, 1, CTRL_TIMEOUT); |
503 | PDEBUG(D_USBI, "reg=0x%04x, data=0x%02x", reg, gspca_dev->usb_buf[0]); | 510 | PDEBUG(D_USBI, "GET 01 0000 %04x %02x", reg, gspca_dev->usb_buf[0]); |
504 | if (ret < 0) | 511 | if (ret < 0) { |
505 | err("read failed %d", ret); | 512 | err("read failed %d", ret); |
513 | gspca_dev->usb_err = ret; | ||
514 | } | ||
506 | return gspca_dev->usb_buf[0]; | 515 | return gspca_dev->usb_buf[0]; |
507 | } | 516 | } |
508 | 517 | ||
@@ -558,13 +567,15 @@ static int sccb_check_status(struct gspca_dev *gspca_dev) | |||
558 | 567 | ||
559 | static void sccb_reg_write(struct gspca_dev *gspca_dev, u8 reg, u8 val) | 568 | static void sccb_reg_write(struct gspca_dev *gspca_dev, u8 reg, u8 val) |
560 | { | 569 | { |
561 | PDEBUG(D_USBO, "reg: 0x%02x, val: 0x%02x", reg, val); | 570 | PDEBUG(D_USBO, "sccb write: %02x %02x", reg, val); |
562 | ov534_reg_write(gspca_dev, OV534_REG_SUBADDR, reg); | 571 | ov534_reg_write(gspca_dev, OV534_REG_SUBADDR, reg); |
563 | ov534_reg_write(gspca_dev, OV534_REG_WRITE, val); | 572 | ov534_reg_write(gspca_dev, OV534_REG_WRITE, val); |
564 | ov534_reg_write(gspca_dev, OV534_REG_OPERATION, OV534_OP_WRITE_3); | 573 | ov534_reg_write(gspca_dev, OV534_REG_OPERATION, OV534_OP_WRITE_3); |
565 | 574 | ||
566 | if (!sccb_check_status(gspca_dev)) | 575 | if (!sccb_check_status(gspca_dev)) { |
567 | err("sccb_reg_write failed"); | 576 | err("sccb_reg_write failed"); |
577 | gspca_dev->usb_err = -EIO; | ||
578 | } | ||
568 | } | 579 | } |
569 | 580 | ||
570 | static u8 sccb_reg_read(struct gspca_dev *gspca_dev, u16 reg) | 581 | static u8 sccb_reg_read(struct gspca_dev *gspca_dev, u16 reg) |
@@ -885,7 +896,7 @@ static int sd_init(struct gspca_dev *gspca_dev) | |||
885 | ov534_set_led(gspca_dev, 0); | 896 | ov534_set_led(gspca_dev, 0); |
886 | set_frame_rate(gspca_dev); | 897 | set_frame_rate(gspca_dev); |
887 | 898 | ||
888 | return 0; | 899 | return gspca_dev->usb_err; |
889 | } | 900 | } |
890 | 901 | ||
891 | static int sd_start(struct gspca_dev *gspca_dev) | 902 | static int sd_start(struct gspca_dev *gspca_dev) |
@@ -920,7 +931,7 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
920 | 931 | ||
921 | ov534_set_led(gspca_dev, 1); | 932 | ov534_set_led(gspca_dev, 1); |
922 | ov534_reg_write(gspca_dev, 0xe0, 0x00); | 933 | ov534_reg_write(gspca_dev, 0xe0, 0x00); |
923 | return 0; | 934 | return gspca_dev->usb_err; |
924 | } | 935 | } |
925 | 936 | ||
926 | static void sd_stopN(struct gspca_dev *gspca_dev) | 937 | static void sd_stopN(struct gspca_dev *gspca_dev) |
@@ -1289,7 +1300,7 @@ static const struct sd_desc sd_desc = { | |||
1289 | }; | 1300 | }; |
1290 | 1301 | ||
1291 | /* -- module initialisation -- */ | 1302 | /* -- module initialisation -- */ |
1292 | static const __devinitdata struct usb_device_id device_table[] = { | 1303 | static const struct usb_device_id device_table[] = { |
1293 | {USB_DEVICE(0x1415, 0x2000)}, | 1304 | {USB_DEVICE(0x1415, 0x2000)}, |
1294 | {} | 1305 | {} |
1295 | }; | 1306 | }; |
diff --git a/drivers/media/video/gspca/ov534_9.c b/drivers/media/video/gspca/ov534_9.c index c5244b4b4777..aaf5428c57f5 100644 --- a/drivers/media/video/gspca/ov534_9.c +++ b/drivers/media/video/gspca/ov534_9.c | |||
@@ -1429,7 +1429,7 @@ static const struct sd_desc sd_desc = { | |||
1429 | }; | 1429 | }; |
1430 | 1430 | ||
1431 | /* -- module initialisation -- */ | 1431 | /* -- module initialisation -- */ |
1432 | static const __devinitdata struct usb_device_id device_table[] = { | 1432 | static const struct usb_device_id device_table[] = { |
1433 | {USB_DEVICE(0x06f8, 0x3003)}, | 1433 | {USB_DEVICE(0x06f8, 0x3003)}, |
1434 | {} | 1434 | {} |
1435 | }; | 1435 | }; |
diff --git a/drivers/media/video/gspca/pac207.c b/drivers/media/video/gspca/pac207.c index 96f9986305b4..81739a2f205e 100644 --- a/drivers/media/video/gspca/pac207.c +++ b/drivers/media/video/gspca/pac207.c | |||
@@ -530,7 +530,7 @@ static const struct sd_desc sd_desc = { | |||
530 | }; | 530 | }; |
531 | 531 | ||
532 | /* -- module initialisation -- */ | 532 | /* -- module initialisation -- */ |
533 | static const __devinitdata struct usb_device_id device_table[] = { | 533 | static const struct usb_device_id device_table[] = { |
534 | {USB_DEVICE(0x041e, 0x4028)}, | 534 | {USB_DEVICE(0x041e, 0x4028)}, |
535 | {USB_DEVICE(0x093a, 0x2460)}, | 535 | {USB_DEVICE(0x093a, 0x2460)}, |
536 | {USB_DEVICE(0x093a, 0x2461)}, | 536 | {USB_DEVICE(0x093a, 0x2461)}, |
diff --git a/drivers/media/video/gspca/pac7302.c b/drivers/media/video/gspca/pac7302.c index 2700975abce5..5615d7bd8304 100644 --- a/drivers/media/video/gspca/pac7302.c +++ b/drivers/media/video/gspca/pac7302.c | |||
@@ -1184,7 +1184,7 @@ static const struct sd_desc sd_desc = { | |||
1184 | }; | 1184 | }; |
1185 | 1185 | ||
1186 | /* -- module initialisation -- */ | 1186 | /* -- module initialisation -- */ |
1187 | static const struct usb_device_id device_table[] __devinitconst = { | 1187 | static const struct usb_device_id device_table[] = { |
1188 | {USB_DEVICE(0x06f8, 0x3009)}, | 1188 | {USB_DEVICE(0x06f8, 0x3009)}, |
1189 | {USB_DEVICE(0x093a, 0x2620)}, | 1189 | {USB_DEVICE(0x093a, 0x2620)}, |
1190 | {USB_DEVICE(0x093a, 0x2621)}, | 1190 | {USB_DEVICE(0x093a, 0x2621)}, |
@@ -1201,7 +1201,7 @@ static const struct usb_device_id device_table[] __devinitconst = { | |||
1201 | MODULE_DEVICE_TABLE(usb, device_table); | 1201 | MODULE_DEVICE_TABLE(usb, device_table); |
1202 | 1202 | ||
1203 | /* -- device connect -- */ | 1203 | /* -- device connect -- */ |
1204 | static int __devinit sd_probe(struct usb_interface *intf, | 1204 | static int sd_probe(struct usb_interface *intf, |
1205 | const struct usb_device_id *id) | 1205 | const struct usb_device_id *id) |
1206 | { | 1206 | { |
1207 | return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), | 1207 | return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), |
diff --git a/drivers/media/video/gspca/pac7311.c b/drivers/media/video/gspca/pac7311.c index 6820f5d58b19..f8801b50e64f 100644 --- a/drivers/media/video/gspca/pac7311.c +++ b/drivers/media/video/gspca/pac7311.c | |||
@@ -837,7 +837,7 @@ static const struct sd_desc sd_desc = { | |||
837 | }; | 837 | }; |
838 | 838 | ||
839 | /* -- module initialisation -- */ | 839 | /* -- module initialisation -- */ |
840 | static const struct usb_device_id device_table[] __devinitconst = { | 840 | static const struct usb_device_id device_table[] = { |
841 | {USB_DEVICE(0x093a, 0x2600)}, | 841 | {USB_DEVICE(0x093a, 0x2600)}, |
842 | {USB_DEVICE(0x093a, 0x2601)}, | 842 | {USB_DEVICE(0x093a, 0x2601)}, |
843 | {USB_DEVICE(0x093a, 0x2603)}, | 843 | {USB_DEVICE(0x093a, 0x2603)}, |
@@ -849,7 +849,7 @@ static const struct usb_device_id device_table[] __devinitconst = { | |||
849 | MODULE_DEVICE_TABLE(usb, device_table); | 849 | MODULE_DEVICE_TABLE(usb, device_table); |
850 | 850 | ||
851 | /* -- device connect -- */ | 851 | /* -- device connect -- */ |
852 | static int __devinit sd_probe(struct usb_interface *intf, | 852 | static int sd_probe(struct usb_interface *intf, |
853 | const struct usb_device_id *id) | 853 | const struct usb_device_id *id) |
854 | { | 854 | { |
855 | return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), | 855 | return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), |
diff --git a/drivers/media/video/gspca/sn9c2028.c b/drivers/media/video/gspca/sn9c2028.c index 40a06680502d..4271f86dfe01 100644 --- a/drivers/media/video/gspca/sn9c2028.c +++ b/drivers/media/video/gspca/sn9c2028.c | |||
@@ -703,7 +703,7 @@ static const struct sd_desc sd_desc = { | |||
703 | }; | 703 | }; |
704 | 704 | ||
705 | /* -- module initialisation -- */ | 705 | /* -- module initialisation -- */ |
706 | static const __devinitdata struct usb_device_id device_table[] = { | 706 | static const struct usb_device_id device_table[] = { |
707 | {USB_DEVICE(0x0458, 0x7005)}, /* Genius Smart 300, version 2 */ | 707 | {USB_DEVICE(0x0458, 0x7005)}, /* Genius Smart 300, version 2 */ |
708 | /* The Genius Smart is untested. I can't find an owner ! */ | 708 | /* The Genius Smart is untested. I can't find an owner ! */ |
709 | /* {USB_DEVICE(0x0c45, 0x8000)}, DC31VC, Don't know this camera */ | 709 | /* {USB_DEVICE(0x0c45, 0x8000)}, DC31VC, Don't know this camera */ |
diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c index cb08d00d0a31..fcf29897b713 100644 --- a/drivers/media/video/gspca/sn9c20x.c +++ b/drivers/media/video/gspca/sn9c20x.c | |||
@@ -2470,7 +2470,7 @@ static const struct sd_desc sd_desc = { | |||
2470 | | (SENSOR_ ## sensor << 8) \ | 2470 | | (SENSOR_ ## sensor << 8) \ |
2471 | | (i2c_addr) | 2471 | | (i2c_addr) |
2472 | 2472 | ||
2473 | static const __devinitdata struct usb_device_id device_table[] = { | 2473 | static const struct usb_device_id device_table[] = { |
2474 | {USB_DEVICE(0x0c45, 0x6240), SN9C20X(MT9M001, 0x5d, 0)}, | 2474 | {USB_DEVICE(0x0c45, 0x6240), SN9C20X(MT9M001, 0x5d, 0)}, |
2475 | {USB_DEVICE(0x0c45, 0x6242), SN9C20X(MT9M111, 0x5d, 0)}, | 2475 | {USB_DEVICE(0x0c45, 0x6242), SN9C20X(MT9M111, 0x5d, 0)}, |
2476 | {USB_DEVICE(0x0c45, 0x6248), SN9C20X(OV9655, 0x30, 0)}, | 2476 | {USB_DEVICE(0x0c45, 0x6248), SN9C20X(OV9655, 0x30, 0)}, |
diff --git a/drivers/media/video/gspca/sonixb.c b/drivers/media/video/gspca/sonixb.c index 73504a3f87b7..c6cd68d66b53 100644 --- a/drivers/media/video/gspca/sonixb.c +++ b/drivers/media/video/gspca/sonixb.c | |||
@@ -23,8 +23,15 @@ | |||
23 | /* Some documentation on known sonixb registers: | 23 | /* Some documentation on known sonixb registers: |
24 | 24 | ||
25 | Reg Use | 25 | Reg Use |
26 | sn9c101 / sn9c102: | ||
26 | 0x10 high nibble red gain low nibble blue gain | 27 | 0x10 high nibble red gain low nibble blue gain |
27 | 0x11 low nibble green gain | 28 | 0x11 low nibble green gain |
29 | sn9c103: | ||
30 | 0x05 red gain 0-127 | ||
31 | 0x06 blue gain 0-127 | ||
32 | 0x07 green gain 0-127 | ||
33 | all: | ||
34 | 0x08-0x0f i2c / 3wire registers | ||
28 | 0x12 hstart | 35 | 0x12 hstart |
29 | 0x13 vstart | 36 | 0x13 vstart |
30 | 0x15 hsize (hsize = register-value * 16) | 37 | 0x15 hsize (hsize = register-value * 16) |
@@ -88,12 +95,9 @@ struct sd { | |||
88 | typedef const __u8 sensor_init_t[8]; | 95 | typedef const __u8 sensor_init_t[8]; |
89 | 96 | ||
90 | struct sensor_data { | 97 | struct sensor_data { |
91 | const __u8 *bridge_init[2]; | 98 | const __u8 *bridge_init; |
92 | int bridge_init_size[2]; | ||
93 | sensor_init_t *sensor_init; | 99 | sensor_init_t *sensor_init; |
94 | int sensor_init_size; | 100 | int sensor_init_size; |
95 | sensor_init_t *sensor_bridge_init[2]; | ||
96 | int sensor_bridge_init_size[2]; | ||
97 | int flags; | 101 | int flags; |
98 | unsigned ctrl_dis; | 102 | unsigned ctrl_dis; |
99 | __u8 sensor_addr; | 103 | __u8 sensor_addr; |
@@ -114,7 +118,6 @@ struct sensor_data { | |||
114 | #define NO_FREQ (1 << FREQ_IDX) | 118 | #define NO_FREQ (1 << FREQ_IDX) |
115 | #define NO_BRIGHTNESS (1 << BRIGHTNESS_IDX) | 119 | #define NO_BRIGHTNESS (1 << BRIGHTNESS_IDX) |
116 | 120 | ||
117 | #define COMP2 0x8f | ||
118 | #define COMP 0xc7 /* 0x87 //0x07 */ | 121 | #define COMP 0xc7 /* 0x87 //0x07 */ |
119 | #define COMP1 0xc9 /* 0x89 //0x09 */ | 122 | #define COMP1 0xc9 /* 0x89 //0x09 */ |
120 | 123 | ||
@@ -123,15 +126,11 @@ struct sensor_data { | |||
123 | 126 | ||
124 | #define SYS_CLK 0x04 | 127 | #define SYS_CLK 0x04 |
125 | 128 | ||
126 | #define SENS(bridge_1, bridge_3, sensor, sensor_1, \ | 129 | #define SENS(bridge, sensor, _flags, _ctrl_dis, _sensor_addr) \ |
127 | sensor_3, _flags, _ctrl_dis, _sensor_addr) \ | ||
128 | { \ | 130 | { \ |
129 | .bridge_init = { bridge_1, bridge_3 }, \ | 131 | .bridge_init = bridge, \ |
130 | .bridge_init_size = { sizeof(bridge_1), sizeof(bridge_3) }, \ | ||
131 | .sensor_init = sensor, \ | 132 | .sensor_init = sensor, \ |
132 | .sensor_init_size = sizeof(sensor), \ | 133 | .sensor_init_size = sizeof(sensor), \ |
133 | .sensor_bridge_init = { sensor_1, sensor_3,}, \ | ||
134 | .sensor_bridge_init_size = { sizeof(sensor_1), sizeof(sensor_3)}, \ | ||
135 | .flags = _flags, .ctrl_dis = _ctrl_dis, .sensor_addr = _sensor_addr \ | 134 | .flags = _flags, .ctrl_dis = _ctrl_dis, .sensor_addr = _sensor_addr \ |
136 | } | 135 | } |
137 | 136 | ||
@@ -311,7 +310,6 @@ static const __u8 initHv7131d[] = { | |||
311 | 0x00, 0x00, | 310 | 0x00, 0x00, |
312 | 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, | 311 | 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, |
313 | 0x28, 0x1e, 0x60, 0x8e, 0x42, | 312 | 0x28, 0x1e, 0x60, 0x8e, 0x42, |
314 | 0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c | ||
315 | }; | 313 | }; |
316 | static const __u8 hv7131d_sensor_init[][8] = { | 314 | static const __u8 hv7131d_sensor_init[][8] = { |
317 | {0xa0, 0x11, 0x01, 0x04, 0x00, 0x00, 0x00, 0x17}, | 315 | {0xa0, 0x11, 0x01, 0x04, 0x00, 0x00, 0x00, 0x17}, |
@@ -326,7 +324,6 @@ static const __u8 initHv7131r[] = { | |||
326 | 0x00, 0x00, | 324 | 0x00, 0x00, |
327 | 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, | 325 | 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, |
328 | 0x28, 0x1e, 0x60, 0x8a, 0x20, | 326 | 0x28, 0x1e, 0x60, 0x8a, 0x20, |
329 | 0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c | ||
330 | }; | 327 | }; |
331 | static const __u8 hv7131r_sensor_init[][8] = { | 328 | static const __u8 hv7131r_sensor_init[][8] = { |
332 | {0xc0, 0x11, 0x31, 0x38, 0x2a, 0x2e, 0x00, 0x10}, | 329 | {0xc0, 0x11, 0x31, 0x38, 0x2a, 0x2e, 0x00, 0x10}, |
@@ -339,7 +336,7 @@ static const __u8 initOv6650[] = { | |||
339 | 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, | 336 | 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, |
340 | 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 337 | 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
341 | 0x00, 0x01, 0x01, 0x0a, 0x16, 0x12, 0x68, 0x8b, | 338 | 0x00, 0x01, 0x01, 0x0a, 0x16, 0x12, 0x68, 0x8b, |
342 | 0x10, 0x1d, 0x10, 0x02, 0x02, 0x09, 0x07 | 339 | 0x10, |
343 | }; | 340 | }; |
344 | static const __u8 ov6650_sensor_init[][8] = { | 341 | static const __u8 ov6650_sensor_init[][8] = { |
345 | /* Bright, contrast, etc are set through SCBB interface. | 342 | /* Bright, contrast, etc are set through SCBB interface. |
@@ -378,24 +375,13 @@ static const __u8 initOv7630[] = { | |||
378 | 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* r09 .. r10 */ | 375 | 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* r09 .. r10 */ |
379 | 0x00, 0x01, 0x01, 0x0a, /* r11 .. r14 */ | 376 | 0x00, 0x01, 0x01, 0x0a, /* r11 .. r14 */ |
380 | 0x28, 0x1e, /* H & V sizes r15 .. r16 */ | 377 | 0x28, 0x1e, /* H & V sizes r15 .. r16 */ |
381 | 0x68, COMP2, MCK_INIT1, /* r17 .. r19 */ | ||
382 | 0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c /* r1a .. r1f */ | ||
383 | }; | ||
384 | static const __u8 initOv7630_3[] = { | ||
385 | 0x44, 0x44, 0x00, 0x1a, 0x20, 0x20, 0x20, 0x80, /* r01 .. r08 */ | ||
386 | 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* r09 .. r10 */ | ||
387 | 0x00, 0x02, 0x01, 0x0a, /* r11 .. r14 */ | ||
388 | 0x28, 0x1e, /* H & V sizes r15 .. r16 */ | ||
389 | 0x68, 0x8f, MCK_INIT1, /* r17 .. r19 */ | 378 | 0x68, 0x8f, MCK_INIT1, /* r17 .. r19 */ |
390 | 0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c, 0x00, /* r1a .. r20 */ | ||
391 | 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, /* r21 .. r28 */ | ||
392 | 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, 0xff /* r29 .. r30 */ | ||
393 | }; | 379 | }; |
394 | static const __u8 ov7630_sensor_init[][8] = { | 380 | static const __u8 ov7630_sensor_init[][8] = { |
395 | {0xa0, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, | 381 | {0xa0, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, |
396 | {0xb0, 0x21, 0x01, 0x77, 0x3a, 0x00, 0x00, 0x10}, | 382 | {0xb0, 0x21, 0x01, 0x77, 0x3a, 0x00, 0x00, 0x10}, |
397 | /* {0xd0, 0x21, 0x12, 0x7c, 0x01, 0x80, 0x34, 0x10}, jfm */ | 383 | /* {0xd0, 0x21, 0x12, 0x7c, 0x01, 0x80, 0x34, 0x10}, jfm */ |
398 | {0xd0, 0x21, 0x12, 0x1c, 0x00, 0x80, 0x34, 0x10}, /* jfm */ | 384 | {0xd0, 0x21, 0x12, 0x5c, 0x00, 0x80, 0x34, 0x10}, /* jfm */ |
399 | {0xa0, 0x21, 0x1b, 0x04, 0x00, 0x80, 0x34, 0x10}, | 385 | {0xa0, 0x21, 0x1b, 0x04, 0x00, 0x80, 0x34, 0x10}, |
400 | {0xa0, 0x21, 0x20, 0x44, 0x00, 0x80, 0x34, 0x10}, | 386 | {0xa0, 0x21, 0x20, 0x44, 0x00, 0x80, 0x34, 0x10}, |
401 | {0xa0, 0x21, 0x23, 0xee, 0x00, 0x80, 0x34, 0x10}, | 387 | {0xa0, 0x21, 0x23, 0xee, 0x00, 0x80, 0x34, 0x10}, |
@@ -413,16 +399,11 @@ static const __u8 ov7630_sensor_init[][8] = { | |||
413 | {0xd0, 0x21, 0x17, 0x1c, 0xbd, 0x06, 0xf6, 0x10}, | 399 | {0xd0, 0x21, 0x17, 0x1c, 0xbd, 0x06, 0xf6, 0x10}, |
414 | }; | 400 | }; |
415 | 401 | ||
416 | static const __u8 ov7630_sensor_init_3[][8] = { | ||
417 | {0xa0, 0x21, 0x13, 0x80, 0x00, 0x00, 0x00, 0x10}, | ||
418 | }; | ||
419 | |||
420 | static const __u8 initPas106[] = { | 402 | static const __u8 initPas106[] = { |
421 | 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x00, 0x00, | 403 | 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x00, 0x00, |
422 | 0x00, 0x00, | 404 | 0x00, 0x00, |
423 | 0x00, 0x00, 0x00, 0x04, 0x01, 0x00, | 405 | 0x00, 0x00, 0x00, 0x04, 0x01, 0x00, |
424 | 0x16, 0x12, 0x24, COMP1, MCK_INIT1, | 406 | 0x16, 0x12, 0x24, COMP1, MCK_INIT1, |
425 | 0x18, 0x10, 0x02, 0x02, 0x09, 0x07 | ||
426 | }; | 407 | }; |
427 | /* compression 0x86 mckinit1 0x2b */ | 408 | /* compression 0x86 mckinit1 0x2b */ |
428 | 409 | ||
@@ -496,7 +477,6 @@ static const __u8 initPas202[] = { | |||
496 | 0x00, 0x00, | 477 | 0x00, 0x00, |
497 | 0x00, 0x00, 0x00, 0x06, 0x03, 0x0a, | 478 | 0x00, 0x00, 0x00, 0x06, 0x03, 0x0a, |
498 | 0x28, 0x1e, 0x20, 0x89, 0x20, | 479 | 0x28, 0x1e, 0x20, 0x89, 0x20, |
499 | 0x00, 0x00, 0x02, 0x03, 0x0f, 0x0c | ||
500 | }; | 480 | }; |
501 | 481 | ||
502 | /* "Known" PAS202BCB registers: | 482 | /* "Known" PAS202BCB registers: |
@@ -537,7 +517,6 @@ static const __u8 initTas5110c[] = { | |||
537 | 0x00, 0x00, | 517 | 0x00, 0x00, |
538 | 0x00, 0x00, 0x00, 0x45, 0x09, 0x0a, | 518 | 0x00, 0x00, 0x00, 0x45, 0x09, 0x0a, |
539 | 0x16, 0x12, 0x60, 0x86, 0x2b, | 519 | 0x16, 0x12, 0x60, 0x86, 0x2b, |
540 | 0x14, 0x0a, 0x02, 0x02, 0x09, 0x07 | ||
541 | }; | 520 | }; |
542 | /* Same as above, except a different hstart */ | 521 | /* Same as above, except a different hstart */ |
543 | static const __u8 initTas5110d[] = { | 522 | static const __u8 initTas5110d[] = { |
@@ -545,12 +524,19 @@ static const __u8 initTas5110d[] = { | |||
545 | 0x00, 0x00, | 524 | 0x00, 0x00, |
546 | 0x00, 0x00, 0x00, 0x41, 0x09, 0x0a, | 525 | 0x00, 0x00, 0x00, 0x41, 0x09, 0x0a, |
547 | 0x16, 0x12, 0x60, 0x86, 0x2b, | 526 | 0x16, 0x12, 0x60, 0x86, 0x2b, |
548 | 0x14, 0x0a, 0x02, 0x02, 0x09, 0x07 | ||
549 | }; | 527 | }; |
550 | static const __u8 tas5110_sensor_init[][8] = { | 528 | /* tas5110c is 3 wire, tas5110d is 2 wire (regular i2c) */ |
529 | static const __u8 tas5110c_sensor_init[][8] = { | ||
551 | {0x30, 0x11, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10}, | 530 | {0x30, 0x11, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10}, |
552 | {0x30, 0x11, 0x02, 0x20, 0xa9, 0x00, 0x00, 0x10}, | 531 | {0x30, 0x11, 0x02, 0x20, 0xa9, 0x00, 0x00, 0x10}, |
553 | {0xa0, 0x61, 0x9a, 0xca, 0x00, 0x00, 0x00, 0x17}, | 532 | }; |
533 | /* Known TAS5110D registers | ||
534 | * reg02: gain, bit order reversed!! 0 == max gain, 255 == min gain | ||
535 | * reg03: bit3: vflip, bit4: ~hflip, bit7: ~gainboost (~ == inverted) | ||
536 | * Note: writing reg03 seems to only work when written together with 02 | ||
537 | */ | ||
538 | static const __u8 tas5110d_sensor_init[][8] = { | ||
539 | {0xa0, 0x61, 0x9a, 0xca, 0x00, 0x00, 0x00, 0x17}, /* reset */ | ||
554 | }; | 540 | }; |
555 | 541 | ||
556 | static const __u8 initTas5130[] = { | 542 | static const __u8 initTas5130[] = { |
@@ -558,7 +544,6 @@ static const __u8 initTas5130[] = { | |||
558 | 0x00, 0x00, | 544 | 0x00, 0x00, |
559 | 0x00, 0x00, 0x00, 0x68, 0x0c, 0x0a, | 545 | 0x00, 0x00, 0x00, 0x68, 0x0c, 0x0a, |
560 | 0x28, 0x1e, 0x60, COMP, MCK_INIT, | 546 | 0x28, 0x1e, 0x60, COMP, MCK_INIT, |
561 | 0x18, 0x10, 0x04, 0x03, 0x11, 0x0c | ||
562 | }; | 547 | }; |
563 | static const __u8 tas5130_sensor_init[][8] = { | 548 | static const __u8 tas5130_sensor_init[][8] = { |
564 | /* {0x30, 0x11, 0x00, 0x40, 0x47, 0x00, 0x00, 0x10}, | 549 | /* {0x30, 0x11, 0x00, 0x40, 0x47, 0x00, 0x00, 0x10}, |
@@ -569,21 +554,18 @@ static const __u8 tas5130_sensor_init[][8] = { | |||
569 | }; | 554 | }; |
570 | 555 | ||
571 | static struct sensor_data sensor_data[] = { | 556 | static struct sensor_data sensor_data[] = { |
572 | SENS(initHv7131d, NULL, hv7131d_sensor_init, NULL, NULL, F_GAIN, NO_BRIGHTNESS|NO_FREQ, 0), | 557 | SENS(initHv7131d, hv7131d_sensor_init, F_GAIN, NO_BRIGHTNESS|NO_FREQ, 0), |
573 | SENS(initHv7131r, NULL, hv7131r_sensor_init, NULL, NULL, 0, NO_BRIGHTNESS|NO_EXPO|NO_FREQ, 0), | 558 | SENS(initHv7131r, hv7131r_sensor_init, 0, NO_BRIGHTNESS|NO_EXPO|NO_FREQ, 0), |
574 | SENS(initOv6650, NULL, ov6650_sensor_init, NULL, NULL, F_GAIN|F_SIF, 0, 0x60), | 559 | SENS(initOv6650, ov6650_sensor_init, F_GAIN|F_SIF, 0, 0x60), |
575 | SENS(initOv7630, initOv7630_3, ov7630_sensor_init, NULL, ov7630_sensor_init_3, | 560 | SENS(initOv7630, ov7630_sensor_init, F_GAIN, 0, 0x21), |
576 | F_GAIN, 0, 0x21), | 561 | SENS(initPas106, pas106_sensor_init, F_GAIN|F_SIF, NO_FREQ, 0), |
577 | SENS(initPas106, NULL, pas106_sensor_init, NULL, NULL, F_GAIN|F_SIF, NO_FREQ, | 562 | SENS(initPas202, pas202_sensor_init, F_GAIN, NO_FREQ, 0), |
578 | 0), | 563 | SENS(initTas5110c, tas5110c_sensor_init, F_GAIN|F_SIF|F_COARSE_EXPO, |
579 | SENS(initPas202, initPas202, pas202_sensor_init, NULL, NULL, F_GAIN, | 564 | NO_BRIGHTNESS|NO_FREQ, 0), |
580 | NO_FREQ, 0), | 565 | SENS(initTas5110d, tas5110d_sensor_init, F_GAIN|F_SIF|F_COARSE_EXPO, |
581 | SENS(initTas5110c, NULL, tas5110_sensor_init, NULL, NULL, | 566 | NO_BRIGHTNESS|NO_FREQ, 0), |
582 | F_GAIN|F_SIF|F_COARSE_EXPO, NO_BRIGHTNESS|NO_FREQ, 0), | 567 | SENS(initTas5130, tas5130_sensor_init, F_GAIN, |
583 | SENS(initTas5110d, NULL, tas5110_sensor_init, NULL, NULL, | 568 | NO_BRIGHTNESS|NO_EXPO|NO_FREQ, 0), |
584 | F_GAIN|F_SIF|F_COARSE_EXPO, NO_BRIGHTNESS|NO_FREQ, 0), | ||
585 | SENS(initTas5130, NULL, tas5130_sensor_init, NULL, NULL, 0, NO_EXPO|NO_FREQ, | ||
586 | 0), | ||
587 | }; | 569 | }; |
588 | 570 | ||
589 | /* get one byte in gspca_dev->usb_buf */ | 571 | /* get one byte in gspca_dev->usb_buf */ |
@@ -655,7 +637,6 @@ static void i2c_w_vector(struct gspca_dev *gspca_dev, | |||
655 | static void setbrightness(struct gspca_dev *gspca_dev) | 637 | static void setbrightness(struct gspca_dev *gspca_dev) |
656 | { | 638 | { |
657 | struct sd *sd = (struct sd *) gspca_dev; | 639 | struct sd *sd = (struct sd *) gspca_dev; |
658 | __u8 value; | ||
659 | 640 | ||
660 | switch (sd->sensor) { | 641 | switch (sd->sensor) { |
661 | case SENSOR_OV6650: | 642 | case SENSOR_OV6650: |
@@ -697,17 +678,6 @@ static void setbrightness(struct gspca_dev *gspca_dev) | |||
697 | goto err; | 678 | goto err; |
698 | break; | 679 | break; |
699 | } | 680 | } |
700 | case SENSOR_TAS5130CXX: { | ||
701 | __u8 i2c[] = | ||
702 | {0x30, 0x11, 0x02, 0x20, 0x70, 0x00, 0x00, 0x10}; | ||
703 | |||
704 | value = 0xff - sd->brightness; | ||
705 | i2c[4] = value; | ||
706 | PDEBUG(D_CONF, "brightness %d : %d", value, i2c[4]); | ||
707 | if (i2c_w(gspca_dev, i2c) < 0) | ||
708 | goto err; | ||
709 | break; | ||
710 | } | ||
711 | } | 681 | } |
712 | return; | 682 | return; |
713 | err: | 683 | err: |
@@ -733,7 +703,7 @@ static void setsensorgain(struct gspca_dev *gspca_dev) | |||
733 | break; | 703 | break; |
734 | } | 704 | } |
735 | case SENSOR_TAS5110C: | 705 | case SENSOR_TAS5110C: |
736 | case SENSOR_TAS5110D: { | 706 | case SENSOR_TAS5130CXX: { |
737 | __u8 i2c[] = | 707 | __u8 i2c[] = |
738 | {0x30, 0x11, 0x02, 0x20, 0x70, 0x00, 0x00, 0x10}; | 708 | {0x30, 0x11, 0x02, 0x20, 0x70, 0x00, 0x00, 0x10}; |
739 | 709 | ||
@@ -742,6 +712,23 @@ static void setsensorgain(struct gspca_dev *gspca_dev) | |||
742 | goto err; | 712 | goto err; |
743 | break; | 713 | break; |
744 | } | 714 | } |
715 | case SENSOR_TAS5110D: { | ||
716 | __u8 i2c[] = { | ||
717 | 0xb0, 0x61, 0x02, 0x00, 0x10, 0x00, 0x00, 0x17 }; | ||
718 | gain = 255 - gain; | ||
719 | /* The bits in the register are the wrong way around!! */ | ||
720 | i2c[3] |= (gain & 0x80) >> 7; | ||
721 | i2c[3] |= (gain & 0x40) >> 5; | ||
722 | i2c[3] |= (gain & 0x20) >> 3; | ||
723 | i2c[3] |= (gain & 0x10) >> 1; | ||
724 | i2c[3] |= (gain & 0x08) << 1; | ||
725 | i2c[3] |= (gain & 0x04) << 3; | ||
726 | i2c[3] |= (gain & 0x02) << 5; | ||
727 | i2c[3] |= (gain & 0x01) << 7; | ||
728 | if (i2c_w(gspca_dev, i2c) < 0) | ||
729 | goto err; | ||
730 | break; | ||
731 | } | ||
745 | 732 | ||
746 | case SENSOR_OV6650: | 733 | case SENSOR_OV6650: |
747 | gain >>= 1; | 734 | gain >>= 1; |
@@ -796,7 +783,7 @@ static void setgain(struct gspca_dev *gspca_dev) | |||
796 | { | 783 | { |
797 | struct sd *sd = (struct sd *) gspca_dev; | 784 | struct sd *sd = (struct sd *) gspca_dev; |
798 | __u8 gain; | 785 | __u8 gain; |
799 | __u8 buf[2] = { 0, 0 }; | 786 | __u8 buf[3] = { 0, 0, 0 }; |
800 | 787 | ||
801 | if (sensor_data[sd->sensor].flags & F_GAIN) { | 788 | if (sensor_data[sd->sensor].flags & F_GAIN) { |
802 | /* Use the sensor gain to do the actual gain */ | 789 | /* Use the sensor gain to do the actual gain */ |
@@ -804,13 +791,18 @@ static void setgain(struct gspca_dev *gspca_dev) | |||
804 | return; | 791 | return; |
805 | } | 792 | } |
806 | 793 | ||
807 | gain = sd->gain >> 4; | 794 | if (sd->bridge == BRIDGE_103) { |
808 | 795 | gain = sd->gain >> 1; | |
809 | /* red and blue gain */ | 796 | buf[0] = gain; /* Red */ |
810 | buf[0] = gain << 4 | gain; | 797 | buf[1] = gain; /* Green */ |
811 | /* green gain */ | 798 | buf[2] = gain; /* Blue */ |
812 | buf[1] = gain; | 799 | reg_w(gspca_dev, 0x05, buf, 3); |
813 | reg_w(gspca_dev, 0x10, buf, 2); | 800 | } else { |
801 | gain = sd->gain >> 4; | ||
802 | buf[0] = gain << 4 | gain; /* Red and blue */ | ||
803 | buf[1] = gain; /* Green */ | ||
804 | reg_w(gspca_dev, 0x10, buf, 2); | ||
805 | } | ||
814 | } | 806 | } |
815 | 807 | ||
816 | static void setexposure(struct gspca_dev *gspca_dev) | 808 | static void setexposure(struct gspca_dev *gspca_dev) |
@@ -1049,7 +1041,7 @@ static void do_autogain(struct gspca_dev *gspca_dev) | |||
1049 | desired_avg_lum = 5000; | 1041 | desired_avg_lum = 5000; |
1050 | } else { | 1042 | } else { |
1051 | deadzone = 1500; | 1043 | deadzone = 1500; |
1052 | desired_avg_lum = 18000; | 1044 | desired_avg_lum = 13000; |
1053 | } | 1045 | } |
1054 | 1046 | ||
1055 | if (sensor_data[sd->sensor].flags & F_COARSE_EXPO) | 1047 | if (sensor_data[sd->sensor].flags & F_COARSE_EXPO) |
@@ -1127,53 +1119,91 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
1127 | { | 1119 | { |
1128 | struct sd *sd = (struct sd *) gspca_dev; | 1120 | struct sd *sd = (struct sd *) gspca_dev; |
1129 | struct cam *cam = &gspca_dev->cam; | 1121 | struct cam *cam = &gspca_dev->cam; |
1130 | int mode, l; | 1122 | int i, mode; |
1131 | const __u8 *sn9c10x; | 1123 | __u8 regs[0x31]; |
1132 | __u8 reg12_19[8]; | ||
1133 | 1124 | ||
1134 | mode = cam->cam_mode[gspca_dev->curr_mode].priv & 0x07; | 1125 | mode = cam->cam_mode[gspca_dev->curr_mode].priv & 0x07; |
1135 | sn9c10x = sensor_data[sd->sensor].bridge_init[sd->bridge]; | 1126 | /* Copy registers 0x01 - 0x19 from the template */ |
1136 | l = sensor_data[sd->sensor].bridge_init_size[sd->bridge]; | 1127 | memcpy(®s[0x01], sensor_data[sd->sensor].bridge_init, 0x19); |
1137 | memcpy(reg12_19, &sn9c10x[0x12 - 1], 8); | 1128 | /* Set the mode */ |
1138 | reg12_19[6] = sn9c10x[0x18 - 1] | (mode << 4); | 1129 | regs[0x18] |= mode << 4; |
1139 | /* Special cases where reg 17 and or 19 value depends on mode */ | 1130 | |
1131 | /* Set bridge gain to 1.0 */ | ||
1132 | if (sd->bridge == BRIDGE_103) { | ||
1133 | regs[0x05] = 0x20; /* Red */ | ||
1134 | regs[0x06] = 0x20; /* Green */ | ||
1135 | regs[0x07] = 0x20; /* Blue */ | ||
1136 | } else { | ||
1137 | regs[0x10] = 0x00; /* Red and blue */ | ||
1138 | regs[0x11] = 0x00; /* Green */ | ||
1139 | } | ||
1140 | |||
1141 | /* Setup pixel numbers and auto exposure window */ | ||
1142 | if (sensor_data[sd->sensor].flags & F_SIF) { | ||
1143 | regs[0x1a] = 0x14; /* HO_SIZE 640, makes no sense */ | ||
1144 | regs[0x1b] = 0x0a; /* VO_SIZE 320, makes no sense */ | ||
1145 | regs[0x1c] = 0x02; /* AE H-start 64 */ | ||
1146 | regs[0x1d] = 0x02; /* AE V-start 64 */ | ||
1147 | regs[0x1e] = 0x09; /* AE H-end 288 */ | ||
1148 | regs[0x1f] = 0x07; /* AE V-end 224 */ | ||
1149 | } else { | ||
1150 | regs[0x1a] = 0x1d; /* HO_SIZE 960, makes no sense */ | ||
1151 | regs[0x1b] = 0x10; /* VO_SIZE 512, makes no sense */ | ||
1152 | regs[0x1c] = 0x05; /* AE H-start 160 */ | ||
1153 | regs[0x1d] = 0x03; /* AE V-start 96 */ | ||
1154 | regs[0x1e] = 0x0f; /* AE H-end 480 */ | ||
1155 | regs[0x1f] = 0x0c; /* AE V-end 384 */ | ||
1156 | } | ||
1157 | |||
1158 | /* Setup the gamma table (only used with the sn9c103 bridge) */ | ||
1159 | for (i = 0; i < 16; i++) | ||
1160 | regs[0x20 + i] = i * 16; | ||
1161 | regs[0x20 + i] = 255; | ||
1162 | |||
1163 | /* Special cases where some regs depend on mode or bridge */ | ||
1140 | switch (sd->sensor) { | 1164 | switch (sd->sensor) { |
1141 | case SENSOR_TAS5130CXX: | 1165 | case SENSOR_TAS5130CXX: |
1142 | /* probably not mode specific at all most likely the upper | 1166 | /* FIXME / TESTME |
1167 | probably not mode specific at all most likely the upper | ||
1143 | nibble of 0x19 is exposure (clock divider) just as with | 1168 | nibble of 0x19 is exposure (clock divider) just as with |
1144 | the tas5110, we need someone to test this. */ | 1169 | the tas5110, we need someone to test this. */ |
1145 | reg12_19[7] = mode ? 0x23 : 0x43; | 1170 | regs[0x19] = mode ? 0x23 : 0x43; |
1146 | break; | 1171 | break; |
1172 | case SENSOR_OV7630: | ||
1173 | /* FIXME / TESTME for some reason with the 101/102 bridge the | ||
1174 | clock is set to 12 Mhz (reg1 == 0x04), rather then 24. | ||
1175 | Also the hstart needs to go from 1 to 2 when using a 103, | ||
1176 | which is likely related. This does not seem right. */ | ||
1177 | if (sd->bridge == BRIDGE_103) { | ||
1178 | regs[0x01] = 0x44; /* Select 24 Mhz clock */ | ||
1179 | regs[0x12] = 0x02; /* Set hstart to 2 */ | ||
1180 | } | ||
1147 | } | 1181 | } |
1148 | /* Disable compression when the raw bayer format has been selected */ | 1182 | /* Disable compression when the raw bayer format has been selected */ |
1149 | if (cam->cam_mode[gspca_dev->curr_mode].priv & MODE_RAW) | 1183 | if (cam->cam_mode[gspca_dev->curr_mode].priv & MODE_RAW) |
1150 | reg12_19[6] &= ~0x80; | 1184 | regs[0x18] &= ~0x80; |
1151 | 1185 | ||
1152 | /* Vga mode emulation on SIF sensor? */ | 1186 | /* Vga mode emulation on SIF sensor? */ |
1153 | if (cam->cam_mode[gspca_dev->curr_mode].priv & MODE_REDUCED_SIF) { | 1187 | if (cam->cam_mode[gspca_dev->curr_mode].priv & MODE_REDUCED_SIF) { |
1154 | reg12_19[0] += 16; /* 0x12: hstart adjust */ | 1188 | regs[0x12] += 16; /* hstart adjust */ |
1155 | reg12_19[1] += 24; /* 0x13: vstart adjust */ | 1189 | regs[0x13] += 24; /* vstart adjust */ |
1156 | reg12_19[3] = 320 / 16; /* 0x15: hsize */ | 1190 | regs[0x15] = 320 / 16; /* hsize */ |
1157 | reg12_19[4] = 240 / 16; /* 0x16: vsize */ | 1191 | regs[0x16] = 240 / 16; /* vsize */ |
1158 | } | 1192 | } |
1159 | 1193 | ||
1160 | /* reg 0x01 bit 2 video transfert on */ | 1194 | /* reg 0x01 bit 2 video transfert on */ |
1161 | reg_w(gspca_dev, 0x01, &sn9c10x[0x01 - 1], 1); | 1195 | reg_w(gspca_dev, 0x01, ®s[0x01], 1); |
1162 | /* reg 0x17 SensorClk enable inv Clk 0x60 */ | 1196 | /* reg 0x17 SensorClk enable inv Clk 0x60 */ |
1163 | reg_w(gspca_dev, 0x17, &sn9c10x[0x17 - 1], 1); | 1197 | reg_w(gspca_dev, 0x17, ®s[0x17], 1); |
1164 | /* Set the registers from the template */ | 1198 | /* Set the registers from the template */ |
1165 | reg_w(gspca_dev, 0x01, sn9c10x, l); | 1199 | reg_w(gspca_dev, 0x01, ®s[0x01], |
1200 | (sd->bridge == BRIDGE_103) ? 0x30 : 0x1f); | ||
1166 | 1201 | ||
1167 | /* Init the sensor */ | 1202 | /* Init the sensor */ |
1168 | i2c_w_vector(gspca_dev, sensor_data[sd->sensor].sensor_init, | 1203 | i2c_w_vector(gspca_dev, sensor_data[sd->sensor].sensor_init, |
1169 | sensor_data[sd->sensor].sensor_init_size); | 1204 | sensor_data[sd->sensor].sensor_init_size); |
1170 | if (sensor_data[sd->sensor].sensor_bridge_init[sd->bridge]) | ||
1171 | i2c_w_vector(gspca_dev, | ||
1172 | sensor_data[sd->sensor].sensor_bridge_init[sd->bridge], | ||
1173 | sensor_data[sd->sensor].sensor_bridge_init_size[ | ||
1174 | sd->bridge]); | ||
1175 | 1205 | ||
1176 | /* Mode specific sensor setup */ | 1206 | /* Mode / bridge specific sensor setup */ |
1177 | switch (sd->sensor) { | 1207 | switch (sd->sensor) { |
1178 | case SENSOR_PAS202: { | 1208 | case SENSOR_PAS202: { |
1179 | const __u8 i2cpclockdiv[] = | 1209 | const __u8 i2cpclockdiv[] = |
@@ -1181,27 +1211,37 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
1181 | /* clockdiv from 4 to 3 (7.5 -> 10 fps) when in low res mode */ | 1211 | /* clockdiv from 4 to 3 (7.5 -> 10 fps) when in low res mode */ |
1182 | if (mode) | 1212 | if (mode) |
1183 | i2c_w(gspca_dev, i2cpclockdiv); | 1213 | i2c_w(gspca_dev, i2cpclockdiv); |
1214 | break; | ||
1184 | } | 1215 | } |
1216 | case SENSOR_OV7630: | ||
1217 | /* FIXME / TESTME We should be able to handle this identical | ||
1218 | for the 101/102 and the 103 case */ | ||
1219 | if (sd->bridge == BRIDGE_103) { | ||
1220 | const __u8 i2c[] = { 0xa0, 0x21, 0x13, | ||
1221 | 0x80, 0x00, 0x00, 0x00, 0x10 }; | ||
1222 | i2c_w(gspca_dev, i2c); | ||
1223 | } | ||
1224 | break; | ||
1185 | } | 1225 | } |
1186 | /* H_size V_size 0x28, 0x1e -> 640x480. 0x16, 0x12 -> 352x288 */ | 1226 | /* H_size V_size 0x28, 0x1e -> 640x480. 0x16, 0x12 -> 352x288 */ |
1187 | reg_w(gspca_dev, 0x15, ®12_19[3], 2); | 1227 | reg_w(gspca_dev, 0x15, ®s[0x15], 2); |
1188 | /* compression register */ | 1228 | /* compression register */ |
1189 | reg_w(gspca_dev, 0x18, ®12_19[6], 1); | 1229 | reg_w(gspca_dev, 0x18, ®s[0x18], 1); |
1190 | /* H_start */ | 1230 | /* H_start */ |
1191 | reg_w(gspca_dev, 0x12, ®12_19[0], 1); | 1231 | reg_w(gspca_dev, 0x12, ®s[0x12], 1); |
1192 | /* V_START */ | 1232 | /* V_START */ |
1193 | reg_w(gspca_dev, 0x13, ®12_19[1], 1); | 1233 | reg_w(gspca_dev, 0x13, ®s[0x13], 1); |
1194 | /* reset 0x17 SensorClk enable inv Clk 0x60 */ | 1234 | /* reset 0x17 SensorClk enable inv Clk 0x60 */ |
1195 | /*fixme: ov7630 [17]=68 8f (+20 if 102)*/ | 1235 | /*fixme: ov7630 [17]=68 8f (+20 if 102)*/ |
1196 | reg_w(gspca_dev, 0x17, ®12_19[5], 1); | 1236 | reg_w(gspca_dev, 0x17, ®s[0x17], 1); |
1197 | /*MCKSIZE ->3 */ /*fixme: not ov7630*/ | 1237 | /*MCKSIZE ->3 */ /*fixme: not ov7630*/ |
1198 | reg_w(gspca_dev, 0x19, ®12_19[7], 1); | 1238 | reg_w(gspca_dev, 0x19, ®s[0x19], 1); |
1199 | /* AE_STRX AE_STRY AE_ENDX AE_ENDY */ | 1239 | /* AE_STRX AE_STRY AE_ENDX AE_ENDY */ |
1200 | reg_w(gspca_dev, 0x1c, &sn9c10x[0x1c - 1], 4); | 1240 | reg_w(gspca_dev, 0x1c, ®s[0x1c], 4); |
1201 | /* Enable video transfert */ | 1241 | /* Enable video transfert */ |
1202 | reg_w(gspca_dev, 0x01, &sn9c10x[0], 1); | 1242 | reg_w(gspca_dev, 0x01, ®s[0x01], 1); |
1203 | /* Compression */ | 1243 | /* Compression */ |
1204 | reg_w(gspca_dev, 0x18, ®12_19[6], 2); | 1244 | reg_w(gspca_dev, 0x18, ®s[0x18], 2); |
1205 | msleep(20); | 1245 | msleep(20); |
1206 | 1246 | ||
1207 | sd->reg11 = -1; | 1247 | sd->reg11 = -1; |
@@ -1525,15 +1565,15 @@ static const struct sd_desc sd_desc = { | |||
1525 | .driver_info = (SENSOR_ ## sensor << 8) | BRIDGE_ ## bridge | 1565 | .driver_info = (SENSOR_ ## sensor << 8) | BRIDGE_ ## bridge |
1526 | 1566 | ||
1527 | 1567 | ||
1528 | static const struct usb_device_id device_table[] __devinitconst = { | 1568 | static const struct usb_device_id device_table[] = { |
1529 | {USB_DEVICE(0x0c45, 0x6001), SB(TAS5110C, 102)}, /* TAS5110C1B */ | 1569 | {USB_DEVICE(0x0c45, 0x6001), SB(TAS5110C, 102)}, /* TAS5110C1B */ |
1530 | {USB_DEVICE(0x0c45, 0x6005), SB(TAS5110C, 101)}, /* TAS5110C1B */ | 1570 | {USB_DEVICE(0x0c45, 0x6005), SB(TAS5110C, 101)}, /* TAS5110C1B */ |
1531 | {USB_DEVICE(0x0c45, 0x6007), SB(TAS5110D, 101)}, /* TAS5110D */ | 1571 | {USB_DEVICE(0x0c45, 0x6007), SB(TAS5110D, 101)}, /* TAS5110D */ |
1532 | {USB_DEVICE(0x0c45, 0x6009), SB(PAS106, 101)}, | 1572 | {USB_DEVICE(0x0c45, 0x6009), SB(PAS106, 101)}, |
1533 | {USB_DEVICE(0x0c45, 0x600d), SB(PAS106, 101)}, | 1573 | {USB_DEVICE(0x0c45, 0x600d), SB(PAS106, 101)}, |
1534 | {USB_DEVICE(0x0c45, 0x6011), SB(OV6650, 101)}, | 1574 | {USB_DEVICE(0x0c45, 0x6011), SB(OV6650, 101)}, |
1535 | #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE | ||
1536 | {USB_DEVICE(0x0c45, 0x6019), SB(OV7630, 101)}, | 1575 | {USB_DEVICE(0x0c45, 0x6019), SB(OV7630, 101)}, |
1576 | #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE | ||
1537 | {USB_DEVICE(0x0c45, 0x6024), SB(TAS5130CXX, 102)}, | 1577 | {USB_DEVICE(0x0c45, 0x6024), SB(TAS5130CXX, 102)}, |
1538 | {USB_DEVICE(0x0c45, 0x6025), SB(TAS5130CXX, 102)}, | 1578 | {USB_DEVICE(0x0c45, 0x6025), SB(TAS5130CXX, 102)}, |
1539 | #endif | 1579 | #endif |
@@ -1544,18 +1584,22 @@ static const struct usb_device_id device_table[] __devinitconst = { | |||
1544 | {USB_DEVICE(0x0c45, 0x602c), SB(OV7630, 102)}, | 1584 | {USB_DEVICE(0x0c45, 0x602c), SB(OV7630, 102)}, |
1545 | {USB_DEVICE(0x0c45, 0x602d), SB(HV7131R, 102)}, | 1585 | {USB_DEVICE(0x0c45, 0x602d), SB(HV7131R, 102)}, |
1546 | {USB_DEVICE(0x0c45, 0x602e), SB(OV7630, 102)}, | 1586 | {USB_DEVICE(0x0c45, 0x602e), SB(OV7630, 102)}, |
1547 | /* {USB_DEVICE(0x0c45, 0x602b), SB(MI03XX, 102)}, */ /* MI0343 MI0360 MI0330 */ | 1587 | /* {USB_DEVICE(0x0c45, 0x6030), SB(MI03XX, 102)}, */ /* MI0343 MI0360 MI0330 */ |
1588 | /* {USB_DEVICE(0x0c45, 0x6082), SB(MI03XX, 103)}, */ /* MI0343 MI0360 */ | ||
1589 | {USB_DEVICE(0x0c45, 0x6083), SB(HV7131D, 103)}, | ||
1590 | {USB_DEVICE(0x0c45, 0x608c), SB(HV7131R, 103)}, | ||
1591 | /* {USB_DEVICE(0x0c45, 0x608e), SB(CISVF10, 103)}, */ | ||
1548 | {USB_DEVICE(0x0c45, 0x608f), SB(OV7630, 103)}, | 1592 | {USB_DEVICE(0x0c45, 0x608f), SB(OV7630, 103)}, |
1549 | #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE | 1593 | {USB_DEVICE(0x0c45, 0x60a8), SB(PAS106, 103)}, |
1594 | {USB_DEVICE(0x0c45, 0x60aa), SB(TAS5130CXX, 103)}, | ||
1550 | {USB_DEVICE(0x0c45, 0x60af), SB(PAS202, 103)}, | 1595 | {USB_DEVICE(0x0c45, 0x60af), SB(PAS202, 103)}, |
1551 | #endif | ||
1552 | {USB_DEVICE(0x0c45, 0x60b0), SB(OV7630, 103)}, | 1596 | {USB_DEVICE(0x0c45, 0x60b0), SB(OV7630, 103)}, |
1553 | {} | 1597 | {} |
1554 | }; | 1598 | }; |
1555 | MODULE_DEVICE_TABLE(usb, device_table); | 1599 | MODULE_DEVICE_TABLE(usb, device_table); |
1556 | 1600 | ||
1557 | /* -- device connect -- */ | 1601 | /* -- device connect -- */ |
1558 | static int __devinit sd_probe(struct usb_interface *intf, | 1602 | static int sd_probe(struct usb_interface *intf, |
1559 | const struct usb_device_id *id) | 1603 | const struct usb_device_id *id) |
1560 | { | 1604 | { |
1561 | return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), | 1605 | return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), |
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index 2d0bb17a30a2..d6f39ce1b7e1 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c | |||
@@ -25,12 +25,12 @@ | |||
25 | #include "gspca.h" | 25 | #include "gspca.h" |
26 | #include "jpeg.h" | 26 | #include "jpeg.h" |
27 | 27 | ||
28 | #define V4L2_CID_INFRARED (V4L2_CID_PRIVATE_BASE + 0) | ||
29 | |||
30 | MODULE_AUTHOR("Jean-François Moine <http://moinejf.free.fr>"); | 28 | MODULE_AUTHOR("Jean-François Moine <http://moinejf.free.fr>"); |
31 | MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver"); | 29 | MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver"); |
32 | MODULE_LICENSE("GPL"); | 30 | MODULE_LICENSE("GPL"); |
33 | 31 | ||
32 | static int starcam; | ||
33 | |||
34 | /* controls */ | 34 | /* controls */ |
35 | enum e_ctrl { | 35 | enum e_ctrl { |
36 | BRIGHTNESS, | 36 | BRIGHTNESS, |
@@ -43,7 +43,7 @@ enum e_ctrl { | |||
43 | HFLIP, | 43 | HFLIP, |
44 | VFLIP, | 44 | VFLIP, |
45 | SHARPNESS, | 45 | SHARPNESS, |
46 | INFRARED, | 46 | ILLUM, |
47 | FREQ, | 47 | FREQ, |
48 | NCTRLS /* number of controls */ | 48 | NCTRLS /* number of controls */ |
49 | }; | 49 | }; |
@@ -100,7 +100,8 @@ enum sensors { | |||
100 | }; | 100 | }; |
101 | 101 | ||
102 | /* device flags */ | 102 | /* device flags */ |
103 | #define PDN_INV 1 /* inverse pin S_PWR_DN / sn_xxx tables */ | 103 | #define F_PDN_INV 0x01 /* inverse pin S_PWR_DN / sn_xxx tables */ |
104 | #define F_ILLUM 0x02 /* presence of illuminator */ | ||
104 | 105 | ||
105 | /* sn9c1xx definitions */ | 106 | /* sn9c1xx definitions */ |
106 | /* register 0x01 */ | 107 | /* register 0x01 */ |
@@ -124,7 +125,7 @@ static void setgamma(struct gspca_dev *gspca_dev); | |||
124 | static void setautogain(struct gspca_dev *gspca_dev); | 125 | static void setautogain(struct gspca_dev *gspca_dev); |
125 | static void sethvflip(struct gspca_dev *gspca_dev); | 126 | static void sethvflip(struct gspca_dev *gspca_dev); |
126 | static void setsharpness(struct gspca_dev *gspca_dev); | 127 | static void setsharpness(struct gspca_dev *gspca_dev); |
127 | static void setinfrared(struct gspca_dev *gspca_dev); | 128 | static void setillum(struct gspca_dev *gspca_dev); |
128 | static void setfreq(struct gspca_dev *gspca_dev); | 129 | static void setfreq(struct gspca_dev *gspca_dev); |
129 | 130 | ||
130 | static const struct ctrl sd_ctrls[NCTRLS] = { | 131 | static const struct ctrl sd_ctrls[NCTRLS] = { |
@@ -251,18 +252,17 @@ static const struct ctrl sd_ctrls[NCTRLS] = { | |||
251 | }, | 252 | }, |
252 | .set_control = setsharpness | 253 | .set_control = setsharpness |
253 | }, | 254 | }, |
254 | /* mt9v111 only */ | 255 | [ILLUM] = { |
255 | [INFRARED] = { | ||
256 | { | 256 | { |
257 | .id = V4L2_CID_INFRARED, | 257 | .id = V4L2_CID_ILLUMINATORS_1, |
258 | .type = V4L2_CTRL_TYPE_BOOLEAN, | 258 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
259 | .name = "Infrared", | 259 | .name = "Illuminator / infrared", |
260 | .minimum = 0, | 260 | .minimum = 0, |
261 | .maximum = 1, | 261 | .maximum = 1, |
262 | .step = 1, | 262 | .step = 1, |
263 | .default_value = 0, | 263 | .default_value = 0, |
264 | }, | 264 | }, |
265 | .set_control = setinfrared | 265 | .set_control = setillum |
266 | }, | 266 | }, |
267 | /* ov7630/ov7648/ov7660 only */ | 267 | /* ov7630/ov7648/ov7660 only */ |
268 | [FREQ] = { | 268 | [FREQ] = { |
@@ -282,32 +282,26 @@ static const struct ctrl sd_ctrls[NCTRLS] = { | |||
282 | /* table of the disabled controls */ | 282 | /* table of the disabled controls */ |
283 | static const __u32 ctrl_dis[] = { | 283 | static const __u32 ctrl_dis[] = { |
284 | [SENSOR_ADCM1700] = (1 << AUTOGAIN) | | 284 | [SENSOR_ADCM1700] = (1 << AUTOGAIN) | |
285 | (1 << INFRARED) | | ||
286 | (1 << HFLIP) | | 285 | (1 << HFLIP) | |
287 | (1 << VFLIP) | | 286 | (1 << VFLIP) | |
288 | (1 << FREQ), | 287 | (1 << FREQ), |
289 | 288 | ||
290 | [SENSOR_GC0307] = (1 << INFRARED) | | 289 | [SENSOR_GC0307] = (1 << HFLIP) | |
291 | (1 << HFLIP) | | ||
292 | (1 << VFLIP) | | 290 | (1 << VFLIP) | |
293 | (1 << FREQ), | 291 | (1 << FREQ), |
294 | 292 | ||
295 | [SENSOR_HV7131R] = (1 << INFRARED) | | 293 | [SENSOR_HV7131R] = (1 << HFLIP) | |
296 | (1 << HFLIP) | | ||
297 | (1 << FREQ), | 294 | (1 << FREQ), |
298 | 295 | ||
299 | [SENSOR_MI0360] = (1 << INFRARED) | | 296 | [SENSOR_MI0360] = (1 << HFLIP) | |
300 | (1 << HFLIP) | | ||
301 | (1 << VFLIP) | | 297 | (1 << VFLIP) | |
302 | (1 << FREQ), | 298 | (1 << FREQ), |
303 | 299 | ||
304 | [SENSOR_MI0360B] = (1 << INFRARED) | | 300 | [SENSOR_MI0360B] = (1 << HFLIP) | |
305 | (1 << HFLIP) | | ||
306 | (1 << VFLIP) | | 301 | (1 << VFLIP) | |
307 | (1 << FREQ), | 302 | (1 << FREQ), |
308 | 303 | ||
309 | [SENSOR_MO4000] = (1 << INFRARED) | | 304 | [SENSOR_MO4000] = (1 << HFLIP) | |
310 | (1 << HFLIP) | | ||
311 | (1 << VFLIP) | | 305 | (1 << VFLIP) | |
312 | (1 << FREQ), | 306 | (1 << FREQ), |
313 | 307 | ||
@@ -315,40 +309,32 @@ static const __u32 ctrl_dis[] = { | |||
315 | (1 << VFLIP) | | 309 | (1 << VFLIP) | |
316 | (1 << FREQ), | 310 | (1 << FREQ), |
317 | 311 | ||
318 | [SENSOR_OM6802] = (1 << INFRARED) | | 312 | [SENSOR_OM6802] = (1 << HFLIP) | |
319 | (1 << HFLIP) | | ||
320 | (1 << VFLIP) | | 313 | (1 << VFLIP) | |
321 | (1 << FREQ), | 314 | (1 << FREQ), |
322 | 315 | ||
323 | [SENSOR_OV7630] = (1 << INFRARED) | | 316 | [SENSOR_OV7630] = (1 << HFLIP), |
324 | (1 << HFLIP), | ||
325 | 317 | ||
326 | [SENSOR_OV7648] = (1 << INFRARED) | | 318 | [SENSOR_OV7648] = (1 << HFLIP), |
327 | (1 << HFLIP), | ||
328 | 319 | ||
329 | [SENSOR_OV7660] = (1 << AUTOGAIN) | | 320 | [SENSOR_OV7660] = (1 << AUTOGAIN) | |
330 | (1 << INFRARED) | | ||
331 | (1 << HFLIP) | | 321 | (1 << HFLIP) | |
332 | (1 << VFLIP), | 322 | (1 << VFLIP), |
333 | 323 | ||
334 | [SENSOR_PO1030] = (1 << AUTOGAIN) | | 324 | [SENSOR_PO1030] = (1 << AUTOGAIN) | |
335 | (1 << INFRARED) | | ||
336 | (1 << HFLIP) | | 325 | (1 << HFLIP) | |
337 | (1 << VFLIP) | | 326 | (1 << VFLIP) | |
338 | (1 << FREQ), | 327 | (1 << FREQ), |
339 | 328 | ||
340 | [SENSOR_PO2030N] = (1 << AUTOGAIN) | | 329 | [SENSOR_PO2030N] = (1 << AUTOGAIN) | |
341 | (1 << INFRARED) | | ||
342 | (1 << FREQ), | 330 | (1 << FREQ), |
343 | 331 | ||
344 | [SENSOR_SOI768] = (1 << AUTOGAIN) | | 332 | [SENSOR_SOI768] = (1 << AUTOGAIN) | |
345 | (1 << INFRARED) | | ||
346 | (1 << HFLIP) | | 333 | (1 << HFLIP) | |
347 | (1 << VFLIP) | | 334 | (1 << VFLIP) | |
348 | (1 << FREQ), | 335 | (1 << FREQ), |
349 | 336 | ||
350 | [SENSOR_SP80708] = (1 << AUTOGAIN) | | 337 | [SENSOR_SP80708] = (1 << AUTOGAIN) | |
351 | (1 << INFRARED) | | ||
352 | (1 << HFLIP) | | 338 | (1 << HFLIP) | |
353 | (1 << VFLIP) | | 339 | (1 << VFLIP) | |
354 | (1 << FREQ), | 340 | (1 << FREQ), |
@@ -1822,44 +1808,46 @@ static int sd_init(struct gspca_dev *gspca_dev) | |||
1822 | PDEBUG(D_PROBE, "Sonix chip id: %02x", regF1); | 1808 | PDEBUG(D_PROBE, "Sonix chip id: %02x", regF1); |
1823 | switch (sd->bridge) { | 1809 | switch (sd->bridge) { |
1824 | case BRIDGE_SN9C102P: | 1810 | case BRIDGE_SN9C102P: |
1811 | case BRIDGE_SN9C105: | ||
1825 | if (regF1 != 0x11) | 1812 | if (regF1 != 0x11) |
1826 | return -ENODEV; | 1813 | return -ENODEV; |
1814 | break; | ||
1815 | default: | ||
1816 | /* case BRIDGE_SN9C110: */ | ||
1817 | /* case BRIDGE_SN9C120: */ | ||
1818 | if (regF1 != 0x12) | ||
1819 | return -ENODEV; | ||
1820 | } | ||
1821 | |||
1822 | switch (sd->sensor) { | ||
1823 | case SENSOR_MI0360: | ||
1824 | mi0360_probe(gspca_dev); | ||
1825 | break; | ||
1826 | case SENSOR_OV7630: | ||
1827 | ov7630_probe(gspca_dev); | ||
1828 | break; | ||
1829 | case SENSOR_OV7648: | ||
1830 | ov7648_probe(gspca_dev); | ||
1831 | break; | ||
1832 | case SENSOR_PO2030N: | ||
1833 | po2030n_probe(gspca_dev); | ||
1834 | break; | ||
1835 | } | ||
1836 | |||
1837 | switch (sd->bridge) { | ||
1838 | case BRIDGE_SN9C102P: | ||
1827 | reg_w1(gspca_dev, 0x02, regGpio[1]); | 1839 | reg_w1(gspca_dev, 0x02, regGpio[1]); |
1828 | break; | 1840 | break; |
1829 | case BRIDGE_SN9C105: | 1841 | case BRIDGE_SN9C105: |
1830 | if (regF1 != 0x11) | ||
1831 | return -ENODEV; | ||
1832 | if (sd->sensor == SENSOR_MI0360) | ||
1833 | mi0360_probe(gspca_dev); | ||
1834 | reg_w(gspca_dev, 0x01, regGpio, 2); | 1842 | reg_w(gspca_dev, 0x01, regGpio, 2); |
1835 | break; | 1843 | break; |
1844 | case BRIDGE_SN9C110: | ||
1845 | reg_w1(gspca_dev, 0x02, 0x62); | ||
1846 | break; | ||
1836 | case BRIDGE_SN9C120: | 1847 | case BRIDGE_SN9C120: |
1837 | if (regF1 != 0x12) | ||
1838 | return -ENODEV; | ||
1839 | switch (sd->sensor) { | ||
1840 | case SENSOR_MI0360: | ||
1841 | mi0360_probe(gspca_dev); | ||
1842 | break; | ||
1843 | case SENSOR_OV7630: | ||
1844 | ov7630_probe(gspca_dev); | ||
1845 | break; | ||
1846 | case SENSOR_OV7648: | ||
1847 | ov7648_probe(gspca_dev); | ||
1848 | break; | ||
1849 | case SENSOR_PO2030N: | ||
1850 | po2030n_probe(gspca_dev); | ||
1851 | break; | ||
1852 | } | ||
1853 | regGpio[1] = 0x70; /* no audio */ | 1848 | regGpio[1] = 0x70; /* no audio */ |
1854 | reg_w(gspca_dev, 0x01, regGpio, 2); | 1849 | reg_w(gspca_dev, 0x01, regGpio, 2); |
1855 | break; | 1850 | break; |
1856 | default: | ||
1857 | /* case BRIDGE_SN9C110: */ | ||
1858 | /* case BRIDGE_SN9C325: */ | ||
1859 | if (regF1 != 0x12) | ||
1860 | return -ENODEV; | ||
1861 | reg_w1(gspca_dev, 0x02, 0x62); | ||
1862 | break; | ||
1863 | } | 1851 | } |
1864 | 1852 | ||
1865 | if (sd->sensor == SENSOR_OM6802) | 1853 | if (sd->sensor == SENSOR_OM6802) |
@@ -1874,6 +1862,8 @@ static int sd_init(struct gspca_dev *gspca_dev) | |||
1874 | sd->i2c_addr = sn9c1xx[9]; | 1862 | sd->i2c_addr = sn9c1xx[9]; |
1875 | 1863 | ||
1876 | gspca_dev->ctrl_dis = ctrl_dis[sd->sensor]; | 1864 | gspca_dev->ctrl_dis = ctrl_dis[sd->sensor]; |
1865 | if (!(sd->flags & F_ILLUM)) | ||
1866 | gspca_dev->ctrl_dis |= (1 << ILLUM); | ||
1877 | 1867 | ||
1878 | return gspca_dev->usb_err; | 1868 | return gspca_dev->usb_err; |
1879 | } | 1869 | } |
@@ -2197,16 +2187,28 @@ static void setsharpness(struct gspca_dev *gspca_dev) | |||
2197 | reg_w1(gspca_dev, 0x99, sd->ctrls[SHARPNESS].val); | 2187 | reg_w1(gspca_dev, 0x99, sd->ctrls[SHARPNESS].val); |
2198 | } | 2188 | } |
2199 | 2189 | ||
2200 | static void setinfrared(struct gspca_dev *gspca_dev) | 2190 | static void setillum(struct gspca_dev *gspca_dev) |
2201 | { | 2191 | { |
2202 | struct sd *sd = (struct sd *) gspca_dev; | 2192 | struct sd *sd = (struct sd *) gspca_dev; |
2203 | 2193 | ||
2204 | if (gspca_dev->ctrl_dis & (1 << INFRARED)) | 2194 | if (gspca_dev->ctrl_dis & (1 << ILLUM)) |
2205 | return; | 2195 | return; |
2206 | /*fixme: different sequence for StarCam Clip and StarCam 370i */ | 2196 | switch (sd->sensor) { |
2207 | /* Clip */ | 2197 | case SENSOR_ADCM1700: |
2208 | i2c_w1(gspca_dev, 0x02, /* gpio */ | 2198 | reg_w1(gspca_dev, 0x02, /* gpio */ |
2209 | sd->ctrls[INFRARED].val ? 0x66 : 0x64); | 2199 | sd->ctrls[ILLUM].val ? 0x64 : 0x60); |
2200 | break; | ||
2201 | case SENSOR_MT9V111: | ||
2202 | if (starcam) | ||
2203 | reg_w1(gspca_dev, 0x02, | ||
2204 | sd->ctrls[ILLUM].val ? | ||
2205 | 0x55 : 0x54); /* 370i */ | ||
2206 | else | ||
2207 | reg_w1(gspca_dev, 0x02, | ||
2208 | sd->ctrls[ILLUM].val ? | ||
2209 | 0x66 : 0x64); /* Clip */ | ||
2210 | break; | ||
2211 | } | ||
2210 | } | 2212 | } |
2211 | 2213 | ||
2212 | static void setfreq(struct gspca_dev *gspca_dev) | 2214 | static void setfreq(struct gspca_dev *gspca_dev) |
@@ -2344,7 +2346,7 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
2344 | /* sensor clock already enabled in sd_init */ | 2346 | /* sensor clock already enabled in sd_init */ |
2345 | /* reg_w1(gspca_dev, 0xf1, 0x00); */ | 2347 | /* reg_w1(gspca_dev, 0xf1, 0x00); */ |
2346 | reg01 = sn9c1xx[1]; | 2348 | reg01 = sn9c1xx[1]; |
2347 | if (sd->flags & PDN_INV) | 2349 | if (sd->flags & F_PDN_INV) |
2348 | reg01 ^= S_PDN_INV; /* power down inverted */ | 2350 | reg01 ^= S_PDN_INV; /* power down inverted */ |
2349 | reg_w1(gspca_dev, 0x01, reg01); | 2351 | reg_w1(gspca_dev, 0x01, reg01); |
2350 | 2352 | ||
@@ -2907,13 +2909,11 @@ static const struct sd_desc sd_desc = { | |||
2907 | .driver_info = (BRIDGE_ ## bridge << 16) \ | 2909 | .driver_info = (BRIDGE_ ## bridge << 16) \ |
2908 | | (SENSOR_ ## sensor << 8) \ | 2910 | | (SENSOR_ ## sensor << 8) \ |
2909 | | (flags) | 2911 | | (flags) |
2910 | static const __devinitdata struct usb_device_id device_table[] = { | 2912 | static const struct usb_device_id device_table[] = { |
2911 | #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE | ||
2912 | {USB_DEVICE(0x0458, 0x7025), BS(SN9C120, MI0360)}, | 2913 | {USB_DEVICE(0x0458, 0x7025), BS(SN9C120, MI0360)}, |
2913 | {USB_DEVICE(0x0458, 0x702e), BS(SN9C120, OV7660)}, | 2914 | {USB_DEVICE(0x0458, 0x702e), BS(SN9C120, OV7660)}, |
2914 | #endif | 2915 | {USB_DEVICE(0x045e, 0x00f5), BSF(SN9C105, OV7660, F_PDN_INV)}, |
2915 | {USB_DEVICE(0x045e, 0x00f5), BSF(SN9C105, OV7660, PDN_INV)}, | 2916 | {USB_DEVICE(0x045e, 0x00f7), BSF(SN9C105, OV7660, F_PDN_INV)}, |
2916 | {USB_DEVICE(0x045e, 0x00f7), BSF(SN9C105, OV7660, PDN_INV)}, | ||
2917 | {USB_DEVICE(0x0471, 0x0327), BS(SN9C105, MI0360)}, | 2917 | {USB_DEVICE(0x0471, 0x0327), BS(SN9C105, MI0360)}, |
2918 | {USB_DEVICE(0x0471, 0x0328), BS(SN9C105, MI0360)}, | 2918 | {USB_DEVICE(0x0471, 0x0328), BS(SN9C105, MI0360)}, |
2919 | {USB_DEVICE(0x0471, 0x0330), BS(SN9C105, MI0360)}, | 2919 | {USB_DEVICE(0x0471, 0x0330), BS(SN9C105, MI0360)}, |
@@ -2925,7 +2925,7 @@ static const __devinitdata struct usb_device_id device_table[] = { | |||
2925 | /* {USB_DEVICE(0x0c45, 0x607b), BS(SN9C102P, OV7660)}, */ | 2925 | /* {USB_DEVICE(0x0c45, 0x607b), BS(SN9C102P, OV7660)}, */ |
2926 | {USB_DEVICE(0x0c45, 0x607c), BS(SN9C102P, HV7131R)}, | 2926 | {USB_DEVICE(0x0c45, 0x607c), BS(SN9C102P, HV7131R)}, |
2927 | /* {USB_DEVICE(0x0c45, 0x607e), BS(SN9C102P, OV7630)}, */ | 2927 | /* {USB_DEVICE(0x0c45, 0x607e), BS(SN9C102P, OV7630)}, */ |
2928 | {USB_DEVICE(0x0c45, 0x60c0), BS(SN9C105, MI0360)}, | 2928 | {USB_DEVICE(0x0c45, 0x60c0), BSF(SN9C105, MI0360, F_ILLUM)}, |
2929 | /* or MT9V111 */ | 2929 | /* or MT9V111 */ |
2930 | /* {USB_DEVICE(0x0c45, 0x60c2), BS(SN9C105, P1030xC)}, */ | 2930 | /* {USB_DEVICE(0x0c45, 0x60c2), BS(SN9C105, P1030xC)}, */ |
2931 | /* {USB_DEVICE(0x0c45, 0x60c8), BS(SN9C105, OM6802)}, */ | 2931 | /* {USB_DEVICE(0x0c45, 0x60c8), BS(SN9C105, OM6802)}, */ |
@@ -2936,10 +2936,8 @@ static const __devinitdata struct usb_device_id device_table[] = { | |||
2936 | /* {USB_DEVICE(0x0c45, 0x60fa), BS(SN9C105, OV7648)}, */ | 2936 | /* {USB_DEVICE(0x0c45, 0x60fa), BS(SN9C105, OV7648)}, */ |
2937 | /* {USB_DEVICE(0x0c45, 0x60f2), BS(SN9C105, OV7660)}, */ | 2937 | /* {USB_DEVICE(0x0c45, 0x60f2), BS(SN9C105, OV7660)}, */ |
2938 | {USB_DEVICE(0x0c45, 0x60fb), BS(SN9C105, OV7660)}, | 2938 | {USB_DEVICE(0x0c45, 0x60fb), BS(SN9C105, OV7660)}, |
2939 | #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE | ||
2940 | {USB_DEVICE(0x0c45, 0x60fc), BS(SN9C105, HV7131R)}, | 2939 | {USB_DEVICE(0x0c45, 0x60fc), BS(SN9C105, HV7131R)}, |
2941 | {USB_DEVICE(0x0c45, 0x60fe), BS(SN9C105, OV7630)}, | 2940 | {USB_DEVICE(0x0c45, 0x60fe), BS(SN9C105, OV7630)}, |
2942 | #endif | ||
2943 | {USB_DEVICE(0x0c45, 0x6100), BS(SN9C120, MI0360)}, /*sn9c128*/ | 2941 | {USB_DEVICE(0x0c45, 0x6100), BS(SN9C120, MI0360)}, /*sn9c128*/ |
2944 | {USB_DEVICE(0x0c45, 0x6102), BS(SN9C120, PO2030N)}, /* /GC0305*/ | 2942 | {USB_DEVICE(0x0c45, 0x6102), BS(SN9C120, PO2030N)}, /* /GC0305*/ |
2945 | /* {USB_DEVICE(0x0c45, 0x6108), BS(SN9C120, OM6802)}, */ | 2943 | /* {USB_DEVICE(0x0c45, 0x6108), BS(SN9C120, OM6802)}, */ |
@@ -2962,16 +2960,15 @@ static const __devinitdata struct usb_device_id device_table[] = { | |||
2962 | /* {USB_DEVICE(0x0c45, 0x6132), BS(SN9C120, OV7670)}, */ | 2960 | /* {USB_DEVICE(0x0c45, 0x6132), BS(SN9C120, OV7670)}, */ |
2963 | {USB_DEVICE(0x0c45, 0x6138), BS(SN9C120, MO4000)}, | 2961 | {USB_DEVICE(0x0c45, 0x6138), BS(SN9C120, MO4000)}, |
2964 | {USB_DEVICE(0x0c45, 0x613a), BS(SN9C120, OV7648)}, | 2962 | {USB_DEVICE(0x0c45, 0x613a), BS(SN9C120, OV7648)}, |
2965 | #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE | ||
2966 | {USB_DEVICE(0x0c45, 0x613b), BS(SN9C120, OV7660)}, | 2963 | {USB_DEVICE(0x0c45, 0x613b), BS(SN9C120, OV7660)}, |
2967 | #endif | ||
2968 | {USB_DEVICE(0x0c45, 0x613c), BS(SN9C120, HV7131R)}, | 2964 | {USB_DEVICE(0x0c45, 0x613c), BS(SN9C120, HV7131R)}, |
2969 | {USB_DEVICE(0x0c45, 0x613e), BS(SN9C120, OV7630)}, | 2965 | {USB_DEVICE(0x0c45, 0x613e), BS(SN9C120, OV7630)}, |
2970 | {USB_DEVICE(0x0c45, 0x6142), BS(SN9C120, PO2030N)}, /*sn9c120b*/ | 2966 | {USB_DEVICE(0x0c45, 0x6142), BS(SN9C120, PO2030N)}, /*sn9c120b*/ |
2971 | /* or GC0305 / GC0307 */ | 2967 | /* or GC0305 / GC0307 */ |
2972 | {USB_DEVICE(0x0c45, 0x6143), BS(SN9C120, SP80708)}, /*sn9c120b*/ | 2968 | {USB_DEVICE(0x0c45, 0x6143), BS(SN9C120, SP80708)}, /*sn9c120b*/ |
2973 | {USB_DEVICE(0x0c45, 0x6148), BS(SN9C120, OM6802)}, /*sn9c120b*/ | 2969 | {USB_DEVICE(0x0c45, 0x6148), BS(SN9C120, OM6802)}, /*sn9c120b*/ |
2974 | {USB_DEVICE(0x0c45, 0x614a), BS(SN9C120, ADCM1700)}, /*sn9c120b*/ | 2970 | {USB_DEVICE(0x0c45, 0x614a), BSF(SN9C120, ADCM1700, F_ILLUM)}, |
2971 | /* {USB_DEVICE(0x0c45, 0x614c), BS(SN9C120, GC0306)}, */ /*sn9c120b*/ | ||
2975 | {} | 2972 | {} |
2976 | }; | 2973 | }; |
2977 | MODULE_DEVICE_TABLE(usb, device_table); | 2974 | MODULE_DEVICE_TABLE(usb, device_table); |
@@ -3007,3 +3004,7 @@ static void __exit sd_mod_exit(void) | |||
3007 | 3004 | ||
3008 | module_init(sd_mod_init); | 3005 | module_init(sd_mod_init); |
3009 | module_exit(sd_mod_exit); | 3006 | module_exit(sd_mod_exit); |
3007 | |||
3008 | module_param(starcam, int, 0644); | ||
3009 | MODULE_PARM_DESC(starcam, | ||
3010 | "StarCam model. 0: Clip, 1: 370i"); | ||
diff --git a/drivers/media/video/gspca/spca1528.c b/drivers/media/video/gspca/spca1528.c index e64338664410..76c006b2bc83 100644 --- a/drivers/media/video/gspca/spca1528.c +++ b/drivers/media/video/gspca/spca1528.c | |||
@@ -555,7 +555,7 @@ static const struct sd_desc sd_desc = { | |||
555 | }; | 555 | }; |
556 | 556 | ||
557 | /* -- module initialisation -- */ | 557 | /* -- module initialisation -- */ |
558 | static const __devinitdata struct usb_device_id device_table[] = { | 558 | static const struct usb_device_id device_table[] = { |
559 | {USB_DEVICE(0x04fc, 0x1528)}, | 559 | {USB_DEVICE(0x04fc, 0x1528)}, |
560 | {} | 560 | {} |
561 | }; | 561 | }; |
diff --git a/drivers/media/video/gspca/spca500.c b/drivers/media/video/gspca/spca500.c index 8e202b9039f1..45552c3ff8d9 100644 --- a/drivers/media/video/gspca/spca500.c +++ b/drivers/media/video/gspca/spca500.c | |||
@@ -1051,7 +1051,7 @@ static const struct sd_desc sd_desc = { | |||
1051 | }; | 1051 | }; |
1052 | 1052 | ||
1053 | /* -- module initialisation -- */ | 1053 | /* -- module initialisation -- */ |
1054 | static const __devinitdata struct usb_device_id device_table[] = { | 1054 | static const struct usb_device_id device_table[] = { |
1055 | {USB_DEVICE(0x040a, 0x0300), .driver_info = KodakEZ200}, | 1055 | {USB_DEVICE(0x040a, 0x0300), .driver_info = KodakEZ200}, |
1056 | {USB_DEVICE(0x041e, 0x400a), .driver_info = CreativePCCam300}, | 1056 | {USB_DEVICE(0x041e, 0x400a), .driver_info = CreativePCCam300}, |
1057 | {USB_DEVICE(0x046d, 0x0890), .driver_info = LogitechTraveler}, | 1057 | {USB_DEVICE(0x046d, 0x0890), .driver_info = LogitechTraveler}, |
diff --git a/drivers/media/video/gspca/spca501.c b/drivers/media/video/gspca/spca501.c index 642839a11e8d..f7ef282cc600 100644 --- a/drivers/media/video/gspca/spca501.c +++ b/drivers/media/video/gspca/spca501.c | |||
@@ -2155,7 +2155,7 @@ static const struct sd_desc sd_desc = { | |||
2155 | }; | 2155 | }; |
2156 | 2156 | ||
2157 | /* -- module initialisation -- */ | 2157 | /* -- module initialisation -- */ |
2158 | static const __devinitdata struct usb_device_id device_table[] = { | 2158 | static const struct usb_device_id device_table[] = { |
2159 | {USB_DEVICE(0x040a, 0x0002), .driver_info = KodakDVC325}, | 2159 | {USB_DEVICE(0x040a, 0x0002), .driver_info = KodakDVC325}, |
2160 | {USB_DEVICE(0x0497, 0xc001), .driver_info = SmileIntlCamera}, | 2160 | {USB_DEVICE(0x0497, 0xc001), .driver_info = SmileIntlCamera}, |
2161 | {USB_DEVICE(0x0506, 0x00df), .driver_info = ThreeComHomeConnectLite}, | 2161 | {USB_DEVICE(0x0506, 0x00df), .driver_info = ThreeComHomeConnectLite}, |
diff --git a/drivers/media/video/gspca/spca505.c b/drivers/media/video/gspca/spca505.c index bc9dd9034ab4..e5bf865147d7 100644 --- a/drivers/media/video/gspca/spca505.c +++ b/drivers/media/video/gspca/spca505.c | |||
@@ -786,7 +786,7 @@ static const struct sd_desc sd_desc = { | |||
786 | }; | 786 | }; |
787 | 787 | ||
788 | /* -- module initialisation -- */ | 788 | /* -- module initialisation -- */ |
789 | static const __devinitdata struct usb_device_id device_table[] = { | 789 | static const struct usb_device_id device_table[] = { |
790 | {USB_DEVICE(0x041e, 0x401d), .driver_info = Nxultra}, | 790 | {USB_DEVICE(0x041e, 0x401d), .driver_info = Nxultra}, |
791 | {USB_DEVICE(0x0733, 0x0430), .driver_info = IntelPCCameraPro}, | 791 | {USB_DEVICE(0x0733, 0x0430), .driver_info = IntelPCCameraPro}, |
792 | /*fixme: may be UsbGrabberPV321 BRIDGE_SPCA506 SENSOR_SAA7113 */ | 792 | /*fixme: may be UsbGrabberPV321 BRIDGE_SPCA506 SENSOR_SAA7113 */ |
diff --git a/drivers/media/video/gspca/spca508.c b/drivers/media/video/gspca/spca508.c index 7307638ac91d..348319371523 100644 --- a/drivers/media/video/gspca/spca508.c +++ b/drivers/media/video/gspca/spca508.c | |||
@@ -1509,7 +1509,7 @@ static const struct sd_desc sd_desc = { | |||
1509 | }; | 1509 | }; |
1510 | 1510 | ||
1511 | /* -- module initialisation -- */ | 1511 | /* -- module initialisation -- */ |
1512 | static const __devinitdata struct usb_device_id device_table[] = { | 1512 | static const struct usb_device_id device_table[] = { |
1513 | {USB_DEVICE(0x0130, 0x0130), .driver_info = HamaUSBSightcam}, | 1513 | {USB_DEVICE(0x0130, 0x0130), .driver_info = HamaUSBSightcam}, |
1514 | {USB_DEVICE(0x041e, 0x4018), .driver_info = CreativeVista}, | 1514 | {USB_DEVICE(0x041e, 0x4018), .driver_info = CreativeVista}, |
1515 | {USB_DEVICE(0x0733, 0x0110), .driver_info = ViewQuestVQ110}, | 1515 | {USB_DEVICE(0x0733, 0x0110), .driver_info = ViewQuestVQ110}, |
diff --git a/drivers/media/video/gspca/spca561.c b/drivers/media/video/gspca/spca561.c index 3a162c6d5466..e836e778dfb6 100644 --- a/drivers/media/video/gspca/spca561.c +++ b/drivers/media/video/gspca/spca561.c | |||
@@ -1061,7 +1061,7 @@ static const struct sd_desc *sd_desc[2] = { | |||
1061 | }; | 1061 | }; |
1062 | 1062 | ||
1063 | /* -- module initialisation -- */ | 1063 | /* -- module initialisation -- */ |
1064 | static const __devinitdata struct usb_device_id device_table[] = { | 1064 | static const struct usb_device_id device_table[] = { |
1065 | {USB_DEVICE(0x041e, 0x401a), .driver_info = Rev072A}, | 1065 | {USB_DEVICE(0x041e, 0x401a), .driver_info = Rev072A}, |
1066 | {USB_DEVICE(0x041e, 0x403b), .driver_info = Rev012A}, | 1066 | {USB_DEVICE(0x041e, 0x403b), .driver_info = Rev012A}, |
1067 | {USB_DEVICE(0x0458, 0x7004), .driver_info = Rev072A}, | 1067 | {USB_DEVICE(0x0458, 0x7004), .driver_info = Rev072A}, |
diff --git a/drivers/media/video/gspca/sq905.c b/drivers/media/video/gspca/sq905.c index 404067745775..2e9c06175192 100644 --- a/drivers/media/video/gspca/sq905.c +++ b/drivers/media/video/gspca/sq905.c | |||
@@ -396,7 +396,7 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
396 | } | 396 | } |
397 | 397 | ||
398 | /* Table of supported USB devices */ | 398 | /* Table of supported USB devices */ |
399 | static const __devinitdata struct usb_device_id device_table[] = { | 399 | static const struct usb_device_id device_table[] = { |
400 | {USB_DEVICE(0x2770, 0x9120)}, | 400 | {USB_DEVICE(0x2770, 0x9120)}, |
401 | {} | 401 | {} |
402 | }; | 402 | }; |
diff --git a/drivers/media/video/gspca/sq905c.c b/drivers/media/video/gspca/sq905c.c index 8ba199543856..457563b7a71b 100644 --- a/drivers/media/video/gspca/sq905c.c +++ b/drivers/media/video/gspca/sq905c.c | |||
@@ -298,7 +298,7 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
298 | } | 298 | } |
299 | 299 | ||
300 | /* Table of supported USB devices */ | 300 | /* Table of supported USB devices */ |
301 | static const __devinitdata struct usb_device_id device_table[] = { | 301 | static const struct usb_device_id device_table[] = { |
302 | {USB_DEVICE(0x2770, 0x905c)}, | 302 | {USB_DEVICE(0x2770, 0x905c)}, |
303 | {USB_DEVICE(0x2770, 0x9050)}, | 303 | {USB_DEVICE(0x2770, 0x9050)}, |
304 | {USB_DEVICE(0x2770, 0x9051)}, | 304 | {USB_DEVICE(0x2770, 0x9051)}, |
diff --git a/drivers/media/video/gspca/sq930x.c b/drivers/media/video/gspca/sq930x.c index a4a98811b9e3..8215d5dcd456 100644 --- a/drivers/media/video/gspca/sq930x.c +++ b/drivers/media/video/gspca/sq930x.c | |||
@@ -1163,7 +1163,7 @@ static const struct sd_desc sd_desc = { | |||
1163 | #define ST(sensor, type) \ | 1163 | #define ST(sensor, type) \ |
1164 | .driver_info = (SENSOR_ ## sensor << 8) \ | 1164 | .driver_info = (SENSOR_ ## sensor << 8) \ |
1165 | | (type) | 1165 | | (type) |
1166 | static const __devinitdata struct usb_device_id device_table[] = { | 1166 | static const struct usb_device_id device_table[] = { |
1167 | {USB_DEVICE(0x041e, 0x4038), ST(MI0360, 0)}, | 1167 | {USB_DEVICE(0x041e, 0x4038), ST(MI0360, 0)}, |
1168 | {USB_DEVICE(0x041e, 0x403c), ST(LZ24BP, 0)}, | 1168 | {USB_DEVICE(0x041e, 0x403c), ST(LZ24BP, 0)}, |
1169 | {USB_DEVICE(0x041e, 0x403d), ST(LZ24BP, 0)}, | 1169 | {USB_DEVICE(0x041e, 0x403d), ST(LZ24BP, 0)}, |
diff --git a/drivers/media/video/gspca/stk014.c b/drivers/media/video/gspca/stk014.c index 11a192b95ed4..87be52b5e1e3 100644 --- a/drivers/media/video/gspca/stk014.c +++ b/drivers/media/video/gspca/stk014.c | |||
@@ -495,7 +495,7 @@ static const struct sd_desc sd_desc = { | |||
495 | }; | 495 | }; |
496 | 496 | ||
497 | /* -- module initialisation -- */ | 497 | /* -- module initialisation -- */ |
498 | static const __devinitdata struct usb_device_id device_table[] = { | 498 | static const struct usb_device_id device_table[] = { |
499 | {USB_DEVICE(0x05e1, 0x0893)}, | 499 | {USB_DEVICE(0x05e1, 0x0893)}, |
500 | {} | 500 | {} |
501 | }; | 501 | }; |
diff --git a/drivers/media/video/gspca/stv0680.c b/drivers/media/video/gspca/stv0680.c index b199ad4666bd..e2ef41cf72d7 100644 --- a/drivers/media/video/gspca/stv0680.c +++ b/drivers/media/video/gspca/stv0680.c | |||
@@ -327,7 +327,7 @@ static const struct sd_desc sd_desc = { | |||
327 | }; | 327 | }; |
328 | 328 | ||
329 | /* -- module initialisation -- */ | 329 | /* -- module initialisation -- */ |
330 | static const __devinitdata struct usb_device_id device_table[] = { | 330 | static const struct usb_device_id device_table[] = { |
331 | {USB_DEVICE(0x0553, 0x0202)}, | 331 | {USB_DEVICE(0x0553, 0x0202)}, |
332 | {USB_DEVICE(0x041e, 0x4007)}, | 332 | {USB_DEVICE(0x041e, 0x4007)}, |
333 | {} | 333 | {} |
diff --git a/drivers/media/video/gspca/stv06xx/stv06xx.c b/drivers/media/video/gspca/stv06xx/stv06xx.c index 28ea4175b80e..7e0661429293 100644 --- a/drivers/media/video/gspca/stv06xx/stv06xx.c +++ b/drivers/media/video/gspca/stv06xx/stv06xx.c | |||
@@ -564,7 +564,7 @@ static int stv06xx_config(struct gspca_dev *gspca_dev, | |||
564 | 564 | ||
565 | 565 | ||
566 | /* -- module initialisation -- */ | 566 | /* -- module initialisation -- */ |
567 | static const __devinitdata struct usb_device_id device_table[] = { | 567 | static const struct usb_device_id device_table[] = { |
568 | /* QuickCam Express */ | 568 | /* QuickCam Express */ |
569 | {USB_DEVICE(0x046d, 0x0840), .driver_info = BRIDGE_STV600 }, | 569 | {USB_DEVICE(0x046d, 0x0840), .driver_info = BRIDGE_STV600 }, |
570 | /* LEGO cam / QuickCam Web */ | 570 | /* LEGO cam / QuickCam Web */ |
diff --git a/drivers/media/video/gspca/sunplus.c b/drivers/media/video/gspca/sunplus.c index a9cbcd6011d9..543542af2720 100644 --- a/drivers/media/video/gspca/sunplus.c +++ b/drivers/media/video/gspca/sunplus.c | |||
@@ -1162,7 +1162,7 @@ static const struct sd_desc sd_desc = { | |||
1162 | #define BS(bridge, subtype) \ | 1162 | #define BS(bridge, subtype) \ |
1163 | .driver_info = (BRIDGE_ ## bridge << 8) \ | 1163 | .driver_info = (BRIDGE_ ## bridge << 8) \ |
1164 | | (subtype) | 1164 | | (subtype) |
1165 | static const __devinitdata struct usb_device_id device_table[] = { | 1165 | static const struct usb_device_id device_table[] = { |
1166 | {USB_DEVICE(0x041e, 0x400b), BS(SPCA504C, 0)}, | 1166 | {USB_DEVICE(0x041e, 0x400b), BS(SPCA504C, 0)}, |
1167 | {USB_DEVICE(0x041e, 0x4012), BS(SPCA504C, 0)}, | 1167 | {USB_DEVICE(0x041e, 0x4012), BS(SPCA504C, 0)}, |
1168 | {USB_DEVICE(0x041e, 0x4013), BS(SPCA504C, 0)}, | 1168 | {USB_DEVICE(0x041e, 0x4013), BS(SPCA504C, 0)}, |
diff --git a/drivers/media/video/gspca/t613.c b/drivers/media/video/gspca/t613.c index 8f0c33116e0d..a3eccd815766 100644 --- a/drivers/media/video/gspca/t613.c +++ b/drivers/media/video/gspca/t613.c | |||
@@ -1416,7 +1416,7 @@ static const struct sd_desc sd_desc = { | |||
1416 | }; | 1416 | }; |
1417 | 1417 | ||
1418 | /* -- module initialisation -- */ | 1418 | /* -- module initialisation -- */ |
1419 | static const __devinitdata struct usb_device_id device_table[] = { | 1419 | static const struct usb_device_id device_table[] = { |
1420 | {USB_DEVICE(0x17a1, 0x0128)}, | 1420 | {USB_DEVICE(0x17a1, 0x0128)}, |
1421 | {} | 1421 | {} |
1422 | }; | 1422 | }; |
diff --git a/drivers/media/video/gspca/tv8532.c b/drivers/media/video/gspca/tv8532.c index 38c22f0a4263..933ef2ca658c 100644 --- a/drivers/media/video/gspca/tv8532.c +++ b/drivers/media/video/gspca/tv8532.c | |||
@@ -388,7 +388,7 @@ static const struct sd_desc sd_desc = { | |||
388 | }; | 388 | }; |
389 | 389 | ||
390 | /* -- module initialisation -- */ | 390 | /* -- module initialisation -- */ |
391 | static const __devinitdata struct usb_device_id device_table[] = { | 391 | static const struct usb_device_id device_table[] = { |
392 | {USB_DEVICE(0x046d, 0x0920)}, | 392 | {USB_DEVICE(0x046d, 0x0920)}, |
393 | {USB_DEVICE(0x046d, 0x0921)}, | 393 | {USB_DEVICE(0x046d, 0x0921)}, |
394 | {USB_DEVICE(0x0545, 0x808b)}, | 394 | {USB_DEVICE(0x0545, 0x808b)}, |
diff --git a/drivers/media/video/gspca/vc032x.c b/drivers/media/video/gspca/vc032x.c index 9b2ae1b6cc75..6caed734a06a 100644 --- a/drivers/media/video/gspca/vc032x.c +++ b/drivers/media/video/gspca/vc032x.c | |||
@@ -4192,7 +4192,7 @@ static const struct sd_desc sd_desc = { | |||
4192 | #define BF(bridge, flags) \ | 4192 | #define BF(bridge, flags) \ |
4193 | .driver_info = (BRIDGE_ ## bridge << 8) \ | 4193 | .driver_info = (BRIDGE_ ## bridge << 8) \ |
4194 | | (flags) | 4194 | | (flags) |
4195 | static const __devinitdata struct usb_device_id device_table[] = { | 4195 | static const struct usb_device_id device_table[] = { |
4196 | {USB_DEVICE(0x041e, 0x405b), BF(VC0323, FL_VFLIP)}, | 4196 | {USB_DEVICE(0x041e, 0x405b), BF(VC0323, FL_VFLIP)}, |
4197 | {USB_DEVICE(0x046d, 0x0892), BF(VC0321, 0)}, | 4197 | {USB_DEVICE(0x046d, 0x0892), BF(VC0321, 0)}, |
4198 | {USB_DEVICE(0x046d, 0x0896), BF(VC0321, 0)}, | 4198 | {USB_DEVICE(0x046d, 0x0896), BF(VC0321, 0)}, |
diff --git a/drivers/media/video/gspca/xirlink_cit.c b/drivers/media/video/gspca/xirlink_cit.c index 5b5039a02031..c089a0f6f1d0 100644 --- a/drivers/media/video/gspca/xirlink_cit.c +++ b/drivers/media/video/gspca/xirlink_cit.c | |||
@@ -3270,7 +3270,7 @@ static const struct sd_desc sd_desc_isoc_nego = { | |||
3270 | }; | 3270 | }; |
3271 | 3271 | ||
3272 | /* -- module initialisation -- */ | 3272 | /* -- module initialisation -- */ |
3273 | static const __devinitdata struct usb_device_id device_table[] = { | 3273 | static const struct usb_device_id device_table[] = { |
3274 | { USB_DEVICE_VER(0x0545, 0x8080, 0x0001, 0x0001), .driver_info = CIT_MODEL0 }, | 3274 | { USB_DEVICE_VER(0x0545, 0x8080, 0x0001, 0x0001), .driver_info = CIT_MODEL0 }, |
3275 | { USB_DEVICE_VER(0x0545, 0x8080, 0x0002, 0x0002), .driver_info = CIT_MODEL1 }, | 3275 | { USB_DEVICE_VER(0x0545, 0x8080, 0x0002, 0x0002), .driver_info = CIT_MODEL1 }, |
3276 | { USB_DEVICE_VER(0x0545, 0x8080, 0x030a, 0x030a), .driver_info = CIT_MODEL2 }, | 3276 | { USB_DEVICE_VER(0x0545, 0x8080, 0x030a, 0x030a), .driver_info = CIT_MODEL2 }, |
diff --git a/drivers/media/video/gspca/zc3xx.c b/drivers/media/video/gspca/zc3xx.c index 14b85d483163..47236a58bf33 100644 --- a/drivers/media/video/gspca/zc3xx.c +++ b/drivers/media/video/gspca/zc3xx.c | |||
@@ -5793,7 +5793,7 @@ static void usb_exchange(struct gspca_dev *gspca_dev, | |||
5793 | break; | 5793 | break; |
5794 | default: | 5794 | default: |
5795 | /* case 0xdd: * delay */ | 5795 | /* case 0xdd: * delay */ |
5796 | msleep(action->val / 64 + 10); | 5796 | msleep(action->idx); |
5797 | break; | 5797 | break; |
5798 | } | 5798 | } |
5799 | action++; | 5799 | action++; |
@@ -5830,7 +5830,7 @@ static void setmatrix(struct gspca_dev *gspca_dev) | |||
5830 | [SENSOR_GC0305] = gc0305_matrix, | 5830 | [SENSOR_GC0305] = gc0305_matrix, |
5831 | [SENSOR_HDCS2020b] = NULL, | 5831 | [SENSOR_HDCS2020b] = NULL, |
5832 | [SENSOR_HV7131B] = NULL, | 5832 | [SENSOR_HV7131B] = NULL, |
5833 | [SENSOR_HV7131R] = NULL, | 5833 | [SENSOR_HV7131R] = po2030_matrix, |
5834 | [SENSOR_ICM105A] = po2030_matrix, | 5834 | [SENSOR_ICM105A] = po2030_matrix, |
5835 | [SENSOR_MC501CB] = NULL, | 5835 | [SENSOR_MC501CB] = NULL, |
5836 | [SENSOR_MT9V111_1] = gc0305_matrix, | 5836 | [SENSOR_MT9V111_1] = gc0305_matrix, |
@@ -5936,6 +5936,7 @@ static void setquality(struct gspca_dev *gspca_dev) | |||
5936 | case SENSOR_ADCM2700: | 5936 | case SENSOR_ADCM2700: |
5937 | case SENSOR_GC0305: | 5937 | case SENSOR_GC0305: |
5938 | case SENSOR_HV7131B: | 5938 | case SENSOR_HV7131B: |
5939 | case SENSOR_HV7131R: | ||
5939 | case SENSOR_OV7620: | 5940 | case SENSOR_OV7620: |
5940 | case SENSOR_PAS202B: | 5941 | case SENSOR_PAS202B: |
5941 | case SENSOR_PO2030: | 5942 | case SENSOR_PO2030: |
@@ -6108,11 +6109,13 @@ static void send_unknown(struct gspca_dev *gspca_dev, int sensor) | |||
6108 | reg_w(gspca_dev, 0x02, 0x003b); | 6109 | reg_w(gspca_dev, 0x02, 0x003b); |
6109 | reg_w(gspca_dev, 0x00, 0x0038); | 6110 | reg_w(gspca_dev, 0x00, 0x0038); |
6110 | break; | 6111 | break; |
6112 | case SENSOR_HV7131R: | ||
6111 | case SENSOR_PAS202B: | 6113 | case SENSOR_PAS202B: |
6112 | reg_w(gspca_dev, 0x03, 0x003b); | 6114 | reg_w(gspca_dev, 0x03, 0x003b); |
6113 | reg_w(gspca_dev, 0x0c, 0x003a); | 6115 | reg_w(gspca_dev, 0x0c, 0x003a); |
6114 | reg_w(gspca_dev, 0x0b, 0x0039); | 6116 | reg_w(gspca_dev, 0x0b, 0x0039); |
6115 | reg_w(gspca_dev, 0x0b, 0x0038); | 6117 | if (sensor == SENSOR_PAS202B) |
6118 | reg_w(gspca_dev, 0x0b, 0x0038); | ||
6116 | break; | 6119 | break; |
6117 | } | 6120 | } |
6118 | } | 6121 | } |
@@ -6704,10 +6707,13 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
6704 | reg_w(gspca_dev, 0x02, 0x003b); | 6707 | reg_w(gspca_dev, 0x02, 0x003b); |
6705 | reg_w(gspca_dev, 0x00, 0x0038); | 6708 | reg_w(gspca_dev, 0x00, 0x0038); |
6706 | break; | 6709 | break; |
6710 | case SENSOR_HV7131R: | ||
6707 | case SENSOR_PAS202B: | 6711 | case SENSOR_PAS202B: |
6708 | reg_w(gspca_dev, 0x03, 0x003b); | 6712 | reg_w(gspca_dev, 0x03, 0x003b); |
6709 | reg_w(gspca_dev, 0x0c, 0x003a); | 6713 | reg_w(gspca_dev, 0x0c, 0x003a); |
6710 | reg_w(gspca_dev, 0x0b, 0x0039); | 6714 | reg_w(gspca_dev, 0x0b, 0x0039); |
6715 | if (sd->sensor == SENSOR_HV7131R) | ||
6716 | reg_w(gspca_dev, 0x50, ZC3XX_R11D_GLOBALGAIN); | ||
6711 | break; | 6717 | break; |
6712 | } | 6718 | } |
6713 | 6719 | ||
@@ -6720,6 +6726,7 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
6720 | break; | 6726 | break; |
6721 | case SENSOR_PAS202B: | 6727 | case SENSOR_PAS202B: |
6722 | case SENSOR_GC0305: | 6728 | case SENSOR_GC0305: |
6729 | case SENSOR_HV7131R: | ||
6723 | case SENSOR_TAS5130C: | 6730 | case SENSOR_TAS5130C: |
6724 | reg_r(gspca_dev, 0x0008); | 6731 | reg_r(gspca_dev, 0x0008); |
6725 | /* fall thru */ | 6732 | /* fall thru */ |
@@ -6760,6 +6767,12 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
6760 | /* ms-win + */ | 6767 | /* ms-win + */ |
6761 | reg_w(gspca_dev, 0x40, 0x0117); | 6768 | reg_w(gspca_dev, 0x40, 0x0117); |
6762 | break; | 6769 | break; |
6770 | case SENSOR_HV7131R: | ||
6771 | i2c_write(gspca_dev, 0x25, 0x04, 0x00); /* exposure */ | ||
6772 | i2c_write(gspca_dev, 0x26, 0x93, 0x00); | ||
6773 | i2c_write(gspca_dev, 0x27, 0xe0, 0x00); | ||
6774 | reg_w(gspca_dev, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN); | ||
6775 | break; | ||
6763 | case SENSOR_GC0305: | 6776 | case SENSOR_GC0305: |
6764 | case SENSOR_TAS5130C: | 6777 | case SENSOR_TAS5130C: |
6765 | reg_w(gspca_dev, 0x09, 0x01ad); /* (from win traces) */ | 6778 | reg_w(gspca_dev, 0x09, 0x01ad); /* (from win traces) */ |
@@ -6808,9 +6821,17 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
6808 | { | 6821 | { |
6809 | struct sd *sd = (struct sd *) gspca_dev; | 6822 | struct sd *sd = (struct sd *) gspca_dev; |
6810 | 6823 | ||
6811 | if (data[0] == 0xff && data[1] == 0xd8) { /* start of frame */ | 6824 | /* check the JPEG end of frame */ |
6825 | if (len >= 3 | ||
6826 | && data[len - 3] == 0xff && data[len - 2] == 0xd9) { | ||
6827 | /*fixme: what does the last byte mean?*/ | ||
6812 | gspca_frame_add(gspca_dev, LAST_PACKET, | 6828 | gspca_frame_add(gspca_dev, LAST_PACKET, |
6813 | NULL, 0); | 6829 | data, len - 1); |
6830 | return; | ||
6831 | } | ||
6832 | |||
6833 | /* check the JPEG start of a frame */ | ||
6834 | if (data[0] == 0xff && data[1] == 0xd8) { | ||
6814 | /* put the JPEG header in the new frame */ | 6835 | /* put the JPEG header in the new frame */ |
6815 | gspca_frame_add(gspca_dev, FIRST_PACKET, | 6836 | gspca_frame_add(gspca_dev, FIRST_PACKET, |
6816 | sd->jpeg_hdr, JPEG_HDR_SZ); | 6837 | sd->jpeg_hdr, JPEG_HDR_SZ); |
@@ -6909,7 +6930,7 @@ static const struct sd_desc sd_desc = { | |||
6909 | #endif | 6930 | #endif |
6910 | }; | 6931 | }; |
6911 | 6932 | ||
6912 | static const __devinitdata struct usb_device_id device_table[] = { | 6933 | static const struct usb_device_id device_table[] = { |
6913 | {USB_DEVICE(0x041e, 0x041e)}, | 6934 | {USB_DEVICE(0x041e, 0x041e)}, |
6914 | {USB_DEVICE(0x041e, 0x4017)}, | 6935 | {USB_DEVICE(0x041e, 0x4017)}, |
6915 | {USB_DEVICE(0x041e, 0x401c), .driver_info = SENSOR_PAS106}, | 6936 | {USB_DEVICE(0x041e, 0x401c), .driver_info = SENSOR_PAS106}, |
diff --git a/drivers/media/video/hdpvr/Makefile b/drivers/media/video/hdpvr/Makefile index e0230fcb2e36..3baa9f613ca3 100644 --- a/drivers/media/video/hdpvr/Makefile +++ b/drivers/media/video/hdpvr/Makefile | |||
@@ -1,6 +1,4 @@ | |||
1 | hdpvr-objs := hdpvr-control.o hdpvr-core.o hdpvr-video.o | 1 | hdpvr-objs := hdpvr-control.o hdpvr-core.o hdpvr-video.o hdpvr-i2c.o |
2 | |||
3 | hdpvr-$(CONFIG_I2C) += hdpvr-i2c.o | ||
4 | 2 | ||
5 | obj-$(CONFIG_VIDEO_HDPVR) += hdpvr.o | 3 | obj-$(CONFIG_VIDEO_HDPVR) += hdpvr.o |
6 | 4 | ||
diff --git a/drivers/media/video/hdpvr/hdpvr-core.c b/drivers/media/video/hdpvr/hdpvr-core.c index f7d1ee55185a..a27d93b503a5 100644 --- a/drivers/media/video/hdpvr/hdpvr-core.c +++ b/drivers/media/video/hdpvr/hdpvr-core.c | |||
@@ -283,6 +283,7 @@ static int hdpvr_probe(struct usb_interface *interface, | |||
283 | struct hdpvr_device *dev; | 283 | struct hdpvr_device *dev; |
284 | struct usb_host_interface *iface_desc; | 284 | struct usb_host_interface *iface_desc; |
285 | struct usb_endpoint_descriptor *endpoint; | 285 | struct usb_endpoint_descriptor *endpoint; |
286 | struct i2c_client *client; | ||
286 | size_t buffer_size; | 287 | size_t buffer_size; |
287 | int i; | 288 | int i; |
288 | int retval = -ENOMEM; | 289 | int retval = -ENOMEM; |
@@ -378,25 +379,35 @@ static int hdpvr_probe(struct usb_interface *interface, | |||
378 | goto error; | 379 | goto error; |
379 | } | 380 | } |
380 | 381 | ||
381 | #ifdef CONFIG_I2C | 382 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) |
382 | /* until i2c is working properly */ | 383 | retval = hdpvr_register_i2c_adapter(dev); |
383 | retval = 0; /* hdpvr_register_i2c_adapter(dev); */ | ||
384 | if (retval < 0) { | 384 | if (retval < 0) { |
385 | v4l2_err(&dev->v4l2_dev, "registering i2c adapter failed\n"); | 385 | v4l2_err(&dev->v4l2_dev, "i2c adapter register failed\n"); |
386 | goto error; | 386 | goto error; |
387 | } | 387 | } |
388 | 388 | ||
389 | /* until i2c is working properly */ | 389 | client = hdpvr_register_ir_rx_i2c(dev); |
390 | retval = 0; /* hdpvr_register_i2c_ir(dev); */ | 390 | if (!client) { |
391 | if (retval < 0) | 391 | v4l2_err(&dev->v4l2_dev, "i2c IR RX device register failed\n"); |
392 | v4l2_err(&dev->v4l2_dev, "registering i2c IR devices failed\n"); | 392 | goto reg_fail; |
393 | #endif /* CONFIG_I2C */ | 393 | } |
394 | |||
395 | client = hdpvr_register_ir_tx_i2c(dev); | ||
396 | if (!client) { | ||
397 | v4l2_err(&dev->v4l2_dev, "i2c IR TX device register failed\n"); | ||
398 | goto reg_fail; | ||
399 | } | ||
400 | #endif | ||
394 | 401 | ||
395 | /* let the user know what node this device is now attached to */ | 402 | /* let the user know what node this device is now attached to */ |
396 | v4l2_info(&dev->v4l2_dev, "device now attached to %s\n", | 403 | v4l2_info(&dev->v4l2_dev, "device now attached to %s\n", |
397 | video_device_node_name(dev->video_dev)); | 404 | video_device_node_name(dev->video_dev)); |
398 | return 0; | 405 | return 0; |
399 | 406 | ||
407 | reg_fail: | ||
408 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) | ||
409 | i2c_del_adapter(&dev->i2c_adapter); | ||
410 | #endif | ||
400 | error: | 411 | error: |
401 | if (dev) { | 412 | if (dev) { |
402 | /* Destroy single thread */ | 413 | /* Destroy single thread */ |
@@ -426,6 +437,9 @@ static void hdpvr_disconnect(struct usb_interface *interface) | |||
426 | mutex_lock(&dev->io_mutex); | 437 | mutex_lock(&dev->io_mutex); |
427 | hdpvr_cancel_queue(dev); | 438 | hdpvr_cancel_queue(dev); |
428 | mutex_unlock(&dev->io_mutex); | 439 | mutex_unlock(&dev->io_mutex); |
440 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) | ||
441 | i2c_del_adapter(&dev->i2c_adapter); | ||
442 | #endif | ||
429 | video_unregister_device(dev->video_dev); | 443 | video_unregister_device(dev->video_dev); |
430 | atomic_dec(&dev_nr); | 444 | atomic_dec(&dev_nr); |
431 | } | 445 | } |
diff --git a/drivers/media/video/hdpvr/hdpvr-i2c.c b/drivers/media/video/hdpvr/hdpvr-i2c.c index 24966aa02a70..e53fa55d56a1 100644 --- a/drivers/media/video/hdpvr/hdpvr-i2c.c +++ b/drivers/media/video/hdpvr/hdpvr-i2c.c | |||
@@ -13,6 +13,8 @@ | |||
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) | ||
17 | |||
16 | #include <linux/i2c.h> | 18 | #include <linux/i2c.h> |
17 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
18 | 20 | ||
@@ -28,106 +30,86 @@ | |||
28 | #define Z8F0811_IR_TX_I2C_ADDR 0x70 | 30 | #define Z8F0811_IR_TX_I2C_ADDR 0x70 |
29 | #define Z8F0811_IR_RX_I2C_ADDR 0x71 | 31 | #define Z8F0811_IR_RX_I2C_ADDR 0x71 |
30 | 32 | ||
31 | static const u8 ir_i2c_addrs[] = { | ||
32 | Z8F0811_IR_TX_I2C_ADDR, | ||
33 | Z8F0811_IR_RX_I2C_ADDR, | ||
34 | }; | ||
35 | |||
36 | static const char * const ir_devicenames[] = { | ||
37 | "ir_tx_z8f0811_hdpvr", | ||
38 | "ir_rx_z8f0811_hdpvr", | ||
39 | }; | ||
40 | 33 | ||
41 | static int hdpvr_new_i2c_ir(struct hdpvr_device *dev, struct i2c_adapter *adap, | 34 | struct i2c_client *hdpvr_register_ir_tx_i2c(struct hdpvr_device *dev) |
42 | const char *type, u8 addr) | ||
43 | { | 35 | { |
44 | struct i2c_board_info info; | ||
45 | struct IR_i2c_init_data *init_data = &dev->ir_i2c_init_data; | 36 | struct IR_i2c_init_data *init_data = &dev->ir_i2c_init_data; |
46 | unsigned short addr_list[2] = { addr, I2C_CLIENT_END }; | 37 | struct i2c_board_info hdpvr_ir_tx_i2c_board_info = { |
38 | I2C_BOARD_INFO("ir_tx_z8f0811_hdpvr", Z8F0811_IR_TX_I2C_ADDR), | ||
39 | }; | ||
47 | 40 | ||
48 | memset(&info, 0, sizeof(struct i2c_board_info)); | 41 | init_data->name = "HD-PVR"; |
49 | strlcpy(info.type, type, I2C_NAME_SIZE); | 42 | hdpvr_ir_tx_i2c_board_info.platform_data = init_data; |
50 | |||
51 | /* Our default information for ir-kbd-i2c.c to use */ | ||
52 | switch (addr) { | ||
53 | case Z8F0811_IR_RX_I2C_ADDR: | ||
54 | init_data->ir_codes = RC_MAP_HAUPPAUGE_NEW; | ||
55 | init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; | ||
56 | init_data->type = RC_TYPE_RC5; | ||
57 | init_data->name = "HD PVR"; | ||
58 | info.platform_data = init_data; | ||
59 | break; | ||
60 | } | ||
61 | 43 | ||
62 | return i2c_new_probed_device(adap, &info, addr_list, NULL) == NULL ? | 44 | return i2c_new_device(&dev->i2c_adapter, &hdpvr_ir_tx_i2c_board_info); |
63 | -1 : 0; | ||
64 | } | 45 | } |
65 | 46 | ||
66 | int hdpvr_register_i2c_ir(struct hdpvr_device *dev) | 47 | struct i2c_client *hdpvr_register_ir_rx_i2c(struct hdpvr_device *dev) |
67 | { | 48 | { |
68 | int i; | 49 | struct IR_i2c_init_data *init_data = &dev->ir_i2c_init_data; |
69 | int ret = 0; | 50 | struct i2c_board_info hdpvr_ir_rx_i2c_board_info = { |
51 | I2C_BOARD_INFO("ir_rx_z8f0811_hdpvr", Z8F0811_IR_RX_I2C_ADDR), | ||
52 | }; | ||
70 | 53 | ||
71 | for (i = 0; i < ARRAY_SIZE(ir_i2c_addrs); i++) | 54 | /* Our default information for ir-kbd-i2c.c to use */ |
72 | ret += hdpvr_new_i2c_ir(dev, dev->i2c_adapter, | 55 | init_data->ir_codes = RC_MAP_HAUPPAUGE_NEW; |
73 | ir_devicenames[i], ir_i2c_addrs[i]); | 56 | init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; |
57 | init_data->type = RC_TYPE_RC5; | ||
58 | init_data->name = "HD-PVR"; | ||
59 | hdpvr_ir_rx_i2c_board_info.platform_data = init_data; | ||
74 | 60 | ||
75 | return ret; | 61 | return i2c_new_device(&dev->i2c_adapter, &hdpvr_ir_rx_i2c_board_info); |
76 | } | 62 | } |
77 | 63 | ||
78 | static int hdpvr_i2c_read(struct hdpvr_device *dev, unsigned char addr, | 64 | static int hdpvr_i2c_read(struct hdpvr_device *dev, int bus, |
79 | char *data, int len) | 65 | unsigned char addr, char *data, int len) |
80 | { | 66 | { |
81 | int ret; | 67 | int ret; |
82 | char *buf = kmalloc(len, GFP_KERNEL); | 68 | |
83 | if (!buf) | 69 | if (len > sizeof(dev->i2c_buf)) |
84 | return -ENOMEM; | 70 | return -EINVAL; |
85 | 71 | ||
86 | ret = usb_control_msg(dev->udev, | 72 | ret = usb_control_msg(dev->udev, |
87 | usb_rcvctrlpipe(dev->udev, 0), | 73 | usb_rcvctrlpipe(dev->udev, 0), |
88 | REQTYPE_I2C_READ, CTRL_READ_REQUEST, | 74 | REQTYPE_I2C_READ, CTRL_READ_REQUEST, |
89 | 0x100|addr, 0, buf, len, 1000); | 75 | (bus << 8) | addr, 0, &dev->i2c_buf, len, 1000); |
90 | 76 | ||
91 | if (ret == len) { | 77 | if (ret == len) { |
92 | memcpy(data, buf, len); | 78 | memcpy(data, &dev->i2c_buf, len); |
93 | ret = 0; | 79 | ret = 0; |
94 | } else if (ret >= 0) | 80 | } else if (ret >= 0) |
95 | ret = -EIO; | 81 | ret = -EIO; |
96 | 82 | ||
97 | kfree(buf); | ||
98 | |||
99 | return ret; | 83 | return ret; |
100 | } | 84 | } |
101 | 85 | ||
102 | static int hdpvr_i2c_write(struct hdpvr_device *dev, unsigned char addr, | 86 | static int hdpvr_i2c_write(struct hdpvr_device *dev, int bus, |
103 | char *data, int len) | 87 | unsigned char addr, char *data, int len) |
104 | { | 88 | { |
105 | int ret; | 89 | int ret; |
106 | char *buf = kmalloc(len, GFP_KERNEL); | ||
107 | if (!buf) | ||
108 | return -ENOMEM; | ||
109 | 90 | ||
110 | memcpy(buf, data, len); | 91 | if (len > sizeof(dev->i2c_buf)) |
92 | return -EINVAL; | ||
93 | |||
94 | memcpy(&dev->i2c_buf, data, len); | ||
111 | ret = usb_control_msg(dev->udev, | 95 | ret = usb_control_msg(dev->udev, |
112 | usb_sndctrlpipe(dev->udev, 0), | 96 | usb_sndctrlpipe(dev->udev, 0), |
113 | REQTYPE_I2C_WRITE, CTRL_WRITE_REQUEST, | 97 | REQTYPE_I2C_WRITE, CTRL_WRITE_REQUEST, |
114 | 0x100|addr, 0, buf, len, 1000); | 98 | (bus << 8) | addr, 0, &dev->i2c_buf, len, 1000); |
115 | 99 | ||
116 | if (ret < 0) | 100 | if (ret < 0) |
117 | goto error; | 101 | return ret; |
118 | 102 | ||
119 | ret = usb_control_msg(dev->udev, | 103 | ret = usb_control_msg(dev->udev, |
120 | usb_rcvctrlpipe(dev->udev, 0), | 104 | usb_rcvctrlpipe(dev->udev, 0), |
121 | REQTYPE_I2C_WRITE_STATT, CTRL_READ_REQUEST, | 105 | REQTYPE_I2C_WRITE_STATT, CTRL_READ_REQUEST, |
122 | 0, 0, buf, 2, 1000); | 106 | 0, 0, &dev->i2c_buf, 2, 1000); |
123 | 107 | ||
124 | if (ret == 2) | 108 | if ((ret == 2) && (dev->i2c_buf[1] == (len - 1))) |
125 | ret = 0; | 109 | ret = 0; |
126 | else if (ret >= 0) | 110 | else if (ret >= 0) |
127 | ret = -EIO; | 111 | ret = -EIO; |
128 | 112 | ||
129 | error: | ||
130 | kfree(buf); | ||
131 | return ret; | 113 | return ret; |
132 | } | 114 | } |
133 | 115 | ||
@@ -146,10 +128,10 @@ static int hdpvr_transfer(struct i2c_adapter *i2c_adapter, struct i2c_msg *msgs, | |||
146 | addr = msgs[i].addr << 1; | 128 | addr = msgs[i].addr << 1; |
147 | 129 | ||
148 | if (msgs[i].flags & I2C_M_RD) | 130 | if (msgs[i].flags & I2C_M_RD) |
149 | retval = hdpvr_i2c_read(dev, addr, msgs[i].buf, | 131 | retval = hdpvr_i2c_read(dev, 1, addr, msgs[i].buf, |
150 | msgs[i].len); | 132 | msgs[i].len); |
151 | else | 133 | else |
152 | retval = hdpvr_i2c_write(dev, addr, msgs[i].buf, | 134 | retval = hdpvr_i2c_write(dev, 1, addr, msgs[i].buf, |
153 | msgs[i].len); | 135 | msgs[i].len); |
154 | } | 136 | } |
155 | 137 | ||
@@ -168,30 +150,47 @@ static struct i2c_algorithm hdpvr_algo = { | |||
168 | .functionality = hdpvr_functionality, | 150 | .functionality = hdpvr_functionality, |
169 | }; | 151 | }; |
170 | 152 | ||
153 | static struct i2c_adapter hdpvr_i2c_adapter_template = { | ||
154 | .name = "Hauppage HD PVR I2C", | ||
155 | .owner = THIS_MODULE, | ||
156 | .algo = &hdpvr_algo, | ||
157 | }; | ||
158 | |||
159 | static int hdpvr_activate_ir(struct hdpvr_device *dev) | ||
160 | { | ||
161 | char buffer[8]; | ||
162 | |||
163 | mutex_lock(&dev->i2c_mutex); | ||
164 | |||
165 | hdpvr_i2c_read(dev, 0, 0x54, buffer, 1); | ||
166 | |||
167 | buffer[0] = 0; | ||
168 | buffer[1] = 0x8; | ||
169 | hdpvr_i2c_write(dev, 1, 0x54, buffer, 2); | ||
170 | |||
171 | buffer[1] = 0x18; | ||
172 | hdpvr_i2c_write(dev, 1, 0x54, buffer, 2); | ||
173 | |||
174 | mutex_unlock(&dev->i2c_mutex); | ||
175 | |||
176 | return 0; | ||
177 | } | ||
178 | |||
171 | int hdpvr_register_i2c_adapter(struct hdpvr_device *dev) | 179 | int hdpvr_register_i2c_adapter(struct hdpvr_device *dev) |
172 | { | 180 | { |
173 | struct i2c_adapter *i2c_adap; | ||
174 | int retval = -ENOMEM; | 181 | int retval = -ENOMEM; |
175 | 182 | ||
176 | i2c_adap = kzalloc(sizeof(struct i2c_adapter), GFP_KERNEL); | 183 | hdpvr_activate_ir(dev); |
177 | if (i2c_adap == NULL) | ||
178 | goto error; | ||
179 | |||
180 | strlcpy(i2c_adap->name, "Hauppauge HD PVR I2C", | ||
181 | sizeof(i2c_adap->name)); | ||
182 | i2c_adap->algo = &hdpvr_algo; | ||
183 | i2c_adap->owner = THIS_MODULE; | ||
184 | i2c_adap->dev.parent = &dev->udev->dev; | ||
185 | 184 | ||
186 | i2c_set_adapdata(i2c_adap, dev); | 185 | memcpy(&dev->i2c_adapter, &hdpvr_i2c_adapter_template, |
186 | sizeof(struct i2c_adapter)); | ||
187 | dev->i2c_adapter.dev.parent = &dev->udev->dev; | ||
187 | 188 | ||
188 | retval = i2c_add_adapter(i2c_adap); | 189 | i2c_set_adapdata(&dev->i2c_adapter, dev); |
189 | 190 | ||
190 | if (!retval) | 191 | retval = i2c_add_adapter(&dev->i2c_adapter); |
191 | dev->i2c_adapter = i2c_adap; | ||
192 | else | ||
193 | kfree(i2c_adap); | ||
194 | 192 | ||
195 | error: | ||
196 | return retval; | 193 | return retval; |
197 | } | 194 | } |
195 | |||
196 | #endif | ||
diff --git a/drivers/media/video/hdpvr/hdpvr-video.c b/drivers/media/video/hdpvr/hdpvr-video.c index d38fe1043e47..514aea76eaa5 100644 --- a/drivers/media/video/hdpvr/hdpvr-video.c +++ b/drivers/media/video/hdpvr/hdpvr-video.c | |||
@@ -1220,12 +1220,9 @@ static void hdpvr_device_release(struct video_device *vdev) | |||
1220 | v4l2_device_unregister(&dev->v4l2_dev); | 1220 | v4l2_device_unregister(&dev->v4l2_dev); |
1221 | 1221 | ||
1222 | /* deregister I2C adapter */ | 1222 | /* deregister I2C adapter */ |
1223 | #ifdef CONFIG_I2C | 1223 | #if defined(CONFIG_I2C) || (CONFIG_I2C_MODULE) |
1224 | mutex_lock(&dev->i2c_mutex); | 1224 | mutex_lock(&dev->i2c_mutex); |
1225 | if (dev->i2c_adapter) | 1225 | i2c_del_adapter(&dev->i2c_adapter); |
1226 | i2c_del_adapter(dev->i2c_adapter); | ||
1227 | kfree(dev->i2c_adapter); | ||
1228 | dev->i2c_adapter = NULL; | ||
1229 | mutex_unlock(&dev->i2c_mutex); | 1226 | mutex_unlock(&dev->i2c_mutex); |
1230 | #endif /* CONFIG_I2C */ | 1227 | #endif /* CONFIG_I2C */ |
1231 | 1228 | ||
diff --git a/drivers/media/video/hdpvr/hdpvr.h b/drivers/media/video/hdpvr/hdpvr.h index 37f1e4c7675d..072f23c570f3 100644 --- a/drivers/media/video/hdpvr/hdpvr.h +++ b/drivers/media/video/hdpvr/hdpvr.h | |||
@@ -25,6 +25,7 @@ | |||
25 | KERNEL_VERSION(HDPVR_MAJOR_VERSION, HDPVR_MINOR_VERSION, HDPVR_RELEASE) | 25 | KERNEL_VERSION(HDPVR_MAJOR_VERSION, HDPVR_MINOR_VERSION, HDPVR_RELEASE) |
26 | 26 | ||
27 | #define HDPVR_MAX 8 | 27 | #define HDPVR_MAX 8 |
28 | #define HDPVR_I2C_MAX_SIZE 128 | ||
28 | 29 | ||
29 | /* Define these values to match your devices */ | 30 | /* Define these values to match your devices */ |
30 | #define HD_PVR_VENDOR_ID 0x2040 | 31 | #define HD_PVR_VENDOR_ID 0x2040 |
@@ -106,9 +107,11 @@ struct hdpvr_device { | |||
106 | struct work_struct worker; | 107 | struct work_struct worker; |
107 | 108 | ||
108 | /* I2C adapter */ | 109 | /* I2C adapter */ |
109 | struct i2c_adapter *i2c_adapter; | 110 | struct i2c_adapter i2c_adapter; |
110 | /* I2C lock */ | 111 | /* I2C lock */ |
111 | struct mutex i2c_mutex; | 112 | struct mutex i2c_mutex; |
113 | /* I2C message buffer space */ | ||
114 | char i2c_buf[HDPVR_I2C_MAX_SIZE]; | ||
112 | 115 | ||
113 | /* For passing data to ir-kbd-i2c */ | 116 | /* For passing data to ir-kbd-i2c */ |
114 | struct IR_i2c_init_data ir_i2c_init_data; | 117 | struct IR_i2c_init_data ir_i2c_init_data; |
@@ -310,7 +313,8 @@ int hdpvr_cancel_queue(struct hdpvr_device *dev); | |||
310 | /* i2c adapter registration */ | 313 | /* i2c adapter registration */ |
311 | int hdpvr_register_i2c_adapter(struct hdpvr_device *dev); | 314 | int hdpvr_register_i2c_adapter(struct hdpvr_device *dev); |
312 | 315 | ||
313 | int hdpvr_register_i2c_ir(struct hdpvr_device *dev); | 316 | struct i2c_client *hdpvr_register_ir_rx_i2c(struct hdpvr_device *dev); |
317 | struct i2c_client *hdpvr_register_ir_tx_i2c(struct hdpvr_device *dev); | ||
314 | 318 | ||
315 | /*========================================================================*/ | 319 | /*========================================================================*/ |
316 | /* buffer management */ | 320 | /* buffer management */ |
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index c87b6bc45555..a221ad68b330 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c | |||
@@ -128,6 +128,19 @@ static int get_key_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | |||
128 | 128 | ||
129 | static int get_key_haup_xvr(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | 129 | static int get_key_haup_xvr(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) |
130 | { | 130 | { |
131 | int ret; | ||
132 | unsigned char buf[1] = { 0 }; | ||
133 | |||
134 | /* | ||
135 | * This is the same apparent "are you ready?" poll command observed | ||
136 | * watching Windows driver traffic and implemented in lirc_zilog. With | ||
137 | * this added, we get far saner remote behavior with z8 chips on usb | ||
138 | * connected devices, even with the default polling interval of 100ms. | ||
139 | */ | ||
140 | ret = i2c_master_send(ir->c, buf, 1); | ||
141 | if (ret != 1) | ||
142 | return (ret < 0) ? ret : -EINVAL; | ||
143 | |||
131 | return get_key_haup_common (ir, ir_key, ir_raw, 6, 3); | 144 | return get_key_haup_common (ir, ir_key, ir_raw, 6, 3); |
132 | } | 145 | } |
133 | 146 | ||
@@ -244,15 +257,17 @@ static void ir_key_poll(struct IR_i2c *ir) | |||
244 | static u32 ir_key, ir_raw; | 257 | static u32 ir_key, ir_raw; |
245 | int rc; | 258 | int rc; |
246 | 259 | ||
247 | dprintk(2,"ir_poll_key\n"); | 260 | dprintk(3, "%s\n", __func__); |
248 | rc = ir->get_key(ir, &ir_key, &ir_raw); | 261 | rc = ir->get_key(ir, &ir_key, &ir_raw); |
249 | if (rc < 0) { | 262 | if (rc < 0) { |
250 | dprintk(2,"error\n"); | 263 | dprintk(2,"error\n"); |
251 | return; | 264 | return; |
252 | } | 265 | } |
253 | 266 | ||
254 | if (rc) | 267 | if (rc) { |
268 | dprintk(1, "%s: keycode = 0x%04x\n", __func__, ir_key); | ||
255 | rc_keydown(ir->rc, ir_key, 0); | 269 | rc_keydown(ir->rc, ir_key, 0); |
270 | } | ||
256 | } | 271 | } |
257 | 272 | ||
258 | static void ir_work(struct work_struct *work) | 273 | static void ir_work(struct work_struct *work) |
@@ -321,6 +336,12 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
321 | rc_type = RC_TYPE_OTHER; | 336 | rc_type = RC_TYPE_OTHER; |
322 | ir_codes = RC_MAP_AVERMEDIA_CARDBUS; | 337 | ir_codes = RC_MAP_AVERMEDIA_CARDBUS; |
323 | break; | 338 | break; |
339 | case 0x71: | ||
340 | name = "Hauppauge/Zilog Z8"; | ||
341 | ir->get_key = get_key_haup_xvr; | ||
342 | rc_type = RC_TYPE_RC5; | ||
343 | ir_codes = hauppauge ? RC_MAP_HAUPPAUGE_NEW : RC_MAP_RC5_TV; | ||
344 | break; | ||
324 | } | 345 | } |
325 | 346 | ||
326 | /* Let the caller override settings */ | 347 | /* Let the caller override settings */ |
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c index e103b8fc7452..9fb86a081c0f 100644 --- a/drivers/media/video/ivtv/ivtv-i2c.c +++ b/drivers/media/video/ivtv/ivtv-i2c.c | |||
@@ -300,10 +300,15 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx) | |||
300 | adap, type, 0, I2C_ADDRS(hw_addrs[idx])); | 300 | adap, type, 0, I2C_ADDRS(hw_addrs[idx])); |
301 | } else if (hw == IVTV_HW_CX25840) { | 301 | } else if (hw == IVTV_HW_CX25840) { |
302 | struct cx25840_platform_data pdata; | 302 | struct cx25840_platform_data pdata; |
303 | struct i2c_board_info cx25840_info = { | ||
304 | .type = "cx25840", | ||
305 | .addr = hw_addrs[idx], | ||
306 | .platform_data = &pdata, | ||
307 | }; | ||
303 | 308 | ||
304 | pdata.pvr150_workaround = itv->pvr150_workaround; | 309 | pdata.pvr150_workaround = itv->pvr150_workaround; |
305 | sd = v4l2_i2c_new_subdev_cfg(&itv->v4l2_dev, | 310 | sd = v4l2_i2c_new_subdev_board(&itv->v4l2_dev, adap, |
306 | adap, type, 0, &pdata, hw_addrs[idx], NULL); | 311 | &cx25840_info, NULL); |
307 | } else { | 312 | } else { |
308 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, | 313 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, |
309 | adap, type, hw_addrs[idx], NULL); | 314 | adap, type, hw_addrs[idx], NULL); |
diff --git a/drivers/media/video/mt9v011.c b/drivers/media/video/mt9v011.c index 209ff97261a9..4904d25f689f 100644 --- a/drivers/media/video/mt9v011.c +++ b/drivers/media/video/mt9v011.c | |||
@@ -12,17 +12,41 @@ | |||
12 | #include <asm/div64.h> | 12 | #include <asm/div64.h> |
13 | #include <media/v4l2-device.h> | 13 | #include <media/v4l2-device.h> |
14 | #include <media/v4l2-chip-ident.h> | 14 | #include <media/v4l2-chip-ident.h> |
15 | #include "mt9v011.h" | 15 | #include <media/mt9v011.h> |
16 | 16 | ||
17 | MODULE_DESCRIPTION("Micron mt9v011 sensor driver"); | 17 | MODULE_DESCRIPTION("Micron mt9v011 sensor driver"); |
18 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | 18 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); |
19 | MODULE_LICENSE("GPL"); | 19 | MODULE_LICENSE("GPL"); |
20 | 20 | ||
21 | |||
22 | static int debug; | 21 | static int debug; |
23 | module_param(debug, int, 0); | 22 | module_param(debug, int, 0); |
24 | MODULE_PARM_DESC(debug, "Debug level (0-2)"); | 23 | MODULE_PARM_DESC(debug, "Debug level (0-2)"); |
25 | 24 | ||
25 | #define R00_MT9V011_CHIP_VERSION 0x00 | ||
26 | #define R01_MT9V011_ROWSTART 0x01 | ||
27 | #define R02_MT9V011_COLSTART 0x02 | ||
28 | #define R03_MT9V011_HEIGHT 0x03 | ||
29 | #define R04_MT9V011_WIDTH 0x04 | ||
30 | #define R05_MT9V011_HBLANK 0x05 | ||
31 | #define R06_MT9V011_VBLANK 0x06 | ||
32 | #define R07_MT9V011_OUT_CTRL 0x07 | ||
33 | #define R09_MT9V011_SHUTTER_WIDTH 0x09 | ||
34 | #define R0A_MT9V011_CLK_SPEED 0x0a | ||
35 | #define R0B_MT9V011_RESTART 0x0b | ||
36 | #define R0C_MT9V011_SHUTTER_DELAY 0x0c | ||
37 | #define R0D_MT9V011_RESET 0x0d | ||
38 | #define R1E_MT9V011_DIGITAL_ZOOM 0x1e | ||
39 | #define R20_MT9V011_READ_MODE 0x20 | ||
40 | #define R2B_MT9V011_GREEN_1_GAIN 0x2b | ||
41 | #define R2C_MT9V011_BLUE_GAIN 0x2c | ||
42 | #define R2D_MT9V011_RED_GAIN 0x2d | ||
43 | #define R2E_MT9V011_GREEN_2_GAIN 0x2e | ||
44 | #define R35_MT9V011_GLOBAL_GAIN 0x35 | ||
45 | #define RF1_MT9V011_CHIP_ENABLE 0xf1 | ||
46 | |||
47 | #define MT9V011_VERSION 0x8232 | ||
48 | #define MT9V011_REV_B_VERSION 0x8243 | ||
49 | |||
26 | /* supported controls */ | 50 | /* supported controls */ |
27 | static struct v4l2_queryctrl mt9v011_qctrl[] = { | 51 | static struct v4l2_queryctrl mt9v011_qctrl[] = { |
28 | { | 52 | { |
@@ -469,23 +493,6 @@ static int mt9v011_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt | |||
469 | return 0; | 493 | return 0; |
470 | } | 494 | } |
471 | 495 | ||
472 | static int mt9v011_s_config(struct v4l2_subdev *sd, int dumb, void *data) | ||
473 | { | ||
474 | struct mt9v011 *core = to_mt9v011(sd); | ||
475 | unsigned *xtal = data; | ||
476 | |||
477 | v4l2_dbg(1, debug, sd, "s_config called\n"); | ||
478 | |||
479 | if (xtal) { | ||
480 | core->xtal = *xtal; | ||
481 | v4l2_dbg(1, debug, sd, "xtal set to %d.%03d MHz\n", | ||
482 | *xtal / 1000000, (*xtal / 1000) % 1000); | ||
483 | } | ||
484 | |||
485 | return 0; | ||
486 | } | ||
487 | |||
488 | |||
489 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 496 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
490 | static int mt9v011_g_register(struct v4l2_subdev *sd, | 497 | static int mt9v011_g_register(struct v4l2_subdev *sd, |
491 | struct v4l2_dbg_register *reg) | 498 | struct v4l2_dbg_register *reg) |
@@ -536,7 +543,6 @@ static const struct v4l2_subdev_core_ops mt9v011_core_ops = { | |||
536 | .g_ctrl = mt9v011_g_ctrl, | 543 | .g_ctrl = mt9v011_g_ctrl, |
537 | .s_ctrl = mt9v011_s_ctrl, | 544 | .s_ctrl = mt9v011_s_ctrl, |
538 | .reset = mt9v011_reset, | 545 | .reset = mt9v011_reset, |
539 | .s_config = mt9v011_s_config, | ||
540 | .g_chip_ident = mt9v011_g_chip_ident, | 546 | .g_chip_ident = mt9v011_g_chip_ident, |
541 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 547 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
542 | .g_register = mt9v011_g_register, | 548 | .g_register = mt9v011_g_register, |
@@ -596,6 +602,14 @@ static int mt9v011_probe(struct i2c_client *c, | |||
596 | core->height = 480; | 602 | core->height = 480; |
597 | core->xtal = 27000000; /* Hz */ | 603 | core->xtal = 27000000; /* Hz */ |
598 | 604 | ||
605 | if (c->dev.platform_data) { | ||
606 | struct mt9v011_platform_data *pdata = c->dev.platform_data; | ||
607 | |||
608 | core->xtal = pdata->xtal; | ||
609 | v4l2_dbg(1, debug, sd, "xtal set to %d.%03d MHz\n", | ||
610 | core->xtal / 1000000, (core->xtal / 1000) % 1000); | ||
611 | } | ||
612 | |||
599 | v4l_info(c, "chip found @ 0x%02x (%s - chip version 0x%04x)\n", | 613 | v4l_info(c, "chip found @ 0x%02x (%s - chip version 0x%04x)\n", |
600 | c->addr << 1, c->adapter->name, version); | 614 | c->addr << 1, c->adapter->name, version); |
601 | 615 | ||
diff --git a/drivers/media/video/mt9v011.h b/drivers/media/video/mt9v011.h deleted file mode 100644 index 3350fd6083c3..000000000000 --- a/drivers/media/video/mt9v011.h +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | /* | ||
2 | * mt9v011 -Micron 1/4-Inch VGA Digital Image Sensor | ||
3 | * | ||
4 | * Copyright (c) 2009 Mauro Carvalho Chehab (mchehab@redhat.com) | ||
5 | * This code is placed under the terms of the GNU General Public License v2 | ||
6 | */ | ||
7 | |||
8 | #ifndef MT9V011_H_ | ||
9 | #define MT9V011_H_ | ||
10 | |||
11 | #define R00_MT9V011_CHIP_VERSION 0x00 | ||
12 | #define R01_MT9V011_ROWSTART 0x01 | ||
13 | #define R02_MT9V011_COLSTART 0x02 | ||
14 | #define R03_MT9V011_HEIGHT 0x03 | ||
15 | #define R04_MT9V011_WIDTH 0x04 | ||
16 | #define R05_MT9V011_HBLANK 0x05 | ||
17 | #define R06_MT9V011_VBLANK 0x06 | ||
18 | #define R07_MT9V011_OUT_CTRL 0x07 | ||
19 | #define R09_MT9V011_SHUTTER_WIDTH 0x09 | ||
20 | #define R0A_MT9V011_CLK_SPEED 0x0a | ||
21 | #define R0B_MT9V011_RESTART 0x0b | ||
22 | #define R0C_MT9V011_SHUTTER_DELAY 0x0c | ||
23 | #define R0D_MT9V011_RESET 0x0d | ||
24 | #define R1E_MT9V011_DIGITAL_ZOOM 0x1e | ||
25 | #define R20_MT9V011_READ_MODE 0x20 | ||
26 | #define R2B_MT9V011_GREEN_1_GAIN 0x2b | ||
27 | #define R2C_MT9V011_BLUE_GAIN 0x2c | ||
28 | #define R2D_MT9V011_RED_GAIN 0x2d | ||
29 | #define R2E_MT9V011_GREEN_2_GAIN 0x2e | ||
30 | #define R35_MT9V011_GLOBAL_GAIN 0x35 | ||
31 | #define RF1_MT9V011_CHIP_ENABLE 0xf1 | ||
32 | |||
33 | #define MT9V011_VERSION 0x8232 | ||
34 | #define MT9V011_REV_B_VERSION 0x8243 | ||
35 | |||
36 | #endif | ||
diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c index c881a64b41fd..d4e7c11553c3 100644 --- a/drivers/media/video/ov7670.c +++ b/drivers/media/video/ov7670.c | |||
@@ -1449,47 +1449,6 @@ static int ov7670_g_chip_ident(struct v4l2_subdev *sd, | |||
1449 | return v4l2_chip_ident_i2c_client(client, chip, V4L2_IDENT_OV7670, 0); | 1449 | return v4l2_chip_ident_i2c_client(client, chip, V4L2_IDENT_OV7670, 0); |
1450 | } | 1450 | } |
1451 | 1451 | ||
1452 | static int ov7670_s_config(struct v4l2_subdev *sd, int dumb, void *data) | ||
1453 | { | ||
1454 | struct i2c_client *client = v4l2_get_subdevdata(sd); | ||
1455 | struct ov7670_config *config = data; | ||
1456 | struct ov7670_info *info = to_state(sd); | ||
1457 | int ret; | ||
1458 | |||
1459 | info->clock_speed = 30; /* default: a guess */ | ||
1460 | |||
1461 | /* | ||
1462 | * Must apply configuration before initializing device, because it | ||
1463 | * selects I/O method. | ||
1464 | */ | ||
1465 | if (config) { | ||
1466 | info->min_width = config->min_width; | ||
1467 | info->min_height = config->min_height; | ||
1468 | info->use_smbus = config->use_smbus; | ||
1469 | |||
1470 | if (config->clock_speed) | ||
1471 | info->clock_speed = config->clock_speed; | ||
1472 | } | ||
1473 | |||
1474 | /* Make sure it's an ov7670 */ | ||
1475 | ret = ov7670_detect(sd); | ||
1476 | if (ret) { | ||
1477 | v4l_dbg(1, debug, client, | ||
1478 | "chip found @ 0x%x (%s) is not an ov7670 chip.\n", | ||
1479 | client->addr << 1, client->adapter->name); | ||
1480 | kfree(info); | ||
1481 | return ret; | ||
1482 | } | ||
1483 | v4l_info(client, "chip found @ 0x%02x (%s)\n", | ||
1484 | client->addr << 1, client->adapter->name); | ||
1485 | |||
1486 | info->fmt = &ov7670_formats[0]; | ||
1487 | info->sat = 128; /* Review this */ | ||
1488 | info->clkrc = info->clock_speed / 30; | ||
1489 | |||
1490 | return 0; | ||
1491 | } | ||
1492 | |||
1493 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 1452 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
1494 | static int ov7670_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) | 1453 | static int ov7670_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) |
1495 | { | 1454 | { |
@@ -1528,7 +1487,6 @@ static const struct v4l2_subdev_core_ops ov7670_core_ops = { | |||
1528 | .s_ctrl = ov7670_s_ctrl, | 1487 | .s_ctrl = ov7670_s_ctrl, |
1529 | .queryctrl = ov7670_queryctrl, | 1488 | .queryctrl = ov7670_queryctrl, |
1530 | .reset = ov7670_reset, | 1489 | .reset = ov7670_reset, |
1531 | .s_config = ov7670_s_config, | ||
1532 | .init = ov7670_init, | 1490 | .init = ov7670_init, |
1533 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 1491 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
1534 | .g_register = ov7670_g_register, | 1492 | .g_register = ov7670_g_register, |
@@ -1558,6 +1516,7 @@ static int ov7670_probe(struct i2c_client *client, | |||
1558 | { | 1516 | { |
1559 | struct v4l2_subdev *sd; | 1517 | struct v4l2_subdev *sd; |
1560 | struct ov7670_info *info; | 1518 | struct ov7670_info *info; |
1519 | int ret; | ||
1561 | 1520 | ||
1562 | info = kzalloc(sizeof(struct ov7670_info), GFP_KERNEL); | 1521 | info = kzalloc(sizeof(struct ov7670_info), GFP_KERNEL); |
1563 | if (info == NULL) | 1522 | if (info == NULL) |
@@ -1565,6 +1524,37 @@ static int ov7670_probe(struct i2c_client *client, | |||
1565 | sd = &info->sd; | 1524 | sd = &info->sd; |
1566 | v4l2_i2c_subdev_init(sd, client, &ov7670_ops); | 1525 | v4l2_i2c_subdev_init(sd, client, &ov7670_ops); |
1567 | 1526 | ||
1527 | info->clock_speed = 30; /* default: a guess */ | ||
1528 | if (client->dev.platform_data) { | ||
1529 | struct ov7670_config *config = client->dev.platform_data; | ||
1530 | |||
1531 | /* | ||
1532 | * Must apply configuration before initializing device, because it | ||
1533 | * selects I/O method. | ||
1534 | */ | ||
1535 | info->min_width = config->min_width; | ||
1536 | info->min_height = config->min_height; | ||
1537 | info->use_smbus = config->use_smbus; | ||
1538 | |||
1539 | if (config->clock_speed) | ||
1540 | info->clock_speed = config->clock_speed; | ||
1541 | } | ||
1542 | |||
1543 | /* Make sure it's an ov7670 */ | ||
1544 | ret = ov7670_detect(sd); | ||
1545 | if (ret) { | ||
1546 | v4l_dbg(1, debug, client, | ||
1547 | "chip found @ 0x%x (%s) is not an ov7670 chip.\n", | ||
1548 | client->addr << 1, client->adapter->name); | ||
1549 | kfree(info); | ||
1550 | return ret; | ||
1551 | } | ||
1552 | v4l_info(client, "chip found @ 0x%02x (%s)\n", | ||
1553 | client->addr << 1, client->adapter->name); | ||
1554 | |||
1555 | info->fmt = &ov7670_formats[0]; | ||
1556 | info->sat = 128; /* Review this */ | ||
1557 | info->clkrc = info->clock_speed / 30; | ||
1568 | return 0; | 1558 | return 0; |
1569 | } | 1559 | } |
1570 | 1560 | ||
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h index ac94a8bf883e..305e6aaa844a 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h | |||
@@ -40,6 +40,7 @@ | |||
40 | #include "pvrusb2-io.h" | 40 | #include "pvrusb2-io.h" |
41 | #include <media/v4l2-device.h> | 41 | #include <media/v4l2-device.h> |
42 | #include <media/cx2341x.h> | 42 | #include <media/cx2341x.h> |
43 | #include <media/ir-kbd-i2c.h> | ||
43 | #include "pvrusb2-devattr.h" | 44 | #include "pvrusb2-devattr.h" |
44 | 45 | ||
45 | /* Legal values for PVR2_CID_HSM */ | 46 | /* Legal values for PVR2_CID_HSM */ |
@@ -202,6 +203,7 @@ struct pvr2_hdw { | |||
202 | 203 | ||
203 | /* IR related */ | 204 | /* IR related */ |
204 | unsigned int ir_scheme_active; /* IR scheme as seen from the outside */ | 205 | unsigned int ir_scheme_active; /* IR scheme as seen from the outside */ |
206 | struct IR_i2c_init_data ir_init_data; /* params passed to IR modules */ | ||
205 | 207 | ||
206 | /* Frequency table */ | 208 | /* Frequency table */ |
207 | unsigned int freqTable[FREQTABLE_SIZE]; | 209 | unsigned int freqTable[FREQTABLE_SIZE]; |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c index 7cbe18c4ca95..451ecd485f97 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c +++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c | |||
@@ -19,6 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/i2c.h> | 21 | #include <linux/i2c.h> |
22 | #include <media/ir-kbd-i2c.h> | ||
22 | #include "pvrusb2-i2c-core.h" | 23 | #include "pvrusb2-i2c-core.h" |
23 | #include "pvrusb2-hdw-internal.h" | 24 | #include "pvrusb2-hdw-internal.h" |
24 | #include "pvrusb2-debug.h" | 25 | #include "pvrusb2-debug.h" |
@@ -48,13 +49,6 @@ module_param_named(disable_autoload_ir_video, pvr2_disable_ir_video, | |||
48 | MODULE_PARM_DESC(disable_autoload_ir_video, | 49 | MODULE_PARM_DESC(disable_autoload_ir_video, |
49 | "1=do not try to autoload ir_video IR receiver"); | 50 | "1=do not try to autoload ir_video IR receiver"); |
50 | 51 | ||
51 | /* Mapping of IR schemes to known I2C addresses - if any */ | ||
52 | static const unsigned char ir_video_addresses[] = { | ||
53 | [PVR2_IR_SCHEME_ZILOG] = 0x71, | ||
54 | [PVR2_IR_SCHEME_29XXX] = 0x18, | ||
55 | [PVR2_IR_SCHEME_24XXX] = 0x18, | ||
56 | }; | ||
57 | |||
58 | static int pvr2_i2c_write(struct pvr2_hdw *hdw, /* Context */ | 52 | static int pvr2_i2c_write(struct pvr2_hdw *hdw, /* Context */ |
59 | u8 i2c_addr, /* I2C address we're talking to */ | 53 | u8 i2c_addr, /* I2C address we're talking to */ |
60 | u8 *data, /* Data to write */ | 54 | u8 *data, /* Data to write */ |
@@ -574,26 +568,55 @@ static void do_i2c_scan(struct pvr2_hdw *hdw) | |||
574 | static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw) | 568 | static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw) |
575 | { | 569 | { |
576 | struct i2c_board_info info; | 570 | struct i2c_board_info info; |
577 | unsigned char addr = 0; | 571 | struct IR_i2c_init_data *init_data = &hdw->ir_init_data; |
578 | if (pvr2_disable_ir_video) { | 572 | if (pvr2_disable_ir_video) { |
579 | pvr2_trace(PVR2_TRACE_INFO, | 573 | pvr2_trace(PVR2_TRACE_INFO, |
580 | "Automatic binding of ir_video has been disabled."); | 574 | "Automatic binding of ir_video has been disabled."); |
581 | return; | 575 | return; |
582 | } | 576 | } |
583 | if (hdw->ir_scheme_active < ARRAY_SIZE(ir_video_addresses)) { | 577 | memset(&info, 0, sizeof(struct i2c_board_info)); |
584 | addr = ir_video_addresses[hdw->ir_scheme_active]; | 578 | switch (hdw->ir_scheme_active) { |
585 | } | 579 | case PVR2_IR_SCHEME_24XXX: /* FX2-controlled IR */ |
586 | if (!addr) { | 580 | case PVR2_IR_SCHEME_29XXX: /* Original 29xxx device */ |
581 | init_data->ir_codes = RC_MAP_HAUPPAUGE_NEW; | ||
582 | init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP; | ||
583 | init_data->type = RC_TYPE_RC5; | ||
584 | init_data->name = hdw->hdw_desc->description; | ||
585 | init_data->polling_interval = 100; /* ms From ir-kbd-i2c */ | ||
586 | /* IR Receiver */ | ||
587 | info.addr = 0x18; | ||
588 | info.platform_data = init_data; | ||
589 | strlcpy(info.type, "ir_video", I2C_NAME_SIZE); | ||
590 | pvr2_trace(PVR2_TRACE_INFO, "Binding %s to i2c address 0x%02x.", | ||
591 | info.type, info.addr); | ||
592 | i2c_new_device(&hdw->i2c_adap, &info); | ||
593 | break; | ||
594 | case PVR2_IR_SCHEME_ZILOG: /* HVR-1950 style */ | ||
595 | case PVR2_IR_SCHEME_24XXX_MCE: /* 24xxx MCE device */ | ||
596 | init_data->ir_codes = RC_MAP_HAUPPAUGE_NEW; | ||
597 | init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; | ||
598 | init_data->type = RC_TYPE_RC5; | ||
599 | init_data->name = hdw->hdw_desc->description; | ||
600 | /* IR Receiver */ | ||
601 | info.addr = 0x71; | ||
602 | info.platform_data = init_data; | ||
603 | strlcpy(info.type, "ir_rx_z8f0811_haup", I2C_NAME_SIZE); | ||
604 | pvr2_trace(PVR2_TRACE_INFO, "Binding %s to i2c address 0x%02x.", | ||
605 | info.type, info.addr); | ||
606 | i2c_new_device(&hdw->i2c_adap, &info); | ||
607 | /* IR Trasmitter */ | ||
608 | info.addr = 0x70; | ||
609 | info.platform_data = init_data; | ||
610 | strlcpy(info.type, "ir_tx_z8f0811_haup", I2C_NAME_SIZE); | ||
611 | pvr2_trace(PVR2_TRACE_INFO, "Binding %s to i2c address 0x%02x.", | ||
612 | info.type, info.addr); | ||
613 | i2c_new_device(&hdw->i2c_adap, &info); | ||
614 | break; | ||
615 | default: | ||
587 | /* The device either doesn't support I2C-based IR or we | 616 | /* The device either doesn't support I2C-based IR or we |
588 | don't know (yet) how to operate IR on the device. */ | 617 | don't know (yet) how to operate IR on the device. */ |
589 | return; | 618 | break; |
590 | } | 619 | } |
591 | pvr2_trace(PVR2_TRACE_INFO, | ||
592 | "Binding ir_video to i2c address 0x%02x.", addr); | ||
593 | memset(&info, 0, sizeof(struct i2c_board_info)); | ||
594 | strlcpy(info.type, "ir_video", I2C_NAME_SIZE); | ||
595 | info.addr = addr; | ||
596 | i2c_new_device(&hdw->i2c_adap, &info); | ||
597 | } | 620 | } |
598 | 621 | ||
599 | void pvr2_i2c_core_init(struct pvr2_hdw *hdw) | 622 | void pvr2_i2c_core_init(struct pvr2_hdw *hdw) |
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index f35459d1f42f..0db90922ee93 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c | |||
@@ -1565,7 +1565,7 @@ static int saa711x_probe(struct i2c_client *client, | |||
1565 | chip_id = name[5]; | 1565 | chip_id = name[5]; |
1566 | 1566 | ||
1567 | /* Check whether this chip is part of the saa711x series */ | 1567 | /* Check whether this chip is part of the saa711x series */ |
1568 | if (memcmp(name, "1f711", 5)) { | 1568 | if (memcmp(name + 1, "f711", 4)) { |
1569 | v4l_dbg(1, debug, client, "chip found @ 0x%x (ID %s) does not match a known saa711x chip.\n", | 1569 | v4l_dbg(1, debug, client, "chip found @ 0x%x (ID %s) does not match a known saa711x chip.\n", |
1570 | client->addr << 1, name); | 1570 | client->addr << 1, name); |
1571 | return -ENODEV; | 1571 | return -ENODEV; |
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index e7aa588c6c5a..deb8fcf4aa49 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -5179,18 +5179,8 @@ struct saa7134_board saa7134_boards[] = { | |||
5179 | [SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG] = { | 5179 | [SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG] = { |
5180 | .name = "Kworld PCI SBTVD/ISDB-T Full-Seg Hybrid", | 5180 | .name = "Kworld PCI SBTVD/ISDB-T Full-Seg Hybrid", |
5181 | .audio_clock = 0x00187de7, | 5181 | .audio_clock = 0x00187de7, |
5182 | #if 0 | 5182 | .tuner_type = TUNER_PHILIPS_TDA8290, |
5183 | /* | ||
5184 | * FIXME: Analog mode doesn't work, if digital is enabled. The proper | ||
5185 | * fix is to use tda8290 driver, but Kworld seems to use an | ||
5186 | * unsupported version of tda8295. | ||
5187 | */ | ||
5188 | .tuner_type = TUNER_NXP_TDA18271, /* TUNER_PHILIPS_TDA8290 */ | ||
5189 | .tuner_addr = 0x60, | ||
5190 | #else | ||
5191 | .tuner_type = UNSET, | ||
5192 | .tuner_addr = ADDR_UNSET, | 5183 | .tuner_addr = ADDR_UNSET, |
5193 | #endif | ||
5194 | .radio_type = UNSET, | 5184 | .radio_type = UNSET, |
5195 | .radio_addr = ADDR_UNSET, | 5185 | .radio_addr = ADDR_UNSET, |
5196 | .gpiomask = 0x8e054000, | 5186 | .gpiomask = 0x8e054000, |
@@ -6932,10 +6922,17 @@ static inline int saa7134_kworld_sbtvd_toggle_agc(struct saa7134_dev *dev, | |||
6932 | /* toggle AGC switch through GPIO 27 */ | 6922 | /* toggle AGC switch through GPIO 27 */ |
6933 | switch (mode) { | 6923 | switch (mode) { |
6934 | case TDA18271_ANALOG: | 6924 | case TDA18271_ANALOG: |
6935 | saa7134_set_gpio(dev, 27, 0); | 6925 | saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x4000); |
6926 | saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x4000); | ||
6927 | msleep(20); | ||
6936 | break; | 6928 | break; |
6937 | case TDA18271_DIGITAL: | 6929 | case TDA18271_DIGITAL: |
6938 | saa7134_set_gpio(dev, 27, 1); | 6930 | saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x14000); |
6931 | saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x14000); | ||
6932 | msleep(20); | ||
6933 | saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x54000); | ||
6934 | saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x54000); | ||
6935 | msleep(30); | ||
6939 | break; | 6936 | break; |
6940 | default: | 6937 | default: |
6941 | return -EINVAL; | 6938 | return -EINVAL; |
@@ -6993,6 +6990,7 @@ static int saa7134_tda8290_callback(struct saa7134_dev *dev, | |||
6993 | int saa7134_tuner_callback(void *priv, int component, int command, int arg) | 6990 | int saa7134_tuner_callback(void *priv, int component, int command, int arg) |
6994 | { | 6991 | { |
6995 | struct saa7134_dev *dev = priv; | 6992 | struct saa7134_dev *dev = priv; |
6993 | |||
6996 | if (dev != NULL) { | 6994 | if (dev != NULL) { |
6997 | switch (dev->tuner_type) { | 6995 | switch (dev->tuner_type) { |
6998 | case TUNER_PHILIPS_TDA8290: | 6996 | case TUNER_PHILIPS_TDA8290: |
@@ -7659,36 +7657,11 @@ int saa7134_board_init2(struct saa7134_dev *dev) | |||
7659 | break; | 7657 | break; |
7660 | } | 7658 | } |
7661 | case SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG: | 7659 | case SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG: |
7662 | { | ||
7663 | struct i2c_msg msg = { .addr = 0x4b, .flags = 0 }; | ||
7664 | int i; | ||
7665 | static u8 buffer[][2] = { | ||
7666 | {0x30, 0x31}, | ||
7667 | {0xff, 0x00}, | ||
7668 | {0x41, 0x03}, | ||
7669 | {0x41, 0x1a}, | ||
7670 | {0xff, 0x02}, | ||
7671 | {0x34, 0x00}, | ||
7672 | {0x45, 0x97}, | ||
7673 | {0x45, 0xc1}, | ||
7674 | }; | ||
7675 | saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x4000); | 7660 | saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x4000); |
7676 | saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x4000); | 7661 | saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x4000); |
7677 | 7662 | ||
7678 | /* | 7663 | saa7134_set_gpio(dev, 27, 0); |
7679 | * FIXME: identify what device is at addr 0x4b and what means | ||
7680 | * this initialization | ||
7681 | */ | ||
7682 | for (i = 0; i < ARRAY_SIZE(buffer); i++) { | ||
7683 | msg.buf = &buffer[i][0]; | ||
7684 | msg.len = ARRAY_SIZE(buffer[0]); | ||
7685 | if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) | ||
7686 | printk(KERN_WARNING | ||
7687 | "%s: Unable to enable tuner(%i).\n", | ||
7688 | dev->name, i); | ||
7689 | } | ||
7690 | break; | 7664 | break; |
7691 | } | ||
7692 | } /* switch() */ | 7665 | } /* switch() */ |
7693 | 7666 | ||
7694 | /* initialize tuner */ | 7667 | /* initialize tuner */ |
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index 3315a48a848b..f65cad287b83 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c | |||
@@ -237,12 +237,39 @@ static struct tda18271_std_map mb86a20s_tda18271_std_map = { | |||
237 | static struct tda18271_config kworld_tda18271_config = { | 237 | static struct tda18271_config kworld_tda18271_config = { |
238 | .std_map = &mb86a20s_tda18271_std_map, | 238 | .std_map = &mb86a20s_tda18271_std_map, |
239 | .gate = TDA18271_GATE_DIGITAL, | 239 | .gate = TDA18271_GATE_DIGITAL, |
240 | .config = 3, /* Use tuner callback for AGC */ | ||
241 | |||
240 | }; | 242 | }; |
241 | 243 | ||
242 | static const struct mb86a20s_config kworld_mb86a20s_config = { | 244 | static const struct mb86a20s_config kworld_mb86a20s_config = { |
243 | .demod_address = 0x10, | 245 | .demod_address = 0x10, |
244 | }; | 246 | }; |
245 | 247 | ||
248 | static int kworld_sbtvd_gate_ctrl(struct dvb_frontend* fe, int enable) | ||
249 | { | ||
250 | struct saa7134_dev *dev = fe->dvb->priv; | ||
251 | |||
252 | unsigned char initmsg[] = {0x45, 0x97}; | ||
253 | unsigned char msg_enable[] = {0x45, 0xc1}; | ||
254 | unsigned char msg_disable[] = {0x45, 0x81}; | ||
255 | struct i2c_msg msg = {.addr = 0x4b, .flags = 0, .buf = initmsg, .len = 2}; | ||
256 | |||
257 | if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) { | ||
258 | wprintk("could not access the I2C gate\n"); | ||
259 | return -EIO; | ||
260 | } | ||
261 | if (enable) | ||
262 | msg.buf = msg_enable; | ||
263 | else | ||
264 | msg.buf = msg_disable; | ||
265 | if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) { | ||
266 | wprintk("could not access the I2C gate\n"); | ||
267 | return -EIO; | ||
268 | } | ||
269 | msleep(20); | ||
270 | return 0; | ||
271 | } | ||
272 | |||
246 | /* ================================================================== | 273 | /* ================================================================== |
247 | * tda1004x based DVB-T cards, helper functions | 274 | * tda1004x based DVB-T cards, helper functions |
248 | */ | 275 | */ |
@@ -623,37 +650,6 @@ static struct tda827x_config tda827x_cfg_2_sw42 = { | |||
623 | 650 | ||
624 | /* ------------------------------------------------------------------ */ | 651 | /* ------------------------------------------------------------------ */ |
625 | 652 | ||
626 | static int __kworld_sbtvd_i2c_gate_ctrl(struct saa7134_dev *dev, int enable) | ||
627 | { | ||
628 | unsigned char initmsg[] = {0x45, 0x97}; | ||
629 | unsigned char msg_enable[] = {0x45, 0xc1}; | ||
630 | unsigned char msg_disable[] = {0x45, 0x81}; | ||
631 | struct i2c_msg msg = {.addr = 0x4b, .flags = 0, .buf = initmsg, .len = 2}; | ||
632 | |||
633 | if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) { | ||
634 | wprintk("could not access the I2C gate\n"); | ||
635 | return -EIO; | ||
636 | } | ||
637 | if (enable) | ||
638 | msg.buf = msg_enable; | ||
639 | else | ||
640 | msg.buf = msg_disable; | ||
641 | if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) { | ||
642 | wprintk("could not access the I2C gate\n"); | ||
643 | return -EIO; | ||
644 | } | ||
645 | msleep(20); | ||
646 | return 0; | ||
647 | } | ||
648 | static int kworld_sbtvd_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) | ||
649 | { | ||
650 | struct saa7134_dev *dev = fe->dvb->priv; | ||
651 | |||
652 | return __kworld_sbtvd_i2c_gate_ctrl(dev, enable); | ||
653 | } | ||
654 | |||
655 | /* ------------------------------------------------------------------ */ | ||
656 | |||
657 | static struct tda1004x_config tda827x_lifeview_config = { | 653 | static struct tda1004x_config tda827x_lifeview_config = { |
658 | .demod_address = 0x08, | 654 | .demod_address = 0x08, |
659 | .invert = 1, | 655 | .invert = 1, |
@@ -1660,27 +1656,23 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1660 | } | 1656 | } |
1661 | break; | 1657 | break; |
1662 | case SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG: | 1658 | case SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG: |
1663 | __kworld_sbtvd_i2c_gate_ctrl(dev, 0); | 1659 | /* Switch to digital mode */ |
1664 | saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x14000); | 1660 | saa7134_tuner_callback(dev, 0, |
1665 | saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x14000); | 1661 | TDA18271_CALLBACK_CMD_AGC_ENABLE, 1); |
1666 | msleep(20); | ||
1667 | saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x54000); | ||
1668 | saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x54000); | ||
1669 | msleep(20); | ||
1670 | fe0->dvb.frontend = dvb_attach(mb86a20s_attach, | 1662 | fe0->dvb.frontend = dvb_attach(mb86a20s_attach, |
1671 | &kworld_mb86a20s_config, | 1663 | &kworld_mb86a20s_config, |
1672 | &dev->i2c_adap); | 1664 | &dev->i2c_adap); |
1673 | __kworld_sbtvd_i2c_gate_ctrl(dev, 1); | ||
1674 | if (fe0->dvb.frontend != NULL) { | 1665 | if (fe0->dvb.frontend != NULL) { |
1666 | dvb_attach(tda829x_attach, fe0->dvb.frontend, | ||
1667 | &dev->i2c_adap, 0x4b, | ||
1668 | &tda829x_no_probe); | ||
1675 | dvb_attach(tda18271_attach, fe0->dvb.frontend, | 1669 | dvb_attach(tda18271_attach, fe0->dvb.frontend, |
1676 | 0x60, &dev->i2c_adap, | 1670 | 0x60, &dev->i2c_adap, |
1677 | &kworld_tda18271_config); | 1671 | &kworld_tda18271_config); |
1678 | /* | 1672 | fe0->dvb.frontend->ops.i2c_gate_ctrl = kworld_sbtvd_gate_ctrl; |
1679 | * Only after success, it can initialize the gate, otherwise | ||
1680 | * an OOPS will hit, due to kfree(fe0->dvb.frontend) | ||
1681 | */ | ||
1682 | fe0->dvb.frontend->ops.i2c_gate_ctrl = kworld_sbtvd_i2c_gate_ctrl; | ||
1683 | } | 1673 | } |
1674 | |||
1675 | /* mb86a20s need to use the I2C gateway */ | ||
1684 | break; | 1676 | break; |
1685 | default: | 1677 | default: |
1686 | wprintk("Huh? unknown DVB card?\n"); | 1678 | wprintk("Huh? unknown DVB card?\n"); |
diff --git a/drivers/media/video/sn9c102/sn9c102_devtable.h b/drivers/media/video/sn9c102/sn9c102_devtable.h index 41064c7b5ef8..b3d2cc729657 100644 --- a/drivers/media/video/sn9c102/sn9c102_devtable.h +++ b/drivers/media/video/sn9c102/sn9c102_devtable.h | |||
@@ -47,8 +47,8 @@ static const struct usb_device_id sn9c102_id_table[] = { | |||
47 | { SN9C102_USB_DEVICE(0x0c45, 0x6009, BRIDGE_SN9C102), }, | 47 | { SN9C102_USB_DEVICE(0x0c45, 0x6009, BRIDGE_SN9C102), }, |
48 | { SN9C102_USB_DEVICE(0x0c45, 0x600d, BRIDGE_SN9C102), }, | 48 | { SN9C102_USB_DEVICE(0x0c45, 0x600d, BRIDGE_SN9C102), }, |
49 | /* { SN9C102_USB_DEVICE(0x0c45, 0x6011, BRIDGE_SN9C102), }, OV6650 */ | 49 | /* { SN9C102_USB_DEVICE(0x0c45, 0x6011, BRIDGE_SN9C102), }, OV6650 */ |
50 | #endif | ||
51 | { SN9C102_USB_DEVICE(0x0c45, 0x6019, BRIDGE_SN9C102), }, | 50 | { SN9C102_USB_DEVICE(0x0c45, 0x6019, BRIDGE_SN9C102), }, |
51 | #endif | ||
52 | { SN9C102_USB_DEVICE(0x0c45, 0x6024, BRIDGE_SN9C102), }, | 52 | { SN9C102_USB_DEVICE(0x0c45, 0x6024, BRIDGE_SN9C102), }, |
53 | { SN9C102_USB_DEVICE(0x0c45, 0x6025, BRIDGE_SN9C102), }, | 53 | { SN9C102_USB_DEVICE(0x0c45, 0x6025, BRIDGE_SN9C102), }, |
54 | #if !defined CONFIG_USB_GSPCA_SONIXB && !defined CONFIG_USB_GSPCA_SONIXB_MODULE | 54 | #if !defined CONFIG_USB_GSPCA_SONIXB && !defined CONFIG_USB_GSPCA_SONIXB_MODULE |
@@ -56,78 +56,68 @@ static const struct usb_device_id sn9c102_id_table[] = { | |||
56 | { SN9C102_USB_DEVICE(0x0c45, 0x6029, BRIDGE_SN9C102), }, | 56 | { SN9C102_USB_DEVICE(0x0c45, 0x6029, BRIDGE_SN9C102), }, |
57 | { SN9C102_USB_DEVICE(0x0c45, 0x602a, BRIDGE_SN9C102), }, | 57 | { SN9C102_USB_DEVICE(0x0c45, 0x602a, BRIDGE_SN9C102), }, |
58 | #endif | 58 | #endif |
59 | { SN9C102_USB_DEVICE(0x0c45, 0x602b, BRIDGE_SN9C102), }, | 59 | { SN9C102_USB_DEVICE(0x0c45, 0x602b, BRIDGE_SN9C102), }, /* not in sonixb */ |
60 | #if !defined CONFIG_USB_GSPCA_SONIXB && !defined CONFIG_USB_GSPCA_SONIXB_MODULE | 60 | #if !defined CONFIG_USB_GSPCA_SONIXB && !defined CONFIG_USB_GSPCA_SONIXB_MODULE |
61 | { SN9C102_USB_DEVICE(0x0c45, 0x602c, BRIDGE_SN9C102), }, | 61 | { SN9C102_USB_DEVICE(0x0c45, 0x602c, BRIDGE_SN9C102), }, |
62 | /* { SN9C102_USB_DEVICE(0x0c45, 0x602d, BRIDGE_SN9C102), }, HV7131R */ | 62 | /* { SN9C102_USB_DEVICE(0x0c45, 0x602d, BRIDGE_SN9C102), }, HV7131R */ |
63 | { SN9C102_USB_DEVICE(0x0c45, 0x602e, BRIDGE_SN9C102), }, | 63 | { SN9C102_USB_DEVICE(0x0c45, 0x602e, BRIDGE_SN9C102), }, |
64 | #endif | 64 | #endif |
65 | { SN9C102_USB_DEVICE(0x0c45, 0x6030, BRIDGE_SN9C102), }, | 65 | { SN9C102_USB_DEVICE(0x0c45, 0x6030, BRIDGE_SN9C102), }, /* not in sonixb */ |
66 | /* SN9C103 */ | 66 | /* SN9C103 */ |
67 | { SN9C102_USB_DEVICE(0x0c45, 0x6080, BRIDGE_SN9C103), }, | 67 | /* { SN9C102_USB_DEVICE(0x0c45, 0x6080, BRIDGE_SN9C103), }, non existent ? */ |
68 | { SN9C102_USB_DEVICE(0x0c45, 0x6082, BRIDGE_SN9C103), }, | 68 | { SN9C102_USB_DEVICE(0x0c45, 0x6082, BRIDGE_SN9C103), }, /* not in sonixb */ |
69 | #if !defined CONFIG_USB_GSPCA_SONIXB && !defined CONFIG_USB_GSPCA_SONIXB_MODULE | ||
69 | /* { SN9C102_USB_DEVICE(0x0c45, 0x6083, BRIDGE_SN9C103), }, HY7131D/E */ | 70 | /* { SN9C102_USB_DEVICE(0x0c45, 0x6083, BRIDGE_SN9C103), }, HY7131D/E */ |
70 | { SN9C102_USB_DEVICE(0x0c45, 0x6088, BRIDGE_SN9C103), }, | 71 | /* { SN9C102_USB_DEVICE(0x0c45, 0x6088, BRIDGE_SN9C103), }, non existent ? */ |
71 | { SN9C102_USB_DEVICE(0x0c45, 0x608a, BRIDGE_SN9C103), }, | 72 | /* { SN9C102_USB_DEVICE(0x0c45, 0x608a, BRIDGE_SN9C103), }, non existent ? */ |
72 | { SN9C102_USB_DEVICE(0x0c45, 0x608b, BRIDGE_SN9C103), }, | 73 | /* { SN9C102_USB_DEVICE(0x0c45, 0x608b, BRIDGE_SN9C103), }, non existent ? */ |
73 | { SN9C102_USB_DEVICE(0x0c45, 0x608c, BRIDGE_SN9C103), }, | 74 | { SN9C102_USB_DEVICE(0x0c45, 0x608c, BRIDGE_SN9C103), }, |
74 | /* { SN9C102_USB_DEVICE(0x0c45, 0x608e, BRIDGE_SN9C103), }, CISVF10 */ | 75 | /* { SN9C102_USB_DEVICE(0x0c45, 0x608e, BRIDGE_SN9C103), }, CISVF10 */ |
75 | #if !defined CONFIG_USB_GSPCA_SONIXB && !defined CONFIG_USB_GSPCA_SONIXB_MODULE | ||
76 | { SN9C102_USB_DEVICE(0x0c45, 0x608f, BRIDGE_SN9C103), }, | 76 | { SN9C102_USB_DEVICE(0x0c45, 0x608f, BRIDGE_SN9C103), }, |
77 | #endif | 77 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60a0, BRIDGE_SN9C103), }, non existent ? */ |
78 | { SN9C102_USB_DEVICE(0x0c45, 0x60a0, BRIDGE_SN9C103), }, | 78 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60a2, BRIDGE_SN9C103), }, non existent ? */ |
79 | { SN9C102_USB_DEVICE(0x0c45, 0x60a2, BRIDGE_SN9C103), }, | 79 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60a3, BRIDGE_SN9C103), }, non existent ? */ |
80 | { SN9C102_USB_DEVICE(0x0c45, 0x60a3, BRIDGE_SN9C103), }, | ||
81 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60a8, BRIDGE_SN9C103), }, PAS106 */ | 80 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60a8, BRIDGE_SN9C103), }, PAS106 */ |
82 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60aa, BRIDGE_SN9C103), }, TAS5130 */ | 81 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60aa, BRIDGE_SN9C103), }, TAS5130 */ |
83 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60ab, BRIDGE_SN9C103), }, TAS5130 */ | 82 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60ab, BRIDGE_SN9C103), }, TAS5110, non existent */ |
84 | { SN9C102_USB_DEVICE(0x0c45, 0x60ac, BRIDGE_SN9C103), }, | 83 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60ac, BRIDGE_SN9C103), }, non existent ? */ |
85 | { SN9C102_USB_DEVICE(0x0c45, 0x60ae, BRIDGE_SN9C103), }, | 84 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60ae, BRIDGE_SN9C103), }, non existent ? */ |
86 | { SN9C102_USB_DEVICE(0x0c45, 0x60af, BRIDGE_SN9C103), }, | 85 | { SN9C102_USB_DEVICE(0x0c45, 0x60af, BRIDGE_SN9C103), }, |
87 | #if !defined CONFIG_USB_GSPCA_SONIXB && !defined CONFIG_USB_GSPCA_SONIXB_MODULE | ||
88 | { SN9C102_USB_DEVICE(0x0c45, 0x60b0, BRIDGE_SN9C103), }, | 86 | { SN9C102_USB_DEVICE(0x0c45, 0x60b0, BRIDGE_SN9C103), }, |
87 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60b2, BRIDGE_SN9C103), }, non existent ? */ | ||
88 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60b3, BRIDGE_SN9C103), }, non existent ? */ | ||
89 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60b8, BRIDGE_SN9C103), }, non existent ? */ | ||
90 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60ba, BRIDGE_SN9C103), }, non existent ? */ | ||
91 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60bb, BRIDGE_SN9C103), }, non existent ? */ | ||
92 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60bc, BRIDGE_SN9C103), }, non existent ? */ | ||
93 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60be, BRIDGE_SN9C103), }, non existent ? */ | ||
89 | #endif | 94 | #endif |
90 | { SN9C102_USB_DEVICE(0x0c45, 0x60b2, BRIDGE_SN9C103), }, | ||
91 | { SN9C102_USB_DEVICE(0x0c45, 0x60b3, BRIDGE_SN9C103), }, | ||
92 | { SN9C102_USB_DEVICE(0x0c45, 0x60b8, BRIDGE_SN9C103), }, | ||
93 | { SN9C102_USB_DEVICE(0x0c45, 0x60ba, BRIDGE_SN9C103), }, | ||
94 | { SN9C102_USB_DEVICE(0x0c45, 0x60bb, BRIDGE_SN9C103), }, | ||
95 | { SN9C102_USB_DEVICE(0x0c45, 0x60bc, BRIDGE_SN9C103), }, | ||
96 | { SN9C102_USB_DEVICE(0x0c45, 0x60be, BRIDGE_SN9C103), }, | ||
97 | /* SN9C105 */ | 95 | /* SN9C105 */ |
98 | #if !defined CONFIG_USB_GSPCA_SONIXJ && !defined CONFIG_USB_GSPCA_SONIXJ_MODULE | 96 | #if !defined CONFIG_USB_GSPCA_SONIXJ && !defined CONFIG_USB_GSPCA_SONIXJ_MODULE |
99 | { SN9C102_USB_DEVICE(0x045e, 0x00f5, BRIDGE_SN9C105), }, | 97 | { SN9C102_USB_DEVICE(0x045e, 0x00f5, BRIDGE_SN9C105), }, |
100 | { SN9C102_USB_DEVICE(0x045e, 0x00f7, BRIDGE_SN9C105), }, | 98 | { SN9C102_USB_DEVICE(0x045e, 0x00f7, BRIDGE_SN9C105), }, |
101 | { SN9C102_USB_DEVICE(0x0471, 0x0327, BRIDGE_SN9C105), }, | 99 | { SN9C102_USB_DEVICE(0x0471, 0x0327, BRIDGE_SN9C105), }, |
102 | { SN9C102_USB_DEVICE(0x0471, 0x0328, BRIDGE_SN9C105), }, | 100 | { SN9C102_USB_DEVICE(0x0471, 0x0328, BRIDGE_SN9C105), }, |
103 | #endif | ||
104 | { SN9C102_USB_DEVICE(0x0c45, 0x60c0, BRIDGE_SN9C105), }, | 101 | { SN9C102_USB_DEVICE(0x0c45, 0x60c0, BRIDGE_SN9C105), }, |
105 | { SN9C102_USB_DEVICE(0x0c45, 0x60c2, BRIDGE_SN9C105), }, | 102 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60c2, BRIDGE_SN9C105), }, PO1030 */ |
106 | { SN9C102_USB_DEVICE(0x0c45, 0x60c8, BRIDGE_SN9C105), }, | 103 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60c8, BRIDGE_SN9C105), }, OM6801 */ |
107 | { SN9C102_USB_DEVICE(0x0c45, 0x60cc, BRIDGE_SN9C105), }, | 104 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60cc, BRIDGE_SN9C105), }, HV7131GP */ |
108 | { SN9C102_USB_DEVICE(0x0c45, 0x60ea, BRIDGE_SN9C105), }, | 105 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60ea, BRIDGE_SN9C105), }, non existent ? */ |
109 | { SN9C102_USB_DEVICE(0x0c45, 0x60ec, BRIDGE_SN9C105), }, | 106 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60ec, BRIDGE_SN9C105), }, MO4000 */ |
110 | { SN9C102_USB_DEVICE(0x0c45, 0x60ef, BRIDGE_SN9C105), }, | 107 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60ef, BRIDGE_SN9C105), }, ICM105C */ |
111 | { SN9C102_USB_DEVICE(0x0c45, 0x60fa, BRIDGE_SN9C105), }, | 108 | /* { SN9C102_USB_DEVICE(0x0c45, 0x60fa, BRIDGE_SN9C105), }, OV7648 */ |
112 | { SN9C102_USB_DEVICE(0x0c45, 0x60fb, BRIDGE_SN9C105), }, | 109 | { SN9C102_USB_DEVICE(0x0c45, 0x60fb, BRIDGE_SN9C105), }, |
113 | { SN9C102_USB_DEVICE(0x0c45, 0x60fc, BRIDGE_SN9C105), }, | 110 | { SN9C102_USB_DEVICE(0x0c45, 0x60fc, BRIDGE_SN9C105), }, |
114 | { SN9C102_USB_DEVICE(0x0c45, 0x60fe, BRIDGE_SN9C105), }, | 111 | { SN9C102_USB_DEVICE(0x0c45, 0x60fe, BRIDGE_SN9C105), }, |
115 | /* SN9C120 */ | 112 | /* SN9C120 */ |
116 | { SN9C102_USB_DEVICE(0x0458, 0x7025, BRIDGE_SN9C120), }, | 113 | { SN9C102_USB_DEVICE(0x0458, 0x7025, BRIDGE_SN9C120), }, |
117 | #if !defined CONFIG_USB_GSPCA_SONIXJ && !defined CONFIG_USB_GSPCA_SONIXJ_MODULE | 114 | /* { SN9C102_USB_DEVICE(0x0c45, 0x6102, BRIDGE_SN9C120), }, po2030 */ |
118 | { SN9C102_USB_DEVICE(0x0c45, 0x6102, BRIDGE_SN9C120), }, | 115 | /* { SN9C102_USB_DEVICE(0x0c45, 0x6108, BRIDGE_SN9C120), }, om6801 */ |
119 | #endif | 116 | /* { SN9C102_USB_DEVICE(0x0c45, 0x610f, BRIDGE_SN9C120), }, S5K53BEB */ |
120 | { SN9C102_USB_DEVICE(0x0c45, 0x6108, BRIDGE_SN9C120), }, | ||
121 | { SN9C102_USB_DEVICE(0x0c45, 0x610f, BRIDGE_SN9C120), }, | ||
122 | #if !defined CONFIG_USB_GSPCA_SONIXJ && !defined CONFIG_USB_GSPCA_SONIXJ_MODULE | ||
123 | { SN9C102_USB_DEVICE(0x0c45, 0x6130, BRIDGE_SN9C120), }, | 117 | { SN9C102_USB_DEVICE(0x0c45, 0x6130, BRIDGE_SN9C120), }, |
124 | #endif | ||
125 | /* { SN9C102_USB_DEVICE(0x0c45, 0x6138, BRIDGE_SN9C120), }, MO8000 */ | 118 | /* { SN9C102_USB_DEVICE(0x0c45, 0x6138, BRIDGE_SN9C120), }, MO8000 */ |
126 | #if !defined CONFIG_USB_GSPCA_SONIXJ && !defined CONFIG_USB_GSPCA_SONIXJ_MODULE | ||
127 | { SN9C102_USB_DEVICE(0x0c45, 0x613a, BRIDGE_SN9C120), }, | 119 | { SN9C102_USB_DEVICE(0x0c45, 0x613a, BRIDGE_SN9C120), }, |
128 | #endif | ||
129 | { SN9C102_USB_DEVICE(0x0c45, 0x613b, BRIDGE_SN9C120), }, | 120 | { SN9C102_USB_DEVICE(0x0c45, 0x613b, BRIDGE_SN9C120), }, |
130 | #if !defined CONFIG_USB_GSPCA_SONIXJ && !defined CONFIG_USB_GSPCA_SONIXJ_MODULE | ||
131 | { SN9C102_USB_DEVICE(0x0c45, 0x613c, BRIDGE_SN9C120), }, | 121 | { SN9C102_USB_DEVICE(0x0c45, 0x613c, BRIDGE_SN9C120), }, |
132 | { SN9C102_USB_DEVICE(0x0c45, 0x613e, BRIDGE_SN9C120), }, | 122 | { SN9C102_USB_DEVICE(0x0c45, 0x613e, BRIDGE_SN9C120), }, |
133 | #endif | 123 | #endif |
diff --git a/drivers/media/video/sr030pc30.c b/drivers/media/video/sr030pc30.c index 864696b7a006..c901721a1db3 100644 --- a/drivers/media/video/sr030pc30.c +++ b/drivers/media/video/sr030pc30.c | |||
@@ -714,15 +714,6 @@ static int sr030pc30_base_config(struct v4l2_subdev *sd) | |||
714 | return ret; | 714 | return ret; |
715 | } | 715 | } |
716 | 716 | ||
717 | static int sr030pc30_s_config(struct v4l2_subdev *sd, | ||
718 | int irq, void *platform_data) | ||
719 | { | ||
720 | struct sr030pc30_info *info = to_sr030pc30(sd); | ||
721 | |||
722 | info->pdata = platform_data; | ||
723 | return 0; | ||
724 | } | ||
725 | |||
726 | static int sr030pc30_s_stream(struct v4l2_subdev *sd, int enable) | 717 | static int sr030pc30_s_stream(struct v4l2_subdev *sd, int enable) |
727 | { | 718 | { |
728 | return 0; | 719 | return 0; |
@@ -763,7 +754,6 @@ static int sr030pc30_s_power(struct v4l2_subdev *sd, int on) | |||
763 | } | 754 | } |
764 | 755 | ||
765 | static const struct v4l2_subdev_core_ops sr030pc30_core_ops = { | 756 | static const struct v4l2_subdev_core_ops sr030pc30_core_ops = { |
766 | .s_config = sr030pc30_s_config, | ||
767 | .s_power = sr030pc30_s_power, | 757 | .s_power = sr030pc30_s_power, |
768 | .queryctrl = sr030pc30_queryctrl, | 758 | .queryctrl = sr030pc30_queryctrl, |
769 | .s_ctrl = sr030pc30_s_ctrl, | 759 | .s_ctrl = sr030pc30_s_ctrl, |
diff --git a/drivers/media/video/tda9875.c b/drivers/media/video/tda9875.c deleted file mode 100644 index 35b6ff5db319..000000000000 --- a/drivers/media/video/tda9875.c +++ /dev/null | |||
@@ -1,411 +0,0 @@ | |||
1 | /* | ||
2 | * For the TDA9875 chip | ||
3 | * (The TDA9875 is used on the Diamond DTV2000 french version | ||
4 | * Other cards probably use these chips as well.) | ||
5 | * This driver will not complain if used with any | ||
6 | * other i2c device with the same address. | ||
7 | * | ||
8 | * Copyright (c) 2000 Guillaume Delvit based on Gerd Knorr source and | ||
9 | * Eric Sandeen | ||
10 | * Copyright (c) 2006 Mauro Carvalho Chehab <mchehab@infradead.org> | ||
11 | * This code is placed under the terms of the GNU General Public License | ||
12 | * Based on tda9855.c by Steve VanDeBogart (vandebo@uclink.berkeley.edu) | ||
13 | * Which was based on tda8425.c by Greg Alexander (c) 1998 | ||
14 | * | ||
15 | * OPTIONS: | ||
16 | * debug - set to 1 if you'd like to see debug messages | ||
17 | * | ||
18 | * Revision: 0.1 - original version | ||
19 | */ | ||
20 | |||
21 | #include <linux/module.h> | ||
22 | #include <linux/kernel.h> | ||
23 | #include <linux/string.h> | ||
24 | #include <linux/timer.h> | ||
25 | #include <linux/delay.h> | ||
26 | #include <linux/errno.h> | ||
27 | #include <linux/slab.h> | ||
28 | #include <linux/i2c.h> | ||
29 | #include <linux/videodev2.h> | ||
30 | #include <media/v4l2-device.h> | ||
31 | #include <media/i2c-addr.h> | ||
32 | |||
33 | static int debug; /* insmod parameter */ | ||
34 | module_param(debug, int, S_IRUGO | S_IWUSR); | ||
35 | MODULE_LICENSE("GPL"); | ||
36 | |||
37 | |||
38 | /* This is a superset of the TDA9875 */ | ||
39 | struct tda9875 { | ||
40 | struct v4l2_subdev sd; | ||
41 | int rvol, lvol; | ||
42 | int bass, treble; | ||
43 | }; | ||
44 | |||
45 | static inline struct tda9875 *to_state(struct v4l2_subdev *sd) | ||
46 | { | ||
47 | return container_of(sd, struct tda9875, sd); | ||
48 | } | ||
49 | |||
50 | #define dprintk if (debug) printk | ||
51 | |||
52 | /* The TDA9875 is made by Philips Semiconductor | ||
53 | * http://www.semiconductors.philips.com | ||
54 | * TDA9875: I2C-bus controlled DSP audio processor, FM demodulator | ||
55 | * | ||
56 | */ | ||
57 | |||
58 | /* subaddresses for TDA9875 */ | ||
59 | #define TDA9875_MUT 0x12 /*General mute (value --> 0b11001100*/ | ||
60 | #define TDA9875_CFG 0x01 /* Config register (value --> 0b00000000 */ | ||
61 | #define TDA9875_DACOS 0x13 /*DAC i/o select (ADC) 0b0000100*/ | ||
62 | #define TDA9875_LOSR 0x16 /*Line output select regirter 0b0100 0001*/ | ||
63 | |||
64 | #define TDA9875_CH1V 0x0c /*Channel 1 volume (mute)*/ | ||
65 | #define TDA9875_CH2V 0x0d /*Channel 2 volume (mute)*/ | ||
66 | #define TDA9875_SC1 0x14 /*SCART 1 in (mono)*/ | ||
67 | #define TDA9875_SC2 0x15 /*SCART 2 in (mono)*/ | ||
68 | |||
69 | #define TDA9875_ADCIS 0x17 /*ADC input select (mono) 0b0110 000*/ | ||
70 | #define TDA9875_AER 0x19 /*Audio effect (AVL+Pseudo) 0b0000 0110*/ | ||
71 | #define TDA9875_MCS 0x18 /*Main channel select (DAC) 0b0000100*/ | ||
72 | #define TDA9875_MVL 0x1a /* Main volume gauche */ | ||
73 | #define TDA9875_MVR 0x1b /* Main volume droite */ | ||
74 | #define TDA9875_MBA 0x1d /* Main Basse */ | ||
75 | #define TDA9875_MTR 0x1e /* Main treble */ | ||
76 | #define TDA9875_ACS 0x1f /* Auxilary channel select (FM) 0b0000000*/ | ||
77 | #define TDA9875_AVL 0x20 /* Auxilary volume gauche */ | ||
78 | #define TDA9875_AVR 0x21 /* Auxilary volume droite */ | ||
79 | #define TDA9875_ABA 0x22 /* Auxilary Basse */ | ||
80 | #define TDA9875_ATR 0x23 /* Auxilary treble */ | ||
81 | |||
82 | #define TDA9875_MSR 0x02 /* Monitor select register */ | ||
83 | #define TDA9875_C1MSB 0x03 /* Carrier 1 (FM) frequency register MSB */ | ||
84 | #define TDA9875_C1MIB 0x04 /* Carrier 1 (FM) frequency register (16-8]b */ | ||
85 | #define TDA9875_C1LSB 0x05 /* Carrier 1 (FM) frequency register LSB */ | ||
86 | #define TDA9875_C2MSB 0x06 /* Carrier 2 (nicam) frequency register MSB */ | ||
87 | #define TDA9875_C2MIB 0x07 /* Carrier 2 (nicam) frequency register (16-8]b */ | ||
88 | #define TDA9875_C2LSB 0x08 /* Carrier 2 (nicam) frequency register LSB */ | ||
89 | #define TDA9875_DCR 0x09 /* Demodulateur configuration regirter*/ | ||
90 | #define TDA9875_DEEM 0x0a /* FM de-emphasis regirter*/ | ||
91 | #define TDA9875_FMAT 0x0b /* FM Matrix regirter*/ | ||
92 | |||
93 | /* values */ | ||
94 | #define TDA9875_MUTE_ON 0xff /* general mute */ | ||
95 | #define TDA9875_MUTE_OFF 0xcc /* general no mute */ | ||
96 | |||
97 | |||
98 | |||
99 | /* Begin code */ | ||
100 | |||
101 | static int tda9875_write(struct v4l2_subdev *sd, int subaddr, unsigned char val) | ||
102 | { | ||
103 | struct i2c_client *client = v4l2_get_subdevdata(sd); | ||
104 | unsigned char buffer[2]; | ||
105 | |||
106 | v4l2_dbg(1, debug, sd, "Writing %d 0x%x\n", subaddr, val); | ||
107 | buffer[0] = subaddr; | ||
108 | buffer[1] = val; | ||
109 | if (2 != i2c_master_send(client, buffer, 2)) { | ||
110 | v4l2_warn(sd, "I/O error, trying (write %d 0x%x)\n", | ||
111 | subaddr, val); | ||
112 | return -1; | ||
113 | } | ||
114 | return 0; | ||
115 | } | ||
116 | |||
117 | |||
118 | static int i2c_read_register(struct i2c_client *client, int addr, int reg) | ||
119 | { | ||
120 | unsigned char write[1]; | ||
121 | unsigned char read[1]; | ||
122 | struct i2c_msg msgs[2] = { | ||
123 | { addr, 0, 1, write }, | ||
124 | { addr, I2C_M_RD, 1, read } | ||
125 | }; | ||
126 | |||
127 | write[0] = reg; | ||
128 | |||
129 | if (2 != i2c_transfer(client->adapter, msgs, 2)) { | ||
130 | v4l_warn(client, "I/O error (read2)\n"); | ||
131 | return -1; | ||
132 | } | ||
133 | v4l_dbg(1, debug, client, "chip_read2: reg%d=0x%x\n", reg, read[0]); | ||
134 | return read[0]; | ||
135 | } | ||
136 | |||
137 | static void tda9875_set(struct v4l2_subdev *sd) | ||
138 | { | ||
139 | struct tda9875 *tda = to_state(sd); | ||
140 | unsigned char a; | ||
141 | |||
142 | v4l2_dbg(1, debug, sd, "tda9875_set(%04x,%04x,%04x,%04x)\n", | ||
143 | tda->lvol, tda->rvol, tda->bass, tda->treble); | ||
144 | |||
145 | a = tda->lvol & 0xff; | ||
146 | tda9875_write(sd, TDA9875_MVL, a); | ||
147 | a =tda->rvol & 0xff; | ||
148 | tda9875_write(sd, TDA9875_MVR, a); | ||
149 | a =tda->bass & 0xff; | ||
150 | tda9875_write(sd, TDA9875_MBA, a); | ||
151 | a =tda->treble & 0xff; | ||
152 | tda9875_write(sd, TDA9875_MTR, a); | ||
153 | } | ||
154 | |||
155 | static void do_tda9875_init(struct v4l2_subdev *sd) | ||
156 | { | ||
157 | struct tda9875 *t = to_state(sd); | ||
158 | |||
159 | v4l2_dbg(1, debug, sd, "In tda9875_init\n"); | ||
160 | tda9875_write(sd, TDA9875_CFG, 0xd0); /*reg de config 0 (reset)*/ | ||
161 | tda9875_write(sd, TDA9875_MSR, 0x03); /* Monitor 0b00000XXX*/ | ||
162 | tda9875_write(sd, TDA9875_C1MSB, 0x00); /*Car1(FM) MSB XMHz*/ | ||
163 | tda9875_write(sd, TDA9875_C1MIB, 0x00); /*Car1(FM) MIB XMHz*/ | ||
164 | tda9875_write(sd, TDA9875_C1LSB, 0x00); /*Car1(FM) LSB XMHz*/ | ||
165 | tda9875_write(sd, TDA9875_C2MSB, 0x00); /*Car2(NICAM) MSB XMHz*/ | ||
166 | tda9875_write(sd, TDA9875_C2MIB, 0x00); /*Car2(NICAM) MIB XMHz*/ | ||
167 | tda9875_write(sd, TDA9875_C2LSB, 0x00); /*Car2(NICAM) LSB XMHz*/ | ||
168 | tda9875_write(sd, TDA9875_DCR, 0x00); /*Demod config 0x00*/ | ||
169 | tda9875_write(sd, TDA9875_DEEM, 0x44); /*DE-Emph 0b0100 0100*/ | ||
170 | tda9875_write(sd, TDA9875_FMAT, 0x00); /*FM Matrix reg 0x00*/ | ||
171 | tda9875_write(sd, TDA9875_SC1, 0x00); /* SCART 1 (SC1)*/ | ||
172 | tda9875_write(sd, TDA9875_SC2, 0x01); /* SCART 2 (sc2)*/ | ||
173 | |||
174 | tda9875_write(sd, TDA9875_CH1V, 0x10); /* Channel volume 1 mute*/ | ||
175 | tda9875_write(sd, TDA9875_CH2V, 0x10); /* Channel volume 2 mute */ | ||
176 | tda9875_write(sd, TDA9875_DACOS, 0x02); /* sig DAC i/o(in:nicam)*/ | ||
177 | tda9875_write(sd, TDA9875_ADCIS, 0x6f); /* sig ADC input(in:mono)*/ | ||
178 | tda9875_write(sd, TDA9875_LOSR, 0x00); /* line out (in:mono)*/ | ||
179 | tda9875_write(sd, TDA9875_AER, 0x00); /*06 Effect (AVL+PSEUDO) */ | ||
180 | tda9875_write(sd, TDA9875_MCS, 0x44); /* Main ch select (DAC) */ | ||
181 | tda9875_write(sd, TDA9875_MVL, 0x03); /* Vol Main left 10dB */ | ||
182 | tda9875_write(sd, TDA9875_MVR, 0x03); /* Vol Main right 10dB*/ | ||
183 | tda9875_write(sd, TDA9875_MBA, 0x00); /* Main Bass Main 0dB*/ | ||
184 | tda9875_write(sd, TDA9875_MTR, 0x00); /* Main Treble Main 0dB*/ | ||
185 | tda9875_write(sd, TDA9875_ACS, 0x44); /* Aux chan select (dac)*/ | ||
186 | tda9875_write(sd, TDA9875_AVL, 0x00); /* Vol Aux left 0dB*/ | ||
187 | tda9875_write(sd, TDA9875_AVR, 0x00); /* Vol Aux right 0dB*/ | ||
188 | tda9875_write(sd, TDA9875_ABA, 0x00); /* Aux Bass Main 0dB*/ | ||
189 | tda9875_write(sd, TDA9875_ATR, 0x00); /* Aux Aigus Main 0dB*/ | ||
190 | |||
191 | tda9875_write(sd, TDA9875_MUT, 0xcc); /* General mute */ | ||
192 | |||
193 | t->lvol = t->rvol = 0; /* 0dB */ | ||
194 | t->bass = 0; /* 0dB */ | ||
195 | t->treble = 0; /* 0dB */ | ||
196 | tda9875_set(sd); | ||
197 | } | ||
198 | |||
199 | |||
200 | static int tda9875_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) | ||
201 | { | ||
202 | struct tda9875 *t = to_state(sd); | ||
203 | |||
204 | switch (ctrl->id) { | ||
205 | case V4L2_CID_AUDIO_VOLUME: | ||
206 | { | ||
207 | int left = (t->lvol+84)*606; | ||
208 | int right = (t->rvol+84)*606; | ||
209 | |||
210 | ctrl->value=max(left,right); | ||
211 | return 0; | ||
212 | } | ||
213 | case V4L2_CID_AUDIO_BALANCE: | ||
214 | { | ||
215 | int left = (t->lvol+84)*606; | ||
216 | int right = (t->rvol+84)*606; | ||
217 | int volume = max(left,right); | ||
218 | int balance = (32768*min(left,right))/ | ||
219 | (volume ? volume : 1); | ||
220 | ctrl->value=(left<right)? | ||
221 | (65535-balance) : balance; | ||
222 | return 0; | ||
223 | } | ||
224 | case V4L2_CID_AUDIO_BASS: | ||
225 | ctrl->value = (t->bass+12)*2427; /* min -12 max +15 */ | ||
226 | return 0; | ||
227 | case V4L2_CID_AUDIO_TREBLE: | ||
228 | ctrl->value = (t->treble+12)*2730;/* min -12 max +12 */ | ||
229 | return 0; | ||
230 | } | ||
231 | return -EINVAL; | ||
232 | } | ||
233 | |||
234 | static int tda9875_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) | ||
235 | { | ||
236 | struct tda9875 *t = to_state(sd); | ||
237 | int chvol = 0, volume = 0, balance = 0, left, right; | ||
238 | |||
239 | switch (ctrl->id) { | ||
240 | case V4L2_CID_AUDIO_VOLUME: | ||
241 | left = (t->lvol+84)*606; | ||
242 | right = (t->rvol+84)*606; | ||
243 | |||
244 | volume = max(left,right); | ||
245 | balance = (32768*min(left,right))/ | ||
246 | (volume ? volume : 1); | ||
247 | balance =(left<right)? | ||
248 | (65535-balance) : balance; | ||
249 | |||
250 | volume = ctrl->value; | ||
251 | |||
252 | chvol=1; | ||
253 | break; | ||
254 | case V4L2_CID_AUDIO_BALANCE: | ||
255 | left = (t->lvol+84)*606; | ||
256 | right = (t->rvol+84)*606; | ||
257 | |||
258 | volume=max(left,right); | ||
259 | |||
260 | balance = ctrl->value; | ||
261 | |||
262 | chvol=1; | ||
263 | break; | ||
264 | case V4L2_CID_AUDIO_BASS: | ||
265 | t->bass = ((ctrl->value/2400)-12) & 0xff; | ||
266 | if (t->bass > 15) | ||
267 | t->bass = 15; | ||
268 | if (t->bass < -12) | ||
269 | t->bass = -12 & 0xff; | ||
270 | break; | ||
271 | case V4L2_CID_AUDIO_TREBLE: | ||
272 | t->treble = ((ctrl->value/2700)-12) & 0xff; | ||
273 | if (t->treble > 12) | ||
274 | t->treble = 12; | ||
275 | if (t->treble < -12) | ||
276 | t->treble = -12 & 0xff; | ||
277 | break; | ||
278 | default: | ||
279 | return -EINVAL; | ||
280 | } | ||
281 | |||
282 | if (chvol) { | ||
283 | left = (min(65536 - balance,32768) * | ||
284 | volume) / 32768; | ||
285 | right = (min(balance,32768) * | ||
286 | volume) / 32768; | ||
287 | t->lvol = ((left/606)-84) & 0xff; | ||
288 | if (t->lvol > 24) | ||
289 | t->lvol = 24; | ||
290 | if (t->lvol < -84) | ||
291 | t->lvol = -84 & 0xff; | ||
292 | |||
293 | t->rvol = ((right/606)-84) & 0xff; | ||
294 | if (t->rvol > 24) | ||
295 | t->rvol = 24; | ||
296 | if (t->rvol < -84) | ||
297 | t->rvol = -84 & 0xff; | ||
298 | } | ||
299 | |||
300 | tda9875_set(sd); | ||
301 | return 0; | ||
302 | } | ||
303 | |||
304 | static int tda9875_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc) | ||
305 | { | ||
306 | switch (qc->id) { | ||
307 | case V4L2_CID_AUDIO_VOLUME: | ||
308 | return v4l2_ctrl_query_fill(qc, 0, 65535, 65535 / 100, 58880); | ||
309 | case V4L2_CID_AUDIO_BASS: | ||
310 | case V4L2_CID_AUDIO_TREBLE: | ||
311 | return v4l2_ctrl_query_fill(qc, 0, 65535, 65535 / 100, 32768); | ||
312 | } | ||
313 | return -EINVAL; | ||
314 | } | ||
315 | |||
316 | /* ----------------------------------------------------------------------- */ | ||
317 | |||
318 | static const struct v4l2_subdev_core_ops tda9875_core_ops = { | ||
319 | .queryctrl = tda9875_queryctrl, | ||
320 | .g_ctrl = tda9875_g_ctrl, | ||
321 | .s_ctrl = tda9875_s_ctrl, | ||
322 | }; | ||
323 | |||
324 | static const struct v4l2_subdev_ops tda9875_ops = { | ||
325 | .core = &tda9875_core_ops, | ||
326 | }; | ||
327 | |||
328 | /* ----------------------------------------------------------------------- */ | ||
329 | |||
330 | |||
331 | /* *********************** * | ||
332 | * i2c interface functions * | ||
333 | * *********************** */ | ||
334 | |||
335 | static int tda9875_checkit(struct i2c_client *client, int addr) | ||
336 | { | ||
337 | int dic, rev; | ||
338 | |||
339 | dic = i2c_read_register(client, addr, 254); | ||
340 | rev = i2c_read_register(client, addr, 255); | ||
341 | |||
342 | if (dic == 0 || dic == 2) { /* tda9875 and tda9875A */ | ||
343 | v4l_info(client, "tda9875%s rev. %d detected at 0x%02x\n", | ||
344 | dic == 0 ? "" : "A", rev, addr << 1); | ||
345 | return 1; | ||
346 | } | ||
347 | v4l_info(client, "no such chip at 0x%02x (dic=0x%x rev=0x%x)\n", | ||
348 | addr << 1, dic, rev); | ||
349 | return 0; | ||
350 | } | ||
351 | |||
352 | static int tda9875_probe(struct i2c_client *client, | ||
353 | const struct i2c_device_id *id) | ||
354 | { | ||
355 | struct tda9875 *t; | ||
356 | struct v4l2_subdev *sd; | ||
357 | |||
358 | v4l_info(client, "chip found @ 0x%02x (%s)\n", | ||
359 | client->addr << 1, client->adapter->name); | ||
360 | |||
361 | if (!tda9875_checkit(client, client->addr)) | ||
362 | return -ENODEV; | ||
363 | |||
364 | t = kzalloc(sizeof(*t), GFP_KERNEL); | ||
365 | if (!t) | ||
366 | return -ENOMEM; | ||
367 | sd = &t->sd; | ||
368 | v4l2_i2c_subdev_init(sd, client, &tda9875_ops); | ||
369 | |||
370 | do_tda9875_init(sd); | ||
371 | return 0; | ||
372 | } | ||
373 | |||
374 | static int tda9875_remove(struct i2c_client *client) | ||
375 | { | ||
376 | struct v4l2_subdev *sd = i2c_get_clientdata(client); | ||
377 | |||
378 | do_tda9875_init(sd); | ||
379 | v4l2_device_unregister_subdev(sd); | ||
380 | kfree(to_state(sd)); | ||
381 | return 0; | ||
382 | } | ||
383 | |||
384 | static const struct i2c_device_id tda9875_id[] = { | ||
385 | { "tda9875", 0 }, | ||
386 | { } | ||
387 | }; | ||
388 | MODULE_DEVICE_TABLE(i2c, tda9875_id); | ||
389 | |||
390 | static struct i2c_driver tda9875_driver = { | ||
391 | .driver = { | ||
392 | .owner = THIS_MODULE, | ||
393 | .name = "tda9875", | ||
394 | }, | ||
395 | .probe = tda9875_probe, | ||
396 | .remove = tda9875_remove, | ||
397 | .id_table = tda9875_id, | ||
398 | }; | ||
399 | |||
400 | static __init int init_tda9875(void) | ||
401 | { | ||
402 | return i2c_add_driver(&tda9875_driver); | ||
403 | } | ||
404 | |||
405 | static __exit void exit_tda9875(void) | ||
406 | { | ||
407 | i2c_del_driver(&tda9875_driver); | ||
408 | } | ||
409 | |||
410 | module_init(init_tda9875); | ||
411 | module_exit(exit_tda9875); | ||
diff --git a/drivers/media/video/tlg2300/pd-video.c b/drivers/media/video/tlg2300/pd-video.c index a1ffe18640fe..df33a1d188bb 100644 --- a/drivers/media/video/tlg2300/pd-video.c +++ b/drivers/media/video/tlg2300/pd-video.c | |||
@@ -512,19 +512,20 @@ int alloc_bulk_urbs_generic(struct urb **urb_array, int num, | |||
512 | int buf_size, gfp_t gfp_flags, | 512 | int buf_size, gfp_t gfp_flags, |
513 | usb_complete_t complete_fn, void *context) | 513 | usb_complete_t complete_fn, void *context) |
514 | { | 514 | { |
515 | struct urb *urb; | 515 | int i = 0; |
516 | void *mem; | ||
517 | int i; | ||
518 | 516 | ||
519 | for (i = 0; i < num; i++) { | 517 | for (; i < num; i++) { |
520 | urb = usb_alloc_urb(0, gfp_flags); | 518 | void *mem; |
519 | struct urb *urb = usb_alloc_urb(0, gfp_flags); | ||
521 | if (urb == NULL) | 520 | if (urb == NULL) |
522 | return i; | 521 | return i; |
523 | 522 | ||
524 | mem = usb_alloc_coherent(udev, buf_size, gfp_flags, | 523 | mem = usb_alloc_coherent(udev, buf_size, gfp_flags, |
525 | &urb->transfer_dma); | 524 | &urb->transfer_dma); |
526 | if (mem == NULL) | 525 | if (mem == NULL) { |
526 | usb_free_urb(urb); | ||
527 | return i; | 527 | return i; |
528 | } | ||
528 | 529 | ||
529 | usb_fill_bulk_urb(urb, udev, usb_rcvbulkpipe(udev, ep_addr), | 530 | usb_fill_bulk_urb(urb, udev, usb_rcvbulkpipe(udev, ep_addr), |
530 | mem, buf_size, complete_fn, context); | 531 | mem, buf_size, complete_fn, context); |
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 3f0871b550ad..810eef43c216 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c | |||
@@ -407,18 +407,6 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev, | |||
407 | /* Decrease the module use count to match the first try_module_get. */ | 407 | /* Decrease the module use count to match the first try_module_get. */ |
408 | module_put(client->driver->driver.owner); | 408 | module_put(client->driver->driver.owner); |
409 | 409 | ||
410 | if (sd) { | ||
411 | /* We return errors from v4l2_subdev_call only if we have the | ||
412 | callback as the .s_config is not mandatory */ | ||
413 | int err = v4l2_subdev_call(sd, core, s_config, | ||
414 | info->irq, info->platform_data); | ||
415 | |||
416 | if (err && err != -ENOIOCTLCMD) { | ||
417 | v4l2_device_unregister_subdev(sd); | ||
418 | sd = NULL; | ||
419 | } | ||
420 | } | ||
421 | |||
422 | error: | 410 | error: |
423 | /* If we have a client but no subdev, then something went wrong and | 411 | /* If we have a client but no subdev, then something went wrong and |
424 | we must unregister the client. */ | 412 | we must unregister the client. */ |
@@ -428,9 +416,8 @@ error: | |||
428 | } | 416 | } |
429 | EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev_board); | 417 | EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev_board); |
430 | 418 | ||
431 | struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct v4l2_device *v4l2_dev, | 419 | struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev, |
432 | struct i2c_adapter *adapter, const char *client_type, | 420 | struct i2c_adapter *adapter, const char *client_type, |
433 | int irq, void *platform_data, | ||
434 | u8 addr, const unsigned short *probe_addrs) | 421 | u8 addr, const unsigned short *probe_addrs) |
435 | { | 422 | { |
436 | struct i2c_board_info info; | 423 | struct i2c_board_info info; |
@@ -440,12 +427,10 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct v4l2_device *v4l2_dev, | |||
440 | memset(&info, 0, sizeof(info)); | 427 | memset(&info, 0, sizeof(info)); |
441 | strlcpy(info.type, client_type, sizeof(info.type)); | 428 | strlcpy(info.type, client_type, sizeof(info.type)); |
442 | info.addr = addr; | 429 | info.addr = addr; |
443 | info.irq = irq; | ||
444 | info.platform_data = platform_data; | ||
445 | 430 | ||
446 | return v4l2_i2c_new_subdev_board(v4l2_dev, adapter, &info, probe_addrs); | 431 | return v4l2_i2c_new_subdev_board(v4l2_dev, adapter, &info, probe_addrs); |
447 | } | 432 | } |
448 | EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev_cfg); | 433 | EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev); |
449 | 434 | ||
450 | /* Return i2c client address of v4l2_subdev. */ | 435 | /* Return i2c client address of v4l2_subdev. */ |
451 | unsigned short v4l2_i2c_subdev_addr(struct v4l2_subdev *sd) | 436 | unsigned short v4l2_i2c_subdev_addr(struct v4l2_subdev *sd) |
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c index 8f81efcfcf56..ef66d2af0c57 100644 --- a/drivers/media/video/v4l2-ctrls.c +++ b/drivers/media/video/v4l2-ctrls.c | |||
@@ -569,7 +569,7 @@ static int user_to_new(struct v4l2_ext_control *c, | |||
569 | int ret; | 569 | int ret; |
570 | u32 size; | 570 | u32 size; |
571 | 571 | ||
572 | ctrl->has_new = 1; | 572 | ctrl->is_new = 1; |
573 | switch (ctrl->type) { | 573 | switch (ctrl->type) { |
574 | case V4L2_CTRL_TYPE_INTEGER64: | 574 | case V4L2_CTRL_TYPE_INTEGER64: |
575 | ctrl->val64 = c->value64; | 575 | ctrl->val64 = c->value64; |
@@ -1280,8 +1280,12 @@ int v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl) | |||
1280 | if (ctrl->done) | 1280 | if (ctrl->done) |
1281 | continue; | 1281 | continue; |
1282 | 1282 | ||
1283 | for (i = 0; i < master->ncontrols; i++) | 1283 | for (i = 0; i < master->ncontrols; i++) { |
1284 | cur_to_new(master->cluster[i]); | 1284 | if (master->cluster[i]) { |
1285 | cur_to_new(master->cluster[i]); | ||
1286 | master->cluster[i]->is_new = 1; | ||
1287 | } | ||
1288 | } | ||
1285 | 1289 | ||
1286 | /* Skip button controls and read-only controls. */ | 1290 | /* Skip button controls and read-only controls. */ |
1287 | if (ctrl->type == V4L2_CTRL_TYPE_BUTTON || | 1291 | if (ctrl->type == V4L2_CTRL_TYPE_BUTTON || |
@@ -1340,12 +1344,15 @@ int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc) | |||
1340 | 1344 | ||
1341 | ctrl = ref->ctrl; | 1345 | ctrl = ref->ctrl; |
1342 | memset(qc, 0, sizeof(*qc)); | 1346 | memset(qc, 0, sizeof(*qc)); |
1343 | qc->id = ctrl->id; | 1347 | if (id >= V4L2_CID_PRIVATE_BASE) |
1348 | qc->id = id; | ||
1349 | else | ||
1350 | qc->id = ctrl->id; | ||
1344 | strlcpy(qc->name, ctrl->name, sizeof(qc->name)); | 1351 | strlcpy(qc->name, ctrl->name, sizeof(qc->name)); |
1345 | qc->minimum = ctrl->minimum; | 1352 | qc->minimum = ctrl->minimum; |
1346 | qc->maximum = ctrl->maximum; | 1353 | qc->maximum = ctrl->maximum; |
1347 | qc->default_value = ctrl->default_value; | 1354 | qc->default_value = ctrl->default_value; |
1348 | if (qc->type == V4L2_CTRL_TYPE_MENU) | 1355 | if (ctrl->type == V4L2_CTRL_TYPE_MENU) |
1349 | qc->step = 1; | 1356 | qc->step = 1; |
1350 | else | 1357 | else |
1351 | qc->step = ctrl->step; | 1358 | qc->step = ctrl->step; |
@@ -1645,7 +1652,7 @@ static int try_or_set_control_cluster(struct v4l2_ctrl *master, bool set) | |||
1645 | if (ctrl == NULL) | 1652 | if (ctrl == NULL) |
1646 | continue; | 1653 | continue; |
1647 | 1654 | ||
1648 | if (ctrl->has_new) { | 1655 | if (ctrl->is_new) { |
1649 | /* Double check this: it may have changed since the | 1656 | /* Double check this: it may have changed since the |
1650 | last check in try_or_set_ext_ctrls(). */ | 1657 | last check in try_or_set_ext_ctrls(). */ |
1651 | if (set && (ctrl->flags & V4L2_CTRL_FLAG_GRABBED)) | 1658 | if (set && (ctrl->flags & V4L2_CTRL_FLAG_GRABBED)) |
@@ -1719,13 +1726,13 @@ static int try_or_set_ext_ctrls(struct v4l2_ctrl_handler *hdl, | |||
1719 | 1726 | ||
1720 | v4l2_ctrl_lock(ctrl); | 1727 | v4l2_ctrl_lock(ctrl); |
1721 | 1728 | ||
1722 | /* Reset the 'has_new' flags of the cluster */ | 1729 | /* Reset the 'is_new' flags of the cluster */ |
1723 | for (j = 0; j < master->ncontrols; j++) | 1730 | for (j = 0; j < master->ncontrols; j++) |
1724 | if (master->cluster[j]) | 1731 | if (master->cluster[j]) |
1725 | master->cluster[j]->has_new = 0; | 1732 | master->cluster[j]->is_new = 0; |
1726 | 1733 | ||
1727 | /* Copy the new caller-supplied control values. | 1734 | /* Copy the new caller-supplied control values. |
1728 | user_to_new() sets 'has_new' to 1. */ | 1735 | user_to_new() sets 'is_new' to 1. */ |
1729 | ret = cluster_walk(i, cs, helpers, user_to_new); | 1736 | ret = cluster_walk(i, cs, helpers, user_to_new); |
1730 | 1737 | ||
1731 | if (!ret) | 1738 | if (!ret) |
@@ -1820,15 +1827,18 @@ static int set_ctrl(struct v4l2_ctrl *ctrl, s32 *val) | |||
1820 | int ret; | 1827 | int ret; |
1821 | int i; | 1828 | int i; |
1822 | 1829 | ||
1830 | if (ctrl->flags & V4L2_CTRL_FLAG_READ_ONLY) | ||
1831 | return -EACCES; | ||
1832 | |||
1823 | v4l2_ctrl_lock(ctrl); | 1833 | v4l2_ctrl_lock(ctrl); |
1824 | 1834 | ||
1825 | /* Reset the 'has_new' flags of the cluster */ | 1835 | /* Reset the 'is_new' flags of the cluster */ |
1826 | for (i = 0; i < master->ncontrols; i++) | 1836 | for (i = 0; i < master->ncontrols; i++) |
1827 | if (master->cluster[i]) | 1837 | if (master->cluster[i]) |
1828 | master->cluster[i]->has_new = 0; | 1838 | master->cluster[i]->is_new = 0; |
1829 | 1839 | ||
1830 | ctrl->val = *val; | 1840 | ctrl->val = *val; |
1831 | ctrl->has_new = 1; | 1841 | ctrl->is_new = 1; |
1832 | ret = try_or_set_control_cluster(master, false); | 1842 | ret = try_or_set_control_cluster(master, false); |
1833 | if (!ret) | 1843 | if (!ret) |
1834 | ret = try_or_set_control_cluster(master, true); | 1844 | ret = try_or_set_control_cluster(master, true); |
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index 359e23290a7e..341764a3a990 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c | |||
@@ -419,6 +419,10 @@ static int get_index(struct video_device *vdev) | |||
419 | * The registration code assigns minor numbers and device node numbers | 419 | * The registration code assigns minor numbers and device node numbers |
420 | * based on the requested type and registers the new device node with | 420 | * based on the requested type and registers the new device node with |
421 | * the kernel. | 421 | * the kernel. |
422 | * | ||
423 | * This function assumes that struct video_device was zeroed when it | ||
424 | * was allocated and does not contain any stale date. | ||
425 | * | ||
422 | * An error is returned if no free minor or device node number could be | 426 | * An error is returned if no free minor or device node number could be |
423 | * found, or if the registration of the device node failed. | 427 | * found, or if the registration of the device node failed. |
424 | * | 428 | * |
@@ -440,7 +444,6 @@ static int __video_register_device(struct video_device *vdev, int type, int nr, | |||
440 | int minor_offset = 0; | 444 | int minor_offset = 0; |
441 | int minor_cnt = VIDEO_NUM_DEVICES; | 445 | int minor_cnt = VIDEO_NUM_DEVICES; |
442 | const char *name_base; | 446 | const char *name_base; |
443 | void *priv = vdev->dev.p; | ||
444 | 447 | ||
445 | /* A minor value of -1 marks this video device as never | 448 | /* A minor value of -1 marks this video device as never |
446 | having been registered */ | 449 | having been registered */ |
@@ -559,10 +562,6 @@ static int __video_register_device(struct video_device *vdev, int type, int nr, | |||
559 | } | 562 | } |
560 | 563 | ||
561 | /* Part 4: register the device with sysfs */ | 564 | /* Part 4: register the device with sysfs */ |
562 | memset(&vdev->dev, 0, sizeof(vdev->dev)); | ||
563 | /* The memset above cleared the device's device_private, so | ||
564 | put back the copy we made earlier. */ | ||
565 | vdev->dev.p = priv; | ||
566 | vdev->dev.class = &video_class; | 565 | vdev->dev.class = &video_class; |
567 | vdev->dev.devt = MKDEV(VIDEO_MAJOR, vdev->minor); | 566 | vdev->dev.devt = MKDEV(VIDEO_MAJOR, vdev->minor); |
568 | if (vdev->parent) | 567 | if (vdev->parent) |
diff --git a/drivers/media/video/v4l2-device.c b/drivers/media/video/v4l2-device.c index 7fe6f92af480..ce64fe16bc60 100644 --- a/drivers/media/video/v4l2-device.c +++ b/drivers/media/video/v4l2-device.c | |||
@@ -100,6 +100,7 @@ void v4l2_device_unregister(struct v4l2_device *v4l2_dev) | |||
100 | is a platform bus, then it is never deleted. */ | 100 | is a platform bus, then it is never deleted. */ |
101 | if (client) | 101 | if (client) |
102 | i2c_unregister_device(client); | 102 | i2c_unregister_device(client); |
103 | continue; | ||
103 | } | 104 | } |
104 | #endif | 105 | #endif |
105 | #if defined(CONFIG_SPI) | 106 | #if defined(CONFIG_SPI) |
@@ -108,6 +109,7 @@ void v4l2_device_unregister(struct v4l2_device *v4l2_dev) | |||
108 | 109 | ||
109 | if (spi) | 110 | if (spi) |
110 | spi_unregister_device(spi); | 111 | spi_unregister_device(spi); |
112 | continue; | ||
111 | } | 113 | } |
112 | #endif | 114 | #endif |
113 | } | 115 | } |
@@ -126,11 +128,19 @@ int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev, | |||
126 | WARN_ON(sd->v4l2_dev != NULL); | 128 | WARN_ON(sd->v4l2_dev != NULL); |
127 | if (!try_module_get(sd->owner)) | 129 | if (!try_module_get(sd->owner)) |
128 | return -ENODEV; | 130 | return -ENODEV; |
131 | sd->v4l2_dev = v4l2_dev; | ||
132 | if (sd->internal_ops && sd->internal_ops->registered) { | ||
133 | err = sd->internal_ops->registered(sd); | ||
134 | if (err) | ||
135 | return err; | ||
136 | } | ||
129 | /* This just returns 0 if either of the two args is NULL */ | 137 | /* This just returns 0 if either of the two args is NULL */ |
130 | err = v4l2_ctrl_add_handler(v4l2_dev->ctrl_handler, sd->ctrl_handler); | 138 | err = v4l2_ctrl_add_handler(v4l2_dev->ctrl_handler, sd->ctrl_handler); |
131 | if (err) | 139 | if (err) { |
140 | if (sd->internal_ops && sd->internal_ops->unregistered) | ||
141 | sd->internal_ops->unregistered(sd); | ||
132 | return err; | 142 | return err; |
133 | sd->v4l2_dev = v4l2_dev; | 143 | } |
134 | spin_lock(&v4l2_dev->lock); | 144 | spin_lock(&v4l2_dev->lock); |
135 | list_add_tail(&sd->list, &v4l2_dev->subdevs); | 145 | list_add_tail(&sd->list, &v4l2_dev->subdevs); |
136 | spin_unlock(&v4l2_dev->lock); | 146 | spin_unlock(&v4l2_dev->lock); |
@@ -146,6 +156,8 @@ void v4l2_device_unregister_subdev(struct v4l2_subdev *sd) | |||
146 | spin_lock(&sd->v4l2_dev->lock); | 156 | spin_lock(&sd->v4l2_dev->lock); |
147 | list_del(&sd->list); | 157 | list_del(&sd->list); |
148 | spin_unlock(&sd->v4l2_dev->lock); | 158 | spin_unlock(&sd->v4l2_dev->lock); |
159 | if (sd->internal_ops && sd->internal_ops->unregistered) | ||
160 | sd->internal_ops->unregistered(sd); | ||
149 | sd->v4l2_dev = NULL; | 161 | sd->v4l2_dev = NULL; |
150 | module_put(sd->owner); | 162 | module_put(sd->owner); |
151 | } | 163 | } |
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index 7e47f15f350d..f51327ef6757 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c | |||
@@ -1659,20 +1659,24 @@ static long __video_do_ioctl(struct file *file, | |||
1659 | { | 1659 | { |
1660 | struct v4l2_dbg_register *p = arg; | 1660 | struct v4l2_dbg_register *p = arg; |
1661 | 1661 | ||
1662 | if (!capable(CAP_SYS_ADMIN)) | 1662 | if (ops->vidioc_g_register) { |
1663 | ret = -EPERM; | 1663 | if (!capable(CAP_SYS_ADMIN)) |
1664 | else if (ops->vidioc_g_register) | 1664 | ret = -EPERM; |
1665 | ret = ops->vidioc_g_register(file, fh, p); | 1665 | else |
1666 | ret = ops->vidioc_g_register(file, fh, p); | ||
1667 | } | ||
1666 | break; | 1668 | break; |
1667 | } | 1669 | } |
1668 | case VIDIOC_DBG_S_REGISTER: | 1670 | case VIDIOC_DBG_S_REGISTER: |
1669 | { | 1671 | { |
1670 | struct v4l2_dbg_register *p = arg; | 1672 | struct v4l2_dbg_register *p = arg; |
1671 | 1673 | ||
1672 | if (!capable(CAP_SYS_ADMIN)) | 1674 | if (ops->vidioc_s_register) { |
1673 | ret = -EPERM; | 1675 | if (!capable(CAP_SYS_ADMIN)) |
1674 | else if (ops->vidioc_s_register) | 1676 | ret = -EPERM; |
1675 | ret = ops->vidioc_s_register(file, fh, p); | 1677 | else |
1678 | ret = ops->vidioc_s_register(file, fh, p); | ||
1679 | } | ||
1676 | break; | 1680 | break; |
1677 | } | 1681 | } |
1678 | #endif | 1682 | #endif |
diff --git a/drivers/media/video/w9966.c b/drivers/media/video/w9966.c index 019ee206cbee..fa35639d0c15 100644 --- a/drivers/media/video/w9966.c +++ b/drivers/media/video/w9966.c | |||
@@ -937,6 +937,7 @@ static void w9966_term(struct w9966 *cam) | |||
937 | parport_unregister_device(cam->pdev); | 937 | parport_unregister_device(cam->pdev); |
938 | w9966_set_state(cam, W9966_STATE_PDEV, 0); | 938 | w9966_set_state(cam, W9966_STATE_PDEV, 0); |
939 | } | 939 | } |
940 | memset(cam, 0, sizeof(*cam)); | ||
940 | } | 941 | } |
941 | 942 | ||
942 | 943 | ||
diff --git a/drivers/media/video/zoran/zoran_card.c b/drivers/media/video/zoran/zoran_card.c index 9cdc3bb15b15..9f2bac519647 100644 --- a/drivers/media/video/zoran/zoran_card.c +++ b/drivers/media/video/zoran/zoran_card.c | |||
@@ -1041,7 +1041,7 @@ zr36057_init (struct zoran *zr) | |||
1041 | /* allocate memory *before* doing anything to the hardware | 1041 | /* allocate memory *before* doing anything to the hardware |
1042 | * in case allocation fails */ | 1042 | * in case allocation fails */ |
1043 | zr->stat_com = kzalloc(BUZ_NUM_STAT_COM * 4, GFP_KERNEL); | 1043 | zr->stat_com = kzalloc(BUZ_NUM_STAT_COM * 4, GFP_KERNEL); |
1044 | zr->video_dev = kmalloc(sizeof(struct video_device), GFP_KERNEL); | 1044 | zr->video_dev = video_device_alloc(); |
1045 | if (!zr->stat_com || !zr->video_dev) { | 1045 | if (!zr->stat_com || !zr->video_dev) { |
1046 | dprintk(1, | 1046 | dprintk(1, |
1047 | KERN_ERR | 1047 | KERN_ERR |