V4L/DVB updates
cover V4L/DVB updates
Linus,
Please pull 'master' from:
git://git.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git master
It contains the following:
- Fix the frame->grabstate update in read() entry point.
- Fix: disable interrupts while at KM_BOUNCE_READ
- Cx88xx: Fix lockup on suspend
- Fix quickcam communicator driver for big endian architectures
- Ks0127 status flags
- MSI TV@nywhere Plus fixes
- Fix bttv and friends on 64bit machines with lots of memory
- Tveeprom: autodetect LG TAPC G701D as tuner type 37
- Fix compilation on ppc32 architecture
Cheers,
Mauro.
V4L/DVB development is hosted at http://linuxtv.org
---
drivers/media/video/cx88/cx88-tvaudio.c | 2 ++ drivers/media/video/ks0127.c | 8 ++++---- drivers/media/video/saa7134/saa7134-cards.c | 14 ++++++++++---- drivers/media/video/tveeprom.c | 2 +- drivers/media/video/usbvideo/quickcam_messenger.h | 14 -------------- drivers/media/video/usbvision/usbvision-video.c | 3 +-- drivers/media/video/v4l2-common.c | 9 ++++++++- drivers/media/video/video-buf.c | 2 +- drivers/media/video/vivi.c | 7 +++++++ include/linux/videodev2.h | 9 +++++++++ 10 files changed, 43 insertions(+), 27 deletions(-)
PATCH 1/9 V4L/DVB (5019): Fix the frame->grabstate update in read() entry point.
From: Thierry MERLE <[email protected]>
The Coverity checker spotted that in usbvision_v4l2_read(), the variable "frmx" is never assigned any value different from -1, but it's used an an array index in "usbvision->frame[frmx]".
Thanks to Adrian Bunk <[email protected]> for warning about that.
---
drivers/media/video/usbvision/usbvision-video.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/media/video/usbvision/usbvision-video.c +1 -2
@@ -1080,7 +1080,6 @@ static ssize_t usbvision_v4l2_read(strucint noblock = file->f_flags &O_NONBLOCK ;unsigned long lock_flags; -int frmx =-1 ;int ret,i;struct usbvision_frame *frame;
@@ -1155,7 +1154,7 @@ static ssize_t usbvision_v4l2_read(struc frame->bytes_read =0 ;/* Mark it as available to be used again. */ - usbvision->frame[frmx].grabstate = FrameState_Unused; + frame->grabstate = FrameState_Unused;/* } */ return count;
PATCH 2/9 V4L/DVB (5020): Fix: disable interrupts while at KM_BOUNCE_READ
In reply to Mauro Carvalho ChehabFrom: Mauro Carvalho Chehab <[email protected]>
vivi.c uses the KM_BOUNCE_READ with local interrupts enabled. This means that if a disk interrupt occurs while vivi.c is using this fixmap slot, the vivi.c driver will, upon return from that interrupt, find that the fixmap slot now points at a different physical page. The net result will probably be rare corruption of disk file contents, because viv.c will now be altering the page which the disk code was recently using.
Thanks to Andrew Morton for pointing this.
---
drivers/media/video/vivi.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/media/video/vivi.c +7 -0
@@ -270,10 +270,15 @@ static void gen_line(struct sg_to_addr tchar *p,*s,*basep;struct page *pg;u8 chr,r,g,b,color; +unsigned long flags; +spinlock_t spinlock; + +spin_lock_init (&spinlock);/* Get first addr pointed to pixel position */ oldpg=get_addr_pos (pos,pages,to_addr); pg=pfn_to_page (sg_dma_address (to_addr[oldpg].sg) >>PAGE_SHIFT ); +spin_lock_irqsave (&spinlock,flags); basep =kmap_atomic (pg,KM_BOUNCE_READ )+to_addr[oldpg].sg->offset;/* We will just duplicate the second pixel at the packet */
@@ -376,6 +381,8 @@ static void gen_line(struct sg_to_addr t end:kunmap_atomic (basep,KM_BOUNCE_READ ); +spin_unlock_irqrestore (&spinlock,flags); + }static void vivi_fillbuff (struct vivi_dev *dev,struct vivi_buffer *buf) {
PATCH 3/9 V4L/DVB (5021): Cx88xx: Fix lockup on suspend
In reply to Mauro Carvalho ChehabFrom: Robert Hancock <[email protected]>
Suspending with the cx88xx module loaded causes the system to lock up because the cx88_audio_thread kthread was missing a try_to_freeze() call, which caused it to go into a tight loop and result in softlockup when suspending. Fix that.
---
drivers/media/video/cx88/cx88-tvaudio.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/media/video/cx88/cx88-tvaudio.c +2 -0
@@ -38,6 +38,7 @@#include <linux/module.h> #include <linux/moduleparam.h> #include <linux/errno.h> +#include <linux/freezer.h> #include <linux/kernel.h> #include <linux/slab.h> #include <linux/mm.h>
@@ -961,6 +962,7 @@ int cx88_audio_thread(void *data)msleep_interruptible (1000 );if (kthread_should_stop ())break ; +try_to_freeze ();/* just monitor the audio status for now ... */ memset (&t,0 ,sizeof (t));
PATCH 4/9 V4L/DVB (5024): Fix quickcam communicator driver for big endian architectures
In reply to Mauro Carvalho ChehabFrom: Grant Likely <[email protected]>
Host endianess does not affect the order that pixel rgb data comes in from the quickcam (the values are bytes, not words or longs). The driver is erroniously swapping the order of rgb values for big endian machines. This patch is needed get the Quickcam communicator working on big endian machines (tested on powerpc)
---
drivers/media/video/usbvideo/quickcam_messenger.h | 14 -------------- 1 files changed, 0 insertions(+), 14 deletions(-)
drivers/media/video/usbvideo/quickcam_messenger.h +0 -14
@@ -35,27 +35,13 @@ struct rgb { };struct bayL0 { -#ifdef __BIG_ENDIAN -u8 r; -u8 g; -#elif __LITTLE_ENDIANu8 g;u8 r; -#else -#error not byte order defined -#endif };struct bayL1 { -#ifdef __BIG_ENDIAN -u8 g; -u8 b; -#elif __LITTLE_ENDIANu8 b;u8 g; -#else -#error not byte order defined -#endif };struct cam_size {
PATCH 5/9 V4L/DVB (5029): Ks0127 status flags
In reply to Mauro Carvalho ChehabFrom: Martin Samuelsson <[email protected]>
Or status flags together in DECODER_GET_STATUS instead of and-zapping them.
---
drivers/media/video/ks0127.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/media/video/ks0127.c +4 -4
@@ -712,13 +712,13 @@ static int ks0127_command(struct i2c_cli *iarg =0 ; status =ks0127_read (ks,KS_STAT );if (!(status &0x20 ))/* NOVID not set */ - *iarg = (*iarg &DECODER_STATUS_GOOD ); + *iarg = (*iarg |DECODER_STATUS_GOOD );if ((status &0x01 ))/* CLOCK set */ - *iarg = (*iarg &DECODER_STATUS_COLOR ); + *iarg = (*iarg |DECODER_STATUS_COLOR );if ((status &0x08 ))/* PALDET set */ - *iarg = (*iarg &DECODER_STATUS_PAL ); + *iarg = (*iarg |DECODER_STATUS_PAL );else - *iarg = (*iarg &DECODER_STATUS_NTSC ); + *iarg = (*iarg |DECODER_STATUS_NTSC );break ;//Catch any unknown command
PATCH 6/9 V4L/DVB (5033): MSI TV@nywhere Plus fixes
In reply to Mauro Carvalho ChehabFrom: hermann pitton <[email protected]>
- MSI TV@nywhere Plus. Fix radio, S-Video and external analog audio in as far we can know currently.
---
drivers/media/video/saa7134/saa7134-cards.c | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-)
drivers/media/video/saa7134/saa7134-cards.c +10 -4
@@ -2570,6 +2570,7 @@ struct saa7134_board saa7134_boards[] = .radio_type = UNSET, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, + .gpiomask = 1 << 21, .inputs = {{ .name = name_tv, .vmux = 1,
@@ -2578,15 +2579,20 @@ struct saa7134_board saa7134_boards[] = },{ .name = name_comp1, .vmux = 3, - .amux = LINE1, + .amux = LINE2, /* unconfirmed, taken from Philips driver */ + },{ + .name = name_comp2, + .vmux = 0, /* untested, Composite over S-Video */ + .amux = LINE2, },{ .name = name_svideo, - .vmux = 0, - .amux = LINE1, + .vmux = 8, + .amux = LINE2, }}, .radio = { .name = name_radio, - .amux = LINE1, + .amux = TV, + .gpio = 0x0200000, }, }, [SAA7134_BOARD_CINERGY250PCI] = {
PATCH 7/9 V4L/DVB (5069): Fix bttv and friends on 64bit machines with lots of memory
In reply to Mauro Carvalho ChehabFrom: Gerd Hoffmann <[email protected]>
We have a DMA32 zone now, lets use it to make sure the card can reach the memory we have allocated for the video frame buffers.
---
drivers/media/video/video-buf.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/video/video-buf.c +1 -1
@@ -1229,7 +1229,7 @@ videobuf_vm_nopage(struct vm_area_struct vaddr,vma->vm_start,vma->vm_end);if (vaddr > vma->vm_end)return NOPAGE_SIGBUS ; - page =alloc_page (GFP_USER ); + page =alloc_page (GFP_USER | __GFP_DMA32);if (!page)return NOPAGE_OOM ;clear_user_page (page_address (page), vaddr, page);
PATCH 8/9 V4L/DVB (5071): Tveeprom: autodetect LG TAPC G701D as tuner type 37
In reply to Mauro Carvalho ChehabFrom: Michael Krufky <[email protected]>
autodetect LG TAPC G701D as tuner type 37.
Thanks to Adonis Papas, for pointing out the missing autodetection for this tuner.
---
drivers/media/video/tveeprom.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/video/tveeprom.c +1 -1
@@ -184,7 +184,7 @@ hauppauge_tuner[] = { TUNER_ABSENT, "Thompson DTT757"},/* 80-89 */ { TUNER_ABSENT, "Philips FQ1216LME MK3"}, - { TUNER_ABSENT, "LG TAPC G701D"}, + { TUNER_LG_PAL_NEW_TAPC, "LG TAPC G701D"}, { TUNER_LG_NTSC_NEW_TAPC, "LG TAPC H791F"}, { TUNER_LG_PAL_NEW_TAPC, "TCL 2002MB 3"}, { TUNER_LG_PAL_NEW_TAPC, "TCL 2002MI 3"},
PATCH 9/9 V4L/DVB (5023): Fix compilation on ppc32 architecture
In reply to Mauro Carvalho ChehabFrom: Mauro Carvalho Chehab <[email protected]>
There's a problem, pointed by Meelis Roos <[email protected]>, that, on ppc32 arch, with some gcc versions (noticed with prerelease 4.1.2 20061115), compilation fails, due the lack of __ucmpdi2 to do the required 64-bit comparision. This patch takes some sugestions made by Andrew Morton <[email protected]>, Stelian Pop <[email protected]> and Segher Boessenkool <[email protected]>
---
drivers/media/video/v4l2-common.c | 9 ++++++++- include/linux/videodev2.h | 9 +++++++++ 2 files changed, 17 insertions(+), 1 deletions(-)
drivers/media/video/v4l2-common.c +8 -1
@@ -90,8 +90,15 @@ MODULE_LICENSE("GPL");char *v4l2_norm_to_name (v4l2_std_id id) {char *name; +u32 myid = id; -switch (id) { +/* HACK: ppc32 architecture doesn't have __ucmpdi2 function to handle +64 bit comparations. So, on that architecture, with some gcc variants, +compilation fails. Currently, the max value is 30bit wide. +*/ +BUG_ON (myid != id); + +switch (myid) {case V4L2_STD_PAL : name="PAL" ;break ;case V4L2_STD_PAL_BG :
include/linux/videodev2.h +9 -0
@@ -662,6 +662,15 @@ #define V4L2_STD_SECAM_LC ((v4l2_s#define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000)#define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000) +/* FIXME: +Although std_id is 64 bits, there is an issue on PPC32 architecture that +makes switch(__u64) to break. So, there's a hack on v4l2-common.c rounding +this value to 32 bits. +As, currently, the max value is for V4L2_STD_ATSC_16_VSB (30 bits wide), +it should work fine. However, if needed to add more than two standards, +v4l2-common.c should be fixed. +*/ +/* some merged standards */ #define V4L2_STD_MN (V4L2_STD_PAL_M|V4L2_STD_PAL_N|V4L2_STD_PAL_Nc|V4L2_STD_NTSC)#define V4L2_STD_B (V4L2_STD_PAL_B|V4L2_STD_PAL_B1|V4L2_STD_SECAM_B)