aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx25840/cx25840-ir.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx25840/cx25840-ir.c')
-rw-r--r--drivers/media/video/cx25840/cx25840-ir.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/media/video/cx25840/cx25840-ir.c b/drivers/media/video/cx25840/cx25840-ir.c
index 326c2554c05c..be23c5b37a2f 100644
--- a/drivers/media/video/cx25840/cx25840-ir.c
+++ b/drivers/media/video/cx25840/cx25840-ir.c
@@ -677,16 +677,18 @@ static int cx25840_ir_rx_read(struct v4l2_subdev *sd, u8 *buf, size_t count,
677 *num = n * sizeof(u32); 677 *num = n * sizeof(u32);
678 678
679 for (p = (u32 *) buf, i = 0; i < n; p++, i++) { 679 for (p = (u32 *) buf, i = 0; i < n; p++, i++) {
680
680 if ((*p & FIFO_RXTX_RTO) == FIFO_RXTX_RTO) { 681 if ((*p & FIFO_RXTX_RTO) == FIFO_RXTX_RTO) {
681 *p = V4L2_SUBDEV_IR_PULSE_RX_SEQ_END; 682 /* Assume RTO was because of no IR light input */
683 u = 0;
682 v4l2_dbg(2, ir_debug, sd, "rx read: end of rx\n"); 684 v4l2_dbg(2, ir_debug, sd, "rx read: end of rx\n");
683 continue; 685 } else {
686 u = (*p & FIFO_RXTX_LVL)
687 ? V4L2_SUBDEV_IR_PULSE_LEVEL_MASK : 0;
688 if (invert)
689 u = u ? 0 : V4L2_SUBDEV_IR_PULSE_LEVEL_MASK;
684 } 690 }
685 691
686 u = (*p & FIFO_RXTX_LVL) ? V4L2_SUBDEV_IR_PULSE_LEVEL_MASK : 0;
687 if (invert)
688 u = u ? 0 : V4L2_SUBDEV_IR_PULSE_LEVEL_MASK;
689
690 v = (u32) pulse_width_count_to_ns((u16) (*p & FIFO_RXTX), 692 v = (u32) pulse_width_count_to_ns((u16) (*p & FIFO_RXTX),
691 divider); 693 divider);
692 if (v >= V4L2_SUBDEV_IR_PULSE_MAX_WIDTH_NS) 694 if (v >= V4L2_SUBDEV_IR_PULSE_MAX_WIDTH_NS)