public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Hunold (LinuxTV.org CVS maintainer) <hunold@linuxtv.org>
To: linux-kernel@vger.kernel.org
Subject: [PATCH 9/14] various av7110 dvb-driver updates
Date: Wed, 8 Oct 2003 15:28:57 +0200	[thread overview]
Message-ID: <106561973797@convergence.de> (raw)
In-Reply-To: <10656197373087@convergence.de>

Sorry: have a look at patch 12 for details!
-[DVB] various av7110 updates
diff -uNrwB --new-file xx-linux-2.6.0-test5/drivers/media/dvb/ttpci/av7110.c linux-2.6.0-test5/drivers/media/dvb/ttpci/av7110.c
--- xx-linux-2.6.0-test5/drivers/media/dvb/ttpci/av7110.c	2003-09-10 11:28:41.000000000 +0200
+++ linux-2.6.0-test5/drivers/media/dvb/ttpci/av7110.c	2003-09-10 10:58:29.000000000 +0200
@@ -40,9 +40,9 @@
 #include <linux/delay.h>
 #include <linux/fs.h>
 #include <linux/timer.h>
+#include <linux/poll.h>
 #include <linux/unistd.h>
 #include <linux/byteorder/swabb.h>
-#include <linux/poll.h>
 #include <linux/slab.h>
 #include <linux/smp_lock.h>
 #include <stdarg.h>
@@ -196,17 +197,22 @@
 	return result;
 }
 
-/* DEBI during interrupt */
 
-/* fixme: val can be a pointer to a memory or an u32 value -- this 
-   won't work on 64bit platforms! */
+/* DEBI during interrupt */
+/* single word writes */
 static inline void iwdebi(struct av7110 *av7110, u32 config, int addr, u32 val, int count)
 {
-        if (count>4 && val)
-                memcpy(av7110->debi_virt, (char *) val, count);
         debiwrite(av7110, config, addr, val, count);
 }
 
