V4L/DVB: cx23885, cx25840: Report IR max pulse width regardless of mod/demod use
authorAndy Walls <awalls@md.metrocast.net>
Sun, 1 Aug 2010 00:57:42 +0000 (21:57 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 9 Aug 2010 02:42:56 +0000 (23:42 -0300)
Compute and report the maximum IR pulse measurment width, even
if we are set to perform carrier modulation or demodulation and
the number is fixed by the carrier freq.

Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/cx23885/cx23888-ir.c
drivers/media/video/cx25840/cx25840-ir.c

index 51f21636e639330bcf528568c0f08c7a4a674f42..aa07286b8d9ba18a7bc84f32a88f88993b5c59f5 100644 (file)
@@ -771,12 +771,15 @@ static int cx23888_ir_rx_s_parameters(struct v4l2_subdev *sd,
                                            &p->carrier_range_upper);
                o->carrier_range_lower = p->carrier_range_lower;
                o->carrier_range_upper = p->carrier_range_upper;
+
+               p->max_pulse_width =
+                       (u32) pulse_width_count_to_ns(FIFO_RXTX, rxclk_divider);
        } else {
                p->max_pulse_width =
                            rxclk_rx_s_max_pulse_width(dev, p->max_pulse_width,
                                                       &rxclk_divider);
-               o->max_pulse_width = p->max_pulse_width;
        }
+       o->max_pulse_width = p->max_pulse_width;
        atomic_set(&state->rxclk_divider, rxclk_divider);
 
        p->noise_filter_min_width =
@@ -889,12 +892,15 @@ static int cx23888_ir_tx_s_parameters(struct v4l2_subdev *sd,
 
                p->duty_cycle = cduty_tx_s_duty_cycle(dev, p->duty_cycle);
                o->duty_cycle = p->duty_cycle;
+
+               p->max_pulse_width =
+                       (u32) pulse_width_count_to_ns(FIFO_RXTX, txclk_divider);
        } else {
                p->max_pulse_width =
                            txclk_tx_s_max_pulse_width(dev, p->max_pulse_width,
                                                       &txclk_divider);
-               o->max_pulse_width = p->max_pulse_width;
        }
+       o->max_pulse_width = p->max_pulse_width;
        atomic_set(&state->txclk_divider, txclk_divider);
 
        p->resolution = clock_divider_to_resolution(txclk_divider);
@@ -1000,12 +1006,10 @@ static int cx23888_ir_log_status(struct v4l2_subdev *sd)
                          "-%1d/+%1d, %u to %u Hz\n", i, j,
                          clock_divider_to_freq(rxclk, 16 + j),
                          clock_divider_to_freq(rxclk, 16 - i));
-       } else {
-               v4l2_info(sd, "\tMax measurable pulse width:        %u us, "
-                         "%llu ns\n",
-                         pulse_width_count_to_us(FIFO_RXTX, rxclk),
-                         pulse_width_count_to_ns(FIFO_RXTX, rxclk));
        }
+       v4l2_info(sd, "\tMax measurable pulse width:        %u us, %llu ns\n",
+                 pulse_width_count_to_us(FIFO_RXTX, rxclk),
+                 pulse_width_count_to_ns(FIFO_RXTX, rxclk));
        v4l2_info(sd, "\tLow pass filter:                   %s\n",
                  filtr ? "enabled" : "disabled");
        if (filtr)
@@ -1047,12 +1051,10 @@ static int cx23888_ir_log_status(struct v4l2_subdev *sd)
                          clock_divider_to_carrier_freq(txclk));
                v4l2_info(sd, "\tCarrier duty cycle:                %2u/16\n",
                          cduty + 1);
-       } else {
-               v4l2_info(sd, "\tMax pulse width:                   %u us, "
-                         "%llu ns\n",
-                         pulse_width_count_to_us(FIFO_RXTX, txclk),
-                         pulse_width_count_to_ns(FIFO_RXTX, txclk));
        }
