diff options
author | Dean Anderson <dean@sensoray.com> | 2010-04-08 22:51:17 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-19 11:57:24 -0400 |
commit | 85b85482c243398839564d5f95d75f479bed591c (patch) | |
tree | 621634c77bdceff75ce6f506cf76ace066bd0fb8 /drivers/media/video/s2255drv.c | |
parent | a5ef91c9a55c89e8c57e628d371107cdfe2d0bd9 (diff) |
V4L/DVB: s2255drv: cleanup of debug messages
Signed-off-by: Dean Anderson <dean@sensoray.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/s2255drv.c')
-rw-r--r-- | drivers/media/video/s2255drv.c | 153 |
1 files changed, 42 insertions, 111 deletions
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c index 83ee93d4ad1c..aba7a72f355f 100644 --- a/drivers/media/video/s2255drv.c +++ b/drivers/media/video/s2255drv.c | |||
@@ -56,10 +56,14 @@ | |||
56 | #include <linux/vmalloc.h> | 56 | #include <linux/vmalloc.h> |
57 | #include <linux/usb.h> | 57 | #include <linux/usb.h> |
58 | 58 | ||
59 | #define S2255_MAJOR_VERSION 1 | ||
60 | #define S2255_MINOR_VERSION 19 | ||
61 | #define S2255_RELEASE 0 | ||
62 | #define S2255_VERSION KERNEL_VERSION(S2255_MAJOR_VERSION, \ | ||
63 | S2255_MINOR_VERSION, \ | ||
64 | S2255_RELEASE) | ||
59 | #define FIRMWARE_FILE_NAME "f2255usb.bin" | 65 | #define FIRMWARE_FILE_NAME "f2255usb.bin" |
60 | 66 | ||
61 | |||
62 | |||
63 | /* default JPEG quality */ | 67 | /* default JPEG quality */ |
64 | #define S2255_DEF_JPEG_QUAL 50 | 68 | #define S2255_DEF_JPEG_QUAL 50 |
65 | /* vendor request in */ | 69 | /* vendor request in */ |
@@ -308,13 +312,6 @@ struct s2255_fh { | |||
308 | /* Need DSP version 5+ for video status feature */ | 312 | /* Need DSP version 5+ for video status feature */ |
309 | #define S2255_MIN_DSP_STATUS 5 | 313 | #define S2255_MIN_DSP_STATUS 5 |
310 | #define S2255_MIN_DSP_COLORFILTER 8 | 314 | #define S2255_MIN_DSP_COLORFILTER 8 |
311 | #define S2255_MAJOR_VERSION 1 | ||
312 | #define S2255_MINOR_VERSION 18 | ||
313 | #define S2255_RELEASE 0 | ||
314 | #define S2255_VERSION KERNEL_VERSION(S2255_MAJOR_VERSION, \ | ||
315 | S2255_MINOR_VERSION, \ | ||
316 | S2255_RELEASE) | ||
317 | |||
318 | #define S2255_NORMS (V4L2_STD_PAL | V4L2_STD_NTSC) | 315 | #define S2255_NORMS (V4L2_STD_PAL | V4L2_STD_NTSC) |
319 | 316 | ||
320 | /* private V4L2 controls */ | 317 | /* private V4L2 controls */ |
@@ -501,7 +498,7 @@ static void s2255_reset_dsppower(struct s2255_dev *dev) | |||
501 | static void s2255_timer(unsigned long user_data) | 498 | static void s2255_timer(unsigned long user_data) |
502 | { | 499 | { |
503 | struct s2255_fw *data = (struct s2255_fw *)user_data; | 500 | struct s2255_fw *data = (struct s2255_fw *)user_data; |
504 | dprintk(100, "s2255 timer\n"); | 501 | dprintk(100, "%s\n", __func__); |
505 | if (usb_submit_urb(data->fw_urb, GFP_ATOMIC) < 0) { | 502 | if (usb_submit_urb(data->fw_urb, GFP_ATOMIC) < 0) { |
506 | printk(KERN_ERR "s2255: can't submit urb\n"); | 503 | printk(KERN_ERR "s2255: can't submit urb\n"); |
507 | atomic_set(&data->fw_state, S2255_FW_FAILED); | 504 | atomic_set(&data->fw_state, S2255_FW_FAILED); |
@@ -523,7 +520,7 @@ static void s2255_fwchunk_complete(struct urb *urb) | |||
523 | struct s2255_fw *data = urb->context; | 520 | struct s2255_fw *data = urb->context; |
524 | struct usb_device *udev = urb->dev; | 521 | struct usb_device *udev = urb->dev; |
525 | int len; | 522 | int len; |
526 | dprintk(100, "udev %p urb %p", udev, urb); | 523 | dprintk(100, "%s: udev %p urb %p", __func__, udev, urb); |
527 | if (urb->status) { | 524 | if (urb->status) { |
528 | dev_err(&udev->dev, "URB failed with status %d\n", urb->status); | 525 | dev_err(&udev->dev, "URB failed with status %d\n", urb->status); |
529 | atomic_set(&data->fw_state, S2255_FW_FAILED); | 526 | atomic_set(&data->fw_state, S2255_FW_FAILED); |
@@ -569,8 +566,8 @@ static void s2255_fwchunk_complete(struct urb *urb) | |||
569 | data->fw_loaded += len; | 566 | data->fw_loaded += len; |
570 | } else { | 567 | } else { |
571 | atomic_set(&data->fw_state, S2255_FW_LOADED_DSPWAIT); | 568 | atomic_set(&data->fw_state, S2255_FW_LOADED_DSPWAIT); |
569 | dprintk(100, "%s: firmware upload complete\n", __func__); | ||
572 | } | 570 | } |
573 | dprintk(100, "2255 complete done\n"); | ||
574 | return; | 571 | return; |
575 | 572 | ||
576 | } | 573 | } |
@@ -581,9 +578,7 @@ static int s2255_got_frame(struct s2255_dev *dev, int chn, int jpgsize) | |||
581 | struct s2255_buffer *buf; | 578 | struct s2255_buffer *buf; |
582 | unsigned long flags = 0; | 579 | unsigned long flags = 0; |
583 | int rc = 0; | 580 | int rc = 0; |
584 | dprintk(2, "wakeup: %p channel: %d\n", &dma_q, chn); | ||
585 | spin_lock_irqsave(&dev->slock, flags); | 581 | spin_lock_irqsave(&dev->slock, flags); |
586 | |||
587 | if (list_empty(&dma_q->active)) { | 582 | if (list_empty(&dma_q->active)) { |
588 | dprintk(1, "No active queue to serve\n"); | 583 | dprintk(1, "No active queue to serve\n"); |
589 | rc = -1; | 584 | rc = -1; |
@@ -591,13 +586,11 @@ static int s2255_got_frame(struct s2255_dev *dev, int chn, int jpgsize) | |||
591 | } | 586 | } |
592 | buf = list_entry(dma_q->active.next, | 587 | buf = list_entry(dma_q->active.next, |
593 | struct s2255_buffer, vb.queue); | 588 | struct s2255_buffer, vb.queue); |
594 | |||
595 | list_del(&buf->vb.queue); | 589 | list_del(&buf->vb.queue); |
596 | do_gettimeofday(&buf->vb.ts); | 590 | do_gettimeofday(&buf->vb.ts); |
597 | dprintk(100, "[%p/%d] wakeup\n", buf, buf->vb.i); | ||
598 | s2255_fillbuff(dev, buf, dma_q->channel, jpgsize); | 591 | s2255_fillbuff(dev, buf, dma_q->channel, jpgsize); |
599 | wake_up(&buf->vb.done); | 592 | wake_up(&buf->vb.done); |
600 | dprintk(2, "wakeup [buf/i] [%p/%d]\n", buf, buf->vb.i); | 593 | dprintk(2, "%s: [buf/i] [%p/%d]\n", __func__, buf, buf->vb.i); |
601 | unlock: | 594 | unlock: |
602 | spin_unlock_irqrestore(&dev->slock, flags); | 595 | spin_unlock_irqrestore(&dev->slock, flags); |
603 | return 0; | 596 | return 0; |
@@ -606,7 +599,6 @@ unlock: | |||
606 | static const struct s2255_fmt *format_by_fourcc(int fourcc) | 599 | static const struct s2255_fmt *format_by_fourcc(int fourcc) |
607 | { | 600 | { |
608 | unsigned int i; | 601 | unsigned int i; |
609 | |||
610 | for (i = 0; i < ARRAY_SIZE(formats); i++) { | 602 | for (i = 0; i < ARRAY_SIZE(formats); i++) { |
611 | if (-1 == formats[i].fourcc) | 603 | if (-1 == formats[i].fourcc) |
612 | continue; | 604 | continue; |
@@ -739,7 +731,6 @@ static int buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, | |||
739 | buf->vb.height = fh->height; | 731 | buf->vb.height = fh->height; |
740 | buf->vb.field = field; | 732 | buf->vb.field = field; |
741 | 733 | ||
742 | |||
743 | if (VIDEOBUF_NEEDS_INIT == buf->vb.state) { | 734 | if (VIDEOBUF_NEEDS_INIT == buf->vb.state) { |
744 | rc = videobuf_iolock(vq, &buf->vb, NULL); | 735 | rc = videobuf_iolock(vq, &buf->vb, NULL); |
745 | if (rc < 0) | 736 | if (rc < 0) |
@@ -759,9 +750,7 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) | |||
759 | struct s2255_fh *fh = vq->priv_data; | 750 | struct s2255_fh *fh = vq->priv_data; |
760 | struct s2255_dev *dev = fh->dev; | 751 | struct s2255_dev *dev = fh->dev; |
761 | struct s2255_dmaqueue *vidq = &dev->vidq[fh->channel]; | 752 | struct s2255_dmaqueue *vidq = &dev->vidq[fh->channel]; |
762 | |||
763 | dprintk(1, "%s\n", __func__); | 753 | dprintk(1, "%s\n", __func__); |
764 | |||
765 | buf->vb.state = VIDEOBUF_QUEUED; | 754 | buf->vb.state = VIDEOBUF_QUEUED; |
766 | list_add_tail(&buf->vb.queue, &vidq->active); | 755 | list_add_tail(&buf->vb.queue, &vidq->active); |
767 | } | 756 | } |
@@ -907,10 +896,8 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, | |||
907 | if (field == V4L2_FIELD_ANY) | 896 | if (field == V4L2_FIELD_ANY) |
908 | b_any_field = 1; | 897 | b_any_field = 1; |
909 | 898 | ||
910 | dprintk(4, "try format %d \n", is_ntsc); | 899 | dprintk(50, "%s NTSC: %d suggested width: %d, height: %d\n", |
911 | /* supports 3 sizes. see s2255drv.h */ | 900 | __func__, is_ntsc, f->fmt.pix.width, f->fmt.pix.height); |
912 | dprintk(50, "width test %d, height %d\n", | ||
913 | f->fmt.pix.width, f->fmt.pix.height); | ||
914 | if (is_ntsc) { | 901 | if (is_ntsc) { |
915 | /* NTSC */ | 902 | /* NTSC */ |
916 | if (f->fmt.pix.height >= NUM_LINES_1CIFS_NTSC * 2) { | 903 | if (f->fmt.pix.height >= NUM_LINES_1CIFS_NTSC * 2) { |
@@ -965,29 +952,24 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, | |||
965 | } | 952 | } |
966 | } | 953 | } |
967 | if (f->fmt.pix.width >= LINE_SZ_4CIFS_PAL) { | 954 | if (f->fmt.pix.width >= LINE_SZ_4CIFS_PAL) { |
968 | dprintk(50, "pal 704\n"); | ||
969 | f->fmt.pix.width = LINE_SZ_4CIFS_PAL; | 955 | f->fmt.pix.width = LINE_SZ_4CIFS_PAL; |
970 | field = V4L2_FIELD_SEQ_TB; | 956 | field = V4L2_FIELD_SEQ_TB; |
971 | } else if (f->fmt.pix.width >= LINE_SZ_2CIFS_PAL) { | 957 | } else if (f->fmt.pix.width >= LINE_SZ_2CIFS_PAL) { |
972 | dprintk(50, "pal 352A\n"); | ||
973 | f->fmt.pix.width = LINE_SZ_2CIFS_PAL; | 958 | f->fmt.pix.width = LINE_SZ_2CIFS_PAL; |
974 | field = V4L2_FIELD_TOP; | 959 | field = V4L2_FIELD_TOP; |
975 | } else if (f->fmt.pix.width >= LINE_SZ_1CIFS_PAL) { | 960 | } else if (f->fmt.pix.width >= LINE_SZ_1CIFS_PAL) { |
976 | dprintk(50, "pal 352B\n"); | ||
977 | f->fmt.pix.width = LINE_SZ_1CIFS_PAL; | 961 | f->fmt.pix.width = LINE_SZ_1CIFS_PAL; |
978 | field = V4L2_FIELD_TOP; | 962 | field = V4L2_FIELD_TOP; |
979 | } else { | 963 | } else { |
980 | dprintk(50, "pal 352C\n"); | ||
981 | f->fmt.pix.width = LINE_SZ_1CIFS_PAL; | 964 | f->fmt.pix.width = LINE_SZ_1CIFS_PAL; |
982 | field = V4L2_FIELD_TOP; | 965 | field = V4L2_FIELD_TOP; |
983 | } | 966 | } |
984 | } | 967 | } |
985 | |||
986 | dprintk(50, "width %d height %d field %d \n", f->fmt.pix.width, | ||
987 | f->fmt.pix.height, f->fmt.pix.field); | ||
988 | f->fmt.pix.field = field; | 968 | f->fmt.pix.field = field; |
989 | f->fmt.pix.bytesperline = (f->fmt.pix.width * fmt->depth) >> 3; | 969 | f->fmt.pix.bytesperline = (f->fmt.pix.width * fmt->depth) >> 3; |
990 | f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline; | 970 | f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline; |
971 | dprintk(50, "%s: set width %d height %d field %d\n", __func__, | ||
972 | f->fmt.pix.width, f->fmt.pix.height, f->fmt.pix.field); | ||
991 | return 0; | 973 | return 0; |
992 | } | 974 | } |
993 | 975 | ||
@@ -1019,7 +1001,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, | |||
1019 | } | 1001 | } |
1020 | 1002 | ||
1021 | if (res_locked(fh->dev, fh)) { | 1003 | if (res_locked(fh->dev, fh)) { |
1022 | dprintk(1, "can't change format after started\n"); | 1004 | dprintk(1, "%s: channel busy\n", __func__); |
1023 | ret = -EBUSY; | 1005 | ret = -EBUSY; |
1024 | goto out_s_fmt; | 1006 | goto out_s_fmt; |
1025 | } | 1007 | } |
@@ -1033,13 +1015,10 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, | |||
1033 | if (fh->width > norm_minw(&fh->dev->vdev[fh->channel])) { | 1015 | if (fh->width > norm_minw(&fh->dev->vdev[fh->channel])) { |
1034 | if (fh->height > norm_minh(&fh->dev->vdev[fh->channel])) { | 1016 | if (fh->height > norm_minh(&fh->dev->vdev[fh->channel])) { |
1035 | if (fh->dev->cap_parm[fh->channel].capturemode & | 1017 | if (fh->dev->cap_parm[fh->channel].capturemode & |
1036 | V4L2_MODE_HIGHQUALITY) { | 1018 | V4L2_MODE_HIGHQUALITY) |
1037 | fh->mode.scale = SCALE_4CIFSI; | 1019 | fh->mode.scale = SCALE_4CIFSI; |
1038 | dprintk(2, "scale 4CIFSI\n"); | 1020 | else |
1039 | } else { | ||
1040 | fh->mode.scale = SCALE_4CIFS; | 1021 | fh->mode.scale = SCALE_4CIFS; |
1041 | dprintk(2, "scale 4CIFS\n"); | ||
1042 | } | ||
1043 | } else | 1022 | } else |
1044 | fh->mode.scale = SCALE_2CIFS; | 1023 | fh->mode.scale = SCALE_2CIFS; |
1045 | 1024 | ||
@@ -1195,19 +1174,13 @@ static u32 get_transfer_size(struct s2255_mode *mode) | |||
1195 | return usbInSize; | 1174 | return usbInSize; |
1196 | } | 1175 | } |
1197 | 1176 | ||
1198 | static void dump_verify_mode(struct s2255_dev *sdev, struct s2255_mode *mode) | 1177 | static void s2255_print_cfg(struct s2255_dev *sdev, struct s2255_mode *mode) |
1199 | { | 1178 | { |
1200 | struct device *dev = &sdev->udev->dev; | 1179 | struct device *dev = &sdev->udev->dev; |
1201 | dev_info(dev, "------------------------------------------------\n"); | 1180 | dev_info(dev, "------------------------------------------------\n"); |
1202 | dev_info(dev, "verify mode\n"); | 1181 | dev_info(dev, "format: %d\nscale %d\n", mode->format, mode->scale); |
1203 | dev_info(dev, "format: %d\n", mode->format); | 1182 | dev_info(dev, "fdec: %d\ncolor %d\n", mode->fdec, mode->color); |
1204 | dev_info(dev, "scale: %d\n", mode->scale); | ||
1205 | dev_info(dev, "fdec: %d\n", mode->fdec); | ||
1206 | dev_info(dev, "color: %d\n", mode->color); | ||
1207 | dev_info(dev, "bright: 0x%x\n", mode->bright); | 1183 | dev_info(dev, "bright: 0x%x\n", mode->bright); |
1208 | dev_info(dev, "restart: 0x%x\n", mode->restart); | ||
1209 | dev_info(dev, "usb_block: 0x%x\n", mode->usb_block); | ||
1210 | dev_info(dev, "single: 0x%x\n", mode->single); | ||
1211 | dev_info(dev, "------------------------------------------------\n"); | 1184 | dev_info(dev, "------------------------------------------------\n"); |
1212 | } | 1185 | } |
1213 | 1186 | ||
@@ -1227,11 +1200,7 @@ static int s2255_set_mode(struct s2255_dev *dev, unsigned long chn, | |||
1227 | unsigned long chn_rev; | 1200 | unsigned long chn_rev; |
1228 | mutex_lock(&dev->lock); | 1201 | mutex_lock(&dev->lock); |
1229 | chn_rev = G_chnmap[chn]; | 1202 | chn_rev = G_chnmap[chn]; |
1230 | dprintk(3, "mode scale [%ld] %p %d\n", chn, mode, mode->scale); | 1203 | dprintk(3, "%s channel %lu\n", __func__, chn); |
1231 | dprintk(3, "mode scale [%ld] %p %d\n", chn, &dev->mode[chn], | ||
1232 | dev->mode[chn].scale); | ||
1233 | dprintk(2, "mode contrast %x\n", mode->contrast); | ||
1234 | |||
1235 | /* if JPEG, set the quality */ | 1204 | /* if JPEG, set the quality */ |
1236 | if ((mode->color & MASK_COLOR) == COLOR_JPG) { | 1205 | if ((mode->color & MASK_COLOR) == COLOR_JPG) { |
1237 | mode->color &= ~MASK_COLOR; | 1206 | mode->color &= ~MASK_COLOR; |
@@ -1239,19 +1208,16 @@ static int s2255_set_mode(struct s2255_dev *dev, unsigned long chn, | |||
1239 | mode->color &= ~MASK_JPG_QUALITY; | 1208 | mode->color &= ~MASK_JPG_QUALITY; |
1240 | mode->color |= (dev->jc[chn].quality << 8); | 1209 | mode->color |= (dev->jc[chn].quality << 8); |
1241 | } | 1210 | } |
1242 | |||
1243 | /* save the mode */ | 1211 | /* save the mode */ |
1244 | dev->mode[chn] = *mode; | 1212 | dev->mode[chn] = *mode; |
1245 | dev->req_image_size[chn] = get_transfer_size(mode); | 1213 | dev->req_image_size[chn] = get_transfer_size(mode); |
1246 | dprintk(1, "transfer size %ld\n", dev->req_image_size[chn]); | 1214 | dprintk(1, "%s: reqsize %ld\n", __func__, dev->req_image_size[chn]); |
1247 | |||
1248 | buffer = kzalloc(512, GFP_KERNEL); | 1215 | buffer = kzalloc(512, GFP_KERNEL); |
1249 | if (buffer == NULL) { | 1216 | if (buffer == NULL) { |
1250 | dev_err(&dev->udev->dev, "out of mem\n"); | 1217 | dev_err(&dev->udev->dev, "out of mem\n"); |
1251 | mutex_unlock(&dev->lock); | 1218 | mutex_unlock(&dev->lock); |
1252 | return -ENOMEM; | 1219 | return -ENOMEM; |
1253 | } | 1220 | } |
1254 | |||
1255 | /* set the mode */ | 1221 | /* set the mode */ |
1256 | buffer[0] = IN_DATA_TOKEN; | 1222 | buffer[0] = IN_DATA_TOKEN; |
1257 | buffer[1] = (__le32) cpu_to_le32(chn_rev); | 1223 | buffer[1] = (__le32) cpu_to_le32(chn_rev); |
@@ -1260,10 +1226,8 @@ static int s2255_set_mode(struct s2255_dev *dev, unsigned long chn, | |||
1260 | dev->setmode_ready[chn] = 0; | 1226 | dev->setmode_ready[chn] = 0; |
1261 | res = s2255_write_config(dev->udev, (unsigned char *)buffer, 512); | 1227 | res = s2255_write_config(dev->udev, (unsigned char *)buffer, 512); |
1262 | if (debug) | 1228 | if (debug) |
1263 | dump_verify_mode(dev, mode); | 1229 | s2255_print_cfg(dev, mode); |
1264 | kfree(buffer); | 1230 | kfree(buffer); |
1265 | dprintk(1, "set mode done chn %lu, %d\n", chn, res); | ||
1266 | |||
1267 | /* wait at least 3 frames before continuing */ | 1231 | /* wait at least 3 frames before continuing */ |
1268 | if (mode->restart) { | 1232 | if (mode->restart) { |
1269 | wait_event_timeout(dev->wait_setmode[chn], | 1233 | wait_event_timeout(dev->wait_setmode[chn], |
@@ -1274,10 +1238,10 @@ static int s2255_set_mode(struct s2255_dev *dev, unsigned long chn, | |||
1274 | res = -EFAULT; | 1238 | res = -EFAULT; |
1275 | } | 1239 | } |
1276 | } | 1240 | } |
1277 | |||
1278 | /* clear the restart flag */ | 1241 | /* clear the restart flag */ |
1279 | dev->mode[chn].restart = 0; | 1242 | dev->mode[chn].restart = 0; |
1280 | mutex_unlock(&dev->lock); | 1243 | mutex_unlock(&dev->lock); |
1244 | dprintk(1, "%s chn %lu, result: %d\n", __func__, chn, res); | ||
1281 | return res; | 1245 | return res; |
1282 | } | 1246 | } |
1283 | 1247 | ||
@@ -1289,7 +1253,7 @@ static int s2255_cmd_status(struct s2255_dev *dev, unsigned long chn, | |||
1289 | u32 chn_rev; | 1253 | u32 chn_rev; |
1290 | mutex_lock(&dev->lock); | 1254 | mutex_lock(&dev->lock); |
1291 | chn_rev = G_chnmap[chn]; | 1255 | chn_rev = G_chnmap[chn]; |
1292 | dprintk(4, "%s chan %d\n", __func__, chn_rev); | 1256 | dprintk(4, "%s chan %lu\n", __func__, chn); |
1293 | buffer = kzalloc(512, GFP_KERNEL); | 1257 | buffer = kzalloc(512, GFP_KERNEL); |
1294 | if (buffer == NULL) { | 1258 | if (buffer == NULL) { |
1295 | dev_err(&dev->udev->dev, "out of mem\n"); | 1259 | dev_err(&dev->udev->dev, "out of mem\n"); |
@@ -1358,7 +1322,6 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) | |||
1358 | new_mode->restart = 0; | 1322 | new_mode->restart = 0; |
1359 | *old_mode = *new_mode; | 1323 | *old_mode = *new_mode; |
1360 | dev->cur_fmt[chn] = fh->fmt; | 1324 | dev->cur_fmt[chn] = fh->fmt; |
1361 | dprintk(1, "%s[%d]\n", __func__, chn); | ||
1362 | dev->last_frame[chn] = -1; | 1325 | dev->last_frame[chn] = -1; |
1363 | dev->bad_payload[chn] = 0; | 1326 | dev->bad_payload[chn] = 0; |
1364 | dev->cur_frame[chn] = 0; | 1327 | dev->cur_frame[chn] = 0; |
@@ -1381,7 +1344,6 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) | |||
1381 | { | 1344 | { |
1382 | struct s2255_fh *fh = priv; | 1345 | struct s2255_fh *fh = priv; |
1383 | struct s2255_dev *dev = fh->dev; | 1346 | struct s2255_dev *dev = fh->dev; |
1384 | |||
1385 | dprintk(4, "%s\n, channel: %d", __func__, fh->channel); | 1347 | dprintk(4, "%s\n, channel: %d", __func__, fh->channel); |
1386 | if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { | 1348 | if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { |
1387 | printk(KERN_ERR "invalid fh type0\n"); | 1349 | printk(KERN_ERR "invalid fh type0\n"); |
@@ -1403,15 +1365,12 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *i) | |||
1403 | struct s2255_mode *mode; | 1365 | struct s2255_mode *mode; |
1404 | struct videobuf_queue *q = &fh->vb_vidq; | 1366 | struct videobuf_queue *q = &fh->vb_vidq; |
1405 | int ret = 0; | 1367 | int ret = 0; |
1406 | |||
1407 | mutex_lock(&q->vb_lock); | 1368 | mutex_lock(&q->vb_lock); |
1408 | |||
1409 | if (videobuf_queue_is_busy(q)) { | 1369 | if (videobuf_queue_is_busy(q)) { |
1410 | dprintk(1, "queue busy\n"); | 1370 | dprintk(1, "queue busy\n"); |
1411 | ret = -EBUSY; | 1371 | ret = -EBUSY; |
1412 | goto out_s_std; | 1372 | goto out_s_std; |
1413 | } | 1373 | } |
1414 | |||
1415 | if (res_locked(fh->dev, fh)) { | 1374 | if (res_locked(fh->dev, fh)) { |
1416 | dprintk(1, "can't change standard after started\n"); | 1375 | dprintk(1, "can't change standard after started\n"); |
1417 | ret = -EBUSY; | 1376 | ret = -EBUSY; |
@@ -1453,10 +1412,8 @@ static int vidioc_enum_input(struct file *file, void *priv, | |||
1453 | struct s2255_fh *fh = priv; | 1412 | struct s2255_fh *fh = priv; |
1454 | struct s2255_dev *dev = fh->dev; | 1413 | struct s2255_dev *dev = fh->dev; |
1455 | u32 status = 0; | 1414 | u32 status = 0; |
1456 | |||
1457 | if (inp->index != 0) | 1415 | if (inp->index != 0) |
1458 | return -EINVAL; | 1416 | return -EINVAL; |
1459 | |||
1460 | inp->type = V4L2_INPUT_TYPE_CAMERA; | 1417 | inp->type = V4L2_INPUT_TYPE_CAMERA; |
1461 | inp->std = S2255_NORMS; | 1418 | inp->std = S2255_NORMS; |
1462 | inp->status = 0; | 1419 | inp->status = 0; |
@@ -1612,7 +1569,7 @@ static int vidioc_g_jpegcomp(struct file *file, void *priv, | |||
1612 | struct s2255_fh *fh = priv; | 1569 | struct s2255_fh *fh = priv; |
1613 | struct s2255_dev *dev = fh->dev; | 1570 | struct s2255_dev *dev = fh->dev; |
1614 | *jc = dev->jc[fh->channel]; | 1571 | *jc = dev->jc[fh->channel]; |
1615 | dprintk(2, "getting jpegcompression, quality %d\n", jc->quality); | 1572 | dprintk(2, "%s: quality %d\n", __func__, jc->quality); |
1616 | return 0; | 1573 | return 0; |
1617 | } | 1574 | } |
1618 | 1575 | ||
@@ -1624,7 +1581,7 @@ static int vidioc_s_jpegcomp(struct file *file, void *priv, | |||
1624 | if (jc->quality < 0 || jc->quality > 100) | 1581 | if (jc->quality < 0 || jc->quality > 100) |
1625 | return -EINVAL; | 1582 | return -EINVAL; |
1626 | dev->jc[fh->channel].quality = jc->quality; | 1583 | dev->jc[fh->channel].quality = jc->quality; |
1627 | dprintk(2, "setting jpeg quality %d\n", jc->quality); | 1584 | dprintk(2, "%s: quality %d\n", __func__, jc->quality); |
1628 | return 0; | 1585 | return 0; |
1629 | } | 1586 | } |
1630 | 1587 | ||
@@ -1839,14 +1796,13 @@ static int s2255_open(struct file *file) | |||
1839 | s2255_set_mode(dev, cur_channel, &fh->mode); | 1796 | s2255_set_mode(dev, cur_channel, &fh->mode); |
1840 | dev->chn_configured[cur_channel] = 1; | 1797 | dev->chn_configured[cur_channel] = 1; |
1841 | } | 1798 | } |
1842 | dprintk(1, "s2255drv: open dev=%s type=%s\n", | 1799 | dprintk(1, "%s: dev=%s type=%s\n", __func__, |
1843 | video_device_node_name(vdev), v4l2_type_names[type]); | 1800 | video_device_node_name(vdev), v4l2_type_names[type]); |
1844 | dprintk(2, "s2255drv: open: fh=0x%08lx, dev=0x%08lx, vidq=0x%08lx\n", | 1801 | dprintk(2, "%s: fh=0x%08lx, dev=0x%08lx, vidq=0x%08lx\n", __func__, |
1845 | (unsigned long)fh, (unsigned long)dev, | 1802 | (unsigned long)fh, (unsigned long)dev, |
1846 | (unsigned long)&dev->vidq[cur_channel]); | 1803 | (unsigned long)&dev->vidq[cur_channel]); |
1847 | dprintk(4, "s2255drv: open: list_empty active=%d\n", | 1804 | dprintk(4, "%s: list_empty active=%d\n", __func__, |
1848 | list_empty(&dev->vidq[cur_channel].active)); | 1805 | list_empty(&dev->vidq[cur_channel].active)); |
1849 | |||
1850 | videobuf_queue_vmalloc_init(&fh->vb_vidq, &s2255_video_qops, | 1806 | videobuf_queue_vmalloc_init(&fh->vb_vidq, &s2255_video_qops, |
1851 | NULL, &dev->slock, | 1807 | NULL, &dev->slock, |
1852 | fh->type, | 1808 | fh->type, |
@@ -1862,10 +1818,8 @@ static unsigned int s2255_poll(struct file *file, | |||
1862 | struct s2255_fh *fh = file->private_data; | 1818 | struct s2255_fh *fh = file->private_data; |
1863 | int rc; | 1819 | int rc; |
1864 | dprintk(100, "%s\n", __func__); | 1820 | dprintk(100, "%s\n", __func__); |
1865 | |||
1866 | if (V4L2_BUF_TYPE_VIDEO_CAPTURE != fh->type) | 1821 | if (V4L2_BUF_TYPE_VIDEO_CAPTURE != fh->type) |
1867 | return POLLERR; | 1822 | return POLLERR; |
1868 | |||
1869 | rc = videobuf_poll_stream(file, &fh->vb_vidq, wait); | 1823 | rc = videobuf_poll_stream(file, &fh->vb_vidq, wait); |
1870 | return rc; | 1824 | return rc; |
1871 | } | 1825 | } |
@@ -1878,7 +1832,6 @@ static void s2255_destroy(struct kref *kref) | |||
1878 | /* make sure firmware still not trying to load */ | 1832 | /* make sure firmware still not trying to load */ |
1879 | del_timer(&dev->timer); /* only started in .probe and .open */ | 1833 | del_timer(&dev->timer); /* only started in .probe and .open */ |
1880 | if (dev->fw_data->fw_urb) { | 1834 | if (dev->fw_data->fw_urb) { |
1881 | dprintk(2, "kill fw_urb\n"); | ||
1882 | usb_kill_urb(dev->fw_data->fw_urb); | 1835 | usb_kill_urb(dev->fw_data->fw_urb); |
1883 | usb_free_urb(dev->fw_data->fw_urb); | 1836 | usb_free_urb(dev->fw_data->fw_urb); |
1884 | dev->fw_data->fw_urb = NULL; | 1837 | dev->fw_data->fw_urb = NULL; |
@@ -1923,14 +1876,11 @@ static int s2255_mmap_v4l(struct file *file, struct vm_area_struct *vma) | |||
1923 | 1876 | ||
1924 | if (!fh) | 1877 | if (!fh) |
1925 | return -ENODEV; | 1878 | return -ENODEV; |
1926 | dprintk(4, "mmap called, vma=0x%08lx\n", (unsigned long)vma); | 1879 | dprintk(4, "%s, vma=0x%08lx\n", __func__, (unsigned long)vma); |
1927 | |||
1928 | ret = videobuf_mmap_mapper(&fh->vb_vidq, vma); | 1880 | ret = videobuf_mmap_mapper(&fh->vb_vidq, vma); |
1929 | 1881 | dprintk(4, "%s vma start=0x%08lx, size=%ld, ret=%d\n", __func__, | |
1930 | dprintk(4, "vma start=0x%08lx, size=%ld, ret=%d\n", | ||
1931 | (unsigned long)vma->vm_start, | 1882 | (unsigned long)vma->vm_start, |
1932 | (unsigned long)vma->vm_end - (unsigned long)vma->vm_start, ret); | 1883 | (unsigned long)vma->vm_end - (unsigned long)vma->vm_start, ret); |
1933 | |||
1934 | return ret; | 1884 | return ret; |
1935 | } | 1885 | } |
1936 | 1886 | ||
@@ -2004,7 +1954,6 @@ static int s2255_probe_v4l(struct s2255_dev *dev) | |||
2004 | /* register 4 video devices */ | 1954 | /* register 4 video devices */ |
2005 | memcpy(&dev->vdev[i], &template, sizeof(struct video_device)); | 1955 | memcpy(&dev->vdev[i], &template, sizeof(struct video_device)); |
2006 | dev->vdev[i].parent = &dev->interface->dev; | 1956 | dev->vdev[i].parent = &dev->interface->dev; |
2007 | video_set_drvdata(&dev->vdev[i], dev); | ||
2008 | if (video_nr == -1) | 1957 | if (video_nr == -1) |
2009 | ret = video_register_device(&dev->vdev[i], | 1958 | ret = video_register_device(&dev->vdev[i], |
2010 | VFL_TYPE_GRABBER, | 1959 | VFL_TYPE_GRABBER, |
@@ -2366,15 +2315,14 @@ static int s2255_board_init(struct s2255_dev *dev) | |||
2366 | } | 2315 | } |
2367 | /* start read pipe */ | 2316 | /* start read pipe */ |
2368 | s2255_start_readpipe(dev); | 2317 | s2255_start_readpipe(dev); |
2369 | 2318 | dprintk(1, "%s: success\n", __func__); | |
2370 | dprintk(1, "S2255: board initialized\n"); | ||
2371 | return 0; | 2319 | return 0; |
2372 | } | 2320 | } |
2373 | 2321 | ||
2374 | static int s2255_board_shutdown(struct s2255_dev *dev) | 2322 | static int s2255_board_shutdown(struct s2255_dev *dev) |
2375 | { | 2323 | { |
2376 | u32 i; | 2324 | u32 i; |
2377 | dprintk(1, "S2255: board shutdown: %p", dev); | 2325 | dprintk(1, "%s: dev: %p", __func__, dev); |
2378 | 2326 | ||
2379 | for (i = 0; i < MAX_CHANNELS; i++) { | 2327 | for (i = 0; i < MAX_CHANNELS; i++) { |
2380 | if (dev->b_acquire[i]) | 2328 | if (dev->b_acquire[i]) |
@@ -2396,9 +2344,8 @@ static void read_pipe_completion(struct urb *purb) | |||
2396 | struct s2255_dev *dev; | 2344 | struct s2255_dev *dev; |
2397 | int status; | 2345 | int status; |
2398 | int pipe; | 2346 | int pipe; |
2399 | |||
2400 | pipe_info = purb->context; | 2347 | pipe_info = purb->context; |
2401 | dprintk(100, "read pipe completion %p, status %d\n", purb, | 2348 | dprintk(100, "%s: urb:%p, status %d\n", __func__, purb, |
2402 | purb->status); | 2349 | purb->status); |
2403 | if (pipe_info == NULL) { | 2350 | if (pipe_info == NULL) { |
2404 | dev_err(&purb->dev->dev, "no context!\n"); | 2351 | dev_err(&purb->dev->dev, "no context!\n"); |
@@ -2413,13 +2360,13 @@ static void read_pipe_completion(struct urb *purb) | |||
2413 | status = purb->status; | 2360 | status = purb->status; |
2414 | /* if shutting down, do not resubmit, exit immediately */ | 2361 | /* if shutting down, do not resubmit, exit immediately */ |
2415 | if (status == -ESHUTDOWN) { | 2362 | if (status == -ESHUTDOWN) { |
2416 | dprintk(2, "read_pipe_completion: err shutdown\n"); | 2363 | dprintk(2, "%s: err shutdown\n", __func__); |
2417 | pipe_info->err_count++; | 2364 | pipe_info->err_count++; |
2418 | return; | 2365 | return; |
2419 | } | 2366 | } |
2420 | 2367 | ||
2421 | if (pipe_info->state == 0) { | 2368 | if (pipe_info->state == 0) { |
2422 | dprintk(2, "exiting USB pipe"); | 2369 | dprintk(2, "%s: exiting USB pipe", __func__); |
2423 | return; | 2370 | return; |
2424 | } | 2371 | } |
2425 | 2372 | ||
@@ -2427,7 +2374,7 @@ static void read_pipe_completion(struct urb *purb) | |||
2427 | s2255_read_video_callback(dev, pipe_info); | 2374 | s2255_read_video_callback(dev, pipe_info); |
2428 | else { | 2375 | else { |
2429 | pipe_info->err_count++; | 2376 | pipe_info->err_count++; |
2430 | dprintk(1, "s2255drv: failed URB %d\n", status); | 2377 | dprintk(1, "%s: failed URB %d\n", __func__, status); |
2431 | } | 2378 | } |
2432 | 2379 | ||
2433 | pipe = usb_rcvbulkpipe(dev->udev, dev->read_endpoint); | 2380 | pipe = usb_rcvbulkpipe(dev->udev, dev->read_endpoint); |
@@ -2443,7 +2390,7 @@ static void read_pipe_completion(struct urb *purb) | |||
2443 | dev_err(&dev->udev->dev, "error submitting urb\n"); | 2390 | dev_err(&dev->udev->dev, "error submitting urb\n"); |
2444 | } | 2391 | } |
2445 | } else { | 2392 | } else { |
2446 | dprintk(2, "read pipe complete state 0\n"); | 2393 | dprintk(2, "%s :complete state 0\n", __func__); |
2447 | } | 2394 | } |
2448 | return; | 2395 | return; |
2449 | } | 2396 | } |
@@ -2454,7 +2401,7 @@ static int s2255_start_readpipe(struct s2255_dev *dev) | |||
2454 | int retval; | 2401 | int retval; |
2455 | struct s2255_pipeinfo *pipe_info = &dev->pipe; | 2402 | struct s2255_pipeinfo *pipe_info = &dev->pipe; |
2456 | pipe = usb_rcvbulkpipe(dev->udev, dev->read_endpoint); | 2403 | pipe = usb_rcvbulkpipe(dev->udev, dev->read_endpoint); |
2457 | dprintk(2, "start pipe IN %d\n", dev->read_endpoint); | 2404 | dprintk(2, "%s: IN %d\n", __func__, dev->read_endpoint); |
2458 | pipe_info->state = 1; | 2405 | pipe_info->state = 1; |
2459 | pipe_info->err_count = 0; | 2406 | pipe_info->err_count = 0; |
2460 | pipe_info->stream_urb = usb_alloc_urb(0, GFP_KERNEL); | 2407 | pipe_info->stream_urb = usb_alloc_urb(0, GFP_KERNEL); |
@@ -2469,8 +2416,6 @@ static int s2255_start_readpipe(struct s2255_dev *dev) | |||
2469 | pipe_info->transfer_buffer, | 2416 | pipe_info->transfer_buffer, |
2470 | pipe_info->cur_transfer_size, | 2417 | pipe_info->cur_transfer_size, |
2471 | read_pipe_completion, pipe_info); | 2418 | read_pipe_completion, pipe_info); |
2472 | |||
2473 | dprintk(4, "submitting URB %p\n", pipe_info->stream_urb); | ||
2474 | retval = usb_submit_urb(pipe_info->stream_urb, GFP_KERNEL); | 2419 | retval = usb_submit_urb(pipe_info->stream_urb, GFP_KERNEL); |
2475 | if (retval) { | 2420 | if (retval) { |
2476 | printk(KERN_ERR "s2255: start read pipe failed\n"); | 2421 | printk(KERN_ERR "s2255: start read pipe failed\n"); |
@@ -2490,10 +2435,7 @@ static int s2255_start_acquire(struct s2255_dev *dev, unsigned long chn) | |||
2490 | dprintk(2, "start acquire failed, bad channel %lu\n", chn); | 2435 | dprintk(2, "start acquire failed, bad channel %lu\n", chn); |
2491 | return -1; | 2436 | return -1; |
2492 | } | 2437 | } |
2493 | |||
2494 | chn_rev = G_chnmap[chn]; | 2438 | chn_rev = G_chnmap[chn]; |
2495 | dprintk(1, "S2255: start acquire %lu \n", chn); | ||
2496 | |||
2497 | buffer = kzalloc(512, GFP_KERNEL); | 2439 | buffer = kzalloc(512, GFP_KERNEL); |
2498 | if (buffer == NULL) { | 2440 | if (buffer == NULL) { |
2499 | dev_err(&dev->udev->dev, "out of mem\n"); | 2441 | dev_err(&dev->udev->dev, "out of mem\n"); |
@@ -2537,20 +2479,15 @@ static int s2255_stop_acquire(struct s2255_dev *dev, unsigned long chn) | |||
2537 | return -ENOMEM; | 2479 | return -ENOMEM; |
2538 | } | 2480 | } |
2539 | /* send the stop command */ | 2481 | /* send the stop command */ |
2540 | dprintk(4, "stop acquire %lu\n", chn); | ||
2541 | *(__le32 *) buffer = IN_DATA_TOKEN; | 2482 | *(__le32 *) buffer = IN_DATA_TOKEN; |
2542 | *((__le32 *) buffer + 1) = (__le32) cpu_to_le32(chn_rev); | 2483 | *((__le32 *) buffer + 1) = (__le32) cpu_to_le32(chn_rev); |
2543 | *((__le32 *) buffer + 2) = CMD_STOP; | 2484 | *((__le32 *) buffer + 2) = CMD_STOP; |
2544 | res = s2255_write_config(dev->udev, (unsigned char *)buffer, 512); | 2485 | res = s2255_write_config(dev->udev, (unsigned char *)buffer, 512); |
2545 | |||
2546 | if (res != 0) | 2486 | if (res != 0) |
2547 | dev_err(&dev->udev->dev, "CMD_STOP error\n"); | 2487 | dev_err(&dev->udev->dev, "CMD_STOP error\n"); |
2548 | |||
2549 | dprintk(4, "stop acquire: releasing states \n"); | ||
2550 | |||
2551 | kfree(buffer); | 2488 | kfree(buffer); |
2552 | dev->b_acquire[chn] = 0; | 2489 | dev->b_acquire[chn] = 0; |
2553 | 2490 | dprintk(4, "%s: chn %lu, res %d\n", __func__, chn, res); | |
2554 | return res; | 2491 | return res; |
2555 | } | 2492 | } |
2556 | 2493 | ||
@@ -2600,9 +2537,7 @@ static int s2255_probe(struct usb_interface *interface, | |||
2600 | int retval = -ENOMEM; | 2537 | int retval = -ENOMEM; |
2601 | __le32 *pdata; | 2538 | __le32 *pdata; |
2602 | int fw_size; | 2539 | int fw_size; |
2603 | 2540 | dprintk(2, "%s\n", __func__); | |
2604 | dprintk(2, "s2255: probe\n"); | ||
2605 | |||
2606 | /* allocate memory for our device state and initialize it to zero */ | 2541 | /* allocate memory for our device state and initialize it to zero */ |
2607 | dev = kzalloc(sizeof(struct s2255_dev), GFP_KERNEL); | 2542 | dev = kzalloc(sizeof(struct s2255_dev), GFP_KERNEL); |
2608 | if (dev == NULL) { | 2543 | if (dev == NULL) { |
@@ -2643,11 +2578,9 @@ static int s2255_probe(struct usb_interface *interface, | |||
2643 | } | 2578 | } |
2644 | /* set intfdata */ | 2579 | /* set intfdata */ |
2645 | usb_set_intfdata(interface, dev); | 2580 | usb_set_intfdata(interface, dev); |
2646 | dprintk(100, "after intfdata %p\n", dev); | ||
2647 | init_timer(&dev->timer); | 2581 | init_timer(&dev->timer); |
2648 | dev->timer.function = s2255_timer; | 2582 | dev->timer.function = s2255_timer; |
2649 | dev->timer.data = (unsigned long)dev->fw_data; | 2583 | dev->timer.data = (unsigned long)dev->fw_data; |
2650 | |||
2651 | init_waitqueue_head(&dev->fw_data->wait_fw); | 2584 | init_waitqueue_head(&dev->fw_data->wait_fw); |
2652 | for (i = 0; i < MAX_CHANNELS; i++) { | 2585 | for (i = 0; i < MAX_CHANNELS; i++) { |
2653 | init_waitqueue_head(&dev->wait_setmode[i]); | 2586 | init_waitqueue_head(&dev->wait_setmode[i]); |
@@ -2696,7 +2629,6 @@ static int s2255_probe(struct usb_interface *interface, | |||
2696 | retval = s2255_board_init(dev); | 2629 | retval = s2255_board_init(dev); |
2697 | if (retval) | 2630 | if (retval) |
2698 | goto errorBOARDINIT; | 2631 | goto errorBOARDINIT; |
2699 | dprintk(4, "before probe done %p\n", dev); | ||
2700 | spin_lock_init(&dev->slock); | 2632 | spin_lock_init(&dev->slock); |
2701 | s2255_fwload_start(dev, 0); | 2633 | s2255_fwload_start(dev, 0); |
2702 | /* kref for each vdev. Released on video_device_release callback */ | 2634 | /* kref for each vdev. Released on video_device_release callback */ |
@@ -2740,7 +2672,6 @@ static void s2255_disconnect(struct usb_interface *interface) | |||
2740 | { | 2672 | { |
2741 | struct s2255_dev *dev = NULL; | 2673 | struct s2255_dev *dev = NULL; |
2742 | int i; | 2674 | int i; |
2743 | dprintk(1, "s2255: disconnect interface %p\n", interface); | ||
2744 | dev = usb_get_intfdata(interface); | 2675 | dev = usb_get_intfdata(interface); |
2745 | /* unregister each video device. */ | 2676 | /* unregister each video device. */ |
2746 | for (i = 0; i < MAX_CHANNELS; i++) | 2677 | for (i = 0; i < MAX_CHANNELS; i++) |