aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorAndy Walls <awalls@md.metrocast.net>2010-07-18 18:57:25 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-08-08 22:42:54 -0400
commit5a28d9a320c865007da830c065bcaecfe91b3932 (patch)
tree60ca62e075c8b917165582707f1b0748512a471e /drivers/media
parentd06d5777b211112e8355e2f5a700c6a9babfdd6f (diff)
V4L/DVB: v4l2_subdev, cx23885: Differentiate IR carrier sense and I/O pin inversion
There is a distinction on IR Tx for the CX2388[578] chips of carrier sense inversion (space is a carrier burst and mark is no burst) and I/O pin level inversion (0 is high output level, 1 is low output level). Allow the caller to set these parameters distinctly as v4l2_subdevice IR parameters. This permits the IR device to be configured and enabled without the IR Tx LED being on during idle/space time due to an external hardware level inversion Signed-off-by: Andy Walls <awalls@md.metrocast.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/cx23885/cx23885-input.c2
-rw-r--r--drivers/media/video/cx23885/cx23888-ir.c32
2 files changed, 25 insertions, 9 deletions
diff --git a/drivers/media/video/cx23885/cx23885-input.c b/drivers/media/video/cx23885/cx23885-input.c
index d0b1613ede2f..496d751ffdc8 100644
--- a/drivers/media/video/cx23885/cx23885-input.c
+++ b/drivers/media/video/cx23885/cx23885-input.c
@@ -170,7 +170,7 @@ static int cx23885_input_ir_start(struct cx23885_dev *dev)
170 * mark is received as low logic level; 170 * mark is received as low logic level;
171 * falling edges are detected as rising edges; etc. 171 * falling edges are detected as rising edges; etc.
172 */ 172 */
173 params.invert = true; 173 params.invert_level = true;
174 break; 174 break;
175 } 175 }
176 v4l2_subdev_call(dev->sd_ir, ir, rx_s_parameters, &params); 176 v4l2_subdev_call(dev->sd_ir, ir, rx_s_parameters, &params);
diff --git a/drivers/media/video/cx23885/cx23888-ir.c b/drivers/media/video/cx23885/cx23888-ir.c
index f63d378257a7..28ca90ff223c 100644
--- a/drivers/media/video/cx23885/cx23888-ir.c
+++ b/drivers/media/video/cx23885/cx23888-ir.c
@@ -60,6 +60,8 @@ MODULE_PARM_DESC(ir_888_debug, "enable debug messages [CX23888 IR controller]");
60#define CNTRL_CPL 0x00001000 60#define CNTRL_CPL 0x00001000
61#define CNTRL_LBM 0x00002000 61#define CNTRL_LBM 0x00002000
62#define CNTRL_R 0x00004000 62#define CNTRL_R 0x00004000
63/* CX23888 specific control flag */
64#define CNTRL_IVO 0x00008000
63 65
64#define CX23888_IR_TXCLK_REG 0x170004 66#define CX23888_IR_TXCLK_REG 0x170004
65#define TXCLK_TCD 0x0000FFFF 67#define TXCLK_TCD 0x0000FFFF
@@ -423,6 +425,13 @@ static inline void control_tx_polarity_invert(struct cx23885_dev *dev,
423 invert ? CNTRL_CPL : 0); 425 invert ? CNTRL_CPL : 0);
424} 426}
425 427
428static inline void control_tx_level_invert(struct cx23885_dev *dev,
429 bool invert)
430{
431 cx23888_ir_and_or4(dev, CX23888_IR_CNTRL_REG, ~CNTRL_IVO,
432 invert ? CNTRL_IVO : 0);
433}
434
426/* 435/*
427 * IR Rx & Tx Clock Register helpers 436 * IR Rx & Tx Clock Register helpers
428 */ 437 */
@@ -782,8 +791,8 @@ static int cx23888_ir_rx_s_parameters(struct v4l2_subdev *sd,
782 791
783 control_rx_s_edge_detection(dev, CNTRL_EDG_BOTH); 792 control_rx_s_edge_detection(dev, CNTRL_EDG_BOTH);
784 793
785 o->invert = p->invert; 794 o->invert_level = p->invert_level;
786 atomic_set(&state->rx_invert, p->invert); 795 atomic_set(&state->rx_invert, p->invert_level);
787 796
788 o->interrupt_enable = p->interrupt_enable; 797 o->interrupt_enable = p->interrupt_enable;
789 o->enable = p->enable; 798 o->enable = p->enable;
@@ -894,8 +903,11 @@ static int cx23888_ir_tx_s_parameters(struct v4l2_subdev *sd,
894 /* FIXME - make this dependent on resolution for better performance */ 903 /* FIXME - make this dependent on resolution for better performance */
895 control_tx_irq_watermark(dev, TX_FIFO_HALF_EMPTY); 904 control_tx_irq_watermark(dev, TX_FIFO_HALF_EMPTY);
896 905
897 control_tx_polarity_invert(dev, p->invert); 906 control_tx_polarity_invert(dev, p->invert_carrier_sense);
898 o->invert = p->invert; 907 o->invert_carrier_sense = p->invert_carrier_sense;
908
909 control_tx_level_invert(dev, p->invert_level);
910 o->invert_level = p->invert_level;
899 911
900 o->interrupt_enable = p->interrupt_enable; 912 o->interrupt_enable = p->interrupt_enable;
901 o->enable = p->enable; 913 o->enable = p->enable;
@@ -1025,8 +1037,11 @@ static int cx23888_ir_log_status(struct v4l2_subdev *sd)
1025 cntrl & CNTRL_TFE ? "enabled" : "disabled"); 1037 cntrl & CNTRL_TFE ? "enabled" : "disabled");
1026 v4l2_info(sd, "\tFIFO interrupt watermark: %s\n", 1038 v4l2_info(sd, "\tFIFO interrupt watermark: %s\n",
1027 cntrl & CNTRL_TIC ? "not empty" : "half full or less"); 1039 cntrl & CNTRL_TIC ? "not empty" : "half full or less");
1028 v4l2_info(sd, "\tSignal polarity: %s\n", 1040 v4l2_info(sd, "\tOutput pin level inversion %s\n",
1029 cntrl & CNTRL_CPL ? "0:mark 1:space" : "0:space 1:mark"); 1041 cntrl & CNTRL_IVO ? "yes" : "no");
1042 v4l2_info(sd, "\tCarrier polarity: %s\n",
1043 cntrl & CNTRL_CPL ? "space:burst mark:noburst"
1044 : "space:noburst mark:burst");
1030 if (cntrl & CNTRL_MOD) { 1045 if (cntrl & CNTRL_MOD) {
1031 v4l2_info(sd, "\tCarrier (16 clocks): %u Hz\n", 1046 v4l2_info(sd, "\tCarrier (16 clocks): %u Hz\n",
1032 clock_divider_to_carrier_freq(txclk)); 1047 clock_divider_to_carrier_freq(txclk));
@@ -1146,7 +1161,7 @@ static const struct v4l2_subdev_ir_parameters default_rx_params = {
1146 .noise_filter_min_width = 333333, /* ns */ 1161 .noise_filter_min_width = 333333, /* ns */
1147 .carrier_range_lower = 35000, 1162 .carrier_range_lower = 35000,
1148 .carrier_range_upper = 37000, 1163 .carrier_range_upper = 37000,
1149 .invert = false, 1164 .invert_level = false,
1150}; 1165};
1151 1166
1152static const struct v4l2_subdev_ir_parameters default_tx_params = { 1167static const struct v4l2_subdev_ir_parameters default_tx_params = {
@@ -1160,7 +1175,8 @@ static const struct v4l2_subdev_ir_parameters default_tx_params = {
1160 .modulation = true, 1175 .modulation = true,
1161 .carrier_freq = 36000, /* 36 kHz - RC-5 carrier */ 1176 .carrier_freq = 36000, /* 36 kHz - RC-5 carrier */
1162 .duty_cycle = 25, /* 25 % - RC-5 carrier */ 1177 .duty_cycle = 25, /* 25 % - RC-5 carrier */
1163 .invert = false, 1178 .invert_level = false,
1179 .invert_carrier_sense = false,
1164}; 1180};
1165 1181
1166int cx23888_ir_probe(struct cx23885_dev *dev) 1182int cx23888_ir_probe(struct cx23885_dev *dev)