From 668a09d846c72467de7777a58c87bea71cbdc93a Mon Sep 17 00:00:00 2001 From: Mike Isely Date: Sun, 28 Oct 2007 20:15:33 -0500 Subject: pvrusb2: Fix associativity logic error From: Roel Kluin <12o3l@tiscali.nl> if(!x & y) should either be if(!(x & y)) or if(!x && y) I made changes as seemed appropriate, but please review this is against current git. Signed-off-by: Roel Kluin <12o3l@tiscali.nl> Signed-off-by: Mike Isely --- linux/drivers/media/video/pvrusb2/pvrusb2-ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux') 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]); -- cgit v1.2.3 From f0177a6944d2424bf957046add61d6472ae49237 Mon Sep 17 00:00:00 2001 From: Mike Isely Date: Sun, 28 Oct 2007 20:19:53 -0500 Subject: pvrusb2: Remove dead sysfs code From: Mike Isely The pvrusb2 driver's sysfs implementation had long since implemented a dummy hotplug function because at the time the kernel would oops without at least the empty function being present. Today - after numerous class interface changes in the kernel - this pvrusb2 change had been dutifully carried forward but an inspection of the kernel sources shows that it is no longer needed. So remove the dummy function and its reference. This also solves a recurring backwards compatibility issue in the pvrusb2 driver as the class interface has been getting thrashed in the kernel. Signed-off-by: Mike Isely --- linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'linux') 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( -- cgit v1.2.3 From 1816a3983b8c8a4ed5e9ba32b1eade0ce9499809 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Wed, 31 Oct 2007 07:40:09 -0700 Subject: saa7134-alsa: Fix mmap support From: Alexander E. Patrakov Trent Piepho wrote: > I do not think the saa7134-alsa driver supports mmap. The cx88-alsa driver > also claimed to support mmap, but it never worked until I fixed it. It's > pretty clear that the code in saa7134-alsa was based on the same code as > cx88-alsa, so it's likely it has the same bug. You are right. The patch below (based on your cx88 patch, but I don't really understand it) fixes mmap support in saa7134-alsa for me. Recording via mmap (arecord -M -f S16_LE -c 2 -r 32000 -D hw:1) didn't work at all before, works now, tested for at least 20 minutes (but, unfortunately, with one overrun at least 0.719 ms long). Signed-off-by: Alexander E. Patrakov Acked-by: Takashi Iwai Signed-off-by: Trent Piepho --- linux/drivers/media/video/saa7134/saa7134-alsa.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'linux') 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; } @@ -665,6 +667,17 @@ static int snd_card_saa7134_capture_open(struct snd_pcm_substream * substream) return 0; } +/* + * 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, }; /* -- cgit v1.2.3 From b74c3486bb4dfd094aa125f2125529c32e21f335 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Wed, 31 Oct 2007 21:16:04 -0700 Subject: bttv: whitespace cleanup From: Trent Piepho Someone wasn't using the v4l-dvb commit scripts and so didn't run the automatic whitespace cleaner on their code. Signed-off-by: Trent Piepho --- linux/drivers/media/video/bt8xx/bttv-audio-hook.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'linux') 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; -- cgit v1.2.3 From 23c568ba4223e0151640c155a8db5d03096313a2 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Wed, 31 Oct 2007 21:16:05 -0700 Subject: ttpci: Rework Kconfig menus and Makefile From: Trent Piepho The ttpci Kconfig file has bugs that cause it to fail in certain Kconfig situations. The basic problem is that it selects certain drivers, but does not depend on the dependencies of those drivers. See http://article.gmane.org/gmane.comp.video.video4linux/35072 Using the Kconfig file also has some annoyances. For instance one can't turn off AV7110 support unless you go down several options and first turn off budget-patch support. Normally user selectable drivers are not forced on like this. The "AV7110 cards with Budget Patch" option is disabled if "Budget cards" isn't on. Normally a driver appears nested under a driver it depends on, but since drivers that don't depend on "Budget cards" are between the two options, the config programs can't display the tree correctly. The Makefile has an issue too. Some modules, ttpci-eeprom and budget-core, appear in the Makefile under several different config symbols. If more than one of these symbols is on, they will get added the to list of objects multiple times. The normal convention is to have a config symbol just the common object(s) and have the users of the that object either depend on or select that config symbol. This patch fixes all these issues. ttpci-eepom is under a new config symbol, and so is the budget-core module. The four different budget card types appear as sub-drivers under a main "SAA7146 DVB cards" option. Turning on budget-patch doesn't force AV7110. Drivers using SAA7146_VV have the necessary VIDEO_DEV dependency, so that it isn't possible to select SAA7146_VV without V4L being on. Signed-off-by: Trent Piepho --- linux/drivers/media/common/Kconfig | 2 +- linux/drivers/media/dvb/ttpci/Kconfig | 35 ++++++++++++++++++++++++---------- linux/drivers/media/dvb/ttpci/Makefile | 12 +++++++----- 3 files changed, 33 insertions(+), 16 deletions(-) (limited to 'linux') 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/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/ -- cgit v1.2.3 From eb9d20431309ea533405d747fec681d654edcf54 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Wed, 31 Oct 2007 21:16:05 -0700 Subject: compat: saa7134 included freezer.h From: Trent Piepho File wasn't present until 2.6.20 Signed-off-by: Trent Piepho --- linux/drivers/media/video/saa7134/saa7134-tvaudio.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'linux') 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 #include #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) #include +#endif #include #include "saa7134-reg.h" -- cgit v1.2.3 From 5f573bf536b5961fa87cf6962f29cdd6fabc0fed Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Wed, 31 Oct 2007 21:16:06 -0700 Subject: compat: a number of dvb frontends didn't include compat.h From: Trent Piepho Signed-off-by: Trent Piepho --- linux/drivers/media/dvb/frontends/dib0070.c | 1 + linux/drivers/media/dvb/frontends/dib3000mb.c | 1 + linux/drivers/media/dvb/frontends/dib3000mc.c | 1 + linux/drivers/media/dvb/frontends/dib7000m.c | 1 + linux/drivers/media/dvb/frontends/dib7000p.c | 1 + linux/drivers/media/dvb/frontends/lgdt330x.c | 1 + linux/drivers/media/dvb/frontends/mt2060.c | 1 + linux/drivers/media/dvb/frontends/mt2131.c | 1 + linux/drivers/media/dvb/frontends/mt2266.c | 1 + linux/drivers/media/dvb/frontends/mt352.c | 1 + linux/drivers/media/dvb/frontends/nxt200x.c | 1 + linux/drivers/media/dvb/frontends/qt1010.c | 1 + linux/drivers/media/dvb/frontends/tda18271.c | 1 + linux/drivers/media/dvb/frontends/tda826x.c | 1 + linux/drivers/media/dvb/frontends/tda827x.c | 1 + linux/drivers/media/dvb/frontends/tua6100.c | 1 + linux/drivers/media/dvb/frontends/zl10353.c | 1 + 17 files changed, 17 insertions(+) (limited to 'linux') 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 #include +#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 #include #include +#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 #include +#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 #include +#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 #include +#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 #include #include +#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 #include #include +#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 #include #include +#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 #include #include +#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 #include #include +#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 #include #include +#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 #include +#include "compat.h" #include #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 +#include "compat.h" #include #include 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 #include +#include "compat.h" #include #include 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 #include #include +#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 #include #include +#include "compat.h" #include "dvb_frontend.h" #include "zl10353_priv.h" -- cgit v1.2.3 From 298d53742e217cffc7b296c7bf868b55da7233f5 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Wed, 31 Oct 2007 21:16:07 -0700 Subject: compat: pwc didn't include compat.h From: Trent Piepho Signed-off-by: Trent Piepho --- linux/drivers/media/video/pwc/pwc.h | 1 + 1 file changed, 1 insertion(+) (limited to 'linux') 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 #endif #include +#include "compat.h" #include #include -- cgit v1.2.3 From 36693f2d1ca968a92acc755f3d5bd297f3219faa Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Wed, 31 Oct 2007 21:16:09 -0700 Subject: em28xx: Include linux/mm.h From: Trent Piepho This em28xx-video.c uses functions from this header, but doesn't include it. It depends on some v4l headers included two levels down including poll.h, which includes mm.h. These v4l headers might change, so it's best to include the headers needed directly. It also causes problems for the out of core build system's backward compatibility with older kernels, which is the real reason I bothered to create a patch for something that would otherwise be so minor that it would hardly be worth the trouble. Signed-off-by: Trent Piepho --- linux/drivers/media/video/em28xx/em28xx-video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux') diff --git a/linux/drivers/media/video/em28xx/em28xx-video.c b/linux/drivers/media/video/em28xx/em28xx-video.c index 533c2a996..fbf06afe7 100644 --- a/linux/drivers/media/video/em28xx/em28xx-video.c +++ b/linux/drivers/media/video/em28xx/em28xx-video.c @@ -32,8 +32,8 @@ #include #include #include +#include #include -#include "compat.h" #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) #include #endif -- cgit v1.2.3 From 57e6676755daf54d77d65a215e67c77ad7b83d4a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 1 Nov 2007 17:56:26 -0200 Subject: Allow faster loading by using 64 bytes block by em28xx i2c write From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/em28xx/em28xx-cards.c | 3 ++- linux/drivers/media/video/tuner-xc2028.c | 3 +++ linux/drivers/media/video/tuner-xc2028.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) (limited to 'linux') diff --git a/linux/drivers/media/video/em28xx/em28xx-cards.c b/linux/drivers/media/video/em28xx/em28xx-cards.c index b9a11dee2..663a4c501 100644 --- a/linux/drivers/media/video/em28xx/em28xx-cards.c +++ b/linux/drivers/media/video/em28xx/em28xx-cards.c @@ -372,7 +372,8 @@ static void em28xx_config_tuner (struct em28xx *dev) memset (&ctl,0,sizeof(ctl)); - ctl.fname = XC2028_DEFAULT_FIRMWARE; + ctl.fname = XC2028_DEFAULT_FIRMWARE; + ctl.max_len = 64; xc2028_cfg.tuner = TUNER_XC2028; xc2028_cfg.priv = &ctl; diff --git a/linux/drivers/media/video/tuner-xc2028.c b/linux/drivers/media/video/tuner-xc2028.c index fdea79c28..9983817b5 100644 --- a/linux/drivers/media/video/tuner-xc2028.c +++ b/linux/drivers/media/video/tuner-xc2028.c @@ -699,6 +699,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; diff --git a/linux/drivers/media/video/tuner-xc2028.h b/linux/drivers/media/video/tuner-xc2028.h index f4856f07b..4e5e4d5d1 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 */ -- cgit v1.2.3 From 2430010071118d278f087c302c72470d7bc14ba9 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 1 Nov 2007 18:47:42 -0200 Subject: CodingStyle fixup From: Mauro Carvalho Chehab Used scripts/Lindent + manual check + scripts/checkpatch.pl Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/tuner-xc2028.c | 368 +++++++++++++++---------------- linux/drivers/media/video/tuner-xc2028.h | 12 +- 2 files changed, 188 insertions(+), 192 deletions(-) (limited to 'linux') diff --git a/linux/drivers/media/video/tuner-xc2028.c b/linux/drivers/media/video/tuner-xc2028.c index 9983817b5..f5a2cfa15 100644 --- a/linux/drivers/media/video/tuner-xc2028.c +++ b/linux/drivers/media/video/tuner-xc2028.c @@ -11,17 +11,17 @@ #include #include #include -#include +#include #include #include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16) #include #else #include #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;ifirm_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->sizesize < 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 (pendp) { + 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;ifirm_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;ifirm_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 (pendp) { + 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 = (sizemax_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,7 +693,7 @@ static int xc2028_set_config (struct dvb_frontend *fe, void *priv_cfg) strcpy(priv->ctrl.fname, p->fname); } - if (p->max_len>0) + if (p->max_len > 0) priv->max_len = p->max_len; tuner_info("%s OK\n", __FUNCTION__); @@ -709,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, @@ -722,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; @@ -742,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) { @@ -759,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; @@ -770,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 4e5e4d5d1..e04611e65 100644 --- a/linux/drivers/media/video/tuner-xc2028.h +++ b/linux/drivers/media/video/tuner-xc2028.h @@ -27,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__); -- cgit v1.2.3 From 711e05969b74bfe06109ecf4e6e6e757dc8ecbc7 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 1 Nov 2007 22:33:38 -0200 Subject: Fix tvp5150 default values From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/tvp5150.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'linux') diff --git a/linux/drivers/media/video/tvp5150.c b/linux/drivers/media/video/tvp5150.c index dba3cd7dc..6be434987 100644 --- a/linux/drivers/media/video/tvp5150.c +++ b/linux/drivers/media/video/tvp5150.c @@ -847,10 +847,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 +1180,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); -- cgit v1.2.3 From 2b62b49ee761793f928f8495f283324e0bacd27d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 1 Nov 2007 22:52:58 -0200 Subject: Fix HVR900/HVR950 entry From: Mauro Carvalho Chehab - Television is now default; - Add HVR950 name at the entry. Signed-off-by: Mauro Carvalho Chehab --- linux/Documentation/video4linux/CARDLIST.em28xx | 2 +- linux/drivers/media/video/em28xx/em28xx-cards.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'linux') diff --git a/linux/Documentation/video4linux/CARDLIST.em28xx b/linux/Documentation/video4linux/CARDLIST.em28xx index 37f0e3ced..abdcc68d4 100644 --- a/linux/Documentation/video4linux/CARDLIST.em28xx +++ b/linux/Documentation/video4linux/CARDLIST.em28xx @@ -8,7 +8,7 @@ 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) diff --git a/linux/drivers/media/video/em28xx/em28xx-cards.c b/linux/drivers/media/video/em28xx/em28xx-cards.c index 663a4c501..29407d8d7 100644 --- a/linux/drivers/media/video/em28xx/em28xx-cards.c +++ b/linux/drivers/media/video/em28xx/em28xx-cards.c @@ -159,7 +159,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,13 +167,13 @@ 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, -- cgit v1.2.3 From 9b96e945de97e6d3b2f1dc356b2334f2854f3d63 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 2 Nov 2007 13:57:19 -0200 Subject: backport changeset 96de0e252cedffad61b3cb5e05662c591898e69a MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Mauro Carvalho Chehab kernel-sync: Author: Jan Engelhardt Date: Fri Oct 19 23:21:04 2007 +0200 Convert files to UTF-8 and some cleanups * Convert files to UTF-8. * Also correct some people's names (one example is Eißfeldt, which was found in a source file. Given that the author used an ß at all in a source file indicates that the real name has in fact a 'ß' and not an 'ss', which is commonly used as a substitute for 'ß' when limited to 7bit.) * Correct town names (Goettingen -> Göttingen) * Update Eberhard Mönkeberg's address (http://lkml.org/lkml/2007/1/8/313) Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/common/saa7146_hlp.c | 2 +- linux/drivers/media/dvb/cinergyT2/cinergyT2.c | 2 +- linux/drivers/media/video/bt8xx/bttv-cards.c | 4 ++-- linux/drivers/media/video/meye.c | 2 +- linux/drivers/media/video/meye.h | 2 +- linux/drivers/media/video/usbvideo/vicam.c | 2 +- linux/drivers/media/video/v4l2-common.c | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) (limited to 'linux') 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/cinergyT2/cinergyT2.c b/linux/drivers/media/dvb/cinergyT2/cinergyT2.c index 455e50cee..0a8f40291 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 and * Holger Waechtler diff --git a/linux/drivers/media/video/bt8xx/bttv-cards.c b/linux/drivers/media/video/bt8xx/bttv-cards.c index 798df8152..730968181 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 + /* Tim Röstermundt 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 */ + /* Sérgio Fortier */ .name = "Prolink PixelView PlayTV MPEG2 PV-M4900", .video_inputs = 3, .audio_inputs = 1, 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 * - * Copyright (C) 2001-2002 Alcôve + * Copyright (C) 2001-2002 Alcôve * * Copyright (C) 2000 Andrew Tridgell * 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 * - * Copyright (C) 2001-2002 Alcôve + * Copyright (C) 2001-2002 Alcôve * * Copyright (C) 2000 Andrew Tridgell * 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/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 * * 2.4 PROCFS support ported from 2.4 kernels by - * Iñaki García Etxebarria + * Iñaki García Etxebarria * Makefile fix by "W. Michael Petullo" * 2.4 devfs support ported from 2.4 kernels by * Dan Merillat -- cgit v1.2.3 From c4a85f85d6389aef0ac3ea1256c4c86ef78b3704 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 2 Nov 2007 14:35:00 -0200 Subject: backport changeset 3a4fa0a25da81600ea0bcd75692ae8ca6050d165 From: Mauro Carvalho Chehab kernel-sync: Author: Robert P. J. Day Date: Fri Oct 19 23:10:43 2007 +0200 Fix misspellings of "system", "controller", "interrupt" and "necessary". Fix the various misspellings of "system", controller", "interrupt" and "[un]necessary". Signed-off-by: Robert P. J. Day Signed-off-by: Adrian Bunk Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/dvb/bt8xx/bt878.c | 2 +- .../media/dvb/ttusb-budget/dvb-ttusb-budget.c | 2 +- linux/drivers/media/video/bt8xx/bttv-cards.c | 22 +++++++++++----------- linux/drivers/media/video/em28xx/em28xx-video.c | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) (limited to 'linux') 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/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/video/bt8xx/bttv-cards.c b/linux/drivers/media/video/bt8xx/bttv-cards.c index 730968181..a2424738f 100644 --- a/linux/drivers/media/video/bt8xx/bttv-cards.c +++ b/linux/drivers/media/video/bt8xx/bttv-cards.c @@ -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/em28xx/em28xx-video.c b/linux/drivers/media/video/em28xx/em28xx-video.c index fbf06afe7..d3bb65306 100644 --- a/linux/drivers/media/video/em28xx/em28xx-video.c +++ b/linux/drivers/media/video/em28xx/em28xx-video.c @@ -957,7 +957,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; } -- cgit v1.2.3 From c2882b4cfb3e32b7fee85b0f191e9988535eafdd Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 2 Nov 2007 14:38:37 -0200 Subject: backport changeset 7b19ada2ed3c1eccb9fe94d74b05e1428224663d kernel-sync: Author: Jiri Slaby Date: Thu Oct 18 23:40:32 2007 -0700 get rid of input BIT* duplicate defines get rid of input BIT* duplicate defines use newly global defined macros for input layer. Also remove includes of input.h from non-input sources only for BIT macro definiton. Define the macro temporarily in local manner, all those local definitons will be removed further in this patchset (to not break bisecting). BIT macro will be globally defined (1< --- linux/drivers/media/dvb/cinergyT2/cinergyT2.c | 2 +- linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c | 2 +- linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c | 2 +- linux/drivers/media/video/usbvideo/konicawc.c | 4 ++-- linux/drivers/media/video/usbvideo/quickcam_messenger.c | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'linux') diff --git a/linux/drivers/media/dvb/cinergyT2/cinergyT2.c b/linux/drivers/media/dvb/cinergyT2/cinergyT2.c index 0a8f40291..c33afb6ea 100644 --- a/linux/drivers/media/dvb/cinergyT2/cinergyT2.c +++ b/linux/drivers/media/dvb/cinergyT2/cinergyT2.c @@ -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-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/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/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; -- cgit v1.2.3 From aef90dc656e1d3f29d6cca5dd6fd7d209d81e1df Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 2 Nov 2007 14:41:20 -0200 Subject: backport changeset 1977f032722c27ee3730284582fd3991ad9ac81b kernel-sync: Author: Jiri Slaby Date: Thu Oct 18 23:40:25 2007 -0700 remove asm/bitops.h includes remove asm/bitops.h includes including asm/bitops directly may cause compile errors. don't include it and include linux/bitops instead. next patch will deny including asm header directly. From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/dvb/ttpci/av7110_ir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux') 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 #include #include -#include +#include #include "av7110.h" #include "av7110_hw.h" -- cgit v1.2.3 From 243f8ac81736ce89f319eb22a1c220c46b733aeb Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 2 Nov 2007 14:44:48 -0200 Subject: backport changeset bb374b7b938f73666c403b201b3dd48ec9fe118a kernel-sync: Author: David Miller Date: Tue Oct 30 21:23:48 2007 -0700 [MEDIA] IVTV: exit_ivtv_i2c() cannot be __devexit It is referenced both from __devinit code (ivtv_probe) and normal .text (ivtv_process_eeprom), and therefore cannot be discarded via __devexit. Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/ivtv/ivtv-i2c.c | 2 +- linux/drivers/media/video/ivtv/ivtv-i2c.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'linux') 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 -- cgit v1.2.3 From b3d6ebe74aa17e6f4284e0e35a6cd6fb4115bbc7 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 2 Nov 2007 14:46:23 -0200 Subject: backport changeset db955170d40601d9925f01712782fbe3ce362b7e kernel-sync: Author: Marcin Garski Date: Fri Oct 19 23:22:11 2007 +0200 more UTF-8 conversions Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/saa5246a.c | 4 ++-- linux/drivers/media/video/saa5249.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'linux') 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) -- cgit v1.2.3 From bfa86c068a66cffdbabbb0656d0a5064ab668c21 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 2 Nov 2007 14:49:00 -0200 Subject: backport changeset e8c44319c691dfb4a0b039b095204c040df9b01a Author: Ralf Baechle Date: Thu Oct 18 03:07:07 2007 -0700 Replace __attribute_pure__ with __pure To be consistent with the use of attributes in the rest of the kernel replace all use of __attribute_pure__ with __pure and delete the definition of __attribute_pure__. Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/v4l1-compat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux') 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)) -- cgit v1.2.3 From ea8eb5444481b26dfae9068b9285c01187bd66d5 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 2 Nov 2007 14:53:23 -0200 Subject: Backport commit ba25f9dcc4ea6e30839fcab5a5516f2176d5bfed kern-sync: Author: Pavel Emelyanov Date: Thu Oct 18 23:40:40 2007 -0700 Use helpers to obtain task pid in printks The task_struct->pid member is going to be deprecated, so start using the helpers (task_pid_nr/task_pid_vnr/task_pid_nr_ns) in the kernel. The first thing to start with is the pid, printed to dmesg - in this case we may safely use task_pid_nr(). Besides, printks produce more (much more) than a half of all the explicit pid usage. Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/zoran_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'linux') 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) */ -- cgit v1.2.3 From 14e2b1076174e9e80a1afba3229b3355ef69ab29 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 2 Nov 2007 14:59:37 -0200 Subject: backport changes on linux/sound/pci/bt87x.c From: Mauro Carvalho Chehab kernel-sync: Signed-off-by: Mauro Carvalho Chehab --- linux/sound/pci/bt87x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'linux') 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; -- cgit v1.2.3 From 565a187e1f60cb82d9fe226d5668d28f1f85fdb4 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 2 Nov 2007 15:05:25 -0200 Subject: Fix CodingStyle From: Mauro Carvalho Chehab kern-sync: Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/cx88/cx88-cards.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'linux') 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); } } } -- cgit v1.2.3 From 49335aab3d6d92e5022bae733347abb40332e5e6 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 2 Nov 2007 17:32:46 -0200 Subject: Backport some changesets touching S/G code From: Mauro Carvalho Chehab kernel-sync: Backport kernel changesets: 45711f1af6eff1a6d010703b4862e0d2b9afd056 117636092a87a28a013a4acb5de5492645ed620f 642f149031d70415d9318b919d50b71e4724adbd Also, added newer entreis at compat.h, to avoid needing to add checks for linux versions inside the source codes. Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/common/saa7146_core.c | 4 ++-- linux/drivers/media/video/ivtv/ivtv-driver.h | 1 + linux/drivers/media/video/ivtv/ivtv-udma.c | 7 +++---- linux/drivers/media/video/videobuf-dma-sg.c | 13 ++++++------- linux/include/media/saa7146.h | 1 + 5 files changed, 13 insertions(+), 13 deletions(-) (limited to 'linux') 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/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 #include #include +#include #include #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) #include 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/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 #include #include +#include #include #include @@ -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/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 #endif +#include #include /* for vmalloc() */ #include /* for vmalloc_to_page() */ -- cgit v1.2.3 From ab38880660b6dd31e1cc3333aee22df905c45e5e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 2 Nov 2007 17:37:32 -0200 Subject: Fix a regression caused by commit 153962364dc6fa4a24571885fbe76506d8968610 From: Ludovico Cavedon Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/em28xx/em28xx-i2c.c | 1 + 1 file changed, 1 insertion(+) (limited to 'linux') diff --git a/linux/drivers/media/video/em28xx/em28xx-i2c.c b/linux/drivers/media/video/em28xx/em28xx-i2c.c index 209370e2b..6f5101170 100644 --- a/linux/drivers/media/video/em28xx/em28xx-i2c.c +++ b/linux/drivers/media/video/em28xx/em28xx-i2c.c @@ -452,6 +452,7 @@ static int attach_inform(struct i2c_client *client) switch (client->addr << 1) { case 0x43: case 0x4b: + case 0x86: { struct v4l2_priv_tun_config tda9887_cfg; -- cgit v1.2.3 From e386e857baaf48c5634e617051e4aa866550188f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 2 Nov 2007 17:46:28 -0200 Subject: Add the remaining addresses for tda9887 From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/em28xx/em28xx-i2c.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'linux') diff --git a/linux/drivers/media/video/em28xx/em28xx-i2c.c b/linux/drivers/media/video/em28xx/em28xx-i2c.c index 6f5101170..833c439bc 100644 --- a/linux/drivers/media/video/em28xx/em28xx-i2c.c +++ b/linux/drivers/media/video/em28xx/em28xx-i2c.c @@ -450,9 +450,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; -- cgit v1.2.3 From a10e3e59904fd6ce093ec74c0ad541afbbebc3e2 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 2 Nov 2007 18:40:13 -0200 Subject: backport commit e42837bcd35b75bb59ae5d3e62f87be1aeeb05c3 kernel-sync: Author: Rafael J. Wysocki Date: Thu Oct 18 03:04:45 2007 -0700 freezer: introduce freezer-friendly waiting macros Introduce freezer-friendly wrappers around wait_event_interruptible() and wait_event_interruptible_timeout(), originally defined in , to be used in freezable kernel threads. Make some of the freezable kernel threads use them. This is necessary for the freezer to stop sending signals to kernel threads, which is implemented in the next patch. From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/dvb/dvb-core/dvb_frontend.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'linux') 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 */ -- cgit v1.2.3 From 5d5ad0f6a021a309c972b6ceaf61df0ba9a27dc8 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 3 Nov 2007 09:07:07 -0200 Subject: Fix: Adds the generic PCI IDs for em28xx From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- linux/Documentation/video4linux/CARDLIST.em28xx | 4 ++-- linux/drivers/media/video/em28xx/em28xx-cards.c | 25 +++++++++---------------- linux/drivers/media/video/em28xx/em28xx-video.c | 14 +++++--------- 3 files changed, 16 insertions(+), 27 deletions(-) (limited to 'linux') diff --git a/linux/Documentation/video4linux/CARDLIST.em28xx b/linux/Documentation/video4linux/CARDLIST.em28xx index abdcc68d4..f947dca5a 100644 --- a/linux/Documentation/video4linux/CARDLIST.em28xx +++ b/linux/Documentation/video4linux/CARDLIST.em28xx @@ -1,9 +1,9 @@ 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) diff --git a/linux/drivers/media/video/em28xx/em28xx-cards.c b/linux/drivers/media/video/em28xx/em28xx-cards.c index 29407d8d7..c689253b4 100644 --- a/linux/drivers/media/video/em28xx/em28xx-cards.c +++ b/linux/drivers/media/video/em28xx/em28xx-cards.c @@ -58,22 +58,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", @@ -338,8 +324,15 @@ 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 }, diff --git a/linux/drivers/media/video/em28xx/em28xx-video.c b/linux/drivers/media/video/em28xx/em28xx-video.c index d3bb65306..b646f74e3 100644 --- a/linux/drivers/media/video/em28xx/em28xx-video.c +++ b/linux/drivers/media/video/em28xx/em28xx-video.c @@ -1878,15 +1878,11 @@ static int em28xx_usb_probe(struct usb_interface *interface, 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= 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= insmod option:\n", - dev->name); + em28xx_errdev("Your board has no unique USB ID and thus can't be autodetected.\n"); + em28xx_errdev("Please pass card= insmod option to workaround that.\n"); + em28xx_errdev("If there isn't any card number for you, please send an email to:\n"); + em28xx_errdev("\tV4L Mailing List \n"); + em28xx_errdev("Here is a list of valid choices for the card= insmod option:\n"); for (i = 0; i < em28xx_bcount; i++) { em28xx_errdev(" card=%d -> %s\n", i, em28xx_boards[i].name); -- cgit v1.2.3 From 214fa1dbeaff3457ef8a7018af320e711cb25a86 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 3 Nov 2007 22:20:59 -0200 Subject: Add a hint for boards without unique USB ID From: Mauro Carvalho Chehab This patch adds a function to allow trying to detect boards that shares the generic IDs. The current detection method is based at eeprom checksum. Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/em28xx/em28xx-cards.c | 198 +++++++++++++++++++----- linux/drivers/media/video/em28xx/em28xx-i2c.c | 74 ++++----- linux/drivers/media/video/em28xx/em28xx-video.c | 120 +++++--------- linux/drivers/media/video/em28xx/em28xx.h | 2 + 4 files changed, 229 insertions(+), 165 deletions(-) (limited to 'linux') diff --git a/linux/drivers/media/video/em28xx/em28xx-cards.c b/linux/drivers/media/video/em28xx/em28xx-cards.c index c689253b4..96eabac5b 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", @@ -343,70 +353,178 @@ 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 [] = { + { 0, 0, 0 }, +}; +/* 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; + + 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); + + if (dev->tuner_type == TUNER_XC2028) { + memset (&ctl, 0, sizeof(ctl)); + + ctl.fname = XC2028_DEFAULT_FIRMWARE; + ctl.max_len = 64; + + xc2028_cfg.tuner = TUNER_XC2028; + xc2028_cfg.priv = &ctl; - memset (&ctl,0,sizeof(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; - ctl.fname = XC2028_DEFAULT_FIRMWARE; - ctl.max_len = 64; + 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; - xc2028_cfg.tuner = TUNER_XC2028; - xc2028_cfg.priv = &ctl; + 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 " + " \n"); + em28xx_errdev("Board detected as %s\n", + em28xx_boards[dev->model].name); - em28xx_i2c_call_clients(dev, TUNER_SET_CONFIG, &xc2028_cfg); + 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= insmod option to " + "workaround that.\n"); + em28xx_errdev("Please send an email with this log to:\n"); + em28xx_errdev("\tV4L Mailing List \n"); + em28xx_errdev("Board eeprom hash is 0x%08lx\n", dev->hash); + + em28xx_errdev("Here is a list of valid choices for the card=" + " 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 833c439bc..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 @@ -498,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 b646f74e3..cadb926d6 100644 --- a/linux/drivers/media/video/em28xx/em28xx-video.c +++ b/linux/drivers/media/video/em28xx/em28xx-video.c @@ -39,7 +39,6 @@ #endif #include "em28xx.h" -#include #include #include #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]"); @@ -190,7 +185,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 +192,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); } /* @@ -1585,7 +1572,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 +1580,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 +1588,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 +1600,17 @@ 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<devno); + em28xx_devused &= ~(1<devno); kfree(dev); return -ENOMEM; } mutex_lock(&dev->lock); + /* register i2c bus */ em28xx_i2c_register(dev); @@ -1680,12 +1622,33 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, 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) { @@ -1791,7 +1754,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 +1794,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<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,26 +1837,14 @@ static int em28xx_usb_probe(struct usb_interface *interface, } if ((card[nr]>=0)&&(card[nr] insmod option to workaround that.\n"); - em28xx_errdev("If there isn't any card number for you, please send an email to:\n"); - em28xx_errdev("\tV4L Mailing List \n"); - em28xx_errdev("Here is a list of valid choices for the card= insmod option:\n"); - 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); diff --git a/linux/drivers/media/video/em28xx/em28xx.h b/linux/drivers/media/video/em28xx/em28xx.h index 8b4c54f9f..13afe0ab9 100644 --- a/linux/drivers/media/video/em28xx/em28xx.h +++ b/linux/drivers/media/video/em28xx/em28xx.h @@ -260,6 +260,8 @@ 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; -- cgit v1.2.3 From 3ed99c75c6b16c3365499e240d87a21123f37208 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 3 Nov 2007 22:21:57 -0200 Subject: Add entry for Pixelview Prolink PlayTV USB 2.0 From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- linux/Documentation/video4linux/CARDLIST.em28xx | 1 + linux/drivers/media/video/em28xx/em28xx-cards.c | 23 ++++++++++++++++++++++- linux/drivers/media/video/em28xx/em28xx.h | 1 + 3 files changed, 24 insertions(+), 1 deletion(-) (limited to 'linux') diff --git a/linux/Documentation/video4linux/CARDLIST.em28xx b/linux/Documentation/video4linux/CARDLIST.em28xx index f947dca5a..b3a818134 100644 --- a/linux/Documentation/video4linux/CARDLIST.em28xx +++ b/linux/Documentation/video4linux/CARDLIST.em28xx @@ -12,3 +12,4 @@ 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) diff --git a/linux/drivers/media/video/em28xx/em28xx-cards.c b/linux/drivers/media/video/em28xx/em28xx-cards.c index 96eabac5b..8069dc880 100644 --- a/linux/drivers/media/video/em28xx/em28xx-cards.c +++ b/linux/drivers/media/video/em28xx/em28xx-cards.c @@ -329,6 +329,26 @@ struct em28xx_board em28xx_boards[] = { .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); @@ -356,7 +376,8 @@ struct usb_device_id em28xx_id_table [] = { MODULE_DEVICE_TABLE (usb, em28xx_id_table); static struct em28xx_hash_table em28xx_hash [] = { - { 0, 0, 0 }, + /* 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, diff --git a/linux/drivers/media/video/em28xx/em28xx.h b/linux/drivers/media/video/em28xx/em28xx.h index 13afe0ab9..4cf310f57 100644 --- a/linux/drivers/media/video/em28xx/em28xx.h +++ b/linux/drivers/media/video/em28xx/em28xx.h @@ -49,6 +49,7 @@ #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 UNSET -1 -- cgit v1.2.3 From a66f6aab3859293e78effa93f7824c3aa0c75e33 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 3 Nov 2007 22:22:38 -0200 Subject: em28xx: fix locking to allow accesses from 2 different threads at the same time From: Sascha Sommer The attached patch modifies the em28xx driver so that there can be ioctls from multiple different threads. This is necessary for capture apps like MPlayer that use different threads for capturing and channel tuning. Now the locking is only done for the ioctls that change properties of the device or access the i2c bus. It also removes some locks that look unnecessary: In em28xx_init_dev: the videodevice is not registered yet so nothing can access the hardware meanwhile, the device struct is not assigned to the interface yet so no race with disconnect is possible In em28xx_release_resources: it gets only called when dev->lock is already held Signed-off-by: Sascha Sommer Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/em28xx/em28xx-video.c | 151 +++++++++++++----------- linux/drivers/media/video/em28xx/em28xx.h | 2 +- 2 files changed, 80 insertions(+), 73 deletions(-) (limited to 'linux') diff --git a/linux/drivers/media/video/em28xx/em28xx-video.c b/linux/drivers/media/video/em28xx/em28xx-video.c index cadb926d6..7ebd69aa0 100644 --- a/linux/drivers/media/video/em28xx/em28xx-video.c +++ b/linux/drivers/media/video/em28xx/em28xx-video.c @@ -144,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 ******************************************/ @@ -272,22 +270,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); @@ -325,7 +319,6 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp) err: mutex_unlock(&dev->lock); - up_read(&em28xx_disconnect); return errCode; } @@ -336,7 +329,6 @@ err: */ static void em28xx_release_resources(struct em28xx *dev) { - mutex_lock(&em28xx_sysfs_lock); /*FIXME: I2C IR should be disconnected */ @@ -348,7 +340,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); @@ -412,6 +403,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"); } @@ -419,47 +412,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; @@ -468,13 +460,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 @@ -482,11 +474,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; } } @@ -505,12 +497,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; } @@ -524,8 +516,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"); @@ -550,13 +541,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; } @@ -596,25 +587,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; } @@ -624,7 +614,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; } @@ -636,7 +626,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; @@ -648,7 +638,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; } @@ -1135,7 +1125,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 @@ -1149,7 +1141,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; } @@ -1157,21 +1151,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 ------------------------------------------ */ @@ -1279,12 +1278,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; } @@ -1353,11 +1356,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: @@ -1408,10 +1423,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); @@ -1426,6 +1444,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: @@ -1527,26 +1546,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; } @@ -1609,8 +1621,6 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, return -ENOMEM; } - mutex_lock(&dev->lock); - /* register i2c bus */ em28xx_i2c_register(dev); @@ -1620,8 +1630,6 @@ 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; @@ -1695,8 +1703,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", @@ -1723,18 +1741,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); @@ -1858,18 +1864,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) { @@ -1888,6 +1895,7 @@ static void em28xx_usb_disconnect(struct usb_interface *interface) em28xx_release_resources(dev); } + mutex_unlock(&dev->lock); if (!dev->users) { @@ -1895,7 +1903,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 4cf310f57..4b4eaa43c 100644 --- a/linux/drivers/media/video/em28xx/em28xx.h +++ b/linux/drivers/media/video/em28xx/em28xx.h @@ -269,7 +269,7 @@ struct em28xx { 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 -- cgit v1.2.3 From 62af2ba09181e8b6c7db6fc777770860ae7674b5 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 3 Nov 2007 19:05:07 +0100 Subject: em28xx: add support for vgear pockettv From: Sascha Sommer attached patch adds support for the vgear pockettv. It seems to require a write to another register for audio to work. I checked my old cinergydrv and we did the same register write there. I therefore enabled it for all em2800 based devices. Signed-off-by: Sascha Sommer Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/em28xx/em28xx-cards.c | 23 +++++++++++++++++++++++ linux/drivers/media/video/em28xx/em28xx.h | 12 ++++++++++++ 2 files changed, 35 insertions(+) (limited to 'linux') diff --git a/linux/drivers/media/video/em28xx/em28xx-cards.c b/linux/drivers/media/video/em28xx/em28xx-cards.c index 8069dc880..510896dbe 100644 --- a/linux/drivers/media/video/em28xx/em28xx-cards.c +++ b/linux/drivers/media/video/em28xx/em28xx-cards.c @@ -329,6 +329,29 @@ 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, diff --git a/linux/drivers/media/video/em28xx/em28xx.h b/linux/drivers/media/video/em28xx/em28xx.h index 4b4eaa43c..e23760122 100644 --- a/linux/drivers/media/video/em28xx/em28xx.h +++ b/linux/drivers/media/video/em28xx/em28xx.h @@ -50,6 +50,7 @@ #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 @@ -342,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 /* */ @@ -397,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 @@ -418,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); } -- cgit v1.2.3 From 539862473c667948283ee5e7e5237ac7191010c6 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 3 Nov 2007 20:48:01 +0100 Subject: em28xx: fix failing autodetection after the reboot From: Sascha Sommer the attached patch is required so that the autodetecion code also works after a reboot. Setting the I2C speed does not seem to be supported for em2800. Signed-off-by: Sascha Sommer Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/em28xx/em28xx-video.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'linux') diff --git a/linux/drivers/media/video/em28xx/em28xx-video.c b/linux/drivers/media/video/em28xx/em28xx-video.c index 7ebd69aa0..05a931aeb 100644 --- a/linux/drivers/media/video/em28xx/em28xx-video.c +++ b/linux/drivers/media/video/em28xx/em28xx-video.c @@ -155,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 */ -- cgit v1.2.3 From dfa9956230aa171f44a61b5939236737f555f4ac Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 3 Nov 2007 23:04:33 -0200 Subject: Add V-Gear PocketTV to Cardlist.em28xx From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- linux/Documentation/video4linux/CARDLIST.em28xx | 1 + 1 file changed, 1 insertion(+) (limited to 'linux') diff --git a/linux/Documentation/video4linux/CARDLIST.em28xx b/linux/Documentation/video4linux/CARDLIST.em28xx index b3a818134..f809834af 100644 --- a/linux/Documentation/video4linux/CARDLIST.em28xx +++ b/linux/Documentation/video4linux/CARDLIST.em28xx @@ -13,3 +13,4 @@ 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) -- cgit v1.2.3 From db212a276b0513120a21ef0d6a64a3a753a3a215 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 3 Nov 2007 23:40:24 -0200 Subject: Fix S-video mode on tvp5150 From: Mauro Carvalho Chehab Thanks to Markus Reichberger to point this. Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/tvp5150.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'linux') diff --git a/linux/drivers/media/video/tvp5150.c b/linux/drivers/media/video/tvp5150.c index 6be434987..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 { -- cgit v1.2.3