aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb/az6007.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2011-07-25 10:07:20 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-01-21 10:45:36 -0500
commit81091144ebdb7bdc6197559cd3547d8be7e4e18e (patch)
treeaa53eb02c231805daf846aaa1c81428a436eb7a6 /drivers/media/dvb/dvb-usb/az6007.c
parentc108a5a0ef1fc20f7ae36318dd154f40dcf1d345 (diff)
[media] az6007: Fix some init sequences and use the right firmwares
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.c105
1 files changed, 43 insertions, 62 deletions
diff --git a/drivers/media/dvb/dvb-usb/az6007.c b/drivers/media/dvb/dvb-usb/az6007.c
index 87dff933289c..03e318d2d4bf 100644
--- a/drivers/media/dvb/dvb-usb/az6007.c
+++ b/drivers/media/dvb/dvb-usb/az6007.c
@@ -56,7 +56,8 @@ static struct drxk_config terratec_h7_drxk = {
56 .single_master = 1, 56 .single_master = 1,
57 .no_i2c_bridge = 0, 57 .no_i2c_bridge = 0,
58 .max_size = 64, 58 .max_size = 64,
59// .microcode_name = "dvb-usb-terratec-h5-drxk.fw", 59 .microcode_name = "dvb-usb-terratec-h7-drxk.fw",
60 .parallel_ts = 1,
60}; 61};
61 62
62static int drxk_gate_ctrl(struct dvb_frontend *fe, int enable) 63static int drxk_gate_ctrl(struct dvb_frontend *fe, int enable)
@@ -200,53 +201,31 @@ static int az6007_read_mac_addr(struct dvb_usb_device *d, u8 mac[6])
200 return 0; 201 return 0;
201} 202}
202 203
204#define AZ6007_POWER 0xbc
205#define FX2_SCON1 0xc0
206#define AZ6007_TS_THROUGH 0xc7
207
203static int az6007_frontend_poweron(struct dvb_usb_adapter *adap) 208static int az6007_frontend_poweron(struct dvb_usb_adapter *adap)
204{ 209{
205 int ret; 210 struct dvb_usb_device *d = adap->dev;
206 u8 req;
207 u16 value;
208 u16 index;
209 int blen;
210 211
211 deb_info("az6007_frontend_poweron adap=%p adap->dev=%p\n", 212 deb_info("az6007_frontend_poweron adap=%p adap->dev=%p\n",
212 adap, adap->dev); 213 adap, adap->dev);
213 214
214 req = 0xBC; 215 az6007_usb_out_op(d, AZ6007_POWER /* 0xbc */, 0, 2, NULL, 0);
215 value = 1; /* power on */ 216 msleep(150);
216 index = 3; 217 az6007_usb_out_op(d, AZ6007_POWER /* 0xbc */, 1, 4, NULL, 0);
217 blen = 0; 218 msleep(100);
218 219 az6007_usb_out_op(d, AZ6007_POWER /* 0xbc */, 1, 3, NULL, 0);
219 ret = az6007_usb_out_op(adap->dev, req, value, index, NULL, blen); 220 msleep(100);
220 if (ret != 0) { 221 az6007_usb_out_op(d, AZ6007_POWER /* 0xbc */, 1, 4, NULL, 0);
221 err("az6007_frontend_poweron failed!!!"); 222 msleep(100);
222 return -EIO; 223 az6007_usb_out_op(d, FX2_SCON1 /* 0xc0 */, 0, 3, NULL, 0);
223 } 224 msleep (10);
224 225 az6007_usb_out_op(d, FX2_SCON1 /* 0xc0 */, 1, 3, NULL, 0);
225 msleep_interruptible(200); 226 msleep (10);
226 227 az6007_usb_out_op(d, AZ6007_POWER /* 0xbc */, 0, 0, NULL, 0);
227 req = 0xBC;
228 value = 0; /* power off */
229 index = 3;
230 blen = 0;
231
232 ret = az6007_usb_out_op(adap->dev, req, value, index, NULL, blen);
233 if (ret != 0) {
234 err("az6007_frontend_poweron failed!!!");
235 return -EIO;
236 }
237
238 msleep_interruptible(200);
239
240 req = 0xBC;
241 value = 1; /* power on */
242 index = 3;
243 blen = 0;
244 228
245 ret = az6007_usb_out_op(adap->dev, req, value, index, NULL, blen);
246 if (ret != 0) {
247 err("az6007_frontend_poweron failed!!!");
248 return -EIO;
249 }
250 deb_info("az6007_frontend_poweron: OK\n"); 229 deb_info("az6007_frontend_poweron: OK\n");
251 230
252 return 0; 231 return 0;
@@ -333,25 +312,6 @@ static int az6007_led_on_off(struct usb_interface *intf, int onoff)
333 return ret; 312 return ret;
334} 313}
335 314
336static int az6007_frontend_tsbypass(struct dvb_usb_adapter *adap, int onoff)
337{
338 int ret;
339 u8 req;
340 u16 value;
341 u16 index;
342 int blen;
343 /* TS through */
344 req = 0xC7;
345 value = onoff;
346 index = 0;
347 blen = 0;
348
349 ret = az6007_usb_out_op(adap->dev, req, value, index, NULL, blen);
350 if (ret != 0)
351 return -EIO;
352 return 0;
353}
354
355static int az6007_frontend_attach(struct dvb_usb_adapter *adap) 315static int az6007_frontend_attach(struct dvb_usb_adapter *adap)
356{ 316{
357 struct az6007_device_state *st = adap->priv; 317 struct az6007_device_state *st = adap->priv;
@@ -409,6 +369,27 @@ out_free:
409 return result; 369 return result;
410} 370}
411 371
372int az6007_power_ctrl(struct dvb_usb_device *d, int onoff)
373{
374 if (!onoff)
375 return 0;
376
377
378 info("Sending poweron sequence");
379
380 az6007_usb_out_op(d, AZ6007_TS_THROUGH /* 0xc7 */, 0, 0, NULL, 0);
381
382#if 0
383 // Seems to be a poweroff sequence
384 az6007_usb_out_op(d, 0xbc, 1, 3, NULL, 0);
385 az6007_usb_out_op(d, 0xbc, 1, 4, NULL, 0);
386 az6007_usb_out_op(d, 0xc0, 0, 3, NULL, 0);
387 az6007_usb_out_op(d, 0xc0, 1, 3, NULL, 0);
388 az6007_usb_out_op(d, 0xbc, 0, 1, NULL, 0);
389#endif
390 return 0;
391}
392
412static struct dvb_usb_device_properties az6007_properties; 393static struct dvb_usb_device_properties az6007_properties;
413 394
414static void az6007_usb_disconnect(struct usb_interface *intf) 395static void az6007_usb_disconnect(struct usb_interface *intf)
@@ -568,7 +549,7 @@ MODULE_DEVICE_TABLE(usb, az6007_usb_table);
568static struct dvb_usb_device_properties az6007_properties = { 549static struct dvb_usb_device_properties az6007_properties = {
569 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 550 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
570 .usb_ctrl = CYPRESS_FX2, 551 .usb_ctrl = CYPRESS_FX2,
571 .firmware = "dvb-usb-az6007-03.fw", 552 .firmware = "dvb-usb-terratec-h7-az6007.fw",
572 .no_reconnect = 1, 553 .no_reconnect = 1,
573 554
574 .identify_state = az6007_identify_state, 555 .identify_state = az6007_identify_state,
@@ -592,7 +573,7 @@ static struct dvb_usb_device_properties az6007_properties = {
592 .size_of_priv = sizeof(struct az6007_device_state), 573 .size_of_priv = sizeof(struct az6007_device_state),
593 } 574 }
594 }, 575 },
595 /* .power_ctrl = az6007_power_ctrl, */ 576 .power_ctrl = az6007_power_ctrl,
596 .read_mac_address = az6007_read_mac_addr, 577 .read_mac_address = az6007_read_mac_addr,
597 578
598 .rc.legacy = { 579 .rc.legacy = {