diff options
-rw-r--r-- | Documentation/feature-removal-schedule.txt | 8 | ||||
-rw-r--r-- | drivers/media/video/pwc/pwc-if.c | 86 | ||||
-rw-r--r-- | drivers/media/video/pwc/pwc.h | 5 |
3 files changed, 0 insertions, 99 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 3d849122b5b1..11b925ca52eb 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -469,14 +469,6 @@ Who: Hans de Goede <hdegoede@redhat.com> | |||
469 | 469 | ||
470 | ---------------------------- | 470 | ---------------------------- |
471 | 471 | ||
472 | What: Driver specific sysfs API in the pwc driver | ||
473 | When: 3.3 | ||
474 | Why: Setting pan/tilt should be done with v4l2 controls, like with other | ||
475 | cams. The button is available as a standard input device | ||
476 | Who: Hans de Goede <hdegoede@redhat.com> | ||
477 | |||
478 | ---------------------------- | ||
479 | |||
480 | What: Driver specific use of pixfmt.priv in the pwc driver | 472 | What: Driver specific use of pixfmt.priv in the pwc driver |
481 | When: 3.3 | 473 | When: 3.3 |
482 | Why: The .priv field never was intended for this, setting a framerate is | 474 | Why: The .priv field never was intended for this, setting a framerate is |
diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index 550ad071a073..777e9c4972ef 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c | |||
@@ -189,7 +189,6 @@ static void pwc_snapshot_button(struct pwc_device *pdev, int down) | |||
189 | { | 189 | { |
190 | if (down) { | 190 | if (down) { |
191 | PWC_TRACE("Snapshot button pressed.\n"); | 191 | PWC_TRACE("Snapshot button pressed.\n"); |
192 | pdev->snapshot_button_status = 1; | ||
193 | } else { | 192 | } else { |
194 | PWC_TRACE("Snapshot button released.\n"); | 193 | PWC_TRACE("Snapshot button released.\n"); |
195 | } | 194 | } |
@@ -531,84 +530,6 @@ static void pwc_cleanup_queued_bufs(struct pwc_device *pdev) | |||
531 | spin_unlock_irqrestore(&pdev->queued_bufs_lock, flags); | 530 | spin_unlock_irqrestore(&pdev->queued_bufs_lock, flags); |
532 | } | 531 | } |
533 | 532 | ||
534 | /********* | ||
535 | * sysfs | ||
536 | *********/ | ||
537 | static struct pwc_device *cd_to_pwc(struct device *cd) | ||
538 | { | ||
539 | struct video_device *vdev = to_video_device(cd); | ||
540 | return video_get_drvdata(vdev); | ||
541 | } | ||
542 | |||
543 | static ssize_t show_pan_tilt(struct device *class_dev, | ||
544 | struct device_attribute *attr, char *buf) | ||
545 | { | ||
546 | struct pwc_device *pdev = cd_to_pwc(class_dev); | ||
547 | return sprintf(buf, "%d %d\n", pdev->pan_angle, pdev->tilt_angle); | ||
548 | } | ||
549 | |||
550 | static ssize_t store_pan_tilt(struct device *class_dev, | ||
551 | struct device_attribute *attr, | ||
552 | const char *buf, size_t count) | ||
553 | { | ||
554 | struct pwc_device *pdev = cd_to_pwc(class_dev); | ||
555 | int pan, tilt; | ||
556 | int ret = -EINVAL; | ||
557 | |||
558 | if (strncmp(buf, "reset", 5) == 0) | ||
559 | ret = pwc_mpt_reset(pdev, 0x3); | ||
560 | |||
561 | else if (sscanf(buf, "%d %d", &pan, &tilt) > 0) | ||
562 | ret = pwc_mpt_set_angle(pdev, pan, tilt); | ||
563 | |||
564 | if (ret < 0) | ||
565 | return ret; | ||
566 | return strlen(buf); | ||
567 | } | ||
568 | static DEVICE_ATTR(pan_tilt, S_IRUGO | S_IWUSR, show_pan_tilt, | ||
569 | store_pan_tilt); | ||
570 | |||
571 | static ssize_t show_snapshot_button_status(struct device *class_dev, | ||
572 | struct device_attribute *attr, char *buf) | ||
573 | { | ||
574 | struct pwc_device *pdev = cd_to_pwc(class_dev); | ||
575 | int status = pdev->snapshot_button_status; | ||
576 | pdev->snapshot_button_status = 0; | ||
577 | return sprintf(buf, "%d\n", status); | ||
578 | } | ||
579 | |||
580 | static DEVICE_ATTR(button, S_IRUGO | S_IWUSR, show_snapshot_button_status, | ||
581 | NULL); | ||
582 | |||
583 | static int pwc_create_sysfs_files(struct pwc_device *pdev) | ||
584 | { | ||
585 | int rc; | ||
586 | |||
587 | rc = device_create_file(&pdev->vdev.dev, &dev_attr_button); | ||
588 | if (rc) | ||
589 | goto err; | ||
590 | if (pdev->features & FEATURE_MOTOR_PANTILT) { | ||
591 | rc = device_create_file(&pdev->vdev.dev, &dev_attr_pan_tilt); | ||
592 | if (rc) | ||
593 | goto err_button; | ||
594 | } | ||
595 | |||
596 | return 0; | ||
597 | |||
598 | err_button: | ||
599 | device_remove_file(&pdev->vdev.dev, &dev_attr_button); | ||
600 | err: | ||
601 | PWC_ERROR("Could not create sysfs files.\n"); | ||
602 | return rc; | ||
603 | } | ||
604 | |||
605 | static void pwc_remove_sysfs_files(struct pwc_device *pdev) | ||
606 | { | ||
607 | if (pdev->features & FEATURE_MOTOR_PANTILT) | ||
608 | device_remove_file(&pdev->vdev.dev, &dev_attr_pan_tilt); | ||
609 | device_remove_file(&pdev->vdev.dev, &dev_attr_button); | ||
610 | } | ||
611 | |||
612 | #ifdef CONFIG_USB_PWC_DEBUG | 533 | #ifdef CONFIG_USB_PWC_DEBUG |
613 | static const char *pwc_sensor_type_to_string(unsigned int sensor_type) | 534 | static const char *pwc_sensor_type_to_string(unsigned int sensor_type) |
614 | { | 535 | { |
@@ -1240,10 +1161,6 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1240 | PWC_ERROR("Failed to register as video device (%d).\n", rc); | 1161 | PWC_ERROR("Failed to register as video device (%d).\n", rc); |
1241 | goto err_unregister_v4l2_dev; | 1162 | goto err_unregister_v4l2_dev; |
1242 | } | 1163 | } |
1243 | rc = pwc_create_sysfs_files(pdev); | ||
1244 | if (rc) | ||
1245 | goto err_video_unreg; | ||
1246 | |||
1247 | PWC_INFO("Registered as %s.\n", video_device_node_name(&pdev->vdev)); | 1164 | PWC_INFO("Registered as %s.\n", video_device_node_name(&pdev->vdev)); |
1248 | 1165 | ||
1249 | #ifdef CONFIG_USB_PWC_INPUT_EVDEV | 1166 | #ifdef CONFIG_USB_PWC_INPUT_EVDEV |
@@ -1252,7 +1169,6 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1252 | if (!pdev->button_dev) { | 1169 | if (!pdev->button_dev) { |
1253 | PWC_ERROR("Err, insufficient memory for webcam snapshot button device."); | 1170 | PWC_ERROR("Err, insufficient memory for webcam snapshot button device."); |
1254 | rc = -ENOMEM; | 1171 | rc = -ENOMEM; |
1255 | pwc_remove_sysfs_files(pdev); | ||
1256 | goto err_video_unreg; | 1172 | goto err_video_unreg; |
1257 | } | 1173 | } |
1258 | 1174 | ||
@@ -1270,7 +1186,6 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1270 | if (rc) { | 1186 | if (rc) { |
1271 | input_free_device(pdev->button_dev); | 1187 | input_free_device(pdev->button_dev); |
1272 | pdev->button_dev = NULL; | 1188 | pdev->button_dev = NULL; |
1273 | pwc_remove_sysfs_files(pdev); | ||
1274 | goto err_video_unreg; | 1189 | goto err_video_unreg; |
1275 | } | 1190 | } |
1276 | #endif | 1191 | #endif |
@@ -1304,7 +1219,6 @@ static void usb_pwc_disconnect(struct usb_interface *intf) | |||
1304 | 1219 | ||
1305 | pwc_cleanup_queued_bufs(pdev); | 1220 | pwc_cleanup_queued_bufs(pdev); |
1306 | 1221 | ||
1307 | pwc_remove_sysfs_files(pdev); | ||
1308 | video_unregister_device(&pdev->vdev); | 1222 | video_unregister_device(&pdev->vdev); |
1309 | v4l2_device_unregister(&pdev->v4l2_dev); | 1223 | v4l2_device_unregister(&pdev->v4l2_dev); |
1310 | 1224 | ||
diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h index c2594f4247aa..e3adec857fcf 100644 --- a/drivers/media/video/pwc/pwc.h +++ b/drivers/media/video/pwc/pwc.h | |||
@@ -275,11 +275,6 @@ struct pwc_device | |||
275 | int pan_angle; /* in degrees * 100 */ | 275 | int pan_angle; /* in degrees * 100 */ |
276 | int tilt_angle; /* absolute angle; 0,0 is home */ | 276 | int tilt_angle; /* absolute angle; 0,0 is home */ |
277 | 277 | ||
278 | /* | ||
279 | * Set to 1 when the user push the button, reset to 0 | ||
280 | * when this value is read from sysfs. | ||
281 | */ | ||
282 | int snapshot_button_status; | ||
283 | #ifdef CONFIG_USB_PWC_INPUT_EVDEV | 278 | #ifdef CONFIG_USB_PWC_INPUT_EVDEV |
284 | struct input_dev *button_dev; /* webcam snapshot button input */ | 279 | struct input_dev *button_dev; /* webcam snapshot button input */ |
285 | char button_phys[64]; | 280 | char button_phys[64]; |