aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2009-04-06 00:51:38 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-06-16 17:20:59 -0400
commit27eab3840baaee469eb6377607520ca2128b66f7 (patch)
tree775915613da853314d7302d5218b7b72882b44be /drivers/media
parent06e61f8d5f5df68104168ac20d0527ecee13638a (diff)
V4L/DVB (11744): pvrusb2: Select, track, and report IR scheme in use with the device
This change defines all possible "IR schemes" related to the pvrusb2 driver, on a per-device basis. That information is then set according to the hardware in use. The idea here is to make possible a more intelligent future decision on which, if any, IR receiver driver might be loaded during initialization. Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-devattr.c1
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-devattr.h22
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h3
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c18
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-i2c-core.c12
5 files changed, 38 insertions, 18 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-devattr.c b/drivers/media/video/pvrusb2/pvrusb2-devattr.c
index 76d42d92e603..a0688c005b84 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-devattr.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-devattr.c
@@ -71,6 +71,7 @@ static const struct pvr2_device_desc pvr2_device_29xxx = {
71 .flag_has_svideo = !0, 71 .flag_has_svideo = !0,
72 .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE, 72 .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
73 .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE, 73 .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
74 .ir_scheme = PVR2_IR_SCHEME_29XXX,
74}; 75};
75 76
76 77
diff --git a/drivers/media/video/pvrusb2/pvrusb2-devattr.h b/drivers/media/video/pvrusb2/pvrusb2-devattr.h
index 3e553389cbc3..73e0e0ba0044 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-devattr.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-devattr.h
@@ -78,8 +78,10 @@ struct pvr2_string_table {
78#define PVR2_LED_SCHEME_HAUPPAUGE 1 78#define PVR2_LED_SCHEME_HAUPPAUGE 1
79 79
80#define PVR2_IR_SCHEME_NONE 0 80#define PVR2_IR_SCHEME_NONE 0
81#define PVR2_IR_SCHEME_24XXX 1 81#define PVR2_IR_SCHEME_24XXX 1 /* FX2-controlled IR */
82#define PVR2_IR_SCHEME_ZILOG 2 82#define PVR2_IR_SCHEME_ZILOG 2 /* HVR-1950 style (must be taken out of reset) */
83#define PVR2_IR_SCHEME_24XXX_MCE 3 /* 24xxx MCE device */
84#define PVR2_IR_SCHEME_29XXX 4 /* Original 29xxx device */
83 85
84/* This describes a particular hardware type (except for the USB device ID 86/* This describes a particular hardware type (except for the USB device ID
85 which must live in a separate structure due to environmental 87 which must live in a separate structure due to environmental
@@ -162,19 +164,9 @@ struct pvr2_device_desc {
162 ensure that it is found. */ 164 ensure that it is found. */
163 unsigned int flag_has_wm8775:1; 165 unsigned int flag_has_wm8775:1;
164 166
165 /* Indicate any specialized IR scheme that might need to be 167 /* Indicate IR scheme of hardware. If not set, then it is assumed
166 supported by this driver. If not set, then it is assumed that 168 that IR can work without any help from the driver. */
167 IR can work without help from the driver (which is frequently 169 unsigned int ir_scheme:3;
168 the case). This is otherwise set to one of
169 PVR2_IR_SCHEME_xxxx. For "xxxx", the value "24XXX" indicates a
170 Hauppauge 24xxx class device which has an FPGA-hosted IR
171 receiver that can only be reached via FX2 command codes. In
172 that case the pvrusb2 driver will emulate the behavior of the
173 older 29xxx device's IR receiver (a "virtual" I2C chip) in terms
174 of those command codes. For the value "ZILOG", we're dealing
175 with an IR chip that must be taken out of reset via another FX2
176 command code (which is the case for HVR-1950 devices). */
177 unsigned int ir_scheme:2;
178 170
179 /* These bits define which kinds of sources the device can handle. 171 /* These bits define which kinds of sources the device can handle.
180 Note: Digital tuner presence is inferred by the 172 Note: Digital tuner presence is inferred by the
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
index 5d75eb5211b1..5b152ff20bd0 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
@@ -200,6 +200,9 @@ struct pvr2_hdw {
200 int i2c_cx25840_hack_state; 200 int i2c_cx25840_hack_state;
201 int i2c_linked; 201 int i2c_linked;
202 202
203 /* IR related */
204 unsigned int ir_scheme_active; /* IR scheme as seen from the outside */
205
203 /* Frequency table */ 206 /* Frequency table */
204 unsigned int freqTable[FREQTABLE_SIZE]; 207 unsigned int freqTable[FREQTABLE_SIZE];
205 unsigned int freqProgSlot; 208 unsigned int freqProgSlot;
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index add3395d3248..686df1afbbaf 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -142,6 +142,15 @@ static const unsigned char *module_i2c_addresses[] = {
142}; 142};
143 143
144 144
145static const char *ir_scheme_names[] = {
146 [PVR2_IR_SCHEME_NONE] = "none",
147 [PVR2_IR_SCHEME_29XXX] = "29xxx",
148 [PVR2_IR_SCHEME_24XXX] = "24xxx (29xxx emulation)",
149 [PVR2_IR_SCHEME_24XXX_MCE] = "24xxx (MCE device)",
150 [PVR2_IR_SCHEME_ZILOG] = "Zilog",
151};
152
153
145/* Define the list of additional controls we'll dynamically construct based 154/* Define the list of additional controls we'll dynamically construct based
146 on query of the cx2341x module. */ 155 on query of the cx2341x module. */
147struct pvr2_mpeg_ids { 156struct pvr2_mpeg_ids {
@@ -2170,7 +2179,7 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw)
2170 } 2179 }
2171 2180
2172 /* Take the IR chip out of reset, if appropriate */ 2181 /* Take the IR chip out of reset, if appropriate */
2173 if (hdw->hdw_desc->ir_scheme == PVR2_IR_SCHEME_ZILOG) { 2182 if (hdw->ir_scheme_active == PVR2_IR_SCHEME_ZILOG) {
2174 pvr2_issue_simple_cmd(hdw, 2183 pvr2_issue_simple_cmd(hdw,
2175 FX2CMD_HCW_ZILOG_RESET | 2184 FX2CMD_HCW_ZILOG_RESET |
2176 (1 << 8) | 2185 (1 << 8) |
@@ -2451,6 +2460,7 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
2451 GFP_KERNEL); 2460 GFP_KERNEL);
2452 if (!hdw->controls) goto fail; 2461 if (!hdw->controls) goto fail;
2453 hdw->hdw_desc = hdw_desc; 2462 hdw->hdw_desc = hdw_desc;
2463 hdw->ir_scheme_active = hdw->hdw_desc->ir_scheme;
2454 for (idx = 0; idx < hdw->control_cnt; idx++) { 2464 for (idx = 0; idx < hdw->control_cnt; idx++) {
2455 cptr = hdw->controls + idx; 2465 cptr = hdw->controls + idx;
2456 cptr->hdw = hdw; 2466 cptr->hdw = hdw;
@@ -4809,6 +4819,12 @@ static unsigned int pvr2_hdw_report_unlocked(struct pvr2_hdw *hdw,int which,
4809 stats.buffers_processed, 4819 stats.buffers_processed,
4810 stats.buffers_failed); 4820 stats.buffers_failed);
4811 } 4821 }
4822 case 6: {
4823 unsigned int id = hdw->ir_scheme_active;
4824 return scnprintf(buf, acnt, "ir scheme: id=%d %s", id,
4825 (id >= ARRAY_SIZE(ir_scheme_names) ?
4826 "?" : ir_scheme_names[id]));
4827 }
4812 default: break; 4828 default: break;
4813 } 4829 }
4814 return 0; 4830 return 0;
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
index 9af282f9e765..838d01c9d02e 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
@@ -574,7 +574,9 @@ void pvr2_i2c_core_init(struct pvr2_hdw *hdw)
574 printk(KERN_INFO "%s: IR disabled\n",hdw->name); 574 printk(KERN_INFO "%s: IR disabled\n",hdw->name);
575 hdw->i2c_func[0x18] = i2c_black_hole; 575 hdw->i2c_func[0x18] = i2c_black_hole;
576 } else if (ir_mode[hdw->unit_number] == 1) { 576 } else if (ir_mode[hdw->unit_number] == 1) {
577 if (hdw->hdw_desc->ir_scheme == PVR2_IR_SCHEME_24XXX) { 577 if (hdw->ir_scheme_active == PVR2_IR_SCHEME_24XXX) {
578 /* Set up translation so that our IR looks like a
579 29xxx device */
578 hdw->i2c_func[0x18] = i2c_24xxx_ir; 580 hdw->i2c_func[0x18] = i2c_24xxx_ir;
579 } 581 }
580 } 582 }
@@ -597,12 +599,18 @@ void pvr2_i2c_core_init(struct pvr2_hdw *hdw)
597 i2c_add_adapter(&hdw->i2c_adap); 599 i2c_add_adapter(&hdw->i2c_adap);
598 if (hdw->i2c_func[0x18] == i2c_24xxx_ir) { 600 if (hdw->i2c_func[0x18] == i2c_24xxx_ir) {
599 /* Probe for a different type of IR receiver on this 601 /* Probe for a different type of IR receiver on this
600 device. If present, disable the emulated IR receiver. */ 602 device. This is really the only way to differentiate
603 older 24xxx devices from 24xxx variants that include an
604 IR blaster. If the IR blaster is present, the IR
605 receiver is part of that chip and thus we must disable
606 the emulated IR receiver. */
601 if (do_i2c_probe(hdw, 0x71)) { 607 if (do_i2c_probe(hdw, 0x71)) {
602 pvr2_trace(PVR2_TRACE_INFO, 608 pvr2_trace(PVR2_TRACE_INFO,
603 "Device has newer IR hardware;" 609 "Device has newer IR hardware;"
604 " disabling unneeded virtual IR device"); 610 " disabling unneeded virtual IR device");
605 hdw->i2c_func[0x18] = NULL; 611 hdw->i2c_func[0x18] = NULL;
612 /* Remember that this is a different device... */
613 hdw->ir_scheme_active = PVR2_IR_SCHEME_24XXX_MCE;
606 } 614 }
607 } 615 }
608 if (i2c_scan) do_i2c_scan(hdw); 616 if (i2c_scan) do_i2c_scan(hdw);