aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAndrew de Quincey <adq_dvb@lidskialf.net>2006-04-18 16:47:11 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-06-25 00:59:10 -0400
commitee6a2cb65c67c3d87478469f04fd023632dca345 (patch)
treede62a3ead3349c8f38a75b9cdbb4c906347cf319 /drivers
parent651b81be154ccf001890e77fbd45cdcac079e253 (diff)
V4L/DVB (3881): Convert core dvb-usb pll code to refactored tuner code
Rename pll calls to appropriate tuner calls. Add pll gate control calls where appropriate. Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-i2c.c24
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb.h6
2 files changed, 18 insertions, 12 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);
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h
index fead958a57e3..311acb43e4c8 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb.h
@@ -330,9 +330,9 @@ extern int dvb_usb_generic_write(struct dvb_usb_device *, u8 *, u16);
330extern int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *, u8[], u32 *, int *); 330extern int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *, u8[], u32 *, int *);
331 331
332/* commonly used pll init and set functions */ 332/* commonly used pll init and set functions */
333extern int dvb_usb_pll_init_i2c(struct dvb_frontend *); 333extern int dvb_usb_tuner_init_i2c(struct dvb_frontend *);
334extern int dvb_usb_pll_set(struct dvb_frontend *, struct dvb_frontend_parameters *, u8[]); 334extern int dvb_usb_tuner_pllbuf(struct dvb_frontend *, struct dvb_frontend_parameters *, u8 *buf, int buf_len);
335extern int dvb_usb_pll_set_i2c(struct dvb_frontend *, struct dvb_frontend_parameters *); 335extern int dvb_usb_tuner_set_params_i2c(struct dvb_frontend *, struct dvb_frontend_parameters *);
336 336
337/* commonly used firmware download types and function */ 337/* commonly used firmware download types and function */
338struct hexline { 338struct hexline {