summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-11-04 08:26:50 -0200
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-11-04 08:26:50 -0200
commitb46e1e93b7a6abd37652c7bcd2353cf6de4b68c0 (patch)
tree68c0b260cd89163e9c6eaa80f98d58dbe297272b /linux
parent08650f2ce2368e8dcc8142f933b65aaf3777efef (diff)
parentdb212a276b0513120a21ef0d6a64a3a753a3a215 (diff)
downloadmediapointer-dvb-s2-b46e1e93b7a6abd37652c7bcd2353cf6de4b68c0.tar.gz
mediapointer-dvb-s2-b46e1e93b7a6abd37652c7bcd2353cf6de4b68c0.tar.bz2
merge: http://linuxtv.org/hg/~mkrufky/tda8295
From: Mauro Carvalho Chehab <mchehab@infradead.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux')
-rw-r--r--linux/Documentation/video4linux/CARDLIST.em28xx8
-rw-r--r--linux/drivers/media/common/Kconfig2
-rw-r--r--linux/drivers/media/common/saa7146_core.c4
-rw-r--r--linux/drivers/media/common/saa7146_hlp.c2
-rw-r--r--linux/drivers/media/dvb/bt8xx/bt878.c2
-rw-r--r--linux/drivers/media/dvb/cinergyT2/cinergyT2.c4
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_frontend.c7
-rw-r--r--linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c2
-rw-r--r--linux/drivers/media/dvb/frontends/dib0070.c1
-rw-r--r--linux/drivers/media/dvb/frontends/dib3000mb.c1
-rw-r--r--linux/drivers/media/dvb/frontends/dib3000mc.c1
-rw-r--r--linux/drivers/media/dvb/frontends/dib7000m.c1
-rw-r--r--linux/drivers/media/dvb/frontends/dib7000p.c1
-rw-r--r--linux/drivers/media/dvb/frontends/lgdt330x.c1
-rw-r--r--linux/drivers/media/dvb/frontends/mt2060.c1
-rw-r--r--linux/drivers/media/dvb/frontends/mt2131.c1
-rw-r--r--linux/drivers/media/dvb/frontends/mt2266.c1
-rw-r--r--linux/drivers/media/dvb/frontends/mt352.c1
-rw-r--r--linux/drivers/media/dvb/frontends/nxt200x.c1
-rw-r--r--linux/drivers/media/dvb/frontends/qt1010.c1
-rw-r--r--linux/drivers/media/dvb/frontends/tda18271.c1
-rw-r--r--linux/drivers/media/dvb/frontends/tda826x.c1
-rw-r--r--linux/drivers/media/dvb/frontends/tda827x.c1
-rw-r--r--linux/drivers/media/dvb/frontends/tua6100.c1
-rw-r--r--linux/drivers/media/dvb/frontends/zl10353.c1
-rw-r--r--linux/drivers/media/dvb/ttpci/Kconfig35
-rw-r--r--linux/drivers/media/dvb/ttpci/Makefile12
-rw-r--r--linux/drivers/media/dvb/ttpci/av7110_ir.c2
-rw-r--r--linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c2
-rw-r--r--linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c2
-rw-r--r--linux/drivers/media/video/bt8xx/bttv-audio-hook.c6
-rw-r--r--linux/drivers/media/video/bt8xx/bttv-cards.c26
-rw-r--r--linux/drivers/media/video/cx88/cx88-cards.c14
-rw-r--r--linux/drivers/media/video/em28xx/em28xx-cards.c276
-rw-r--r--linux/drivers/media/video/em28xx/em28xx-i2c.c80
-rw-r--r--linux/drivers/media/video/em28xx/em28xx-video.c278
-rw-r--r--linux/drivers/media/video/em28xx/em28xx.h17
-rw-r--r--linux/drivers/media/video/ivtv/ivtv-driver.h1
-rw-r--r--linux/drivers/media/video/ivtv/ivtv-i2c.c2
-rw-r--r--linux/drivers/media/video/ivtv/ivtv-i2c.h2
-rw-r--r--linux/drivers/media/video/ivtv/ivtv-udma.c7
-rw-r--r--linux/drivers/media/video/meye.c2
-rw-r--r--linux/drivers/media/video/meye.h2
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.c2
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c10
-rw-r--r--linux/drivers/media/video/pwc/pwc.h1
-rw-r--r--linux/drivers/media/video/saa5246a.c4
-rw-r--r--linux/drivers/media/video/saa5249.c4
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-alsa.c16
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-tvaudio.c2
-rw-r--r--linux/drivers/media/video/tuner-xc2028.c369
-rw-r--r--linux/drivers/media/video/tuner-xc2028.h13
-rw-r--r--linux/drivers/media/video/tvp5150.c27
-rw-r--r--linux/drivers/media/video/usbvideo/konicawc.c4
-rw-r--r--linux/drivers/media/video/usbvideo/quickcam_messenger.c4
-rw-r--r--linux/drivers/media/video/usbvideo/vicam.c2
-rw-r--r--linux/drivers/media/video/v4l1-compat.c2
-rw-r--r--linux/drivers/media/video/v4l2-common.c2
-rw-r--r--linux/drivers/media/video/videobuf-dma-sg.c13
-rw-r--r--linux/drivers/media/video/zoran_driver.c4
-rw-r--r--linux/include/media/saa7146.h1
-rw-r--r--linux/sound/pci/bt87x.c4
62 files changed, 740 insertions, 558 deletions
diff --git a/linux/Documentation/video4linux/CARDLIST.em28xx b/linux/Documentation/video4linux/CARDLIST.em28xx
index 37f0e3ced..f809834af 100644
--- a/linux/Documentation/video4linux/CARDLIST.em28xx
+++ b/linux/Documentation/video4linux/CARDLIST.em28xx
@@ -1,14 +1,16 @@
0 -> Unknown EM2800 video grabber (em2800) [eb1a:2800]
- 1 -> Unknown EM2820/2840 video grabber (em2820/em2840)
+ 1 -> Unknown EM2750/28xx video grabber (em2820/em2840) [eb1a:2750,eb1a:2820,eb1a:2821,eb1a:2860,eb1a:2861,eb1a:2870,eb1a:2881,eb1a:2883]
2 -> Terratec Cinergy 250 USB (em2820/em2840) [0ccd:0036]
3 -> Pinnacle PCTV USB 2 (em2820/em2840) [2304:0208]
4 -> Hauppauge WinTV USB 2 (em2820/em2840) [2040:4200]
- 5 -> MSI VOX USB 2.0 (em2820/em2840) [eb1a:2820]
+ 5 -> MSI VOX USB 2.0 (em2820/em2840)
6 -> Terratec Cinergy 200 USB (em2800)
7 -> Leadtek Winfast USB II (em2800)
8 -> Kworld USB2800 (em2800)
9 -> Pinnacle Dazzle DVC 90 (em2820/em2840) [2304:0207]
- 10 -> Hauppauge WinTV HVR 900 (em2880)
+ 10 -> Hauppauge WinTV HVR 900/950 (em2880)
11 -> Terratec Hybrid XS (em2880)
12 -> Kworld PVR TV 2800 RF (em2820/em2840)
13 -> Terratec Prodigy XS (em2880)
+ 14 -> Pixelview Prolink PlayTV USB 2.0 (em2820/em2840)
+ 15 -> V-Gear PocketTV (em2800)
diff --git a/linux/drivers/media/common/Kconfig b/linux/drivers/media/common/Kconfig
index c5092ef10..06ca75911 100644
--- a/linux/drivers/media/common/Kconfig
+++ b/linux/drivers/media/common/Kconfig
@@ -1,6 +1,6 @@
config VIDEO_SAA7146
tristate
- depends on I2C
+ depends on I2C && PCI
config VIDEO_SAA7146_VV
tristate
diff --git a/linux/drivers/media/common/saa7146_core.c b/linux/drivers/media/common/saa7146_core.c
index e4063a1e0..7fb263dc1 100644
--- a/linux/drivers/media/common/saa7146_core.c
+++ b/linux/drivers/media/common/saa7146_core.c
@@ -158,13 +158,13 @@ static struct scatterlist* vmalloc_to_sg(unsigned char *virt, int nr_pages)
sglist = kcalloc(nr_pages, sizeof(struct scatterlist), GFP_KERNEL);
if (NULL == sglist)
return NULL;
+ sg_init_table(sglist, nr_pages);
for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) {
pg = vmalloc_to_page(virt);
if (NULL == pg)
goto err;
BUG_ON(PageHighMem(pg));
- sglist[i].page = pg;
- sglist[i].length = PAGE_SIZE;
+ sg_set_page(&sglist[i], pg, PAGE_SIZE, 0);
}
return sglist;
diff --git a/linux/drivers/media/common/saa7146_hlp.c b/linux/drivers/media/common/saa7146_hlp.c
index 602c9c4be..c0f3f51f9 100644
--- a/linux/drivers/media/common/saa7146_hlp.c
+++ b/linux/drivers/media/common/saa7146_hlp.c
@@ -313,7 +313,7 @@ static int sort_and_eliminate(u32* values, int* count)
return -EINVAL;
}
- /* bubble sort the first ´count´ items of the array ´values´ */
+ /* bubble sort the first @count items of the array @values */
for( top = *count; top > 0; top--) {
for( low = 0, high = 1; high < top; low++, high++) {
if( values[low] > values[high] ) {
diff --git a/linux/drivers/media/dvb/bt8xx/bt878.c b/linux/drivers/media/dvb/bt8xx/bt878.c
index 2abbf55db..1da817ee9 100644
--- a/linux/drivers/media/dvb/bt8xx/bt878.c
+++ b/linux/drivers/media/dvb/bt8xx/bt878.c
@@ -284,7 +284,7 @@ static irqreturn_t bt878_irq(int irq, void *dev_id)
if (!(astat = (stat & mask)))
return IRQ_NONE; /* this interrupt is not for me */
/* dprintk("bt878(%d) debug: irq count %d, stat 0x%8.8x, mask 0x%8.8x\n",bt->nr,count,stat,mask); */
- btwrite(astat, BT878_AINT_STAT); /* try to clear interupt condition */
+ btwrite(astat, BT878_AINT_STAT); /* try to clear interrupt condition */
if (astat & (BT878_ASCERR | BT878_AOCERR)) {
diff --git a/linux/drivers/media/dvb/cinergyT2/cinergyT2.c b/linux/drivers/media/dvb/cinergyT2/cinergyT2.c
index 455e50cee..c33afb6ea 100644
--- a/linux/drivers/media/dvb/cinergyT2/cinergyT2.c
+++ b/linux/drivers/media/dvb/cinergyT2/cinergyT2.c
@@ -1,5 +1,5 @@
/*
- * TerraTec Cinergy T²/qanu USB2 DVB-T adapter.
+ * TerraTec Cinergy T²/qanu USB2 DVB-T adapter.
*
* Copyright (C) 2004 Daniel Mack <daniel@qanu.de> and
* Holger Waechtler <holger@qanu.de>
@@ -878,7 +878,7 @@ static int cinergyt2_register_rc(struct cinergyt2 *cinergyt2)
input_dev->name = DRIVER_NAME " remote control";
input_dev->phys = cinergyt2->phys;
- input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
+ input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
for (i = 0; i < ARRAY_SIZE(rc_keys); i += 3)
set_bit(rc_keys[i + 2], input_dev->keybit);
input_dev->keycodesize = 0;
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
index 4f872ef7b..ce24996d8 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -531,9 +531,16 @@ static int dvb_frontend_thread(void *data)
while (1) {
up(&fepriv->sem); /* is locked when we enter the thread... */
restart:
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
timeout = wait_event_interruptible_timeout(fepriv->wait_queue,
dvb_frontend_should_wakeup(fe) || kthread_should_stop(),
fepriv->delay);
+#else
+ timeout = wait_event_interruptible_timeout(fepriv->wait_queue,
+ dvb_frontend_should_wakeup(fe) || kthread_should_stop()
+ || freezing(current),
+ fepriv->delay);
+#endif
if (kthread_should_stop() || dvb_frontend_is_exiting(fe)) {
/* got signal or quitting */
diff --git a/linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c b/linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
index 2270e228d..b47427ea6 100644
--- a/linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
+++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
@@ -120,7 +120,7 @@ int dvb_usb_remote_init(struct dvb_usb_device *d)
if (!input_dev)
return -ENOMEM;
- input_dev->evbit[0] = BIT(EV_KEY);
+ input_dev->evbit[0] = BIT_MASK(EV_KEY);
input_dev->name = "IR-receiver inside an USB DVB receiver";
input_dev->phys = d->rc_phys;
usb_to_input_id(d->udev, &input_dev->id);
diff --git a/linux/drivers/media/dvb/frontends/dib0070.c b/linux/drivers/media/dvb/frontends/dib0070.c
index 5643248a2..e0a2019b9 100644
--- a/linux/drivers/media/dvb/frontends/dib0070.c
+++ b/linux/drivers/media/dvb/frontends/dib0070.c
@@ -9,6 +9,7 @@
*/
#include <linux/kernel.h>
#include <linux/i2c.h>
+#include "compat.h"
#include "dvb_frontend.h"
diff --git a/linux/drivers/media/dvb/frontends/dib3000mb.c b/linux/drivers/media/dvb/frontends/dib3000mb.c
index 136b9d216..093e5890e 100644
--- a/linux/drivers/media/dvb/frontends/dib3000mb.c
+++ b/linux/drivers/media/dvb/frontends/dib3000mb.c
@@ -27,6 +27,7 @@
#include <linux/delay.h>
#include <linux/string.h>
#include <linux/slab.h>
+#include "compat.h"
#include "dvb_frontend.h"
diff --git a/linux/drivers/media/dvb/frontends/dib3000mc.c b/linux/drivers/media/dvb/frontends/dib3000mc.c
index 494ca17cb..75ba0721b 100644
--- a/linux/drivers/media/dvb/frontends/dib3000mc.c
+++ b/linux/drivers/media/dvb/frontends/dib3000mc.c
@@ -13,6 +13,7 @@
#include <linux/kernel.h>
#include <linux/i2c.h>
+#include "compat.h"
#include "dvb_frontend.h"
diff --git a/linux/drivers/media/dvb/frontends/dib7000m.c b/linux/drivers/media/dvb/frontends/dib7000m.c
index 00cd5fcbd..ff5bc463f 100644
--- a/linux/drivers/media/dvb/frontends/dib7000m.c
+++ b/linux/drivers/media/dvb/frontends/dib7000m.c
@@ -10,6 +10,7 @@
*/
#include <linux/kernel.h>
#include <linux/i2c.h>
+#include "compat.h"
#include "dvb_frontend.h"
diff --git a/linux/drivers/media/dvb/frontends/dib7000p.c b/linux/drivers/media/dvb/frontends/dib7000p.c
index 81eb3db06..f27df535f 100644
--- a/linux/drivers/media/dvb/frontends/dib7000p.c
+++ b/linux/drivers/media/dvb/frontends/dib7000p.c
@@ -9,6 +9,7 @@
*/
#include <linux/kernel.h>
#include <linux/i2c.h>
+#include "compat.h"
#include "dvb_frontend.h"
diff --git a/linux/drivers/media/dvb/frontends/lgdt330x.c b/linux/drivers/media/dvb/frontends/lgdt330x.c
index 5a58c8478..8bfd491b5 100644
--- a/linux/drivers/media/dvb/frontends/lgdt330x.c
+++ b/linux/drivers/media/dvb/frontends/lgdt330x.c
@@ -40,6 +40,7 @@
#include <linux/string.h>
#include <linux/slab.h>
#include <asm/byteorder.h>
+#include "compat.h"
#include "dvb_frontend.h"
#include "dvb_math.h"
diff --git a/linux/drivers/media/dvb/frontends/mt2060.c b/linux/drivers/media/dvb/frontends/mt2060.c
index 036d09b71..355817754 100644
--- a/linux/drivers/media/dvb/frontends/mt2060.c
+++ b/linux/drivers/media/dvb/frontends/mt2060.c
@@ -25,6 +25,7 @@
#include <linux/delay.h>
#include <linux/dvb/frontend.h>
#include <linux/i2c.h>
+#include "compat.h"
#include "dvb_frontend.h"
diff --git a/linux/drivers/media/dvb/frontends/mt2131.c b/linux/drivers/media/dvb/frontends/mt2131.c
index 13cf16668..47e081c2e 100644
--- a/linux/drivers/media/dvb/frontends/mt2131.c
+++ b/linux/drivers/media/dvb/frontends/mt2131.c
@@ -23,6 +23,7 @@
#include <linux/delay.h>
#include <linux/dvb/frontend.h>
#include <linux/i2c.h>
+#include "compat.h"
#include "dvb_frontend.h"
diff --git a/linux/drivers/media/dvb/frontends/mt2266.c b/linux/drivers/media/dvb/frontends/mt2266.c
index 03fe82657..add5e3c42 100644
--- a/linux/drivers/media/dvb/frontends/mt2266.c
+++ b/linux/drivers/media/dvb/frontends/mt2266.c
@@ -18,6 +18,7 @@
#include <linux/delay.h>
#include <linux/dvb/frontend.h>
#include <linux/i2c.h>
+#include "compat.h"
#include "dvb_frontend.h"
#include "mt2266.h"
diff --git a/linux/drivers/media/dvb/frontends/mt352.c b/linux/drivers/media/dvb/frontends/mt352.c
index 5dd9b731f..c9500f58a 100644
--- a/linux/drivers/media/dvb/frontends/mt352.c
+++ b/linux/drivers/media/dvb/frontends/mt352.c
@@ -36,6 +36,7 @@
#include <linux/delay.h>
#include <linux/string.h>
#include <linux/slab.h>
+#include "compat.h"
#include "dvb_frontend.h"
#include "mt352_priv.h"
diff --git a/linux/drivers/media/dvb/frontends/nxt200x.c b/linux/drivers/media/dvb/frontends/nxt200x.c
index fcf964fe1..8808d781f 100644
--- a/linux/drivers/media/dvb/frontends/nxt200x.c
+++ b/linux/drivers/media/dvb/frontends/nxt200x.c
@@ -46,6 +46,7 @@
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/string.h>
+#include "compat.h"
#include "dvb_frontend.h"
#include "nxt200x.h"
diff --git a/linux/drivers/media/dvb/frontends/qt1010.c b/linux/drivers/media/dvb/frontends/qt1010.c
index 6ad39074e..4afed44ab 100644
--- a/linux/drivers/media/dvb/frontends/qt1010.c
+++ b/linux/drivers/media/dvb/frontends/qt1010.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "qt1010.h"
+#include "compat.h"
#include "qt1010_priv.h"
static int debug;
diff --git a/linux/drivers/media/dvb/frontends/tda18271.c b/linux/drivers/media/dvb/frontends/tda18271.c
index bc84465c7..98b3f006d 100644
--- a/linux/drivers/media/dvb/frontends/tda18271.c
+++ b/linux/drivers/media/dvb/frontends/tda18271.c
@@ -20,6 +20,7 @@
#include <linux/i2c.h>
#include <linux/delay.h>
+#include "compat.h"
#include <linux/videodev2.h>
#include "tuner-driver.h"
diff --git a/linux/drivers/media/dvb/frontends/tda826x.c b/linux/drivers/media/dvb/frontends/tda826x.c
index bd3ebc284..24d6cc11f 100644
--- a/linux/drivers/media/dvb/frontends/tda826x.c
+++ b/linux/drivers/media/dvb/frontends/tda826x.c
@@ -21,6 +21,7 @@
*/
#include <linux/module.h>
+#include "compat.h"
#include <linux/dvb/frontend.h>
#include <asm/types.h>
diff --git a/linux/drivers/media/dvb/frontends/tda827x.c b/linux/drivers/media/dvb/frontends/tda827x.c
index 8329d33b5..1199f134a 100644
--- a/linux/drivers/media/dvb/frontends/tda827x.c
+++ b/linux/drivers/media/dvb/frontends/tda827x.c
@@ -20,6 +20,7 @@
#include <linux/module.h>
#include <asm/types.h>
+#include "compat.h"
#include <linux/dvb/frontend.h>
#include <linux/videodev2.h>
diff --git a/linux/drivers/media/dvb/frontends/tua6100.c b/linux/drivers/media/dvb/frontends/tua6100.c
index 6ba0029dc..34e7c93f3 100644
--- a/linux/drivers/media/dvb/frontends/tua6100.c
+++ b/linux/drivers/media/dvb/frontends/tua6100.c
@@ -31,6 +31,7 @@
#include <linux/module.h>
#include <linux/dvb/frontend.h>
#include <asm/types.h>
+#include "compat.h"
#include "tua6100.h"
diff --git a/linux/drivers/media/dvb/frontends/zl10353.c b/linux/drivers/media/dvb/frontends/zl10353.c
index 9399e15a8..6340c6858 100644
--- a/linux/drivers/media/dvb/frontends/zl10353.c
+++ b/linux/drivers/media/dvb/frontends/zl10353.c
@@ -25,6 +25,7 @@
#include <linux/delay.h>
#include <linux/string.h>
#include <linux/slab.h>
+#include "compat.h"
#include "dvb_frontend.h"
#include "zl10353_priv.h"
diff --git a/linux/drivers/media/dvb/ttpci/Kconfig b/linux/drivers/media/dvb/ttpci/Kconfig
index f95961495..ae882432d 100644
--- a/linux/drivers/media/dvb/ttpci/Kconfig
+++ b/linux/drivers/media/dvb/ttpci/Kconfig
@@ -1,8 +1,14 @@
+config TTPCI_EEPROM
+ tristate
+ default n
+
config DVB_AV7110
tristate "AV7110 cards"
depends on DVB_CORE && PCI && I2C
select FW_LOADER if !DVB_AV7110_FIRMWARE
+ select TTPCI_EEPROM
select VIDEO_SAA7146_VV
+ depends on VIDEO_DEV # dependencies of VIDEO_SAA7146_VV
select DVB_VES1820 if !DVB_FE_CUSTOMISE
select DVB_VES1X93 if !DVB_FE_CUSTOMISE
select DVB_STV0299 if !DVB_FE_CUSTOMISE
@@ -57,10 +63,19 @@ config DVB_AV7110_OSD
All other people say N.
-config DVB_BUDGET
- tristate "Budget cards"
+config DVB_BUDGET_CORE
+ tristate "SAA7146 DVB cards (aka Budget, Nova-PCI)"
depends on DVB_CORE && PCI && I2C
select VIDEO_SAA7146
+ select TTPCI_EEPROM
+ help
+ Support for simple SAA7146 based DVB cards
+ (so called Budget- or Nova-PCI cards) without onboard
+ MPEG2 decoder.
+
+config DVB_BUDGET
+ tristate "Budget cards"
+ depends on DVB_BUDGET_CORE && I2C
select DVB_STV0299 if !DVB_FE_CUSTOMISE
select DVB_VES1X93 if !DVB_FE_CUSTOMISE
select DVB_VES1820 if !DVB_FE_CUSTOMISE
@@ -73,9 +88,9 @@ config DVB_BUDGET
select DVB_TDA826X if !DVB_FE_CUSTOMISE
select DVB_LNBP21 if !DVB_FE_CUSTOMISE
help
- Support for simple SAA7146 based DVB cards
- (so called Budget- or Nova-PCI cards) without onboard
- MPEG2 decoder.
+ Support for simple SAA7146 based DVB cards (so called Budget-
+ or Nova-PCI cards) without onboard MPEG2 decoder, and without
+ analog inputs or an onboard Common Interface connector.
Say Y if you own such a card and want to use it.
@@ -84,8 +99,7 @@ config DVB_BUDGET
config DVB_BUDGET_CI
tristate "Budget cards with onboard CI connector"
- depends on DVB_CORE && PCI && I2C && INPUT
- select VIDEO_SAA7146
+ depends on DVB_BUDGET_CORE && I2C
select DVB_STV0297 if !DVB_FE_CUSTOMISE
select DVB_STV0299 if !DVB_FE_CUSTOMISE
select DVB_TDA1004X if !DVB_FE_CUSTOMISE
@@ -106,8 +120,9 @@ config DVB_BUDGET_CI
config DVB_BUDGET_AV
tristate "Budget cards with analog video inputs"
- depends on DVB_CORE && PCI && I2C
+ depends on DVB_BUDGET_CORE && I2C
select VIDEO_SAA7146_VV
+ depends on VIDEO_DEV # dependencies of VIDEO_SAA7146_VV
select DVB_PLL if !DVB_FE_CUSTOMISE
select DVB_STV0299 if !DVB_FE_CUSTOMISE
select DVB_TDA1004X if !DVB_FE_CUSTOMISE
@@ -127,8 +142,8 @@ config DVB_BUDGET_AV
config DVB_BUDGET_PATCH
tristate "AV7110 cards with Budget Patch"
- depends on DVB_CORE && DVB_BUDGET
- select DVB_AV7110
+ depends on DVB_BUDGET_CORE && I2C
+ depends on DVB_AV7110
select DVB_STV0299 if !DVB_FE_CUSTOMISE
select DVB_VES1X93 if !DVB_FE_CUSTOMISE
select DVB_TDA8083 if !DVB_FE_CUSTOMISE
diff --git a/linux/drivers/media/dvb/ttpci/Makefile b/linux/drivers/media/dvb/ttpci/Makefile
index 2c1145236..d7483f1a9 100644
--- a/linux/drivers/media/dvb/ttpci/Makefile
+++ b/linux/drivers/media/dvb/ttpci/Makefile
@@ -5,11 +5,13 @@
dvb-ttpci-objs := av7110_hw.o av7110_v4l.o av7110_av.o av7110_ca.o av7110.o av7110_ipack.o av7110_ir.o
-obj-$(CONFIG_DVB_BUDGET) += budget-core.o budget.o ttpci-eeprom.o
-obj-$(CONFIG_DVB_BUDGET_AV) += budget-core.o budget-av.o ttpci-eeprom.o
-obj-$(CONFIG_DVB_BUDGET_CI) += budget-core.o budget-ci.o ttpci-eeprom.o
-obj-$(CONFIG_DVB_BUDGET_PATCH) += budget-core.o budget-patch.o ttpci-eeprom.o
-obj-$(CONFIG_DVB_AV7110) += dvb-ttpci.o ttpci-eeprom.o
+obj-$(CONFIG_TTPCI_EEPROM) += ttpci-eeprom.o
+obj-$(CONFIG_DVB_BUDGET_CORE) += budget-core.o
+obj-$(CONFIG_DVB_BUDGET) += budget.o
+obj-$(CONFIG_DVB_BUDGET_AV) += budget-av.o
+obj-$(CONFIG_DVB_BUDGET_CI) += budget-ci.o
+obj-$(CONFIG_DVB_BUDGET_PATCH) += budget-patch.o
+obj-$(CONFIG_DVB_AV7110) += dvb-ttpci.o
EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/
diff --git a/linux/drivers/media/dvb/ttpci/av7110_ir.c b/linux/drivers/media/dvb/ttpci/av7110_ir.c
index be0fa967d..9097646a3 100644
--- a/linux/drivers/media/dvb/ttpci/av7110_ir.c
+++ b/linux/drivers/media/dvb/ttpci/av7110_ir.c
@@ -27,7 +27,7 @@
#include <linux/module.h>
#include <linux/proc_fs.h>
#include <linux/kernel.h>
-#include <asm/bitops.h>
+#include <linux/bitops.h>
#include "av7110.h"
#include "av7110_hw.h"
diff --git a/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
index 2de73002d..8fd4b615b 100644
--- a/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
+++ b/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
@@ -136,7 +136,7 @@ struct ttusb {
struct dvb_frontend* fe;
};
-/* ugly workaround ... don't know why it's neccessary to read */
+/* ugly workaround ... don't know why it's necessary to read */
/* all result codes. */
#define DEBUG 0
diff --git a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c
index 2c4a50a3a..f6667cf3d 100644
--- a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c
+++ b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c
@@ -1217,7 +1217,7 @@ static int ttusb_init_rc( struct ttusb_dec *dec)
input_dev->name = "ttusb_dec remote control";
input_dev->phys = dec->rc_phys;
- input_dev->evbit[0] = BIT(EV_KEY);
+ input_dev->evbit[0] = BIT_MASK(EV_KEY);
input_dev->keycodesize = sizeof(u16);
input_dev->keycodemax = 0x1a;
input_dev->keycode = rc_keys;
diff --git a/linux/drivers/media/video/bt8xx/bttv-audio-hook.c b/linux/drivers/media/video/bt8xx/bttv-audio-hook.c
index 67b634235..2364d1658 100644
--- a/linux/drivers/media/video/bt8xx/bttv-audio-hook.c
+++ b/linux/drivers/media/video/bt8xx/bttv-audio-hook.c
@@ -117,9 +117,9 @@ void gvbctv5pci_audio(struct bttv *btv, struct v4l2_tuner *t, int set)
break;
default:
t->rxsubchans = V4L2_TUNER_SUB_MONO |
- V4L2_TUNER_SUB_STEREO |
- V4L2_TUNER_SUB_LANG1 |
- V4L2_TUNER_SUB_LANG2;
+ V4L2_TUNER_SUB_STEREO |
+ V4L2_TUNER_SUB_LANG1 |
+ V4L2_TUNER_SUB_LANG2;
}
t->audmode = V4L2_TUNER_MODE_STEREO |
V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
diff --git a/linux/drivers/media/video/bt8xx/bttv-cards.c b/linux/drivers/media/video/bt8xx/bttv-cards.c
index 798df8152..a2424738f 100644
--- a/linux/drivers/media/video/bt8xx/bttv-cards.c
+++ b/linux/drivers/media/video/bt8xx/bttv-cards.c
@@ -1279,7 +1279,7 @@ struct tvcard bttv_tvcards[] = {
.has_radio = 1,
},
[BTTV_BOARD_LIFETEC_9415] = {
- /* Tim Röstermundt <rosterm@uni-muenster.de>
+ /* Tim Röstermundt <rosterm@uni-muenster.de>
in de.comp.os.unix.linux.hardware:
options bttv card=0 pll=1 radio=1 gpiomask=0x18e0
gpiomux =0x44c71f,0x44d71f,0,0x44d71f,0x44dfff
@@ -2856,7 +2856,7 @@ struct tvcard bttv_tvcards[] = {
},
/* ---- card 0x8b ---------------------------------- */
[BTTV_BOARD_PV_M4900] = {
- /* Sérgio Fortier <sergiofortier@yahoo.com.br> */
+ /* Sérgio Fortier <sergiofortier@yahoo.com.br> */
.name = "Prolink PixelView PlayTV MPEG2 PV-M4900",
.video_inputs = 3,
.audio_inputs = 1,
@@ -4422,18 +4422,18 @@ void tea5757_set_freq(struct bttv *btv, unsigned short freq)
*
* The board hardwire Y0 (xpoint) to MUX1 and MUXOUT to Yin.
* GPIO pins are wired as:
- * GPIO[0:3] - AX[0:3] (xpoint) - P1[0:3] (microcontroler)
- * GPIO[4:6] - AY[0:2] (xpoint) - P1[4:6] (microcontroler)
- * GPIO[7] - DATA (xpoint) - P1[7] (microcontroler)
- * GPIO[8] - - P3[5] (microcontroler)
- * GPIO[9] - RESET (xpoint) - P3[6] (microcontroler)
- * GPIO[10] - STROBE (xpoint) - P3[7] (microcontroler)
- * GPINTR - - P3[4] (microcontroler)
+ * GPIO[0:3] - AX[0:3] (xpoint) - P1[0:3] (microcontroller)
+ * GPIO[4:6] - AY[0:2] (xpoint) - P1[4:6] (microcontroller)
+ * GPIO[7] - DATA (xpoint) - P1[7] (microcontroller)
+ * GPIO[8] - - P3[5] (microcontroller)
+ * GPIO[9] - RESET (xpoint) - P3[6] (microcontroller)
+ * GPIO[10] - STROBE (xpoint) - P3[7] (microcontroller)
+ * GPINTR - - P3[4] (microcontroller)
*
- * The microcontroler is a 80C32 like. It should be possible to change xpoint
- * configuration either directly (as we are doing) or using the microcontroler
+ * The microcontroller is a 80C32 like. It should be possible to change xpoint
+ * configuration either directly (as we are doing) or using the microcontroller
* which is also wired to I2C interface. I have no further info on the
- * microcontroler features, one would need to disassembly the firmware.
+ * microcontroller features, one would need to disassembly the firmware.
* note: the vendor refused to give any information on this product, all
* that stuff was found using a multimeter! :)
*/
@@ -4501,7 +4501,7 @@ static void tibetCS16_init(struct bttv *btv)
* The analog switch is controlled by the "master", but the detection order
* of the four BT878A chips is in an order which I just don't understand.
* The "master" is actually the second controller to be detected. The
- * logic on the board uses logical numbers for the 4 controlers, but
+ * logic on the board uses logical numbers for the 4 controllers, but
* those numbers are different from the detection sequence. When working
* with the analog switch, we need to "map" from the detection sequence
* over to the board's logical controller number. This mapping sequence
diff --git a/linux/drivers/media/video/cx88/cx88-cards.c b/linux/drivers/media/video/cx88/cx88-cards.c
index 7deb566af..9c76afeb8 100644
--- a/linux/drivers/media/video/cx88/cx88-cards.c
+++ b/linux/drivers/media/video/cx88/cx88-cards.c
@@ -2035,17 +2035,17 @@ static void cx88_card_setup(struct cx88_core *core)
struct v4l2_priv_tun_config tea5767_cfg;
struct tea5767_ctrl ctl;
- memset (&ctl,0,sizeof(ctl));
+ memset(&ctl, 0, sizeof(ctl));
- ctl.high_cut=1;
- ctl.st_noise=1;
- ctl.deemph_75=1;
- ctl.xtal_freq=TEA5767_HIGH_LO_13MHz;
+ ctl.high_cut = 1;
+ ctl.st_noise = 1;
+ ctl.deemph_75 = 1;
+ ctl.xtal_freq = TEA5767_HIGH_LO_13MHz;
tea5767_cfg.tuner = TUNER_TEA5767;
- tea5767_cfg.priv = &ctl;
+ tea5767_cfg.priv = &ctl;
- cx88_call_i2c_clients (core, TUNER_SET_CONFIG, &tea5767_cfg);
+ cx88_call_i2c_clients(core, TUNER_SET_CONFIG, &tea5767_cfg);
}
}
}
diff --git a/linux/drivers/media/video/em28xx/em28xx-cards.c b/linux/drivers/media/video/em28xx/em28xx-cards.c
index b9a11dee2..510896dbe 100644
--- a/linux/drivers/media/video/em28xx/em28xx-cards.c
+++ b/linux/drivers/media/video/em28xx/em28xx-cards.c
@@ -38,6 +38,16 @@
#include "em28xx.h"
#include "tuner-xc2028.h"
+static int tuner = -1;
+module_param(tuner, int, 0444);
+MODULE_PARM_DESC(tuner, "tuner type");
+
+struct em28xx_hash_table {
+ unsigned long hash;
+ unsigned int model;
+ unsigned int tuner;
+};
+
struct em28xx_board em28xx_boards[] = {
[EM2800_BOARD_UNKNOWN] = {
.name = "Unknown EM2800 video grabber",
@@ -58,22 +68,8 @@ struct em28xx_board em28xx_boards[] = {
}},
},
[EM2820_BOARD_UNKNOWN] = {
- .name = "Unknown EM2820/2840 video grabber",
+ .name = "Unknown EM2750/28xx video grabber",
.is_em2800 = 0,
- .vchannels = 2,
- .norm = VIDEO_MODE_PAL,
- .tda9887_conf = TDA9887_PRESENT,
- .has_tuner = 1,
- .decoder = EM28XX_SAA7113,
- .input = {{
- .type = EM28XX_VMUX_COMPOSITE1,
- .vmux = SAA7115_COMPOSITE0,
- .amux = 1,
- },{
- .type = EM28XX_VMUX_SVIDEO,
- .vmux = SAA7115_SVIDEO3,
- .amux = 1,
- }},
},
[EM2820_BOARD_KWORLD_PVRTV2800RF] = {
.name = "Kworld PVR TV 2800 RF",
@@ -159,7 +155,7 @@ struct em28xx_board em28xx_boards[] = {
}},
},
[EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = {
- .name = "Hauppauge WinTV HVR 900",
+ .name = "Hauppauge WinTV HVR 900/950",
.vchannels = 3,
.norm = VIDEO_MODE_PAL,
.tda9887_conf = TDA9887_PRESENT,
@@ -167,14 +163,14 @@ struct em28xx_board em28xx_boards[] = {
.has_tuner = 1,
.decoder = EM28XX_TVP5150,
.input = {{
- .type = EM28XX_VMUX_COMPOSITE1,
- .vmux = TVP5150_COMPOSITE1,
- .amux = 1,
- },{
.type = EM28XX_VMUX_TELEVISION,
.vmux = TVP5150_COMPOSITE0,
.amux = 0,
},{
+ .type = EM28XX_VMUX_COMPOSITE1,
+ .vmux = TVP5150_COMPOSITE1,
+ .amux = 1,
+ },{
.type = EM28XX_VMUX_SVIDEO,
.vmux = TVP5150_SVIDEO,
.amux = 1,
@@ -333,13 +329,63 @@ struct em28xx_board em28xx_boards[] = {
.amux = 1,
}},
},
+ [EM2800_BOARD_VGEAR_POCKETTV] = {
+ .name = "V-Gear PocketTV",
+ .is_em2800 = 1,
+ .vchannels = 3,
+ .norm = VIDEO_MODE_PAL,
+ .tuner_type = TUNER_LG_PAL_NEW_TAPC,
+ .tda9887_conf = TDA9887_PRESENT,
+ .has_tuner = 1,
+ .decoder = EM28XX_SAA7113,
+ .input = {{
+ .type = EM28XX_VMUX_TELEVISION,
+ .vmux = SAA7115_COMPOSITE2,
+ .amux = 0,
+ },{
+ .type = EM28XX_VMUX_COMPOSITE1,
+ .vmux = SAA7115_COMPOSITE0,
+ .amux = 1,
+ },{
+ .type = EM28XX_VMUX_SVIDEO,
+ .vmux = SAA7115_SVIDEO3,
+ .amux = 1,
+ }},
+ },
+ [EM2820_BOARD_PROLINK_PLAYTV_USB2] = {
+ .name = "Pixelview Prolink PlayTV USB 2.0",
+ .vchannels = 3,
+ .tda9887_conf = TDA9887_PRESENT,
+ .has_tuner = 1,
+ .decoder = EM28XX_SAA7113,
+ .input = {{
+ .type = EM28XX_VMUX_TELEVISION,
+ .vmux = SAA7115_COMPOSITE2,
+ .amux = 1,
+ },{
+ .type = EM28XX_VMUX_COMPOSITE1,
+ .vmux = SAA7115_COMPOSITE0,
+ .amux = 1,
+ },{
+ .type = EM28XX_VMUX_SVIDEO,
+ .vmux = SAA7115_SVIDEO3,
+ .amux = 1,
+ }},
+ },
};
const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards);
/* table of devices that work with this driver */
struct usb_device_id em28xx_id_table [] = {
+ { USB_DEVICE(0xeb1a, 0x2750), .driver_info = EM2820_BOARD_UNKNOWN },
{ USB_DEVICE(0xeb1a, 0x2800), .driver_info = EM2800_BOARD_UNKNOWN },
- { USB_DEVICE(0xeb1a, 0x2820), .driver_info = EM2820_BOARD_MSI_VOX_USB_2 },
+ { USB_DEVICE(0xeb1a, 0x2820), .driver_info = EM2820_BOARD_UNKNOWN },
+ { USB_DEVICE(0xeb1a, 0x2821), .driver_info = EM2820_BOARD_UNKNOWN },
+ { USB_DEVICE(0xeb1a, 0x2860), .driver_info = EM2820_BOARD_UNKNOWN },
+ { USB_DEVICE(0xeb1a, 0x2861), .driver_info = EM2820_BOARD_UNKNOWN },
+ { USB_DEVICE(0xeb1a, 0x2870), .driver_info = EM2820_BOARD_UNKNOWN },
+ { USB_DEVICE(0xeb1a, 0x2881), .driver_info = EM2820_BOARD_UNKNOWN },
+ { USB_DEVICE(0xeb1a, 0x2883), .driver_info = EM2820_BOARD_UNKNOWN },
{ USB_DEVICE(0x0ccd, 0x0036), .driver_info = EM2820_BOARD_TERRATEC_CINERGY_250 },
{ USB_DEVICE(0x2304, 0x0208), .driver_info = EM2820_BOARD_PINNACLE_USB_2 },
{ USB_DEVICE(0x2040, 0x4200), .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
@@ -350,69 +396,179 @@ struct usb_device_id em28xx_id_table [] = {
{ USB_DEVICE(0x0ccd, 0x0047), .driver_info = EM2880_BOARD_TERRATEC_PRODIGY_XS },
{ },
};
+MODULE_DEVICE_TABLE (usb, em28xx_id_table);
+
+static struct em28xx_hash_table em28xx_hash [] = {
+ /* P/N: SA 60002070465 Tuner: TVF7533-MF */
+ { 0x6ce05a8f, EM2820_BOARD_PROLINK_PLAYTV_USB2, TUNER_YMEC_TVF_5533MF },
+};
+/* Since em28xx_pre_card_setup() requires a proper dev->model,
+ * this won't work for boards with generic PCI IDs
+ */
void em28xx_pre_card_setup(struct em28xx *dev)
{
/* request some modules */
switch(dev->model){
- case EM2880_BOARD_TERRATEC_PRODIGY_XS:
- case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
- case EM2880_BOARD_TERRATEC_HYBRID_XS:
- {
- em28xx_write_regs_req(dev, 0x00, 0x08, "\x7d", 1); // reset through GPIO?
- break;
- }
+ case EM2880_BOARD_TERRATEC_PRODIGY_XS:
+ case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
+ case EM2880_BOARD_TERRATEC_HYBRID_XS:
+ /* reset through GPIO? */
+ em28xx_write_regs_req(dev, 0x00, 0x08, "\x7d", 1);
+ break;
+ }
+}
+
+static int em28xx_tuner_callback(void *ptr, int command, int arg)
+{
+ int rc = 0;
+ struct em28xx *dev = ptr;
+
+ if (dev->tuner_type != TUNER_XC2028)
+ return 0;
+
+ switch (command) {
+ case XC2028_TUNER_RESET:
+ /* FIXME: This is device-dependent */
+ dev->em28xx_write_regs_req(dev, 0x00, 0x48, "\x00", 1);
+ dev->em28xx_write_regs_req(dev, 0x00, 0x12, "\x67", 1);
+
+ msleep(140);
+ break;
}
+ return rc;
}
static void em28xx_config_tuner (struct em28xx *dev)
{
struct v4l2_priv_tun_config xc2028_cfg;
struct xc2028_ctrl ctl;
+ struct tuner_setup tun_setup;
+ struct v4l2_frequency f;
+
+ if (!dev->has_tuner)
+ return;
- memset (&ctl,0,sizeof(ctl));
+ tun_setup.mode_mask = T_ANALOG_TV | T_RADIO;
+ tun_setup.type = dev->tuner_type;
+ tun_setup.addr = dev->tuner_addr;
+ tun_setup.tuner_callback = em28xx_tuner_callback;
- ctl.fname = XC2028_DEFAULT_FIRMWARE;
+ em28xx_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup);
- xc2028_cfg.tuner = TUNER_XC2028;
- xc2028_cfg.priv = &ctl;
+ if (dev->tuner_type == TUNER_XC2028) {
+ memset (&ctl, 0, sizeof(ctl));
- em28xx_i2c_call_clients(dev, TUNER_SET_CONFIG, &xc2028_cfg);
+ ctl.fname = XC2028_DEFAULT_FIRMWARE;
+ ctl.max_len = 64;
+
+ xc2028_cfg.tuner = TUNER_XC2028;
+ xc2028_cfg.priv = &ctl;
+
+ em28xx_i2c_call_clients(dev, TUNER_SET_CONFIG, &xc2028_cfg);
+ }
+
+ /* configure tuner */
+ f.tuner = 0;
+ f.type = V4L2_TUNER_ANALOG_TV;
+ f.frequency = 9076; /* just a magic number */
+ dev->ctl_freq = f.frequency;
+ em28xx_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, &f);
+}
+
+static int em28xx_hint_board(struct em28xx *dev)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(em28xx_hash); i++) {
+ if (dev->hash == em28xx_hash[i].hash) {
+ dev->model = em28xx_hash[i].model;
+ dev->tuner_type = em28xx_hash[i].tuner;
+
+ em28xx_errdev("Your board has no unique USB ID.\n");
+ em28xx_errdev("A hint were successfully done, "
+ "based on eeprom hash.\n");
+ em28xx_errdev("This method is not 100%% failproof.\n");
+ em28xx_errdev("If the board were missdetected, "
+ "please email this log to:\n");
+ em28xx_errdev("\tV4L Mailing List "
+ " <video4linux-list@redhat.com>\n");
+ em28xx_errdev("Board detected as %s\n",
+ em28xx_boards[dev->model].name);
+
+ return 0;
+ }
+ }
+ em28xx_errdev("Your board has no unique USB ID and thus need a "
+ "hint to be detected.\n");
+ em28xx_errdev("You may try to use card=<n> insmod option to "
+ "workaround that.\n");
+ em28xx_errdev("Please send an email with this log to:\n");
+ em28xx_errdev("\tV4L Mailing List <video4linux-list@redhat.com>\n");
+ em28xx_errdev("Board eeprom hash is 0x%08lx\n", dev->hash);
+
+ em28xx_errdev("Here is a list of valid choices for the card=<n>"
+ " insmod option:\n");
+ for (i = 0; i < em28xx_bcount; i++) {
+ em28xx_errdev(" card=%d -> %s\n",
+ i, em28xx_boards[i].name);
+ }
+ return -1;
}
void em28xx_card_setup(struct em28xx *dev)
{
/* request some modules */
- switch(dev->model){
- case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
- {
- struct tveeprom tv;
+ switch (dev->model) {
+ case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
+ {
+ struct tveeprom tv;
#ifdef CONFIG_MODULES
- request_module("tveeprom");
- request_module("ir-kbd-i2c");
- request_module("msp3400");
+ request_module("tveeprom");
+ request_module("ir-kbd-i2c");
#endif
- /* Call first TVeeprom */
-
- dev->i2c_client.addr = 0xa0 >> 1;
- tveeprom_hauppauge_analog(&dev->i2c_client, &tv, dev->eedata);
-
- dev->tuner_type= tv.tuner_type;
- if (tv.audio_processor == AUDIO_CHIP_MSP34XX) {
- dev->i2s_speed=2048000;
- dev->has_msp34xx=1;
- } else
- dev->has_msp34xx=0;
- break;
- }
- case EM2820_BOARD_KWORLD_PVRTV2800RF:
- {
- em28xx_write_regs_req(dev,0x00,0x08, "\xf9", 1); // GPIO enables sound on KWORLD PVR TV 2800RF
- break;
- }
+ /* Call first TVeeprom */
+
+ dev->i2c_client.addr = 0xa0 >> 1;
+ tveeprom_hauppauge_analog(&dev->i2c_client, &tv, dev->eedata);
+ dev->tuner_type = tv.tuner_type;
+ if (tv.audio_processor == AUDIO_CHIP_MSP34XX) {
+ dev->i2s_speed = 2048000;
+ dev->has_msp34xx = 1;
+ }
+ break;
+ }
+ case EM2820_BOARD_KWORLD_PVRTV2800RF:
+ /* GPIO enables sound on KWORLD PVR TV 2800RF */
+ em28xx_write_regs_req(dev, 0x00, 0x08, "\xf9", 1);
+ break;
+ case EM2820_BOARD_UNKNOWN:
+ case EM2800_BOARD_UNKNOWN:
+ em28xx_hint_board(dev);
}
+
+ dev->is_em2800 = em28xx_boards[dev->model].is_em2800;
+ dev->has_tuner = em28xx_boards[dev->model].has_tuner;
+ dev->has_msp34xx = em28xx_boards[dev->model].has_msp34xx;
+ dev->tda9887_conf = em28xx_boards[dev->model].tda9887_conf;
+ dev->decoder = em28xx_boards[dev->model].decoder;
+ dev->video_inputs = em28xx_boards[dev->model].vchannels;
+
+ if (tuner >= 0)
+ dev->tuner_type = tuner;
+
+#ifdef CONFIG_MODULES
+ /* request some modules */
+ if (dev->has_msp34xx)
+ request_module("msp3400");
+ if (dev->decoder == EM28XX_SAA7113 || dev->decoder == EM28XX_SAA7114)
+ request_module("saa7115");
+ if (dev->decoder == EM28XX_TVP5150)
+ request_module("tvp5150");
+ if (dev->has_tuner)
+ request_module("tuner");
+#endif
+
em28xx_config_tuner (dev);
}
-
-MODULE_DEVICE_TABLE (usb, em28xx_id_table);
diff --git a/linux/drivers/media/video/em28xx/em28xx-i2c.c b/linux/drivers/media/video/em28xx/em28xx-i2c.c
index 209370e2b..214cafe86 100644
--- a/linux/drivers/media/video/em28xx/em28xx-i2c.c
+++ b/linux/drivers/media/video/em28xx/em28xx-i2c.c
@@ -292,6 +292,31 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
return rc;
}
+/* based on linux/sunrpc/svcauth.h and linux/hash.h
+ * The original hash function returns a different value, if arch is x86_64
+ * or i386.
+ */
+static inline unsigned long em28xx_hash_mem(char *buf, int length, int bits)
+{
+ unsigned long hash = 0;
+ unsigned long l = 0;
+ int len = 0;
+ unsigned char c;
+ do {
+ if (len == length) {
+ c = (char)len;
+ len = -1;
+ } else
+ c = *buf++;
+ l = (l << 8) | c;
+ len++;
+ if ((len & (32 / 8 - 1)) == 0)
+ hash = ((hash^l) * 0x9e370001UL);
+ } while (len);
+
+ return (hash >> (32 - bits)) & 0xffffffffUL;
+}
+
static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned char *eedata, int len)
{
unsigned char buf, *p = eedata;
@@ -335,7 +360,11 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned char *eedata, int len)
printk("\n");
}
- printk(KERN_INFO "EEPROM ID= 0x%08x\n", em_eeprom->id);
+ if (em_eeprom->id == 0x9567eb1a)
+ dev->hash = em28xx_hash_mem(eedata, len, 32);
+
+ printk(KERN_INFO "EEPROM ID= 0x%08x, hash = 0x%08lx\n",
+ em_eeprom->id, dev->hash);
printk(KERN_INFO "Vendor/Product ID= %04x:%04x\n", em_eeprom->vendor_ID,
em_eeprom->product_ID);
@@ -403,43 +432,6 @@ static void dec_use(struct i2c_adapter *adap)
}
#endif
-static int em28xx_tuner_callback(void *ptr, int command, int arg)
-{
- int rc = 0;
- struct em28xx *dev = ptr;
-
- if (dev->tuner_type != TUNER_XC2028)
- return 0;
-
- switch (command) {
- case XC2028_TUNER_RESET:
- /* FIXME: This is device-dependent */
- dev->em28xx_write_regs_req(dev, 0x00, 0x48, "\x00", 1);
- dev->em28xx_write_regs_req(dev, 0x00, 0x12, "\x67", 1);
-
- msleep(140);
- break;
- }
- return rc;
-}
-
-static int em28xx_set_tuner(int check_eeprom, struct i2c_client *client)
-{
- struct em28xx *dev = client->adapter->algo_data;
- struct tuner_setup tun_setup;
-
- if (dev->has_tuner) {
- tun_setup.mode_mask = T_ANALOG_TV | T_RADIO;
- tun_setup.type = dev->tuner_type;
- tun_setup.addr = dev->tuner_addr;
- tun_setup.tuner_callback = em28xx_tuner_callback;
-
- em28xx_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup);
- }
-
- return (0);
-}
-
/*
* attach_inform()
* gets called when a device attaches to the i2c bus
@@ -450,8 +442,10 @@ static int attach_inform(struct i2c_client *client)
struct em28xx *dev = client->adapter->algo_data;
switch (client->addr << 1) {
- case 0x43:
- case 0x4b:
+ case 0x86:
+ case 0x84:
+ case 0x96:
+ case 0x94:
{
struct v4l2_priv_tun_config tda9887_cfg;
@@ -496,9 +490,11 @@ static int attach_inform(struct i2c_client *client)
break;
default:
+ if (!dev->tuner_addr)
+ dev->tuner_addr = client->addr;
+
dprintk1(1,"attach inform: detected I2C address %x\n", client->addr << 1);
- dev->tuner_addr = client->addr;
- em28xx_set_tuner(-1, client);
+
}
return 0;
diff --git a/linux/drivers/media/video/em28xx/em28xx-video.c b/linux/drivers/media/video/em28xx/em28xx-video.c
index 533c2a996..05a931aeb 100644
--- a/linux/drivers/media/video/em28xx/em28xx-video.c
+++ b/linux/drivers/media/video/em28xx/em28xx-video.c
@@ -32,14 +32,13 @@
#include <linux/usb.h>
#include <linux/i2c.h>
#include <linux/version.h>
+#include <linux/mm.h>
#include <linux/video_decoder.h>
-#include "compat.h"
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
#include <linux/mutex.h>
#endif
#include "em28xx.h"
-#include <media/tuner.h>
#include <media/v4l2-common.h>
#include <media/msp3400.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
@@ -89,10 +88,6 @@ MODULE_PARM_DESC(card,"card type");
MODULE_PARM_DESC(video_nr,"video device numbers");
MODULE_PARM_DESC(vbi_nr,"vbi device numbers");
-static int tuner = -1;
-module_param(tuner, int, 0444);
-MODULE_PARM_DESC(tuner, "tuner type");
-
static unsigned int video_debug = 0;
module_param(video_debug,int,0644);
MODULE_PARM_DESC(video_debug,"enable debug messages [video]");
@@ -149,8 +144,6 @@ static struct v4l2_queryctrl em28xx_qctrl[] = {
static struct usb_driver em28xx_usb_driver;
-static DEFINE_MUTEX(em28xx_sysfs_lock);
-static DECLARE_RWSEM(em28xx_disconnect);
/********************* v4l2 interface ******************************************/
@@ -162,7 +155,8 @@ static int em28xx_config(struct em28xx *dev)
{
/* Sets I2C speed to 100 KHz */
- em28xx_write_regs_req(dev, 0x00, 0x06, "\x40", 1);
+ if (!dev->is_em2800)
+ em28xx_write_regs_req(dev, 0x00, 0x06, "\x40", 1);
#if 1
/* enable vbi capturing */
@@ -190,7 +184,6 @@ static int em28xx_config(struct em28xx *dev)
*/
static void em28xx_config_i2c(struct em28xx *dev)
{
- struct v4l2_frequency f;
struct v4l2_routing route;
route.input = INPUT(dev->ctl_input)->vmux;
@@ -198,13 +191,6 @@ static void em28xx_config_i2c(struct em28xx *dev)
em28xx_i2c_call_clients(dev, VIDIOC_INT_RESET, NULL);
em28xx_i2c_call_clients(dev, VIDIOC_INT_S_VIDEO_ROUTING, &route);
em28xx_i2c_call_clients(dev, VIDIOC_STREAMON, NULL);
-
- /* configure tuner */
- f.tuner = 0;
- f.type = V4L2_TUNER_ANALOG_TV;
- f.frequency = 9076; /* FIXME:remove magic number */
- dev->ctl_freq = f.frequency;
- em28xx_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, &f);
}
/*
@@ -285,22 +271,18 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp)
em28xx_videodbg("open minor=%d type=%s users=%d\n",
minor,v4l2_type_names[dev->type],dev->users);
- if (!down_read_trylock(&em28xx_disconnect))
- return -ERESTARTSYS;
+ mutex_lock(&dev->lock);
if (dev->users) {
em28xx_warn("this driver can be opened only once\n");
- up_read(&em28xx_disconnect);
+ mutex_unlock(&dev->lock);
return -EBUSY;
}
- mutex_init(&dev->fileop_lock); /* to 1 == available */
spin_lock_init(&dev->queue_lock);
init_waitqueue_head(&dev->wait_frame);
init_waitqueue_head(&dev->wait_stream);
- mutex_lock(&dev->lock);
-
if (dev->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
em28xx_set_alternate(dev);
@@ -338,7 +320,6 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp)
err:
mutex_unlock(&dev->lock);
- up_read(&em28xx_disconnect);
return errCode;
}
@@ -349,7 +330,6 @@ err:
*/
static void em28xx_release_resources(struct em28xx *dev)
{
- mutex_lock(&em28xx_sysfs_lock);
/*FIXME: I2C IR should be disconnected */
@@ -361,7 +341,6 @@ static void em28xx_release_resources(struct em28xx *dev)
video_unregister_device(dev->vbi_dev);
em28xx_i2c_unregister(dev);
usb_put_dev(dev->udev);
- mutex_unlock(&em28xx_sysfs_lock);
#if 0 /* Fixme: disallocating these generates kernel hang */
kfree (dev->vdev);
@@ -425,6 +404,8 @@ em28xx_v4l2_read(struct file *filp, char __user * buf, size_t count,
int ret = 0;
struct em28xx *dev = filp->private_data;
+ mutex_lock(&dev->lock);
+
if (dev->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
em28xx_videodbg("V4l2_Buf_type_videocapture is set\n");
}
@@ -432,47 +413,46 @@ em28xx_v4l2_read(struct file *filp, char __user * buf, size_t count,
em28xx_videodbg("V4L2_BUF_TYPE_VBI_CAPTURE is set\n");
em28xx_videodbg("not supported yet! ...\n");
if (copy_to_user(buf, "", 1)) {
- mutex_unlock(&dev->fileop_lock);
+ mutex_unlock(&dev->lock);
return -EFAULT;
}
+ mutex_unlock(&dev->lock);
return (1);
}
if (dev->type == V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) {
em28xx_videodbg("V4L2_BUF_TYPE_SLICED_VBI_CAPTURE is set\n");
em28xx_videodbg("not supported yet! ...\n");
if (copy_to_user(buf, "", 1)) {
- mutex_unlock(&dev->fileop_lock);
+ mutex_unlock(&dev->lock);
return -EFAULT;
}
+ mutex_unlock(&dev->lock);
return (1);
}
- if (mutex_lock_interruptible(&dev->fileop_lock))
- return -ERESTARTSYS;
-
if (dev->state & DEV_DISCONNECTED) {
em28xx_videodbg("device not present\n");
- mutex_unlock(&dev->fileop_lock);
+ mutex_unlock(&dev->lock);
return -ENODEV;
}
if (dev->state & DEV_MISCONFIGURED) {
em28xx_videodbg("device misconfigured; close and open it again\n");
- mutex_unlock(&dev->fileop_lock);
+ mutex_unlock(&dev->lock);
return -EIO;
}
if (dev->io == IO_MMAP) {
em28xx_videodbg ("IO method is set to mmap; close and open"
" the device again to choose the read method\n");
- mutex_unlock(&dev->fileop_lock);
+ mutex_unlock(&dev->lock);
return -EINVAL;
}
if (dev->io == IO_NONE) {
if (!em28xx_request_buffers(dev, EM28XX_NUM_READ_FRAMES)) {
em28xx_errdev("read failed, not enough memory\n");
- mutex_unlock(&dev->fileop_lock);
+ mutex_unlock(&dev->lock);
return -ENOMEM;
}
dev->io = IO_READ;
@@ -481,13 +461,13 @@ em28xx_v4l2_read(struct file *filp, char __user * buf, size_t count,
}
if (!count) {
- mutex_unlock(&dev->fileop_lock);
+ mutex_unlock(&dev->lock);
return 0;
}
if (list_empty(&dev->outqueue)) {
if (filp->f_flags & O_NONBLOCK) {
- mutex_unlock(&dev->fileop_lock);
+ mutex_unlock(&dev->lock);
return -EAGAIN;
}
ret = wait_event_interruptible
@@ -495,11 +475,11 @@ em28xx_v4l2_read(struct file *filp, char __user * buf, size_t count,
(!list_empty(&dev->outqueue)) ||
(dev->state & DEV_DISCONNECTED));
if (ret) {
- mutex_unlock(&dev->fileop_lock);
+ mutex_unlock(&dev->lock);
return ret;
}
if (dev->state & DEV_DISCONNECTED) {
- mutex_unlock(&dev->fileop_lock);
+ mutex_unlock(&dev->lock);
return -ENODEV;
}
}
@@ -518,12 +498,12 @@ em28xx_v4l2_read(struct file *filp, char __user * buf, size_t count,
count = f->buf.length;
if (copy_to_user(buf, f->bufmem, count)) {
- mutex_unlock(&dev->fileop_lock);
+ mutex_unlock(&dev->lock);
return -EFAULT;
}
*f_pos += count;
- mutex_unlock(&dev->fileop_lock);
+ mutex_unlock(&dev->lock);
return count;
}
@@ -537,8 +517,7 @@ static unsigned int em28xx_v4l2_poll(struct file *filp, poll_table * wait)
unsigned int mask = 0;
struct em28xx *dev = filp->private_data;
- if (mutex_lock_interruptible(&dev->fileop_lock))
- return POLLERR;
+ mutex_lock(&dev->lock);
if (dev->state & DEV_DISCONNECTED) {
em28xx_videodbg("device not present\n");
@@ -563,13 +542,13 @@ static unsigned int em28xx_v4l2_poll(struct file *filp, poll_table * wait)
if (!list_empty(&dev->outqueue))
mask |= POLLIN | POLLRDNORM;
- mutex_unlock(&dev->fileop_lock);
+ mutex_unlock(&dev->lock);
return mask;
}
}
- mutex_unlock(&dev->fileop_lock);
+ mutex_unlock(&dev->lock);
return POLLERR;
}
@@ -609,25 +588,24 @@ static int em28xx_v4l2_mmap(struct file *filp, struct vm_area_struct *vma)
struct em28xx *dev = filp->private_data;
- if (mutex_lock_interruptible(&dev->fileop_lock))
- return -ERESTARTSYS;
+ mutex_lock(&dev->lock);
if (dev->state & DEV_DISCONNECTED) {
em28xx_videodbg("mmap: device not present\n");
- mutex_unlock(&dev->fileop_lock);
+ mutex_unlock(&dev->lock);
return -ENODEV;
}
if (dev->state & DEV_MISCONFIGURED) {
em28xx_videodbg ("mmap: Device is misconfigured; close and "
"open it again\n");
- mutex_unlock(&dev->fileop_lock);
+ mutex_unlock(&dev->lock);
return -EIO;
}
if (dev->io != IO_MMAP || !(vma->vm_flags & VM_WRITE) ||
size != PAGE_ALIGN(dev->frame[0].buf.length)) {
- mutex_unlock(&dev->fileop_lock);
+ mutex_unlock(&dev->lock);
return -EINVAL;
}
@@ -637,7 +615,7 @@ static int em28xx_v4l2_mmap(struct file *filp, struct vm_area_struct *vma)
}
if (i == dev->num_frames) {
em28xx_videodbg("mmap: user supplied mapping address is out of range\n");
- mutex_unlock(&dev->fileop_lock);
+ mutex_unlock(&dev->lock);
return -EINVAL;
}
@@ -649,7 +627,7 @@ static int em28xx_v4l2_mmap(struct file *filp, struct vm_area_struct *vma)
while (size > 0) { /* size is page-aligned */
if (vm_insert_page(vma, start, vmalloc_to_page(pos))) {
em28xx_videodbg("mmap: vm_insert_page failed\n");
- mutex_unlock(&dev->fileop_lock);
+ mutex_unlock(&dev->lock);
return -EAGAIN;
}
start += PAGE_SIZE;
@@ -661,7 +639,7 @@ static int em28xx_v4l2_mmap(struct file *filp, struct vm_area_struct *vma)
vma->vm_private_data = &dev->frame[i];
em28xx_vm_open(vma);
- mutex_unlock(&dev->fileop_lock);
+ mutex_unlock(&dev->lock);
return 0;
}
@@ -957,7 +935,7 @@ static int em28xx_set_fmt(struct em28xx *dev, unsigned int cmd, struct v4l2_form
/* stop io in case it is already in progress */
if (dev->stream == STREAM_ON) {
- em28xx_videodbg("VIDIOC_SET_FMT: interupting stream\n");
+ em28xx_videodbg("VIDIOC_SET_FMT: interrupting stream\n");
if ((ret = em28xx_stream_interrupt(dev)))
return ret;
}
@@ -1148,7 +1126,9 @@ static int em28xx_do_ioctl(struct inode *inode, struct file *filp,
}
}
}
+ mutex_lock(&dev->lock);
em28xx_i2c_call_clients(dev,cmd,qc);
+ mutex_unlock(&dev->lock);
if (qc->type)
return 0;
else
@@ -1162,7 +1142,9 @@ static int em28xx_do_ioctl(struct inode *inode, struct file *filp,
if (!dev->has_msp34xx)
retval=em28xx_get_ctrl(dev, ctrl);
if (retval==-EINVAL) {
+ mutex_lock(&dev->lock);
em28xx_i2c_call_clients(dev,cmd,arg);
+ mutex_unlock(&dev->lock);
return 0;
} else return retval;
}
@@ -1170,21 +1152,26 @@ static int em28xx_do_ioctl(struct inode *inode, struct file *filp,
{
struct v4l2_control *ctrl = arg;
u8 i;
+ mutex_lock(&dev->lock);
if (!dev->has_msp34xx){
for (i = 0; i < ARRAY_SIZE(em28xx_qctrl); i++) {
if (ctrl->id == em28xx_qctrl[i].id) {
+ int retval=-EINVAL;
if (ctrl->value <
em28xx_qctrl[i].minimum
|| ctrl->value >
em28xx_qctrl[i].maximum)
return -ERANGE;
- return em28xx_set_ctrl(dev, ctrl);
+ retval = em28xx_set_ctrl(dev, ctrl);
+ mutex_unlock(&dev->lock);
+ return retval;
}
}
}
em28xx_i2c_call_clients(dev,cmd,arg);
+ mutex_unlock(&dev->lock);
return 0;
}
/* --- tuner ioctls ------------------------------------------ */
@@ -1292,12 +1279,16 @@ static int em28xx_do_ioctl(struct inode *inode, struct file *filp,
|| dev->io != IO_MMAP)
return -EINVAL;
+ mutex_lock(&dev->lock);
if (dev->stream == STREAM_ON) {
em28xx_videodbg ("VIDIOC_STREAMOFF: interrupting stream\n");
- if ((ret = em28xx_stream_interrupt(dev)))
+ if ((ret = em28xx_stream_interrupt(dev))){
+ mutex_unlock(&dev->lock);
return ret;
+ }
}
em28xx_empty_framequeues(dev);
+ mutex_unlock(&dev->lock);
return 0;
}
@@ -1366,11 +1357,23 @@ static int em28xx_video_do_ioctl(struct inode *inode, struct file *filp,
return 0;
}
case VIDIOC_G_FMT:
- return em28xx_get_fmt(dev, (struct v4l2_format *) arg);
+ {
+ int retval;
+ mutex_lock(&dev->lock);
+ retval = em28xx_get_fmt(dev, (struct v4l2_format *) arg);
+ mutex_unlock(&dev->lock);
+ return retval;
+ }
case VIDIOC_TRY_FMT:
case VIDIOC_S_FMT:
- return em28xx_set_fmt(dev, cmd, (struct v4l2_format *)arg);
+ {
+ int retval;
+ mutex_lock(&dev->lock);
+ retval = em28xx_set_fmt(dev, cmd, (struct v4l2_format *)arg);
+ mutex_unlock(&dev->lock);
+ return retval;
+ }
#if 0
case VIDIOCGMBUF:
@@ -1421,10 +1424,13 @@ static int em28xx_video_do_ioctl(struct inode *inode, struct file *filp,
return -EINVAL;
}
+ mutex_lock(&dev->lock);
if (dev->stream == STREAM_ON) {
em28xx_videodbg("VIDIOC_REQBUFS: interrupting stream\n");
- if ((ret = em28xx_stream_interrupt(dev)))
+ if ((ret = em28xx_stream_interrupt(dev))){
+ mutex_unlock(&dev->lock);
return ret;
+ }
}
em28xx_empty_framequeues(dev);
@@ -1439,6 +1445,7 @@ static int em28xx_video_do_ioctl(struct inode *inode, struct file *filp,
em28xx_videodbg ("VIDIOC_REQBUFS: setting io method to mmap: num bufs %i\n",
rb->count);
dev->io = rb->count ? IO_MMAP : IO_NONE;
+ mutex_unlock(&dev->lock);
return 0;
}
case VIDIOC_QUERYBUF:
@@ -1540,26 +1547,19 @@ static int em28xx_v4l2_ioctl(struct inode *inode, struct file *filp,
int ret = 0;
struct em28xx *dev = filp->private_data;
- if (mutex_lock_interruptible(&dev->fileop_lock))
- return -ERESTARTSYS;
-
if (dev->state & DEV_DISCONNECTED) {
em28xx_errdev("v4l2 ioctl: device not present\n");
- mutex_unlock(&dev->fileop_lock);
return -ENODEV;
}
if (dev->state & DEV_MISCONFIGURED) {
em28xx_errdev
("v4l2 ioctl: device is misconfigured; close and open it again\n");
- mutex_unlock(&dev->fileop_lock);
return -EIO;
}
ret = video_usercopy(inode, filp, cmd, arg, em28xx_video_do_ioctl);
- mutex_unlock(&dev->fileop_lock);
-
return ret;
}
@@ -1585,7 +1585,7 @@ static const struct file_operations em28xx_v4l_fops = {
* allocates and inits the device structs, registers i2c bus and v4l device
*/
static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
- int minor, int model)
+ int minor)
{
struct em28xx *dev = *devhandle;
int retval = -ENOMEM;
@@ -1593,7 +1593,6 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
unsigned int maxh, maxw;
dev->udev = udev;
- dev->model = model;
mutex_init(&dev->lock);
init_waitqueue_head(&dev->open);
@@ -1602,43 +1601,6 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
dev->em28xx_read_reg_req_len = em28xx_read_reg_req_len;
dev->em28xx_write_regs_req = em28xx_write_regs_req;
dev->em28xx_read_reg_req = em28xx_read_reg_req;
- dev->is_em2800 = em28xx_boards[model].is_em2800;
- dev->has_tuner = em28xx_boards[model].has_tuner;
- dev->has_msp34xx = em28xx_boards[model].has_msp34xx;
- dev->tda9887_conf = em28xx_boards[model].tda9887_conf;
- dev->decoder = em28xx_boards[model].decoder;
-
- if (tuner >= 0)
- dev->tuner_type = tuner;
- else
- dev->tuner_type = em28xx_boards[model].tuner_type;
-
- dev->video_inputs = em28xx_boards[model].vchannels;
-
- for (i = 0; i < TVNORMS; i++)
- if (em28xx_boards[model].norm == tvnorms[i].mode)
- break;
- if (i == TVNORMS)
- i = 0;
-
- dev->tvnorm = &tvnorms[i]; /* set default norm */
-
- em28xx_videodbg("tvnorm=%s\n", dev->tvnorm->name);
-
- maxw = norm_maxw(dev);
- maxh = norm_maxh(dev);
-
- /* set default image size */
- dev->width = maxw;
- dev->height = maxh;
- dev->interlaced = EM28XX_INTERLACED_DEFAULT;
- dev->field_size = dev->width * dev->height;
- dev->frame_size =
- dev->interlaced ? dev->field_size << 1 : dev->field_size;
- dev->bytesperline = dev->width * 2;
- dev->hscale = 0;
- dev->vscale = 0;
- dev->ctl_input = 2;
/* setup video picture settings for saa7113h */
memset(&dev->vpic, 0, sizeof(dev->vpic));
@@ -1651,24 +1613,15 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
dev->vpic.palette = VIDEO_PALETTE_YUV422;
em28xx_pre_card_setup(dev);
-#ifdef CONFIG_MODULES
- /* request some modules */
- if (dev->decoder == EM28XX_SAA7113 || dev->decoder == EM28XX_SAA7114)
- request_module("saa7115");
- if (dev->decoder == EM28XX_TVP5150)
- request_module("tvp5150");
- if (dev->has_tuner)
- request_module("tuner");
-#endif
+
errCode = em28xx_config(dev);
if (errCode) {
em28xx_errdev("error configuring device\n");
- em28xx_devused&=~(1<<dev->devno);
+ em28xx_devused &= ~(1<<dev->devno);
kfree(dev);
return -ENOMEM;
}
- mutex_lock(&dev->lock);
/* register i2c bus */
em28xx_i2c_register(dev);
@@ -1678,14 +1631,33 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
/* configure the device */
em28xx_config_i2c(dev);
- mutex_unlock(&dev->lock);
+ for (i = 0; i < TVNORMS; i++)
+ if (em28xx_boards[dev->model].norm == tvnorms[i].mode)
+ break;
+ if (i == TVNORMS)
+ i = 0;
+
+ dev->tvnorm = &tvnorms[i]; /* set default norm */
+
+ em28xx_videodbg("tvnorm=%s\n", dev->tvnorm->name);
+
+ maxw = norm_maxw(dev);
+ maxh = norm_maxh(dev);
+
+ /* set default image size */
+ dev->width = maxw;
+ dev->height = maxh;
+ dev->interlaced = EM28XX_INTERLACED_DEFAULT;
+ dev->field_size = dev->width * dev->height;
+ dev->frame_size =
+ dev->interlaced ? dev->field_size << 1 : dev->field_size;
+ dev->bytesperline = dev->width * 2;
+ dev->hscale = 0;
+ dev->vscale = 0;
+ dev->ctl_input = 2;
errCode = em28xx_config(dev);
-#ifdef CONFIG_MODULES
- if (dev->has_msp34xx)
- request_module("msp3400");
-#endif
/* allocate and fill v4l2 device struct */
dev->vdev = video_device_alloc();
if (NULL == dev->vdev) {
@@ -1732,8 +1704,18 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
video_set_drvdata(dev->vbi_dev, dev);
#endif
+
+ if (dev->has_msp34xx) {
+ /* Send a reset to other chips via gpio */
+ em28xx_write_regs_req(dev, 0x00, 0x08, "\xf7", 1);
+ msleep(3);
+ em28xx_write_regs_req(dev, 0x00, 0x08, "\xff", 1);
+ msleep(3);
+
+ }
+ video_mux(dev, 0);
+
/* register v4l2 device */
- mutex_lock(&dev->lock);
if ((retval = video_register_device(dev->vdev, VFL_TYPE_GRABBER,
video_nr[dev->devno]))) {
em28xx_errdev("unable to register video device (error=%i).\n",
@@ -1760,18 +1742,6 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
printk("registered VBI\n");
}
- if (dev->has_msp34xx) {
- /* Send a reset to other chips via gpio */
- em28xx_write_regs_req(dev, 0x00, 0x08, "\xf7", 1);
- msleep(3);
- em28xx_write_regs_req(dev, 0x00, 0x08, "\xff", 1);
- msleep(3);
-
- }
- video_mux(dev, 0);
-
- mutex_unlock(&dev->lock);
-
em28xx_info("V4L2 device registered as /dev/video%d and /dev/vbi%d\n",
dev->vdev->minor-MINOR_VFL_TYPE_GRABBER_MIN,
dev->vbi_dev->minor-MINOR_VFL_TYPE_VBI_MIN);
@@ -1791,7 +1761,7 @@ static int em28xx_usb_probe(struct usb_interface *interface,
struct usb_interface *uif;
struct em28xx *dev = NULL;
int retval = -ENODEV;
- int model,i,nr,ifnum;
+ int i, nr, ifnum;
udev = usb_get_dev(interface_to_usbdev(interface));
ifnum = interface->altsetting[0].desc.bInterfaceNumber;
@@ -1831,8 +1801,6 @@ static int em28xx_usb_probe(struct usb_interface *interface,
return -ENODEV;
}
- model=id->driver_info;
-
if (nr >= EM28XX_MAXBOARDS) {
printk (DRIVER_NAME ": Supports only %i em28xx boards.\n",EM28XX_MAXBOARDS);
em28xx_devused&=~(1<<nr);
@@ -1848,7 +1816,8 @@ static int em28xx_usb_probe(struct usb_interface *interface,
}
snprintf(dev->name, 29, "em28xx #%d", nr);
- dev->devno=nr;
+ dev->devno = nr;
+ dev->model = id->driver_info;
/* compute alternate max packet sizes */
uif = udev->actconfig->interface[0];
@@ -1875,30 +1844,14 @@ static int em28xx_usb_probe(struct usb_interface *interface,
}
if ((card[nr]>=0)&&(card[nr]<em28xx_bcount))
- model=card[nr];
-
- if ((model==EM2800_BOARD_UNKNOWN)||(model==EM2820_BOARD_UNKNOWN)) {
- em28xx_errdev( "Your board has no eeprom inside it and thus can't\n"
- "%s: be autodetected. Please pass card=<n> insmod option to\n"
- "%s: workaround that. Redirect complaints to the vendor of\n"
- "%s: the TV card. Generic type will be used."
- "%s: Best regards,\n"
- "%s: -- tux\n",
- dev->name,dev->name,dev->name,dev->name,dev->name);
- em28xx_errdev("%s: Here is a list of valid choices for the card=<n> insmod option:\n",
- dev->name);
- for (i = 0; i < em28xx_bcount; i++) {
- em28xx_errdev(" card=%d -> %s\n", i,
- em28xx_boards[i].name);
- }
- }
+ dev->model = card[nr];
/* allocate device struct */
- retval = em28xx_init_dev(&dev, udev, nr, model);
+ retval = em28xx_init_dev(&dev, udev, nr);
if (retval)
return retval;
- em28xx_info("Found %s\n", em28xx_boards[model].name);
+ em28xx_info("Found %s\n", em28xx_boards[dev->model].name);
/* save our data pointer in this interface device */
usb_set_intfdata(interface, dev);
@@ -1912,18 +1865,19 @@ static int em28xx_usb_probe(struct usb_interface *interface,
*/
static void em28xx_usb_disconnect(struct usb_interface *interface)
{
- struct em28xx *dev = usb_get_intfdata(interface);
+ struct em28xx *dev;
+
+ dev = usb_get_intfdata(interface);
usb_set_intfdata(interface, NULL);
if (!dev)
return;
- down_write(&em28xx_disconnect);
+ em28xx_info("disconnecting %s\n", dev->vdev->name);
+ /* wait until all current v4l2 io is finished then deallocate resources */
mutex_lock(&dev->lock);
- em28xx_info("disconnecting %s\n", dev->vdev->name);
-
wake_up_interruptible_all(&dev->open);
if (dev->users) {
@@ -1942,6 +1896,7 @@ static void em28xx_usb_disconnect(struct usb_interface *interface)
em28xx_release_resources(dev);
}
+
mutex_unlock(&dev->lock);
if (!dev->users) {
@@ -1949,7 +1904,6 @@ static void em28xx_usb_disconnect(struct usb_interface *interface)
kfree(dev);
}
- up_write(&em28xx_disconnect);
}
static struct usb_driver em28xx_usb_driver = {
diff --git a/linux/drivers/media/video/em28xx/em28xx.h b/linux/drivers/media/video/em28xx/em28xx.h
index 8b4c54f9f..e23760122 100644
--- a/linux/drivers/media/video/em28xx/em28xx.h
+++ b/linux/drivers/media/video/em28xx/em28xx.h
@@ -49,6 +49,8 @@
#define EM2880_BOARD_TERRATEC_HYBRID_XS 11
#define EM2820_BOARD_KWORLD_PVRTV2800RF 12
#define EM2880_BOARD_TERRATEC_PRODIGY_XS 13
+#define EM2820_BOARD_PROLINK_PLAYTV_USB2 14
+#define EM2800_BOARD_VGEAR_POCKETTV 15
#define UNSET -1
@@ -260,13 +262,15 @@ struct em28xx {
int interlaced; /* 1=interlace fileds, 0=just top fileds */
int type;
+ unsigned long hash; /* eeprom hash - for boards with generic ID */
+
/* states */
enum em28xx_dev_state state;
enum em28xx_stream_state stream;
enum em28xx_io_method io;
/* locks */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
- struct mutex lock, fileop_lock;
+ struct mutex lock;
#else
struct semaphore lock, fileop_lock;
#endif
@@ -339,6 +343,9 @@ extern struct em28xx_board em28xx_boards[];
extern struct usb_device_id em28xx_id_table[];
extern const unsigned int em28xx_bcount;
+/* em2800 registers */
+#define EM2800_AUDIOSRC_REG 0x08
+
/* em28xx registers */
#define CHIPID_REG 0x0a
#define USBSUSP_REG 0x0c /* */
@@ -394,6 +401,8 @@ extern const unsigned int em28xx_bcount;
#define VIDEO_AC97 0x14
/* register settings */
+#define EM2800_AUDIO_SRC_TUNER 0x0d
+#define EM2800_AUDIO_SRC_LINE 0x0c
#define EM28XX_AUDIO_SRC_TUNER 0xc0
#define EM28XX_AUDIO_SRC_LINE 0x80
@@ -415,6 +424,12 @@ extern const unsigned int em28xx_bcount;
inline static int em28xx_audio_source(struct em28xx *dev, int input)
{
+ if(dev->is_em2800){
+ u8 tmp = EM2800_AUDIO_SRC_TUNER;
+ if(input == EM28XX_AUDIO_SRC_LINE)
+ tmp = EM2800_AUDIO_SRC_LINE;
+ em28xx_write_regs(dev, EM2800_AUDIOSRC_REG, &tmp, 1);
+ }
return em28xx_write_reg_bits(dev, AUDIOSRC_REG, input, 0xc0);
}
diff --git a/linux/drivers/media/video/ivtv/ivtv-driver.h b/linux/drivers/media/video/ivtv/ivtv-driver.h
index 592b03fe9..b1511cbf4 100644
--- a/linux/drivers/media/video/ivtv/ivtv-driver.h
+++ b/linux/drivers/media/video/ivtv/ivtv-driver.h
@@ -51,6 +51,7 @@
#include <linux/unistd.h>
#include <linux/byteorder/swab.h>
#include <linux/pagemap.h>
+#include <linux/scatterlist.h>
#include <linux/workqueue.h>
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
#include <linux/mutex.h>
diff --git a/linux/drivers/media/video/ivtv/ivtv-i2c.c b/linux/drivers/media/video/ivtv/ivtv-i2c.c
index d78f2f7fd..6c96bb9bc 100644
--- a/linux/drivers/media/video/ivtv/ivtv-i2c.c
+++ b/linux/drivers/media/video/ivtv/ivtv-i2c.c
@@ -746,7 +746,7 @@ int __devinit init_ivtv_i2c(struct ivtv *itv)
return i2c_bit_add_bus(&itv->i2c_adap);
}
-void __devexit exit_ivtv_i2c(struct ivtv *itv)
+void exit_ivtv_i2c(struct ivtv *itv)
{
IVTV_DEBUG_I2C("i2c exit\n");
diff --git a/linux/drivers/media/video/ivtv/ivtv-i2c.h b/linux/drivers/media/video/ivtv/ivtv-i2c.h
index 677c32928..de6a07442 100644
--- a/linux/drivers/media/video/ivtv/ivtv-i2c.h
+++ b/linux/drivers/media/video/ivtv/ivtv-i2c.h
@@ -36,6 +36,6 @@ void ivtv_call_i2c_clients(struct ivtv *itv, unsigned int cmd, void *arg);
/* init + register i2c algo-bit adapter */
int __devinit init_ivtv_i2c(struct ivtv *itv);
-void __devexit exit_ivtv_i2c(struct ivtv *itv);
+void exit_ivtv_i2c(struct ivtv *itv);
#endif
diff --git a/linux/drivers/media/video/ivtv/ivtv-udma.c b/linux/drivers/media/video/ivtv/ivtv-udma.c
index c4626d1cd..5d4964b24 100644
--- a/linux/drivers/media/video/ivtv/ivtv-udma.c
+++ b/linux/drivers/media/video/ivtv/ivtv-udma.c
@@ -22,6 +22,7 @@
#include "ivtv-driver.h"
#include "ivtv-udma.h"
+#include "compat.h"
void ivtv_udma_get_page_info(struct ivtv_dma_page_info *dma_page, unsigned long first, unsigned long size)
{
@@ -49,8 +50,6 @@ int ivtv_udma_fill_sg_list (struct ivtv_user_dma *dma, struct ivtv_dma_page_info
unsigned int len = (i == dma_page->page_count - 1) ?
dma_page->tail : PAGE_SIZE - offset;
- dma->SGlist[map_offset].length = len;
- dma->SGlist[map_offset].offset = offset;
if (PageHighMem(dma->map[map_offset])) {
void *src;
@@ -63,10 +62,10 @@ int ivtv_udma_fill_sg_list (struct ivtv_user_dma *dma, struct ivtv_dma_page_info
memcpy(page_address(dma->bouncemap[map_offset]) + offset, src, len);
kunmap_atomic(src, KM_BOUNCE_READ);
local_irq_restore(flags);
- dma->SGlist[map_offset].page = dma->bouncemap[map_offset];
+ sg_set_page(&dma->SGlist[map_offset], dma->bouncemap[map_offset], len, offset);
}
else {
- dma->SGlist[map_offset].page = dma->map[map_offset];
+ sg_set_page(&dma->SGlist[map_offset], dma->map[map_offset], len, offset);
}
offset = 0;
map_offset++;
diff --git a/linux/drivers/media/video/meye.c b/linux/drivers/media/video/meye.c
index 502d5cdfe..5e685252f 100644
--- a/linux/drivers/media/video/meye.c
+++ b/linux/drivers/media/video/meye.c
@@ -3,7 +3,7 @@
*
* Copyright (C) 2001-2004 Stelian Pop <stelian@popies.net>
*
- * Copyright (C) 2001-2002 Alcôve <www.alcove.com>
+ * Copyright (C) 2001-2002 Alcôve <www.alcove.com>
*
* Copyright (C) 2000 Andrew Tridgell <tridge@valinux.com>
*
diff --git a/linux/drivers/media/video/meye.h b/linux/drivers/media/video/meye.h
index fdba6226e..c5c8d0a0a 100644
--- a/linux/drivers/media/video/meye.h
+++ b/linux/drivers/media/video/meye.h
@@ -3,7 +3,7 @@
*
* Copyright (C) 2001-2004 Stelian Pop <stelian@popies.net>
*
- * Copyright (C) 2001-2002 Alcôve <www.alcove.com>
+ * Copyright (C) 2001-2002 Alcôve <www.alcove.com>
*
* Copyright (C) 2000 Andrew Tridgell <tridge@valinux.com>
*
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.c b/linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
index 83d1484a9..cdbd92ed0 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
@@ -415,7 +415,7 @@ static int parse_mtoken(const char *ptr,unsigned int len,
int msk;
*valptr = 0;
for (idx = 0, msk = 1; valid_bits; idx++, msk <<= 1) {
- if (!msk & valid_bits) continue;
+ if (!(msk & valid_bits)) continue;
valid_bits &= ~msk;
if (!names[idx]) continue;
slen = strlen(names[idx]);
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
index 8537b5b05..7bcf0996f 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
@@ -922,14 +922,6 @@ static int pvr2_sysfs_hotplug(struct class_device *cd,char **envp,
because sysfs will still try to call it. */
return 0;
}
-#else
-static int pvr2_sysfs_hotplug(struct device *d,
- struct kobj_uevent_env *env)
-{
- /* Even though we don't do anything here, we still need this function
- because sysfs will still try to call it. */
- return 0;
-}
#endif
struct pvr2_sysfs_class *pvr2_sysfs_class_create(void)
@@ -949,8 +941,6 @@ struct pvr2_sysfs_class *pvr2_sysfs_class_create(void)
clp->class.hotplug = pvr2_sysfs_hotplug;
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
clp->class.uevent = pvr2_sysfs_hotplug;
-#else
- clp->class.dev_uevent = pvr2_sysfs_hotplug;
#endif
if (class_register(&clp->class)) {
pvr2_sysfs_trace(
diff --git a/linux/drivers/media/video/pwc/pwc.h b/linux/drivers/media/video/pwc/pwc.h
index a01dcb282..c5fe0e13d 100644
--- a/linux/drivers/media/video/pwc/pwc.h
+++ b/linux/drivers/media/video/pwc/pwc.h
@@ -37,6 +37,7 @@
#include <asm/semaphore.h>
#endif
#include <asm/errno.h>
+#include "compat.h"
#include <linux/videodev.h>
#include <media/v4l2-common.h>
diff --git a/linux/drivers/media/video/saa5246a.c b/linux/drivers/media/video/saa5246a.c
index d8091b18a..1c5bf3f38 100644
--- a/linux/drivers/media/video/saa5246a.c
+++ b/linux/drivers/media/video/saa5246a.c
@@ -206,10 +206,10 @@ static int i2c_senddata(struct saa5246a_device *t, ...)
return i2c_sendbuf(t, buf[0], ct-1, buf+1);
}
-/* Get count number of bytes from I²C-device at address adr, store them in buf.
+/* Get count number of bytes from I²C-device at address adr, store them in buf.
* Start & stop handshaking is done by this routine, ack will be sent after the
* last byte to inhibit further sending of data. If uaccess is 'true', data is
- * written to user-space with put_user. Returns -1 if I²C-device didn't send
+ * written to user-space with put_user. Returns -1 if I²C-device didn't send
* acknowledge, 0 otherwise
*/
static int i2c_getdata(struct saa5246a_device *t, int count, u8 *buf)
diff --git a/linux/drivers/media/video/saa5249.c b/linux/drivers/media/video/saa5249.c
index def3486e9..8fa29c540 100644
--- a/linux/drivers/media/video/saa5249.c
+++ b/linux/drivers/media/video/saa5249.c
@@ -301,10 +301,10 @@ static int i2c_senddata(struct saa5249_device *t, ...)
return i2c_sendbuf(t, buf[0], ct-1, buf+1);
}
-/* Get count number of bytes from I²C-device at address adr, store them in buf. Start & stop
+/* Get count number of bytes from I²C-device at address adr, store them in buf. Start & stop
* handshaking is done by this routine, ack will be sent after the last byte to inhibit further
* sending of data. If uaccess is 'true', data is written to user-space with put_user.
- * Returns -1 if I²C-device didn't send acknowledge, 0 otherwise
+ * Returns -1 if I²C-device didn't send acknowledge, 0 otherwise
*/
static int i2c_getdata(struct saa5249_device *t, int count, u8 *buf)
diff --git a/linux/drivers/media/video/saa7134/saa7134-alsa.c b/linux/drivers/media/video/saa7134/saa7134-alsa.c
index 9b557ab7c..a2ee5cf9c 100644
--- a/linux/drivers/media/video/saa7134/saa7134-alsa.c
+++ b/linux/drivers/media/video/saa7134/saa7134-alsa.c
@@ -557,8 +557,10 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream,
V4L functions, and force ALSA to use that as the DMA area */
substream->runtime->dma_area = dev->dmasound.dma.vmalloc;
+ substream->runtime->dma_bytes = dev->dmasound.bufsize;
+ substream->runtime->dma_addr = 0;
- return 1;
+ return 0;
}
@@ -666,6 +668,17 @@ static int snd_card_saa7134_capture_open(struct snd_pcm_substream * substream)
}
/*
+ * page callback (needed for mmap)
+ */
+
+static struct page *snd_card_saa7134_page(struct snd_pcm_substream *substream,
+ unsigned long offset)
+{
+ void *pageptr = substream->runtime->dma_area + offset;
+ return vmalloc_to_page(pageptr);
+}
+
+/*
* ALSA capture callbacks definition
*/
@@ -678,6 +691,7 @@ static struct snd_pcm_ops snd_card_saa7134_capture_ops = {
.prepare = snd_card_saa7134_capture_prepare,
.trigger = snd_card_saa7134_capture_trigger,
.pointer = snd_card_saa7134_capture_pointer,
+ .page = snd_card_saa7134_page,
};
/*
diff --git a/linux/drivers/media/video/saa7134/saa7134-tvaudio.c b/linux/drivers/media/video/saa7134/saa7134-tvaudio.c
index 274816a8b..5832d552f 100644
--- a/linux/drivers/media/video/saa7134/saa7134-tvaudio.c
+++ b/linux/drivers/media/video/saa7134/saa7134-tvaudio.c
@@ -27,7 +27,9 @@
#include <linux/kthread.h>
#include <linux/slab.h>
#include <linux/delay.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
#include <linux/freezer.h>
+#endif
#include <asm/div64.h>
#include "saa7134-reg.h"
diff --git a/linux/drivers/media/video/tuner-xc2028.c b/linux/drivers/media/video/tuner-xc2028.c
index fdea79c28..f5a2cfa15 100644
--- a/linux/drivers/media/video/tuner-xc2028.c
+++ b/linux/drivers/media/video/tuner-xc2028.c
@@ -11,17 +11,17 @@
#include <linux/i2c.h>
#include <asm/div64.h>
#include <linux/firmware.h>
-#include <linux/videodev.h>
+#include <linux/videodev2.h>
#include <linux/delay.h>
#include <media/tuner.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16)
#include <linux/mutex.h>
#else
#include <asm/semaphore.h>
#endif
#include "compat.h"
#include "tuner-i2c.h"
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
#include "i2c-compat.h"
#endif
#include "tuner-xc2028.h"
@@ -70,34 +70,38 @@ struct xc2028_data {
enum tuner_mode mode;
struct i2c_client *i2c_client;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16)
struct mutex lock;
#else
struct semaphore lock;
#endif
};
-#define i2c_send(rc, priv, buf, size) \
-if (size != (rc = tuner_i2c_xfer_send(&priv->i2c_props, buf, size))) \
- tuner_info("i2c output error: rc = %d (should be %d)\n", \
- rc, (int)size);
-
-#define i2c_rcv(rc, priv, buf, size) \
-if (size != (rc = tuner_i2c_xfer_recv(&priv->i2c_props, buf, size))) \
- tuner_info("i2c input error: rc = %d (should be %d)\n", \
- rc, (int)size);
-
-#define send_seq(priv, data...) \
-{ int rc; \
+#define i2c_send(rc, priv, buf, size) do { \
+ rc = tuner_i2c_xfer_send(&priv->i2c_props, buf, size); \
+ if (size != rc) \
+ tuner_info("i2c output error: rc = %d (should be %d)\n",\
+ rc, (int)size); \
+} while (0)
+
+#define i2c_rcv(rc, priv, buf, size) do { \
+ rc = tuner_i2c_xfer_recv(&priv->i2c_props, buf, size); \
+ if (size != rc) \
+ tuner_info("i2c input error: rc = %d (should be %d)\n", \
+ rc, (int)size); \
+} while (0)
+
+#define send_seq(priv, data...) do { \
+ int rc; \
static u8 _val[] = data; \
if (sizeof(_val) != \
- (rc = tuner_i2c_xfer_send (&priv->i2c_props, \
+ (rc = tuner_i2c_xfer_send(&priv->i2c_props, \
_val, sizeof(_val)))) { \
- tuner_info("Error on line %d: %d\n",__LINE__,rc); \
- return -EINVAL; \
+ tuner_info("Error on line %d: %d\n", __LINE__, rc); \
+ return -EINVAL; \
} \
- msleep (10); \
-}
+ msleep(10); \
+} while (0)
static int xc2028_get_reg(struct xc2028_data *priv, u16 reg)
{
@@ -106,42 +110,42 @@ static int xc2028_get_reg(struct xc2028_data *priv, u16 reg)
tuner_info("%s called\n", __FUNCTION__);
- buf[0]= reg;
+ buf[0] = reg;
i2c_send(rc, priv, buf, sizeof(buf));
- if (rc<0)
+ if (rc < 0)
return rc;
i2c_rcv(rc, priv, buf, 2);
- if (rc<0)
+ if (rc < 0)
return rc;
- return (buf[1])|(buf[0]<<8);
+ return (buf[1]) | (buf[0] << 8);
}
-static void free_firmware (struct xc2028_data *priv)
+static void free_firmware(struct xc2028_data *priv)
{
int i;
if (!priv->firm)
return;
- for (i=0;i<priv->firm_size;i++) {
- if (priv->firm[i].ptr)
- kfree(priv->firm[i].ptr);
- }
+ for (i = 0; i < priv->firm_size; i++)
+ kfree(priv->firm[i].ptr);
+
kfree(priv->firm);
- priv->firm=NULL;
+ priv->firm = NULL;
priv->need_load_generic = 1;
}
-static int load_all_firmwares (struct dvb_frontend *fe)
+static int load_all_firmwares(struct dvb_frontend *fe)
{
struct xc2028_data *priv = fe->tuner_priv;
- const struct firmware *fw=NULL;
+ const struct firmware *fw = NULL;
unsigned char *p, *endp;
- int rc=0, n, n_array;
+ int rc = 0;
+ int n, n_array;
char name[33];
tuner_info("%s called\n", __FUNCTION__);
@@ -149,7 +153,7 @@ static int load_all_firmwares (struct dvb_frontend *fe)
tuner_info("Loading firmware %s\n", priv->ctrl.fname);
rc = request_firmware(&fw, priv->ctrl.fname, priv->dev);
if (rc < 0) {
- if (rc==-ENOENT)
+ if (rc == -ENOENT)
tuner_info("Error: firmware %s not found.\n",
priv->ctrl.fname);
else
@@ -158,44 +162,44 @@ static int load_all_firmwares (struct dvb_frontend *fe)
return rc;
}
- p=fw->data;
- endp=p+fw->size;
+ p = fw->data;
+ endp = p + fw->size;
- if(fw->size<sizeof(name)-1+2) {
+ if (fw->size < sizeof(name) - 1 + 2) {
tuner_info("Error: firmware size is zero!\n");
- rc=-EINVAL;
+ rc = -EINVAL;
goto done;
}
- memcpy(name,p,sizeof(name)-1);
- name[sizeof(name)-1]=0;
- p+=sizeof(name)-1;
+ memcpy(name, p, sizeof(name) - 1);
+ name[sizeof(name) - 1] = 0;
+ p += sizeof(name) - 1;
- priv->version = le16_to_cpu(*(__u16 *)p);
+ priv->version = le16_to_cpu(*(__u16 *) p);
p += 2;
tuner_info("firmware: %s, ver %d.%d\n", name,
- priv->version>>8, priv->version&0xff);
+ priv->version >> 8, priv->version & 0xff);
- if (p+2>endp)
+ if (p + 2 > endp)
goto corrupt;
- n_array = le16_to_cpu(*(__u16 *)p);
+ n_array = le16_to_cpu(*(__u16 *) p);
p += 2;
tuner_info("there are %d firmwares at %s\n", n_array, priv->ctrl.fname);
- priv->firm=kzalloc(sizeof(*priv->firm)*n_array,GFP_KERNEL);
+ priv->firm = kzalloc(sizeof(*priv->firm) * n_array, GFP_KERNEL);
if (!fw) {
tuner_info("Not enough memory for loading firmware.\n");
- rc=-ENOMEM;
+ rc = -ENOMEM;
goto done;
}
priv->firm_size = n_array;
- n=-1;
- while (p<endp) {
+ n = -1;
+ while (p < endp) {
__u32 type, size;
v4l2_std_id id;
@@ -206,34 +210,34 @@ static int load_all_firmwares (struct dvb_frontend *fe)
}
/* Checks if there's enough bytes to read */
- if (p+sizeof(type)+sizeof(id)+sizeof(size)>endp) {
+ if (p + sizeof(type) + sizeof(id) + sizeof(size) > endp) {
tuner_info("Lost firmware!\n");
goto corrupt;
}
- type = le32_to_cpu(*(__u32 *)p);
+ type = le32_to_cpu(*(__u32 *) p);
p += sizeof(type);
- id = le64_to_cpu(*(v4l2_std_id *)p);
+ id = le64_to_cpu(*(v4l2_std_id *) p);
p += sizeof(id);
- size = le32_to_cpu(*(v4l2_std_id *)p);
+ size = le32_to_cpu(*(v4l2_std_id *) p);
p += sizeof(size);
- if ((!size)||(size+p>endp)) {
+ if ((!size) || (size + p > endp)) {
tuner_info("Firmware type %x, id %lx corrupt\n",
- type, (unsigned long) id);
+ type, (unsigned long)id);
goto corrupt;
}
- priv->firm[n].ptr=kzalloc(size,GFP_KERNEL);
+ priv->firm[n].ptr = kzalloc(size, GFP_KERNEL);
if (!priv->firm[n].ptr) {
tuner_info("Not enough memory.\n");
- rc=-ENOMEM;
+ rc = -ENOMEM;
goto err;
}
tuner_info("Loading firmware type %x, id %lx, size=%d.\n",
- type, (unsigned long) id, size);
+ type, (unsigned long)id, size);
memcpy(priv->firm[n].ptr, p, size);
priv->firm[n].type = type;
@@ -243,7 +247,7 @@ static int load_all_firmwares (struct dvb_frontend *fe)
p += size;
}
- if (n+1 != priv->firm_size) {
+ if (n + 1 != priv->firm_size) {
tuner_info("Firmware file is incomplete!\n");
goto corrupt;
}
@@ -251,7 +255,7 @@ static int load_all_firmwares (struct dvb_frontend *fe)
goto done;
corrupt:
- rc=-EINVAL;
+ rc = -EINVAL;
tuner_info("Error: firmware file is corrupted!\n");
err:
@@ -266,46 +270,44 @@ done:
return rc;
}
-static int load_firmware (struct dvb_frontend *fe, unsigned int type,
- v4l2_std_id *id)
+static int load_firmware(struct dvb_frontend *fe, unsigned int type,
+ v4l2_std_id * id)
{
struct xc2028_data *priv = fe->tuner_priv;
- int i, rc;
- unsigned char *p, *endp, buf[priv->max_len];
+ int i, rc;
+ unsigned char *p, *endp, buf[priv->max_len];
tuner_info("%s called\n", __FUNCTION__);
if (!priv->firm) {
- printk (KERN_ERR PREFIX "Error! firmware not loaded\n");
+ printk(KERN_ERR PREFIX "Error! firmware not loaded\n");
return -EINVAL;
}
if ((type == 0) && (*id == 0))
- *id=V4L2_STD_PAL;
+ *id = V4L2_STD_PAL;
/* Seek for exact match */
- for (i=0;i<priv->firm_size;i++) {
- if ( (type == priv->firm[i].type) &&
- (*id == priv->firm[i].id))
+ for (i = 0; i < priv->firm_size; i++) {
+ if ((type == priv->firm[i].type) && (*id == priv->firm[i].id))
goto found;
}
/* Seek for generic video standard match */
- for (i=0;i<priv->firm_size;i++) {
- if ( (type == priv->firm[i].type) && (*id & priv->firm[i].id))
+ for (i = 0; i < priv->firm_size; i++) {
+ if ((type == priv->firm[i].type) && (*id & priv->firm[i].id))
goto found;
}
/*FIXME: Would make sense to seek for type "hint" match ? */
- tuner_info ("Can't find firmware for type=%x, id=%lx\n", type,
- (long int)*id);
+ tuner_info("Can't find firmware for type=%x, id=%lx\n", type,
+ (long int)*id);
return -EINVAL;
found:
*id = priv->firm[i].id;
- tuner_info ("Found firmware for type=%x, id=%lx\n", type,
- (long int)*id);
+ tuner_info("Found firmware for type=%x, id=%lx\n", type, (long int)*id);
p = priv->firm[i].ptr;
@@ -313,19 +315,18 @@ found:
printk(KERN_ERR PREFIX "Firmware pointer were freed!");
return -EINVAL;
}
- endp = p+priv->firm[i].size;
+ endp = p + priv->firm[i].size;
- while (p<endp) {
+ while (p < endp) {
__u16 size;
/* Checks if there's enough bytes to read */
- if (p+sizeof(size)>endp) {
+ if (p + sizeof(size) > endp) {
tuner_info("missing bytes\n");
return -EINVAL;
}
-
- size = le16_to_cpu(*(__u16 *)p);
+ size = le16_to_cpu(*(__u16 *) p);
p += sizeof(size);
if (size == 0xffff)
@@ -334,10 +335,10 @@ found:
if (!size) {
/* Special callback command received */
rc = priv->tuner_callback(priv->video_dev,
- XC2028_TUNER_RESET, 0);
- if (rc<0) {
+ XC2028_TUNER_RESET, 0);
+ if (rc < 0) {
tuner_info("Error at RESET code %d\n",
- (*p)&0x7f);
+ (*p) & 0x7f);
return -EINVAL;
}
continue;
@@ -345,13 +346,13 @@ found:
/* Checks for a sleep command */
if (size & 0x8000) {
- msleep (size & 0x7fff);
+ msleep(size & 0x7fff);
continue;
}
if ((size + p > endp)) {
tuner_info("missing bytes: need %d, have %d\n",
- size, (int)(endp-p));
+ size, (int)(endp - p));
return -EINVAL;
}
@@ -360,14 +361,15 @@ found:
size--;
/* Sends message chunks */
- while (size>0) {
- int len = (size<priv->max_len-1)?size:priv->max_len-1;
+ while (size > 0) {
+ int len = (size < priv->max_len - 1) ?
+ size : priv->max_len - 1;
- memcpy(buf+1, p, len);
+ memcpy(buf + 1, p, len);
- i2c_send(rc, priv, buf, len+1);
- if (rc<0) {
- tuner_info("%d returned from send\n",rc);
+ i2c_send(rc, priv, buf, len + 1);
+ if (rc < 0) {
+ tuner_info("%d returned from send\n", rc);
return -EINVAL;
}
@@ -379,13 +381,12 @@ found:
}
static int check_firmware(struct dvb_frontend *fe, enum tuner_mode new_mode,
- v4l2_std_id std,
- fe_bandwidth_t bandwidth)
+ v4l2_std_id std, fe_bandwidth_t bandwidth)
{
struct xc2028_data *priv = fe->tuner_priv;
int rc, version;
- v4l2_std_id std0=0;
- unsigned int type0=0,type=0;
+ v4l2_std_id std0 = 0;
+ unsigned int type0 = 0, type = 0;
int change_digital_bandwidth;
tuner_info("%s called\n", __FUNCTION__);
@@ -394,58 +395,56 @@ static int check_firmware(struct dvb_frontend *fe, enum tuner_mode new_mode,
if (!priv->ctrl.fname)
return -EINVAL;
- rc=load_all_firmwares(fe);
- if (rc<0)
+ rc = load_all_firmwares(fe);
+ if (rc < 0)
return rc;
}
- tuner_info( "I am in mode %u and I should switch to mode %i\n",
- priv->mode, new_mode);
+ tuner_info("I am in mode %u and I should switch to mode %i\n",
+ priv->mode, new_mode);
/* first of all, determine whether we have switched the mode */
- if(new_mode != priv->mode) {
+ if (new_mode != priv->mode) {
priv->mode = new_mode;
priv->need_load_generic = 1;
}
change_digital_bandwidth = (priv->mode == T_DIGITAL_TV
- && bandwidth != priv->bandwidth) ? 1 : 0;
+ && bandwidth != priv->bandwidth) ? 1 : 0;
tuner_info("old bandwidth %u, new bandwidth %u\n", priv->bandwidth,
- bandwidth);
+ bandwidth);
if (priv->need_load_generic) {
/* Reset is needed before loading firmware */
rc = priv->tuner_callback(priv->video_dev,
XC2028_TUNER_RESET, 0);
- if (rc<0)
+ if (rc < 0)
return rc;
- type0=BASE;
+ type0 = BASE;
if (priv->ctrl.type == XC2028_FIRM_MTS)
type0 |= MTS;
- if (priv->bandwidth==8)
+ if (priv->bandwidth == 8)
type0 |= F8MHZ;
/* FIXME: How to load FM and FM|INPUT1 firmwares? */
rc = load_firmware(fe, type0, &std0);
- if (rc<0) {
+ if (rc < 0) {
tuner_info("Error %d while loading generic firmware\n",
rc);
return rc;
}
- priv->need_load_generic=0;
- priv->firm_type=0;
- if(priv->mode == T_DIGITAL_TV) {
- change_digital_bandwidth=1;
- }
+ priv->need_load_generic = 0;
+ priv->firm_type = 0;
+ if (priv->mode == T_DIGITAL_TV)
+ change_digital_bandwidth = 1;
}
- tuner_info("I should change bandwidth %u\n",
- change_digital_bandwidth);
+ tuner_info("I should change bandwidth %u\n", change_digital_bandwidth);
if (change_digital_bandwidth) {
@@ -454,7 +453,7 @@ static int check_firmware(struct dvb_frontend *fe, enum tuner_mode new_mode,
/* FIXME: When should select a DTV78 firmware?
*/
- switch(bandwidth) {
+ switch (bandwidth) {
case BANDWIDTH_8_MHZ:
type |= DTV8;
break;
@@ -487,21 +486,21 @@ static int check_firmware(struct dvb_frontend *fe, enum tuner_mode new_mode,
if (priv->ctrl.type == XC2028_FIRM_MTS)
type |= MTS;
- tuner_info("firmware standard to load: %08lx\n",(unsigned long) std);
+ tuner_info("firmware standard to load: %08lx\n", (unsigned long)std);
if (priv->firm_type & std) {
tuner_info("no need to load a std-specific firmware.\n");
return 0;
}
rc = load_firmware(fe, type, &std);
- if (rc<0)
+ if (rc < 0)
return rc;
version = xc2028_get_reg(priv, 0x4);
tuner_info("Firmware version is %d.%d\n",
- (version>>4)&0x0f,(version)&0x0f);
+ (version >> 4) & 0x0f, (version) & 0x0f);
- priv->firm_type=std;
+ priv->firm_type = std;
return 0;
}
@@ -509,7 +508,7 @@ static int check_firmware(struct dvb_frontend *fe, enum tuner_mode new_mode,
static int xc2028_signal(struct dvb_frontend *fe, u16 *strength)
{
struct xc2028_data *priv = fe->tuner_priv;
- int frq_lock, signal=0;
+ int frq_lock, signal = 0;
tuner_info("%s called\n", __FUNCTION__);
@@ -518,16 +517,15 @@ static int xc2028_signal(struct dvb_frontend *fe, u16 *strength)
*strength = 0;
frq_lock = xc2028_get_reg(priv, 0x2);
- if (frq_lock<=0)
+ if (frq_lock <= 0)
goto ret;
/* Frequency is locked. Return signal quality */
signal = xc2028_get_reg(priv, 0x40);
- if(signal<=0) {
- signal=frq_lock;
- }
+ if (signal <= 0)
+ signal = frq_lock;
ret:
mutex_unlock(&priv->lock);
@@ -539,15 +537,14 @@ ret:
#define DIV 15625
-static int generic_set_tv_freq(struct dvb_frontend *fe, u32 freq /* in Hz */,
- enum tuner_mode new_mode,
- v4l2_std_id std,
- fe_bandwidth_t bandwidth)
+static int generic_set_tv_freq(struct dvb_frontend *fe, u32 freq /* in Hz */ ,
+ enum tuner_mode new_mode,
+ v4l2_std_id std, fe_bandwidth_t bandwidth)
{
struct xc2028_data *priv = fe->tuner_priv;
- int rc=-EINVAL;
- unsigned char buf[5];
- u32 div, offset = 0;
+ int rc = -EINVAL;
+ unsigned char buf[5];
+ u32 div, offset = 0;
tuner_info("%s called\n", __FUNCTION__);
@@ -557,57 +554,57 @@ static int generic_set_tv_freq(struct dvb_frontend *fe, u32 freq /* in Hz */,
/* HACK: It seems that specific firmware need to be reloaded
when freq is changed */
- priv->firm_type=0;
+ priv->firm_type = 0;
/* Reset GPIO 1 */
rc = priv->tuner_callback(priv->video_dev, XC2028_TUNER_RESET, 0);
- if (rc<0)
+ if (rc < 0)
goto ret;
msleep(10);
#endif
tuner_info("should set frequency %d kHz)\n", freq / 1000);
- if (check_firmware(fe, new_mode, std, bandwidth)<0)
+ if (check_firmware(fe, new_mode, std, bandwidth) < 0)
goto ret;
- if(new_mode == T_DIGITAL_TV)
+ if (new_mode == T_DIGITAL_TV)
offset = 2750000;
- div = (freq - offset + DIV/2)/DIV;
+ div = (freq - offset + DIV / 2) / DIV;
/* CMD= Set frequency */
- if (priv->version<0x0202) {
+ if (priv->version < 0x0202) {
send_seq(priv, {0x00, 0x02, 0x00, 0x00});
} else {
send_seq(priv, {0x80, 0x02, 0x00, 0x00});
}
rc = priv->tuner_callback(priv->video_dev, XC2028_RESET_CLK, 1);
- if (rc<0)
+ if (rc < 0)
goto ret;
msleep(10);
- buf[0]= 0xff & (div>>24);
- buf[1]= 0xff & (div>>16);
- buf[2]= 0xff & (div>>8);
- buf[3]= 0xff & (div);
- buf[4]= 0;
+ buf[0] = 0xff & (div >> 24);
+ buf[1] = 0xff & (div >> 16);
+ buf[2] = 0xff & (div >> 8);
+ buf[3] = 0xff & (div);
+ buf[4] = 0;
i2c_send(rc, priv, buf, sizeof(buf));
- if (rc<0)
+ if (rc < 0)
goto ret;
msleep(100);
- priv->frequency=freq;
+ priv->frequency = freq;
printk("divider= %02x %02x %02x %02x (freq=%d.%02d)\n",
- buf[1],buf[2],buf[3],buf[4],
- freq / 1000000, (freq%1000000)/10000);
+ buf[1], buf[2], buf[3], buf[4],
+ freq / 1000000, (freq % 1000000) / 10000);
- rc=0;
+ rc = 0;
ret:
mutex_unlock(&priv->lock);
@@ -616,15 +613,14 @@ ret:
}
static int xc2028_set_tv_freq(struct dvb_frontend *fe,
- struct analog_parameters *p)
+ struct analog_parameters *p)
{
struct xc2028_data *priv = fe->tuner_priv;
tuner_info("%s called\n", __FUNCTION__);
- return generic_set_tv_freq(fe, 62500l*p->frequency, T_ANALOG_TV,
- p->std,
- BANDWIDTH_8_MHZ /* NOT USED */);
+ return generic_set_tv_freq(fe, 62500l * p->frequency, T_ANALOG_TV,
+ p->std, BANDWIDTH_8_MHZ /* NOT USED */);
}
static int xc2028_set_params(struct dvb_frontend *fe,
@@ -636,13 +632,13 @@ static int xc2028_set_params(struct dvb_frontend *fe,
/* FIXME: Only OFDM implemented */
if (fe->ops.info.type != FE_OFDM) {
- tuner_info ("DTV type not implemented.\n");
+ tuner_info("DTV type not implemented.\n");
return -EINVAL;
}
return generic_set_tv_freq(fe, p->frequency, T_DIGITAL_TV,
- 0, /* NOT USED */
- p->u.ofdm.bandwidth);
+ 0 /* NOT USED */,
+ p->u.ofdm.bandwidth);
}
@@ -657,11 +653,10 @@ static int xc2028_dvb_release(struct dvb_frontend *fe)
if (!priv->count) {
list_del(&priv->xc2028_list);
- if (priv->ctrl.fname)
- kfree(priv->ctrl.fname);
+ kfree(priv->ctrl.fname);
free_firmware(priv);
- kfree (priv);
+ kfree(priv);
}
return 0;
@@ -678,7 +673,7 @@ static int xc2028_get_frequency(struct dvb_frontend *fe, u32 *frequency)
return 0;
}
-static int xc2028_set_config (struct dvb_frontend *fe, void *priv_cfg)
+static int xc2028_set_config(struct dvb_frontend *fe, void *priv_cfg)
{
struct xc2028_data *priv = fe->tuner_priv;
struct xc2028_ctrl *p = priv_cfg;
@@ -688,10 +683,9 @@ static int xc2028_set_config (struct dvb_frontend *fe, void *priv_cfg)
priv->ctrl.type = p->type;
if (p->fname) {
- if (priv->ctrl.fname)
- kfree(priv->ctrl.fname);
+ kfree(priv->ctrl.fname);
- priv->ctrl.fname = kmalloc(strlen(p->fname)+1, GFP_KERNEL);
+ priv->ctrl.fname = kmalloc(strlen(p->fname) + 1, GFP_KERNEL);
if (!priv->ctrl.fname)
return -ENOMEM;
@@ -699,6 +693,9 @@ static int xc2028_set_config (struct dvb_frontend *fe, void *priv_cfg)
strcpy(priv->ctrl.fname, p->fname);
}
+ if (p->max_len > 0)
+ priv->max_len = p->max_len;
+
tuner_info("%s OK\n", __FUNCTION__);
return 0;
@@ -706,11 +703,11 @@ static int xc2028_set_config (struct dvb_frontend *fe, void *priv_cfg)
static const struct dvb_tuner_ops xc2028_dvb_tuner_ops = {
.info = {
- .name = "Xceive XC3028",
- .frequency_min = 42000000,
- .frequency_max = 864000000,
- .frequency_step = 50000,
- },
+ .name = "Xceive XC3028",
+ .frequency_min = 42000000,
+ .frequency_max = 864000000,
+ .frequency_step = 50000,
+ },
.set_config = xc2028_set_config,
.set_analog_params = xc2028_set_tv_freq,
@@ -719,18 +716,20 @@ static const struct dvb_tuner_ops xc2028_dvb_tuner_ops = {
.get_rf_strength = xc2028_signal,
.set_params = xc2028_set_params,
-// int (*sleep)(struct dvb_frontend *fe);
-// int (*get_bandwidth)(struct dvb_frontend *fe, u32 *bandwidth);
-// int (*get_status)(struct dvb_frontend *fe, u32 *status);
+#if 0
+ int (*sleep)(struct dvb_frontend *fe);
+ int (*get_bandwidth)(struct dvb_frontend *fe, u32 *bandwidth);
+ int (*get_status)(struct dvb_frontend *fe, u32 *status);
+#endif
};
-int xc2028_attach(struct dvb_frontend *fe, struct i2c_adapter* i2c_adap,
+int xc2028_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c_adap,
u8 i2c_addr, struct device *dev, void *video_dev,
- int (*tuner_callback) (void *dev, int command,int arg))
+ int (*tuner_callback) (void *dev, int command, int arg))
{
struct xc2028_data *priv;
- printk( KERN_INFO PREFIX "Xcv2028/3028 init called!\n");
+ printk(KERN_INFO PREFIX "Xcv2028/3028 init called!\n");
if (NULL == dev)
return -ENODEV;
@@ -739,14 +738,13 @@ int xc2028_attach(struct dvb_frontend *fe, struct i2c_adapter* i2c_adap,
return -ENODEV;
if (!tuner_callback) {
- printk( KERN_ERR PREFIX "No tuner callback!\n");
+ printk(KERN_ERR PREFIX "No tuner callback!\n");
return -EINVAL;
}
list_for_each_entry(priv, &xc2028_list, xc2028_list) {
- if (priv->dev == dev) {
+ if (priv->dev == dev)
dev = NULL;
- }
}
if (dev) {
@@ -756,8 +754,8 @@ int xc2028_attach(struct dvb_frontend *fe, struct i2c_adapter* i2c_adap,
fe->tuner_priv = priv;
- priv->bandwidth=BANDWIDTH_6_MHZ;
- priv->need_load_generic=1;
+ priv->bandwidth = BANDWIDTH_6_MHZ;
+ priv->need_load_generic = 1;
priv->mode = T_UNINITIALIZED;
priv->i2c_props.addr = i2c_addr;
priv->i2c_props.adap = i2c_adap;
@@ -767,33 +765,32 @@ int xc2028_attach(struct dvb_frontend *fe, struct i2c_adapter* i2c_adap,
priv->max_len = 13;
#if 0
- /* Without fname, xc2028/3028 won't work. So, this driver will only
- work after calling TUNER_SET_CONFIG */
+ /* Without fname, xc2028/3028 won't work. So, this
+ driver will only work after calling TUNER_SET_CONFIG */
- priv->ctrl.fname = kmalloc(sizeof(DEFAULT_FIRMWARE)+1,
+ priv->ctrl.fname = kmalloc(sizeof(DEFAULT_FIRMWARE) + 1,
GFP_KERNEL);
if (!priv->ctrl.fname) {
- kfree (priv);
+ kfree(priv);
return -ENOMEM;
}
- strcpy (priv->ctrl.fname, DEFAULT_FIRMWARE);
+ strcpy(priv->ctrl.fname, DEFAULT_FIRMWARE);
#endif
mutex_init(&priv->lock);
- list_add_tail(&priv->xc2028_list,&xc2028_list);
+ list_add_tail(&priv->xc2028_list, &xc2028_list);
}
priv->count++;
memcpy(&fe->ops.tuner_ops, &xc2028_dvb_tuner_ops,
- sizeof(xc2028_dvb_tuner_ops));
+ sizeof(xc2028_dvb_tuner_ops));
tuner_info("type set to %s\n", "XCeive xc2028/xc3028 tuner");
return 0;
}
-
EXPORT_SYMBOL(xc2028_attach);
MODULE_DESCRIPTION("Xceive xc2028/xc3028 tuner driver");
diff --git a/linux/drivers/media/video/tuner-xc2028.h b/linux/drivers/media/video/tuner-xc2028.h
index f4856f07b..e04611e65 100644
--- a/linux/drivers/media/video/tuner-xc2028.h
+++ b/linux/drivers/media/video/tuner-xc2028.h
@@ -19,6 +19,7 @@ enum xc2028_firm_type {
struct xc2028_ctrl {
enum xc2028_firm_type type;
char *fname;
+ int max_len;
};
/* xc2028 commands for callback */
@@ -26,15 +27,17 @@ struct xc2028_ctrl {
#define XC2028_RESET_CLK 1
#if defined(CONFIG_TUNER_XC2028) || (defined(CONFIG_TUNER_XC2028_MODULE) && defined(MODULE))
-int xc2028_attach(struct dvb_frontend *fe, struct i2c_adapter* i2c_adap,
+int xc2028_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c_adap,
u8 i2c_addr, struct device *dev, void *video_dev,
- int (*tuner_callback) (void *dev, int command,int arg));
+ int (*tuner_callback) (void *dev, int command, int arg));
#else
static inline int xc2028_attach(struct dvb_frontend *fe,
- struct i2c_adapter* i2c_adap,
- u8 i2c_addr, struct device *dev, void *video_dev,
- int (*tuner_callback) (void *dev, int command,int arg))
+ struct i2c_adapter *i2c_adap,
+ u8 i2c_addr, struct device *dev,
+ void *video_dev,
+ int (*tuner_callback) (void *dev, int command,
+ int arg))
{
printk(KERN_INFO "%s: not probed - driver disabled by Kconfig\n",
__FUNCTION__);
diff --git a/linux/drivers/media/video/tvp5150.c b/linux/drivers/media/video/tvp5150.c
index dba3cd7dc..1619c5ff3 100644
--- a/linux/drivers/media/video/tvp5150.c
+++ b/linux/drivers/media/video/tvp5150.c
@@ -320,6 +320,7 @@ static inline void tvp5150_selmux(struct i2c_client *c)
int opmode=0;
struct tvp5150 *decoder = i2c_get_clientdata(c);
int input = 0;
+ unsigned char val;
if ((decoder->route.output & TVP5150_BLACK_SCREEN) || !decoder->enable)
input = 8;
@@ -345,6 +346,16 @@ static inline void tvp5150_selmux(struct i2c_client *c)
tvp5150_write(c, TVP5150_OP_MODE_CTL, opmode);
tvp5150_write(c, TVP5150_VD_IN_SRC_SEL_1, input);
+
+ /* Svideo should enable YCrCb output and disable GPCL output
+ * For Composite and TV, it should be the reverse
+ */
+ val = tvp5150_read(c, TVP5150_MISC_CTL);
+ if (decoder->route.input == TVP5150_SVIDEO)
+ val = (val & ~0x40) | 0x10;
+ else
+ val = (val & ~0x10) | 0x40;
+ tvp5150_write(c, TVP5150_MISC_CTL, val);
};
struct i2c_reg_value {
@@ -847,10 +858,10 @@ static inline void tvp5150_reset(struct i2c_client *c)
tvp5150_write_inittab(c, tvp5150_init_enable);
/* Initialize image preferences */
- tvp5150_write(c, TVP5150_BRIGHT_CTL, decoder->bright >> 8);
- tvp5150_write(c, TVP5150_CONTRAST_CTL, decoder->contrast >> 8);
- tvp5150_write(c, TVP5150_SATURATION_CTL, decoder->contrast >> 8);
- tvp5150_write(c, TVP5150_HUE_CTL, (decoder->hue - 32768) >> 8);
+ tvp5150_write(c, TVP5150_BRIGHT_CTL, decoder->bright);
+ tvp5150_write(c, TVP5150_CONTRAST_CTL, decoder->contrast);
+ tvp5150_write(c, TVP5150_SATURATION_CTL, decoder->contrast);
+ tvp5150_write(c, TVP5150_HUE_CTL, decoder->hue);
tvp5150_set_std(c, decoder->norm);
};
@@ -1180,10 +1191,10 @@ static int tvp5150_detect_client(struct i2c_adapter *adapter,
core->norm = V4L2_STD_ALL; /* Default is autodetect */
core->route.input = TVP5150_COMPOSITE1;
core->enable = 1;
- core->bright = 32768;
- core->contrast = 32768;
- core->hue = 32768;
- core->sat = 32768;
+ core->bright = 128;
+ core->contrast = 128;
+ core->hue = 0;
+ core->sat = 128;
if (rv) {
kfree(c);
diff --git a/linux/drivers/media/video/usbvideo/konicawc.c b/linux/drivers/media/video/usbvideo/konicawc.c
index 2d5ab2044..850034753 100644
--- a/linux/drivers/media/video/usbvideo/konicawc.c
+++ b/linux/drivers/media/video/usbvideo/konicawc.c
@@ -253,8 +253,8 @@ static void konicawc_register_input(struct konicawc *cam, struct usb_device *dev
#endif
#endif
- input_dev->evbit[0] = BIT(EV_KEY);
- input_dev->keybit[LONG(BTN_0)] = BIT(BTN_0);
+ input_dev->evbit[0] = BIT_MASK(EV_KEY);
+ input_dev->keybit[BIT_WORD(BTN_0)] = BIT_MASK(BTN_0);
input_dev->private = cam;
diff --git a/linux/drivers/media/video/usbvideo/quickcam_messenger.c b/linux/drivers/media/video/usbvideo/quickcam_messenger.c
index 349d1ba02..b32c0b9e3 100644
--- a/linux/drivers/media/video/usbvideo/quickcam_messenger.c
+++ b/linux/drivers/media/video/usbvideo/quickcam_messenger.c
@@ -115,8 +115,8 @@ static void qcm_register_input(struct qcm *cam, struct usb_device *dev)
#endif
#endif
- input_dev->evbit[0] = BIT(EV_KEY);
- input_dev->keybit[LONG(BTN_0)] = BIT(BTN_0);
+ input_dev->evbit[0] = BIT_MASK(EV_KEY);
+ input_dev->keybit[BIT_WORD(BTN_0)] = BIT_MASK(BTN_0);
input_dev->private = cam;
diff --git a/linux/drivers/media/video/usbvideo/vicam.c b/linux/drivers/media/video/usbvideo/vicam.c
index c1dc9a40c..a9440a8c1 100644
--- a/linux/drivers/media/video/usbvideo/vicam.c
+++ b/linux/drivers/media/video/usbvideo/vicam.c
@@ -961,7 +961,7 @@ read_frame(struct vicam_camera *cam, int framenum)
request[7] = realShutter >> 8;
}
- // Per John Markus Bjørndalen, byte at index 8 causes problems if it isn't 0
+ // Per John Markus Bjørndalen, byte at index 8 causes problems if it isn't 0
request[8] = 0;
// bytes 9-15 do not seem to affect exposure or image quality
diff --git a/linux/drivers/media/video/v4l1-compat.c b/linux/drivers/media/video/v4l1-compat.c
index 6281ad36a..d631a22a3 100644
--- a/linux/drivers/media/video/v4l1-compat.c
+++ b/linux/drivers/media/video/v4l1-compat.c
@@ -145,7 +145,7 @@ const static unsigned int palette2pixelformat[] = {
[VIDEO_PALETTE_YUV422P] = V4L2_PIX_FMT_YUV422P,
};
-static unsigned int __attribute_pure__
+static unsigned int __pure
palette_to_pixelformat(unsigned int palette)
{
if (palette < ARRAY_SIZE(palette2pixelformat))
diff --git a/linux/drivers/media/video/v4l2-common.c b/linux/drivers/media/video/v4l2-common.c
index a1d751c8a..04477421b 100644
--- a/linux/drivers/media/video/v4l2-common.c
+++ b/linux/drivers/media/video/v4l2-common.c
@@ -37,7 +37,7 @@
* Video4linux 1/2 integration by Justin Schoeman
* <justin@suntiger.ee.up.ac.za>
* 2.4 PROCFS support ported from 2.4 kernels by
- * Iñaki García Etxebarria <garetxe@euskalnet.net>
+ * Iñaki García Etxebarria <garetxe@euskalnet.net>
* Makefile fix by "W. Michael Petullo" <mike@flyn.org>
* 2.4 devfs support ported from 2.4 kernels by
* Dan Merillat <dan@merillat.org>
diff --git a/linux/drivers/media/video/videobuf-dma-sg.c b/linux/drivers/media/video/videobuf-dma-sg.c
index c70beb3f0..a99415141 100644
--- a/linux/drivers/media/video/videobuf-dma-sg.c
+++ b/linux/drivers/media/video/videobuf-dma-sg.c
@@ -27,6 +27,7 @@
#include <linux/pci.h>
#include <linux/vmalloc.h>
#include <linux/pagemap.h>
+#include <linux/scatterlist.h>
#include <asm/page.h>
#include <asm/pgtable.h>
@@ -61,13 +62,13 @@ videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages)
sglist = kcalloc(nr_pages, sizeof(struct scatterlist), GFP_KERNEL);
if (NULL == sglist)
return NULL;
+ sg_init_table(sglist, nr_pages);
for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) {
pg = vmalloc_to_page(virt);
if (NULL == pg)
goto err;
BUG_ON(PageHighMem(pg));
- sglist[i].page = pg;
- sglist[i].length = PAGE_SIZE;
+ sg_set_page(&sglist[i], pg, PAGE_SIZE, 0);
}
return sglist;
@@ -87,22 +88,20 @@ videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset)
sglist = kcalloc(nr_pages, sizeof(*sglist), GFP_KERNEL);
if (NULL == sglist)
return NULL;
+ sg_init_table(sglist, nr_pages);
if (NULL == pages[0])
goto nopage;
if (PageHighMem(pages[0]))
/* DMA to highmem pages might not work */
goto highmem;
- sglist[0].page = pages[0];
- sglist[0].offset = offset;
- sglist[0].length = PAGE_SIZE - offset;
+ sg_set_page(&sglist[0], pages[0], PAGE_SIZE - offset, offset);
for (i = 1; i < nr_pages; i++) {
if (NULL == pages[i])
goto nopage;
if (PageHighMem(pages[i]))
goto highmem;
- sglist[i].page = pages[i];
- sglist[i].length = PAGE_SIZE;
+ sg_set_page(&sglist[i], pages[i], PAGE_SIZE, 0);
}
return sglist;
diff --git a/linux/drivers/media/video/zoran_driver.c b/linux/drivers/media/video/zoran_driver.c
index e2e8fa66a..4fa613703 100644
--- a/linux/drivers/media/video/zoran_driver.c
+++ b/linux/drivers/media/video/zoran_driver.c
@@ -1351,7 +1351,7 @@ zoran_open (struct inode *inode,
}
dprintk(1, KERN_INFO "%s: zoran_open(%s, pid=[%d]), users(-)=%d\n",
- ZR_DEVNAME(zr), current->comm, current->pid, zr->user);
+ ZR_DEVNAME(zr), current->comm, task_pid_nr(current), zr->user);
/* now, create the open()-specific file_ops struct */
fh = kzalloc(sizeof(struct zoran_fh), GFP_KERNEL);
@@ -1424,7 +1424,7 @@ zoran_close (struct inode *inode,
struct zoran *zr = fh->zr;
dprintk(1, KERN_INFO "%s: zoran_close(%s, pid=[%d]), users(+)=%d\n",
- ZR_DEVNAME(zr), current->comm, current->pid, zr->user);
+ ZR_DEVNAME(zr), current->comm, task_pid_nr(current), zr->user);
/* kernel locks (fs/device.c), so don't do that ourselves
* (prevents deadlocks) */
diff --git a/linux/include/media/saa7146.h b/linux/include/media/saa7146.h
index 825865d64..f13a8c58a 100644
--- a/linux/include/media/saa7146.h
+++ b/linux/include/media/saa7146.h
@@ -15,6 +15,7 @@
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
#include <linux/mutex.h>
#endif
+#include <linux/scatterlist.h>
#include <linux/vmalloc.h> /* for vmalloc() */
#include <linux/mm.h> /* for vmalloc_to_page() */
diff --git a/linux/sound/pci/bt87x.c b/linux/sound/pci/bt87x.c
index 6214d8209..86c922635 100644
--- a/linux/sound/pci/bt87x.c
+++ b/linux/sound/pci/bt87x.c
@@ -181,7 +181,7 @@ struct snd_bt87x_board {
unsigned no_digital:1; /* No digital input */
};
-static const __devinitdata struct snd_bt87x_board snd_bt87x_boards[] = {
+static __devinitdata struct snd_bt87x_board snd_bt87x_boards[] = {
[SND_BT87X_BOARD_UNKNOWN] = {
.dig_rate = 32000, /* just a guess */
},
@@ -880,7 +880,7 @@ static int __devinit snd_bt87x_detect_card(struct pci_dev *pci)
int i;
const struct pci_device_id *supported;
- supported = pci_match_device(&driver, pci);
+ supported = pci_match_id(snd_bt87x_ids, pci);
if (supported && supported->driver_data > 0)
return supported->driver_data;