aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/ttpci
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/ttpci')
-rw-r--r--drivers/media/dvb/ttpci/av7110.c23
-rw-r--r--drivers/media/dvb/ttpci/av7110.h7
-rw-r--r--drivers/media/dvb/ttpci/av7110_hw.c40
-rw-r--r--drivers/media/dvb/ttpci/budget.h4
4 files changed, 38 insertions, 36 deletions
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c
index d36369e9e88f..1aa61bf29ad6 100644
--- a/drivers/media/dvb/ttpci/av7110.c
+++ b/drivers/media/dvb/ttpci/av7110.c
@@ -54,7 +54,6 @@
54#include <linux/i2c.h> 54#include <linux/i2c.h>
55 55
56#include <asm/system.h> 56#include <asm/system.h>
57#include <asm/semaphore.h>
58 57
59#include <linux/dvb/frontend.h> 58#include <linux/dvb/frontend.h>
60 59
@@ -242,10 +241,10 @@ static int arm_thread(void *data)
242 if (!av7110->arm_ready) 241 if (!av7110->arm_ready)
243 continue; 242 continue;
244 243
245 if (down_interruptible(&av7110->dcomlock)) 244 if (mutex_lock_interruptible(&av7110->dcomlock))
246 break; 245 break;
247 newloops = rdebi(av7110, DEBINOSWAP, STATUS_LOOPS, 0, 2); 246 newloops = rdebi(av7110, DEBINOSWAP, STATUS_LOOPS, 0, 2);
248 up(&av7110->dcomlock); 247 mutex_unlock(&av7110->dcomlock);
249 248
250 if (newloops == av7110->arm_loops || av7110->arm_errors > 3) { 249 if (newloops == av7110->arm_loops || av7110->arm_errors > 3) {
251 printk(KERN_ERR "dvb-ttpci: ARM crashed @ card %d\n", 250 printk(KERN_ERR "dvb-ttpci: ARM crashed @ card %d\n",
@@ -253,10 +252,10 @@ static int arm_thread(void *data)
253 252
254 recover_arm(av7110); 253 recover_arm(av7110);
255 254
256 if (down_interruptible(&av7110->dcomlock)) 255 if (mutex_lock_interruptible(&av7110->dcomlock))
257 break; 256 break;
258 newloops = rdebi(av7110, DEBINOSWAP, STATUS_LOOPS, 0, 2) - 1; 257 newloops = rdebi(av7110, DEBINOSWAP, STATUS_LOOPS, 0, 2) - 1;
259 up(&av7110->dcomlock); 258 mutex_unlock(&av7110->dcomlock);
260 } 259 }
261 av7110->arm_loops = newloops; 260 av7110->arm_loops = newloops;
262 av7110->arm_errors = 0; 261 av7110->arm_errors = 0;
@@ -741,7 +740,7 @@ int ChangePIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid,
741 int ret = 0; 740 int ret = 0;
742 dprintk(4, "%p\n", av7110); 741 dprintk(4, "%p\n", av7110);
743 742
744 if (down_interruptible(&av7110->pid_mutex)) 743 if (mutex_lock_interruptible(&av7110->pid_mutex))
745 return -ERESTARTSYS; 744 return -ERESTARTSYS;
746 745
747 if (!(vpid & 0x8000)) 746 if (!(vpid & 0x8000))
@@ -760,7 +759,7 @@ int ChangePIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid,
760 ret = SetPIDs(av7110, vpid, apid, ttpid, subpid, pcrpid); 759 ret = SetPIDs(av7110, vpid, apid, ttpid, subpid, pcrpid);
761 } 760 }
762 761
763 up(&av7110->pid_mutex); 762 mutex_unlock(&av7110->pid_mutex);
764 return ret; 763 return ret;
765} 764}
766 765
@@ -2096,7 +2095,7 @@ static int av7110_fe_lock_fix(struct av7110* av7110, fe_status_t status)
2096 if (av7110->playing) 2095 if (av7110->playing)
2097 return 0; 2096 return 0;
2098 2097
2099 if (down_interruptible(&av7110->pid_mutex)) 2098 if (mutex_lock_interruptible(&av7110->pid_mutex))
2100 return -ERESTARTSYS; 2099 return -ERESTARTSYS;
2101 2100
2102 if (synced) { 2101 if (synced) {
@@ -2118,7 +2117,7 @@ static int av7110_fe_lock_fix(struct av7110* av7110, fe_status_t status)
2118 if (!ret) 2117 if (!ret)
2119 av7110->fe_synced = synced; 2118 av7110->fe_synced = synced;
2120 2119
2121 up(&av7110->pid_mutex); 2120 mutex_unlock(&av7110->pid_mutex);
2122 return ret; 2121 return ret;
2123} 2122}
2124 2123
@@ -2713,16 +2712,16 @@ static int av7110_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_d
2713 tasklet_init (&av7110->debi_tasklet, debiirq, (unsigned long) av7110); 2712 tasklet_init (&av7110->debi_tasklet, debiirq, (unsigned long) av7110);
2714 tasklet_init (&av7110->gpio_tasklet, gpioirq, (unsigned long) av7110); 2713 tasklet_init (&av7110->gpio_tasklet, gpioirq, (unsigned long) av7110);
2715 2714
2716 sema_init(&av7110->pid_mutex, 1); 2715 mutex_init(&av7110->pid_mutex);
2717 2716
2718 /* locks for data transfers from/to AV7110 */ 2717 /* locks for data transfers from/to AV7110 */
2719 spin_lock_init(&av7110->debilock); 2718 spin_lock_init(&av7110->debilock);
2720 sema_init(&av7110->dcomlock, 1); 2719 mutex_init(&av7110->dcomlock);
2721 av7110->debitype = -1; 2720 av7110->debitype = -1;
2722 2721
2723 /* default OSD window */ 2722 /* default OSD window */
2724 av7110->osdwin = 1; 2723 av7110->osdwin = 1;
2725 sema_init(&av7110->osd_sema, 1); 2724 mutex_init(&av7110->osd_mutex);
2726 2725
2727 /* ARM "watchdog" */ 2726 /* ARM "watchdog" */
2728 init_waitqueue_head(&av7110->arm_wait); 2727 init_waitqueue_head(&av7110->arm_wait);
diff --git a/drivers/media/dvb/ttpci/av7110.h b/drivers/media/dvb/ttpci/av7110.h
index fafd25fab835..3e2e12124bae 100644
--- a/drivers/media/dvb/ttpci/av7110.h
+++ b/drivers/media/dvb/ttpci/av7110.h
@@ -16,6 +16,7 @@
16#include <linux/dvb/ca.h> 16#include <linux/dvb/ca.h>
17#include <linux/dvb/osd.h> 17#include <linux/dvb/osd.h>
18#include <linux/dvb/net.h> 18#include <linux/dvb/net.h>
19#include <linux/mutex.h>
19 20
20#include "dvbdev.h" 21#include "dvbdev.h"
21#include "demux.h" 22#include "demux.h"
@@ -127,7 +128,7 @@ struct av7110 {
127 /* DEBI and polled command interface */ 128 /* DEBI and polled command interface */
128 129
129 spinlock_t debilock; 130 spinlock_t debilock;
130 struct semaphore dcomlock; 131 struct mutex dcomlock;
131 volatile int debitype; 132 volatile int debitype;
132 volatile int debilen; 133 volatile int debilen;
133 134
@@ -146,7 +147,7 @@ struct av7110 {
146 147
147 int osdwin; /* currently active window */ 148 int osdwin; /* currently active window */
148 u16 osdbpp[8]; 149 u16 osdbpp[8];
149 struct semaphore osd_sema; 150 struct mutex osd_mutex;
150 151
151 /* CA */ 152 /* CA */
152 153
@@ -172,7 +173,7 @@ struct av7110 {
172 struct tasklet_struct vpe_tasklet; 173 struct tasklet_struct vpe_tasklet;
173 174
174 int fe_synced; 175 int fe_synced;
175 struct semaphore pid_mutex; 176 struct mutex pid_mutex;
176 177
177 int video_blank; 178 int video_blank;
178 struct video_status videostate; 179 struct video_status videostate;
diff --git a/drivers/media/dvb/ttpci/av7110_hw.c b/drivers/media/dvb/ttpci/av7110_hw.c
index b2e63e9fc053..3c5366d15a8a 100644
--- a/drivers/media/dvb/ttpci/av7110_hw.c
+++ b/drivers/media/dvb/ttpci/av7110_hw.c
@@ -324,10 +324,10 @@ int av7110_wait_msgstate(struct av7110 *av7110, u16 flags)
324 start = jiffies; 324 start = jiffies;
325 for (;;) { 325 for (;;) {
326 err = time_after(jiffies, start + ARM_WAIT_FREE); 326 err = time_after(jiffies, start + ARM_WAIT_FREE);
327 if (down_interruptible(&av7110->dcomlock)) 327 if (mutex_lock_interruptible(&av7110->dcomlock))
328 return -ERESTARTSYS; 328 return -ERESTARTSYS;
329 stat = rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2); 329 stat = rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2);
330 up(&av7110->dcomlock); 330 mutex_unlock(&av7110->dcomlock);
331 if ((stat & flags) == 0) 331 if ((stat & flags) == 0)
332 break; 332 break;
333 if (err) { 333 if (err) {
@@ -484,11 +484,11 @@ static int av7110_send_fw_cmd(struct av7110 *av7110, u16* buf, int length)
484 dprintk(1, "arm not ready.\n"); 484 dprintk(1, "arm not ready.\n");
485 return -1; 485 return -1;
486 } 486 }
487 if (down_interruptible(&av7110->dcomlock)) 487 if (mutex_lock_interruptible(&av7110->dcomlock))
488 return -ERESTARTSYS; 488 return -ERESTARTSYS;
489 489
490 ret = __av7110_send_fw_cmd(av7110, buf, length); 490 ret = __av7110_send_fw_cmd(av7110, buf, length);
491 up(&av7110->dcomlock); 491 mutex_unlock(&av7110->dcomlock);
492 if (ret && ret!=-ERESTARTSYS) 492 if (ret && ret!=-ERESTARTSYS)
493 printk(KERN_ERR "dvb-ttpci: %s(): av7110_send_fw_cmd error %d\n", 493 printk(KERN_ERR "dvb-ttpci: %s(): av7110_send_fw_cmd error %d\n",
494 __FUNCTION__, ret); 494 __FUNCTION__, ret);
@@ -560,11 +560,11 @@ int av7110_fw_request(struct av7110 *av7110, u16 *request_buf,
560 return -1; 560 return -1;
561 } 561 }
562 562
563 if (down_interruptible(&av7110->dcomlock)) 563 if (mutex_lock_interruptible(&av7110->dcomlock))
564 return -ERESTARTSYS; 564 return -ERESTARTSYS;
565 565
566 if ((err = __av7110_send_fw_cmd(av7110, request_buf, request_buf_len)) < 0) { 566 if ((err = __av7110_send_fw_cmd(av7110, request_buf, request_buf_len)) < 0) {
567 up(&av7110->dcomlock); 567 mutex_unlock(&av7110->dcomlock);
568 printk(KERN_ERR "dvb-ttpci: av7110_fw_request error %d\n", err); 568 printk(KERN_ERR "dvb-ttpci: av7110_fw_request error %d\n", err);
569 return err; 569 return err;
570 } 570 }
@@ -576,7 +576,7 @@ int av7110_fw_request(struct av7110 *av7110, u16 *request_buf,
576 break; 576 break;
577 if (err) { 577 if (err) {
578 printk(KERN_ERR "%s: timeout waiting for COMMAND to complete\n", __FUNCTION__); 578 printk(KERN_ERR "%s: timeout waiting for COMMAND to complete\n", __FUNCTION__);
579 up(&av7110->dcomlock); 579 mutex_unlock(&av7110->dcomlock);
580 return -ETIMEDOUT; 580 return -ETIMEDOUT;
581 } 581 }
582#ifdef _NOHANDSHAKE 582#ifdef _NOHANDSHAKE
@@ -592,7 +592,7 @@ int av7110_fw_request(struct av7110 *av7110, u16 *request_buf,
592 break; 592 break;
593 if (err) { 593 if (err) {
594 printk(KERN_ERR "%s: timeout waiting for HANDSHAKE_REG\n", __FUNCTION__); 594 printk(KERN_ERR "%s: timeout waiting for HANDSHAKE_REG\n", __FUNCTION__);
595 up(&av7110->dcomlock); 595 mutex_unlock(&av7110->dcomlock);
596 return -ETIMEDOUT; 596 return -ETIMEDOUT;
597 } 597 }
598 msleep(1); 598 msleep(1);
@@ -603,12 +603,12 @@ int av7110_fw_request(struct av7110 *av7110, u16 *request_buf,
603 stat = rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2); 603 stat = rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2);
604 if (stat & GPMQOver) { 604 if (stat & GPMQOver) {
605 printk(KERN_ERR "%s: GPMQOver\n", __FUNCTION__); 605 printk(KERN_ERR "%s: GPMQOver\n", __FUNCTION__);
606 up(&av7110->dcomlock); 606 mutex_unlock(&av7110->dcomlock);
607 return -1; 607 return -1;
608 } 608 }
609 else if (stat & OSDQOver) { 609 else if (stat & OSDQOver) {
610 printk(KERN_ERR "%s: OSDQOver\n", __FUNCTION__); 610 printk(KERN_ERR "%s: OSDQOver\n", __FUNCTION__);
611 up(&av7110->dcomlock); 611 mutex_unlock(&av7110->dcomlock);
612 return -1; 612 return -1;
613 } 613 }
614#endif 614#endif
@@ -616,7 +616,7 @@ int av7110_fw_request(struct av7110 *av7110, u16 *request_buf,
616 for (i = 0; i < reply_buf_len; i++) 616 for (i = 0; i < reply_buf_len; i++)
617 reply_buf[i] = rdebi(av7110, DEBINOSWAP, COM_BUFF + 2 * i, 0, 2); 617 reply_buf[i] = rdebi(av7110, DEBINOSWAP, COM_BUFF + 2 * i, 0, 2);
618 618
619 up(&av7110->dcomlock); 619 mutex_unlock(&av7110->dcomlock);
620 return 0; 620 return 0;
621} 621}
622 622
@@ -732,7 +732,7 @@ static int FlushText(struct av7110 *av7110)
732 unsigned long start; 732 unsigned long start;
733 int err; 733 int err;
734 734
735 if (down_interruptible(&av7110->dcomlock)) 735 if (mutex_lock_interruptible(&av7110->dcomlock))
736 return -ERESTARTSYS; 736 return -ERESTARTSYS;
737 start = jiffies; 737 start = jiffies;
738 while (1) { 738 while (1) {
@@ -742,12 +742,12 @@ static int FlushText(struct av7110 *av7110)
742 if (err) { 742 if (err) {
743 printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for BUFF1_BASE == 0\n", 743 printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for BUFF1_BASE == 0\n",
744 __FUNCTION__); 744 __FUNCTION__);
745 up(&av7110->dcomlock); 745 mutex_unlock(&av7110->dcomlock);
746 return -ETIMEDOUT; 746 return -ETIMEDOUT;
747 } 747 }
748 msleep(1); 748 msleep(1);
749 } 749 }
750 up(&av7110->dcomlock); 750 mutex_unlock(&av7110->dcomlock);
751 return 0; 751 return 0;
752} 752}
753 753
@@ -758,7 +758,7 @@ static int WriteText(struct av7110 *av7110, u8 win, u16 x, u16 y, u8* buf)
758 int length = strlen(buf) + 1; 758 int length = strlen(buf) + 1;
759 u16 cbuf[5] = { (COMTYPE_OSD << 8) + DText, 3, win, x, y }; 759 u16 cbuf[5] = { (COMTYPE_OSD << 8) + DText, 3, win, x, y };
760 760
761 if (down_interruptible(&av7110->dcomlock)) 761 if (mutex_lock_interruptible(&av7110->dcomlock))
762 return -ERESTARTSYS; 762 return -ERESTARTSYS;
763 763
764 start = jiffies; 764 start = jiffies;
@@ -769,7 +769,7 @@ static int WriteText(struct av7110 *av7110, u8 win, u16 x, u16 y, u8* buf)
769 if (ret) { 769 if (ret) {
770 printk(KERN_ERR "dvb-ttpci: %s: timeout waiting for BUFF1_BASE == 0\n", 770 printk(KERN_ERR "dvb-ttpci: %s: timeout waiting for BUFF1_BASE == 0\n",
771 __FUNCTION__); 771 __FUNCTION__);
772 up(&av7110->dcomlock); 772 mutex_unlock(&av7110->dcomlock);
773 return -ETIMEDOUT; 773 return -ETIMEDOUT;
774 } 774 }
775 msleep(1); 775 msleep(1);
@@ -783,7 +783,7 @@ static int WriteText(struct av7110 *av7110, u8 win, u16 x, u16 y, u8* buf)
783 if (ret) { 783 if (ret) {
784 printk(KERN_ERR "dvb-ttpci: %s: timeout waiting for HANDSHAKE_REG\n", 784 printk(KERN_ERR "dvb-ttpci: %s: timeout waiting for HANDSHAKE_REG\n",
785 __FUNCTION__); 785 __FUNCTION__);
786 up(&av7110->dcomlock); 786 mutex_unlock(&av7110->dcomlock);
787 return -ETIMEDOUT; 787 return -ETIMEDOUT;
788 } 788 }
789 msleep(1); 789 msleep(1);
@@ -795,7 +795,7 @@ static int WriteText(struct av7110 *av7110, u8 win, u16 x, u16 y, u8* buf)
795 if (length & 1) 795 if (length & 1)
796 wdebi(av7110, DEBINOSWAP, BUFF1_BASE + i * 2, 0, 2); 796 wdebi(av7110, DEBINOSWAP, BUFF1_BASE + i * 2, 0, 2);
797 ret = __av7110_send_fw_cmd(av7110, cbuf, 5); 797 ret = __av7110_send_fw_cmd(av7110, cbuf, 5);
798 up(&av7110->dcomlock); 798 mutex_unlock(&av7110->dcomlock);
799 if (ret && ret!=-ERESTARTSYS) 799 if (ret && ret!=-ERESTARTSYS)
800 printk(KERN_ERR "dvb-ttpci: WriteText error %d\n", ret); 800 printk(KERN_ERR "dvb-ttpci: WriteText error %d\n", ret);
801 return ret; 801 return ret;
@@ -1059,7 +1059,7 @@ int av7110_osd_cmd(struct av7110 *av7110, osd_cmd_t *dc)
1059{ 1059{
1060 int ret; 1060 int ret;
1061 1061
1062 if (down_interruptible(&av7110->osd_sema)) 1062 if (mutex_lock_interruptible(&av7110->osd_mutex))
1063 return -ERESTARTSYS; 1063 return -ERESTARTSYS;
1064 1064
1065 switch (dc->cmd) { 1065 switch (dc->cmd) {
@@ -1195,7 +1195,7 @@ int av7110_osd_cmd(struct av7110 *av7110, osd_cmd_t *dc)
1195 break; 1195 break;
1196 } 1196 }
1197 1197
1198 up(&av7110->osd_sema); 1198 mutex_unlock(&av7110->osd_mutex);
1199 if (ret==-ERESTARTSYS) 1199 if (ret==-ERESTARTSYS)
1200 dprintk(1, "av7110_osd_cmd(%d) returns with -ERESTARTSYS\n",dc->cmd); 1200 dprintk(1, "av7110_osd_cmd(%d) returns with -ERESTARTSYS\n",dc->cmd);
1201 else if (ret) 1201 else if (ret)
diff --git a/drivers/media/dvb/ttpci/budget.h b/drivers/media/dvb/ttpci/budget.h
index c7bb63c4d98d..4ac0f4d08025 100644
--- a/drivers/media/dvb/ttpci/budget.h
+++ b/drivers/media/dvb/ttpci/budget.h
@@ -10,6 +10,8 @@
10#include "dvb_net.h" 10#include "dvb_net.h"
11 11
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/mutex.h>
14
13#include <media/saa7146.h> 15#include <media/saa7146.h>
14 16
15extern int budget_debug; 17extern int budget_debug;
@@ -51,7 +53,7 @@ struct budget {
51 struct dmx_frontend mem_frontend; 53 struct dmx_frontend mem_frontend;
52 54
53 int fe_synced; 55 int fe_synced;
54 struct semaphore pid_mutex; 56 struct mutex pid_mutex;
55 57
56 int ci_present; 58 int ci_present;
57 int video_port; 59 int video_port;