[media] em28xx: fix xc3028 demod and firmware setup on DVB
authorMauro Carvalho Chehab <m.chehab@samsung.com>
Sun, 12 Jan 2014 14:08:22 +0000 (11:08 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Mon, 13 Jan 2014 12:30:30 +0000 (10:30 -0200)
Now that em28xx can be compiled without V4L support, we should
call em28xx_setup_xc3028() on both em28xx-v4l and em28xx-dvb
modules.

Reported-by: Chris Lee <updatelee@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/usb/em28xx/em28xx-cards.c
drivers/media/usb/em28xx/em28xx-dvb.c
drivers/media/usb/em28xx/em28xx-video.c
drivers/media/usb/em28xx/em28xx.h

index 39cf49c44e10260a38226ef22b41020d533b8861..6efb9029381ba971971f427bb554cba1072296c1 100644 (file)
@@ -2768,6 +2768,55 @@ static void em28xx_card_setup(struct em28xx *dev)
                dev->tuner_type = tuner;
 }
 
+void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
+{
+       memset(ctl, 0, sizeof(*ctl));
+
+       ctl->fname   = XC2028_DEFAULT_FIRMWARE;
+       ctl->max_len = 64;
+       ctl->mts = em28xx_boards[dev->model].mts_firmware;
+
+       switch (dev->model) {
+       case EM2880_BOARD_EMPIRE_DUAL_TV:
+       case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
+       case EM2882_BOARD_TERRATEC_HYBRID_XS:
+               ctl->demod = XC3028_FE_ZARLINK456;
+               break;
+       case EM2880_BOARD_TERRATEC_HYBRID_XS:
+       case EM2880_BOARD_TERRATEC_HYBRID_XS_FR:
+       case EM2881_BOARD_PINNACLE_HYBRID_PRO:
+               ctl->demod = XC3028_FE_ZARLINK456;
+               break;
+       case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
+       case EM2882_BOARD_PINNACLE_HYBRID_PRO_330E:
+               ctl->demod = XC3028_FE_DEFAULT;
+               break;
+       case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
+               ctl->demod = XC3028_FE_DEFAULT;
+               ctl->fname = XC3028L_DEFAULT_FIRMWARE;
+               break;
+       case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
+       case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
+       case EM2880_BOARD_PINNACLE_PCTV_HD_PRO:
+               /* FIXME: Better to specify the needed IF */
+               ctl->demod = XC3028_FE_DEFAULT;
+               break;
+       case EM2883_BOARD_KWORLD_HYBRID_330U:
+       case EM2882_BOARD_DIKOM_DK300:
+       case EM2882_BOARD_KWORLD_VS_DVBT:
+               ctl->demod = XC3028_FE_CHINA;
+               ctl->fname = XC2028_DEFAULT_FIRMWARE;
+               break;
+       case EM2882_BOARD_EVGA_INDTUBE:
+               ctl->demod = XC3028_FE_CHINA;
+               ctl->fname = XC3028L_DEFAULT_FIRMWARE;
+               break;
+       default:
+               ctl->demod = XC3028_FE_OREN538;
+       }
+}
+EXPORT_SYMBOL_GPL(em28xx_setup_xc3028);
+
 static void request_module_async(struct work_struct *work)
 {
        struct em28xx *dev = container_of(work,
index 5c6be66ac858571279bffbdc28b5e1655d3888a1..7dba17576edfd5e01a6c0812ecf5de9120d939ca 100644 (file)
@@ -828,11 +828,16 @@ static int em28xx_attach_xc3028(u8 addr, struct em28xx *dev)
 {
        struct dvb_frontend *fe;
        struct xc2028_config cfg;
+       struct xc2028_ctrl ctl;
 
        memset(&cfg, 0, sizeof(cfg));
        cfg.i2c_adap  = &dev->i2c_adap[dev->def_i2c_bus];
        cfg.i2c_addr  = addr;
 
+       memset(&ctl, 0, sizeof(ctl));
+       em28xx_setup_xc3028(dev, &ctl);
+       cfg.ctrl  = &ctl;
+
        if (!dev->dvb->fe[0]) {
                em28xx_errdev("/2: dvb frontend not attached. "
                                "Can't attach xc3028\n");
index 9c44628683307ec05ebacee2b5fbb0037fb7db52..a1dcceb7b2c0ba5d456b943863ea97cfb959464d 100644 (file)
@@ -2100,54 +2100,6 @@ static struct video_device *em28xx_vdev_init(struct em28xx *dev,
        return vfd;
 }
 
-static void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
-{
-       memset(ctl, 0, sizeof(*ctl));
-
-       ctl->fname   = XC2028_DEFAULT_FIRMWARE;
-       ctl->max_len = 64;
-       ctl->mts = em28xx_boards[dev->model].mts_firmware;
-
-       switch (dev->model) {
-       case EM2880_BOARD_EMPIRE_DUAL_TV:
-       case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
-       case EM2882_BOARD_TERRATEC_HYBRID_XS:
-               ctl->demod = XC3028_FE_ZARLINK456;
-               break;
-       case EM2880_BOARD_TERRATEC_HYBRID_XS:
-       case EM2880_BOARD_TERRATEC_HYBRID_XS_FR:
-       case EM2881_BOARD_PINNACLE_HYBRID_PRO:
-               ctl->demod = XC3028_FE_ZARLINK456;
-               break;
-       case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
-       case EM2882_BOARD_PINNACLE_HYBRID_PRO_330E:
-               ctl->demod = XC3028_FE_DEFAULT;
-               break;
-       case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
-               ctl->demod = XC3028_FE_DEFAULT;
-               ctl->fname = XC3028L_DEFAULT_FIRMWARE;
-               break;
-       case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
-       case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
-       case EM2880_BOARD_PINNACLE_PCTV_HD_PRO:
-               /* FIXME: Better to specify the needed IF */
-               ctl->demod = XC3028_FE_DEFAULT;
-               break;
-       case EM2883_BOARD_KWORLD_HYBRID_330U:
-       case EM2882_BOARD_DIKOM_DK300:
-       case EM2882_BOARD_KWORLD_VS_DVBT:
-               ctl->demod = XC3028_FE_CHINA;
-               ctl->fname = XC2028_DEFAULT_FIRMWARE;
-               break;
-       case EM2882_BOARD_EVGA_INDTUBE:
-               ctl->demod = XC3028_FE_CHINA;
-               ctl->fname = XC3028L_DEFAULT_FIRMWARE;
-               break;
-       default:
-               ctl->demod = XC3028_FE_OREN538;
-       }
-}
-
 static void em28xx_tuner_setup(struct em28xx *dev)
 {
        struct tuner_setup           tun_setup;
index e76f993e319547d0c42647c5eb33732326660be0..5d5d1b6f029446792e500f637c3a36eae3274b49 100644 (file)
@@ -762,6 +762,7 @@ void em28xx_close_extension(struct em28xx *dev);
 extern struct em28xx_board em28xx_boards[];
 extern struct usb_device_id em28xx_id_table[];
 int em28xx_tuner_callback(void *ptr, int component, int command, int arg);
+void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl);
 void em28xx_release_resources(struct em28xx *dev);
 
 /* Provided by em28xx-camera.c */