aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/cx18/cx18-cards.h3
-rw-r--r--drivers/media/video/cx18/cx18-driver.h3
-rw-r--r--drivers/media/video/cx18/cx18-i2c.c25
3 files changed, 16 insertions, 15 deletions
diff --git a/drivers/media/video/cx18/cx18-cards.h b/drivers/media/video/cx18/cx18-cards.h
index 444e3c7c563..af3d71607dc 100644
--- a/drivers/media/video/cx18/cx18-cards.h
+++ b/drivers/media/video/cx18/cx18-cards.h
@@ -34,6 +34,9 @@
34#define CX18_HW_Z8F0811_IR_HAUP (CX18_HW_Z8F0811_IR_RX_HAUP | \ 34#define CX18_HW_Z8F0811_IR_HAUP (CX18_HW_Z8F0811_IR_RX_HAUP | \
35 CX18_HW_Z8F0811_IR_TX_HAUP) 35 CX18_HW_Z8F0811_IR_TX_HAUP)
36 36
37#define CX18_HW_IR_ANY (CX18_HW_Z8F0811_IR_RX_HAUP | \
38 CX18_HW_Z8F0811_IR_TX_HAUP)
39
37/* video inputs */ 40/* video inputs */
38#define CX18_CARD_INPUT_VID_TUNER 1 41#define CX18_CARD_INPUT_VID_TUNER 1
39#define CX18_CARD_INPUT_SVIDEO1 2 42#define CX18_CARD_INPUT_SVIDEO1 2
diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h
index fe767b82c9a..e3f7911a738 100644
--- a/drivers/media/video/cx18/cx18-driver.h
+++ b/drivers/media/video/cx18/cx18-driver.h
@@ -50,6 +50,7 @@
50#include <media/v4l2-ioctl.h> 50#include <media/v4l2-ioctl.h>
51#include <media/v4l2-device.h> 51#include <media/v4l2-device.h>
52#include <media/tuner.h> 52#include <media/tuner.h>
53#include <media/ir-kbd-i2c.h>
53#include "cx18-mailbox.h" 54#include "cx18-mailbox.h"
54#include "cx18-av-core.h" 55#include "cx18-av-core.h"
55#include "cx23418.h" 56#include "cx23418.h"
@@ -606,6 +607,8 @@ struct cx18 {
606 struct i2c_algo_bit_data i2c_algo[2]; 607 struct i2c_algo_bit_data i2c_algo[2];
607 struct cx18_i2c_algo_callback_data i2c_algo_cb_data[2]; 608 struct cx18_i2c_algo_callback_data i2c_algo_cb_data[2];
608 609
610 struct IR_i2c_init_data ir_i2c_init_data;
611
609 /* gpio */ 612 /* gpio */
610 u32 gpio_dir; 613 u32 gpio_dir;
611 u32 gpio_val; 614 u32 gpio_val;
diff --git a/drivers/media/video/cx18/cx18-i2c.c b/drivers/media/video/cx18/cx18-i2c.c
index 2477461e84d..eecf29af916 100644
--- a/drivers/media/video/cx18/cx18-i2c.c
+++ b/drivers/media/video/cx18/cx18-i2c.c
@@ -28,7 +28,6 @@
28#include "cx18-gpio.h" 28#include "cx18-gpio.h"
29#include "cx18-i2c.h" 29#include "cx18-i2c.h"
30#include "cx18-irq.h" 30#include "cx18-irq.h"
31#include <media/ir-kbd-i2c.h>
32 31
33#define CX18_REG_I2C_1_WR 0xf15000 32#define CX18_REG_I2C_1_WR 0xf15000
34#define CX18_REG_I2C_1_RD 0xf15008 33#define CX18_REG_I2C_1_RD 0xf15008
@@ -97,17 +96,11 @@ static const char * const hw_devicenames[] = {
97 "ir_rx_z8f0811_haup", 96 "ir_rx_z8f0811_haup",
98}; 97};
99 98
100static const struct IR_i2c_init_data z8f0811_ir_init_data = { 99static int cx18_i2c_new_ir(struct cx18 *cx, struct i2c_adapter *adap, u32 hw,
101 .ir_codes = &ir_codes_hauppauge_new_table, 100 const char *type, u8 addr)
102 .internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR,
103 .type = IR_TYPE_RC5,
104 .name = "CX23418 Z8F0811 Hauppauge",
105};
106
107static int cx18_i2c_new_ir(struct i2c_adapter *adap, u32 hw, const char *type,
108 u8 addr)
109{ 101{
110 struct i2c_board_info info; 102 struct i2c_board_info info;
103 struct IR_i2c_init_data *init_data = &cx->ir_i2c_init_data;
111 unsigned short addr_list[2] = { addr, I2C_CLIENT_END }; 104 unsigned short addr_list[2] = { addr, I2C_CLIENT_END };
112 105
113 memset(&info, 0, sizeof(struct i2c_board_info)); 106 memset(&info, 0, sizeof(struct i2c_board_info));
@@ -116,9 +109,11 @@ static int cx18_i2c_new_ir(struct i2c_adapter *adap, u32 hw, const char *type,
116 /* Our default information for ir-kbd-i2c.c to use */ 109 /* Our default information for ir-kbd-i2c.c to use */
117 switch (hw) { 110 switch (hw) {
118 case CX18_HW_Z8F0811_IR_RX_HAUP: 111 case CX18_HW_Z8F0811_IR_RX_HAUP:
119 info.platform_data = (void *) &z8f0811_ir_init_data; 112 init_data->ir_codes = &ir_codes_hauppauge_new_table;
120 break; 113 init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR;
121 default: 114 init_data->type = IR_TYPE_RC5;
115 init_data->name = cx->card_name;
116 info.platform_data = init_data;
122 break; 117 break;
123 } 118 }
124 119
@@ -154,8 +149,8 @@ int cx18_i2c_register(struct cx18 *cx, unsigned idx)
154 return sd != NULL ? 0 : -1; 149 return sd != NULL ? 0 : -1;
155 } 150 }
156 151
157 if (hw & CX18_HW_Z8F0811_IR_HAUP) 152 if (hw & CX18_HW_IR_ANY)
158 return cx18_i2c_new_ir(adap, hw, type, hw_addrs[idx]); 153 return cx18_i2c_new_ir(cx, adap, hw, type, hw_addrs[idx]);
159 154
160 /* Is it not an I2C device or one we do not wish to register? */ 155 /* Is it not an I2C device or one we do not wish to register? */
161 if (!hw_addrs[idx]) 156 if (!hw_addrs[idx])