aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2008-04-22 13:45:53 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 13:07:50 -0400
commit6f4a57292f4f0a0fef5e4e39cb394fedcf2acf9f (patch)
tree7808cee65ac46fed106b3078213ca422cbe2cee7
parent22ef8fc945b28398d93a5d362e54915b66eba23f (diff)
V4L/DVB (7351): tuner-simple: add init and sleep methods
taken from dvb-pll Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/video/tuner-simple.c48
-rw-r--r--drivers/media/video/tuner-types.c25
-rw-r--r--include/media/tuner-types.h3
3 files changed, 76 insertions, 0 deletions
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
index 3ec76391a60d..3a27d4a8ce38 100644
--- a/drivers/media/video/tuner-simple.c
+++ b/drivers/media/video/tuner-simple.c
@@ -810,6 +810,52 @@ fail:
810 return ret; 810 return ret;
811} 811}
812 812
813static int simple_init(struct dvb_frontend *fe)
814{
815 struct tuner_simple_priv *priv = fe->tuner_priv;
816
817 if (priv->i2c_props.adap == NULL)
818 return -EINVAL;
819
820 if (priv->tun->initdata) {
821 int ret;
822
823 if (fe->ops.i2c_gate_ctrl)
824 fe->ops.i2c_gate_ctrl(fe, 1);
825
826 ret = tuner_i2c_xfer_send(&priv->i2c_props,
827 priv->tun->initdata + 1,
828 priv->tun->initdata[0]);
829 if (ret != priv->tun->initdata[0])
830 return ret;
831 }
832
833 return 0;
834}
835
836static int simple_sleep(struct dvb_frontend *fe)
837{
838 struct tuner_simple_priv *priv = fe->tuner_priv;
839
840 if (priv->i2c_props.adap == NULL)
841 return -EINVAL;
842
843 if (priv->tun->sleepdata) {
844 int ret;
845
846 if (fe->ops.i2c_gate_ctrl)
847 fe->ops.i2c_gate_ctrl(fe, 1);
848
849 ret = tuner_i2c_xfer_send(&priv->i2c_props,
850 priv->tun->sleepdata + 1,
851 priv->tun->sleepdata[0]);
852 if (ret != priv->tun->sleepdata[0])
853 return ret;
854 }
855
856 return 0;
857}
858
813static int simple_release(struct dvb_frontend *fe) 859static int simple_release(struct dvb_frontend *fe)
814{ 860{
815 struct tuner_simple_priv *priv = fe->tuner_priv; 861 struct tuner_simple_priv *priv = fe->tuner_priv;
@@ -841,6 +887,8 @@ static int simple_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
841} 887}
842 888
843static struct dvb_tuner_ops simple_tuner_ops = { 889static struct dvb_tuner_ops simple_tuner_ops = {
890 .init = simple_init,
891 .sleep = simple_sleep,
844 .set_analog_params = simple_set_params, 892 .set_analog_params = simple_set_params,
845 .set_params = simple_dvb_set_params, 893 .set_params = simple_dvb_set_params,
846 .calc_regs = simple_dvb_calc_regs, 894 .calc_regs = simple_dvb_calc_regs,
diff --git a/drivers/media/video/tuner-types.c b/drivers/media/video/tuner-types.c
index 8b53d0d05b23..13c76a57d8e2 100644
--- a/drivers/media/video/tuner-types.c
+++ b/drivers/media/video/tuner-types.c
@@ -35,6 +35,27 @@
35 * based on the video standard in use. 35 * based on the video standard in use.
36 */ 36 */
37 37
38/* The following was taken from dvb-pll.c: */
39
40/* Set AGC TOP value to 103 dBuV:
41 * 0x80 = Control Byte
42 * 0x40 = 250 uA charge pump (irrelevant)
43 * 0x18 = Aux Byte to follow
44 * 0x06 = 64.5 kHz divider (irrelevant)
45 * 0x01 = Disable Vt (aka sleep)
46 *
47 * 0x00 = AGC Time constant 2s Iagc = 300 nA (vs 0x80 = 9 nA)
48 * 0x50 = AGC Take over point = 103 dBuV
49 */
50static u8 tua603x_agc103[] = { 2, 0x80|0x40|0x18|0x06|0x01, 0x00|0x50 };
51
52/* 0x04 = 166.67 kHz divider
53 *
54 * 0x80 = AGC Time constant 50ms Iagc = 9 uA
55 * 0x20 = AGC Take over point = 112 dBuV
56 */
57static u8 tua603x_agc112[] = { 2, 0x80|0x40|0x18|0x04|0x01, 0x80|0x20 };
58
38/* 0-9 */ 59/* 0-9 */
39/* ------------ TUNER_TEMIC_PAL - TEMIC PAL ------------ */ 60/* ------------ TUNER_TEMIC_PAL - TEMIC PAL ------------ */
40 61
@@ -1425,6 +1446,7 @@ struct tunertype tuners[] = {
1425 .min = 16 * 57.00, 1446 .min = 16 * 57.00,
1426 .max = 16 * 863.00, 1447 .max = 16 * 863.00,
1427 .stepsize = 62500, 1448 .stepsize = 62500,
1449 .initdata = tua603x_agc103,
1428 }, 1450 },
1429 [TUNER_TENA_9533_DI] = { /* Philips PAL */ 1451 [TUNER_TENA_9533_DI] = { /* Philips PAL */
1430 .name = "Tena TNF9533-D/IF/TNF9533-B/DF", 1452 .name = "Tena TNF9533-D/IF/TNF9533-B/DF",
@@ -1439,6 +1461,8 @@ struct tunertype tuners[] = {
1439 .name = "Philips FMD1216ME MK3 Hybrid Tuner", 1461 .name = "Philips FMD1216ME MK3 Hybrid Tuner",
1440 .params = tuner_philips_fmd1216me_mk3_params, 1462 .params = tuner_philips_fmd1216me_mk3_params,
1441 .count = ARRAY_SIZE(tuner_philips_fmd1216me_mk3_params), 1463 .count = ARRAY_SIZE(tuner_philips_fmd1216me_mk3_params),
1464 .initdata = tua603x_agc112,
1465 .sleepdata = (u8[]){ 4, 0x9c, 0x60, 0x85, 0x54 },
1442 }, 1466 },
1443 [TUNER_LG_TDVS_H06XF] = { /* LGINNOTEK ATSC */ 1467 [TUNER_LG_TDVS_H06XF] = { /* LGINNOTEK ATSC */
1444 .name = "LG TDVS-H06xF", /* H061F, H062F & H064F */ 1468 .name = "LG TDVS-H06xF", /* H061F, H062F & H064F */
@@ -1447,6 +1471,7 @@ struct tunertype tuners[] = {
1447 .min = 16 * 54.00, 1471 .min = 16 * 54.00,
1448 .max = 16 * 863.00, 1472 .max = 16 * 863.00,
1449 .stepsize = 62500, 1473 .stepsize = 62500,
1474 .initdata = tua603x_agc103,
1450 }, 1475 },
1451 [TUNER_YMEC_TVF66T5_B_DFF] = { /* Philips PAL */ 1476 [TUNER_YMEC_TVF66T5_B_DFF] = { /* Philips PAL */
1452 .name = "Ymec TVF66T5-B/DFF", 1477 .name = "Ymec TVF66T5-B/DFF",
diff --git a/include/media/tuner-types.h b/include/media/tuner-types.h
index 4b5e5cf780c8..fda12093cab3 100644
--- a/include/media/tuner-types.h
+++ b/include/media/tuner-types.h
@@ -120,6 +120,9 @@ struct tunertype {
120 u16 min; 120 u16 min;
121 u16 max; 121 u16 max;
122 u16 stepsize; 122 u16 stepsize;
123
124 u8 *initdata;
125 u8 *sleepdata;
123}; 126};
124 127
125extern struct tunertype tuners[]; 128extern struct tunertype tuners[];