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

[media] saa7191: fix querystd

Return V4L2_STD_UNKNOWN if no signal is detected.
Otherwise AND the standard mask with the detected standards.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent af1f7284
...@@ -271,7 +271,7 @@ static int saa7191_querystd(struct v4l2_subdev *sd, v4l2_std_id *norm) ...@@ -271,7 +271,7 @@ static int saa7191_querystd(struct v4l2_subdev *sd, v4l2_std_id *norm)
dprintk("SAA7191 extended signal auto-detection...\n"); dprintk("SAA7191 extended signal auto-detection...\n");
*norm = V4L2_STD_NTSC | V4L2_STD_PAL | V4L2_STD_SECAM; *norm &= V4L2_STD_NTSC | V4L2_STD_PAL | V4L2_STD_SECAM;
stdc &= ~SAA7191_STDC_SECS; stdc &= ~SAA7191_STDC_SECS;
ctl3 &= ~(SAA7191_CTL3_FSEL); ctl3 &= ~(SAA7191_CTL3_FSEL);
...@@ -302,7 +302,7 @@ static int saa7191_querystd(struct v4l2_subdev *sd, v4l2_std_id *norm) ...@@ -302,7 +302,7 @@ static int saa7191_querystd(struct v4l2_subdev *sd, v4l2_std_id *norm)
if (status & SAA7191_STATUS_FIDT) { if (status & SAA7191_STATUS_FIDT) {
/* 60Hz signal -> NTSC */ /* 60Hz signal -> NTSC */
dprintk("60Hz signal: NTSC\n"); dprintk("60Hz signal: NTSC\n");
*norm = V4L2_STD_NTSC; *norm &= V4L2_STD_NTSC;
return 0; return 0;
} }
...@@ -324,12 +324,13 @@ static int saa7191_querystd(struct v4l2_subdev *sd, v4l2_std_id *norm) ...@@ -324,12 +324,13 @@ static int saa7191_querystd(struct v4l2_subdev *sd, v4l2_std_id *norm)
if (status & SAA7191_STATUS_FIDT) { if (status & SAA7191_STATUS_FIDT) {
dprintk("No 50Hz signal\n"); dprintk("No 50Hz signal\n");
saa7191_s_std(sd, old_norm); saa7191_s_std(sd, old_norm);
return -EAGAIN; *norm = V4L2_STD_UNKNOWN;
return 0;
} }
if (status & SAA7191_STATUS_CODE) { if (status & SAA7191_STATUS_CODE) {
dprintk("PAL\n"); dprintk("PAL\n");
*norm = V4L2_STD_PAL; *norm &= V4L2_STD_PAL;
return saa7191_s_std(sd, old_norm); return saa7191_s_std(sd, old_norm);
} }
...@@ -349,18 +350,19 @@ static int saa7191_querystd(struct v4l2_subdev *sd, v4l2_std_id *norm) ...@@ -349,18 +350,19 @@ static int saa7191_querystd(struct v4l2_subdev *sd, v4l2_std_id *norm)
/* not 50Hz ? */ /* not 50Hz ? */
if (status & SAA7191_STATUS_FIDT) { if (status & SAA7191_STATUS_FIDT) {
dprintk("No 50Hz signal\n"); dprintk("No 50Hz signal\n");
err = -EAGAIN; *norm = V4L2_STD_UNKNOWN;
goto out; goto out;
} }
if (status & SAA7191_STATUS_CODE) { if (status & SAA7191_STATUS_CODE) {
/* Color detected -> SECAM */ /* Color detected -> SECAM */
dprintk("SECAM\n"); dprintk("SECAM\n");
*norm = V4L2_STD_SECAM; *norm &= V4L2_STD_SECAM;
return saa7191_s_std(sd, old_norm); return saa7191_s_std(sd, old_norm);
} }
dprintk("No color detected with SECAM - Going back to PAL.\n"); dprintk("No color detected with SECAM - Going back to PAL.\n");
*norm = V4L2_STD_UNKNOWN;
out: out:
return saa7191_s_std(sd, old_norm); return saa7191_s_std(sd, old_norm);
......
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