Mercurial > pt1.oyama
comparison driver/pt1_pci.c @ 50:23b6f99f65b2
propagate upstream change:
- adapted to FastBoot. use spinlock to avoid resource contention between multiple number of cards.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Thu, 27 Aug 2009 21:39:14 +0900 |
parents | 07d71b1484a8 |
children | c915076353ae |
comparison
equal
deleted
inserted
replaced
49:6bcdd17c12f6 | 50:23b6f99f65b2 |
---|---|
49 MODULE_AUTHOR("Tomoaki Ishikawa tomy@users.sourceforge.jp"); | 49 MODULE_AUTHOR("Tomoaki Ishikawa tomy@users.sourceforge.jp"); |
50 #define DRIVER_DESC "PCI earthsoft PT1 driver" | 50 #define DRIVER_DESC "PCI earthsoft PT1 driver" |
51 MODULE_DESCRIPTION(DRIVER_DESC); | 51 MODULE_DESCRIPTION(DRIVER_DESC); |
52 MODULE_LICENSE("GPL"); | 52 MODULE_LICENSE("GPL"); |
53 | 53 |
54 static int debug = 7; /* 1 normal messages, 0 quiet .. 7 verbose. */ | 54 static int debug = 7; /* 1 normal messages, 0 quiet .. |
55 static int lnb = 0; /* LNB OFF:0 +11V:1 +15V:2 */ | 55 7 verbose. */ |
56 static int lnb = 0; /* LNB OFF:0 +11V:1 +15V:2 */ | |
57 static spinlock_t lock; /* to synchronize at probing */ | |
56 | 58 |
57 module_param(debug, int, 0); | 59 module_param(debug, int, 0); |
58 module_param(lnb, int, 0); | 60 module_param(lnb, int, 0); |
59 MODULE_PARM_DESC(debug, "debug level (1-2)"); | 61 MODULE_PARM_DESC(debug, "debug level (1-2)"); |
60 MODULE_PARM_DESC(debug, "LNB level (0:OFF 1:+11V 2:+15V)"); | 62 MODULE_PARM_DESC(debug, "LNB level (0:OFF 1:+11V 2:+15V)"); |
696 if(rc < 0){ | 698 if(rc < 0){ |
697 printk(KERN_ERR "Error tuner_init\n"); | 699 printk(KERN_ERR "Error tuner_init\n"); |
698 goto out_err_fpga; | 700 goto out_err_fpga; |
699 } | 701 } |
700 } | 702 } |
703 | |
704 spin_lock(&lock); | |
705 | |
701 // 初期化完了 | 706 // 初期化完了 |
702 for(lp = 0 ; lp < MAX_CHANNEL ; lp++){ | 707 for(lp = 0 ; lp < MAX_CHANNEL ; lp++){ |
703 set_sleepmode(dev_conf->regs, &dev_conf->lock, | 708 set_sleepmode(dev_conf->regs, &dev_conf->lock, |
704 i2c_address[lp], channeltype[lp], TYPE_SLEEP); | 709 i2c_address[lp], channeltype[lp], TYPE_SLEEP); |
705 | 710 |
706 schedule_timeout_interruptible(msecs_to_jiffies(50)); | 711 schedule_timeout_interruptible(msecs_to_jiffies(50)); |
707 } | 712 } |
708 rc = alloc_chrdev_region(&dev_conf->dev, 0, MAX_CHANNEL, DEV_NAME); | 713 rc = alloc_chrdev_region(&dev_conf->dev, 0, MAX_CHANNEL, DEV_NAME); |
709 if(rc < 0){ | 714 if(rc < 0){ |
715 spin_unlock(&lock); | |
710 goto out_err_fpga; | 716 goto out_err_fpga; |
711 } | 717 } |
712 | 718 |
713 // 初期化 | 719 // 初期化 |
714 init_waitqueue_head(&dev_conf->dma_wait_q); | 720 init_waitqueue_head(&dev_conf->dma_wait_q); |
721 device[lp] = dev_conf ; | 727 device[lp] = dev_conf ; |
722 dev_conf->card_number = lp; | 728 dev_conf->card_number = lp; |
723 break ; | 729 break ; |
724 } | 730 } |
725 } | 731 } |
732 | |
733 spin_unlock(&lock); | |
734 | |
726 for(lp = 0 ; lp < MAX_CHANNEL ; lp++){ | 735 for(lp = 0 ; lp < MAX_CHANNEL ; lp++){ |
727 cdev_init(&dev_conf->cdev[lp], &pt1_fops); | 736 cdev_init(&dev_conf->cdev[lp], &pt1_fops); |
728 dev_conf->cdev[lp].owner = THIS_MODULE; | 737 dev_conf->cdev[lp].owner = THIS_MODULE; |
729 cdev_add(&dev_conf->cdev[lp], | 738 cdev_add(&dev_conf->cdev[lp], |
730 MKDEV(MAJOR(dev_conf->dev), (MINOR(dev_conf->dev) + lp)), 1); | 739 MKDEV(MAJOR(dev_conf->dev), (MINOR(dev_conf->dev) + lp)), 1); |
908 { | 917 { |
909 printk(version); | 918 printk(version); |
910 pt1video_class = class_create(THIS_MODULE, DRIVERNAME); | 919 pt1video_class = class_create(THIS_MODULE, DRIVERNAME); |
911 if (IS_ERR(pt1video_class)) | 920 if (IS_ERR(pt1video_class)) |
912 return PTR_ERR(pt1video_class); | 921 return PTR_ERR(pt1video_class); |
922 spin_lock_init(&lock); | |
913 return pci_register_driver(&pt1_driver); | 923 return pci_register_driver(&pt1_driver); |
914 } | 924 } |
915 | 925 |
916 | 926 |
917 static void __exit pt1_pci_cleanup(void) | 927 static void __exit pt1_pci_cleanup(void) |