aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ivtv/ivtv-i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/ivtv/ivtv-i2c.c')
-rw-r--r--drivers/media/video/ivtv/ivtv-i2c.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c
index 68170924448c..bf0d35affe0b 100644
--- a/drivers/media/video/ivtv/ivtv-i2c.c
+++ b/drivers/media/video/ivtv/ivtv-i2c.c
@@ -94,6 +94,7 @@
94#define IVTV_HAUP_INT_IR_RX_I2C_ADDR 0x18 94#define IVTV_HAUP_INT_IR_RX_I2C_ADDR 0x18
95#define IVTV_Z8F0811_IR_TX_I2C_ADDR 0x70 95#define IVTV_Z8F0811_IR_TX_I2C_ADDR 0x70
96#define IVTV_Z8F0811_IR_RX_I2C_ADDR 0x71 96#define IVTV_Z8F0811_IR_RX_I2C_ADDR 0x71
97#define IVTV_ADAPTEC_IR_ADDR 0x6b
97 98
98/* This array should match the IVTV_HW_ defines */ 99/* This array should match the IVTV_HW_ defines */
99static const u8 hw_addrs[] = { 100static const u8 hw_addrs[] = {
@@ -118,6 +119,7 @@ static const u8 hw_addrs[] = {
118 IVTV_HAUP_INT_IR_RX_I2C_ADDR, /* IVTV_HW_I2C_IR_RX_HAUP_INT */ 119 IVTV_HAUP_INT_IR_RX_I2C_ADDR, /* IVTV_HW_I2C_IR_RX_HAUP_INT */
119 IVTV_Z8F0811_IR_TX_I2C_ADDR, /* IVTV_HW_Z8F0811_IR_TX_HAUP */ 120 IVTV_Z8F0811_IR_TX_I2C_ADDR, /* IVTV_HW_Z8F0811_IR_TX_HAUP */
120 IVTV_Z8F0811_IR_RX_I2C_ADDR, /* IVTV_HW_Z8F0811_IR_RX_HAUP */ 121 IVTV_Z8F0811_IR_RX_I2C_ADDR, /* IVTV_HW_Z8F0811_IR_RX_HAUP */
122 IVTV_ADAPTEC_IR_ADDR, /* IVTV_HW_I2C_IR_RX_ADAPTEC */
121}; 123};
122 124
123/* This array should match the IVTV_HW_ defines */ 125/* This array should match the IVTV_HW_ defines */
@@ -143,8 +145,34 @@ static const char * const hw_devicenames[] = {
143 "ir_video", /* IVTV_HW_I2C_IR_RX_HAUP_INT */ 145 "ir_video", /* IVTV_HW_I2C_IR_RX_HAUP_INT */
144 "ir_tx_z8f0811_haup", /* IVTV_HW_Z8F0811_IR_TX_HAUP */ 146 "ir_tx_z8f0811_haup", /* IVTV_HW_Z8F0811_IR_TX_HAUP */
145 "ir_rx_z8f0811_haup", /* IVTV_HW_Z8F0811_IR_RX_HAUP */ 147 "ir_rx_z8f0811_haup", /* IVTV_HW_Z8F0811_IR_RX_HAUP */
148 "ir_video", /* IVTV_HW_I2C_IR_RX_ADAPTEC */
146}; 149};
147 150
151static int get_key_adaptec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
152{
153 unsigned char keybuf[4];
154
155 keybuf[0] = 0x00;
156 i2c_master_send(ir->c, keybuf, 1);
157 /* poll IR chip */
158 if (i2c_master_recv(ir->c, keybuf, sizeof(keybuf)) != sizeof(keybuf)) {
159 return 0;
160 }
161
162 /* key pressed ? */
163 if (keybuf[2] == 0xff)
164 return 0;
165
166 /* remove repeat bit */
167 keybuf[2] &= 0x7f;
168 keybuf[3] |= 0x80;
169
170 *ir_key = (u32) keybuf;
171 *ir_raw = (u32) keybuf;
172
173 return 1;
174}
175
148static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr) 176static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr)
149{ 177{
150 struct i2c_board_info info; 178 struct i2c_board_info info;
@@ -190,6 +218,13 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr)
190 init_data->type = RC_TYPE_RC5; 218 init_data->type = RC_TYPE_RC5;
191 init_data->name = itv->card_name; 219 init_data->name = itv->card_name;
192 break; 220 break;
221 case IVTV_HW_I2C_IR_RX_ADAPTEC:
222 init_data->get_key = get_key_adaptec;
223 init_data->name = itv->card_name;
224 /* FIXME: The protocol and RC_MAP needs to be corrected */
225 init_data->ir_codes = RC_MAP_EMPTY;
226 init_data->type = RC_TYPE_UNKNOWN;
227 break;
193 } 228 }
194 229
195 memset(&info, 0, sizeof(struct i2c_board_info)); 230 memset(&info, 0, sizeof(struct i2c_board_info));
@@ -219,7 +254,6 @@ struct i2c_client *ivtv_i2c_new_ir_legacy(struct ivtv *itv)
219 0x1a, /* Hauppauge IR external - collides with WM8739 */ 254 0x1a, /* Hauppauge IR external - collides with WM8739 */
220 0x18, /* Hauppauge IR internal */ 255 0x18, /* Hauppauge IR internal */
221 0x71, /* Hauppauge IR (PVR150) */ 256 0x71, /* Hauppauge IR (PVR150) */
222 0x6b, /* Adaptec IR */
223 I2C_CLIENT_END 257 I2C_CLIENT_END
224 }; 258 };
225 259