diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-05 04:55:26 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-18 17:14:15 -0400 |
commit | c7a45e5b4f8c2f96cd242ae1b1c06e7fb19a08d0 (patch) | |
tree | c96a6a20bfd01b1fd39b40d583508aaed543c04f | |
parent | da508f5799659241a359e2d07abb8af905f6291c (diff) |
[media] em28xx: Prepare to support 2 different I2C buses
Newer em28xx devices have 2 buses. Change the logic to allow
using both buses.
This patch was generated by this small script:
for i in drivers/media/usb/em28xx/*.c; do
sed 's,->i2c_adap,->i2c_adap[dev->def_i2c_bus],g;s,->i2c_client,->i2c_client[dev->def_i2c_bus],'
done
Of course, em28xx.h needed manual edit.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/usb/em28xx/em28xx-cards.c | 32 | ||||
-rw-r--r-- | drivers/media/usb/em28xx/em28xx-dvb.c | 86 | ||||
-rw-r--r-- | drivers/media/usb/em28xx/em28xx-i2c.c | 30 | ||||
-rw-r--r-- | drivers/media/usb/em28xx/em28xx-input.c | 5 | ||||
-rw-r--r-- | drivers/media/usb/em28xx/em28xx.h | 10 |
5 files changed, 85 insertions, 78 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c index 4dcef9d6d561..d81f7ee94c41 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c | |||
@@ -2249,7 +2249,7 @@ static int em28xx_initialize_mt9m111(struct em28xx *dev) | |||
2249 | }; | 2249 | }; |
2250 | 2250 | ||
2251 | for (i = 0; i < ARRAY_SIZE(regs); i++) | 2251 | for (i = 0; i < ARRAY_SIZE(regs); i++) |
2252 | i2c_master_send(&dev->i2c_client, ®s[i][0], 3); | 2252 | i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], ®s[i][0], 3); |
2253 | 2253 | ||
2254 | return 0; | 2254 | return 0; |
2255 | } | 2255 | } |
@@ -2276,7 +2276,7 @@ static int em28xx_initialize_mt9m001(struct em28xx *dev) | |||
2276 | }; | 2276 | }; |
2277 | 2277 | ||
2278 | for (i = 0; i < ARRAY_SIZE(regs); i++) | 2278 | for (i = 0; i < ARRAY_SIZE(regs); i++) |
2279 | i2c_master_send(&dev->i2c_client, ®s[i][0], 3); | 2279 | i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], ®s[i][0], 3); |
2280 | 2280 | ||
2281 | return 0; | 2281 | return 0; |
2282 | } | 2282 | } |
@@ -2294,10 +2294,10 @@ static int em28xx_hint_sensor(struct em28xx *dev) | |||
2294 | u16 version; | 2294 | u16 version; |
2295 | 2295 | ||
2296 | /* Micron sensor detection */ | 2296 | /* Micron sensor detection */ |
2297 | dev->i2c_client.addr = 0xba >> 1; | 2297 | dev->i2c_client[dev->def_i2c_bus].addr = 0xba >> 1; |
2298 | cmd = 0; | 2298 | cmd = 0; |
2299 | i2c_master_send(&dev->i2c_client, &cmd, 1); | 2299 | i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], &cmd, 1); |
2300 | rc = i2c_master_recv(&dev->i2c_client, (char *)&version_be, 2); | 2300 | rc = i2c_master_recv(&dev->i2c_client[dev->def_i2c_bus], (char *)&version_be, 2); |
2301 | if (rc != 2) | 2301 | if (rc != 2) |
2302 | return -EINVAL; | 2302 | return -EINVAL; |
2303 | 2303 | ||
@@ -2748,8 +2748,8 @@ static void em28xx_card_setup(struct em28xx *dev) | |||
2748 | #endif | 2748 | #endif |
2749 | /* Call first TVeeprom */ | 2749 | /* Call first TVeeprom */ |
2750 | 2750 | ||
2751 | dev->i2c_client.addr = 0xa0 >> 1; | 2751 | dev->i2c_client[dev->def_i2c_bus].addr = 0xa0 >> 1; |
2752 | tveeprom_hauppauge_analog(&dev->i2c_client, &tv, dev->eedata); | 2752 | tveeprom_hauppauge_analog(&dev->i2c_client[dev->def_i2c_bus], &tv, dev->eedata); |
2753 | 2753 | ||
2754 | dev->tuner_type = tv.tuner_type; | 2754 | dev->tuner_type = tv.tuner_type; |
2755 | 2755 | ||
@@ -2841,15 +2841,15 @@ static void em28xx_card_setup(struct em28xx *dev) | |||
2841 | 2841 | ||
2842 | /* request some modules */ | 2842 | /* request some modules */ |
2843 | if (dev->board.has_msp34xx) | 2843 | if (dev->board.has_msp34xx) |
2844 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2844 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap[dev->def_i2c_bus], |
2845 | "msp3400", 0, msp3400_addrs); | 2845 | "msp3400", 0, msp3400_addrs); |
2846 | 2846 | ||
2847 | if (dev->board.decoder == EM28XX_SAA711X) | 2847 | if (dev->board.decoder == EM28XX_SAA711X) |
2848 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2848 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap[dev->def_i2c_bus], |
2849 | "saa7115_auto", 0, saa711x_addrs); | 2849 | "saa7115_auto", 0, saa711x_addrs); |
2850 | 2850 | ||
2851 | if (dev->board.decoder == EM28XX_TVP5150) | 2851 | if (dev->board.decoder == EM28XX_TVP5150) |
2852 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2852 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap[dev->def_i2c_bus], |
2853 | "tvp5150", 0, tvp5150_addrs); | 2853 | "tvp5150", 0, tvp5150_addrs); |
2854 | 2854 | ||
2855 | if (dev->em28xx_sensor == EM28XX_MT9V011) { | 2855 | if (dev->em28xx_sensor == EM28XX_MT9V011) { |
@@ -2861,25 +2861,25 @@ static void em28xx_card_setup(struct em28xx *dev) | |||
2861 | }; | 2861 | }; |
2862 | 2862 | ||
2863 | pdata.xtal = dev->sensor_xtal; | 2863 | pdata.xtal = dev->sensor_xtal; |
2864 | v4l2_i2c_new_subdev_board(&dev->v4l2_dev, &dev->i2c_adap, | 2864 | v4l2_i2c_new_subdev_board(&dev->v4l2_dev, &dev->i2c_adap[dev->def_i2c_bus], |
2865 | &mt9v011_info, NULL); | 2865 | &mt9v011_info, NULL); |
2866 | } | 2866 | } |
2867 | 2867 | ||
2868 | 2868 | ||
2869 | if (dev->board.adecoder == EM28XX_TVAUDIO) | 2869 | if (dev->board.adecoder == EM28XX_TVAUDIO) |
2870 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2870 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap[dev->def_i2c_bus], |
2871 | "tvaudio", dev->board.tvaudio_addr, NULL); | 2871 | "tvaudio", dev->board.tvaudio_addr, NULL); |
2872 | 2872 | ||
2873 | if (dev->board.tuner_type != TUNER_ABSENT) { | 2873 | if (dev->board.tuner_type != TUNER_ABSENT) { |
2874 | int has_demod = (dev->tda9887_conf & TDA9887_PRESENT); | 2874 | int has_demod = (dev->tda9887_conf & TDA9887_PRESENT); |
2875 | 2875 | ||
2876 | if (dev->board.radio.type) | 2876 | if (dev->board.radio.type) |
2877 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2877 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap[dev->def_i2c_bus], |
2878 | "tuner", dev->board.radio_addr, NULL); | 2878 | "tuner", dev->board.radio_addr, NULL); |
2879 | 2879 | ||
2880 | if (has_demod) | 2880 | if (has_demod) |
2881 | v4l2_i2c_new_subdev(&dev->v4l2_dev, | 2881 | v4l2_i2c_new_subdev(&dev->v4l2_dev, |
2882 | &dev->i2c_adap, "tuner", | 2882 | &dev->i2c_adap[dev->def_i2c_bus], "tuner", |
2883 | 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); | 2883 | 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); |
2884 | if (dev->tuner_addr == 0) { | 2884 | if (dev->tuner_addr == 0) { |
2885 | enum v4l2_i2c_tuner_type type = | 2885 | enum v4l2_i2c_tuner_type type = |
@@ -2887,13 +2887,13 @@ static void em28xx_card_setup(struct em28xx *dev) | |||
2887 | struct v4l2_subdev *sd; | 2887 | struct v4l2_subdev *sd; |
2888 | 2888 | ||
2889 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, | 2889 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
2890 | &dev->i2c_adap, "tuner", | 2890 | &dev->i2c_adap[dev->def_i2c_bus], "tuner", |
2891 | 0, v4l2_i2c_tuner_addrs(type)); | 2891 | 0, v4l2_i2c_tuner_addrs(type)); |
2892 | 2892 | ||
2893 | if (sd) | 2893 | if (sd) |
2894 | dev->tuner_addr = v4l2_i2c_subdev_addr(sd); | 2894 | dev->tuner_addr = v4l2_i2c_subdev_addr(sd); |
2895 | } else { | 2895 | } else { |
2896 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2896 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap[dev->def_i2c_bus], |
2897 | "tuner", dev->tuner_addr, NULL); | 2897 | "tuner", dev->tuner_addr, NULL); |
2898 | } | 2898 | } |
2899 | } | 2899 | } |
diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c index 7200dfe59ef9..98b95be3be6e 100644 --- a/drivers/media/usb/em28xx/em28xx-dvb.c +++ b/drivers/media/usb/em28xx/em28xx-dvb.c | |||
@@ -463,10 +463,10 @@ static void hauppauge_hvr930c_init(struct em28xx *dev) | |||
463 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44); | 463 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44); |
464 | msleep(10); | 464 | msleep(10); |
465 | 465 | ||
466 | dev->i2c_client.addr = 0x82 >> 1; | 466 | dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1; |
467 | 467 | ||
468 | for (i = 0; i < ARRAY_SIZE(regs); i++) | 468 | for (i = 0; i < ARRAY_SIZE(regs); i++) |
469 | i2c_master_send(&dev->i2c_client, regs[i].r, regs[i].len); | 469 | i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], regs[i].r, regs[i].len); |
470 | em28xx_gpio_set(dev, hauppauge_hvr930c_end); | 470 | em28xx_gpio_set(dev, hauppauge_hvr930c_end); |
471 | 471 | ||
472 | msleep(100); | 472 | msleep(100); |
@@ -520,10 +520,10 @@ static void terratec_h5_init(struct em28xx *dev) | |||
520 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x45); | 520 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x45); |
521 | msleep(10); | 521 | msleep(10); |
522 | 522 | ||
523 | dev->i2c_client.addr = 0x82 >> 1; | 523 | dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1; |
524 | 524 | ||
525 | for (i = 0; i < ARRAY_SIZE(regs); i++) | 525 | for (i = 0; i < ARRAY_SIZE(regs); i++) |
526 | i2c_master_send(&dev->i2c_client, regs[i].r, regs[i].len); | 526 | i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], regs[i].r, regs[i].len); |
527 | em28xx_gpio_set(dev, terratec_h5_end); | 527 | em28xx_gpio_set(dev, terratec_h5_end); |
528 | }; | 528 | }; |
529 | 529 | ||
@@ -573,10 +573,10 @@ static void terratec_htc_stick_init(struct em28xx *dev) | |||
573 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44); | 573 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44); |
574 | msleep(10); | 574 | msleep(10); |
575 | 575 | ||
576 | dev->i2c_client.addr = 0x82 >> 1; | 576 | dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1; |
577 | 577 | ||
578 | for (i = 0; i < ARRAY_SIZE(regs); i++) | 578 | for (i = 0; i < ARRAY_SIZE(regs); i++) |
579 | i2c_master_send(&dev->i2c_client, regs[i].r, regs[i].len); | 579 | i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], regs[i].r, regs[i].len); |
580 | 580 | ||
581 | em28xx_gpio_set(dev, terratec_htc_stick_end); | 581 | em28xx_gpio_set(dev, terratec_htc_stick_end); |
582 | }; | 582 | }; |
@@ -631,10 +631,10 @@ static void terratec_htc_usb_xs_init(struct em28xx *dev) | |||
631 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44); | 631 | em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x44); |
632 | msleep(10); | 632 | msleep(10); |
633 | 633 | ||
634 | dev->i2c_client.addr = 0x82 >> 1; | 634 | dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1; |
635 | 635 | ||
636 | for (i = 0; i < ARRAY_SIZE(regs); i++) | 636 | for (i = 0; i < ARRAY_SIZE(regs); i++) |
637 | i2c_master_send(&dev->i2c_client, regs[i].r, regs[i].len); | 637 | i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], regs[i].r, regs[i].len); |
638 | 638 | ||
639 | em28xx_gpio_set(dev, terratec_htc_usb_xs_end); | 639 | em28xx_gpio_set(dev, terratec_htc_usb_xs_end); |
640 | }; | 640 | }; |
@@ -660,10 +660,10 @@ static void pctv_520e_init(struct em28xx *dev) | |||
660 | {{ 0x01, 0x00, 0x73, 0xaf }, 4}, | 660 | {{ 0x01, 0x00, 0x73, 0xaf }, 4}, |
661 | }; | 661 | }; |
662 | 662 | ||
663 | dev->i2c_client.addr = 0x82 >> 1; /* 0x41 */ | 663 | dev->i2c_client[dev->def_i2c_bus].addr = 0x82 >> 1; /* 0x41 */ |
664 | 664 | ||
665 | for (i = 0; i < ARRAY_SIZE(regs); i++) | 665 | for (i = 0; i < ARRAY_SIZE(regs); i++) |
666 | i2c_master_send(&dev->i2c_client, regs[i].r, regs[i].len); | 666 | i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], regs[i].r, regs[i].len); |
667 | }; | 667 | }; |
668 | 668 | ||
669 | static int em28xx_pctv_290e_set_lna(struct dvb_frontend *fe) | 669 | static int em28xx_pctv_290e_set_lna(struct dvb_frontend *fe) |
@@ -777,7 +777,7 @@ static int em28xx_attach_xc3028(u8 addr, struct em28xx *dev) | |||
777 | struct xc2028_config cfg; | 777 | struct xc2028_config cfg; |
778 | 778 | ||
779 | memset(&cfg, 0, sizeof(cfg)); | 779 | memset(&cfg, 0, sizeof(cfg)); |
780 | cfg.i2c_adap = &dev->i2c_adap; | 780 | cfg.i2c_adap = &dev->i2c_adap[dev->def_i2c_bus]; |
781 | cfg.i2c_addr = addr; | 781 | cfg.i2c_addr = addr; |
782 | 782 | ||
783 | if (!dev->dvb->fe[0]) { | 783 | if (!dev->dvb->fe[0]) { |
@@ -960,7 +960,7 @@ static int em28xx_dvb_init(struct em28xx *dev) | |||
960 | switch (dev->model) { | 960 | switch (dev->model) { |
961 | case EM2874_BOARD_LEADERSHIP_ISDBT: | 961 | case EM2874_BOARD_LEADERSHIP_ISDBT: |
962 | dvb->fe[0] = dvb_attach(s921_attach, | 962 | dvb->fe[0] = dvb_attach(s921_attach, |
963 | &sharp_isdbt, &dev->i2c_adap); | 963 | &sharp_isdbt, &dev->i2c_adap[dev->def_i2c_bus]); |
964 | 964 | ||
965 | if (!dvb->fe[0]) { | 965 | if (!dvb->fe[0]) { |
966 | result = -EINVAL; | 966 | result = -EINVAL; |
@@ -974,7 +974,7 @@ static int em28xx_dvb_init(struct em28xx *dev) | |||
974 | case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600: | 974 | case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600: |
975 | dvb->fe[0] = dvb_attach(lgdt330x_attach, | 975 | dvb->fe[0] = dvb_attach(lgdt330x_attach, |
976 | &em2880_lgdt3303_dev, | 976 | &em2880_lgdt3303_dev, |
977 | &dev->i2c_adap); | 977 | &dev->i2c_adap[dev->def_i2c_bus]); |
978 | if (em28xx_attach_xc3028(0x61, dev) < 0) { | 978 | if (em28xx_attach_xc3028(0x61, dev) < 0) { |
979 | result = -EINVAL; | 979 | result = -EINVAL; |
980 | goto out_free; | 980 | goto out_free; |
@@ -983,7 +983,7 @@ static int em28xx_dvb_init(struct em28xx *dev) | |||
983 | case EM2880_BOARD_KWORLD_DVB_310U: | 983 | case EM2880_BOARD_KWORLD_DVB_310U: |
984 | dvb->fe[0] = dvb_attach(zl10353_attach, | 984 | dvb->fe[0] = dvb_attach(zl10353_attach, |
985 | &em28xx_zl10353_with_xc3028, | 985 | &em28xx_zl10353_with_xc3028, |
986 | &dev->i2c_adap); | 986 | &dev->i2c_adap[dev->def_i2c_bus]); |
987 | if (em28xx_attach_xc3028(0x61, dev) < 0) { | 987 | if (em28xx_attach_xc3028(0x61, dev) < 0) { |
988 | result = -EINVAL; | 988 | result = -EINVAL; |
989 | goto out_free; | 989 | goto out_free; |
@@ -994,7 +994,7 @@ static int em28xx_dvb_init(struct em28xx *dev) | |||
994 | case EM2880_BOARD_EMPIRE_DUAL_TV: | 994 | case EM2880_BOARD_EMPIRE_DUAL_TV: |
995 | dvb->fe[0] = dvb_attach(zl10353_attach, | 995 | dvb->fe[0] = dvb_attach(zl10353_attach, |
996 | &em28xx_zl10353_xc3028_no_i2c_gate, | 996 | &em28xx_zl10353_xc3028_no_i2c_gate, |
997 | &dev->i2c_adap); | 997 | &dev->i2c_adap[dev->def_i2c_bus]); |
998 | if (em28xx_attach_xc3028(0x61, dev) < 0) { | 998 | if (em28xx_attach_xc3028(0x61, dev) < 0) { |
999 | result = -EINVAL; | 999 | result = -EINVAL; |
1000 | goto out_free; | 1000 | goto out_free; |
@@ -1007,13 +1007,13 @@ static int em28xx_dvb_init(struct em28xx *dev) | |||
1007 | case EM2882_BOARD_KWORLD_VS_DVBT: | 1007 | case EM2882_BOARD_KWORLD_VS_DVBT: |
1008 | dvb->fe[0] = dvb_attach(zl10353_attach, | 1008 | dvb->fe[0] = dvb_attach(zl10353_attach, |
1009 | &em28xx_zl10353_xc3028_no_i2c_gate, | 1009 | &em28xx_zl10353_xc3028_no_i2c_gate, |
1010 | &dev->i2c_adap); | 1010 | &dev->i2c_adap[dev->def_i2c_bus]); |
1011 | if (dvb->fe[0] == NULL) { | 1011 | if (dvb->fe[0] == NULL) { |
1012 | /* This board could have either a zl10353 or a mt352. | 1012 | /* This board could have either a zl10353 or a mt352. |
1013 | If the chip id isn't for zl10353, try mt352 */ | 1013 | If the chip id isn't for zl10353, try mt352 */ |
1014 | dvb->fe[0] = dvb_attach(mt352_attach, | 1014 | dvb->fe[0] = dvb_attach(mt352_attach, |
1015 | &terratec_xs_mt352_cfg, | 1015 | &terratec_xs_mt352_cfg, |
1016 | &dev->i2c_adap); | 1016 | &dev->i2c_adap[dev->def_i2c_bus]); |
1017 | } | 1017 | } |
1018 | 1018 | ||
1019 | if (em28xx_attach_xc3028(0x61, dev) < 0) { | 1019 | if (em28xx_attach_xc3028(0x61, dev) < 0) { |
@@ -1024,16 +1024,16 @@ static int em28xx_dvb_init(struct em28xx *dev) | |||
1024 | case EM2870_BOARD_KWORLD_355U: | 1024 | case EM2870_BOARD_KWORLD_355U: |
1025 | dvb->fe[0] = dvb_attach(zl10353_attach, | 1025 | dvb->fe[0] = dvb_attach(zl10353_attach, |
1026 | &em28xx_zl10353_no_i2c_gate_dev, | 1026 | &em28xx_zl10353_no_i2c_gate_dev, |
1027 | &dev->i2c_adap); | 1027 | &dev->i2c_adap[dev->def_i2c_bus]); |
1028 | if (dvb->fe[0] != NULL) | 1028 | if (dvb->fe[0] != NULL) |
1029 | dvb_attach(qt1010_attach, dvb->fe[0], | 1029 | dvb_attach(qt1010_attach, dvb->fe[0], |
1030 | &dev->i2c_adap, &em28xx_qt1010_config); | 1030 | &dev->i2c_adap[dev->def_i2c_bus], &em28xx_qt1010_config); |
1031 | break; | 1031 | break; |
1032 | case EM2883_BOARD_KWORLD_HYBRID_330U: | 1032 | case EM2883_BOARD_KWORLD_HYBRID_330U: |
1033 | case EM2882_BOARD_EVGA_INDTUBE: | 1033 | case EM2882_BOARD_EVGA_INDTUBE: |
1034 | dvb->fe[0] = dvb_attach(s5h1409_attach, | 1034 | dvb->fe[0] = dvb_attach(s5h1409_attach, |
1035 | &em28xx_s5h1409_with_xc3028, | 1035 | &em28xx_s5h1409_with_xc3028, |
1036 | &dev->i2c_adap); | 1036 | &dev->i2c_adap[dev->def_i2c_bus]); |
1037 | if (em28xx_attach_xc3028(0x61, dev) < 0) { | 1037 | if (em28xx_attach_xc3028(0x61, dev) < 0) { |
1038 | result = -EINVAL; | 1038 | result = -EINVAL; |
1039 | goto out_free; | 1039 | goto out_free; |
@@ -1042,10 +1042,10 @@ static int em28xx_dvb_init(struct em28xx *dev) | |||
1042 | case EM2882_BOARD_KWORLD_ATSC_315U: | 1042 | case EM2882_BOARD_KWORLD_ATSC_315U: |
1043 | dvb->fe[0] = dvb_attach(lgdt330x_attach, | 1043 | dvb->fe[0] = dvb_attach(lgdt330x_attach, |
1044 | &em2880_lgdt3303_dev, | 1044 | &em2880_lgdt3303_dev, |
1045 | &dev->i2c_adap); | 1045 | &dev->i2c_adap[dev->def_i2c_bus]); |
1046 | if (dvb->fe[0] != NULL) { | 1046 | if (dvb->fe[0] != NULL) { |
1047 | if (!dvb_attach(simple_tuner_attach, dvb->fe[0], | 1047 | if (!dvb_attach(simple_tuner_attach, dvb->fe[0], |
1048 | &dev->i2c_adap, 0x61, TUNER_THOMSON_DTT761X)) { | 1048 | &dev->i2c_adap[dev->def_i2c_bus], 0x61, TUNER_THOMSON_DTT761X)) { |
1049 | result = -EINVAL; | 1049 | result = -EINVAL; |
1050 | goto out_free; | 1050 | goto out_free; |
1051 | } | 1051 | } |
@@ -1054,7 +1054,7 @@ static int em28xx_dvb_init(struct em28xx *dev) | |||
1054 | case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2: | 1054 | case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2: |
1055 | case EM2882_BOARD_PINNACLE_HYBRID_PRO_330E: | 1055 | case EM2882_BOARD_PINNACLE_HYBRID_PRO_330E: |
1056 | dvb->fe[0] = dvb_attach(drxd_attach, &em28xx_drxd, NULL, | 1056 | dvb->fe[0] = dvb_attach(drxd_attach, &em28xx_drxd, NULL, |
1057 | &dev->i2c_adap, &dev->udev->dev); | 1057 | &dev->i2c_adap[dev->def_i2c_bus], &dev->udev->dev); |
1058 | if (em28xx_attach_xc3028(0x61, dev) < 0) { | 1058 | if (em28xx_attach_xc3028(0x61, dev) < 0) { |
1059 | result = -EINVAL; | 1059 | result = -EINVAL; |
1060 | goto out_free; | 1060 | goto out_free; |
@@ -1064,10 +1064,10 @@ static int em28xx_dvb_init(struct em28xx *dev) | |||
1064 | /* Philips CU1216L NIM (Philips TDA10023 + Infineon TUA6034) */ | 1064 | /* Philips CU1216L NIM (Philips TDA10023 + Infineon TUA6034) */ |
1065 | dvb->fe[0] = dvb_attach(tda10023_attach, | 1065 | dvb->fe[0] = dvb_attach(tda10023_attach, |
1066 | &em28xx_tda10023_config, | 1066 | &em28xx_tda10023_config, |
1067 | &dev->i2c_adap, 0x48); | 1067 | &dev->i2c_adap[dev->def_i2c_bus], 0x48); |
1068 | if (dvb->fe[0]) { | 1068 | if (dvb->fe[0]) { |
1069 | if (!dvb_attach(simple_tuner_attach, dvb->fe[0], | 1069 | if (!dvb_attach(simple_tuner_attach, dvb->fe[0], |
1070 | &dev->i2c_adap, 0x60, TUNER_PHILIPS_CU1216L)) { | 1070 | &dev->i2c_adap[dev->def_i2c_bus], 0x60, TUNER_PHILIPS_CU1216L)) { |
1071 | result = -EINVAL; | 1071 | result = -EINVAL; |
1072 | goto out_free; | 1072 | goto out_free; |
1073 | } | 1073 | } |
@@ -1076,10 +1076,10 @@ static int em28xx_dvb_init(struct em28xx *dev) | |||
1076 | case EM2870_BOARD_KWORLD_A340: | 1076 | case EM2870_BOARD_KWORLD_A340: |
1077 | dvb->fe[0] = dvb_attach(lgdt3305_attach, | 1077 | dvb->fe[0] = dvb_attach(lgdt3305_attach, |
1078 | &em2870_lgdt3304_dev, | 1078 | &em2870_lgdt3304_dev, |
1079 | &dev->i2c_adap); | 1079 | &dev->i2c_adap[dev->def_i2c_bus]); |
1080 | if (dvb->fe[0] != NULL) | 1080 | if (dvb->fe[0] != NULL) |
1081 | dvb_attach(tda18271_attach, dvb->fe[0], 0x60, | 1081 | dvb_attach(tda18271_attach, dvb->fe[0], 0x60, |
1082 | &dev->i2c_adap, &kworld_a340_config); | 1082 | &dev->i2c_adap[dev->def_i2c_bus], &kworld_a340_config); |
1083 | break; | 1083 | break; |
1084 | case EM28174_BOARD_PCTV_290E: | 1084 | case EM28174_BOARD_PCTV_290E: |
1085 | /* set default GPIO0 for LNA, used if GPIOLIB is undefined */ | 1085 | /* set default GPIO0 for LNA, used if GPIOLIB is undefined */ |
@@ -1087,14 +1087,14 @@ static int em28xx_dvb_init(struct em28xx *dev) | |||
1087 | CXD2820R_GPIO_L; | 1087 | CXD2820R_GPIO_L; |
1088 | dvb->fe[0] = dvb_attach(cxd2820r_attach, | 1088 | dvb->fe[0] = dvb_attach(cxd2820r_attach, |
1089 | &em28xx_cxd2820r_config, | 1089 | &em28xx_cxd2820r_config, |
1090 | &dev->i2c_adap, | 1090 | &dev->i2c_adap[dev->def_i2c_bus], |
1091 | &dvb->lna_gpio); | 1091 | &dvb->lna_gpio); |
1092 | if (dvb->fe[0]) { | 1092 | if (dvb->fe[0]) { |
1093 | /* FE 0 attach tuner */ | 1093 | /* FE 0 attach tuner */ |
1094 | if (!dvb_attach(tda18271_attach, | 1094 | if (!dvb_attach(tda18271_attach, |
1095 | dvb->fe[0], | 1095 | dvb->fe[0], |
1096 | 0x60, | 1096 | 0x60, |
1097 | &dev->i2c_adap, | 1097 | &dev->i2c_adap[dev->def_i2c_bus], |
1098 | &em28xx_cxd2820r_tda18271_config)) { | 1098 | &em28xx_cxd2820r_tda18271_config)) { |
1099 | 1099 | ||
1100 | dvb_frontend_detach(dvb->fe[0]); | 1100 | dvb_frontend_detach(dvb->fe[0]); |
@@ -1124,7 +1124,7 @@ static int em28xx_dvb_init(struct em28xx *dev) | |||
1124 | hauppauge_hvr930c_init(dev); | 1124 | hauppauge_hvr930c_init(dev); |
1125 | 1125 | ||
1126 | dvb->fe[0] = dvb_attach(drxk_attach, | 1126 | dvb->fe[0] = dvb_attach(drxk_attach, |
1127 | &hauppauge_930c_drxk, &dev->i2c_adap); | 1127 | &hauppauge_930c_drxk, &dev->i2c_adap[dev->def_i2c_bus]); |
1128 | if (!dvb->fe[0]) { | 1128 | if (!dvb->fe[0]) { |
1129 | result = -EINVAL; | 1129 | result = -EINVAL; |
1130 | goto out_free; | 1130 | goto out_free; |
@@ -1142,7 +1142,7 @@ static int em28xx_dvb_init(struct em28xx *dev) | |||
1142 | 1142 | ||
1143 | if (dvb->fe[0]->ops.i2c_gate_ctrl) | 1143 | if (dvb->fe[0]->ops.i2c_gate_ctrl) |
1144 | dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 1); | 1144 | dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 1); |
1145 | if (!dvb_attach(xc5000_attach, dvb->fe[0], &dev->i2c_adap, | 1145 | if (!dvb_attach(xc5000_attach, dvb->fe[0], &dev->i2c_adap[dev->def_i2c_bus], |
1146 | &cfg)) { | 1146 | &cfg)) { |
1147 | result = -EINVAL; | 1147 | result = -EINVAL; |
1148 | goto out_free; | 1148 | goto out_free; |
@@ -1155,7 +1155,7 @@ static int em28xx_dvb_init(struct em28xx *dev) | |||
1155 | case EM2884_BOARD_TERRATEC_H5: | 1155 | case EM2884_BOARD_TERRATEC_H5: |
1156 | terratec_h5_init(dev); | 1156 | terratec_h5_init(dev); |
1157 | 1157 | ||
1158 | dvb->fe[0] = dvb_attach(drxk_attach, &terratec_h5_drxk, &dev->i2c_adap); | 1158 | dvb->fe[0] = dvb_attach(drxk_attach, &terratec_h5_drxk, &dev->i2c_adap[dev->def_i2c_bus]); |
1159 | if (!dvb->fe[0]) { | 1159 | if (!dvb->fe[0]) { |
1160 | result = -EINVAL; | 1160 | result = -EINVAL; |
1161 | goto out_free; | 1161 | goto out_free; |
@@ -1169,7 +1169,7 @@ static int em28xx_dvb_init(struct em28xx *dev) | |||
1169 | /* Attach tda18271 to DVB-C frontend */ | 1169 | /* Attach tda18271 to DVB-C frontend */ |
1170 | if (dvb->fe[0]->ops.i2c_gate_ctrl) | 1170 | if (dvb->fe[0]->ops.i2c_gate_ctrl) |
1171 | dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 1); | 1171 | dvb->fe[0]->ops.i2c_gate_ctrl(dvb->fe[0], 1); |
1172 | if (!dvb_attach(tda18271c2dd_attach, dvb->fe[0], &dev->i2c_adap, 0x60)) { | 1172 | if (!dvb_attach(tda18271c2dd_attach, dvb->fe[0], &dev->i2c_adap[dev->def_i2c_bus], 0x60)) { |
1173 | result = -EINVAL; | 1173 | result = -EINVAL; |
1174 | goto out_free; | 1174 | goto out_free; |
1175 | } | 1175 | } |
@@ -1180,17 +1180,17 @@ static int em28xx_dvb_init(struct em28xx *dev) | |||
1180 | case EM28174_BOARD_PCTV_460E: | 1180 | case EM28174_BOARD_PCTV_460E: |
1181 | /* attach demod */ | 1181 | /* attach demod */ |
1182 | dvb->fe[0] = dvb_attach(tda10071_attach, | 1182 | dvb->fe[0] = dvb_attach(tda10071_attach, |
1183 | &em28xx_tda10071_config, &dev->i2c_adap); | 1183 | &em28xx_tda10071_config, &dev->i2c_adap[dev->def_i2c_bus]); |
1184 | 1184 | ||
1185 | /* attach SEC */ | 1185 | /* attach SEC */ |
1186 | if (dvb->fe[0]) | 1186 | if (dvb->fe[0]) |
1187 | dvb_attach(a8293_attach, dvb->fe[0], &dev->i2c_adap, | 1187 | dvb_attach(a8293_attach, dvb->fe[0], &dev->i2c_adap[dev->def_i2c_bus], |
1188 | &em28xx_a8293_config); | 1188 | &em28xx_a8293_config); |
1189 | break; | 1189 | break; |
1190 | case EM2874_BOARD_MAXMEDIA_UB425_TC: | 1190 | case EM2874_BOARD_MAXMEDIA_UB425_TC: |
1191 | /* attach demodulator */ | 1191 | /* attach demodulator */ |
1192 | dvb->fe[0] = dvb_attach(drxk_attach, &maxmedia_ub425_tc_drxk, | 1192 | dvb->fe[0] = dvb_attach(drxk_attach, &maxmedia_ub425_tc_drxk, |
1193 | &dev->i2c_adap); | 1193 | &dev->i2c_adap[dev->def_i2c_bus]); |
1194 | 1194 | ||
1195 | if (dvb->fe[0]) { | 1195 | if (dvb->fe[0]) { |
1196 | /* disable I2C-gate */ | 1196 | /* disable I2C-gate */ |
@@ -1198,7 +1198,7 @@ static int em28xx_dvb_init(struct em28xx *dev) | |||
1198 | 1198 | ||
1199 | /* attach tuner */ | 1199 | /* attach tuner */ |
1200 | if (!dvb_attach(tda18271c2dd_attach, dvb->fe[0], | 1200 | if (!dvb_attach(tda18271c2dd_attach, dvb->fe[0], |
1201 | &dev->i2c_adap, 0x60)) { | 1201 | &dev->i2c_adap[dev->def_i2c_bus], 0x60)) { |
1202 | dvb_frontend_detach(dvb->fe[0]); | 1202 | dvb_frontend_detach(dvb->fe[0]); |
1203 | result = -EINVAL; | 1203 | result = -EINVAL; |
1204 | goto out_free; | 1204 | goto out_free; |
@@ -1216,12 +1216,12 @@ static int em28xx_dvb_init(struct em28xx *dev) | |||
1216 | 1216 | ||
1217 | /* attach demodulator */ | 1217 | /* attach demodulator */ |
1218 | dvb->fe[0] = dvb_attach(drxk_attach, &pctv_520e_drxk, | 1218 | dvb->fe[0] = dvb_attach(drxk_attach, &pctv_520e_drxk, |
1219 | &dev->i2c_adap); | 1219 | &dev->i2c_adap[dev->def_i2c_bus]); |
1220 | 1220 | ||
1221 | if (dvb->fe[0]) { | 1221 | if (dvb->fe[0]) { |
1222 | /* attach tuner */ | 1222 | /* attach tuner */ |
1223 | if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60, | 1223 | if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60, |
1224 | &dev->i2c_adap, | 1224 | &dev->i2c_adap[dev->def_i2c_bus], |
1225 | &em28xx_cxd2820r_tda18271_config)) { | 1225 | &em28xx_cxd2820r_tda18271_config)) { |
1226 | dvb_frontend_detach(dvb->fe[0]); | 1226 | dvb_frontend_detach(dvb->fe[0]); |
1227 | result = -EINVAL; | 1227 | result = -EINVAL; |
@@ -1234,7 +1234,7 @@ static int em28xx_dvb_init(struct em28xx *dev) | |||
1234 | 1234 | ||
1235 | /* attach demodulator */ | 1235 | /* attach demodulator */ |
1236 | dvb->fe[0] = dvb_attach(drxk_attach, &terratec_htc_stick_drxk, | 1236 | dvb->fe[0] = dvb_attach(drxk_attach, &terratec_htc_stick_drxk, |
1237 | &dev->i2c_adap); | 1237 | &dev->i2c_adap[dev->def_i2c_bus]); |
1238 | if (!dvb->fe[0]) { | 1238 | if (!dvb->fe[0]) { |
1239 | result = -EINVAL; | 1239 | result = -EINVAL; |
1240 | goto out_free; | 1240 | goto out_free; |
@@ -1242,7 +1242,7 @@ static int em28xx_dvb_init(struct em28xx *dev) | |||
1242 | 1242 | ||
1243 | /* Attach the demodulator. */ | 1243 | /* Attach the demodulator. */ |
1244 | if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60, | 1244 | if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60, |
1245 | &dev->i2c_adap, | 1245 | &dev->i2c_adap[dev->def_i2c_bus], |
1246 | &em28xx_cxd2820r_tda18271_config)) { | 1246 | &em28xx_cxd2820r_tda18271_config)) { |
1247 | result = -EINVAL; | 1247 | result = -EINVAL; |
1248 | goto out_free; | 1248 | goto out_free; |
@@ -1253,7 +1253,7 @@ static int em28xx_dvb_init(struct em28xx *dev) | |||
1253 | 1253 | ||
1254 | /* attach demodulator */ | 1254 | /* attach demodulator */ |
1255 | dvb->fe[0] = dvb_attach(drxk_attach, &terratec_htc_stick_drxk, | 1255 | dvb->fe[0] = dvb_attach(drxk_attach, &terratec_htc_stick_drxk, |
1256 | &dev->i2c_adap); | 1256 | &dev->i2c_adap[dev->def_i2c_bus]); |
1257 | if (!dvb->fe[0]) { | 1257 | if (!dvb->fe[0]) { |
1258 | result = -EINVAL; | 1258 | result = -EINVAL; |
1259 | goto out_free; | 1259 | goto out_free; |
@@ -1261,7 +1261,7 @@ static int em28xx_dvb_init(struct em28xx *dev) | |||
1261 | 1261 | ||
1262 | /* Attach the demodulator. */ | 1262 | /* Attach the demodulator. */ |
1263 | if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60, | 1263 | if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60, |
1264 | &dev->i2c_adap, | 1264 | &dev->i2c_adap[dev->def_i2c_bus], |
1265 | &em28xx_cxd2820r_tda18271_config)) { | 1265 | &em28xx_cxd2820r_tda18271_config)) { |
1266 | result = -EINVAL; | 1266 | result = -EINVAL; |
1267 | goto out_free; | 1267 | goto out_free; |
diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c index 6152423bef76..9086e57914e6 100644 --- a/drivers/media/usb/em28xx/em28xx-i2c.c +++ b/drivers/media/usb/em28xx/em28xx-i2c.c | |||
@@ -384,7 +384,7 @@ static int em28xx_i2c_read_block(struct em28xx *dev, u16 addr, bool addr_w16, | |||
384 | /* Select address */ | 384 | /* Select address */ |
385 | buf[0] = addr >> 8; | 385 | buf[0] = addr >> 8; |
386 | buf[1] = addr & 0xff; | 386 | buf[1] = addr & 0xff; |
387 | ret = i2c_master_send(&dev->i2c_client, buf + !addr_w16, 1 + addr_w16); | 387 | ret = i2c_master_send(&dev->i2c_client[dev->def_i2c_bus], buf + !addr_w16, 1 + addr_w16); |
388 | if (ret < 0) | 388 | if (ret < 0) |
389 | return ret; | 389 | return ret; |
390 | /* Read data */ | 390 | /* Read data */ |
@@ -398,7 +398,7 @@ static int em28xx_i2c_read_block(struct em28xx *dev, u16 addr, bool addr_w16, | |||
398 | else | 398 | else |
399 | rsize = remain; | 399 | rsize = remain; |
400 | 400 | ||
401 | ret = i2c_master_recv(&dev->i2c_client, data, rsize); | 401 | ret = i2c_master_recv(&dev->i2c_client[dev->def_i2c_bus], data, rsize); |
402 | if (ret < 0) | 402 | if (ret < 0) |
403 | return ret; | 403 | return ret; |
404 | 404 | ||
@@ -422,10 +422,10 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, u8 **eedata, u16 *eedata_len) | |||
422 | *eedata = NULL; | 422 | *eedata = NULL; |
423 | *eedata_len = 0; | 423 | *eedata_len = 0; |
424 | 424 | ||
425 | dev->i2c_client.addr = 0xa0 >> 1; | 425 | dev->i2c_client[dev->def_i2c_bus].addr = 0xa0 >> 1; |
426 | 426 | ||
427 | /* Check if board has eeprom */ | 427 | /* Check if board has eeprom */ |
428 | err = i2c_master_recv(&dev->i2c_client, &buf, 0); | 428 | err = i2c_master_recv(&dev->i2c_client[dev->def_i2c_bus], &buf, 0); |
429 | if (err < 0) { | 429 | if (err < 0) { |
430 | em28xx_info("board has no eeprom\n"); | 430 | em28xx_info("board has no eeprom\n"); |
431 | return -ENODEV; | 431 | return -ENODEV; |
@@ -652,8 +652,8 @@ void em28xx_do_i2c_scan(struct em28xx *dev) | |||
652 | memset(i2c_devicelist, 0, ARRAY_SIZE(i2c_devicelist)); | 652 | memset(i2c_devicelist, 0, ARRAY_SIZE(i2c_devicelist)); |
653 | 653 | ||
654 | for (i = 0; i < ARRAY_SIZE(i2c_devs); i++) { | 654 | for (i = 0; i < ARRAY_SIZE(i2c_devs); i++) { |
655 | dev->i2c_client.addr = i; | 655 | dev->i2c_client[dev->def_i2c_bus].addr = i; |
656 | rc = i2c_master_recv(&dev->i2c_client, &buf, 0); | 656 | rc = i2c_master_recv(&dev->i2c_client[dev->def_i2c_bus], &buf, 0); |
657 | if (rc < 0) | 657 | if (rc < 0) |
658 | continue; | 658 | continue; |
659 | i2c_devicelist[i] = i; | 659 | i2c_devicelist[i] = i; |
@@ -675,21 +675,21 @@ int em28xx_i2c_register(struct em28xx *dev) | |||
675 | 675 | ||
676 | BUG_ON(!dev->em28xx_write_regs || !dev->em28xx_read_reg); | 676 | BUG_ON(!dev->em28xx_write_regs || !dev->em28xx_read_reg); |
677 | BUG_ON(!dev->em28xx_write_regs_req || !dev->em28xx_read_reg_req); | 677 | BUG_ON(!dev->em28xx_write_regs_req || !dev->em28xx_read_reg_req); |
678 | dev->i2c_adap = em28xx_adap_template; | 678 | dev->i2c_adap[dev->def_i2c_bus] = em28xx_adap_template; |
679 | dev->i2c_adap.dev.parent = &dev->udev->dev; | 679 | dev->i2c_adap[dev->def_i2c_bus].dev.parent = &dev->udev->dev; |
680 | strcpy(dev->i2c_adap.name, dev->name); | 680 | strcpy(dev->i2c_adap[dev->def_i2c_bus].name, dev->name); |
681 | dev->i2c_adap.algo_data = dev; | 681 | dev->i2c_adap[dev->def_i2c_bus].algo_data = dev; |
682 | i2c_set_adapdata(&dev->i2c_adap, &dev->v4l2_dev); | 682 | i2c_set_adapdata(&dev->i2c_adap[dev->def_i2c_bus], &dev->v4l2_dev); |
683 | 683 | ||
684 | retval = i2c_add_adapter(&dev->i2c_adap); | 684 | retval = i2c_add_adapter(&dev->i2c_adap[dev->def_i2c_bus]); |
685 | if (retval < 0) { | 685 | if (retval < 0) { |
686 | em28xx_errdev("%s: i2c_add_adapter failed! retval [%d]\n", | 686 | em28xx_errdev("%s: i2c_add_adapter failed! retval [%d]\n", |
687 | __func__, retval); | 687 | __func__, retval); |
688 | return retval; | 688 | return retval; |
689 | } | 689 | } |
690 | 690 | ||
691 | dev->i2c_client = em28xx_client_template; | 691 | dev->i2c_client[dev->def_i2c_bus] = em28xx_client_template; |
692 | dev->i2c_client.adapter = &dev->i2c_adap; | 692 | dev->i2c_client[dev->def_i2c_bus].adapter = &dev->i2c_adap[dev->def_i2c_bus]; |
693 | 693 | ||
694 | retval = em28xx_i2c_eeprom(dev, &dev->eedata, &dev->eedata_len); | 694 | retval = em28xx_i2c_eeprom(dev, &dev->eedata, &dev->eedata_len); |
695 | if ((retval < 0) && (retval != -ENODEV)) { | 695 | if ((retval < 0) && (retval != -ENODEV)) { |
@@ -711,6 +711,6 @@ int em28xx_i2c_register(struct em28xx *dev) | |||
711 | */ | 711 | */ |
712 | int em28xx_i2c_unregister(struct em28xx *dev) | 712 | int em28xx_i2c_unregister(struct em28xx *dev) |
713 | { | 713 | { |
714 | i2c_del_adapter(&dev->i2c_adap); | 714 | i2c_del_adapter(&dev->i2c_adap[dev->def_i2c_bus]); |
715 | return 0; | 715 | return 0; |
716 | } | 716 | } |
diff --git a/drivers/media/usb/em28xx/em28xx-input.c b/drivers/media/usb/em28xx/em28xx-input.c index 1bef990b3f18..466b19d0d767 100644 --- a/drivers/media/usb/em28xx/em28xx-input.c +++ b/drivers/media/usb/em28xx/em28xx-input.c | |||
@@ -280,11 +280,12 @@ static int em2874_polling_getkey(struct em28xx_IR *ir, | |||
280 | 280 | ||
281 | static int em28xx_i2c_ir_handle_key(struct em28xx_IR *ir) | 281 | static int em28xx_i2c_ir_handle_key(struct em28xx_IR *ir) |
282 | { | 282 | { |
283 | struct em28xx *dev = ir->dev; | ||
283 | static u32 ir_key; | 284 | static u32 ir_key; |
284 | int rc; | 285 | int rc; |
285 | struct i2c_client client; | 286 | struct i2c_client client; |
286 | 287 | ||
287 | client.adapter = &ir->dev->i2c_adap; | 288 | client.adapter = &ir->dev->i2c_adap[dev->def_i2c_bus]; |
288 | client.addr = ir->i2c_dev_addr; | 289 | client.addr = ir->i2c_dev_addr; |
289 | 290 | ||
290 | rc = ir->get_key_i2c(&client, &ir_key); | 291 | rc = ir->get_key_i2c(&client, &ir_key); |
@@ -461,7 +462,7 @@ static int em28xx_probe_i2c_ir(struct em28xx *dev) | |||
461 | }; | 462 | }; |
462 | 463 | ||
463 | while (addr_list[i] != I2C_CLIENT_END) { | 464 | while (addr_list[i] != I2C_CLIENT_END) { |
464 | if (i2c_probe_func_quick_read(&dev->i2c_adap, addr_list[i]) == 1) | 465 | if (i2c_probe_func_quick_read(&dev->i2c_adap[dev->def_i2c_bus], addr_list[i]) == 1) |
465 | return addr_list[i]; | 466 | return addr_list[i]; |
466 | i++; | 467 | i++; |
467 | } | 468 | } |
diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h index 2d6d31ace733..5de7b6c93857 100644 --- a/drivers/media/usb/em28xx/em28xx.h +++ b/drivers/media/usb/em28xx/em28xx.h | |||
@@ -157,6 +157,9 @@ | |||
157 | #define EM28XX_NUM_BUFS 5 | 157 | #define EM28XX_NUM_BUFS 5 |
158 | #define EM28XX_DVB_NUM_BUFS 5 | 158 | #define EM28XX_DVB_NUM_BUFS 5 |
159 | 159 | ||
160 | /* max number of I2C buses on em28xx devices */ | ||
161 | #define NUM_I2C_BUSES 2 | ||
162 | |||
160 | /* isoc transfers: number of packets for each buffer | 163 | /* isoc transfers: number of packets for each buffer |
161 | windows requests only 64 packets .. so we better do the same | 164 | windows requests only 64 packets .. so we better do the same |
162 | this is what I found out for all alternate numbers there! | 165 | this is what I found out for all alternate numbers there! |
@@ -507,10 +510,13 @@ struct em28xx { | |||
507 | int tuner_type; /* type of the tuner */ | 510 | int tuner_type; /* type of the tuner */ |
508 | int tuner_addr; /* tuner address */ | 511 | int tuner_addr; /* tuner address */ |
509 | int tda9887_conf; | 512 | int tda9887_conf; |
513 | |||
510 | /* i2c i/o */ | 514 | /* i2c i/o */ |
511 | struct i2c_adapter i2c_adap; | 515 | struct i2c_adapter i2c_adap[NUM_I2C_BUSES]; |
512 | struct i2c_client i2c_client; | 516 | struct i2c_client i2c_client[NUM_I2C_BUSES]; |
513 | unsigned char eeprom_addrwidth_16bit:1; | 517 | unsigned char eeprom_addrwidth_16bit:1; |
518 | int def_i2c_bus; /* Default I2C bus */ | ||
519 | |||
514 | /* video for linux */ | 520 | /* video for linux */ |
515 | int users; /* user count for exclusive use */ | 521 | int users; /* user count for exclusive use */ |
516 | int streaming_users; /* Number of actively streaming users */ | 522 | int streaming_users; /* Number of actively streaming users */ |