+/* buffer writes */
+static inline void mwdebi(struct av7110 *av7110, u32 config, int addr, char *val, int count)
+{
+	memcpy(av7110->debi_virt, val, count);
+        debiwrite(av7110, config, addr, 0, count);
+}
+
+
 static inline u32 irdebi(struct av7110 *av7110, u32 config, int addr, u32 val, int count)
 {
         u32 res;
@@ -1915,8 +1922,8 @@
                 if (waitdebi(av7110, BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0)
                         return -1;
                 DEB_D(("Writing DRAM block %d\n",i));
-                iwdebi(av7110, DEBISWAB, bootblock,
-                       i*(BOOT_MAX_SIZE)+(u32)data,
+                mwdebi(av7110, DEBISWAB, bootblock,
+                       ((char*)data) + i*(BOOT_MAX_SIZE),
                        BOOT_MAX_SIZE);
                 bootblock^=0x1400;
                 iwdebi(av7110, DEBISWAB, BOOT_BASE, swab32(base), 4);
@@ -1929,9 +1936,9 @@
                 if (waitdebi(av7110, BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0)
                         return -1;
                 if (rest>4)
-                        iwdebi(av7110, DEBISWAB, bootblock, i*(BOOT_MAX_SIZE)+(u32)data, rest);
+                        mwdebi(av7110, DEBISWAB, bootblock, ((char*)data) + i*(BOOT_MAX_SIZE), rest);
                 else
-                        iwdebi(av7110, DEBISWAB, bootblock, i*(BOOT_MAX_SIZE)-4+(u32)data, rest+4);
+                        mwdebi(av7110, DEBISWAB, bootblock, ((char*)data) + i*(BOOT_MAX_SIZE) - 4, rest+4);
                 
                 iwdebi(av7110, DEBISWAB, BOOT_BASE, swab32(base), 4);
                 iwdebi(av7110, DEBINOSWAP, BOOT_SIZE, rest, 2);
@@ -2015,7 +2022,7 @@
         //saa7146_setgpio(dev, DEBI_DONE_LINE, SAA7146_GPIO_INPUT);
         //saa7146_setgpio(dev, 3, SAA7146_GPIO_INPUT);
 
-        iwdebi(av7110, DEBISWAB, DPRAM_BASE, (u32) bootcode, sizeof(bootcode));
+	mwdebi(av7110, DEBISWAB, DPRAM_BASE, bootcode, sizeof(bootcode));
         iwdebi(av7110, DEBINOSWAP, BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2);
         
         wait_for_debi_done(av7110);
@@ -2033,7 +2040,7 @@
         
         DEB_D(("bootarm: load dpram code\n"));
 
-	iwdebi(av7110, DEBISWAB, DPRAM_BASE, (u32) Dpram, sizeof(Dpram));
+	mwdebi(av7110, DEBISWAB, DPRAM_BASE, Dpram, sizeof(Dpram));
 
 	wait_for_debi_done(av7110);
 
@@ -2742,7 +2764,7 @@
 
 		DEB_EE(("VIDIOC_G_TUNER: %d\n", t->index));
 
-		if( 0 == av7110->has_analog_tuner || av7110->current_input != 1 ) {
+		if( 0 == av7110->has_analog_tuner || t->index != 0 ) {
 			return -EINVAL;
 		}
 
@@ -3257,7 +3279,7 @@
 	DEB_EE(("av7110: fwstc = %04hx %04hx %04hx %04hx\n",
 			fwstc[0], fwstc[1], fwstc[2], fwstc[3]));
 
-	*stc =  (((uint64_t)(~fwstc[2]) & 1) << 32) |
+	*stc =  (((uint64_t) ((fwstc[3] & 0x8000) >> 15)) << 32) |
 		(((uint64_t)fwstc[1])     << 16) | ((uint64_t)fwstc[0]);
 	*base = 1;
 
@@ -3630,17 +3652,22 @@
 
 	DEB_EE(("av7110: %p\n",av7110));
 
+	if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
 	poll_wait(file, &av7110->avout.queue, wait);
+	}
+	
 	poll_wait(file, &av7110->video_events.wait_queue, wait);
 
 	if (av7110->video_events.eventw != av7110->video_events.eventr)
 		mask = POLLPRI;
 
+	if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
 	if (av7110->playing) {
                 if (FREE_COND)
                         mask |= (POLLOUT | POLLWRNORM);
         } else /* if not playing: may play if asked for */
                 mask |= (POLLOUT | POLLWRNORM);
+	}
 
         return mask;
 }
@@ -3653,6 +3680,10 @@
 
 	DEB_EE(("av7110: %p\n",av7110));
 
+	if ((file->f_flags & O_ACCMODE) == O_RDONLY) {
+		return -EPERM;
+	}
+
         if (av7110->videostate.stream_source!=VIDEO_SOURCE_MEMORY) 
                 return -EPERM;
 
@@ -3690,6 +3721,10 @@
                 n=MIN_IFRAME/len+1;
         }
 
+	/* setting n always > 1, fixes problems when playing stillframes
+	   consisting of I- and P-Frames */
+	n=MIN_IFRAME/len+1;
+	
 	/* FIXME: nonblock? */
 	dvb_play(av7110, iframe_header, sizeof(iframe_header), 0, 1, 0);
 
@@ -3711,9 +3746,12 @@
         
 	DEB_EE(("av7110: %p\n",av7110));
 
-        if (((file->f_flags&O_ACCMODE)==O_RDONLY) &&
-            (cmd!=VIDEO_GET_STATUS))
+        if ((file->f_flags&O_ACCMODE)==O_RDONLY) {
+		if ( cmd!=VIDEO_GET_STATUS && cmd!=VIDEO_GET_EVENT && 
+		     cmd!=VIDEO_GET_SIZE ) {
                 return -EPERM;
+		}
+	}
         
         switch (cmd) {
         case VIDEO_STOP:
@@ -4027,15 +4065,17 @@
 
         if ((err=dvb_generic_open(inode, file))<0)
                 return err;
+
+	if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
         dvb_ringbuffer_flush_spinlock_wakeup(&av7110->aout);
         dvb_ringbuffer_flush_spinlock_wakeup(&av7110->avout);
         av7110->video_blank=1;
         av7110->audiostate.AV_sync_state=1;
         av7110->videostate.stream_source=VIDEO_SOURCE_DEMUX;
 
-	if ((file->f_flags & O_ACCMODE) != O_RDONLY)
 		/*  empty event queue */
 		av7110->video_events.eventr = av7110->video_events.eventw = 0;
+	}
 
         return 0;
 }
