Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[pandora-kernel.git] / drivers / media / dvb / ttpci / budget.c
index 1500210..874a10a 100644 (file)
@@ -442,6 +442,7 @@ static struct stv090x_config tt1600_stv090x_config = {
        .repeater_level         = STV090x_RPTLEVEL_16,
 
        .tuner_init             = NULL,
+       .tuner_sleep            = NULL,
        .tuner_set_mode         = NULL,
        .tuner_set_frequency    = NULL,
        .tuner_get_frequency    = NULL,
@@ -627,22 +628,36 @@ static void frontend_init(struct budget *budget)
                                                 &tt1600_stv6110x_config,
                                                 &budget->i2c_adap);
 
-                               tt1600_stv090x_config.tuner_init          = ctl->tuner_init;
-                               tt1600_stv090x_config.tuner_set_mode      = ctl->tuner_set_mode;
-                               tt1600_stv090x_config.tuner_set_frequency = ctl->tuner_set_frequency;
-                               tt1600_stv090x_config.tuner_get_frequency = ctl->tuner_get_frequency;
-                               tt1600_stv090x_config.tuner_set_bandwidth = ctl->tuner_set_bandwidth;
-                               tt1600_stv090x_config.tuner_get_bandwidth = ctl->tuner_get_bandwidth;
-                               tt1600_stv090x_config.tuner_set_bbgain    = ctl->tuner_set_bbgain;
-                               tt1600_stv090x_config.tuner_get_bbgain    = ctl->tuner_get_bbgain;
-                               tt1600_stv090x_config.tuner_set_refclk    = ctl->tuner_set_refclk;
-                               tt1600_stv090x_config.tuner_get_status    = ctl->tuner_get_status;
-
-                               dvb_attach(isl6423_attach,
-                                       budget->dvb_frontend,
-                                       &budget->i2c_adap,
-                                       &tt1600_isl6423_config);
-
+                               if (ctl) {
+                                       tt1600_stv090x_config.tuner_init          = ctl->tuner_init;
+                                       tt1600_stv090x_config.tuner_sleep         = ctl->tuner_sleep;
+                                       tt1600_stv090x_config.tuner_set_mode      = ctl->tuner_set_mode;
+                                       tt1600_stv090x_config.tuner_set_frequency = ctl->tuner_set_frequency;
+                                       tt1600_stv090x_config.tuner_get_frequency = ctl->tuner_get_frequency;
+                                       tt1600_stv090x_config.tuner_set_bandwidth = ctl->tuner_set_bandwidth;
+                                       tt1600_stv090x_config.tuner_get_bandwidth = ctl->tuner_get_bandwidth;
+                                       tt1600_stv090x_config.tuner_set_bbgain    = ctl->tuner_set_bbgain;
+                                       tt1600_stv090x_config.tuner_get_bbgain    = ctl->tuner_get_bbgain;
+                                       tt1600_stv090x_config.tuner_set_refclk    = ctl->tuner_set_refclk;
+                                       tt1600_stv090x_config.tuner_get_status    = ctl->tuner_get_status;
+
+                                       /* call the init function once to initialize
+                                          tuner's clock output divider and demod's
+                                          master clock */
+                                       if (budget->dvb_frontend->ops.init)
+                                               budget->dvb_frontend->ops.init(budget->dvb_frontend);
+
+                                       if (dvb_attach(isl6423_attach,
+                                                      budget->dvb_frontend,
+                                                      &budget->i2c_adap,
+                                                      &tt1600_isl6423_config) == NULL) {
+                                               printk(KERN_ERR "%s: No Intersil ISL6423 found!\n", __func__);
+                                               goto error_out;
+                                       }
+                               } else {
+                                       printk(KERN_ERR "%s: No STV6110(A) Silicon Tuner found!\n", __func__);
+                                       goto error_out;
+                               }
                        }
                }
                break;