Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Michael Krufky and committed by
Mauro Carvalho Chehab
6f4a5729 22ef8fc9

+76
+48
drivers/media/video/tuner-simple.c
··· 810 810 return ret; 811 811 } 812 812 813 + static 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 + 836 + static 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 + 813 859 static int simple_release(struct dvb_frontend *fe) 814 860 { 815 861 struct tuner_simple_priv *priv = fe->tuner_priv; ··· 887 841 } 888 842 889 843 static struct dvb_tuner_ops simple_tuner_ops = { 844 + .init = simple_init, 845 + .sleep = simple_sleep, 890 846 .set_analog_params = simple_set_params, 891 847 .set_params = simple_dvb_set_params, 892 848 .calc_regs = simple_dvb_calc_regs,
+25
drivers/media/video/tuner-types.c
··· 35 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 + */ 50 + static 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 + */ 57 + static u8 tua603x_agc112[] = { 2, 0x80|0x40|0x18|0x04|0x01, 0x80|0x20 }; 58 + 38 59 /* 0-9 */ 39 60 /* ------------ TUNER_TEMIC_PAL - TEMIC PAL ------------ */ 40 61 ··· 1446 1425 .min = 16 * 57.00, 1447 1426 .max = 16 * 863.00, 1448 1427 .stepsize = 62500, 1428 + .initdata = tua603x_agc103, 1449 1429 }, 1450 1430 [TUNER_TENA_9533_DI] = { /* Philips PAL */ 1451 1431 .name = "Tena TNF9533-D/IF/TNF9533-B/DF", ··· 1461 1439 .name = "Philips FMD1216ME MK3 Hybrid Tuner", 1462 1440 .params = tuner_philips_fmd1216me_mk3_params, 1463 1441 .count = ARRAY_SIZE(tuner_philips_fmd1216me_mk3_params), 1442 + .initdata = tua603x_agc112, 1443 + .sleepdata = (u8[]){ 4, 0x9c, 0x60, 0x85, 0x54 }, 1464 1444 }, 1465 1445 [TUNER_LG_TDVS_H06XF] = { /* LGINNOTEK ATSC */ 1466 1446 .name = "LG TDVS-H06xF", /* H061F, H062F & H064F */ ··· 1471 1447 .min = 16 * 54.00, 1472 1448 .max = 16 * 863.00, 1473 1449 .stepsize = 62500, 1450 + .initdata = tua603x_agc103, 1474 1451 }, 1475 1452 [TUNER_YMEC_TVF66T5_B_DFF] = { /* Philips PAL */ 1476 1453 .name = "Ymec TVF66T5-B/DFF",
+3
include/media/tuner-types.h
··· 120 120 u16 min; 121 121 u16 max; 122 122 u16 stepsize; 123 + 124 + u8 *initdata; 125 + u8 *sleepdata; 123 126 }; 124 127 125 128 extern struct tunertype tuners[];