diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-12-30 06:31:10 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-12-30 09:17:08 -0500 |
commit | e1e2c57565635310209566a31a300e593f74cc22 (patch) | |
tree | 6f809071e409f32c3c659066d8390590788ad78d /drivers | |
parent | 1c0eb0ffb0d541bf05a4b422a629fa5986799313 (diff) |
[media] ivtv: Add Adaptec Remote Controller
lirc-i2c implements a get key logic for the Adaptec Remote
Controller, at address 0x6b. The only driver that seems to have
an Adaptec device is ivtv:
$ git grep -i adaptec drivers/media
drivers/media/video/cs53l32a.c: * cs53l32a (Adaptec AVC-2010 and AVC-2410) i2c ivtv driver.
drivers/media/video/cs53l32a.c: * Audio source switching for Adaptec AVC-2410 added by Trev Jackson
drivers/media/video/cs53l32a.c: /* Set cs53l32a internal register for Adaptec 2010/2410 setup */
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2410 card */
drivers/media/video/ivtv/ivtv-cards.c: { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0093 },
drivers/media/video/ivtv/ivtv-cards.c: .name = "Adaptec VideOh! AVC-2410",
drivers/media/video/ivtv/ivtv-cards.c:/* Adaptec VideOh! AVC-2010 card */
drivers/media/video/ivtv/ivtv-cards.c: { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_ADAPTEC, 0x0092 },
drivers/media/video/ivtv/ivtv-cards.c: .name = "Adaptec VideOh! AVC-2010",
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2410 7 /* Adaptec AVC-2410 */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_CARD_AVC2010 8 /* Adaptec AVD-2010 (No Tuner) */
drivers/media/video/ivtv/ivtv-cards.h:#define IVTV_PCI_ID_ADAPTEC 0x9005
drivers/media/video/ivtv/ivtv-driver.c: "\t\t\t 8 = Adaptec AVC-2410\n"
drivers/media/video/ivtv/ivtv-driver.c: "\t\t\t 9 = Adaptec AVC-2010\n"
drivers/media/video/ivtv/ivtv-i2c.c: 0x6b, /* Adaptec IR */
There are two Adaptec cards defined there, but AVC-2010 doesn't have a
remote controller. So, the logic at lirc_i2c seems to be for Adaptec AVC-2410.
As we'll remove lirc_i2c from kernel, move the getkey code to ivtv driver, and
use it for AVC-2410.
Reviewed-by: Andy Walls <awalls@md.metrocast.net>
Acked-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-cards.c | 3 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-cards.h | 4 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-i2c.c | 36 |
3 files changed, 40 insertions, 3 deletions
diff --git a/drivers/media/video/ivtv/ivtv-cards.c b/drivers/media/video/ivtv/ivtv-cards.c index b6f2a2b42283..145e4749a69d 100644 --- a/drivers/media/video/ivtv/ivtv-cards.c +++ b/drivers/media/video/ivtv/ivtv-cards.c | |||
@@ -405,7 +405,8 @@ static const struct ivtv_card ivtv_card_avc2410 = { | |||
405 | .hw_audio_ctrl = IVTV_HW_MSP34XX, | 405 | .hw_audio_ctrl = IVTV_HW_MSP34XX, |
406 | .hw_muxer = IVTV_HW_CS53L32A, | 406 | .hw_muxer = IVTV_HW_CS53L32A, |
407 | .hw_all = IVTV_HW_MSP34XX | IVTV_HW_CS53L32A | | 407 | .hw_all = IVTV_HW_MSP34XX | IVTV_HW_CS53L32A | |
408 | IVTV_HW_SAA7115 | IVTV_HW_TUNER, | 408 | IVTV_HW_SAA7115 | IVTV_HW_TUNER | |
409 | IVTV_HW_I2C_IR_RX_ADAPTEC, | ||
409 | .video_inputs = { | 410 | .video_inputs = { |
410 | { IVTV_CARD_INPUT_VID_TUNER, 0, IVTV_SAA71XX_COMPOSITE4 }, | 411 | { IVTV_CARD_INPUT_VID_TUNER, 0, IVTV_SAA71XX_COMPOSITE4 }, |
411 | { IVTV_CARD_INPUT_SVIDEO1, 1, IVTV_SAA71XX_SVIDEO0 }, | 412 | { IVTV_CARD_INPUT_SVIDEO1, 1, IVTV_SAA71XX_SVIDEO0 }, |
diff --git a/drivers/media/video/ivtv/ivtv-cards.h b/drivers/media/video/ivtv/ivtv-cards.h index 78eca992e1fd..e6f5c02981f1 100644 --- a/drivers/media/video/ivtv/ivtv-cards.h +++ b/drivers/media/video/ivtv/ivtv-cards.h | |||
@@ -111,6 +111,7 @@ | |||
111 | #define IVTV_HW_I2C_IR_RX_HAUP_INT (1 << 18) | 111 | #define IVTV_HW_I2C_IR_RX_HAUP_INT (1 << 18) |
112 | #define IVTV_HW_Z8F0811_IR_TX_HAUP (1 << 19) | 112 | #define IVTV_HW_Z8F0811_IR_TX_HAUP (1 << 19) |
113 | #define IVTV_HW_Z8F0811_IR_RX_HAUP (1 << 20) | 113 | #define IVTV_HW_Z8F0811_IR_RX_HAUP (1 << 20) |
114 | #define IVTV_HW_I2C_IR_RX_ADAPTEC (1 << 21) | ||
114 | 115 | ||
115 | #define IVTV_HW_Z8F0811_IR_HAUP (IVTV_HW_Z8F0811_IR_RX_HAUP | \ | 116 | #define IVTV_HW_Z8F0811_IR_HAUP (IVTV_HW_Z8F0811_IR_RX_HAUP | \ |
116 | IVTV_HW_Z8F0811_IR_TX_HAUP) | 117 | IVTV_HW_Z8F0811_IR_TX_HAUP) |
@@ -120,7 +121,8 @@ | |||
120 | #define IVTV_HW_IR_RX_ANY (IVTV_HW_I2C_IR_RX_AVER | \ | 121 | #define IVTV_HW_IR_RX_ANY (IVTV_HW_I2C_IR_RX_AVER | \ |
121 | IVTV_HW_I2C_IR_RX_HAUP_EXT | \ | 122 | IVTV_HW_I2C_IR_RX_HAUP_EXT | \ |
122 | IVTV_HW_I2C_IR_RX_HAUP_INT | \ | 123 | IVTV_HW_I2C_IR_RX_HAUP_INT | \ |
123 | IVTV_HW_Z8F0811_IR_RX_HAUP) | 124 | IVTV_HW_Z8F0811_IR_RX_HAUP | \ |
125 | IVTV_HW_I2C_IR_RX_ADAPTEC) | ||
124 | 126 | ||
125 | #define IVTV_HW_IR_TX_ANY (IVTV_HW_Z8F0811_IR_TX_HAUP) | 127 | #define IVTV_HW_IR_TX_ANY (IVTV_HW_Z8F0811_IR_TX_HAUP) |
126 | 128 | ||
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 */ |
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 = (u32) keybuf; | ||
171 | *ir_raw = (u32) keybuf; | ||
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; |
@@ -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 | ||