]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
[media] em28xx: Add a separate config dir for secondary bus
authorMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 5 Mar 2013 09:55:27 +0000 (06:55 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 18 Mar 2013 21:14:52 +0000 (18:14 -0300)
Prepare to register a separate bus for the second bus.
For now, just add a new field. A latter patch will add the
bits to make it work.
This patch was generated by this script:
perl -e 'while (<>) { if (s/EM2874_I2C_SECONDARY_BUS_SELECT.*\n//) {
printf "\t\t.def_i2c_bus  = 1,\n"; $found = 1; print $_ } else { if ($found) { s/^\s+// }; $found = 0; print $_; } }' \
drivers/media/usb/em28xx/em28xx-cards.c >a && mv a drivers/media/usb/em28xx/em28xx-cards.c

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/usb/em28xx/em28xx-cards.c
drivers/media/usb/em28xx/em28xx.h

index d81f7ee94c410371ba98a1b9193ed2b8c03459d0..16ab4d7780b3494ad44de43d839c01e6672f7b08 100644 (file)
@@ -958,8 +958,8 @@ struct em28xx_board em28xx_boards[] = {
 #else
                .tuner_type   = TUNER_ABSENT,
 #endif
-               .i2c_speed    = EM2874_I2C_SECONDARY_BUS_SELECT |
-                               EM28XX_I2C_CLK_WAIT_ENABLE |
+               .def_i2c_bus  = 1,
+               .i2c_speed    = EM28XX_I2C_CLK_WAIT_ENABLE |
                                EM28XX_I2C_FREQ_400_KHZ,
        },
        [EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C] = {
@@ -974,8 +974,8 @@ struct em28xx_board em28xx_boards[] = {
                .tuner_type   = TUNER_ABSENT,
 #endif
                .ir_codes     = RC_MAP_HAUPPAUGE,
-               .i2c_speed    = EM2874_I2C_SECONDARY_BUS_SELECT |
-                               EM28XX_I2C_CLK_WAIT_ENABLE |
+               .def_i2c_bus  = 1,
+               .i2c_speed    = EM28XX_I2C_CLK_WAIT_ENABLE |
                                EM28XX_I2C_FREQ_400_KHZ,
        },
        [EM2884_BOARD_CINERGY_HTC_STICK] = {
@@ -983,8 +983,8 @@ struct em28xx_board em28xx_boards[] = {
                .has_dvb      = 1,
                .ir_codes     = RC_MAP_NEC_TERRATEC_CINERGY_XS,
                .tuner_type   = TUNER_ABSENT,
-               .i2c_speed    = EM2874_I2C_SECONDARY_BUS_SELECT |
-                               EM28XX_I2C_CLK_WAIT_ENABLE |
+               .def_i2c_bus  = 1,
+               .i2c_speed    = EM28XX_I2C_CLK_WAIT_ENABLE |
                                EM28XX_I2C_FREQ_400_KHZ,
        },
        [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = {
@@ -1404,8 +1404,8 @@ struct em28xx_board em28xx_boards[] = {
        },
 
        [EM2874_BOARD_LEADERSHIP_ISDBT] = {
-               .i2c_speed      = EM2874_I2C_SECONDARY_BUS_SELECT |
-                                 EM28XX_I2C_CLK_WAIT_ENABLE |
+               .def_i2c_bus    = 1,
+               .i2c_speed      = EM28XX_I2C_CLK_WAIT_ENABLE |
                                  EM28XX_I2C_FREQ_100_KHZ,
                .xclk           = EM28XX_XCLK_FREQUENCY_10MHZ,
                .name           = "EM2874 Leadership ISDBT",
@@ -1917,8 +1917,8 @@ struct em28xx_board em28xx_boards[] = {
         * Empia EM28174, Sony CXD2820R and NXP TDA18271HD/C2 */
        [EM28174_BOARD_PCTV_290E] = {
                .name          = "PCTV nanoStick T2 290e",
-               .i2c_speed      = EM2874_I2C_SECONDARY_BUS_SELECT |
-                       EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_FREQ_100_KHZ,
+               .def_i2c_bus   = 1,
+               .i2c_speed     = EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_FREQ_100_KHZ,
                .tuner_type    = TUNER_ABSENT,
                .tuner_gpio    = pctv_290e,
                .has_dvb       = 1,
@@ -1927,8 +1927,8 @@ struct em28xx_board em28xx_boards[] = {
        /* 2013:024f PCTV DVB-S2 Stick 460e
         * Empia EM28174, NXP TDA10071, Conexant CX24118A and Allegro A8293 */
        [EM28174_BOARD_PCTV_460E] = {
-               .i2c_speed     = EM2874_I2C_SECONDARY_BUS_SELECT |
-                       EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_FREQ_400_KHZ,
+               .def_i2c_bus   = 1,
+               .i2c_speed     = EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_FREQ_400_KHZ,
                .name          = "PCTV DVB-S2 Stick (460e)",
                .tuner_type    = TUNER_ABSENT,
                .tuner_gpio    = pctv_460e,
@@ -1958,8 +1958,8 @@ struct em28xx_board em28xx_boards[] = {
                .tuner_type    = TUNER_ABSENT,
                .tuner_gpio    = maxmedia_ub425_tc,
                .has_dvb       = 1,
-               .i2c_speed     = EM2874_I2C_SECONDARY_BUS_SELECT |
-                               EM28XX_I2C_CLK_WAIT_ENABLE |
+               .def_i2c_bus   = 1,
+               .i2c_speed     = EM28XX_I2C_CLK_WAIT_ENABLE |
                                EM28XX_I2C_FREQ_400_KHZ,
        },
        /* 2304:0242 PCTV QuatroStick (510e)
@@ -1970,8 +1970,8 @@ struct em28xx_board em28xx_boards[] = {
                .tuner_gpio    = pctv_510e,
                .has_dvb       = 1,
                .ir_codes      = RC_MAP_PINNACLE_PCTV_HD,
-               .i2c_speed     = EM2874_I2C_SECONDARY_BUS_SELECT |
-                               EM28XX_I2C_CLK_WAIT_ENABLE |
+               .def_i2c_bus   = 1,
+               .i2c_speed     = EM28XX_I2C_CLK_WAIT_ENABLE |
                                EM28XX_I2C_FREQ_400_KHZ,
        },
        /* 2013:0251 PCTV QuatroStick nano (520e)
@@ -1982,8 +1982,8 @@ struct em28xx_board em28xx_boards[] = {
                .tuner_gpio    = pctv_520e,
                .has_dvb       = 1,
                .ir_codes      = RC_MAP_PINNACLE_PCTV_HD,
-               .i2c_speed     = EM2874_I2C_SECONDARY_BUS_SELECT |
-                               EM28XX_I2C_CLK_WAIT_ENABLE |
+               .def_i2c_bus   = 1,
+               .i2c_speed     = EM28XX_I2C_CLK_WAIT_ENABLE |
                                EM28XX_I2C_FREQ_400_KHZ,
        },
        [EM2884_BOARD_TERRATEC_HTC_USB_XS] = {
@@ -1991,8 +1991,8 @@ struct em28xx_board em28xx_boards[] = {
                .has_dvb      = 1,
                .ir_codes     = RC_MAP_NEC_TERRATEC_CINERGY_XS,
                .tuner_type   = TUNER_ABSENT,
-               .i2c_speed    = EM2874_I2C_SECONDARY_BUS_SELECT |
-                               EM28XX_I2C_CLK_WAIT_ENABLE |
+               .def_i2c_bus  = 1,
+               .i2c_speed    = EM28XX_I2C_CLK_WAIT_ENABLE |
                                EM28XX_I2C_FREQ_400_KHZ,
        },
 };
@@ -2234,6 +2234,9 @@ static inline void em28xx_set_model(struct em28xx *dev)
        if (!dev->board.i2c_speed)
                dev->board.i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
                                       EM28XX_I2C_FREQ_100_KHZ;
+
+       if (dev->board.def_i2c_bus == 1)
+               dev->board.i2c_speed |= EM2874_I2C_SECONDARY_BUS_SELECT;
 }
 
 
index 5de7b6c93857df4f7fd236aa4d7b1d2861a78ae6..43eb1c69e3f24b820f1812cedcd638e2f32f87fd 100644 (file)
@@ -375,6 +375,7 @@ struct em28xx_board {
        int vchannels;
        int tuner_type;
        int tuner_addr;
+       int def_i2c_bus;        /* Default I2C bus */
 
        /* i2c flags */
        unsigned int tda9887_conf;