summaryrefslogtreecommitdiff
path: root/drivers/media/i2c/ks0127.c
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2013-05-29 10:18:56 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-06-17 09:42:40 -0300
commite83c30c723caf5def0eb8eca5b106b39a3dab71c (patch)
tree331168d650de77e8b9cc57f4495dad493bbd43a7 /drivers/media/i2c/ks0127.c
parentddc7f72a3d4049653114647069f8044de5f2499d (diff)
[media] ks0127: fix querystd
Return V4L2_STD_UNKNOWN if no signal is detected. Otherwise AND the standard mask with the detected standards. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/i2c/ks0127.c')
-rw-r--r--drivers/media/i2c/ks0127.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/media/i2c/ks0127.c b/drivers/media/i2c/ks0127.c
index b5223e850a26..c3e94ae82c03 100644
--- a/drivers/media/i2c/ks0127.c
+++ b/drivers/media/i2c/ks0127.c
@@ -609,17 +609,24 @@ static int ks0127_status(struct v4l2_subdev *sd, u32 *pstatus, v4l2_std_id *pstd
{
int stat = V4L2_IN_ST_NO_SIGNAL;
u8 status;
- v4l2_std_id std = V4L2_STD_ALL;
+ v4l2_std_id std = pstd ? *pstd : V4L2_STD_ALL;
status = ks0127_read(sd, KS_STAT);
if (!(status & 0x20)) /* NOVID not set */
stat = 0;
- if (!(status & 0x01)) /* CLOCK set */
+ if (!(status & 0x01)) { /* CLOCK set */
stat |= V4L2_IN_ST_NO_COLOR;
- if ((status & 0x08)) /* PALDET set */
- std = V4L2_STD_PAL;
+ std = V4L2_STD_UNKNOWN;
+ } else {
+ if ((status & 0x08)) /* PALDET set */
+ std &= V4L2_STD_PAL;
+ else
+ std &= V4L2_STD_NTSC;
+ }
+ if ((status & 0x10)) /* PALDET set */
+ std &= V4L2_STD_525_60;
else
- std = V4L2_STD_NTSC;
+ std &= V4L2_STD_625_50;
if (pstd)
*pstd = std;
if (pstatus)