aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Horan <knasher@gmail.com>2013-08-28 08:37:37 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2013-10-02 05:48:14 -0400
commit03a6727995df6dbef6e0054761e75ecc68b3a6d2 (patch)
treee50e81ea9c022355bcb2429930f2638949bfeab6
parentd7f74c0310c3245052d4b8f6b92d8fc628785e76 (diff)
[media] media: dvb-frontends: ts2020: Added in a option for frequency divider value for s600 devices
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>
-rw-r--r--drivers/media/dvb-frontends/ts2020.c4
-rw-r--r--drivers/media/dvb-frontends/ts2020.h1
-rw-r--r--drivers/media/usb/dvb-usb/dw2102.c13
3 files changed, 14 insertions, 4 deletions
diff --git a/drivers/media/dvb-frontends/ts2020.c b/drivers/media/dvb-frontends/ts2020.c
index ad7ad857ab2a..678f13ac4503 100644
--- a/drivers/media/dvb-frontends/ts2020.c
+++ b/drivers/media/dvb-frontends/ts2020.c
@@ -31,6 +31,7 @@ struct ts2020_priv {
31 struct i2c_adapter *i2c; 31 struct i2c_adapter *i2c;
32 u8 clk_out_div; 32 u8 clk_out_div;
33 u32 frequency; 33 u32 frequency;
34 u32 frequency_div;
34}; 35};
35 36
36static int ts2020_release(struct dvb_frontend *fe) 37static int ts2020_release(struct dvb_frontend *fe)
@@ -193,7 +194,7 @@ static int ts2020_set_params(struct dvb_frontend *fe)
193 u8 lo = 0x01, div4 = 0x0; 194 u8 lo = 0x01, div4 = 0x0;
194 195
195 /* Calculate frequency divider */ 196 /* Calculate frequency divider */
196 if (frequency < 1060000) { 197 if (frequency < priv->frequency_div) {
197 lo |= 0x10; 198 lo |= 0x10;
198 div4 = 0x1; 199 div4 = 0x1;
199 ndiv = (frequency * 14 * 4) / TS2020_XTAL_FREQ; 200 ndiv = (frequency * 14 * 4) / TS2020_XTAL_FREQ;
@@ -340,6 +341,7 @@ struct dvb_frontend *ts2020_attach(struct dvb_frontend *fe,
340 priv->i2c_address = config->tuner_address; 341 priv->i2c_address = config->tuner_address;
341 priv->i2c = i2c; 342 priv->i2c = i2c;
342 priv->clk_out_div = config->clk_out_div; 343 priv->clk_out_div = config->clk_out_div;
344 priv->frequency_div = config->frequency_div;
343 fe->tuner_priv = priv; 345 fe->tuner_priv = priv;
344 346
345 /* Wake Up the tuner */ 347 /* Wake Up the tuner */
diff --git a/drivers/media/dvb-frontends/ts2020.h b/drivers/media/dvb-frontends/ts2020.h
index 5bcb9a71ca80..b2fe6bb3a38b 100644
--- a/drivers/media/dvb-frontends/ts2020.h
+++ b/drivers/media/dvb-frontends/ts2020.h
@@ -28,6 +28,7 @@
28struct ts2020_config { 28struct ts2020_config {
29 u8 tuner_address; 29 u8 tuner_address;
30 u8 clk_out_div; 30 u8 clk_out_div;
31 u32 frequency_div;
31}; 32};
32 33
33#if IS_ENABLED(CONFIG_DVB_TS2020) 34#if IS_ENABLED(CONFIG_DVB_TS2020)
diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c
index 6e237b6dd0a8..6136a2c7dbfd 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -955,9 +955,10 @@ static struct ds3000_config dw2104_ds3000_config = {
955 .demod_address = 0x68, 955 .demod_address = 0x68,
956}; 956};
957 957
958static struct ts2020_config dw2104_ts2020_config = { 958static struct ts2020_config dw2104_ts2020_config = {
959 .tuner_address = 0x60, 959 .tuner_address = 0x60,
960 .clk_out_div = 1, 960 .clk_out_div = 1,
961 .frequency_div = 1060000,
961}; 962};
962 963
963static struct ds3000_config s660_ds3000_config = { 964static struct ds3000_config s660_ds3000_config = {
@@ -966,6 +967,12 @@ static struct ds3000_config s660_ds3000_config = {
966 .set_lock_led = dw210x_led_ctrl, 967 .set_lock_led = dw210x_led_ctrl,
967}; 968};
968 969
970static struct ts2020_config s660_ts2020_config = {
971 .tuner_address = 0x60,
972 .clk_out_div = 1,
973 .frequency_div = 1146000,
974};
975
969static struct stv0900_config dw2104a_stv0900_config = { 976static struct stv0900_config dw2104a_stv0900_config = {
970 .demod_address = 0x6a, 977 .demod_address = 0x6a,
971 .demod_mode = 0, 978 .demod_mode = 0,
@@ -1205,7 +1212,7 @@ static int ds3000_frontend_attach(struct dvb_usb_adapter *d)
1205 if (d->fe_adap[0].fe == NULL) 1212 if (d->fe_adap[0].fe == NULL)
1206 return -EIO; 1213 return -EIO;
1207 1214
1208 dvb_attach(ts2020_attach, d->fe_adap[0].fe, &dw2104_ts2020_config, 1215 dvb_attach(ts2020_attach, d->fe_adap[0].fe, &s660_ts2020_config,
1209 &d->dev->i2c_adap); 1216 &d->dev->i2c_adap);
1210 1217
1211 st->old_set_voltage = d->fe_adap[0].fe->ops.set_voltage; 1218 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)
1213 1220
1214 dw210x_op_rw(d->dev->udev, 0x8a, 0, 0, obuf, 2, DW210X_WRITE_MSG); 1221 dw210x_op_rw(d->dev->udev, 0x8a, 0, 0, obuf, 2, DW210X_WRITE_MSG);
1215 1222
1216 info("Attached ds3000+ds2020!\n"); 1223 info("Attached ds3000+ts2020!\n");
1217 1224
1218 return 0; 1225 return 0;
1219} 1226}