Commit b01052ab authored by Devin Heitmueller's avatar Devin Heitmueller Committed by Mauro Carvalho Chehab

[media] au8522: fix lock detection to be more reliable

Only looking at the lock register causes the status to float
between locked and not locked when there is no signal.  So improve
the logic to also examine the state of the FSC PLL, which results
in the lock status being consistently reported.
Signed-off-by: default avatarDevin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 6211d28e
...@@ -623,10 +623,12 @@ static int au8522_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) ...@@ -623,10 +623,12 @@ static int au8522_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
int val = 0; int val = 0;
struct au8522_state *state = to_state(sd); struct au8522_state *state = to_state(sd);
u8 lock_status; u8 lock_status;
u8 pll_status;
/* Interrogate the decoder to see if we are getting a real signal */ /* Interrogate the decoder to see if we are getting a real signal */
lock_status = au8522_readreg(state, 0x00); lock_status = au8522_readreg(state, 0x00);
if (lock_status == 0xa2) pll_status = au8522_readreg(state, 0x7e);
if ((lock_status == 0xa2) && (pll_status & 0x10))
vt->signal = 0xffff; vt->signal = 0xffff;
else else
vt->signal = 0x00; vt->signal = 0x00;
......
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