aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/usbvideo/ibmcam.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/usbvideo/ibmcam.c')
-rw-r--r--drivers/media/video/usbvideo/ibmcam.c78
1 files changed, 46 insertions, 32 deletions
diff --git a/drivers/media/video/usbvideo/ibmcam.c b/drivers/media/video/usbvideo/ibmcam.c
index cc27efe121dd..28421d386f1e 100644
--- a/drivers/media/video/usbvideo/ibmcam.c
+++ b/drivers/media/video/usbvideo/ibmcam.c
@@ -258,7 +258,9 @@ static enum ParseState ibmcam_find_header(struct uvd *uvd) /* FIXME: Add frame h
258 (RING_QUEUE_PEEK(&uvd->dp, 2) == 0x00)) 258 (RING_QUEUE_PEEK(&uvd->dp, 2) == 0x00))
259 { 259 {
260#if 0 /* This code helps to detect new frame markers */ 260#if 0 /* This code helps to detect new frame markers */
261 info("Header sig: 00 FF 00 %02X", RING_QUEUE_PEEK(&uvd->dp, 3)); 261 dev_info(&uvd->dev->dev,
262 "Header sig: 00 FF 00 %02X\n",
263 RING_QUEUE_PEEK(&uvd->dp, 3));
262#endif 264#endif
263 frame->header = RING_QUEUE_PEEK(&uvd->dp, 3); 265 frame->header = RING_QUEUE_PEEK(&uvd->dp, 3);
264 if ((frame->header == HDRSIG_MODEL1_128x96) || 266 if ((frame->header == HDRSIG_MODEL1_128x96) ||
@@ -266,7 +268,8 @@ static enum ParseState ibmcam_find_header(struct uvd *uvd) /* FIXME: Add frame h
266 (frame->header == HDRSIG_MODEL1_352x288)) 268 (frame->header == HDRSIG_MODEL1_352x288))
267 { 269 {
268#if 0 270#if 0
269 info("Header found."); 271 dev_info(&uvd->dev->dev,
272 "Header found.\n");
270#endif 273#endif
271 RING_QUEUE_DEQUEUE_BYTES(&uvd->dp, marker_len); 274 RING_QUEUE_DEQUEUE_BYTES(&uvd->dp, marker_len);
272 icam->has_hdr = 1; 275 icam->has_hdr = 1;
@@ -295,7 +298,7 @@ case IBMCAM_MODEL_4:
295 (RING_QUEUE_PEEK(&uvd->dp, 1) == 0xFF)) 298 (RING_QUEUE_PEEK(&uvd->dp, 1) == 0xFF))
296 { 299 {
297#if 0 300#if 0
298 info("Header found."); 301 dev_info(&uvd->dev->dev, "Header found.\n");
299#endif 302#endif
300 RING_QUEUE_DEQUEUE_BYTES(&uvd->dp, marker_len); 303 RING_QUEUE_DEQUEUE_BYTES(&uvd->dp, marker_len);
301 icam->has_hdr = 1; 304 icam->has_hdr = 1;
@@ -338,7 +341,7 @@ case IBMCAM_MODEL_4:
338 byte4 = RING_QUEUE_PEEK(&uvd->dp, 3); 341 byte4 = RING_QUEUE_PEEK(&uvd->dp, 3);
339 frame->header = (byte3 << 8) | byte4; 342 frame->header = (byte3 << 8) | byte4;
340#if 0 343#if 0
341 info("Header found."); 344 dev_info(&uvd->dev->dev, "Header found.\n");
342#endif 345#endif
343 RING_QUEUE_DEQUEUE_BYTES(&uvd->dp, marker_len); 346 RING_QUEUE_DEQUEUE_BYTES(&uvd->dp, marker_len);
344 icam->has_hdr = 1; 347 icam->has_hdr = 1;
@@ -354,7 +357,8 @@ case IBMCAM_MODEL_4:
354 } 357 }
355 if (!icam->has_hdr) { 358 if (!icam->has_hdr) {
356 if (uvd->debug > 2) 359 if (uvd->debug > 2)
357 info("Skipping frame, no header"); 360 dev_info(&uvd->dev->dev,
361 "Skipping frame, no header\n");
358 return scan_EndParse; 362 return scan_EndParse;
359 } 363 }
360 364
@@ -881,7 +885,9 @@ static enum ParseState ibmcam_model3_parse_lines(
881 */ 885 */
882 if ((frame->curline + 1) >= data_h) { 886 if ((frame->curline + 1) >= data_h) {
883 if (uvd->debug >= 3) 887 if (uvd->debug >= 3)
884 info("Reached line %d. (frame is done)", frame->curline); 888 dev_info(&uvd->dev->dev,
889 "Reached line %d. (frame is done)\n",
890 frame->curline);
885 return scan_NextFrame; 891 return scan_NextFrame;
886 } 892 }
887 893
@@ -954,8 +960,9 @@ static enum ParseState ibmcam_model3_parse_lines(
954 960
955 if (frame->curline >= VIDEOSIZE_Y(frame->request)) { 961 if (frame->curline >= VIDEOSIZE_Y(frame->request)) {
956 if (uvd->debug >= 3) { 962 if (uvd->debug >= 3) {
957 info("All requested lines (%ld.) done.", 963 dev_info(&uvd->dev->dev,
958 VIDEOSIZE_Y(frame->request)); 964 "All requested lines (%ld.) done.\n",
965 VIDEOSIZE_Y(frame->request));
959 } 966 }
960 return scan_NextFrame; 967 return scan_NextFrame;
961 } else 968 } else
@@ -1000,7 +1007,9 @@ static enum ParseState ibmcam_model4_128x96_parse_lines(
1000 */ 1007 */
1001 if ((frame->curline + 1) >= data_h) { 1008 if ((frame->curline + 1) >= data_h) {
1002 if (uvd->debug >= 3) 1009 if (uvd->debug >= 3)
1003 info("Reached line %d. (frame is done)", frame->curline); 1010 dev_info(&uvd->dev->dev,
1011 "Reached line %d. (frame is done)\n",
1012 frame->curline);
1004 return scan_NextFrame; 1013 return scan_NextFrame;
1005 } 1014 }
1006 1015
@@ -1049,8 +1058,9 @@ static enum ParseState ibmcam_model4_128x96_parse_lines(
1049 1058
1050 if (frame->curline >= VIDEOSIZE_Y(frame->request)) { 1059 if (frame->curline >= VIDEOSIZE_Y(frame->request)) {
1051 if (uvd->debug >= 3) { 1060 if (uvd->debug >= 3) {
1052 info("All requested lines (%ld.) done.", 1061 dev_info(&uvd->dev->dev,
1053 VIDEOSIZE_Y(frame->request)); 1062 "All requested lines (%ld.) done.\n",
1063 VIDEOSIZE_Y(frame->request));
1054 } 1064 }
1055 return scan_NextFrame; 1065 return scan_NextFrame;
1056 } else 1066 } else
@@ -1171,10 +1181,11 @@ static int ibmcam_veio(
1171 sizeof(cp), 1181 sizeof(cp),
1172 1000); 1182 1000);
1173#if 0 1183#if 0
1174 info("USB => %02x%02x%02x%02x%02x%02x%02x%02x " 1184 dev_info(&uvd->dev->dev,
1175 "(req=$%02x val=$%04x ind=$%04x)", 1185 "USB => %02x%02x%02x%02x%02x%02x%02x%02x "
1176 cp[0],cp[1],cp[2],cp[3],cp[4],cp[5],cp[6],cp[7], 1186 "(req=$%02x val=$%04x ind=$%04x)\n",
1177 req, value, index); 1187 cp[0],cp[1],cp[2],cp[3],cp[4],cp[5],cp[6],cp[7],
1188 req, value, index);
1178#endif 1189#endif
1179 } else { 1190 } else {
1180 i = usb_control_msg( 1191 i = usb_control_msg(
@@ -1449,10 +1460,9 @@ static void ibmcam_adjust_contrast(struct uvd *uvd)
1449 */ 1460 */
1450static void ibmcam_change_lighting_conditions(struct uvd *uvd) 1461static void ibmcam_change_lighting_conditions(struct uvd *uvd)
1451{ 1462{
1452 static const char proc[] = "ibmcam_change_lighting_conditions";
1453
1454 if (debug > 0) 1463 if (debug > 0)
1455 info("%s: Set lighting to %hu.", proc, lighting); 1464 dev_info(&uvd->dev->dev,
1465 "%s: Set lighting to %hu.\n", __func__, lighting);
1456 1466
1457 switch (IBMCAM_T(uvd)->camera_model) { 1467 switch (IBMCAM_T(uvd)->camera_model) {
1458 case IBMCAM_MODEL_1: 1468 case IBMCAM_MODEL_1:
@@ -1495,8 +1505,6 @@ static void ibmcam_change_lighting_conditions(struct uvd *uvd)
1495 */ 1505 */
1496static void ibmcam_set_sharpness(struct uvd *uvd) 1506static void ibmcam_set_sharpness(struct uvd *uvd)
1497{ 1507{
1498 static const char proc[] = "ibmcam_set_sharpness";
1499
1500 switch (IBMCAM_T(uvd)->camera_model) { 1508 switch (IBMCAM_T(uvd)->camera_model) {
1501 case IBMCAM_MODEL_1: 1509 case IBMCAM_MODEL_1:
1502 { 1510 {
@@ -1505,7 +1513,8 @@ static void ibmcam_set_sharpness(struct uvd *uvd)
1505 1513
1506 RESTRICT_TO_RANGE(sharpness, SHARPNESS_MIN, SHARPNESS_MAX); 1514 RESTRICT_TO_RANGE(sharpness, SHARPNESS_MIN, SHARPNESS_MAX);
1507 if (debug > 0) 1515 if (debug > 0)
1508 info("%s: Set sharpness to %hu.", proc, sharpness); 1516 dev_info(&uvd->dev->dev, "%s: Set sharpness to %hu.\n",
1517 __func__, sharpness);
1509 1518
1510 sv = sa[sharpness - SHARPNESS_MIN]; 1519 sv = sa[sharpness - SHARPNESS_MIN];
1511 for (i=0; i < 2; i++) { 1520 for (i=0; i < 2; i++) {
@@ -1564,11 +1573,11 @@ static void ibmcam_set_sharpness(struct uvd *uvd)
1564 */ 1573 */
1565static void ibmcam_set_brightness(struct uvd *uvd) 1574static void ibmcam_set_brightness(struct uvd *uvd)
1566{ 1575{
1567 static const char proc[] = "ibmcam_set_brightness";
1568 static const unsigned short n = 1; 1576 static const unsigned short n = 1;
1569 1577
1570 if (debug > 0) 1578 if (debug > 0)
1571 info("%s: Set brightness to %hu.", proc, uvd->vpic.brightness); 1579 dev_info(&uvd->dev->dev, "%s: Set brightness to %hu.\n",
1580 __func__, uvd->vpic.brightness);
1572 1581
1573 switch (IBMCAM_T(uvd)->camera_model) { 1582 switch (IBMCAM_T(uvd)->camera_model) {
1574 case IBMCAM_MODEL_1: 1583 case IBMCAM_MODEL_1:
@@ -2115,7 +2124,8 @@ static void ibmcam_model2_setup_after_video_if(struct uvd *uvd)
2115 break; 2124 break;
2116 } 2125 }
2117 if (uvd->debug > 0) 2126 if (uvd->debug > 0)
2118 info("Framerate (hardware): %hd.", hw_fps); 2127 dev_info(&uvd->dev->dev, "Framerate (hardware): %hd.\n",
2128 hw_fps);
2119 RESTRICT_TO_RANGE(hw_fps, 0, 31); 2129 RESTRICT_TO_RANGE(hw_fps, 0, 31);
2120 ibmcam_model2_Packet1(uvd, mod2_set_framerate, hw_fps); 2130 ibmcam_model2_Packet1(uvd, mod2_set_framerate, hw_fps);
2121 } 2131 }
@@ -3487,7 +3497,7 @@ static void ibmcam_model3_setup_after_video_if(struct uvd *uvd)
3487 /* 01.01.08 - Added for RCA video in support -LO */ 3497 /* 01.01.08 - Added for RCA video in support -LO */
3488 if(init_model3_input) { 3498 if(init_model3_input) {
3489 if (debug > 0) 3499 if (debug > 0)
3490 info("Setting input to RCA."); 3500 dev_info(&uvd->dev->dev, "Setting input to RCA.\n");
3491 for (i=0; i < ARRAY_SIZE(initData); i++) { 3501 for (i=0; i < ARRAY_SIZE(initData); i++) {
3492 ibmcam_veio(uvd, initData[i].req, initData[i].value, initData[i].index); 3502 ibmcam_veio(uvd, initData[i].req, initData[i].value, initData[i].index);
3493 } 3503 }
@@ -3685,7 +3695,7 @@ static int ibmcam_probe(struct usb_interface *intf, const struct usb_device_id *
3685 unsigned char video_ep = 0; 3695 unsigned char video_ep = 0;
3686 3696
3687 if (debug >= 1) 3697 if (debug >= 1)
3688 info("ibmcam_probe(%p,%u.)", intf, ifnum); 3698 dev_info(&uvd->dev->dev, "ibmcam_probe(%p,%u.)\n", intf, ifnum);
3689 3699
3690 /* We don't handle multi-config cameras */ 3700 /* We don't handle multi-config cameras */
3691 if (dev->descriptor.bNumConfigurations != 1) 3701 if (dev->descriptor.bNumConfigurations != 1)
@@ -3736,14 +3746,16 @@ static int ibmcam_probe(struct usb_interface *intf, const struct usb_device_id *
3736 brand = "IBM PC Camera"; /* a.k.a. Xirlink C-It */ 3746 brand = "IBM PC Camera"; /* a.k.a. Xirlink C-It */
3737 break; 3747 break;
3738 } 3748 }
3739 info("%s USB camera found (model %d, rev. 0x%04x)", 3749 dev_info(&uvd->dev->dev,
3740 brand, model, le16_to_cpu(dev->descriptor.bcdDevice)); 3750 "%s USB camera found (model %d, rev. 0x%04x)\n",
3751 brand, model, le16_to_cpu(dev->descriptor.bcdDevice));
3741 } while (0); 3752 } while (0);
3742 3753
3743 /* Validate found interface: must have one ISO endpoint */ 3754 /* Validate found interface: must have one ISO endpoint */
3744 nas = intf->num_altsetting; 3755 nas = intf->num_altsetting;
3745 if (debug > 0) 3756 if (debug > 0)
3746 info("Number of alternate settings=%d.", nas); 3757 dev_info(&uvd->dev->dev, "Number of alternate settings=%d.\n",
3758 nas);
3747 if (nas < 2) { 3759 if (nas < 2) {
3748 err("Too few alternate settings for this camera!"); 3760 err("Too few alternate settings for this camera!");
3749 return -ENODEV; 3761 return -ENODEV;
@@ -3787,7 +3799,9 @@ static int ibmcam_probe(struct usb_interface *intf, const struct usb_device_id *
3787 actInterface = i; 3799 actInterface = i;
3788 maxPS = le16_to_cpu(endpoint->wMaxPacketSize); 3800 maxPS = le16_to_cpu(endpoint->wMaxPacketSize);
3789 if (debug > 0) 3801 if (debug > 0)
3790 info("Active setting=%d. maxPS=%d.", i, maxPS); 3802 dev_info(&uvd->dev->dev,
3803 "Active setting=%d. "
3804 "maxPS=%d.\n", i, maxPS);
3791 } else 3805 } else
3792 err("More than one active alt. setting! Ignoring #%d.", i); 3806 err("More than one active alt. setting! Ignoring #%d.", i);
3793 } 3807 }
@@ -3826,7 +3840,7 @@ static int ibmcam_probe(struct usb_interface *intf, const struct usb_device_id *
3826 RESTRICT_TO_RANGE(framerate, 0, 5); 3840 RESTRICT_TO_RANGE(framerate, 0, 5);
3827 break; 3841 break;
3828 default: 3842 default:
3829 info("IBM camera: using 320x240"); 3843 dev_info(&uvd->dev->dev, "IBM camera: using 320x240\n");
3830 size = SIZE_320x240; 3844 size = SIZE_320x240;
3831 /* No break here */ 3845 /* No break here */
3832 case SIZE_320x240: 3846 case SIZE_320x240:
@@ -3855,7 +3869,7 @@ static int ibmcam_probe(struct usb_interface *intf, const struct usb_device_id *
3855 canvasY = 120; 3869 canvasY = 120;
3856 break; 3870 break;
3857 default: 3871 default:
3858 info("IBM NetCamera: using 176x144"); 3872 dev_info(&uvd->dev->dev, "IBM NetCamera: using 176x144\n");
3859 size = SIZE_176x144; 3873 size = SIZE_176x144;
3860 /* No break here */ 3874 /* No break here */
3861 case SIZE_176x144: 3875 case SIZE_176x144: