aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pvrusb2
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/pvrusb2')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h2
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-i2c-core.c62
2 files changed, 45 insertions, 19 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
index ac94a8bf883e..305e6aaa844a 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
@@ -40,6 +40,7 @@
40#include "pvrusb2-io.h" 40#include "pvrusb2-io.h"
41#include <media/v4l2-device.h> 41#include <media/v4l2-device.h>
42#include <media/cx2341x.h> 42#include <media/cx2341x.h>
43#include <media/ir-kbd-i2c.h>
43#include "pvrusb2-devattr.h" 44#include "pvrusb2-devattr.h"
44 45
45/* Legal values for PVR2_CID_HSM */ 46/* Legal values for PVR2_CID_HSM */
@@ -202,6 +203,7 @@ struct pvr2_hdw {
202 203
203 /* IR related */ 204 /* IR related */
204 unsigned int ir_scheme_active; /* IR scheme as seen from the outside */ 205 unsigned int ir_scheme_active; /* IR scheme as seen from the outside */
206 struct IR_i2c_init_data ir_init_data; /* params passed to IR modules */
205 207
206 /* Frequency table */ 208 /* Frequency table */
207 unsigned int freqTable[FREQTABLE_SIZE]; 209 unsigned int freqTable[FREQTABLE_SIZE];
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
index 7cbe18c4ca95..ccc884948f34 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
@@ -19,6 +19,7 @@
19 */ 19 */
20 20
21#include <linux/i2c.h> 21#include <linux/i2c.h>
22#include <media/ir-kbd-i2c.h>
22#include "pvrusb2-i2c-core.h" 23#include "pvrusb2-i2c-core.h"
23#include "pvrusb2-hdw-internal.h" 24#include "pvrusb2-hdw-internal.h"
24#include "pvrusb2-debug.h" 25#include "pvrusb2-debug.h"
@@ -48,13 +49,6 @@ module_param_named(disable_autoload_ir_video, pvr2_disable_ir_video,
48MODULE_PARM_DESC(disable_autoload_ir_video, 49MODULE_PARM_DESC(disable_autoload_ir_video,
49 "1=do not try to autoload ir_video IR receiver"); 50 "1=do not try to autoload ir_video IR receiver");
50 51
51/* Mapping of IR schemes to known I2C addresses - if any */
52static const unsigned char ir_video_addresses[] = {
53 [PVR2_IR_SCHEME_ZILOG] = 0x71,
54 [PVR2_IR_SCHEME_29XXX] = 0x18,
55 [PVR2_IR_SCHEME_24XXX] = 0x18,
56};
57
58static int pvr2_i2c_write(struct pvr2_hdw *hdw, /* Context */ 52static int pvr2_i2c_write(struct pvr2_hdw *hdw, /* Context */
59 u8 i2c_addr, /* I2C address we're talking to */ 53 u8 i2c_addr, /* I2C address we're talking to */
60 u8 *data, /* Data to write */ 54 u8 *data, /* Data to write */
@@ -574,26 +568,56 @@ static void do_i2c_scan(struct pvr2_hdw *hdw)
574static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw) 568static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw)
575{ 569{
576 struct i2c_board_info info; 570 struct i2c_board_info info;
577 unsigned char addr = 0; 571 struct IR_i2c_init_data *init_data = &hdw->ir_init_data;
578 if (pvr2_disable_ir_video) { 572 if (pvr2_disable_ir_video) {
579 pvr2_trace(PVR2_TRACE_INFO, 573 pvr2_trace(PVR2_TRACE_INFO,
580 "Automatic binding of ir_video has been disabled."); 574 "Automatic binding of ir_video has been disabled.");
581 return; 575 return;
582 } 576 }
583 if (hdw->ir_scheme_active < ARRAY_SIZE(ir_video_addresses)) { 577 memset(&info, 0, sizeof(struct i2c_board_info));
584 addr = ir_video_addresses[hdw->ir_scheme_active]; 578 switch (hdw->ir_scheme_active) {
585 } 579 case PVR2_IR_SCHEME_24XXX: /* FX2-controlled IR */
586 if (!addr) { 580 case PVR2_IR_SCHEME_29XXX: /* Original 29xxx device */
581 init_data->ir_codes = RC_MAP_HAUPPAUGE_NEW;
582 init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP;
583 init_data->type = RC_TYPE_RC5;
584 init_data->name = hdw->hdw_desc->description;
585 init_data->polling_interval = 100; /* ms From ir-kbd-i2c */
586 /* IR Receiver */
587 info.addr = 0x18;
588 info.platform_data = init_data;
589 strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
590 pvr2_trace(PVR2_TRACE_INFO, "Binding %s to i2c address 0x%02x.",
591 info.type, info.addr);
592 i2c_new_device(&hdw->i2c_adap, &info);
593 break;
594 case PVR2_IR_SCHEME_ZILOG: /* HVR-1950 style */
595 case PVR2_IR_SCHEME_24XXX_MCE: /* 24xxx MCE device */
596 init_data->ir_codes = RC_MAP_HAUPPAUGE_NEW;
597 init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR;
598 init_data->type = RC_TYPE_RC5;
599 init_data->name = hdw->hdw_desc->description;
600 init_data->polling_interval = 260; /* ms From lirc_zilog */
601 /* IR Receiver */
602 info.addr = 0x71;
603 info.platform_data = init_data;
604 strlcpy(info.type, "ir_rx_z8f0811_haup", I2C_NAME_SIZE);
605 pvr2_trace(PVR2_TRACE_INFO, "Binding %s to i2c address 0x%02x.",
606 info.type, info.addr);
607 i2c_new_device(&hdw->i2c_adap, &info);
608 /* IR Trasmitter */
609 info.addr = 0x70;
610 info.platform_data = init_data;
611 strlcpy(info.type, "ir_tx_z8f0811_haup", I2C_NAME_SIZE);
612 pvr2_trace(PVR2_TRACE_INFO, "Binding %s to i2c address 0x%02x.",
613 info.type, info.addr);
614 i2c_new_device(&hdw->i2c_adap, &info);
615 break;
616 default:
587 /* The device either doesn't support I2C-based IR or we 617 /* The device either doesn't support I2C-based IR or we
588 don't know (yet) how to operate IR on the device. */ 618 don't know (yet) how to operate IR on the device. */
589 return; 619 break;
590 } 620 }
591 pvr2_trace(PVR2_TRACE_INFO,
592 "Binding ir_video to i2c address 0x%02x.", addr);
593 memset(&info, 0, sizeof(struct i2c_board_info));
594 strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
595 info.addr = addr;
596 i2c_new_device(&hdw->i2c_adap, &info);
597} 621}
598 622
599void pvr2_i2c_core_init(struct pvr2_hdw *hdw) 623void pvr2_i2c_core_init(struct pvr2_hdw *hdw)