@@ -4047,7 +4087,10 @@
 
 	DEB_EE(("av7110: %p\n",av7110));
 
+	if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
         AV_Stop(av7110, RP_VIDEO);
+	}
+
         return dvb_generic_release(inode, file);
 }
 
@@ -4094,7 +4137,8 @@
 
 static struct dvb_device dvbdev_video = {
 	.priv		= 0,
-	.users		= 1,
+	.users		= 6,
+	.readers	= 5,	/* arbitrary */
 	.writers	= 1,
 	.fops		= &dvb_video_fops,
 	.kernel_ioctl	= dvb_video_ioctl,
@@ -4660,6 +4730,7 @@
 MAKE_AV7110_INFO(unkwn1, "Technotrend/Hauppauge PCI rev?(unknown1)?");
 MAKE_AV7110_INFO(unkwn2, "Technotrend/Hauppauge PCI rev?(unknown2)?");
 MAKE_AV7110_INFO(nexus,  "Technotrend/Hauppauge Nexus PCI DVB-S");
+MAKE_AV7110_INFO(dvboc11,"Octal/Technotrend DVB-C for iTV");
 
 static struct pci_device_id pci_tbl[] = {
 	MAKE_EXTENSION_PCI(fs_1_5, 0x110a, 0xffff),
@@ -4676,6 +4747,7 @@
 	MAKE_EXTENSION_PCI(unkwn1, 0xffc2, 0x0000),
 	MAKE_EXTENSION_PCI(unkwn2, 0x00a1, 0x00a1),
 	MAKE_EXTENSION_PCI(nexus,  0x00a1, 0xa1a0),
+	MAKE_EXTENSION_PCI(dvboc11,0x13c2, 0x000a),
 	{
 		.vendor    = 0,
 	}


  reply	other threads:[~2003-10-08 13:34 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-08 13:28 [PATCH 1/14] LinuxTV.org DVB driver update Michael Hunold
2003-10-08 13:28 ` [PATCH 2/14] firmware update for av7110 dvb driver Michael Hunold
2003-10-08 13:28   ` [PATCH 3/14] add new DVB-T frontend driver Michael Hunold
2003-10-08 13:28     ` [PATCH 4/14] video capture updates for saa7146 core Michael Hunold
2003-10-08 13:28       ` [PATCH 5/14] multiple device *read* opens support Michael Hunold
2003-10-08 13:28         ` [PATCH 6/14] update copyright and licensing Michael Hunold
2003-10-08 13:28           ` [PATCH 7/14] usual c99 initializer fixes Michael Hunold
2003-10-08 13:28             ` [PATCH 8/14] various patches for non-av7110 dvb-drivers Michael Hunold
2003-10-08 13:28               ` Michael Hunold [this message]
2003-10-08 13:28                 ` [PATCH 10/14] update dvb frontend drivers Michael Hunold
2003-10-08 13:28                   ` [PATCH 11/14] Kconfig and Makefile updates, inspired by Adrian Bunk and Roman Zippel Michael Hunold
2003-10-08 13:28                     ` [PATCH 12/14] some more av7110 dvb-driver updates Michael Hunold
2003-10-08 13:29                       ` [PATCH 13/14] fix v4l1 backward compatibility in saa7146 driver Michael Hunold
2003-10-08 13:29                         ` [PATCH 14/14] firmware blob for new DVB-T frontend driver Michael Hunold
2003-10-08 14:45   ` [PATCH 2/14] firmware update for av7110 dvb driver Marcel Holtmann
2003-10-08 15:36     ` Michael Hunold
2003-10-08 15:54       ` Michael Hunold
2003-10-12 21:42         ` Manuel Estrada Sainz
2003-10-11 11:59     ` Jochen Friedrich
2003-10-10 20:15 ` [PATCH 1/14] LinuxTV.org DVB driver update Stephen Hemminger
2003-10-11  8:41   ` Michael Hunold
2003-10-11 17:53     ` David S. Miller
2003-10-12  9:16       ` Geert Uytterhoeven
2003-10-12 11:08         ` Sam Ravnborg
2003-10-12 20:14           ` Michael Hunold
2003-10-13 16:01           ` Stephen Hemminger
2003-10-14  9:59             ` Michael Hunold
2003-10-12 20:10         ` Michael Hunold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=106561973797@convergence.de \
    --to=hunold@linuxtv.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox