Commit 22443acc authored by Jammy Huang's avatar Jammy Huang Committed by Hans Verkuil

media: aspeed: Fix unstable timing detection

Using stable-signal in resolution detection, and try detection again
if unstable.

VE_MODE_DETECT_EXTSRC_ADC: 1 if video source is from ADC output.
VE_MODE_DETECT_H_STABLE: 1 if horizontal signal detection is stable.
VE_MODE_DETECT_V_STABLE: 1 if vertical signal detection is stable.
Signed-off-by: default avatarJammy Huang <jammy_huang@aspeedtech.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
parent d6f9a60f
...@@ -155,9 +155,14 @@ ...@@ -155,9 +155,14 @@
#define VE_MODE_DETECT_STATUS 0x098 #define VE_MODE_DETECT_STATUS 0x098
#define VE_MODE_DETECT_H_PERIOD GENMASK(11, 0) #define VE_MODE_DETECT_H_PERIOD GENMASK(11, 0)
#define VE_MODE_DETECT_EXTSRC_ADC BIT(12)
#define VE_MODE_DETECT_H_STABLE BIT(13)
#define VE_MODE_DETECT_V_STABLE BIT(14)
#define VE_MODE_DETECT_V_LINES GENMASK(27, 16) #define VE_MODE_DETECT_V_LINES GENMASK(27, 16)
#define VE_MODE_DETECT_STATUS_VSYNC BIT(28) #define VE_MODE_DETECT_STATUS_VSYNC BIT(28)
#define VE_MODE_DETECT_STATUS_HSYNC BIT(29) #define VE_MODE_DETECT_STATUS_HSYNC BIT(29)
#define VE_MODE_DETECT_VSYNC_RDY BIT(30)
#define VE_MODE_DETECT_HSYNC_RDY BIT(31)
#define VE_SYNC_STATUS 0x09c #define VE_SYNC_STATUS 0x09c
#define VE_SYNC_STATUS_HSYNC GENMASK(11, 0) #define VE_SYNC_STATUS_HSYNC GENMASK(11, 0)
...@@ -939,6 +944,7 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) ...@@ -939,6 +944,7 @@ static void aspeed_video_get_resolution(struct aspeed_video *video)
bool invalid_resolution = true; bool invalid_resolution = true;
int rc; int rc;
int tries = 0; int tries = 0;
u32 mds;
u32 src_lr_edge; u32 src_lr_edge;
u32 src_tb_edge; u32 src_tb_edge;
struct v4l2_bt_timings *det = &video->detected_timings; struct v4l2_bt_timings *det = &video->detected_timings;
...@@ -969,6 +975,13 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) ...@@ -969,6 +975,13 @@ static void aspeed_video_get_resolution(struct aspeed_video *video)
return; return;
} }
mds = aspeed_video_read(video, VE_MODE_DETECT_STATUS);
// try detection again if current signal isn't stable
if (!(mds & VE_MODE_DETECT_H_STABLE) ||
!(mds & VE_MODE_DETECT_V_STABLE) ||
(mds & VE_MODE_DETECT_EXTSRC_ADC))
continue;
aspeed_video_check_and_set_polarity(video); aspeed_video_check_and_set_polarity(video);
aspeed_video_enable_mode_detect(video); aspeed_video_enable_mode_detect(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