aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/em28xx/em28xx-core.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2009-01-02V4L/DVB (10135): v4l2: introduce v4l2_file_operations.Hans Verkuil1-2/+1
Introduce a struct v4l2_file_operations for v4l2 drivers. Remove the unnecessary inode argument. Move compat32 handling (and llseek) into the v4l2-dev core: this is now handled in the v4l2 core and no longer in the drivers themselves. Note that this changeset reverts an earlier patch that changed the return type of__video_ioctl2 from int to long. This change will be reinstated later in a much improved version. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30V4L/DVB (10125): em28xx: Don't do AC97 vendor detection for i2s audio devicesDevin Heitmueller1-1/+2
The current code was trying to query the AC97 registers for the vendor information even if it was clearly not a AC97 audio device (resulting in errors in the dmesg output). This was due to a bug in the way we did the check. Signed-off-by: Devin Heitmueller <dheitmueller@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30V4L/DVB (10122): em28xx: don't load em28xx-alsa for em2870 based devicesDevin Heitmueller1-1/+1
Like the em2874, the em2870 does not have any analog support, so don't bother loading the em28xx-alsa module. Signed-off-by: Devin Heitmueller <dheitmueller@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30V4L/DVB (9979): em28xx: move usb probe code to a proper placeMauro Carvalho Chehab1-0/+143
em28xx-video were holding several code that are not specific to V4L2 interface. This patch moves the core code for em28xx-core, and usb probing code into em28xx-cards. This opens the possibility of breaking em28xx into a core module and a V4L2 module, loaded only on devices that have analog interfaces. Some cleanup may be done at em28xx-cards to optimize the config code. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30V4L/DVB (9953): em28xx: Add suport for debugging AC97 anciliary chipsMauro Carvalho Chehab1-2/+2
The em28xx driver can be coupled to an anciliary AC97 chip. This patch allows read/write AC97 registers directly. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30V4L/DVB (9927): em28xx: use a more standard way to specify video formatsMauro Carvalho Chehab1-4/+13
This patch uses the same code for enumberating video formats that are present on cx88, bttv and saa7134 drivers. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30V4L/DVB (9756): em28xx: Improve register log formatMauro Carvalho Chehab1-28/+32
Change log format to look more like URB transactions. In fact, setup and IN/OUT transactions are merged. This helps to debug the driver. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-29V4L/DVB (9764): em28xx: Add support for suspend the device when not usedMauro Carvalho Chehab1-8/+13
Several chips may be turned off when the device is not used, like audio, video and dvb demods. This patch adds a gpio callback at the core structs to allow turning off such devices. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-29V4L/DVB (9763): em28xx: fix gpio settingsMauro Carvalho Chehab1-2/+2
A previous changeset moved gpio from em28xx struct into em28xx_board. However, the driver were not updated to properly honor those gpio's. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-29V4L/DVB (9758): em28xx: replace some magic by register descriptions where knownMauro Carvalho Chehab1-24/+24
Replaces all occurrences of em28xx_write_regs_req() and em28xx_write_reg() used to setup register names by em28xx_write_reg(). Also, documents the register names that are known. This patch were generated by this small perl script: my %reg_map = ( # Register table - the same as defined on parse_em28xx.pl script ); while (<>) { if (m/(.*)em28xx_write_regs_req\(dev\,\s*0x00\,\s*(.*)\,\s*\"\\x(..)\",\s*1\)\;(.*)/) { my $reg = $2; my $val = $3; $val =~ tr/A-f/a-f/; $reg = $reg_map{$reg} if defined($reg_map{$reg}); printf "$1em28xx_write_reg(dev, %s, 0x%s);$4\n", $reg, $val; } elsif (m/(.*)em28xx_write_regs\(dev\,\s*(.*)\,\s*\"\\x(..)\",\s*1\)\;(.*)/) { my $reg = $2; my $val = $3; $val =~ tr/A-f/a-f/; $reg = $reg_map{$reg} if defined($reg_map{$reg}); printf "$1em28xx_write_reg(dev, %s, 0x%s);$4\n", $reg, $val; } else { print $_; } } Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-29V4L/DVB (9752): Remove duplicated fields on em28xx_board and em28xx structsMauro Carvalho Chehab1-4/+4
Several fields are duplicated on both structs. Let's just copy em28xx_board instead. A later cleanup could just copy the fields that are changed, in order to keep em28xx_board const. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-29V4L/DVB (9747): em28xx: Properly handles XCLK and I2C speedMauro Carvalho Chehab1-5/+3
The previous patches removed XCLK and I2C magic. Now, we finally know what those registers do. Also, only a very few cards need different setups for those. Instead of keeping the setups for those values inside the per-device hack magic switch, move the uncommon values to the board-specific struct, and have a common setup for all other boards. So, almost 100 lines of hacking magic were removed. A co-lateral effect of this patch is that it also fixes a bug at em28xx-core, where xclk were set, without taking any care about not overriding a previous xclk setup. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-29V4L/DVB (9672): Allow opening more than one output at the same timeMauro Carvalho Chehab1-13/+20
Some devices use more than one AC97 outputs. This patch allows such devices to properly work. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-29V4L/DVB (9671): em28xx: Add detection of Sigmatel Stac97xx series of AC97 devicesMauro Carvalho Chehab1-0/+6
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-29V4L/DVB (9670): em28xx: allow specifying audio outputMauro Carvalho Chehab1-7/+17
Some boards use different AC97 setups for output. This patch adds the capability of specifying the output to be used. Currently, only one output is selected, but the better is to allow user to select it via a mixer, on alsa driver. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-29V4L/DVB (9669): em28xx: Fix a stupid cut-and-paste errorMauro Carvalho Chehab1-1/+1
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-29V4L/DVB (9657): em28xx: add a functio to write on a single registerDevin Heitmueller1-0/+6
Introduce a new function that writes to a single register. This is useful because the vast majority of register writes are a single register, and this format permits or'ing register value bits together. Signed-off-by: Devin Heitmueller <devin.heitmueller@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-29V4L/DVB (9653): em28xx: improve AC97 handlingMauro Carvalho Chehab1-30/+43
AC97 devices provide several input and outputs. However, before this patch, em28xx device weren't properly allowing the usage of ac97 possible combinations. Also, several input volumes were left untouched, instead of making sure that the volumes were set on mute state. This patch improves support for ac97 devices by allowing to use any inputs, and making sure that unused inputs are set on mute state. Yet, some work is still needed to select the AC97 output. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-29V4L/DVB (9652): em28xx: merge AC97 vendor id's into a single varMauro Carvalho Chehab1-4/+7
This makes easier to identify vendor ID, since AC97 vendors are generally identified by 3 bytes. The remaining byte is used by the vendor to identify its devices. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-29V4L/DVB (9651): em28xx: Improve audio handlingMauro Carvalho Chehab1-48/+205
This patch properly implements audio handling on em28xx. Before this patch, it was assumed that every device has an Empia 202 audio chip. However, this is not true. After this patch, specific AC97 chipset setup and configurations can be done. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-29V4L/DVB (9643): em28xx: remove the previous register namesMauro Carvalho Chehab1-4/+4
Previously, AC97 registers were named as if they were part of em28xx device, generating some confusion. Replace such names for a more general naming convention. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-29V4L/DVB (9589): Properly support capture start on em2874Devin Heitmueller1-0/+18
Properly support capture start on em2874 The transport stream enable register moved in the em2874, so make it work properly. Thanks for Ray Lu from Empia for providing the em2874 datasheet. Signed-off-by: Devin Heitmueller <devin.heitmueller@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-29V4L/DVB (9584): Support different GPIO/GPO registers for newer devicesDevin Heitmueller1-4/+4
Empia moved the location of the GPIO/GPO registers in newer devices. Add the ability to specify the relocated registers (including caching of register contents). Thanks for Ray Lu from Empia for providing the em2874 datasheet. Signed-off-by: Devin Heitmueller <devin.heitmueller@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-11-20V4L/DVB (9647): em28xx: void having two concurrent control URB'sMauro Carvalho Chehab1-2/+10
Now that we have a polling task for IR, there's a race condition, since IR can be polling while other operations are being doing. Also, we are now sharing the same urb_buf for both read and write control urb operations. So, we need a mutex. Thanks to Davin Heitmueller <devin.heitmueller@gmail.com> for warning me. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-11-20V4L/DVB (9646): em28xx: avoid allocating/dealocating memory on every control urbMauro Carvalho Chehab1-22/+26
Before this patch, every register setup on em28xx were dynamically allocating a temporary buffer for control URB's to be handled. To avoid this ping-pong, use, instead a pre-allocated buffer. Also, be sure that read control URB's also use the buffer, instead of relying on a stack buffer. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-11-16V4L/DVB (9632): make em28xx aux audio input workDevin Heitmueller1-0/+2
The attached patch makes the em28xx auxillary audio input work. Tested with the HVR-950. em28xx: make auxillary audio input work The tuner audio input was working but the aux input wasn't. Tested with the HVR-950. Signed-off-by: Devin Heitmueller <devin.heitmueller@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-04-26V4L/DVB (7734): em28xx: copy and paste error in em28xx_init_isocJanne Grunau1-1/+1
Fixes a copy and paste error in check of kzalloc return value. The check block was copied from the previous allocation but the variable wasn't exchanged. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24V4L/DVB (7652): em28xx: Drop the severity level of the "urb resubmit failed"Devin Heitmueller1-2/+2
em28xx-core.c - Drop the severity level of the "urb resubmit failed" to debug, since it occurs every time a stream disconnects, which fills the dmesg log Signed-off-by: Devin Heitmueller <devin.heitmueller@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24V4L/DVB (7615): em28xx: Provide the proper support for switching between analog/digitalMauro Carvalho Chehab1-7/+83
Before this patch, HVR900/HVR950 were incorreclty going back to analog. The result is that only digital were working. This patch provides the proper setup for analog/digital and tuner callback. It also properly resets analog into a sane state at open(). Thanks to Steven Toth <stoth@linuxtv.org> and Michael Krufky <mkrufky@linuxtv.org> for helping to set the proper parameters to GPO/GPIO em2883 ports. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24V4L/DVB (7614): em28xx-core: fix some debug printk's that wrongly received KERN_INFOMauro Carvalho Chehab1-4/+4
Those printk's were adding more info to a line that were already being printed. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24V4L/DVB (7613): em28xx: rename registersMauro Carvalho Chehab1-43/+43
Now, all registers will follow the same convension: EM28XX_R<reg_number>_<reg_name> This allows to associate a register with its value, and also with a canonical name. Also, registers that are specific to a given chip were renamed accordingly, as EM2800_foo (for 2800 only registers) or EM2880_foo (for registers that started to appear on em2880). Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24V4L/DVB (7610): em28xx: Select reg wait time based on chip IDMauro Carvalho Chehab1-0/+3
This is more conservative than just removing the msleep() from em28xx_write_regs_req(), since some old hardware may still need it. So, it will remove the sleep time only for those chips where this removal were tested. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24V4L/DVB (7609): em28xx-core: speed-up firmware loadDevin Heitmueller1-1/+0
em28xx-core.c: - Remove sleep in i2c message routine which slows down i2c by a factor 10x. Load time for BASE firmware went from 13s to .973s Signed-off-by: Devin Heitmueller <devin.heitmueller@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24V4L/DVB (7607): CodingStyle fixesDouglas Schilling Landgraf1-24/+39
Signed-off-by: Douglas Schilling Landgraf <dougsland@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24V4L/DVB (7604): em28xx-dvb: Fix analog modeMauro Carvalho Chehab1-7/+2
The analog entries are wrong. Fix it. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24V4L/DVB (7602): em28xx: generalise URB setup codeAidan Thornton1-0/+181
Move the URB setup and management code to em28xx-core.c and generalise it slighlty so that the DVB code can use it. Signed-off-by: Aidan Thornton <makosoft@googlemail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24V4L/DVB (7595): Improve generic support for setting gpio valuesMauro Carvalho Chehab1-5/+27
em28xx based devices with xc3028 may require some specific gpio values. This patch adds a generic handling for such values. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24V4L/DVB (7567): em28xx: Some cleanupsMauro Carvalho Chehab1-2/+2
Removes some fields from data structs. There are some fields that are just caching some calculus for buffer size. The calculus were moved to the places it were needed and the now unused fields were removed. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24V4L/DVB (7540): em28xx: convert to use videobuf-vmallocMauro Carvalho Chehab1-417/+0
The usage of videobuf-vmalloc allows to cleanup em28xx logic. Also, it reduced its size by about 5.42% on i386 arch (and about 7.5% on x86_64): 39113 4876 40 44029 abfd old/em28xx.ko 36731 4868 40 41639 a2a7 /home/v4l/master/v4l/em28xx.ko Also, the preliminary tests, made on a single core 1.5 MHz Centrino showed that CPU usage reduced from 42%-75% to 28%-33% (reports from "top") command. A test with time command presented an even better result: This is the performance tests I did, running code_example to get 1,000 frames @29.995 Hz (about 35 seconds of stream), tested on a i386 machine, running at 1,5GHz: The old driver: $ time -f "%E: %Us User time, %Ss Kernel time, %P CPU used" ./capture_example 0:34.21: 8.22s User time, 25.16s Kernel time, 97% CPU used The videobuf-based driver: $ time -f "%E: %Us User time, %Ss Kernel time, %P CPU used" ./capture_example 0:35.36: 0.01s User time, 0.05s Kernel time, 0% CPU used Conclusion: The time consumption to receive the stream where reduced from about 33.38 seconds to 0.05 seconds. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24V4L/DVB (7522): media/video/em28xx replace remaining __FUNCTION__ occurrencesHarvey Harrison1-3/+3
__FUNCTION__ is gcc-specific, use __func__ Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24V4L/DVB (7331): Fix em2800 altsetting selectionSascha Sommer1-5/+13
Signed-off-by: Sascha Sommer <saschasommer@freenet.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24V4L/DVB (7094): static memoryDouglas Schilling Landgraf1-3/+3
- Static memory is always initialized with 0. - Replaced in some cases C99 comments for /* */ Signed-off-by: Douglas Schilling Landgraf <dougsland@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-03-20V4L/DVB (7291): em28xx: correct use of and fixAndrew Morton1-1/+1
be less silly while we're there. Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-03-20V4L/DVB (7285): em28xx: Correct use of ! and &Julia Lawall1-1/+1
In commit e6bafba5b4765a5a252f1b8d31cbf6d2459da337, a bug was fixed that involved converting !x & y to !(x & y). The code below shows the same pattern, and thus should perhaps be fixed in the same way. This is not tested and clearly changes the semantics, so it is only something to consider. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // <smpl> @@ expression E1,E2; @@ ( !E1 & !E2 | - !E1 & E2 + !(E1 & E2) ) // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-02-18V4L/DVB (7180): em28xx: add URB_NO_TRANSFER_DMA_MAP, since urb->transfer_dma is setMauro Carvalho Chehab1-1/+1
Thanks to Alan Stern <stern@rowland.harvard.edu> for pointing this issue. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-02-18V4L/DVB (7179): Allow more than one em28xx boardMauro Carvalho Chehab1-22/+40
em28xx driver is capable of handling more than one usb device. However, isoc transfers require a large amount of data to be transfered. Before this patch, just one em28xx board were enough to allocate more than 50% URBs: T: Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh= 8 B: Alloc=480/800 us (60%), #Int= 0, #Iso= 2 D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS=64 #Cfgs= 1 So, only one board could use an USB host at the same time. After the patch, it is possible to use more than one em28xx at the same time, on the same usb host, if the image size is slower or equal to 345600, since those images will require about 30% of the URBs: T: Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh= 8 B: Alloc=232/800 us (29%), #Int= 0, #Iso= 2 D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS=64 #Cfgs= 1 So, in thesis, after the patch, it would be possible to use up to 3 boards by each usb host, if the devices are generating small images. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-02-18V4L/DVB (7163): em28xx: makes audio settings more stableMauro Carvalho Chehab1-8/+20
Improves audio configurations on em28xx: - mutes audio before changing amux; - adds a delay after setting audio src; - waits up to 50ms for ac97 busy. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-02-18V4L/DVB (7161): em28xx: Fix printing debug values higher than 127Mauro Carvalho Chehab1-2/+3
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-02-18V4L/DVB (7158): Fix em28xx audio initializationMauro Carvalho Chehab1-8/+3
AC97 register initialization seem to always be needed. This patch fixes audio for Prolink/Pixelview USB2 board. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-02-18V4L/DVB (7156): em28xx/em28xx-core.c: fix use of potentially uninitialized variableAndrew Morton1-1/+2
drivers/media/video/em28xx/em28xx-core.c: In function 'em28xx_set_audio_source': drivers/media/video/em28xx/em28xx-core.c:276: warning: 'no_ac97' may be used uninitialized in this function This looks like a genuine bug to me. Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>