diff options
Diffstat (limited to 'drivers/media/video/ivtv/ivtv-i2c.c')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-i2c.c | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c index 665191c9b407..e103b8fc7452 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 */ |
99 | static const u8 hw_addrs[] = { | 100 | static 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 | ||
151 | static 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 = keybuf[3] | keybuf[2] << 8 | keybuf[1] << 16 |keybuf[0] << 24; | ||
171 | *ir_raw = *ir_key; | ||
172 | |||
173 | return 1; | ||
174 | } | ||
175 | |||
148 | static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr) | 176 | static 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; |
@@ -172,7 +200,7 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr) | |||
172 | init_data->ir_codes = RC_MAP_AVERMEDIA_CARDBUS; | 200 | init_data->ir_codes = RC_MAP_AVERMEDIA_CARDBUS; |
173 | init_data->internal_get_key_func = | 201 | init_data->internal_get_key_func = |
174 | IR_KBD_GET_KEY_AVERMEDIA_CARDBUS; | 202 | IR_KBD_GET_KEY_AVERMEDIA_CARDBUS; |
175 | init_data->type = IR_TYPE_OTHER; | 203 | init_data->type = RC_TYPE_OTHER; |
176 | init_data->name = "AVerMedia AVerTV card"; | 204 | init_data->name = "AVerMedia AVerTV card"; |
177 | break; | 205 | break; |
178 | case IVTV_HW_I2C_IR_RX_HAUP_EXT: | 206 | case IVTV_HW_I2C_IR_RX_HAUP_EXT: |
@@ -180,15 +208,22 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr) | |||
180 | /* Default to old black remote */ | 208 | /* Default to old black remote */ |
181 | init_data->ir_codes = RC_MAP_RC5_TV; | 209 | init_data->ir_codes = RC_MAP_RC5_TV; |
182 | init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP; | 210 | init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP; |
183 | init_data->type = IR_TYPE_RC5; | 211 | init_data->type = RC_TYPE_RC5; |
184 | init_data->name = itv->card_name; | 212 | init_data->name = itv->card_name; |
185 | break; | 213 | break; |
186 | case IVTV_HW_Z8F0811_IR_RX_HAUP: | 214 | case IVTV_HW_Z8F0811_IR_RX_HAUP: |
187 | /* Default to grey remote */ | 215 | /* Default to grey remote */ |
188 | init_data->ir_codes = RC_MAP_HAUPPAUGE_NEW; | 216 | init_data->ir_codes = RC_MAP_HAUPPAUGE_NEW; |
189 | init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; | 217 | init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; |
190 | init_data->type = IR_TYPE_RC5; | 218 | init_data->type = RC_TYPE_RC5; |
219 | init_data->name = itv->card_name; | ||
220 | break; | ||
221 | case IVTV_HW_I2C_IR_RX_ADAPTEC: | ||
222 | init_data->get_key = get_key_adaptec; | ||
191 | init_data->name = itv->card_name; | 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; | ||
192 | break; | 227 | break; |
193 | } | 228 | } |
194 | 229 | ||
@@ -218,8 +253,6 @@ struct i2c_client *ivtv_i2c_new_ir_legacy(struct ivtv *itv) | |||
218 | const unsigned short addr_list[] = { | 253 | const unsigned short addr_list[] = { |
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) */ | ||
222 | 0x6b, /* Adaptec IR */ | ||
223 | I2C_CLIENT_END | 256 | I2C_CLIENT_END |
224 | }; | 257 | }; |
225 | 258 | ||