Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 288267
Collapse All | Expand All

(-)v4l-dvb/linux/drivers/media/dvb/b2c2/flexcop-common.h (+3 lines)
Lines 117-122 int flexcop_device_initialize(struct fle Link Here
117
void flexcop_device_exit(struct flexcop_device *fc);
117
void flexcop_device_exit(struct flexcop_device *fc);
118
void flexcop_reset_block_300(struct flexcop_device *fc);
118
void flexcop_reset_block_300(struct flexcop_device *fc);
119
119
120
void flexcop_device_suspend(struct flexcop_device *fc);
121
void flexcop_device_resume(struct flexcop_device *fc);
122
120
/* from flexcop-dma.c */
123
/* from flexcop-dma.c */
121
int flexcop_dma_allocate(struct pci_dev *pdev,
124
int flexcop_dma_allocate(struct pci_dev *pdev,
122
		struct flexcop_dma *dma, u32 size);
125
		struct flexcop_dma *dma, u32 size);
(-)v4l-dvb/linux/drivers/media/dvb/b2c2/flexcop.c (+69 lines)
Lines 292-297 void flexcop_device_exit(struct flexcop_ Link Here
292
}
292
}
293
EXPORT_SYMBOL(flexcop_device_exit);
293
EXPORT_SYMBOL(flexcop_device_exit);
294
294
295
void flexcop_device_suspend(struct flexcop_device *fc)
296
{
297
	/* flexcop_device_exit does only unregister objects
298
	 * so just stop streaming here */
299
	struct dvb_demux_feed *feed;
300
301
	/* copied from flexcop_pci_irq_check_work */
302
#if 1
303
	info("stopping pid feeds");
304
	spin_lock_irq(&fc->demux.lock);
305
	list_for_each_entry(feed, &fc->demux.feed_list,
306
			list_head) {
307
		flexcop_pid_feed_control(fc, feed, 0);
308
	}
309
	spin_unlock_irq(&fc->demux.lock);
310
#endif
311
312
#if 1
313
	/* make sure streaming is really off */
314
	if (fc->stream_control)
315
		fc->stream_control(fc, 0);
316
#endif
317
#if 0
318
	fc->feedcount = 0;
319
	fc->extra_feedcount = 0;
320
	flexcop_reset_block_300(fc);
321
	flexcop_hw_filter_init(fc);
322
#endif
323
}
324
EXPORT_SYMBOL(flexcop_device_suspend);
325
326
void flexcop_device_resume(struct flexcop_device *fc)
327
{
328
	/* copied from flexcop_device_initialize */
329
	//struct dvb_demux_feed *feed;
330
	flexcop_reset(fc);
331
332
	flexcop_sram_init(fc);
333
	flexcop_hw_filter_init(fc);
334
	flexcop_smc_ctrl(fc, 0);
335
336
	/* do the MAC address reading after initializing the dvb_adapter */
337
	/* TODO: need not reread MAC address, but status was not saved */
338
	if (fc->get_mac_addr(fc, 0) == 0) {
339
		u8 *b = fc->dvb_adapter.proposed_mac;
340
		info("MAC address = %pM", b);
341
		flexcop_set_mac_filter(fc, b);
342
		flexcop_mac_filter_ctrl(fc, 1);
343
	} else
344
		warn("reading of MAC address failed.\n");
345
346
	/* TODO: Is it fine to start streaming here,
347
	 * before DMA is re-initialized */
348
349
	/* copied from flexcop_pci_irq_check_work */
350
	info("restarting pid feeds");
351
#if 0
352
	spin_lock_irq(&fc->demux.lock);
353
	list_for_each_entry(feed, &fc->demux.feed_list,
354
			list_head) {
355
		flexcop_pid_feed_control(fc, feed, 1);
356
	}
357
	spin_unlock_irq(&fc->demux.lock);
358
#endif
359
360
	flexcop_device_name(fc, "resume of", "complete");
361
}
362
EXPORT_SYMBOL(flexcop_device_resume);
363
295
static int flexcop_module_init(void)
364
static int flexcop_module_init(void)
296
{
365
{
297
	info(DRIVER_NAME " loaded successfully");
366
	info(DRIVER_NAME " loaded successfully");
(-)v4l-dvb/linux/drivers/media/dvb/b2c2/flexcop-pci.c (-6 / +75 lines)
Lines 319-326 static int flexcop_pci_init(struct flexc Link Here
319
	pci_read_config_byte(fc_pci->pdev, PCI_CLASS_REVISION, &card_rev);
319
	pci_read_config_byte(fc_pci->pdev, PCI_CLASS_REVISION, &card_rev);
320
	info("card revision %x", card_rev);
320
	info("card revision %x", card_rev);
321
321
322
	if ((ret = pci_enable_device(fc_pci->pdev)) != 0)
323
		return ret;
324
	pci_set_master(fc_pci->pdev);
322
	pci_set_master(fc_pci->pdev);
325
323
326
	if ((ret = pci_request_regions(fc_pci->pdev, DRIVER_NAME)) != 0)
324
	if ((ret = pci_request_regions(fc_pci->pdev, DRIVER_NAME)) != 0)
Lines 334-340 static int flexcop_pci_init(struct flexc Link Here
334
		goto err_pci_release_regions;
332
		goto err_pci_release_regions;
335
	}
333
	}
336
334
337
	pci_set_drvdata(fc_pci->pdev, fc_pci);
338
	spin_lock_init(&fc_pci->irq_lock);
335
	spin_lock_init(&fc_pci->irq_lock);
339
	if ((ret = request_irq(fc_pci->pdev->irq, flexcop_pci_isr,
336
	if ((ret = request_irq(fc_pci->pdev->irq, flexcop_pci_isr,
340
					IRQF_SHARED, DRIVER_NAME, fc_pci)) != 0)
337
					IRQF_SHARED, DRIVER_NAME, fc_pci)) != 0)
Lines 345-351 static int flexcop_pci_init(struct flexc Link Here
345
342
346
err_pci_iounmap:
343
err_pci_iounmap:
347
	pci_iounmap(fc_pci->pdev, fc_pci->io_mem);
344
	pci_iounmap(fc_pci->pdev, fc_pci->io_mem);
348
	pci_set_drvdata(fc_pci->pdev, NULL);
349
err_pci_release_regions:
345
err_pci_release_regions:
350
	pci_release_regions(fc_pci->pdev);
346
	pci_release_regions(fc_pci->pdev);
351
err_pci_disable_device:
347
err_pci_disable_device:
Lines 358-366 static void flexcop_pci_exit(struct flex Link Here
358
	if (fc_pci->init_state & FC_PCI_INIT) {
354
	if (fc_pci->init_state & FC_PCI_INIT) {
359
		free_irq(fc_pci->pdev->irq, fc_pci);
355
		free_irq(fc_pci->pdev->irq, fc_pci);
360
		pci_iounmap(fc_pci->pdev, fc_pci->io_mem);
356
		pci_iounmap(fc_pci->pdev, fc_pci->io_mem);
361
		pci_set_drvdata(fc_pci->pdev, NULL);
362
		pci_release_regions(fc_pci->pdev);
357
		pci_release_regions(fc_pci->pdev);
363
		pci_disable_device(fc_pci->pdev);
364
	}
358
	}
365
	fc_pci->init_state &= ~FC_PCI_INIT;
359
	fc_pci->init_state &= ~FC_PCI_INIT;
366
}
360
}
Lines 399-404 static int flexcop_pci_probe(struct pci_ Link Here
399
393
400
	/* bus specific part */
394
	/* bus specific part */
401
	fc_pci->pdev = pdev;
395
	fc_pci->pdev = pdev;
396
	ret = pci_enable_device(pdev);
397
	if (ret != 0)
398
		goto err_kfree;
399
400
	pci_set_drvdata(pdev, fc_pci);
402
	if ((ret = flexcop_pci_init(fc_pci)) != 0)
401
	if ((ret = flexcop_pci_init(fc_pci)) != 0)
403
		goto err_kfree;
402
		goto err_kfree;
404
403
Lines 428-433 err_fc_exit: Link Here
428
err_pci_exit:
427
err_pci_exit:
429
	flexcop_pci_exit(fc_pci);
428
	flexcop_pci_exit(fc_pci);
430
err_kfree:
429
err_kfree:
430
	pci_set_drvdata(pdev, NULL);
431
	flexcop_device_kfree(fc);
431
	flexcop_device_kfree(fc);
432
	return ret;
432
	return ret;
433
}
433
}
Lines 445-453 static void flexcop_pci_remove(struct pc Link Here
445
	flexcop_pci_dma_exit(fc_pci);
445
	flexcop_pci_dma_exit(fc_pci);
446
	flexcop_device_exit(fc_pci->fc_dev);
446
	flexcop_device_exit(fc_pci->fc_dev);
447
	flexcop_pci_exit(fc_pci);
447
	flexcop_pci_exit(fc_pci);
448
	pci_set_drvdata(pdev, NULL);
449
	pci_disable_device(pdev);
448
	flexcop_device_kfree(fc_pci->fc_dev);
450
	flexcop_device_kfree(fc_pci->fc_dev);
449
}
451
}
450
452
453
#ifdef CONFIG_PM
454
static int flexcop_pci_suspend(struct pci_dev *pdev, pm_message_t mesg)
455
{
456
	struct flexcop_pci *fc_pci = pci_get_drvdata(pdev);
457
	struct flexcop_device *fc = fc_pci->fc_dev;
458
459
	/* most parts are from flexcop_pci_remove */
460
461
	if (irq_chk_intv > 0)
462
		cancel_delayed_work(&fc_pci->irq_check_work);
463
464
	flexcop_pci_dma_exit(fc_pci);
465
	flexcop_device_suspend(fc);
466
	flexcop_pci_exit(fc_pci);
467
468
	pci_save_state(pdev);
469
470
	pci_disable_device(pdev);
471
	pci_set_power_state(pdev, pci_choose_state(pdev, mesg));
472
473
	return 0;
474
}
475
476
static int flexcop_pci_resume(struct pci_dev *pdev)
477
{
478
	int ret;
479
	struct flexcop_pci *fc_pci = pci_get_drvdata(pdev);
480
	struct flexcop_device *fc = fc_pci->fc_dev;
481
482
	/* restore power state 0 */
483
	pci_set_power_state(pdev, PCI_D0);
484
	pci_restore_state(pdev);
485
486
	ret = pci_enable_device(pdev);
487
	if (ret < 0) {
488
		err("unable to enable device in resume\n");
489
		return ret;
490
	}
491
492
	/* from flexcop_pci_probe */
493
	ret = flexcop_pci_init(fc_pci);
494
	if (ret < 0) {
495
		err("could not allocate pci resources in resume\n");
496
		return ret;
497
	}
498
499
	/* init flexcop */
500
	flexcop_device_resume(fc); /* instead of flexcop_device_initialize */
501
502
	/* init dma */
503
	flexcop_pci_dma_init(fc_pci);
504
505
	/* last step: restart watchdog */
506
	if (irq_chk_intv > 0)
507
		schedule_delayed_work(&fc_pci->irq_check_work,
508
				msecs_to_jiffies(irq_chk_intv < 100 ?
509
					100 :
510
					irq_chk_intv));
511
512
	return 0;
513
}
514
#endif
515
451
static struct pci_device_id flexcop_pci_tbl[] = {
516
static struct pci_device_id flexcop_pci_tbl[] = {
452
	{ PCI_DEVICE(0x13d0, 0x2103) },
517
	{ PCI_DEVICE(0x13d0, 0x2103) },
453
	{ },
518
	{ },
Lines 460-465 static struct pci_driver flexcop_pci_dri Link Here
460
	.id_table = flexcop_pci_tbl,
525
	.id_table = flexcop_pci_tbl,
461
	.probe    = flexcop_pci_probe,
526
	.probe    = flexcop_pci_probe,
462
	.remove   = flexcop_pci_remove,
527
	.remove   = flexcop_pci_remove,
528
#ifdef CONFIG_PM
529
	.suspend  = flexcop_pci_suspend,
530
	.resume   = flexcop_pci_resume,
531
#endif
463
};
532
};
464
533
465
static int __init flexcop_pci_module_init(void)
534
static int __init flexcop_pci_module_init(void)

Return to bug 288267