diff options
author | Jean Delvare <khali@linux-fr.org> | 2009-05-13 15:49:32 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-06-16 17:21:11 -0400 |
commit | 4d7a2d6721a6380d4ffc26d81d2c8232fd0d2dfc (patch) | |
tree | 5ccac1dc6084363abdea5a63fe5d305421bd894c | |
parent | c668f32dca105d876e51862a003a302fa61e4ae4 (diff) |
V4L/DVB (11845): ir-kbd-i2c: Use initialization data
For specific boards, pass initialization data to ir-kbd-i2c instead
of modifying the settings after the device is initialized. This is
more efficient and easier to read.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-cards.c | 3 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-i2c.c | 29 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx.h | 1 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx-cards.c | 31 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx-i2c.c | 22 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx.h | 1 | ||||
-rw-r--r-- | drivers/media/video/ir-kbd-i2c.c | 12 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-i2c.c | 28 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-input.c | 94 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134.h | 1 | ||||
-rw-r--r-- | include/media/ir-kbd-i2c.h | 7 |
11 files changed, 79 insertions, 150 deletions
diff --git a/drivers/media/video/cx231xx/cx231xx-cards.c b/drivers/media/video/cx231xx/cx231xx-cards.c index 734f6eaefd9b..63d2239fd324 100644 --- a/drivers/media/video/cx231xx/cx231xx-cards.c +++ b/drivers/media/video/cx231xx/cx231xx-cards.c | |||
@@ -287,10 +287,7 @@ void cx231xx_register_i2c_ir(struct cx231xx *dev) | |||
287 | return; | 287 | return; |
288 | 288 | ||
289 | /* REVISIT: instantiate IR device */ | 289 | /* REVISIT: instantiate IR device */ |
290 | } | ||
291 | 290 | ||
292 | void cx231xx_set_ir(struct cx231xx *dev, struct IR_i2c *ir) | ||
293 | { | ||
294 | /* detect & configure */ | 291 | /* detect & configure */ |
295 | switch (dev->model) { | 292 | switch (dev->model) { |
296 | 293 | ||
diff --git a/drivers/media/video/cx231xx/cx231xx-i2c.c b/drivers/media/video/cx231xx/cx231xx-i2c.c index ac4099a49da0..33219dc4d649 100644 --- a/drivers/media/video/cx231xx/cx231xx-i2c.c +++ b/drivers/media/video/cx231xx/cx231xx-i2c.c | |||
@@ -424,34 +424,6 @@ static u32 functionality(struct i2c_adapter *adap) | |||
424 | return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_I2C; | 424 | return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_I2C; |
425 | } | 425 | } |
426 | 426 | ||
427 | /* | ||
428 | * attach_inform() | ||
429 | * gets called when a device attaches to the i2c bus | ||
430 | * does some basic configuration | ||
431 | */ | ||
432 | static int attach_inform(struct i2c_client *client) | ||
433 | { | ||
434 | struct cx231xx_i2c *bus = i2c_get_adapdata(client->adapter); | ||
435 | struct cx231xx *dev = bus->dev; | ||
436 | |||
437 | switch (client->addr << 1) { | ||
438 | case 0x8e: | ||
439 | { | ||
440 | struct IR_i2c *ir = i2c_get_clientdata(client); | ||
441 | dprintk1(1, "attach_inform: IR detected (%s).\n", | ||
442 | ir->phys); | ||
443 | cx231xx_set_ir(dev, ir); | ||
444 | break; | ||
445 | } | ||
446 | break; | ||
447 | |||
448 | default: | ||
449 | break; | ||
450 | } | ||
451 | |||
452 | return 0; | ||
453 | } | ||
454 | |||
455 | static struct i2c_algorithm cx231xx_algo = { | 427 | static struct i2c_algorithm cx231xx_algo = { |
456 | .master_xfer = cx231xx_i2c_xfer, | 428 | .master_xfer = cx231xx_i2c_xfer, |
457 | .functionality = functionality, | 429 | .functionality = functionality, |
@@ -462,7 +434,6 @@ static struct i2c_adapter cx231xx_adap_template = { | |||
462 | .name = "cx231xx", | 434 | .name = "cx231xx", |
463 | .id = I2C_HW_B_CX231XX, | 435 | .id = I2C_HW_B_CX231XX, |
464 | .algo = &cx231xx_algo, | 436 | .algo = &cx231xx_algo, |
465 | .client_register = attach_inform, | ||
466 | }; | 437 | }; |
467 | 438 | ||
468 | static struct i2c_client cx231xx_client_template = { | 439 | static struct i2c_client cx231xx_client_template = { |
diff --git a/drivers/media/video/cx231xx/cx231xx.h b/drivers/media/video/cx231xx/cx231xx.h index 8c300f60fdff..e38eb2d425f7 100644 --- a/drivers/media/video/cx231xx/cx231xx.h +++ b/drivers/media/video/cx231xx/cx231xx.h | |||
@@ -739,7 +739,6 @@ extern struct cx231xx_board cx231xx_boards[]; | |||
739 | extern struct usb_device_id cx231xx_id_table[]; | 739 | extern struct usb_device_id cx231xx_id_table[]; |
740 | extern const unsigned int cx231xx_bcount; | 740 | extern const unsigned int cx231xx_bcount; |
741 | void cx231xx_register_i2c_ir(struct cx231xx *dev); | 741 | void cx231xx_register_i2c_ir(struct cx231xx *dev); |
742 | void cx231xx_set_ir(struct cx231xx *dev, struct IR_i2c *ir); | ||
743 | int cx231xx_tuner_callback(void *ptr, int component, int command, int arg); | 742 | int cx231xx_tuner_callback(void *ptr, int component, int command, int arg); |
744 | 743 | ||
745 | /* Provided by cx231xx-input.c */ | 744 | /* Provided by cx231xx-input.c */ |
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index edba71115a94..fe2a471e5f64 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
@@ -1915,6 +1915,7 @@ static int em28xx_hint_board(struct em28xx *dev) | |||
1915 | void em28xx_register_i2c_ir(struct em28xx *dev) | 1915 | void em28xx_register_i2c_ir(struct em28xx *dev) |
1916 | { | 1916 | { |
1917 | struct i2c_board_info info; | 1917 | struct i2c_board_info info; |
1918 | struct IR_i2c_init_data init_data; | ||
1918 | const unsigned short addr_list[] = { | 1919 | const unsigned short addr_list[] = { |
1919 | 0x30, 0x47, I2C_CLIENT_END | 1920 | 0x30, 0x47, I2C_CLIENT_END |
1920 | }; | 1921 | }; |
@@ -1923,12 +1924,9 @@ void em28xx_register_i2c_ir(struct em28xx *dev) | |||
1923 | return; | 1924 | return; |
1924 | 1925 | ||
1925 | memset(&info, 0, sizeof(struct i2c_board_info)); | 1926 | memset(&info, 0, sizeof(struct i2c_board_info)); |
1927 | memset(&init_data, 0, sizeof(struct IR_i2c_init_data)); | ||
1926 | strlcpy(info.type, "ir_video", I2C_NAME_SIZE); | 1928 | strlcpy(info.type, "ir_video", I2C_NAME_SIZE); |
1927 | i2c_new_probed_device(&dev->i2c_adap, &info, addr_list); | ||
1928 | } | ||
1929 | 1929 | ||
1930 | void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir) | ||
1931 | { | ||
1932 | /* detect & configure */ | 1930 | /* detect & configure */ |
1933 | switch (dev->model) { | 1931 | switch (dev->model) { |
1934 | case (EM2800_BOARD_UNKNOWN): | 1932 | case (EM2800_BOARD_UNKNOWN): |
@@ -1937,22 +1935,19 @@ void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir) | |||
1937 | break; | 1935 | break; |
1938 | case (EM2800_BOARD_TERRATEC_CINERGY_200): | 1936 | case (EM2800_BOARD_TERRATEC_CINERGY_200): |
1939 | case (EM2820_BOARD_TERRATEC_CINERGY_250): | 1937 | case (EM2820_BOARD_TERRATEC_CINERGY_250): |
1940 | ir->ir_codes = ir_codes_em_terratec; | 1938 | init_data.ir_codes = ir_codes_em_terratec; |
1941 | ir->get_key = em28xx_get_key_terratec; | 1939 | init_data.get_key = em28xx_get_key_terratec; |
1942 | snprintf(ir->name, sizeof(ir->name), | 1940 | init_data.name = "i2c IR (EM28XX Terratec)"; |
1943 | "i2c IR (EM28XX Terratec)"); | ||
1944 | break; | 1941 | break; |
1945 | case (EM2820_BOARD_PINNACLE_USB_2): | 1942 | case (EM2820_BOARD_PINNACLE_USB_2): |
1946 | ir->ir_codes = ir_codes_pinnacle_grey; | 1943 | init_data.ir_codes = ir_codes_pinnacle_grey; |
1947 | ir->get_key = em28xx_get_key_pinnacle_usb_grey; | 1944 | init_data.get_key = em28xx_get_key_pinnacle_usb_grey; |
1948 | snprintf(ir->name, sizeof(ir->name), | 1945 | init_data.name = "i2c IR (EM28XX Pinnacle PCTV)"; |
1949 | "i2c IR (EM28XX Pinnacle PCTV)"); | ||
1950 | break; | 1946 | break; |
1951 | case (EM2820_BOARD_HAUPPAUGE_WINTV_USB_2): | 1947 | case (EM2820_BOARD_HAUPPAUGE_WINTV_USB_2): |
1952 | ir->ir_codes = ir_codes_hauppauge_new; | 1948 | init_data.ir_codes = ir_codes_hauppauge_new; |
1953 | ir->get_key = em28xx_get_key_em_haup; | 1949 | init_data.get_key = em28xx_get_key_em_haup; |
1954 | snprintf(ir->name, sizeof(ir->name), | 1950 | init_data.name = "i2c IR (EM2840 Hauppauge)"; |
1955 | "i2c IR (EM2840 Hauppauge)"); | ||
1956 | break; | 1951 | break; |
1957 | case (EM2820_BOARD_MSI_VOX_USB_2): | 1952 | case (EM2820_BOARD_MSI_VOX_USB_2): |
1958 | break; | 1953 | break; |
@@ -1963,6 +1958,10 @@ void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir) | |||
1963 | case (EM2800_BOARD_GRABBEEX_USB2800): | 1958 | case (EM2800_BOARD_GRABBEEX_USB2800): |
1964 | break; | 1959 | break; |
1965 | } | 1960 | } |
1961 | |||
1962 | if (init_data.name) | ||
1963 | info.platform_data = &init_data; | ||
1964 | i2c_new_probed_device(&dev->i2c_adap, &info, addr_list); | ||
1966 | } | 1965 | } |
1967 | 1966 | ||
1968 | void em28xx_card_setup(struct em28xx *dev) | 1967 | void em28xx_card_setup(struct em28xx *dev) |
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index d90294cbb70d..2c86fcf089f5 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c | |||
@@ -451,27 +451,6 @@ static u32 functionality(struct i2c_adapter *adap) | |||
451 | return I2C_FUNC_SMBUS_EMUL; | 451 | return I2C_FUNC_SMBUS_EMUL; |
452 | } | 452 | } |
453 | 453 | ||
454 | /* | ||
455 | * attach_inform() | ||
456 | * gets called when a device attaches to the i2c bus | ||
457 | * does some basic configuration | ||
458 | */ | ||
459 | static int attach_inform(struct i2c_client *client) | ||
460 | { | ||
461 | struct em28xx *dev = client->adapter->algo_data; | ||
462 | struct IR_i2c *ir = i2c_get_clientdata(client); | ||
463 | |||
464 | switch (client->addr << 1) { | ||
465 | case 0x60: | ||
466 | case 0x8e: | ||
467 | dprintk1(1, "attach_inform: IR detected (%s).\n", ir->phys); | ||
468 | em28xx_set_ir(dev, ir); | ||
469 | break; | ||
470 | } | ||
471 | |||
472 | return 0; | ||
473 | } | ||
474 | |||
475 | static struct i2c_algorithm em28xx_algo = { | 454 | static struct i2c_algorithm em28xx_algo = { |
476 | .master_xfer = em28xx_i2c_xfer, | 455 | .master_xfer = em28xx_i2c_xfer, |
477 | .functionality = functionality, | 456 | .functionality = functionality, |
@@ -482,7 +461,6 @@ static struct i2c_adapter em28xx_adap_template = { | |||
482 | .name = "em28xx", | 461 | .name = "em28xx", |
483 | .id = I2C_HW_B_EM28XX, | 462 | .id = I2C_HW_B_EM28XX, |
484 | .algo = &em28xx_algo, | 463 | .algo = &em28xx_algo, |
485 | .client_register = attach_inform, | ||
486 | }; | 464 | }; |
487 | 465 | ||
488 | static struct i2c_client em28xx_client_template = { | 466 | static struct i2c_client em28xx_client_template = { |
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index 9c632541df10..8db797fedb7e 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h | |||
@@ -644,7 +644,6 @@ extern struct em28xx_board em28xx_boards[]; | |||
644 | extern struct usb_device_id em28xx_id_table[]; | 644 | extern struct usb_device_id em28xx_id_table[]; |
645 | extern const unsigned int em28xx_bcount; | 645 | extern const unsigned int em28xx_bcount; |
646 | void em28xx_register_i2c_ir(struct em28xx *dev); | 646 | void em28xx_register_i2c_ir(struct em28xx *dev); |
647 | void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir); | ||
648 | int em28xx_tuner_callback(void *ptr, int component, int command, int arg); | 647 | int em28xx_tuner_callback(void *ptr, int component, int command, int arg); |
649 | void em28xx_release_resources(struct em28xx *dev); | 648 | void em28xx_release_resources(struct em28xx *dev); |
650 | 649 | ||
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index cb833a63041c..3a8880243b1f 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c | |||
@@ -298,7 +298,7 @@ static void ir_work(struct work_struct *work) | |||
298 | static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) | 298 | static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) |
299 | { | 299 | { |
300 | IR_KEYTAB_TYPE *ir_codes = NULL; | 300 | IR_KEYTAB_TYPE *ir_codes = NULL; |
301 | char *name; | 301 | const char *name; |
302 | int ir_type; | 302 | int ir_type; |
303 | struct IR_i2c *ir; | 303 | struct IR_i2c *ir; |
304 | struct input_dev *input_dev; | 304 | struct input_dev *input_dev; |
@@ -386,6 +386,16 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
386 | goto err_out_free; | 386 | goto err_out_free; |
387 | } | 387 | } |
388 | 388 | ||
389 | /* Let the caller override settings */ | ||
390 | if (client->dev.platform_data) { | ||
391 | const struct IR_i2c_init_data *init_data = | ||
392 | client->dev.platform_data; | ||
393 | |||
394 | ir_codes = init_data->ir_codes; | ||
395 | name = init_data->name; | ||
396 | ir->get_key = init_data->get_key; | ||
397 | } | ||
398 | |||
389 | /* Sets name */ | 399 | /* Sets name */ |
390 | snprintf(ir->name, sizeof(ir->name), "i2c IR (%s)", name); | 400 | snprintf(ir->name, sizeof(ir->name), "i2c IR (%s)", name); |
391 | ir->ir_codes = ir_codes; | 401 | ir->ir_codes = ir_codes; |
diff --git a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c index a96f75985cba..a8a355e28799 100644 --- a/drivers/media/video/saa7134/saa7134-i2c.c +++ b/drivers/media/video/saa7134/saa7134-i2c.c | |||
@@ -321,33 +321,6 @@ static u32 functionality(struct i2c_adapter *adap) | |||
321 | return I2C_FUNC_SMBUS_EMUL; | 321 | return I2C_FUNC_SMBUS_EMUL; |
322 | } | 322 | } |
323 | 323 | ||
324 | static int attach_inform(struct i2c_client *client) | ||
325 | { | ||
326 | struct saa7134_dev *dev = client->adapter->algo_data; | ||
327 | |||
328 | d1printk( "%s i2c attach [addr=0x%x,client=%s]\n", | ||
329 | client->driver->driver.name, client->addr, client->name); | ||
330 | |||
331 | /* Am I an i2c remote control? */ | ||
332 | |||
333 | switch (client->addr) { | ||
334 | case 0x7a: | ||
335 | case 0x47: | ||
336 | case 0x71: | ||
337 | case 0x2d: | ||
338 | case 0x30: | ||
339 | { | ||
340 | struct IR_i2c *ir = i2c_get_clientdata(client); | ||
341 | d1printk("%s i2c IR detected (%s).\n", | ||
342 | client->driver->driver.name, ir->phys); | ||
343 | saa7134_set_i2c_ir(dev,ir); | ||
344 | break; | ||
345 | } | ||
346 | } | ||
347 | |||
348 | return 0; | ||
349 | } | ||
350 | |||
351 | static struct i2c_algorithm saa7134_algo = { | 324 | static struct i2c_algorithm saa7134_algo = { |
352 | .master_xfer = saa7134_i2c_xfer, | 325 | .master_xfer = saa7134_i2c_xfer, |
353 | .functionality = functionality, | 326 | .functionality = functionality, |
@@ -358,7 +331,6 @@ static struct i2c_adapter saa7134_adap_template = { | |||
358 | .name = "saa7134", | 331 | .name = "saa7134", |
359 | .id = I2C_HW_SAA7134, | 332 | .id = I2C_HW_SAA7134, |
360 | .algo = &saa7134_algo, | 333 | .algo = &saa7134_algo, |
361 | .client_register = attach_inform, | ||
362 | }; | 334 | }; |
363 | 335 | ||
364 | static struct i2c_client saa7134_client_template = { | 336 | static struct i2c_client saa7134_client_template = { |
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 4144ca9cc7e0..a20f687f81a8 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c | |||
@@ -685,6 +685,7 @@ void saa7134_input_fini(struct saa7134_dev *dev) | |||
685 | void saa7134_probe_i2c_ir(struct saa7134_dev *dev) | 685 | void saa7134_probe_i2c_ir(struct saa7134_dev *dev) |
686 | { | 686 | { |
687 | struct i2c_board_info info; | 687 | struct i2c_board_info info; |
688 | struct IR_i2c_init_data init_data; | ||
688 | const unsigned short addr_list[] = { | 689 | const unsigned short addr_list[] = { |
689 | 0x7a, 0x47, 0x71, 0x2d, | 690 | 0x7a, 0x47, 0x71, 0x2d, |
690 | I2C_CLIENT_END | 691 | I2C_CLIENT_END |
@@ -722,62 +723,35 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) | |||
722 | } | 723 | } |
723 | 724 | ||
724 | memset(&info, 0, sizeof(struct i2c_board_info)); | 725 | memset(&info, 0, sizeof(struct i2c_board_info)); |
726 | memset(&init_data, 0, sizeof(struct IR_i2c_init_data)); | ||
725 | strlcpy(info.type, "ir_video", I2C_NAME_SIZE); | 727 | strlcpy(info.type, "ir_video", I2C_NAME_SIZE); |
726 | client = i2c_new_probed_device(&dev->i2c_adap, &info, addr_list); | ||
727 | if (client) | ||
728 | return; | ||
729 | |||
730 | /* MSI TV@nywhere Plus controller doesn't seem to | ||
731 | respond to probes unless we read something from | ||
732 | an existing device. Weird... */ | ||
733 | rc = i2c_transfer(&dev->i2c_adap, &msg_msi, 1); | ||
734 | dprintk(KERN_DEBUG "probe 0x%02x @ %s: %s\n", | ||
735 | msg_msi.addr, dev->i2c_adap.name, | ||
736 | (1 == rc) ? "yes" : "no"); | ||
737 | client = i2c_new_probed_device(&dev->i2c_adap, &info, addr_list_msi); | ||
738 | if (client) | ||
739 | return; | ||
740 | 728 | ||
741 | /* Special case for AVerMedia Cardbus remote */ | ||
742 | subaddr = 0x0d; | ||
743 | rc = i2c_transfer(&dev->i2c_adap, msg_avermedia, 2); | ||
744 | dprintk(KERN_DEBUG "probe 0x%02x/0x%02x @ %s: %s\n", | ||
745 | msg_avermedia[0].addr, subaddr, dev->i2c_adap.name, | ||
746 | (2 == rc) ? "yes" : "no"); | ||
747 | if (2 == rc) { | ||
748 | info.addr = msg_avermedia[0].addr; | ||
749 | i2c_new_device(&dev->i2c_adap, &info); | ||
750 | } | ||
751 | } | ||
752 | |||
753 | void saa7134_set_i2c_ir(struct saa7134_dev *dev, struct IR_i2c *ir) | ||
754 | { | ||
755 | switch (dev->board) { | 729 | switch (dev->board) { |
756 | case SAA7134_BOARD_PINNACLE_PCTV_110i: | 730 | case SAA7134_BOARD_PINNACLE_PCTV_110i: |
757 | case SAA7134_BOARD_PINNACLE_PCTV_310i: | 731 | case SAA7134_BOARD_PINNACLE_PCTV_310i: |
758 | snprintf(ir->name, sizeof(ir->name), "Pinnacle PCTV"); | 732 | init_data.name = "Pinnacle PCTV"; |
759 | if (pinnacle_remote == 0) { | 733 | if (pinnacle_remote == 0) { |
760 | ir->get_key = get_key_pinnacle_color; | 734 | init_data.get_key = get_key_pinnacle_color; |
761 | ir->ir_codes = ir_codes_pinnacle_color; | 735 | init_data.ir_codes = ir_codes_pinnacle_color; |
762 | } else { | 736 | } else { |
763 | ir->get_key = get_key_pinnacle_grey; | 737 | init_data.get_key = get_key_pinnacle_grey; |
764 | ir->ir_codes = ir_codes_pinnacle_grey; | 738 | init_data.ir_codes = ir_codes_pinnacle_grey; |
765 | } | 739 | } |
766 | break; | 740 | break; |
767 | case SAA7134_BOARD_UPMOST_PURPLE_TV: | 741 | case SAA7134_BOARD_UPMOST_PURPLE_TV: |
768 | snprintf(ir->name, sizeof(ir->name), "Purple TV"); | 742 | init_data.name = "Purple TV"; |
769 | ir->get_key = get_key_purpletv; | 743 | init_data.get_key = get_key_purpletv; |
770 | ir->ir_codes = ir_codes_purpletv; | 744 | init_data.ir_codes = ir_codes_purpletv; |
771 | break; | 745 | break; |
772 | case SAA7134_BOARD_MSI_TVATANYWHERE_PLUS: | 746 | case SAA7134_BOARD_MSI_TVATANYWHERE_PLUS: |
773 | snprintf(ir->name, sizeof(ir->name), "MSI TV@nywhere Plus"); | 747 | init_data.name = "MSI TV@nywhere Plus"; |
774 | ir->get_key = get_key_msi_tvanywhere_plus; | 748 | init_data.get_key = get_key_msi_tvanywhere_plus; |
775 | ir->ir_codes = ir_codes_msi_tvanywhere_plus; | 749 | init_data.ir_codes = ir_codes_msi_tvanywhere_plus; |
776 | break; | 750 | break; |
777 | case SAA7134_BOARD_HAUPPAUGE_HVR1110: | 751 | case SAA7134_BOARD_HAUPPAUGE_HVR1110: |
778 | snprintf(ir->name, sizeof(ir->name), "HVR 1110"); | 752 | init_data.name = "HVR 1110"; |
779 | ir->get_key = get_key_hvr1110; | 753 | init_data.get_key = get_key_hvr1110; |
780 | ir->ir_codes = ir_codes_hauppauge_new; | 754 | init_data.ir_codes = ir_codes_hauppauge_new; |
781 | break; | 755 | break; |
782 | case SAA7134_BOARD_BEHOLD_607FM_MK3: | 756 | case SAA7134_BOARD_BEHOLD_607FM_MK3: |
783 | case SAA7134_BOARD_BEHOLD_607FM_MK5: | 757 | case SAA7134_BOARD_BEHOLD_607FM_MK5: |
@@ -791,15 +765,39 @@ void saa7134_set_i2c_ir(struct saa7134_dev *dev, struct IR_i2c *ir) | |||
791 | case SAA7134_BOARD_BEHOLD_M63: | 765 | case SAA7134_BOARD_BEHOLD_M63: |
792 | case SAA7134_BOARD_BEHOLD_M6_EXTRA: | 766 | case SAA7134_BOARD_BEHOLD_M6_EXTRA: |
793 | case SAA7134_BOARD_BEHOLD_H6: | 767 | case SAA7134_BOARD_BEHOLD_H6: |
794 | snprintf(ir->name, sizeof(ir->name), "BeholdTV"); | 768 | init_data.name = "BeholdTV"; |
795 | ir->get_key = get_key_beholdm6xx; | 769 | init_data.get_key = get_key_beholdm6xx; |
796 | ir->ir_codes = ir_codes_behold; | 770 | init_data.ir_codes = ir_codes_behold; |
797 | break; | ||
798 | default: | ||
799 | dprintk("Shouldn't get here: Unknown board %x for I2C IR?\n",dev->board); | ||
800 | break; | 771 | break; |
801 | } | 772 | } |
802 | 773 | ||
774 | if (init_data.name) | ||
775 | info.platform_data = &init_data; | ||
776 | client = i2c_new_probed_device(&dev->i2c_adap, &info, addr_list); | ||
777 | if (client) | ||
778 | return; | ||
779 | |||
780 | /* MSI TV@nywhere Plus controller doesn't seem to | ||
781 | respond to probes unless we read something from | ||
782 | an existing device. Weird... */ | ||
783 | rc = i2c_transfer(&dev->i2c_adap, &msg_msi, 1); | ||
784 | dprintk(KERN_DEBUG "probe 0x%02x @ %s: %s\n", | ||
785 | msg_msi.addr, dev->i2c_adap.name, | ||
786 | (1 == rc) ? "yes" : "no"); | ||
787 | client = i2c_new_probed_device(&dev->i2c_adap, &info, addr_list_msi); | ||
788 | if (client) | ||
789 | return; | ||
790 | |||
791 | /* Special case for AVerMedia Cardbus remote */ | ||
792 | subaddr = 0x0d; | ||
793 | rc = i2c_transfer(&dev->i2c_adap, msg_avermedia, 2); | ||
794 | dprintk(KERN_DEBUG "probe 0x%02x/0x%02x @ %s: %s\n", | ||
795 | msg_avermedia[0].addr, subaddr, dev->i2c_adap.name, | ||
796 | (2 == rc) ? "yes" : "no"); | ||
797 | if (2 == rc) { | ||
798 | info.addr = msg_avermedia[0].addr; | ||
799 | i2c_new_device(&dev->i2c_adap, &info); | ||
800 | } | ||
803 | } | 801 | } |
804 | 802 | ||
805 | static int saa7134_rc5_irq(struct saa7134_dev *dev) | 803 | static int saa7134_rc5_irq(struct saa7134_dev *dev) |
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 116534ec33eb..ae7602d343c1 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
@@ -800,7 +800,6 @@ int saa7134_input_init1(struct saa7134_dev *dev); | |||
800 | void saa7134_input_fini(struct saa7134_dev *dev); | 800 | void saa7134_input_fini(struct saa7134_dev *dev); |
801 | void saa7134_input_irq(struct saa7134_dev *dev); | 801 | void saa7134_input_irq(struct saa7134_dev *dev); |
802 | void saa7134_probe_i2c_ir(struct saa7134_dev *dev); | 802 | void saa7134_probe_i2c_ir(struct saa7134_dev *dev); |
803 | void saa7134_set_i2c_ir(struct saa7134_dev *dev, struct IR_i2c *ir); | ||
804 | void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir); | 803 | void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir); |
805 | void saa7134_ir_stop(struct saa7134_dev *dev); | 804 | void saa7134_ir_stop(struct saa7134_dev *dev); |
806 | 805 | ||
diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h index 94a77b15a30a..3ad4ed5402fb 100644 --- a/include/media/ir-kbd-i2c.h +++ b/include/media/ir-kbd-i2c.h | |||
@@ -19,4 +19,11 @@ struct IR_i2c { | |||
19 | char phys[32]; | 19 | char phys[32]; |
20 | int (*get_key)(struct IR_i2c*, u32*, u32*); | 20 | int (*get_key)(struct IR_i2c*, u32*, u32*); |
21 | }; | 21 | }; |
22 | |||
23 | /* Can be passed when instantiating an ir_video i2c device */ | ||
24 | struct IR_i2c_init_data { | ||
25 | IR_KEYTAB_TYPE *ir_codes; | ||
26 | const char *name; | ||
27 | int (*get_key)(struct IR_i2c*, u32*, u32*); | ||
28 | }; | ||
22 | #endif | 29 | #endif |