aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/ttpci/budget-av.c
diff options
context:
space:
mode:
authorAndrew de Quincey <adq_dvb@lidskialf.net>2006-01-09 12:25:05 -0500
committerMauro Carvalho Chehab <mchehab@brturbo.com.br>2006-01-09 12:25:05 -0500
commit2d0235df0e62cb9f07232bf9cf8009fabf13d304 (patch)
treebe338e90f7dfc419bf294fb5e38289fff77ac81b /drivers/media/dvb/ttpci/budget-av.c
parent8a8e9c281de5dd63cdcbbafc0252fe0d8c758294 (diff)
DVB (2428): Fixes for the topuptv/SCM mediaguard CAM module in KNC1 CI module
- Fixes for the topuptv/SCM mediaguard CAM module in KNC1 CI module Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Diffstat (limited to 'drivers/media/dvb/ttpci/budget-av.c')
-rw-r--r--drivers/media/dvb/ttpci/budget-av.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c
index 9f51bae7194c..8bc784ab1972 100644
--- a/drivers/media/dvb/ttpci/budget-av.c
+++ b/drivers/media/dvb/ttpci/budget-av.c
@@ -127,7 +127,7 @@ static int ciintf_read_attribute_mem(struct dvb_ca_en50221 *ca, int slot, int ad
127 saa7146_setgpio(budget_av->budget.dev, 1, SAA7146_GPIO_OUTHI); 127 saa7146_setgpio(budget_av->budget.dev, 1, SAA7146_GPIO_OUTHI);
128 udelay(1); 128 udelay(1);
129 129
130 result = ttpci_budget_debiread(&budget_av->budget, DEBICICAM, address & 0xfff, 1, 0, 0); 130 result = ttpci_budget_debiread(&budget_av->budget, DEBICICAM, address & 0xfff, 1, 0, 1);
131 131
132 if (result == -ETIMEDOUT) 132 if (result == -ETIMEDOUT)
133 budget_av->slot_status = 0; 133 budget_av->slot_status = 0;
@@ -145,7 +145,7 @@ static int ciintf_write_attribute_mem(struct dvb_ca_en50221 *ca, int slot, int a
145 saa7146_setgpio(budget_av->budget.dev, 1, SAA7146_GPIO_OUTHI); 145 saa7146_setgpio(budget_av->budget.dev, 1, SAA7146_GPIO_OUTHI);
146 udelay(1); 146 udelay(1);
147 147
148 result = ttpci_budget_debiwrite(&budget_av->budget, DEBICICAM, address & 0xfff, 1, value, 0, 0); 148 result = ttpci_budget_debiwrite(&budget_av->budget, DEBICICAM, address & 0xfff, 1, value, 0, 1);
149 149
150 if (result == -ETIMEDOUT) 150 if (result == -ETIMEDOUT)
151 budget_av->slot_status = 0; 151 budget_av->slot_status = 0;
@@ -192,7 +192,7 @@ static int ciintf_slot_reset(struct dvb_ca_en50221 *ca, int slot)
192{ 192{
193 struct budget_av *budget_av = (struct budget_av *) ca->data; 193 struct budget_av *budget_av = (struct budget_av *) ca->data;
194 struct saa7146_dev *saa = budget_av->budget.dev; 194 struct saa7146_dev *saa = budget_av->budget.dev;
195 int timeout = 500; // 5 seconds (4.4.6 Ready) 195 int timeout = 50; // 5 seconds (4.4.6 Ready)
196 196
197 if (slot != 0) 197 if (slot != 0)
198 return -EINVAL; 198 return -EINVAL;
@@ -256,19 +256,37 @@ static int ciintf_poll_slot_status(struct dvb_ca_en50221 *ca, int slot, int open
256{ 256{
257 struct budget_av *budget_av = (struct budget_av *) ca->data; 257 struct budget_av *budget_av = (struct budget_av *) ca->data;
258 struct saa7146_dev *saa = budget_av->budget.dev; 258 struct saa7146_dev *saa = budget_av->budget.dev;
259 int cam_present = 0;
259 260
260 if (slot != 0) 261 if (slot != 0)
261 return -EINVAL; 262 return -EINVAL;
262 263
263 if (!budget_av->slot_status) { 264 if (!budget_av->slot_status)
265 {
266 // first of all test the card detect line
264 saa7146_setgpio(saa, 3, SAA7146_GPIO_INPUT); 267 saa7146_setgpio(saa, 3, SAA7146_GPIO_INPUT);
265 udelay(1); 268 udelay(1);
266 if (saa7146_read(saa, PSR) & MASK_06) 269 if (saa7146_read(saa, PSR) & MASK_06)
267 { 270 {
271 cam_present = 1;
272 }
273 saa7146_setgpio(saa, 3, SAA7146_GPIO_OUTLO);
274
275 // that is unreliable however, so try and read from IO memory
276 if (!cam_present)
277 {
278 saa7146_setgpio(budget_av->budget.dev, 1, SAA7146_GPIO_OUTLO);
279 if (ttpci_budget_debiread(&budget_av->budget, DEBICICAM, 0, 1, 0, 1) != -ETIMEDOUT)
280 {
281 cam_present = 1;
282 }
283 }
284
285 // did we find something?
286 if (cam_present) {
268 printk(KERN_INFO "budget-av: cam inserted\n"); 287 printk(KERN_INFO "budget-av: cam inserted\n");
269 budget_av->slot_status = 1; 288 budget_av->slot_status = 1;
270 } 289 }
271 saa7146_setgpio(saa, 3, SAA7146_GPIO_OUTLO);
272 } else if (!open) { 290 } else if (!open) {
273 saa7146_setgpio(budget_av->budget.dev, 1, SAA7146_GPIO_OUTLO); 291 saa7146_setgpio(budget_av->budget.dev, 1, SAA7146_GPIO_OUTLO);
274 if (ttpci_budget_debiread(&budget_av->budget, DEBICICAM, 0, 1, 0, 1) == -ETIMEDOUT) 292 if (ttpci_budget_debiread(&budget_av->budget, DEBICICAM, 0, 1, 0, 1) == -ETIMEDOUT)