diff driver/pt1_pci.c @ 64:98a92ce5382e

added fake support code for PT2. the PT2 part is not expected to work. be careful!
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Thu, 22 Oct 2009 02:18:12 +0900
parents c915076353ae
children 272a8fba970b
line wrap: on
line diff
--- a/driver/pt1_pci.c	Sat Oct 10 01:11:34 2009 +0900
+++ b/driver/pt1_pci.c	Thu Oct 22 02:18:12 2009 +0900
@@ -59,8 +59,13 @@
 MODULE_PARM_DESC(debug, "debug level (1-2)");
 MODULE_PARM_DESC(debug, "LNB level (0:OFF 1:+11V 2:+15V)");
 
+#define VENDOR_EARTHSOFT 0x10ee
+#define PCI_PT1_ID 0x211a
+#define PCI_PT2_ID 0x222a
+
 static struct pci_device_id pt1_pci_tbl[] = {
-	{ 0x10ee, 0x211a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
+	{ VENDOR_EARTHSOFT, PCI_PT1_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
+	{ VENDOR_EARTHSOFT, PCI_PT2_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
 	{ 0, }
 };
 MODULE_DEVICE_TABLE(pci, pt1_pci_tbl);
@@ -97,7 +102,8 @@
 	wait_queue_head_t	dma_wait_q ;// for poll on reading
 	DMA_CONTROL		*dmactl[DMA_RING_SIZE];
 	PT1_CHANNEL		*channel[MAX_CHANNEL];
-}PT1_DEVICE;
+	int			cardtype;
+} PT1_DEVICE;
 
 typedef	struct	_MICRO_PACKET{
 	char	data[3];
@@ -514,12 +520,12 @@
 			return 0 ;
 		case LNB_ENABLE:
 			if(lnb){
-				settuner_reset(channel->ptr->regs, lnb, TUNER_POWER_ON_RESET_DISABLE);
+				settuner_reset(channel->ptr->regs, channel->ptr->cardtype, lnb, TUNER_POWER_ON_RESET_DISABLE);
 			}
 			return 0 ;
 		case LNB_DISABLE:
 			if(lnb){
-				settuner_reset(channel->ptr->regs, LNB_OFF, TUNER_POWER_ON_RESET_DISABLE);
+				settuner_reset(channel->ptr->regs, channel->ptr->cardtype, LNB_OFF, TUNER_POWER_ON_RESET_DISABLE);
 			}
 			return 0 ;
 	}
@@ -628,7 +634,7 @@
 	rc = pci_enable_device(pdev);
 	if (rc)
 		return rc;
-	rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
+	rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
 	if (rc) {
 		printk(KERN_ERR "PT1:DMA MASK ERROR");
 		return rc;
@@ -663,6 +669,18 @@
 			return -ENOMEM ;
 		}
 	}
+
+	switch(ent->device) {
+	case PCI_PT1_ID:
+		dev_conf->cardtype = PT1;
+		break;
+	case PCI_PT2_ID:
+		dev_conf->cardtype = PT2;
+		break;
+	default:
+		break;
+	}
+
 	// PCIアドレスをマップする
 	dev_conf->mmio_start = pci_resource_start(pdev, 0);
 	dev_conf->mmio_len = pci_resource_len(pdev, 0);
@@ -683,10 +701,10 @@
 		goto out_err_fpga;
 	}
 	// チューナリセット
-	settuner_reset(dev_conf->regs, LNB_OFF, TUNER_POWER_ON_RESET_ENABLE);
+	settuner_reset(dev_conf->regs, dev_conf->cardtype, LNB_OFF, TUNER_POWER_ON_RESET_ENABLE);
 	schedule_timeout_interruptible(msecs_to_jiffies(50));
 
-	settuner_reset(dev_conf->regs, LNB_OFF, TUNER_POWER_ON_RESET_DISABLE);
+	settuner_reset(dev_conf->regs, dev_conf->cardtype, LNB_OFF, TUNER_POWER_ON_RESET_DISABLE);
 	schedule_timeout_interruptible(msecs_to_jiffies(10));
 	mutex_init(&dev_conf->lock);
 
@@ -815,7 +833,7 @@
 	}
 out_err_fpga:
 	writel(0xb0b0000, dev_conf->regs);
-	writel(0, dev_conf->regs + 4);
+	writel(0, dev_conf->regs + CFG_REGS_ADDR);
 	iounmap(dev_conf->regs);
 	release_mem_region(dev_conf->mmio_start, dev_conf->mmio_len);
 	for (i = 0; i < DMA_RING_SIZE; i++) {
@@ -864,8 +882,8 @@
 
 		unregister_chrdev_region(dev_conf->dev, MAX_CHANNEL);
 		writel(0xb0b0000, dev_conf->regs);
-		writel(0, dev_conf->regs + 4);
-		settuner_reset(dev_conf->regs, LNB_OFF, TUNER_POWER_OFF);
+		writel(0, dev_conf->regs + CFG_REGS_ADDR);
+		settuner_reset(dev_conf->regs, dev_conf->cardtype, LNB_OFF, TUNER_POWER_OFF);
 		release_mem_region(dev_conf->mmio_start, dev_conf->mmio_len);
 		iounmap(dev_conf->regs);
 		for (i = 0; i < DMA_RING_SIZE; i++) {