Commit bd3276a3 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] adv7511: fix VIC autodetect

The adv7511 will automatically fill in the VIC code in the AVI InfoFrame
based on the timings of the incoming pixelport signals.

However, to have this work correctly it needs to specify the fps
value in a register. After doing this the proper VIC code is filled in.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 43f71d93
......@@ -1041,6 +1041,8 @@ static int adv7511_s_dv_timings(struct v4l2_subdev *sd,
struct v4l2_dv_timings *timings)
{
struct adv7511_state *state = get_adv7511_state(sd);
struct v4l2_bt_timings *bt = &timings->bt;
u32 fps;
v4l2_dbg(1, debug, sd, "%s:\n", __func__);
......@@ -1052,15 +1054,29 @@ static int adv7511_s_dv_timings(struct v4l2_subdev *sd,
if the format is one of the CEA or DMT timings. */
v4l2_find_dv_timings_cap(timings, &adv7511_timings_cap, 0, NULL, NULL);
timings->bt.flags &= ~V4L2_DV_FL_REDUCED_FPS;
/* save timings */
state->dv_timings = *timings;
/* set h/vsync polarities */
adv7511_wr_and_or(sd, 0x17, 0x9f,
((timings->bt.polarities & V4L2_DV_VSYNC_POS_POL) ? 0 : 0x40) |
((timings->bt.polarities & V4L2_DV_HSYNC_POS_POL) ? 0 : 0x20));
((bt->polarities & V4L2_DV_VSYNC_POS_POL) ? 0 : 0x40) |
((bt->polarities & V4L2_DV_HSYNC_POS_POL) ? 0 : 0x20));
fps = (u32)bt->pixelclock / (V4L2_DV_BT_FRAME_WIDTH(bt) * V4L2_DV_BT_FRAME_HEIGHT(bt));
switch (fps) {
case 24:
adv7511_wr_and_or(sd, 0xfb, 0xf9, 1 << 1);
break;
case 25:
adv7511_wr_and_or(sd, 0xfb, 0xf9, 2 << 1);
break;
case 30:
adv7511_wr_and_or(sd, 0xfb, 0xf9, 3 << 1);
break;
default:
adv7511_wr_and_or(sd, 0xfb, 0xf9, 0);
break;
}
/* update quantization range based on new dv_timings */
adv7511_set_rgb_quantization_mode(sd, state->rgb_quantization_range_ctrl);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment