diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2013-03-04 07:30:48 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-23 09:59:47 -0400 |
commit | 8e42bf033e1d2a4ece4050a9c3f6226e60a7bb2f (patch) | |
tree | 15e44f315631efe8afa28523b1ac5999de957204 | |
parent | 5efb54b2b7bf685f5d2efdf468418e26a74554f2 (diff) |
[media] s5p-tv: add dv_timings support for mixer_video
This just adds dv_timings support without modifying existing dv_preset
support.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
Acked-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/platform/s5p-tv/mixer_video.c | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/drivers/media/platform/s5p-tv/mixer_video.c b/drivers/media/platform/s5p-tv/mixer_video.c index 82142a2d6d93..24fb38177c82 100644 --- a/drivers/media/platform/s5p-tv/mixer_video.c +++ b/drivers/media/platform/s5p-tv/mixer_video.c | |||
@@ -559,6 +559,79 @@ static int mxr_g_dv_preset(struct file *file, void *fh, | |||
559 | return ret ? -EINVAL : 0; | 559 | return ret ? -EINVAL : 0; |
560 | } | 560 | } |
561 | 561 | ||
562 | static int mxr_enum_dv_timings(struct file *file, void *fh, | ||
563 | struct v4l2_enum_dv_timings *timings) | ||
564 | { | ||
565 | struct mxr_layer *layer = video_drvdata(file); | ||
566 | struct mxr_device *mdev = layer->mdev; | ||
567 | int ret; | ||
568 | |||
569 | /* lock protects from changing sd_out */ | ||
570 | mutex_lock(&mdev->mutex); | ||
571 | ret = v4l2_subdev_call(to_outsd(mdev), video, enum_dv_timings, timings); | ||
572 | mutex_unlock(&mdev->mutex); | ||
573 | |||
574 | return ret ? -EINVAL : 0; | ||
575 | } | ||
576 | |||
577 | static int mxr_s_dv_timings(struct file *file, void *fh, | ||
578 | struct v4l2_dv_timings *timings) | ||
579 | { | ||
580 | struct mxr_layer *layer = video_drvdata(file); | ||
581 | struct mxr_device *mdev = layer->mdev; | ||
582 | int ret; | ||
583 | |||
584 | /* lock protects from changing sd_out */ | ||
585 | mutex_lock(&mdev->mutex); | ||
586 | |||
587 | /* timings change cannot be done while there is an entity | ||
588 | * dependant on output configuration | ||
589 | */ | ||
590 | if (mdev->n_output > 0) { | ||
591 | mutex_unlock(&mdev->mutex); | ||
592 | return -EBUSY; | ||
593 | } | ||
594 | |||
595 | ret = v4l2_subdev_call(to_outsd(mdev), video, s_dv_timings, timings); | ||
596 | |||
597 | mutex_unlock(&mdev->mutex); | ||
598 | |||
599 | mxr_layer_update_output(layer); | ||
600 | |||
601 | /* any failure should return EINVAL according to V4L2 doc */ | ||
602 | return ret ? -EINVAL : 0; | ||
603 | } | ||
604 | |||
605 | static int mxr_g_dv_timings(struct file *file, void *fh, | ||
606 | struct v4l2_dv_timings *timings) | ||
607 | { | ||
608 | struct mxr_layer *layer = video_drvdata(file); | ||
609 | struct mxr_device *mdev = layer->mdev; | ||
610 | int ret; | ||
611 | |||
612 | /* lock protects from changing sd_out */ | ||
613 | mutex_lock(&mdev->mutex); | ||
614 | ret = v4l2_subdev_call(to_outsd(mdev), video, g_dv_timings, timings); | ||
615 | mutex_unlock(&mdev->mutex); | ||
616 | |||
617 | return ret ? -EINVAL : 0; | ||
618 | } | ||
619 | |||
620 | static int mxr_dv_timings_cap(struct file *file, void *fh, | ||
621 | struct v4l2_dv_timings_cap *cap) | ||
622 | { | ||
623 | struct mxr_layer *layer = video_drvdata(file); | ||
624 | struct mxr_device *mdev = layer->mdev; | ||
625 | int ret; | ||
626 | |||
627 | /* lock protects from changing sd_out */ | ||
628 | mutex_lock(&mdev->mutex); | ||
629 | ret = v4l2_subdev_call(to_outsd(mdev), video, dv_timings_cap, cap); | ||
630 | mutex_unlock(&mdev->mutex); | ||
631 | |||
632 | return ret ? -EINVAL : 0; | ||
633 | } | ||
634 | |||
562 | static int mxr_s_std(struct file *file, void *fh, v4l2_std_id *norm) | 635 | static int mxr_s_std(struct file *file, void *fh, v4l2_std_id *norm) |
563 | { | 636 | { |
564 | struct mxr_layer *layer = video_drvdata(file); | 637 | struct mxr_layer *layer = video_drvdata(file); |
@@ -618,6 +691,8 @@ static int mxr_enum_output(struct file *file, void *fh, struct v4l2_output *a) | |||
618 | a->capabilities = 0; | 691 | a->capabilities = 0; |
619 | if (sd->ops->video && sd->ops->video->s_dv_preset) | 692 | if (sd->ops->video && sd->ops->video->s_dv_preset) |
620 | a->capabilities |= V4L2_OUT_CAP_PRESETS; | 693 | a->capabilities |= V4L2_OUT_CAP_PRESETS; |
694 | if (sd->ops->video && sd->ops->video->s_dv_timings) | ||
695 | a->capabilities |= V4L2_OUT_CAP_DV_TIMINGS; | ||
621 | if (sd->ops->video && sd->ops->video->s_std_output) | 696 | if (sd->ops->video && sd->ops->video->s_std_output) |
622 | a->capabilities |= V4L2_OUT_CAP_STD; | 697 | a->capabilities |= V4L2_OUT_CAP_STD; |
623 | a->type = V4L2_OUTPUT_TYPE_ANALOG; | 698 | a->type = V4L2_OUTPUT_TYPE_ANALOG; |
@@ -742,6 +817,11 @@ static const struct v4l2_ioctl_ops mxr_ioctl_ops = { | |||
742 | .vidioc_enum_dv_presets = mxr_enum_dv_presets, | 817 | .vidioc_enum_dv_presets = mxr_enum_dv_presets, |
743 | .vidioc_s_dv_preset = mxr_s_dv_preset, | 818 | .vidioc_s_dv_preset = mxr_s_dv_preset, |
744 | .vidioc_g_dv_preset = mxr_g_dv_preset, | 819 | .vidioc_g_dv_preset = mxr_g_dv_preset, |
820 | /* DV Timings functions */ | ||
821 | .vidioc_enum_dv_timings = mxr_enum_dv_timings, | ||
822 | .vidioc_s_dv_timings = mxr_s_dv_timings, | ||
823 | .vidioc_g_dv_timings = mxr_g_dv_timings, | ||
824 | .vidioc_dv_timings_cap = mxr_dv_timings_cap, | ||
745 | /* analog TV standard functions */ | 825 | /* analog TV standard functions */ |
746 | .vidioc_s_std = mxr_s_std, | 826 | .vidioc_s_std = mxr_s_std, |
747 | .vidioc_g_std = mxr_g_std, | 827 | .vidioc_g_std = mxr_g_std, |