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:38:59 -0400 |
commit | 22c25b48613d89702f0436fd7ac1f299f9b2e42a (patch) | |
tree | a0a6f4c2f7705be03c55c5be73c22503f02d5072 | |
parent | 0349f6a5f18e929ca88c6db7def5e02f5ae0a416 (diff) |
[media] ad9389b: 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>
-rw-r--r-- | drivers/media/i2c/ad9389b.c | 68 |
1 files changed, 39 insertions, 29 deletions
diff --git a/drivers/media/i2c/ad9389b.c b/drivers/media/i2c/ad9389b.c index 1b7ecfd88673..cee0ae60ec2b 100644 --- a/drivers/media/i2c/ad9389b.c +++ b/drivers/media/i2c/ad9389b.c | |||
@@ -571,35 +571,6 @@ static const struct v4l2_subdev_core_ops ad9389b_core_ops = { | |||
571 | .interrupt_service_routine = ad9389b_isr, | 571 | .interrupt_service_routine = ad9389b_isr, |
572 | }; | 572 | }; |
573 | 573 | ||
574 | /* ------------------------------ PAD OPS ------------------------------ */ | ||
575 | |||
576 | static int ad9389b_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) | ||
577 | { | ||
578 | struct ad9389b_state *state = get_ad9389b_state(sd); | ||
579 | |||
580 | if (edid->pad != 0) | ||
581 | return -EINVAL; | ||
582 | if (edid->blocks == 0 || edid->blocks > 256) | ||
583 | return -EINVAL; | ||
584 | if (!edid->edid) | ||
585 | return -EINVAL; | ||
586 | if (!state->edid.segments) { | ||
587 | v4l2_dbg(1, debug, sd, "EDID segment 0 not found\n"); | ||
588 | return -ENODATA; | ||
589 | } | ||
590 | if (edid->start_block >= state->edid.segments * 2) | ||
591 | return -E2BIG; | ||
592 | if (edid->blocks + edid->start_block >= state->edid.segments * 2) | ||
593 | edid->blocks = state->edid.segments * 2 - edid->start_block; | ||
594 | memcpy(edid->edid, &state->edid.data[edid->start_block * 128], | ||
595 | 128 * edid->blocks); | ||
596 | return 0; | ||
597 | } | ||
598 | |||
599 | static const struct v4l2_subdev_pad_ops ad9389b_pad_ops = { | ||
600 | .get_edid = ad9389b_get_edid, | ||
601 | }; | ||
602 | |||
603 | /* ------------------------------ VIDEO OPS ------------------------------ */ | 574 | /* ------------------------------ VIDEO OPS ------------------------------ */ |
604 | 575 | ||
605 | /* Enable/disable ad9389b output */ | 576 | /* Enable/disable ad9389b output */ |
@@ -678,6 +649,9 @@ static int ad9389b_g_dv_timings(struct v4l2_subdev *sd, | |||
678 | static int ad9389b_enum_dv_timings(struct v4l2_subdev *sd, | 649 | static int ad9389b_enum_dv_timings(struct v4l2_subdev *sd, |
679 | struct v4l2_enum_dv_timings *timings) | 650 | struct v4l2_enum_dv_timings *timings) |
680 | { | 651 | { |
652 | if (timings->pad != 0) | ||
653 | return -EINVAL; | ||
654 | |||
681 | return v4l2_enum_dv_timings_cap(timings, &ad9389b_timings_cap, | 655 | return v4l2_enum_dv_timings_cap(timings, &ad9389b_timings_cap, |
682 | NULL, NULL); | 656 | NULL, NULL); |
683 | } | 657 | } |
@@ -685,6 +659,9 @@ static int ad9389b_enum_dv_timings(struct v4l2_subdev *sd, | |||
685 | static int ad9389b_dv_timings_cap(struct v4l2_subdev *sd, | 659 | static int ad9389b_dv_timings_cap(struct v4l2_subdev *sd, |
686 | struct v4l2_dv_timings_cap *cap) | 660 | struct v4l2_dv_timings_cap *cap) |
687 | { | 661 | { |
662 | if (cap->pad != 0) | ||
663 | return -EINVAL; | ||
664 | |||
688 | *cap = ad9389b_timings_cap; | 665 | *cap = ad9389b_timings_cap; |
689 | return 0; | 666 | return 0; |
690 | } | 667 | } |
@@ -697,6 +674,39 @@ static const struct v4l2_subdev_video_ops ad9389b_video_ops = { | |||
697 | .dv_timings_cap = ad9389b_dv_timings_cap, | 674 | .dv_timings_cap = ad9389b_dv_timings_cap, |
698 | }; | 675 | }; |
699 | 676 | ||
677 | /* ------------------------------ PAD OPS ------------------------------ */ | ||
678 | |||
679 | static int ad9389b_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) | ||
680 | { | ||
681 | struct ad9389b_state *state = get_ad9389b_state(sd); | ||
682 | |||
683 | if (edid->pad != 0) | ||
684 | return -EINVAL; | ||
685 | if (edid->blocks == 0 || edid->blocks > 256) | ||
686 | return -EINVAL; | ||
687 | if (!edid->edid) | ||
688 | return -EINVAL; | ||
689 | if (!state->edid.segments) { | ||
690 | v4l2_dbg(1, debug, sd, "EDID segment 0 not found\n"); | ||
691 | return -ENODATA; | ||
692 | } | ||
693 | if (edid->start_block >= state->edid.segments * 2) | ||
694 | return -E2BIG; | ||
695 | if (edid->blocks + edid->start_block >= state->edid.segments * 2) | ||
696 | edid->blocks = state->edid.segments * 2 - edid->start_block; | ||
697 | memcpy(edid->edid, &state->edid.data[edid->start_block * 128], | ||
698 | 128 * edid->blocks); | ||
699 | return 0; | ||
700 | } | ||
701 | |||
702 | static const struct v4l2_subdev_pad_ops ad9389b_pad_ops = { | ||
703 | .get_edid = ad9389b_get_edid, | ||
704 | .enum_dv_timings = ad9389b_enum_dv_timings, | ||
705 | .dv_timings_cap = ad9389b_dv_timings_cap, | ||
706 | }; | ||
707 | |||
708 | /* ------------------------------ AUDIO OPS ------------------------------ */ | ||
709 | |||
700 | static int ad9389b_s_audio_stream(struct v4l2_subdev *sd, int enable) | 710 | static int ad9389b_s_audio_stream(struct v4l2_subdev *sd, int enable) |
701 | { | 711 | { |
702 | v4l2_dbg(1, debug, sd, "%s: %sable\n", __func__, (enable ? "en" : "dis")); | 712 | v4l2_dbg(1, debug, sd, "%s: %sable\n", __func__, (enable ? "en" : "dis")); |