summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/ttpci/budget-core.c
diff options
context:
space:
mode:
authorAndrew de Quincy <devnull@localhost>2004-11-12 17:30:07 +0000
committerAndrew de Quincy <devnull@localhost>2004-11-12 17:30:07 +0000
commit0f191893b127c16c0a9ccfc3557ddf4dbae2f1a9 (patch)
treed43ab2a49c06c0f98080aa61b059a91c218abc2b /linux/drivers/media/dvb/ttpci/budget-core.c
parentff1fec5eac165d66fb5693c745a8ab7930d09fd2 (diff)
downloadmediapointer-dvb-s2-0f191893b127c16c0a9ccfc3557ddf4dbae2f1a9.tar.gz
mediapointer-dvb-s2-0f191893b127c16c0a9ccfc3557ddf4dbae2f1a9.tar.bz2
Updated to fix problems with some CAMs on KNC1 cards
Diffstat (limited to 'linux/drivers/media/dvb/ttpci/budget-core.c')
-rw-r--r--linux/drivers/media/dvb/ttpci/budget-core.c53
1 files changed, 34 insertions, 19 deletions
diff --git a/linux/drivers/media/dvb/ttpci/budget-core.c b/linux/drivers/media/dvb/ttpci/budget-core.c
index 86c7d2b93..c42fc407a 100644
--- a/linux/drivers/media/dvb/ttpci/budget-core.c
+++ b/linux/drivers/media/dvb/ttpci/budget-core.c
@@ -163,21 +163,23 @@ static void vpeirq (unsigned long data)
}
-u32 ttpci_budget_debiread (struct budget *budget, u32 config, int addr,
- int count)
+int ttpci_budget_debiread (struct budget *budget, u32 config, int addr,
+ int count, int uselocks)
{
struct saa7146_dev *saa = budget->dev;
- u32 result = 0;
- unsigned long flags;
+ int result = 0;
+ unsigned long flags = 0;
if (count > 4 || count <= 0)
return 0;
- spin_lock_irqsave (&budget->debilock, flags);
+ if (uselocks)
+ spin_lock_irqsave (&budget->debilock, flags);
- if (saa7146_wait_for_debi_done (saa) < 0) {
- spin_unlock_irqrestore (&budget->debilock, flags);
- return 0;
+ if ((result = saa7146_wait_for_debi_done (saa, uselocks)) < 0) {
+ if (uselocks)
+ spin_unlock_irqrestore (&budget->debilock, flags);
+ return result;
}
saa7146_write (saa, DEBI_COMMAND,
@@ -186,30 +188,38 @@ u32 ttpci_budget_debiread (struct budget *budget, u32 config, int addr,
saa7146_write (saa, DEBI_PAGE, 0);
saa7146_write (saa, MC2, (2 << 16) | 2);
- saa7146_wait_for_debi_done (saa);
+ if ((result = saa7146_wait_for_debi_done (saa, uselocks)) < 0) {
+ if (uselocks)
+ spin_unlock_irqrestore (&budget->debilock, flags);
+ return result;
+ }
result = saa7146_read (saa, DEBI_AD);
result &= (0xffffffffUL >> ((4 - count) * 8));
- spin_unlock_irqrestore (&budget->debilock, flags);
+ if (uselocks)
+ spin_unlock_irqrestore (&budget->debilock, flags);
return result;
}
-u8 ttpci_budget_debiwrite (struct budget *budget, u32 config, int addr,
- int count, u32 value)
+int ttpci_budget_debiwrite (struct budget *budget, u32 config, int addr,
+ int count, u32 value, int uselocks)
{
struct saa7146_dev *saa = budget->dev;
- unsigned long flags;
+ unsigned long flags = 0;
+ int result;
if (count > 4 || count <= 0)
return 0;
- spin_lock_irqsave (&budget->debilock, flags);
+ if (uselocks)
+ spin_lock_irqsave (&budget->debilock, flags);
- if (saa7146_wait_for_debi_done (saa) < 0) {
- spin_unlock_irqrestore (&budget->debilock, flags);
- return 0;
+ if ((result = saa7146_wait_for_debi_done (saa, uselocks)) < 0) {
+ if (uselocks)
+ spin_unlock_irqrestore (&budget->debilock, flags);
+ return result;
}
saa7146_write (saa, DEBI_COMMAND,
@@ -219,9 +229,14 @@ u8 ttpci_budget_debiwrite (struct budget *budget, u32 config, int addr,
saa7146_write (saa, DEBI_AD, value);
saa7146_write (saa, MC2, (2 << 16) | 2);
- saa7146_wait_for_debi_done (saa);
+ if ((result = saa7146_wait_for_debi_done (saa, uselocks)) < 0) {
+ if (uselocks)
+ spin_unlock_irqrestore (&budget->debilock, flags);
+ return result;
+ }
- spin_unlock_irqrestore (&budget->debilock, flags);
+ if (uselocks)
+ spin_unlock_irqrestore (&budget->debilock, flags);
return 0;
}