diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2014-01-31 06:51:18 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-05-25 11:40:04 -0400 |
commit | 9646171fac46161b160918f01d3a307376679ed8 (patch) | |
tree | 3182d77c162f4e84b51265d89ac40cef0cbf71f0 /drivers/media/i2c/adv7511.c | |
parent | 22c25b48613d89702f0436fd7ac1f299f9b2e42a (diff) |
[media] adv7511: Add pad-level DV timings operations
The video enum_dv_timings and dv_timings_cap operations are deprecated.
Implement the pad-level version of those operations to prepare for the
removal of the video version.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/i2c/adv7511.c')
-rw-r--r-- | drivers/media/i2c/adv7511.c | 66 |
1 files changed, 38 insertions, 28 deletions
diff --git a/drivers/media/i2c/adv7511.c b/drivers/media/i2c/adv7511.c index 942ca4b99297..f4a143143f0b 100644 --- a/drivers/media/i2c/adv7511.c +++ b/drivers/media/i2c/adv7511.c | |||
@@ -597,34 +597,6 @@ static int adv7511_isr(struct v4l2_subdev *sd, u32 status, bool *handled) | |||
597 | return 0; | 597 | return 0; |
598 | } | 598 | } |
599 | 599 | ||
600 | static int adv7511_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) | ||
601 | { | ||
602 | struct adv7511_state *state = get_adv7511_state(sd); | ||
603 | |||
604 | if (edid->pad != 0) | ||
605 | return -EINVAL; | ||
606 | if ((edid->blocks == 0) || (edid->blocks > 256)) | ||
607 | return -EINVAL; | ||
608 | if (!edid->edid) | ||
609 | return -EINVAL; | ||
610 | if (!state->edid.segments) { | ||
611 | v4l2_dbg(1, debug, sd, "EDID segment 0 not found\n"); | ||
612 | return -ENODATA; | ||
613 | } | ||
614 | if (edid->start_block >= state->edid.segments * 2) | ||
615 | return -E2BIG; | ||
616 | if ((edid->blocks + edid->start_block) >= state->edid.segments * 2) | ||
617 | edid->blocks = state->edid.segments * 2 - edid->start_block; | ||
618 | |||
619 | memcpy(edid->edid, &state->edid.data[edid->start_block * 128], | ||
620 | 128 * edid->blocks); | ||
621 | return 0; | ||
622 | } | ||
623 | |||
624 | static const struct v4l2_subdev_pad_ops adv7511_pad_ops = { | ||
625 | .get_edid = adv7511_get_edid, | ||
626 | }; | ||
627 | |||
628 | static const struct v4l2_subdev_core_ops adv7511_core_ops = { | 600 | static const struct v4l2_subdev_core_ops adv7511_core_ops = { |
629 | .log_status = adv7511_log_status, | 601 | .log_status = adv7511_log_status, |
630 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 602 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
@@ -700,12 +672,18 @@ static int adv7511_g_dv_timings(struct v4l2_subdev *sd, | |||
700 | static int adv7511_enum_dv_timings(struct v4l2_subdev *sd, | 672 | static int adv7511_enum_dv_timings(struct v4l2_subdev *sd, |
701 | struct v4l2_enum_dv_timings *timings) | 673 | struct v4l2_enum_dv_timings *timings) |
702 | { | 674 | { |
675 | if (timings->pad != 0) | ||
676 | return -EINVAL; | ||
677 | |||
703 | return v4l2_enum_dv_timings_cap(timings, &adv7511_timings_cap, NULL, NULL); | 678 | return v4l2_enum_dv_timings_cap(timings, &adv7511_timings_cap, NULL, NULL); |
704 | } | 679 | } |
705 | 680 | ||
706 | static int adv7511_dv_timings_cap(struct v4l2_subdev *sd, | 681 | static int adv7511_dv_timings_cap(struct v4l2_subdev *sd, |
707 | struct v4l2_dv_timings_cap *cap) | 682 | struct v4l2_dv_timings_cap *cap) |
708 | { | 683 | { |
684 | if (cap->pad != 0) | ||
685 | return -EINVAL; | ||
686 | |||
709 | *cap = adv7511_timings_cap; | 687 | *cap = adv7511_timings_cap; |
710 | return 0; | 688 | return 0; |
711 | } | 689 | } |
@@ -797,6 +775,38 @@ static const struct v4l2_subdev_audio_ops adv7511_audio_ops = { | |||
797 | .s_routing = adv7511_s_routing, | 775 | .s_routing = adv7511_s_routing, |
798 | }; | 776 | }; |
799 | 777 | ||
778 | /* ---------------------------- PAD OPS ------------------------------------- */ | ||
779 | |||
780 | static int adv7511_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) | ||
781 | { | ||
782 | struct adv7511_state *state = get_adv7511_state(sd); | ||
783 | |||
784 | if (edid->pad != 0) | ||
785 | return -EINVAL; | ||
786 | if ((edid->blocks == 0) || (edid->blocks > 256)) | ||
787 | return -EINVAL; | ||
788 | if (!edid->edid) | ||
789 | return -EINVAL; | ||
790 | if (!state->edid.segments) { | ||
791 | v4l2_dbg(1, debug, sd, "EDID segment 0 not found\n"); | ||
792 | return -ENODATA; | ||
793 | } | ||
794 | if (edid->start_block >= state->edid.segments * 2) | ||
795 | return -E2BIG; | ||
796 | if ((edid->blocks + edid->start_block) >= state->edid.segments * 2) | ||
797 | edid->blocks = state->edid.segments * 2 - edid->start_block; | ||
798 | |||
799 | memcpy(edid->edid, &state->edid.data[edid->start_block * 128], | ||
800 | 128 * edid->blocks); | ||
801 | return 0; | ||
802 | } | ||
803 | |||
804 | static const struct v4l2_subdev_pad_ops adv7511_pad_ops = { | ||
805 | .get_edid = adv7511_get_edid, | ||
806 | .enum_dv_timings = adv7511_enum_dv_timings, | ||
807 | .dv_timings_cap = adv7511_dv_timings_cap, | ||
808 | }; | ||
809 | |||
800 | /* --------------------- SUBDEV OPS --------------------------------------- */ | 810 | /* --------------------- SUBDEV OPS --------------------------------------- */ |
801 | 811 | ||
802 | static const struct v4l2_subdev_ops adv7511_ops = { | 812 | static const struct v4l2_subdev_ops adv7511_ops = { |