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

[media] tvp514x: 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>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
55852cbb ec276a5a

+7 -5
+7 -5
drivers/media/i2c/tvp514x.c
··· 542 542 if (std_id == NULL) 543 543 return -EINVAL; 544 544 545 - *std_id = V4L2_STD_UNKNOWN; 546 - 547 545 /* To query the standard the TVP514x must power on the ADCs. */ 548 546 if (!decoder->streaming) { 549 547 tvp514x_s_stream(sd, 1); ··· 550 552 551 553 /* query the current standard */ 552 554 current_std = tvp514x_query_current_std(sd); 553 - if (current_std == STD_INVALID) 555 + if (current_std == STD_INVALID) { 556 + *std_id = V4L2_STD_UNKNOWN; 554 557 return 0; 558 + } 555 559 556 560 input_sel = decoder->input; 557 561 ··· 594 594 } 595 595 /* check whether signal is locked */ 596 596 sync_lock_status = tvp514x_read_reg(sd, REG_STATUS1); 597 - if (lock_mask != (sync_lock_status & lock_mask)) 597 + if (lock_mask != (sync_lock_status & lock_mask)) { 598 + *std_id = V4L2_STD_UNKNOWN; 598 599 return 0; /* No input detected */ 600 + } 599 601 600 - *std_id = decoder->std_list[current_std].standard.id; 602 + *std_id &= decoder->std_list[current_std].standard.id; 601 603 602 604 v4l2_dbg(1, debug, sd, "Current STD: %s\n", 603 605 decoder->std_list[current_std].standard.name);