aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb/az6007.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2012-01-21 08:35:12 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-01-21 10:46:51 -0500
commit04e3ece7153054e2694a882f6ffa54941574049c (patch)
tree4283c789a83842c1437cc3c8cc04b212184b7715 /drivers/media/dvb/dvb-usb/az6007.c
parentb19280cf2bee7df489f9488bda45220f8518e39f (diff)
[media] az6007: Driver cleanup
Remove commented test code, remove unused poweroff stuff, and fix the copyright data. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/dvb-usb/az6007.c')
-rw-r--r--drivers/media/dvb/dvb-usb/az6007.c56
1 files changed, 13 insertions, 43 deletions
diff --git a/drivers/media/dvb/dvb-usb/az6007.c b/drivers/media/dvb/dvb-usb/az6007.c
index f0e4c013bb5d..534d3267c86e 100644
--- a/drivers/media/dvb/dvb-usb/az6007.c
+++ b/drivers/media/dvb/dvb-usb/az6007.c
@@ -7,8 +7,9 @@
7 * http://linux.terratec.de/files/TERRATEC_H7/20110323_TERRATEC_H7_Linux.tar.gz 7 * http://linux.terratec.de/files/TERRATEC_H7/20110323_TERRATEC_H7_Linux.tar.gz
8 * The original driver's license is GPL, as declared with MODULE_LICENSE() 8 * The original driver's license is GPL, as declared with MODULE_LICENSE()
9 * 9 *
10 * Driver modifiyed by Mauro Carvalho Chehab <mchehab@redhat.com> in order 10 * Copyright (c) 2010-2011 Mauro Carvalho Chehab <mchehab@redhat.com>
11 * to work with upstream drxk driver, and to fix some bugs. 11 * Driver modified by in order to work with upstream drxk driver, and
12 * tons of bugs got fixed.
12 * 13 *
13 * This program is free software; you can redistribute it and/or modify 14 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by 15 * it under the terms of the GNU General Public License as published by
@@ -58,7 +59,6 @@ struct az6007_device_state {
58 59
59 /* Due to DRX-K - probably need changes */ 60 /* Due to DRX-K - probably need changes */
60 int (*gate_ctrl) (struct dvb_frontend *, int); 61 int (*gate_ctrl) (struct dvb_frontend *, int);
61 struct semaphore pll_mutex;
62 bool tuner_attached; 62 bool tuner_attached;
63 63
64 unsigned char data[4096]; 64 unsigned char data[4096];
@@ -94,17 +94,11 @@ static int drxk_gate_ctrl(struct dvb_frontend *fe, int enable)
94 if (!st) 94 if (!st)
95 return -EINVAL; 95 return -EINVAL;
96 96
97 if (enable) { 97 if (enable)
98#if 0
99 down(&st->pll_mutex);
100#endif
101 status = st->gate_ctrl(fe, 1); 98 status = st->gate_ctrl(fe, 1);
102 } else { 99 else
103#if 0
104 status = st->gate_ctrl(fe, 0); 100 status = st->gate_ctrl(fe, 0);
105#endif 101
106 up(&st->pll_mutex);
107 }
108 return status; 102 return status;
109} 103}
110 104
@@ -221,14 +215,6 @@ static int az6007_rc_query(struct dvb_usb_device *d, u32 * event, int *state)
221 return 0; 215 return 0;
222} 216}
223 217
224#if 0
225int az6007_power_ctrl(struct dvb_usb_device *d, int onoff)
226{
227 u8 v = onoff;
228 return az6007_write(d->udev, AZ6007_POWER, v , 3, NULL, 1);
229}
230#endif
231
232static int az6007_read_mac_addr(struct dvb_usb_device *d, u8 mac[6]) 218static int az6007_read_mac_addr(struct dvb_usb_device *d, u8 mac[6])
233{ 219{
234 int ret; 220 int ret;
@@ -246,6 +232,7 @@ static int az6007_led_on_off(struct usb_interface *intf, int onoff)
246{ 232{
247 struct usb_device *udev = interface_to_usbdev(intf); 233 struct usb_device *udev = interface_to_usbdev(intf);
248 int ret; 234 int ret;
235
249 /* TS through */ 236 /* TS through */
250 ret = az6007_write(udev, AZ6007_POWER, onoff, 0, NULL, 0); 237 ret = az6007_write(udev, AZ6007_POWER, onoff, 0, NULL, 0);
251 if (ret < 0) 238 if (ret < 0)
@@ -257,8 +244,6 @@ static int az6007_frontend_attach(struct dvb_usb_adapter *adap)
257{ 244{
258 struct az6007_device_state *st = adap->dev->priv; 245 struct az6007_device_state *st = adap->dev->priv;
259 246
260 BUG_ON(!st);
261
262 deb_info("attaching demod drxk"); 247 deb_info("attaching demod drxk");
263 248
264 adap->fe_adap[0].fe = dvb_attach(drxk_attach, &terratec_h7_drxk, 249 adap->fe_adap[0].fe = dvb_attach(drxk_attach, &terratec_h7_drxk,
@@ -267,8 +252,6 @@ static int az6007_frontend_attach(struct dvb_usb_adapter *adap)
267 return -EINVAL; 252 return -EINVAL;
268 253
269 adap->fe_adap[0].fe->sec_priv = adap; 254 adap->fe_adap[0].fe->sec_priv = adap;
270 /* FIXME: do we need a pll semaphore? */
271 sema_init(&st->pll_mutex, 1);
272 st->gate_ctrl = adap->fe_adap[0].fe->ops.i2c_gate_ctrl; 255 st->gate_ctrl = adap->fe_adap[0].fe->ops.i2c_gate_ctrl;
273 adap->fe_adap[0].fe->ops.i2c_gate_ctrl = drxk_gate_ctrl; 256 adap->fe_adap[0].fe->ops.i2c_gate_ctrl = drxk_gate_ctrl;
274 257
@@ -282,9 +265,8 @@ static int az6007_tuner_attach(struct dvb_usb_adapter *adap)
282 if (st->tuner_attached) 265 if (st->tuner_attached)
283 return 0; 266 return 0;
284 267
285 st->tuner_attached = true;
286
287 deb_info("attaching tuner mt2063"); 268 deb_info("attaching tuner mt2063");
269
288 /* Attach mt2063 to DVB-C frontend */ 270 /* Attach mt2063 to DVB-C frontend */
289 if (adap->fe_adap[0].fe->ops.i2c_gate_ctrl) 271 if (adap->fe_adap[0].fe->ops.i2c_gate_ctrl)
290 adap->fe_adap[0].fe->ops.i2c_gate_ctrl(adap->fe_adap[0].fe, 1); 272 adap->fe_adap[0].fe->ops.i2c_gate_ctrl(adap->fe_adap[0].fe, 1);
@@ -296,6 +278,8 @@ static int az6007_tuner_attach(struct dvb_usb_adapter *adap)
296 if (adap->fe_adap[0].fe->ops.i2c_gate_ctrl) 278 if (adap->fe_adap[0].fe->ops.i2c_gate_ctrl)
297 adap->fe_adap[0].fe->ops.i2c_gate_ctrl(adap->fe_adap[0].fe, 0); 279 adap->fe_adap[0].fe->ops.i2c_gate_ctrl(adap->fe_adap[0].fe, 0);
298 280
281 st->tuner_attached = true;
282
299 return 0; 283 return 0;
300} 284}
301 285
@@ -355,25 +339,9 @@ int az6007_power_ctrl(struct dvb_usb_device *d, int onoff)
355 az6007_write(udev, AZ6007_POWER, 0, 0, NULL, 0); 339 az6007_write(udev, AZ6007_POWER, 0, 0, NULL, 0);
356 az6007_write(udev, AZ6007_TS_THROUGH, 0, 0, NULL, 0); 340 az6007_write(udev, AZ6007_TS_THROUGH, 0, 0, NULL, 0);
357 341
358#if 0
359 // Seems to be a poweroff sequence
360 az6007_write(udev, 0xbc, 1, 3, NULL, 0);
361 az6007_write(udev, 0xbc, 1, 4, NULL, 0);
362 az6007_write(udev, 0xc0, 0, 3, NULL, 0);
363 az6007_write(udev, 0xc0, 1, 3, NULL, 0);
364 az6007_write(udev, 0xbc, 0, 1, NULL, 0);
365#endif
366
367 return 0; 342 return 0;
368} 343}
369 344
370static struct dvb_usb_device_properties az6007_properties;
371
372static void az6007_usb_disconnect(struct usb_interface *intf)
373{
374 dvb_usb_device_exit(intf);
375}
376
377/* I2C */ 345/* I2C */
378static int az6007_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], 346static int az6007_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
379 int num) 347 int num)
@@ -513,6 +481,8 @@ int az6007_identify_state(struct usb_device *udev,
513 return 0; 481 return 0;
514} 482}
515 483
484static struct dvb_usb_device_properties az6007_properties;
485
516static int az6007_usb_probe(struct usb_interface *intf, 486static int az6007_usb_probe(struct usb_interface *intf,
517 const struct usb_device_id *id) 487 const struct usb_device_id *id)
518{ 488{
@@ -589,7 +559,6 @@ static struct usb_driver az6007_usb_driver = {
589 .name = "dvb_usb_az6007", 559 .name = "dvb_usb_az6007",
590 .probe = az6007_usb_probe, 560 .probe = az6007_usb_probe,
591 .disconnect = dvb_usb_device_exit, 561 .disconnect = dvb_usb_device_exit,
592 /* .disconnect = az6007_usb_disconnect, */
593 .id_table = az6007_usb_table, 562 .id_table = az6007_usb_table,
594}; 563};
595 564
@@ -619,6 +588,7 @@ module_init(az6007_usb_module_init);
619module_exit(az6007_usb_module_exit); 588module_exit(az6007_usb_module_exit);
620 589
621MODULE_AUTHOR("Henry Wang <Henry.wang@AzureWave.com>"); 590MODULE_AUTHOR("Henry Wang <Henry.wang@AzureWave.com>");
591MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
622MODULE_DESCRIPTION("Driver for AzureWave 6007 DVB-C/T USB2.0 and clones"); 592MODULE_DESCRIPTION("Driver for AzureWave 6007 DVB-C/T USB2.0 and clones");
623MODULE_VERSION("1.1"); 593MODULE_VERSION("1.1");
624MODULE_LICENSE("GPL"); 594MODULE_LICENSE("GPL");