summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/ttpci/av7110_hw.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/dvb/ttpci/av7110_hw.c')
-rw-r--r--linux/drivers/media/dvb/ttpci/av7110_hw.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/linux/drivers/media/dvb/ttpci/av7110_hw.c b/linux/drivers/media/dvb/ttpci/av7110_hw.c
index 754bb8140..5a11d3da5 100644
--- a/linux/drivers/media/dvb/ttpci/av7110_hw.c
+++ b/linux/drivers/media/dvb/ttpci/av7110_hw.c
@@ -293,6 +293,37 @@ int av7110_bootarm(struct av7110 *av7110)
* DEBI command polling
****************************************************************************/
+int av7110_wait_msgstate(struct av7110 *av7110, u16 flags)
+{
+ unsigned long start;
+ u32 stat;
+
+ if (FW_VERSION(av7110->arm_app) <= 0x261c) {
+ /* not supported by old firmware */
+ msleep(50);
+ return 0;
+ }
+
+ /* new firmware */
+ start = jiffies;
+ for (;;) {
+ if (down_interruptible(&av7110->dcomlock))
+ return -ERESTARTSYS;
+ stat = rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2);
+ up(&av7110->dcomlock);
+ if ((stat & flags) == 0) {
+ break;
+ }
+ if (time_after(jiffies, start + ARM_WAIT_FREE)) {
+ printk(KERN_ERR "%s: timeout waiting for MSGSTATE %04x\n",
+ __FUNCTION__, stat & flags);
+ return -1;
+ }
+ msleep(1);
+ }
+ return 0;
+}
+
int __av7110_send_fw_cmd(struct av7110 *av7110, u16* buf, int length)
{
int i;