Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
e83c30c7 ddc7f72a

+12 -5
+12 -5
drivers/media/i2c/ks0127.c
··· 609 609 { 610 610 int stat = V4L2_IN_ST_NO_SIGNAL; 611 611 u8 status; 612 - v4l2_std_id std = V4L2_STD_ALL; 612 + v4l2_std_id std = pstd ? *pstd : V4L2_STD_ALL; 613 613 614 614 status = ks0127_read(sd, KS_STAT); 615 615 if (!(status & 0x20)) /* NOVID not set */ 616 616 stat = 0; 617 - if (!(status & 0x01)) /* CLOCK set */ 617 + if (!(status & 0x01)) { /* CLOCK set */ 618 618 stat |= V4L2_IN_ST_NO_COLOR; 619 - if ((status & 0x08)) /* PALDET set */ 620 - std = V4L2_STD_PAL; 619 + std = V4L2_STD_UNKNOWN; 620 + } else { 621 + if ((status & 0x08)) /* PALDET set */ 622 + std &= V4L2_STD_PAL; 623 + else 624 + std &= V4L2_STD_NTSC; 625 + } 626 + if ((status & 0x10)) /* PALDET set */ 627 + std &= V4L2_STD_525_60; 621 628 else 622 - std = V4L2_STD_NTSC; 629 + std &= V4L2_STD_625_50; 623 630 if (pstd) 624 631 *pstd = std; 625 632 if (pstatus)