+       v4l2_info(sd, "\tMax pulse width:                   %u us, %llu ns\n",
+                 pulse_width_count_to_us(FIFO_RXTX, txclk),
+                 pulse_width_count_to_ns(FIFO_RXTX, txclk));
        v4l2_info(sd, "\tBusy:                              %s\n",
                  stats & STATS_TBY ? "yes" : "no");
        v4l2_info(sd, "\tFIFO service requested:            %s\n",
index 308e87e9fae7247fe65b4e79f6fd28700234c580..326c2554c05c5a46d1d202c3528ce9d7eab6a826 100644 (file)
@@ -791,12 +791,15 @@ static int cx25840_ir_rx_s_parameters(struct v4l2_subdev *sd,
                                            &p->carrier_range_upper);
                o->carrier_range_lower = p->carrier_range_lower;
                o->carrier_range_upper = p->carrier_range_upper;
+
+               p->max_pulse_width =
+                       (u32) pulse_width_count_to_ns(FIFO_RXTX, rxclk_divider);
        } else {
                p->max_pulse_width =
                            rxclk_rx_s_max_pulse_width(c, p->max_pulse_width,
                                                       &rxclk_divider);
-               o->max_pulse_width = p->max_pulse_width;
        }
+       o->max_pulse_width = p->max_pulse_width;
        atomic_set(&ir_state->rxclk_divider, rxclk_divider);
 
        p->noise_filter_min_width =
@@ -970,12 +973,15 @@ static int cx25840_ir_tx_s_parameters(struct v4l2_subdev *sd,
 
                p->duty_cycle = cduty_tx_s_duty_cycle(c, p->duty_cycle);
                o->duty_cycle = p->duty_cycle;
+
+               p->max_pulse_width =
+                       (u32) pulse_width_count_to_ns(FIFO_RXTX, txclk_divider);
        } else {
                p->max_pulse_width =
                            txclk_tx_s_max_pulse_width(c, p->max_pulse_width,
                                                       &txclk_divider);
-               o->max_pulse_width = p->max_pulse_width;
        }
+       o->max_pulse_width = p->max_pulse_width;
        atomic_set(&ir_state->txclk_divider, txclk_divider);
 
        p->resolution = clock_divider_to_resolution(txclk_divider);
@@ -1094,12 +1100,10 @@ int cx25840_ir_log_status(struct v4l2_subdev *sd)
                          "-%1d/+%1d, %u to %u Hz\n", i, j,
                          clock_divider_to_freq(rxclk, 16 + j),
                          clock_divider_to_freq(rxclk, 16 - i));
-       } else {
-               v4l2_info(sd, "\tMax measurable pulse width:        %u us, "
-                         "%llu ns\n",
-                         pulse_width_count_to_us(FIFO_RXTX, rxclk),
-                         pulse_width_count_to_ns(FIFO_RXTX, rxclk));
        }
+       v4l2_info(sd, "\tMax measurable pulse width:        %u us, %llu ns\n",
+                 pulse_width_count_to_us(FIFO_RXTX, rxclk),
+                 pulse_width_count_to_ns(FIFO_RXTX, rxclk));
        v4l2_info(sd, "\tLow pass filter:                   %s\n",
                  filtr ? "enabled" : "disabled");
        if (filtr)
@@ -1139,12 +1143,10 @@ int cx25840_ir_log_status(struct v4l2_subdev *sd)
                          clock_divider_to_carrier_freq(txclk));
                v4l2_info(sd, "\tCarrier duty cycle:                %2u/16\n",
                          cduty + 1);
-       } else {
-               v4l2_info(sd, "\tMax pulse width:                   %u us, "
-                         "%llu ns\n",
-                         pulse_width_count_to_us(FIFO_RXTX, txclk),
-                         pulse_width_count_to_ns(FIFO_RXTX, txclk));
        }
+       v4l2_info(sd, "\tMax pulse width:                   %u us, %llu ns\n",
+                 pulse_width_count_to_us(FIFO_RXTX, txclk),
+                 pulse_width_count_to_ns(FIFO_RXTX, txclk));
        v4l2_info(sd, "\tBusy:                              %s\n",
                  stats & STATS_TBY ? "yes" : "no");
        v4l2_info(sd, "\tFIFO service requested:            %s\n",