aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorManu Abraham <abraham.manu@gmail.com>2009-12-02 20:07:24 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-01-17 08:55:28 -0500
commitdf0cca174b4d85ea041509a13e5e68b377758bf1 (patch)
tree1e35b52b855b4bb3d2359e04dbe70a0cce6df836 /drivers/media/dvb
parentbd1fcac0148fb4a44395227edb0ff8ee31e09de1 (diff)
V4L/DVB (13706): [MB86A16] Overhaul
* better ISR handling * I2C fixes * better handling of configurations Signed-off-by: Manu Abraham <manu@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/mantis/mantis_common.h14
-rw-r--r--drivers/media/dvb/mantis/mantis_core.c95
-rw-r--r--drivers/media/dvb/mantis/mantis_dvb.c13
-rw-r--r--drivers/media/dvb/mantis/mantis_i2c.c68
-rw-r--r--drivers/media/dvb/mantis/mantis_pci.c170
-rw-r--r--drivers/media/dvb/mantis/mantis_vp1033.c8
-rw-r--r--drivers/media/dvb/mantis/mantis_vp1033.h6
-rw-r--r--drivers/media/dvb/mantis/mantis_vp1034.c8
-rw-r--r--drivers/media/dvb/mantis/mantis_vp1034.h7
-rw-r--r--drivers/media/dvb/mantis/mantis_vp2033.c20
-rw-r--r--drivers/media/dvb/mantis/mantis_vp2033.h6
-rw-r--r--drivers/media/dvb/mantis/mantis_vp3030.c10
-rw-r--r--drivers/media/dvb/mantis/mantis_vp3030.h8
13 files changed, 215 insertions, 218 deletions
diff --git a/drivers/media/dvb/mantis/mantis_common.h b/drivers/media/dvb/mantis/mantis_common.h
index ba360f884967..60a7457b2b98 100644
--- a/drivers/media/dvb/mantis/mantis_common.h
+++ b/drivers/media/dvb/mantis/mantis_common.h
@@ -65,10 +65,19 @@
65#define mmaor(dat, addr) mmwrite((dat) | ((mask) & mmread(addr)), addr) 65#define mmaor(dat, addr) mmwrite((dat) | ((mask) & mmread(addr)), addr)
66 66
67 67
68struct mantis_hwconfig {
69 char *model_name;
70 char *dev_type;
71};
72
73
68struct mantis_pci { 74struct mantis_pci {
69 /* PCI stuff */ 75 /* PCI stuff */
70 u16 vendor_id; 76 u16 vendor_id;
71 u16 device_id; 77 u16 device_id;
78 u16 subsystem_vendor;
79 u16 subsystem_device;
80
72 u8 latency; 81 u8 latency;
73 82
74 struct pci_dev *pdev; 83 struct pci_dev *pdev;
@@ -110,7 +119,7 @@ struct mantis_pci {
110 119
111 u8 feeds; 120 u8 feeds;
112 121
113 struct mantis_config *config; 122 struct mantis_hwconfig *hwconfig;
114 123
115 u32 mantis_int_stat; 124 u32 mantis_int_stat;
116 u32 mantis_int_mask; 125 u32 mantis_int_mask;
@@ -121,7 +130,8 @@ struct mantis_pci {
121 u32 sub_device_id; 130 u32 sub_device_id;
122 131
123 /* A12 A13 A14 */ 132 /* A12 A13 A14 */
124 int gpio_status;}; 133 int gpio_status;
134};
125 135
126extern unsigned int verbose; 136extern unsigned int verbose;
127extern unsigned int devs; 137extern unsigned int devs;
diff --git a/drivers/media/dvb/mantis/mantis_core.c b/drivers/media/dvb/mantis/mantis_core.c
index 111227752452..1012959499a2 100644
--- a/drivers/media/dvb/mantis/mantis_core.c
+++ b/drivers/media/dvb/mantis/mantis_core.c
@@ -20,7 +20,10 @@
20 20
21#include "mantis_common.h" 21#include "mantis_common.h"
22#include "mantis_core.h" 22#include "mantis_core.h"
23 23#include "mantis_vp1033.h"
24#include "mantis_vp1034.h"
25#include "mantis_vp2033.h"
26#include "mantis_vp3030.h"
24 27
25static int read_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length) 28static int read_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length)
26{ 29{
@@ -45,7 +48,7 @@ static int read_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length)
45 48
46 return err; 49 return err;
47 } 50 }
48 msleep_interruptible(2); 51// msleep_interruptible(2);
49 52
50 return 0; 53 return 0;
51} 54}
@@ -72,41 +75,6 @@ static int write_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length)
72 return 0; 75 return 0;
73} 76}
74 77
75static int get_subdevice_id(struct mantis_pci *mantis)
76{
77 int err;
78 static u8 sub_device_id[2];
79
80 mantis->sub_device_id = 0;
81 sub_device_id[0] = 0xfc;
82 if ((err = read_eeprom_byte(mantis, &sub_device_id[0], 2)) < 0) {
83 dprintk(verbose, MANTIS_ERROR, 1, "Mantis EEPROM read error");
84 return err;
85 }
86 mantis->sub_device_id = (sub_device_id[0] << 8) | sub_device_id[1];
87 dprintk(verbose, MANTIS_ERROR, 1, "Sub Device ID=[0x%04x]",
88 mantis->sub_device_id);
89
90 return 0;
91}
92
93static int get_subvendor_id(struct mantis_pci *mantis)
94{
95 int err;
96 static u8 sub_vendor_id[2];
97
98 mantis->sub_vendor_id = 0;
99 sub_vendor_id[0] = 0xfe;
100 if ((err = read_eeprom_byte(mantis, &sub_vendor_id[0], 2)) < 0) {
101 dprintk(verbose, MANTIS_ERROR, 1, "Mantis EEPROM read error");
102 return err;
103 }
104 mantis->sub_vendor_id = (sub_vendor_id[0] << 8) | sub_vendor_id[1];
105 dprintk(verbose, MANTIS_ERROR, 1, "Sub Vendor ID=[0x%04x]",
106 mantis->sub_vendor_id);
107
108 return 0;
109}
110 78
111static int get_mac_address(struct mantis_pci *mantis) 79static int get_mac_address(struct mantis_pci *mantis)
112{ 80{
@@ -118,8 +86,8 @@ static int get_mac_address(struct mantis_pci *mantis)
118 86
119 return err; 87 return err;
120 } 88 }
121 dprintk(verbose, MANTIS_ERROR, 1, 89 dprintk(verbose, MANTIS_ERROR, 0,
122 "MAC Address=[%02x:%02x:%02x:%02x:%02x:%02x]", 90 " MAC Address=[%02x:%02x:%02x:%02x:%02x:%02x]\n",
123 mantis->mac_address[0], mantis->mac_address[1], 91 mantis->mac_address[0], mantis->mac_address[1],
124 mantis->mac_address[2], mantis->mac_address[3], 92 mantis->mac_address[2], mantis->mac_address[3],
125 mantis->mac_address[4], mantis->mac_address[5]); 93 mantis->mac_address[4], mantis->mac_address[5]);
@@ -127,11 +95,51 @@ static int get_mac_address(struct mantis_pci *mantis)
127 return 0; 95 return 0;
128} 96}
129 97
98#define MANTIS_MODEL_UNKNOWN "UNKNOWN"
99#define MANTIS_DEV_UNKNOWN "UNKNOWN"
100
101struct mantis_hwconfig unknown_device = {
102 .model_name = MANTIS_MODEL_UNKNOWN,
103 .dev_type = MANTIS_DEV_UNKNOWN,
104};
105
106static void mantis_load_config(struct mantis_pci *mantis)
107{
108 switch (mantis->subsystem_device) {
109 case MANTIS_VP_1033_DVB_S: // VP-1033
110 mantis->hwconfig = &vp1033_mantis_config;
111 break;
112 case MANTIS_VP_1034_DVB_S: // VP-1034
113 mantis->hwconfig = &vp1034_mantis_config;
114 break;
115 case MANTIS_VP_2033_DVB_C: // VP-2033
116 mantis->hwconfig = &vp2033_mantis_config;
117 break;
118 case MANTIS_VP_3030_DVB_T: // VP-3030
119 mantis->hwconfig = &vp3030_mantis_config;
120 break;
121 default:
122 mantis->hwconfig = &unknown_device;
123 break;
124 }
125}
130 126
131int mantis_core_init(struct mantis_pci *mantis) 127int mantis_core_init(struct mantis_pci *mantis)
132{ 128{
133 int err = 0; 129 int err = 0;
134 130
131 mantis_load_config(mantis);
132 dprintk(verbose, MANTIS_ERROR, 0, "found a %s PCI %s device on (%02x:%02x.%x),\n",
133 mantis->hwconfig->model_name, mantis->hwconfig->dev_type,
134 mantis->pdev->bus->number, PCI_SLOT(mantis->pdev->devfn), PCI_FUNC(mantis->pdev->devfn));
135 dprintk(verbose, MANTIS_ERROR, 0, " Mantis Rev %d [%04x:%04x], ",
136 mantis->revision,
137 mantis->subsystem_vendor, mantis->subsystem_device);
138 dprintk(verbose, MANTIS_ERROR, 0,
139 "irq: %d, latency: %d\n memory: 0x%lx, mmio: 0x%p\n",
140 mantis->pdev->irq, mantis->latency,
141 mantis->mantis_addr, mantis->mantis_mmio);
142
135 if ((err = mantis_i2c_init(mantis)) < 0) { 143 if ((err = mantis_i2c_init(mantis)) < 0) {
136 dprintk(verbose, MANTIS_ERROR, 1, "Mantis I2C init failed"); 144 dprintk(verbose, MANTIS_ERROR, 1, "Mantis I2C init failed");
137 return err; 145 return err;
@@ -140,14 +148,6 @@ int mantis_core_init(struct mantis_pci *mantis)
140 dprintk(verbose, MANTIS_ERROR, 1, "get MAC address failed"); 148 dprintk(verbose, MANTIS_ERROR, 1, "get MAC address failed");
141 return err; 149 return err;
142 } 150 }
143 if ((err = get_subvendor_id(mantis)) < 0) {
144 dprintk(verbose, MANTIS_ERROR, 1, "get Sub vendor ID failed");
145 return err;
146 }
147 if ((err = get_subdevice_id(mantis)) < 0) {
148 dprintk(verbose, MANTIS_ERROR, 1, "get Sub device ID failed");
149 return err;
150 }
151 if ((err = mantis_dma_init(mantis)) < 0) { 151 if ((err = mantis_dma_init(mantis)) < 0) {
152 dprintk(verbose, MANTIS_ERROR, 1, "Mantis DMA init failed"); 152 dprintk(verbose, MANTIS_ERROR, 1, "Mantis DMA init failed");
153 return err; 153 return err;
@@ -162,7 +162,6 @@ int mantis_core_init(struct mantis_pci *mantis)
162 162
163int mantis_core_exit(struct mantis_pci *mantis) 163int mantis_core_exit(struct mantis_pci *mantis)
164{ 164{
165
166 mantis_dma_stop(mantis); 165 mantis_dma_stop(mantis);
167 dprintk(verbose, MANTIS_ERROR, 1, "DMA engine stopping"); 166 dprintk(verbose, MANTIS_ERROR, 1, "DMA engine stopping");
168 if (mantis_dma_exit(mantis) < 0) 167 if (mantis_dma_exit(mantis) < 0)
diff --git a/drivers/media/dvb/mantis/mantis_dvb.c b/drivers/media/dvb/mantis/mantis_dvb.c
index 5830d4a7bda2..319bb8bef4e1 100644
--- a/drivers/media/dvb/mantis/mantis_dvb.c
+++ b/drivers/media/dvb/mantis/mantis_dvb.c
@@ -206,22 +206,13 @@ err0:
206 return result; 206 return result;
207} 207}
208 208
209#define MANTIS_VP_1027_DVB_S 0x0013
210#define MANTIS_VP_1033_DVB_S 0x0016
211#define MANTIS_VP_1034_DVB_S 0x0014
212#define MANTIS_VP_1040_DVB_S2
213#define MANTIS_VP_1041_DVB_S2
214#define MANTIS_VP_2033_DVB_C 0x0008
215#define MANTIS_VP_3024_DVB_T 0x0009
216#define MANTIS_VP_3030_DVB_T 0x0024
217
218int __devinit mantis_frontend_init(struct mantis_pci *mantis) 209int __devinit mantis_frontend_init(struct mantis_pci *mantis)
219{ 210{
220 dprintk(verbose, MANTIS_DEBUG, 1, "Mantis frontend Init"); 211 dprintk(verbose, MANTIS_DEBUG, 1, "Mantis frontend Init");
221 mantis_fe_powerup(mantis); 212 mantis_fe_powerup(mantis);
222 mantis_frontend_reset(mantis); 213 mantis_frontend_reset(mantis);
223 dprintk(verbose, MANTIS_DEBUG, 1, "Device ID=%02x", mantis->sub_device_id); 214 dprintk(verbose, MANTIS_DEBUG, 1, "Device ID=%02x", mantis->subsystem_device);
224 switch (mantis->sub_device_id) { 215 switch (mantis->subsystem_device) {
225 case MANTIS_VP_1033_DVB_S: // VP-1033 216 case MANTIS_VP_1033_DVB_S: // VP-1033
226 dprintk(verbose, MANTIS_ERROR, 1, "Probing for STV0299 (DVB-S)"); 217 dprintk(verbose, MANTIS_ERROR, 1, "Probing for STV0299 (DVB-S)");
227 mantis->fe = stv0299_attach(&lgtdqcs001f_config, 218 mantis->fe = stv0299_attach(&lgtdqcs001f_config,
diff --git a/drivers/media/dvb/mantis/mantis_i2c.c b/drivers/media/dvb/mantis/mantis_i2c.c
index cfecb344bb7a..8b90a2af6871 100644
--- a/drivers/media/dvb/mantis/mantis_i2c.c
+++ b/drivers/media/dvb/mantis/mantis_i2c.c
@@ -33,32 +33,27 @@
33static int mantis_ack_wait(struct mantis_pci *mantis) 33static int mantis_ack_wait(struct mantis_pci *mantis)
34{ 34{
35 int rc = 0; 35 int rc = 0;
36 u32 timeout = 0;
36 37
37 if (wait_event_interruptible_timeout(mantis->i2c_wq, 38 if (wait_event_interruptible_timeout(mantis->i2c_wq,
38 mantis->mantis_int_stat & MANTIS_INT_I2CRACK, 39 mantis->mantis_int_stat & MANTIS_INT_I2CDONE,
39 msecs_to_jiffies(50)) == -ERESTARTSYS) 40 msecs_to_jiffies(50)) == -ERESTARTSYS) {
40 41
42 dprintk(verbose, MANTIS_DEBUG, 1, "I2C Transfer failed, Master !I2CDONE");
41 rc = -EREMOTEIO; 43 rc = -EREMOTEIO;
42/* 44 }
43 // Wait till we are done 45 while (!(mantis->mantis_int_stat & MANTIS_INT_I2CRACK)) {
44 while (mantis->mantis_int_stat & MANTIS_INT_I2CRACK){ 46 dprintk(verbose, MANTIS_DEBUG, 1, "Waiting for Slave RACK");
45 if (mantis->mantis_int_stat & MANTIS_INT_I2CDONE) { 47 mantis->mantis_int_stat = mmread(MANTIS_INT_STAT);
46 mantis->mantis_int_stat &= ~MANTIS_INT_I2CRACK; 48 msleep(5);
47// dprintk(verbose, MANTIS_DEBUG, 1, "SLAVE RACK 'ed .. Waiting for I2CDONE"); 49 timeout++;
50 if (timeout > 500) {
51 dprintk(verbose, MANTIS_ERROR, 1, "Slave RACK Fail !");
52 rc = -EREMOTEIO;
48 break; 53 break;
49 } 54 }
50 } 55 }
51 56 udelay(350);
52 if (mantis->mantis_int_stat & MANTIS_INT_I2CDONE) {
53// dprintk(verbose, MANTIS_DEBUG, 1, "Mantis Int I2CDONE");
54 rc = 1;
55 }
56
57 mantis->mantis_int_stat &= ~MANTIS_INT_I2CDONE;
58*/
59 // ..
60 if (mantis->mantis_int_stat & MANTIS_INT_I2CRACK)
61 msleep_interruptible(10);
62 57
63 return rc; 58 return rc;
64} 59}
@@ -67,7 +62,7 @@ static int mantis_i2c_read(struct mantis_pci *mantis, const struct i2c_msg *msg)
67{ 62{
68 u32 rxd, i; 63 u32 rxd, i;
69 64
70 dprintk(verbose, MANTIS_DEBUG, 1, "Address=[0x%02x]", msg->addr); 65 dprintk(verbose, MANTIS_INFO, 0, " %s: Address=[0x%02x] <R>[ ", __func__, msg->addr);
71 for (i = 0; i < msg->len; i++) { 66 for (i = 0; i < msg->len; i++) {
72 rxd = (msg->addr << 25) | (1 << 24) 67 rxd = (msg->addr << 25) | (1 << 24)
73 | MANTIS_I2C_RATE_3 68 | MANTIS_I2C_RATE_3
@@ -77,18 +72,17 @@ static int mantis_i2c_read(struct mantis_pci *mantis, const struct i2c_msg *msg)
77 if (i == (msg->len - 1)) 72 if (i == (msg->len - 1))
78 rxd &= ~MANTIS_I2C_STOP; 73 rxd &= ~MANTIS_I2C_STOP;
79 74
75 mmwrite(MANTIS_INT_I2CDONE, MANTIS_INT_STAT);
80 mmwrite(rxd, MANTIS_I2CDATA_CTL); 76 mmwrite(rxd, MANTIS_I2CDATA_CTL);
81 if (mantis_ack_wait(mantis) < 0) { 77 if (mantis_ack_wait(mantis) != 0) {
82 dprintk(verbose, MANTIS_DEBUG, 1, "ACK failed<R>"); 78 dprintk(verbose, MANTIS_DEBUG, 1, "ACK failed<R>");
83 return -EIO; 79 return -EREMOTEIO;
84 } 80 }
85 rxd = mmread(MANTIS_I2CDATA_CTL); 81 rxd = mmread(MANTIS_I2CDATA_CTL);
86 msg->buf[i] = (u8)((rxd >> 8) & 0xFF); 82 msg->buf[i] = (u8)((rxd >> 8) & 0xFF);
87 dprintk(verbose, MANTIS_DEBUG, 1, 83 dprintk(verbose, MANTIS_INFO, 0, "%02x ", msg->buf[i]);
88 "Data<R[%d]>=[0x%02x]", i, msg->buf[i]);
89
90 msleep_interruptible(2);
91 } 84 }
85 dprintk(verbose, MANTIS_INFO, 0, "]\n");
92 86
93 return 0; 87 return 0;
94} 88}
@@ -98,9 +92,9 @@ static int mantis_i2c_write(struct mantis_pci *mantis, const struct i2c_msg *msg
98 int i; 92 int i;
99 u32 txd = 0; 93 u32 txd = 0;
100 94
101 dprintk(verbose, MANTIS_DEBUG, 1, "Address=[0x%02x]", msg->addr); 95 dprintk(verbose, MANTIS_INFO, 0, " %s: Address=[0x%02x] <W>[ ", __func__, msg->addr);
102 for (i = 0; i < msg->len; i++) { 96 for (i = 0; i < msg->len; i++) {
103 dprintk(verbose, MANTIS_DEBUG, 1, "Data<W[%d]>=[0x%02x]", i, msg->buf[i]); 97 dprintk(verbose, MANTIS_INFO, 0, "%02x ", msg->buf[i]);
104 txd = (msg->addr << 25) | (msg->buf[i] << 8) 98 txd = (msg->addr << 25) | (msg->buf[i] << 8)
105 | MANTIS_I2C_RATE_3 99 | MANTIS_I2C_RATE_3
106 | MANTIS_I2C_STOP 100 | MANTIS_I2C_STOP
@@ -109,13 +103,14 @@ static int mantis_i2c_write(struct mantis_pci *mantis, const struct i2c_msg *msg
109 if (i == (msg->len - 1)) 103 if (i == (msg->len - 1))
110 txd &= ~MANTIS_I2C_STOP; 104 txd &= ~MANTIS_I2C_STOP;
111 105
106 mmwrite(MANTIS_INT_I2CDONE, MANTIS_INT_STAT);
112 mmwrite(txd, MANTIS_I2CDATA_CTL); 107 mmwrite(txd, MANTIS_I2CDATA_CTL);
113 if (mantis_ack_wait(mantis) < 0) { 108 if (mantis_ack_wait(mantis) != 0) {
114 dprintk(verbose, MANTIS_DEBUG, 1, "ACK failed<W>"); 109 dprintk(verbose, MANTIS_DEBUG, 1, "ACK failed<W>");
115 return -1; 110 return -EREMOTEIO;
116 } 111 }
117 udelay(500);
118 } 112 }
113 dprintk(verbose, MANTIS_INFO, 0, "]\n");
119 114
120 return 0; 115 return 0;
121} 116}
@@ -159,7 +154,7 @@ static struct i2c_adapter mantis_i2c_adapter = {
159 154
160int __devinit mantis_i2c_init(struct mantis_pci *mantis) 155int __devinit mantis_i2c_init(struct mantis_pci *mantis)
161{ 156{
162 u32 intstat; 157 u32 intstat, intmask;
163 158
164 memcpy(&mantis->adapter, &mantis_i2c_adapter, sizeof (mantis_i2c_adapter)); 159 memcpy(&mantis->adapter, &mantis_i2c_adapter, sizeof (mantis_i2c_adapter));
165 i2c_set_adapdata(&mantis->adapter, mantis); 160 i2c_set_adapdata(&mantis->adapter, mantis);
@@ -169,15 +164,12 @@ int __devinit mantis_i2c_init(struct mantis_pci *mantis)
169 164
170 dprintk(verbose, MANTIS_DEBUG, 1, "Initializing I2C .."); 165 dprintk(verbose, MANTIS_DEBUG, 1, "Initializing I2C ..");
171 166
172 // Clear all interrupts
173 intstat = mmread(MANTIS_INT_STAT); 167 intstat = mmread(MANTIS_INT_STAT);
168 intmask = mmread(MANTIS_INT_MASK);
174 mmwrite(intstat, MANTIS_INT_STAT); 169 mmwrite(intstat, MANTIS_INT_STAT);
170 mmwrite(intmask | MANTIS_INT_I2CDONE, MANTIS_INT_MASK);
175 171
176 mmwrite(mmread(MANTIS_INT_MASK) | MANTIS_INT_I2CDONE, 172 dprintk(verbose, MANTIS_DEBUG, 1, "[0x%08x/%08x]", intstat, intmask);
177 MANTIS_INT_MASK);
178
179 dprintk(verbose, MANTIS_DEBUG, 1, "[0x%08x/%08x]",
180 mmread(MANTIS_INT_STAT), mmread(MANTIS_INT_MASK));
181 173
182 return 0; 174 return 0;
183} 175}
diff --git a/drivers/media/dvb/mantis/mantis_pci.c b/drivers/media/dvb/mantis/mantis_pci.c
index 68ff1b2a0b3d..0bc25d2778f5 100644
--- a/drivers/media/dvb/mantis/mantis_pci.c
+++ b/drivers/media/dvb/mantis/mantis_pci.c
@@ -52,7 +52,6 @@ MODULE_DEVICE_TABLE(pci, mantis_pci_table);
52 52
53static irqreturn_t mantis_pci_irq(int irq, void *dev_id) 53static irqreturn_t mantis_pci_irq(int irq, void *dev_id)
54{ 54{
55 int i = 0, interrupts = 0;
56 u32 stat = 0, mask = 0, lstat = 0, mstat = 0; 55 u32 stat = 0, mask = 0, lstat = 0, mstat = 0;
57 struct mantis_pci *mantis; 56 struct mantis_pci *mantis;
58 57
@@ -64,109 +63,67 @@ static irqreturn_t mantis_pci_irq(int irq, void *dev_id)
64 stat = mmread(MANTIS_INT_STAT); 63 stat = mmread(MANTIS_INT_STAT);
65 mask = mmread(MANTIS_INT_MASK); 64 mask = mmread(MANTIS_INT_MASK);
66 mstat = lstat = stat & ~MANTIS_INT_RISCSTAT; 65 mstat = lstat = stat & ~MANTIS_INT_RISCSTAT;
67 66 if (!(stat & mask))
68 if (!(stat & mask)) {
69 dprintk(verbose, MANTIS_DEBUG, 1, "Not ours !");
70 return IRQ_NONE; 67 return IRQ_NONE;
68
69 mantis->mantis_int_stat = stat;
70 mantis->mantis_int_mask = mask;
71 dprintk(verbose, MANTIS_DEBUG, 0, "=== Interrupts[%04x/%04x]= [", stat, mask);
72 if (stat & MANTIS_INT_RISCEN) {
73 dprintk(verbose, MANTIS_DEBUG, 0, "* DMA enabl *");
74 }
75 if (stat & MANTIS_INT_I2CRACK) {
76 dprintk(verbose, MANTIS_DEBUG, 0, "* I2C R-ACK *");
77// wake_up(&mantis->i2c_wq);
78 }
79 if (stat & MANTIS_INT_PCMCIA7) {
80 dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-07 *");
81 }
82 if (stat & MANTIS_INT_IRQ0) {
83 dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-0 *");
84 }
85 if (stat & MANTIS_INT_IRQ1) {
86 dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-1 *");
87 }
88 if (stat & MANTIS_INT_OCERR) {
89 dprintk(verbose, MANTIS_DEBUG, 0, "* INT OCERR *");
90 }
91 if (stat & MANTIS_INT_PABORT) {
92 dprintk(verbose, MANTIS_DEBUG, 0, "* INT PABRT *");
93 }
94 if (stat & MANTIS_INT_RIPERR) {
95 dprintk(verbose, MANTIS_DEBUG, 0, "* INT RIPRR *");
71 } 96 }
72 mmwrite(lstat, MANTIS_INT_STAT); 97 if (stat & MANTIS_INT_PPERR) {
73 interrupts = hweight32(stat); 98 dprintk(verbose, MANTIS_DEBUG, 0, "* INT PPERR *");
74 dprintk(verbose, MANTIS_DEBUG, 0, "=== Interrupts[%04x/%04x]=%d [", stat, mask, interrupts);
75
76 while (lstat) {
77 if (lstat & MANTIS_INT_RISCEN) {
78 dprintk(verbose, MANTIS_DEBUG, 0, "* DMA enabl *");
79 lstat &= ~MANTIS_INT_RISCEN;
80
81 } else if (lstat & MANTIS_INT_I2CRACK) {
82 dprintk(verbose, MANTIS_DEBUG, 0, "* I2C R-ACK *");
83 mantis->mantis_int_stat = stat;
84 mantis->mantis_int_mask = mask;
85 wake_up(&mantis->i2c_wq);
86 lstat &= ~MANTIS_INT_I2CRACK;
87
88 } else if (lstat & MANTIS_INT_PCMCIA7) {
89 dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-07 *");
90 lstat &= ~MANTIS_INT_PCMCIA7;
91
92 } else if (lstat & MANTIS_INT_PCMCIA6) {
93 dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-06 *");
94 lstat &= ~MANTIS_INT_PCMCIA6;
95
96 } else if (lstat & MANTIS_INT_PCMCIA5) {
97 dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-05 *");
98 lstat &= ~MANTIS_INT_PCMCIA5;
99
100 } else if (lstat & MANTIS_INT_PCMCIA4) {
101 dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-04 *");
102 lstat &= ~MANTIS_INT_PCMCIA4;
103
104 } else if (lstat & MANTIS_INT_PCMCIA3) {
105 dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-03 *");
106 lstat &= ~MANTIS_INT_PCMCIA3;
107
108 } else if (lstat & MANTIS_INT_PCMCIA2) {
109 dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-02 *");
110 lstat &= ~MANTIS_INT_PCMCIA2;
111
112 } else if (lstat & MANTIS_INT_PCMCIA1) {
113 dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-01 *");
114 lstat &= ~MANTIS_INT_PCMCIA1;
115
116 } else if (lstat & MANTIS_INT_PCMCIA0) {
117 dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-00 *");
118 lstat &= ~MANTIS_INT_PCMCIA0;
119
120 } else if (lstat & MANTIS_INT_IRQ0) {
121 dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-0 *");
122 lstat &= ~MANTIS_INT_IRQ0;
123
124 } else if (lstat & MANTIS_INT_IRQ1) {
125 dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-1 *");
126 lstat &= ~MANTIS_INT_IRQ1;
127
128 } else if (lstat & MANTIS_INT_OCERR) {
129 dprintk(verbose, MANTIS_DEBUG, 0, "* INT OCERR *");
130 lstat &= ~MANTIS_INT_OCERR;
131
132 } else if (lstat & MANTIS_INT_PABORT) {
133 dprintk(verbose, MANTIS_DEBUG, 0, "* INT PABRT *");
134 lstat &= ~MANTIS_INT_PABORT;
135
136 } else if (lstat & MANTIS_INT_RIPERR) {
137 dprintk(verbose, MANTIS_DEBUG, 0, "* INT RIPRR *");
138 lstat &= ~MANTIS_INT_RIPERR;
139
140 } else if (lstat & MANTIS_INT_PPERR) {
141 dprintk(verbose, MANTIS_DEBUG, 0, "* INT PPERR *");
142 lstat &= ~MANTIS_INT_PPERR;
143
144 } else if (lstat & MANTIS_INT_FTRGT) {
145 dprintk(verbose, MANTIS_DEBUG, 0, "* INT FTRGT *");
146 lstat &= ~MANTIS_INT_FTRGT;
147
148 } else if (lstat & MANTIS_INT_RISCI) {
149 dprintk(verbose, MANTIS_DEBUG, 0, "* INT RISCI *");
150 mantis->finished_block = (stat & MANTIS_INT_RISCSTAT) >> 28;
151 tasklet_schedule(&mantis->tasklet);
152 lstat &= ~MANTIS_INT_RISCI;
153
154 } else if (lstat & MANTIS_INT_I2CDONE) {
155 dprintk(verbose, MANTIS_DEBUG, 0, "* I2C DONE *");
156 mantis->mantis_int_stat = stat;
157 mantis->mantis_int_mask = mask;
158 lstat &= ~MANTIS_INT_I2CDONE;
159 } else {
160 dprintk(verbose, MANTIS_DEBUG, 0,
161 "* Unknown [%04x/%04x] *", stat, mask);
162 break;
163 }
164 i++;
165 if (i > interrupts) {
166 dprintk(verbose, MANTIS_ERROR, 1, "going Loopy ! -- BREAK --");
167 break;
168 }
169 } 99 }
100 if (stat & MANTIS_INT_FTRGT) {
101 dprintk(verbose, MANTIS_DEBUG, 0, "* INT FTRGT *");
102 }
103 if (stat & MANTIS_INT_RISCI) {
104 dprintk(verbose, MANTIS_DEBUG, 0, "* INT RISCI *");
105 mantis->finished_block = (stat & MANTIS_INT_RISCSTAT) >> 28;
106 tasklet_schedule(&mantis->tasklet);
107 }
108 if (stat & MANTIS_INT_I2CDONE) {
109 dprintk(verbose, MANTIS_DEBUG, 0, "* I2C DONE *");
110 wake_up(&mantis->i2c_wq);
111 }
112 mmwrite(stat, MANTIS_INT_STAT);
113 stat &= ~(MANTIS_INT_RISCEN | MANTIS_INT_I2CDONE |
114 MANTIS_INT_I2CRACK | MANTIS_INT_PCMCIA7 |
115 MANTIS_INT_PCMCIA6 | MANTIS_INT_PCMCIA5 |
116 MANTIS_INT_PCMCIA4 | MANTIS_INT_PCMCIA3 |
117 MANTIS_INT_PCMCIA2 | MANTIS_INT_PCMCIA1 |
118 MANTIS_INT_PCMCIA0 | MANTIS_INT_IRQ1 |
119 MANTIS_INT_IRQ0 | MANTIS_INT_OCERR |
120 MANTIS_INT_PABORT | MANTIS_INT_RIPERR |
121 MANTIS_INT_PPERR | MANTIS_INT_FTRGT |
122 MANTIS_INT_RISCI);
123
124 if (stat)
125 dprintk(verbose, MANTIS_DEBUG, 0, "* Unknown [%04x] *", stat);
126
170 dprintk(verbose, MANTIS_DEBUG, 0, "] ===\n"); 127 dprintk(verbose, MANTIS_DEBUG, 0, "] ===\n");
171 128
172 return IRQ_HANDLED; 129 return IRQ_HANDLED;
@@ -180,8 +137,6 @@ static int __devinit mantis_pci_probe(struct pci_dev *pdev,
180 struct mantis_pci *mantis; 137 struct mantis_pci *mantis;
181 int ret = 0; 138 int ret = 0;
182 139
183 devs++;
184
185 mantis = kmalloc(sizeof (struct mantis_pci), GFP_KERNEL); 140 mantis = kmalloc(sizeof (struct mantis_pci), GFP_KERNEL);
186 if (mantis == NULL) { 141 if (mantis == NULL) {
187 printk("%s: Out of memory\n", __func__); 142 printk("%s: Out of memory\n", __func__);
@@ -190,6 +145,8 @@ static int __devinit mantis_pci_probe(struct pci_dev *pdev,
190 } 145 }
191 memset(mantis, 0, sizeof (struct mantis_pci)); 146 memset(mantis, 0, sizeof (struct mantis_pci));
192 mantis->num = devs; 147 mantis->num = devs;
148 devs++;
149
193 if (pci_enable_device(pdev)) { 150 if (pci_enable_device(pdev)) {
194 dprintk(verbose, MANTIS_ERROR, 1, "Mantis PCI enable failed"); 151 dprintk(verbose, MANTIS_ERROR, 1, "Mantis PCI enable failed");
195 ret = -ENODEV; 152 ret = -ENODEV;
@@ -225,11 +182,13 @@ static int __devinit mantis_pci_probe(struct pci_dev *pdev,
225 mantis->latency = latency; 182 mantis->latency = latency;
226 mantis->revision = revision; 183 mantis->revision = revision;
227 mantis->pdev = pdev; 184 mantis->pdev = pdev;
185 mantis->subsystem_vendor = pdev->subsystem_vendor;
186 mantis->subsystem_device = pdev->subsystem_device;
228 init_waitqueue_head(&mantis->i2c_wq); 187 init_waitqueue_head(&mantis->i2c_wq);
229 188
230 // CAM bypass 189 // CAM bypass
231 //mmwrite(mmread(MANTIS_INT_MASK) | MANTIS_INT_IRQ1, MANTIS_INT_MASK); 190 //mmwrite(mmread(MANTIS_INT_MASK) | MANTIS_INT_IRQ1, MANTIS_INT_MASK);
232 dprintk(verbose, MANTIS_INFO, 1, "gpif status: %04x irqcfg: %04x", mmread(0x9c), mmread(0x98)); 191 dprintk(verbose, MANTIS_INFO, 0, "\ngpif status: %04x irqcfg: %04x\n", mmread(0x9c), mmread(0x98));
233 if ((mmread(0x9c) & 0x200) != 0) { //CAM inserted 192 if ((mmread(0x9c) & 0x200) != 0) { //CAM inserted
234 msleep_interruptible(1); 193 msleep_interruptible(1);
235 if ((mmread(0x9c) & 0x200) != 0) 194 if ((mmread(0x9c) & 0x200) != 0)
@@ -242,11 +201,8 @@ static int __devinit mantis_pci_probe(struct pci_dev *pdev,
242 } 201 }
243 mantis_set_direction(mantis, 0); 202 mantis_set_direction(mantis, 0);
244 203
245 // default latency if none specified
246 if (!latency) 204 if (!latency)
247 pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 32); 205 pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 32);
248 dprintk(verbose, MANTIS_ERROR, 0, "Mantis Rev %d, ",
249 mantis->revision);
250 206
251 dprintk(verbose, MANTIS_ERROR, 0, 207 dprintk(verbose, MANTIS_ERROR, 0,
252 "irq: %d, latency: %d\n memory: 0x%lx, mmio: 0x%p\n", 208 "irq: %d, latency: %d\n memory: 0x%lx, mmio: 0x%p\n",
diff --git a/drivers/media/dvb/mantis/mantis_vp1033.c b/drivers/media/dvb/mantis/mantis_vp1033.c
index 720f4fb7e925..07fcc45b7f67 100644
--- a/drivers/media/dvb/mantis/mantis_vp1033.c
+++ b/drivers/media/dvb/mantis/mantis_vp1033.c
@@ -81,6 +81,14 @@ struct stv0299_config lgtdqcs001f_config = {
81// .pll_set = lgtdqcs001f_pll_set, 81// .pll_set = lgtdqcs001f_pll_set,
82}; 82};
83 83
84#define MANTIS_MODEL_NAME "VP-1033"
85#define MANTIS_DEV_TYPE "DVB-S/DSS"
86
87struct mantis_hwconfig vp1033_mantis_config = {
88 .model_name = MANTIS_MODEL_NAME,
89 .dev_type = MANTIS_DEV_TYPE,
90};
91
84int lgtdqcs001f_tuner_set(struct dvb_frontend *fe, 92int lgtdqcs001f_tuner_set(struct dvb_frontend *fe,
85 struct dvb_frontend_parameters *params) 93 struct dvb_frontend_parameters *params)
86{ 94{
diff --git a/drivers/media/dvb/mantis/mantis_vp1033.h b/drivers/media/dvb/mantis/mantis_vp1033.h
index d50f09233ffb..e24570659d55 100644
--- a/drivers/media/dvb/mantis/mantis_vp1033.h
+++ b/drivers/media/dvb/mantis/mantis_vp1033.h
@@ -21,10 +21,14 @@
21#ifndef __MANTIS_VP1033_H 21#ifndef __MANTIS_VP1033_H
22#define __MANTIS_VP1033_H 22#define __MANTIS_VP1033_H
23 23
24#include "stv0299.h"
25#include "dvb_frontend.h" 24#include "dvb_frontend.h"
25#include "mantis_common.h"
26#include "stv0299.h"
27
28#define MANTIS_VP_1033_DVB_S 0x0016
26 29
27extern struct stv0299_config lgtdqcs001f_config; 30extern struct stv0299_config lgtdqcs001f_config;
31extern struct mantis_hwconfig vp1033_mantis_config;
28 32
29extern int lgtdqcs001f_tuner_set(struct dvb_frontend *fe, 33extern int lgtdqcs001f_tuner_set(struct dvb_frontend *fe,
30 struct dvb_frontend_parameters *params); 34 struct dvb_frontend_parameters *params);
diff --git a/drivers/media/dvb/mantis/mantis_vp1034.c b/drivers/media/dvb/mantis/mantis_vp1034.c
index b85ac29691d0..c9c947911627 100644
--- a/drivers/media/dvb/mantis/mantis_vp1034.c
+++ b/drivers/media/dvb/mantis/mantis_vp1034.c
@@ -26,6 +26,14 @@ struct mb86a16_config vp1034_config = {
26 .set_voltage = vp1034_set_voltage, 26 .set_voltage = vp1034_set_voltage,
27}; 27};
28 28
29#define MANTIS_MODEL_NAME "VP-1034"
30#define MANTIS_DEV_TYPE "DVB-S/DSS"
31
32struct mantis_hwconfig vp1034_mantis_config = {
33 .model_name = MANTIS_MODEL_NAME,
34 .dev_type = MANTIS_DEV_TYPE,
35};
36
29int vp1034_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) 37int vp1034_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
30{ 38{
31 struct mantis_pci *mantis = fe->dvb->priv; 39 struct mantis_pci *mantis = fe->dvb->priv;
diff --git a/drivers/media/dvb/mantis/mantis_vp1034.h b/drivers/media/dvb/mantis/mantis_vp1034.h
index 2324dada09de..21948573b087 100644
--- a/drivers/media/dvb/mantis/mantis_vp1034.h
+++ b/drivers/media/dvb/mantis/mantis_vp1034.h
@@ -21,9 +21,14 @@
21#ifndef __MANTIS_VP1034_H 21#ifndef __MANTIS_VP1034_H
22#define __MANTIS_VP1034_H 22#define __MANTIS_VP1034_H
23 23
24#include "mb86a16.h"
25#include "dvb_frontend.h" 24#include "dvb_frontend.h"
25#include "mantis_common.h"
26#include "mb86a16.h"
27
28
29#define MANTIS_VP_1034_DVB_S 0x0014
26 30
31extern struct mantis_hwconfig vp1034_mantis_config;
27extern struct mb86a16_config vp1034_config; 32extern struct mb86a16_config vp1034_config;
28extern int vp1034_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage); 33extern int vp1034_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage);
29 34
diff --git a/drivers/media/dvb/mantis/mantis_vp2033.c b/drivers/media/dvb/mantis/mantis_vp2033.c
index bca9ebaf39d7..e98959769120 100644
--- a/drivers/media/dvb/mantis/mantis_vp2033.c
+++ b/drivers/media/dvb/mantis/mantis_vp2033.c
@@ -32,9 +32,17 @@ struct tda10021_state {
32 u8 reg0; 32 u8 reg0;
33}; 33};
34 34
35#define MANTIS_MODEL_NAME "VP-2033"
36#define MANTIS_DEV_TYPE "DVB-C"
37
38struct mantis_hwconfig vp2033_mantis_config = {
39 .model_name = MANTIS_MODEL_NAME,
40 .dev_type = MANTIS_DEV_TYPE,
41};
42
35struct cu1216_config philips_cu1216_config = { 43struct cu1216_config philips_cu1216_config = {
36 .demod_address = 0x18 >> 1, 44 .demod_address = 0x18 >> 1,
37 .pll_set = philips_cu1216_tuner_set, 45 .pll_set = philips_cu1216_tuner_set,
38// .fe_reset = mantis_fe_reset, 46// .fe_reset = mantis_fe_reset,
39}; 47};
40 48
@@ -47,10 +55,10 @@ int philips_cu1216_tuner_set(struct dvb_frontend *fe,
47 u8 buf[4]; 55 u8 buf[4];
48 56
49 struct i2c_msg msg = { 57 struct i2c_msg msg = {
50 .addr = 0xc0 >> 1, 58 .addr = 0xc0 >> 1,
51 .flags = 0, 59 .flags = 0,
52 .buf = buf, 60 .buf = buf,
53 .len = sizeof (buf) 61 .len = sizeof (buf)
54 }; 62 };
55 63
56#define TUNER_MUL 62500 64#define TUNER_MUL 62500
diff --git a/drivers/media/dvb/mantis/mantis_vp2033.h b/drivers/media/dvb/mantis/mantis_vp2033.h
index 29baba180961..513c491942cb 100644
--- a/drivers/media/dvb/mantis/mantis_vp2033.h
+++ b/drivers/media/dvb/mantis/mantis_vp2033.h
@@ -21,10 +21,14 @@
21#ifndef __MANTIS_VP2033_H 21#ifndef __MANTIS_VP2033_H
22#define __MANTIS_VP2033_H 22#define __MANTIS_VP2033_H
23 23
24#include "cu1216.h"
25#include "dvb_frontend.h" 24#include "dvb_frontend.h"
25#include "mantis_common.h"
26#include "cu1216.h"
27
28#define MANTIS_VP_2033_DVB_C 0x0008
26 29
27extern struct cu1216_config philips_cu1216_config; 30extern struct cu1216_config philips_cu1216_config;
31extern struct mantis_hwconfig vp2033_mantis_config;
28 32
29extern int philips_cu1216_tuner_set(struct dvb_frontend *fe, 33extern int philips_cu1216_tuner_set(struct dvb_frontend *fe,
30 struct dvb_frontend_parameters *params); 34 struct dvb_frontend_parameters *params);
diff --git a/drivers/media/dvb/mantis/mantis_vp3030.c b/drivers/media/dvb/mantis/mantis_vp3030.c
index f44f226ce9ab..8043e5d9218d 100644
--- a/drivers/media/dvb/mantis/mantis_vp3030.c
+++ b/drivers/media/dvb/mantis/mantis_vp3030.c
@@ -22,7 +22,15 @@
22#include "mantis_vp3030.h" 22#include "mantis_vp3030.h"
23 23
24struct zl10353_config mantis_vp3030_config = { 24struct zl10353_config mantis_vp3030_config = {
25 .demod_address = 0x0f, 25 .demod_address = 0x0f,
26};
27
28#define MANTIS_MODEL_NAME "VP-3030"
29#define MANTIS_DEV_TYPE "DVB-T"
30
31struct mantis_hwconfig vp3030_mantis_config = {
32 .model_name = MANTIS_MODEL_NAME,
33 .dev_type = MANTIS_DEV_TYPE,
26}; 34};
27 35
28int panasonic_en57h12d5_set_params(struct dvb_frontend *fe, 36int panasonic_en57h12d5_set_params(struct dvb_frontend *fe,
diff --git a/drivers/media/dvb/mantis/mantis_vp3030.h b/drivers/media/dvb/mantis/mantis_vp3030.h
index f8e72cce7e69..acc50a48e18f 100644
--- a/drivers/media/dvb/mantis/mantis_vp3030.h
+++ b/drivers/media/dvb/mantis/mantis_vp3030.h
@@ -21,10 +21,14 @@
21#ifndef __MANTIS_VP3030_H 21#ifndef __MANTIS_VP3030_H
22#define __MANTIS_VP3030_H 22#define __MANTIS_VP3030_H
23 23
24#include "zl10353.h"
25#include "dvb-pll.h"
26#include "dvb_frontend.h" 24#include "dvb_frontend.h"
25#include "mantis_common.h"
26#include "dvb-pll.h"
27#include "zl10353.h"
28
29#define MANTIS_VP_3030_DVB_T 0x0024
27 30
28extern struct zl10353_config mantis_vp3030_config; 31extern struct zl10353_config mantis_vp3030_config;
32extern struct mantis_hwconfig vp3030_mantis_config;
29 33
30#endif // __MANTIS_VP3030_H 34#endif // __MANTIS_VP3030_H