aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb/digitv.c
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2007-06-02 15:30:46 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-07-18 13:24:15 -0400
commit4ce15678926cef4886df46964142fc2520c216cd (patch)
tree6f3b02ff93f688646a2b53f4d9af7157306b7c16 /drivers/media/dvb/dvb-usb/digitv.c
parentb784e526a8333db57d1b9f385a12553066bdba64 (diff)
V4L/DVB (5777): Dvb-pll digitv dvb-usb: Eliminate last user of dvb_pll_configure
The last user of dvb_pll_configure was the dvb-usb function dvb_usb_tuner_calc_regs(), which was nothing more than a wrapper around dvb_pll_configure(). It's just a copy of the functionality provided by the tuner_ops calc_regs method, and can be deleted. There were two users of dvb_usb_tuner_calc_regs(). One was dvb_usb_tuner_set_params_i2c(), which is converted to use fe->ops.tuner_ops.calc_regs(). The other was the digitv driver. This driver can use one of two demods, mt352 or nxt6000. For the mt352, the driver would set tuner_ops.calc_regs to dvb_usb_tuner_calc_regs(). We can just attach dvb_pll and use the tuner_ops.calc_regs() provided by that module. For the nxt600, the driver would set tuner_ops.set_params to digitv_nxt6000_tuner_set_params. That function would in turn use dvb_usb_tuner_calc_regs(). We convert it to use tuner_ops.calc_regs() instead, and use dvb_pll_attach. The digitv_tuner_attach() needs to know which frontend was attached by digitv_frontend_attach(), since the nxt6000 needs tuner_ops.set_params() to be overridden with digitv_nxt6000_tuner_set_params(). So, to do this a digitv_state that says which frontend was used is added to the dvb_usb_device private state field. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/dvb-usb/digitv.c')
-rw-r--r--drivers/media/dvb/dvb-usb/digitv.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/media/dvb/dvb-usb/digitv.c b/drivers/media/dvb/dvb-usb/digitv.c
index b5acb11c0bc9..36e0f8fee37a 100644
--- a/drivers/media/dvb/dvb-usb/digitv.c
+++ b/drivers/media/dvb/dvb-usb/digitv.c
@@ -118,7 +118,8 @@ static int digitv_nxt6000_tuner_set_params(struct dvb_frontend *fe, struct dvb_f
118{ 118{
119 struct dvb_usb_adapter *adap = fe->dvb->priv; 119 struct dvb_usb_adapter *adap = fe->dvb->priv;
120 u8 b[5]; 120 u8 b[5];
121 dvb_usb_tuner_calc_regs(fe,fep,b, 5); 121
122 fe->ops.tuner_ops.calc_regs(fe, fep, b, sizeof(b));
122 if (fe->ops.i2c_gate_ctrl) 123 if (fe->ops.i2c_gate_ctrl)
123 fe->ops.i2c_gate_ctrl(fe, 1); 124 fe->ops.i2c_gate_ctrl(fe, 1);
124 return digitv_ctrl_msg(adap->dev, USB_WRITE_TUNER, 0, &b[1], 4, NULL, 0); 125 return digitv_ctrl_msg(adap->dev, USB_WRITE_TUNER, 0, &b[1], 4, NULL, 0);
@@ -130,12 +131,14 @@ static struct nxt6000_config digitv_nxt6000_config = {
130 131
131static int digitv_frontend_attach(struct dvb_usb_adapter *adap) 132static int digitv_frontend_attach(struct dvb_usb_adapter *adap)
132{ 133{
134 struct digitv_state *st = adap->dev->priv;
135
133 if ((adap->fe = dvb_attach(mt352_attach, &digitv_mt352_config, &adap->dev->i2c_adap)) != NULL) { 136 if ((adap->fe = dvb_attach(mt352_attach, &digitv_mt352_config, &adap->dev->i2c_adap)) != NULL) {
134 adap->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs; 137 st->is_nxt6000 = 0;
135 return 0; 138 return 0;
136 } 139 }
137 if ((adap->fe = dvb_attach(nxt6000_attach, &digitv_nxt6000_config, &adap->dev->i2c_adap)) != NULL) { 140 if ((adap->fe = dvb_attach(nxt6000_attach, &digitv_nxt6000_config, &adap->dev->i2c_adap)) != NULL) {
138 adap->fe->ops.tuner_ops.set_params = digitv_nxt6000_tuner_set_params; 141 st->is_nxt6000 = 1;
139 return 0; 142 return 0;
140 } 143 }
141 return -EIO; 144 return -EIO;
@@ -143,8 +146,14 @@ static int digitv_frontend_attach(struct dvb_usb_adapter *adap)
143 146
144static int digitv_tuner_attach(struct dvb_usb_adapter *adap) 147static int digitv_tuner_attach(struct dvb_usb_adapter *adap)
145{ 148{
146 adap->pll_addr = 0x60; 149 struct digitv_state *st = adap->dev->priv;
147 adap->pll_desc = &dvb_pll_tded4; 150
151 if (!dvb_attach(dvb_pll_attach, adap->fe, 0x60, NULL, &dvb_pll_tded4))
152 return -ENODEV;
153
154 if (st->is_nxt6000)
155 adap->fe->ops.tuner_ops.set_params = digitv_nxt6000_tuner_set_params;
156
148 return 0; 157 return 0;
149} 158}
150 159
@@ -273,6 +282,8 @@ static struct dvb_usb_device_properties digitv_properties = {
273 .usb_ctrl = CYPRESS_FX2, 282 .usb_ctrl = CYPRESS_FX2,
274 .firmware = "dvb-usb-digitv-02.fw", 283 .firmware = "dvb-usb-digitv-02.fw",
275 284
285 .size_of_priv = sizeof(struct digitv_state),
286
276 .num_adapters = 1, 287 .num_adapters = 1,
277 .adapter = { 288 .adapter = {
278 { 289 {