aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/dvb-usb/dvb-usb-i2c.c')
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-i2c.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c b/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
index 9b254532af4d..b067c72f8356 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
@@ -46,7 +46,7 @@ int dvb_usb_i2c_exit(struct dvb_usb_device *d)
46 return 0; 46 return 0;
47} 47}
48 48
49int dvb_usb_pll_init_i2c(struct dvb_frontend *fe) 49int dvb_usb_tuner_init_i2c(struct dvb_frontend *fe)
50{ 50{
51 struct dvb_usb_device *d = fe->dvb->priv; 51 struct dvb_usb_device *d = fe->dvb->priv;
52 struct i2c_msg msg = { .addr = d->pll_addr, .flags = 0, .buf = d->pll_init, .len = 4 }; 52 struct i2c_msg msg = { .addr = d->pll_addr, .flags = 0, .buf = d->pll_init, .len = 4 };
@@ -63,6 +63,8 @@ int dvb_usb_pll_init_i2c(struct dvb_frontend *fe)
63 deb_pll("pll-buf: %x %x %x %x\n",d->pll_init[0],d->pll_init[1], 63 deb_pll("pll-buf: %x %x %x %x\n",d->pll_init[0],d->pll_init[1],
64 d->pll_init[2],d->pll_init[3]); 64 d->pll_init[2],d->pll_init[3]);
65 65
66 if (fe->ops->i2c_gate_ctrl)
67 fe->ops->i2c_gate_ctrl(fe, 1);
66 if (i2c_transfer (&d->i2c_adap, &msg, 1) != 1) { 68 if (i2c_transfer (&d->i2c_adap, &msg, 1) != 1) {
67 err("tuner i2c write failed for pll_init."); 69 err("tuner i2c write failed for pll_init.");
68 ret = -EREMOTEIO; 70 ret = -EREMOTEIO;
@@ -73,38 +75,42 @@ int dvb_usb_pll_init_i2c(struct dvb_frontend *fe)
73 d->tuner_pass_ctrl(fe,0,d->pll_addr); 75 d->tuner_pass_ctrl(fe,0,d->pll_addr);
74 return ret; 76 return ret;
75} 77}
76EXPORT_SYMBOL(dvb_usb_pll_init_i2c); 78EXPORT_SYMBOL(dvb_usb_tuner_init_i2c);
77 79
78int dvb_usb_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep, u8 b[5]) 80int dvb_usb_tuner_pllbuf(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep, u8 *b, int buf_len)
79{ 81{
80 struct dvb_usb_device *d = fe->dvb->priv; 82 struct dvb_usb_device *d = fe->dvb->priv;
81 83
84 if (buf_len != 5)
85 return -EINVAL;
82 if (d->pll_desc == NULL) 86 if (d->pll_desc == NULL)
83 return 0; 87 return 0;
84 88
85 deb_pll("pll addr: %x, freq: %d %p\n",d->pll_addr,fep->frequency,d->pll_desc); 89 deb_pll("pll addr: %x, freq: %d %p\n",d->pll_addr,fep->frequency,d->pll_desc);
86 90
87 b[0] = d->pll_addr << 1; 91 b[0] = d->pll_addr;
88 dvb_pll_configure(d->pll_desc,&b[1],fep->frequency,fep->u.ofdm.bandwidth); 92 dvb_pll_configure(d->pll_desc,&b[1],fep->frequency,fep->u.ofdm.bandwidth);
89 93
90 deb_pll("pll-buf: %x %x %x %x %x\n",b[0],b[1],b[2],b[3],b[4]); 94 deb_pll("pll-buf: %x %x %x %x %x\n",b[0],b[1],b[2],b[3],b[4]);
91 95
92 return 0; 96 return 5;
93} 97}
94EXPORT_SYMBOL(dvb_usb_pll_set); 98EXPORT_SYMBOL(dvb_usb_tuner_pllbuf);
95 99
96int dvb_usb_pll_set_i2c(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep) 100int dvb_usb_tuner_set_frequency_i2c(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
97{ 101{
98 struct dvb_usb_device *d = fe->dvb->priv; 102 struct dvb_usb_device *d = fe->dvb->priv;
99 int ret = 0; 103 int ret = 0;
100 u8 b[5]; 104 u8 b[5];
101 struct i2c_msg msg = { .addr = d->pll_addr, .flags = 0, .buf = &b[1], .len = 4 }; 105 struct i2c_msg msg = { .addr = d->pll_addr, .flags = 0, .buf = &b[1], .len = 4 };
102 106
103 dvb_usb_pll_set(fe,fep,b); 107 dvb_usb_tuner_pllbuf(fe,fep,b,5);
104 108
105 if (d->tuner_pass_ctrl) 109 if (d->tuner_pass_ctrl)
106 d->tuner_pass_ctrl(fe,1,d->pll_addr); 110 d->tuner_pass_ctrl(fe,1,d->pll_addr);
107 111
112 if (fe->ops->i2c_gate_ctrl)
113 fe->ops->i2c_gate_ctrl(fe, 1);
108 if (i2c_transfer (&d->i2c_adap, &msg, 1) != 1) { 114 if (i2c_transfer (&d->i2c_adap, &msg, 1) != 1) {
109 err("tuner i2c write failed for pll_set."); 115 err("tuner i2c write failed for pll_set.");
110 ret = -EREMOTEIO; 116 ret = -EREMOTEIO;
@@ -116,4 +122,4 @@ int dvb_usb_pll_set_i2c(struct dvb_frontend *fe, struct dvb_frontend_parameters
116 122
117 return ret; 123 return ret;
118} 124}
119EXPORT_SYMBOL(dvb_usb_pll_set_i2c); 125EXPORT_SYMBOL(dvb_usb_tuner_set_frequency_i2c);