[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>
This commit is contained in:
Родитель
0349f6a5f1
Коммит
22c25b4861
|
@ -571,35 +571,6 @@ static const struct v4l2_subdev_core_ops ad9389b_core_ops = {
|
|||
.interrupt_service_routine = ad9389b_isr,
|
||||
};
|
||||
|
||||
/* ------------------------------ PAD OPS ------------------------------ */
|
||||
|
||||
static int ad9389b_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid)
|
||||
{
|
||||
struct ad9389b_state *state = get_ad9389b_state(sd);
|
||||
|
||||
if (edid->pad != 0)
|
||||
return -EINVAL;
|
||||
if (edid->blocks == 0 || edid->blocks > 256)
|
||||
return -EINVAL;
|
||||
if (!edid->edid)
|
||||
return -EINVAL;
|
||||
if (!state->edid.segments) {
|
||||
v4l2_dbg(1, debug, sd, "EDID segment 0 not found\n");
|
||||
return -ENODATA;
|
||||
}
|
||||
if (edid->start_block >= state->edid.segments * 2)
|
||||
return -E2BIG;
|
||||
if (edid->blocks + edid->start_block >= state->edid.segments * 2)
|
||||
edid->blocks = state->edid.segments * 2 - edid->start_block;
|
||||
memcpy(edid->edid, &state->edid.data[edid->start_block * 128],
|
||||
128 * edid->blocks);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct v4l2_subdev_pad_ops ad9389b_pad_ops = {
|
||||
.get_edid = ad9389b_get_edid,
|
||||
};
|
||||
|
||||
/* ------------------------------ VIDEO OPS ------------------------------ */
|
||||
|
||||
/* Enable/disable ad9389b output */
|
||||
|
@ -678,6 +649,9 @@ static int ad9389b_g_dv_timings(struct v4l2_subdev *sd,
|
|||
static int ad9389b_enum_dv_timings(struct v4l2_subdev *sd,
|
||||
struct v4l2_enum_dv_timings *timings)
|
||||
{
|
||||
if (timings->pad != 0)
|
||||
return -EINVAL;
|
||||
|
||||
return v4l2_enum_dv_timings_cap(timings, &ad9389b_timings_cap,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
@ -685,6 +659,9 @@ static int ad9389b_enum_dv_timings(struct v4l2_subdev *sd,
|
|||
static int ad9389b_dv_timings_cap(struct v4l2_subdev *sd,
|
||||
struct v4l2_dv_timings_cap *cap)
|
||||
{
|
||||
if (cap->pad != 0)
|
||||
return -EINVAL;
|
||||
|
||||
*cap = ad9389b_timings_cap;
|
||||
return 0;
|
||||
}
|
||||
|
@ -697,6 +674,39 @@ static const struct v4l2_subdev_video_ops ad9389b_video_ops = {
|
|||
.dv_timings_cap = ad9389b_dv_timings_cap,
|
||||
};
|
||||
|
||||
/* ------------------------------ PAD OPS ------------------------------ */
|
||||
|
||||
static int ad9389b_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid)
|
||||
{
|
||||
struct ad9389b_state *state = get_ad9389b_state(sd);
|
||||
|
||||
if (edid->pad != 0)
|
||||
return -EINVAL;
|
||||
if (edid->blocks == 0 || edid->blocks > 256)
|
||||
return -EINVAL;
|
||||
if (!edid->edid)
|
||||
return -EINVAL;
|
||||
if (!state->edid.segments) {
|
||||
v4l2_dbg(1, debug, sd, "EDID segment 0 not found\n");
|
||||
return -ENODATA;
|
||||
}
|
||||
if (edid->start_block >= state->edid.segments * 2)
|
||||
return -E2BIG;
|
||||
if (edid->blocks + edid->start_block >= state->edid.segments * 2)
|
||||
edid->blocks = state->edid.segments * 2 - edid->start_block;
|
||||
memcpy(edid->edid, &state->edid.data[edid->start_block * 128],
|
||||
128 * edid->blocks);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct v4l2_subdev_pad_ops ad9389b_pad_ops = {
|
||||
.get_edid = ad9389b_get_edid,
|
||||
.enum_dv_timings = ad9389b_enum_dv_timings,
|
||||
.dv_timings_cap = ad9389b_dv_timings_cap,
|
||||
};
|
||||
|
||||
/* ------------------------------ AUDIO OPS ------------------------------ */
|
||||
|
||||
static int ad9389b_s_audio_stream(struct v4l2_subdev *sd, int enable)
|
||||
{
|
||||
v4l2_dbg(1, debug, sd, "%s: %sable\n", __func__, (enable ? "en" : "dis"));
|
||||
|
|
Загрузка…
Ссылка в новой задаче