[media] media: dvb-frontends: ts2020: Added in a option for frequency divider value...
authorJohn Horan <knasher@gmail.com>
Wed, 28 Aug 2013 12:37:37 +0000 (09:37 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Wed, 2 Oct 2013 09:48:14 +0000 (06:48 -0300)
When the tuner part of the ds3000 driver was split to share code with the m88rs2000 driver, the ts2020 driver used
the frequency divider value from the m88rs2000 driver.  However the ds3000 driver requires a different value, and this
resulted in some frequecies being invisible to the tuner.  This patch adds back in the value needed for the ds3000 driver
and configured as an option in the dw2102 frontend driver.
It may also apply to su3000 devices, which use the same ds3000 driver, but for now it is only applied to the s660 device.

Signed-off-by: John Horan <knasher@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/dvb-frontends/ts2020.c
drivers/media/dvb-frontends/ts2020.h
drivers/media/usb/dvb-usb/dw2102.c

index ad7ad857ab2a9effdfc9a087c8c03ec3076db976..678f13ac4503ec55b756b83cd97577442fbc2b0c 100644 (file)
@@ -31,6 +31,7 @@ struct ts2020_priv {
        struct i2c_adapter *i2c;
        u8 clk_out_div;
        u32 frequency;
+       u32 frequency_div;
 };
 
 static int ts2020_release(struct dvb_frontend *fe)
@@ -193,7 +194,7 @@ static int ts2020_set_params(struct dvb_frontend *fe)
        u8 lo = 0x01, div4 = 0x0;
 
        /* Calculate frequency divider */
-       if (frequency < 1060000) {
+       if (frequency < priv->frequency_div) {
                lo |= 0x10;
                div4 = 0x1;
                ndiv = (frequency * 14 * 4) / TS2020_XTAL_FREQ;
@@ -340,6 +341,7 @@ struct dvb_frontend *ts2020_attach(struct dvb_frontend *fe,
        priv->i2c_address = config->tuner_address;
        priv->i2c = i2c;
        priv->clk_out_div = config->clk_out_div;
+       priv->frequency_div = config->frequency_div;
        fe->tuner_priv = priv;
 
        /* Wake Up the tuner */
index 5bcb9a71ca80ea6bca28ec1f3b12a47aa13eb13e..b2fe6bb3a38b0c425d2d31b167351382f1cae2dd 100644 (file)
@@ -28,6 +28,7 @@
 struct ts2020_config {
        u8 tuner_address;
        u8 clk_out_div;
+       u32 frequency_div;
 };
 
 #if IS_ENABLED(CONFIG_DVB_TS2020)
index 6e237b6dd0a8d8acb5bba115152e5b060775e680..6136a2c7dbfd20b31fd468b8e094b2bb672b3bc1 100644 (file)
@@ -955,9 +955,10 @@ static struct ds3000_config dw2104_ds3000_config = {
        .demod_address = 0x68,
 };
 
-static struct ts2020_config dw2104_ts2020_config  = {
+static struct ts2020_config dw2104_ts2020_config = {
        .tuner_address = 0x60,
        .clk_out_div = 1,
+       .frequency_div = 1060000,
 };
 
 static struct ds3000_config s660_ds3000_config = {
@@ -966,6 +967,12 @@ static struct ds3000_config s660_ds3000_config = {
        .set_lock_led = dw210x_led_ctrl,
 };
 
+static struct ts2020_config s660_ts2020_config = {
+       .tuner_address = 0x60,
+       .clk_out_div = 1,
+       .frequency_div = 1146000,
+};
+
 static struct stv0900_config dw2104a_stv0900_config = {
        .demod_address = 0x6a,
        .demod_mode = 0,
@@ -1205,7 +1212,7 @@ static int ds3000_frontend_attach(struct dvb_usb_adapter *d)
        if (d->fe_adap[0].fe == NULL)
                return -EIO;
 
-       dvb_attach(ts2020_attach, d->fe_adap[0].fe, &dw2104_ts2020_config,
+       dvb_attach(ts2020_attach, d->fe_adap[0].fe, &s660_ts2020_config,
                &d->dev->i2c_adap);
 
        st->old_set_voltage = d->fe_adap[0].fe->ops.set_voltage;
@@ -1213,7 +1220,7 @@ static int ds3000_frontend_attach(struct dvb_usb_adapter *d)
 
        dw210x_op_rw(d->dev->udev, 0x8a, 0, 0, obuf, 2, DW210X_WRITE_MSG);
 
-       info("Attached ds3000+ds2020!\n");
+       info("Attached ds3000+ts2020!\n");
 
        return 0;
 }