Commit 0e78795e authored by Jae Hyun Yoo's avatar Jae Hyun Yoo Committed by Mauro Carvalho Chehab

media: aspeed: refine hsync/vsync polarity setting logic

To prevent inaccurate detections of resolution, this commit enables
clearing of hsync/vsync polarity bits based on probed sync state.
Signed-off-by: default avatarJae Hyun Yoo <jae.hyun.yoo@linux.intel.com>
Reviewed-by: default avatarEddie James <eajames@linux.ibm.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 86caab29
...@@ -614,7 +614,7 @@ static void aspeed_video_check_and_set_polarity(struct aspeed_video *video) ...@@ -614,7 +614,7 @@ static void aspeed_video_check_and_set_polarity(struct aspeed_video *video)
int i; int i;
int hsync_counter = 0; int hsync_counter = 0;
int vsync_counter = 0; int vsync_counter = 0;
u32 sts; u32 sts, ctrl;
for (i = 0; i < NUM_POLARITY_CHECKS; ++i) { for (i = 0; i < NUM_POLARITY_CHECKS; ++i) {
sts = aspeed_video_read(video, VE_MODE_DETECT_STATUS); sts = aspeed_video_read(video, VE_MODE_DETECT_STATUS);
...@@ -629,30 +629,29 @@ static void aspeed_video_check_and_set_polarity(struct aspeed_video *video) ...@@ -629,30 +629,29 @@ static void aspeed_video_check_and_set_polarity(struct aspeed_video *video)
hsync_counter++; hsync_counter++;
} }
if (hsync_counter < 0 || vsync_counter < 0) { ctrl = aspeed_video_read(video, VE_CTRL);
u32 ctrl = 0;
if (hsync_counter < 0) { if (hsync_counter < 0) {
ctrl = VE_CTRL_HSYNC_POL; ctrl |= VE_CTRL_HSYNC_POL;
video->detected_timings.polarities &= video->detected_timings.polarities &=
~V4L2_DV_HSYNC_POS_POL; ~V4L2_DV_HSYNC_POS_POL;
} else { } else {
ctrl &= ~VE_CTRL_HSYNC_POL;
video->detected_timings.polarities |= video->detected_timings.polarities |=
V4L2_DV_HSYNC_POS_POL; V4L2_DV_HSYNC_POS_POL;
} }
if (vsync_counter < 0) { if (vsync_counter < 0) {
ctrl = VE_CTRL_VSYNC_POL; ctrl |= VE_CTRL_VSYNC_POL;
video->detected_timings.polarities &= video->detected_timings.polarities &=
~V4L2_DV_VSYNC_POS_POL; ~V4L2_DV_VSYNC_POS_POL;
} else { } else {
ctrl &= ~VE_CTRL_VSYNC_POL;
video->detected_timings.polarities |= video->detected_timings.polarities |=
V4L2_DV_VSYNC_POS_POL; V4L2_DV_VSYNC_POS_POL;
} }
if (ctrl) aspeed_video_write(video, VE_CTRL, ctrl);
aspeed_video_update(video, VE_CTRL, 0, ctrl);
}
} }
static bool aspeed_video_alloc_buf(struct aspeed_video *video, static bool aspeed_video_alloc_buf(struct aspeed_video *video,
......
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