| .. | .. |
|---|
| 20 | 20 | #include <media/v4l2-device.h> |
|---|
| 21 | 21 | #include <media/v4l2-ctrls.h> |
|---|
| 22 | 22 | #include <media/v4l2-fh.h> |
|---|
| 23 | | - |
|---|
| 24 | | -#include "most/core.h" |
|---|
| 23 | +#include <linux/most.h> |
|---|
| 25 | 24 | |
|---|
| 26 | 25 | #define V4L2_CMP_MAX_INPUT 1 |
|---|
| 27 | 26 | |
|---|
| 28 | | -static struct core_component comp; |
|---|
| 27 | +static struct most_component comp; |
|---|
| 29 | 28 | |
|---|
| 30 | 29 | struct most_video_dev { |
|---|
| 31 | 30 | struct most_interface *iface; |
|---|
| .. | .. |
|---|
| 54 | 53 | }; |
|---|
| 55 | 54 | |
|---|
| 56 | 55 | static struct list_head video_devices = LIST_HEAD_INIT(video_devices); |
|---|
| 57 | | -static struct spinlock list_lock; |
|---|
| 56 | +static DEFINE_SPINLOCK(list_lock); |
|---|
| 58 | 57 | |
|---|
| 59 | 58 | static inline bool data_ready(struct most_video_dev *mdev) |
|---|
| 60 | 59 | { |
|---|
| .. | .. |
|---|
| 74 | 73 | struct comp_fh *fh; |
|---|
| 75 | 74 | |
|---|
| 76 | 75 | switch (vdev->vfl_type) { |
|---|
| 77 | | - case VFL_TYPE_GRABBER: |
|---|
| 76 | + case VFL_TYPE_VIDEO: |
|---|
| 78 | 77 | break; |
|---|
| 79 | 78 | default: |
|---|
| 80 | 79 | return -EINVAL; |
|---|
| .. | .. |
|---|
| 250 | 249 | strlcpy(cap->card, "MOST", sizeof(cap->card)); |
|---|
| 251 | 250 | snprintf(cap->bus_info, sizeof(cap->bus_info), |
|---|
| 252 | 251 | "%s", mdev->iface->description); |
|---|
| 253 | | - |
|---|
| 254 | | - cap->capabilities = |
|---|
| 255 | | - V4L2_CAP_READWRITE | |
|---|
| 256 | | - V4L2_CAP_TUNER | |
|---|
| 257 | | - V4L2_CAP_VIDEO_CAPTURE; |
|---|
| 258 | 252 | return 0; |
|---|
| 259 | 253 | } |
|---|
| 260 | 254 | |
|---|
| .. | .. |
|---|
| 366 | 360 | .release = video_device_release, |
|---|
| 367 | 361 | .ioctl_ops = &video_ioctl_ops, |
|---|
| 368 | 362 | .tvnorms = V4L2_STD_UNKNOWN, |
|---|
| 363 | + .device_caps = V4L2_CAP_READWRITE | V4L2_CAP_VIDEO_CAPTURE, |
|---|
| 369 | 364 | }; |
|---|
| 370 | 365 | |
|---|
| 371 | 366 | /**************************************************************************/ |
|---|
| .. | .. |
|---|
| 428 | 423 | |
|---|
| 429 | 424 | /* Register the v4l2 device */ |
|---|
| 430 | 425 | video_set_drvdata(mdev->vdev, mdev); |
|---|
| 431 | | - ret = video_register_device(mdev->vdev, VFL_TYPE_GRABBER, -1); |
|---|
| 426 | + ret = video_register_device(mdev->vdev, VFL_TYPE_VIDEO, -1); |
|---|
| 432 | 427 | if (ret) { |
|---|
| 433 | 428 | v4l2_err(&mdev->v4l2_dev, "video_register_device failed (%d)\n", |
|---|
| 434 | 429 | ret); |
|---|
| .. | .. |
|---|
| 453 | 448 | } |
|---|
| 454 | 449 | |
|---|
| 455 | 450 | static int comp_probe_channel(struct most_interface *iface, int channel_idx, |
|---|
| 456 | | - struct most_channel_config *ccfg, char *name) |
|---|
| 451 | + struct most_channel_config *ccfg, char *name, |
|---|
| 452 | + char *args) |
|---|
| 457 | 453 | { |
|---|
| 458 | 454 | int ret; |
|---|
| 459 | 455 | struct most_video_dev *mdev = get_comp_dev(iface, channel_idx); |
|---|
| .. | .. |
|---|
| 530 | 526 | return 0; |
|---|
| 531 | 527 | } |
|---|
| 532 | 528 | |
|---|
| 533 | | -static struct core_component comp = { |
|---|
| 529 | +static struct most_component comp = { |
|---|
| 530 | + .mod = THIS_MODULE, |
|---|
| 534 | 531 | .name = "video", |
|---|
| 535 | 532 | .probe_channel = comp_probe_channel, |
|---|
| 536 | 533 | .disconnect_channel = comp_disconnect_channel, |
|---|
| .. | .. |
|---|
| 539 | 536 | |
|---|
| 540 | 537 | static int __init comp_init(void) |
|---|
| 541 | 538 | { |
|---|
| 542 | | - spin_lock_init(&list_lock); |
|---|
| 543 | | - return most_register_component(&comp); |
|---|
| 539 | + int err; |
|---|
| 540 | + |
|---|
| 541 | + err = most_register_component(&comp); |
|---|
| 542 | + if (err) |
|---|
| 543 | + return err; |
|---|
| 544 | + err = most_register_configfs_subsys(&comp); |
|---|
| 545 | + if (err) { |
|---|
| 546 | + most_deregister_component(&comp); |
|---|
| 547 | + return err; |
|---|
| 548 | + } |
|---|
| 549 | + return 0; |
|---|
| 544 | 550 | } |
|---|
| 545 | 551 | |
|---|
| 546 | 552 | static void __exit comp_exit(void) |
|---|
| .. | .. |
|---|
| 565 | 571 | } |
|---|
| 566 | 572 | spin_unlock_irq(&list_lock); |
|---|
| 567 | 573 | |
|---|
| 574 | + most_deregister_configfs_subsys(&comp); |
|---|
| 568 | 575 | most_deregister_component(&comp); |
|---|
| 569 | 576 | BUG_ON(!list_empty(&video_devices)); |
|---|
| 570 | 577 | } |
|---|