summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/em28xx/em28xx-video.c
AgeCommit message (Collapse)Author
2009-03-04em28xx: enable Compro VideoMate ForYou soundMauro Carvalho Chehab
From: Vitaly Wool <vital@embeddedalley.com> Compro VideoMate uses an external audio DSP chip, controlled via tvaudio module (tda9874a). This patch improves em28xx infrastructure to support an external audio processor and fixes the Compro VideoMate entry to work with it. Signed-off-by: Vitaly Wool <vital@embeddedalley.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-02-11em28xx: Coding style fixes and a typo correctionDouglas Schilling Landgraf
From: Nicola Soranzo <nsoranzo@tiscali.it> Lots of coding style fixes and a typo correction for em28xx. Priority: normal Signed-off-by: Nicola Soranzo <nsoranzo@tiscali.it> [dougsland@redhat.com: fixed a reject due to a change on em28xx-audio.c] Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
2009-01-20em28xx: use usb_make_path to report bus infoThierry MERLE
From: Thierry MERLE <thierry.merle@free.fr> usb_make_path reports canonical bus info. Use it when reporting bus info in VIDIOC_QUERYCAP. Priority: normal Signed-off-by: Thierry MERLE <thierry.merle@free.fr>
2009-01-21em28xx: fix VIDIOC_G_CTRL when there is no msp34xx device.Hans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> Priority: normal Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2009-01-18em28xx: Fix for KWorld 330U BoardMauro Carvalho Chehab
From: Robert Krakora <rob.krakora@messagenetsystems.com> Fix for KWorld 330U Board Many thanks to Devin and Mauro!!! Priority: normal Signed-off-by: Robert Krakora <rob.krakora@messagenetsystems.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-07em28xx: fix input selectionMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> em28xx were trying to access the third input entry, even for boards that don't support it. This patch reviews the input mux selection fixing this bug and a few other troubles, like not validating the input on one userspace ioctl. Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30v4l2: debugging API changed to match against driver name instead of ID.Hans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> Since the i2c driver ID will be removed in the near future we have to modify the v4l2 debugging API to use the driver name instead of driver ID. Note that this API is not used in applications other than v4l2-dbg.cpp as it is for debugging and testing only. Should anyone use the old VIDIOC_G_CHIP_IDENT, then this will be logged with a warning that it is deprecated and will be removed in 2.6.30. Priority: normal Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2008-12-30v4l2: introduce v4l2_file_operations.Hans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> 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. Priority: normal Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2008-12-29em28xx: expand output formats availableDevin Heitmueller
From: Devin Heitmueller <dheitmueller@linuxtv.org> Add additional output formats, which will be useful for the Pinnacle PCTV Ultimate 880e integration with the saa7136. Thanks to Ray Lu from Empia for providing the em2860/em2880 datasheet. Priority: normal Signed-off-by: Devin Heitmueller <dheitmueller@linuxtv.org>
2008-12-28em28xx: simplify analog logicMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> Now, just two routines are enough for analog: the first one configs the analog part and register V4L2 devices, and the second one release analog devices. After this patch, it will be easier to transform em28xx-video into an em28xx extension, loaded only on analog devices. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-28em28xx: move usb probe code to a proper placeMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> 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. Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-22em28xx: Allow get/set registers for debug on i2c slave chipsMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-22em28xx: Add suport for debugging AC97 anciliary chipsMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> 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-22em28xx: de-obfuscate vidioc_g_ctrl logicMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> vidioc_g_ctrl() were using an uneeded confusing logic. Instead, use the direct approach. Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-22em28xx: Fix bad locks on error conditionMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-20em28xx: use a more standard way to specify video formatsMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> This patch uses the same code for enumberating video formats that are present on cx88, bttv and saa7134 drivers. Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-20em28xx: Fix a bug that were putting xc2028/3028 tuner to sleepMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> The changeset 78aa52a159cf introduced a bug on em28xx: buffer setup should be awaking xc3028. Instead, since we didn't specify the tuner mode, the device were going to sleep, due to the lack of tuner mode when asking tuner to handle VIDIOC_S_FREQUENCY: xc2028 0-0061: Device is Xceive 3028 version 1.0, firmware version 2.7 xc2028 0-0061: divisor= 00 00 14 d0 (freq=83.250) xc2028 0-0061: Putting xc2028/3028 into poweroff mode. xc2028 0-0061: Printing sleep stack trace: Pid: 10936, comm: mplayer Tainted: P M 2.6.27.8 #1 Call Trace: [<ffffffffa0b759ea>] xc2028_sleep+0x89/0x1ab [tuner_xc2028] [<ffffffffa0b48fb9>] tuner_s_frequency+0xf5/0x165 [tuner] Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-18merge: http://www.linuxtv.org/hg/~dheitmueller/v4l-dvbMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-16em28xx: fix NULL pointer dereference in call to VIDIOC_INT_RESET commandDevin Heitmueller
From: Devin Heitmueller <dheitmueller@linuxtv.org> Fix a NULL pointer dereference that would occur if the video decoder tied to the em28xx supports the VIDIOC_INT_RESET call (for example: the cx25840 driver) Priority: high Signed-off-by: Devin Heitmueller <dheitmueller@linuxtv.org>
2008-12-16em28xx: fix/improve em28xx locking schemaMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> Changes/fixes on em28xx dev->lock: - em28xx_init_dev() were unlocking without a previous lock; - some read ioctls need to lock after the removal of KBL, since a write may be happening at the same time an ioctl is reading; - keep the device locked during all device initialization; - lock/unlock while reading/writing registers. Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-16em28xx: vidioc_try_fmt_vid_cap() doesn't need any lockMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> vidioc_try_fmt_vid_cap() just checks if a given resolution is supported. It doesn't touch on struct em28xx device descriptor. so, there's no need to lock. While there, use unlikely() for those values that aren't likely to occur. Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-16em28xx: move res_get locks to the caller routinesMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-16em28xx: move dev->lock from res_free to the caller routinesMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-05em28xx: turn off tuner when not usedMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> em28xx devices generally get hot when xc3028 tuner is powered on. This patch solves this by turning power off when the device is not used, at the expense of having a higher load time, when calling a TV application. Since firmware load happens on 1 or 2 seconds on most devices, this is not a pain. Also, it helps to save the planet by saving some power :) Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-11-29em28xx: improve board description messagesMauro Carvalho Chehab
Print manufacturer/product info from USB device and also card entry. From: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-11-27em28xx: improve probe messagesMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> Prints usb speed used by em28xx interface. While there, fixes USB ID's endiannes. Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-11-27em28xx: Add support for suspend the device when not usedMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> 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. Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-11-26em28xx: replace some magic by register descriptions where knownMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> 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 $_; } } Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-11-25em28xx: improve debug messagesMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> Now, the first message states board names. Also, removed printing the alternate settings by default. I2C messages are now clearer. Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-11-25Remove duplicated fields on em28xx_board and em28xx structsMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> 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. Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-11-24em28xx: fix compile warningHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> Label fail_unreg is no longer used. Priority: normal Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2008-11-22em28xx: improve message probing logsMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> On some em28xx devices, there's an unused interface. This is printed on the logs as an error. We can just ignore that interface. Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-11-20Allow opening more than one output at the same timeMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> Some devices use more than one AC97 outputs. This patch allows such devices to properly work. Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-11-20em28xx: allow specifying audio outputMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> 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. Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-11-20em28xx: fix a race condition with haldMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> Newer versions of hald tries to open it to call QUERYCAP. Due to the lack of a proper locking, it is possible to open the device before it finishes initialization. This patch adds a lock to avoid this risk, and to protect the list of em28xx devices. While here, remove the uneeded BKL lock. Priority: high Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-11-19em28xx: Improve audio handlingMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> 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. Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-11-19Make use of the em28xx chip configuration register to determine whetherMauro Carvalho Chehab
From: Devin Heitmueller <devin.heitmueller@gmail.com> we have AC97 audio, I2S audio, or no audio support at all. Thanks for Ray Lu from Empia for providing the em2860/em2880 datasheet. Signed-off-by: Devin Heitmueller <devin.heitmueller@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-11-19Avoid having two concurrent control URB'sMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> 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. Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-11-18em28xx: Avoid memory leaks if registration failsMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> em28xx_init_dev() has some error conditions that are not properly de-allocating dev var, nor freeing the device number for a future usage. Priority: high Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-11-12em28xx: Properly implement poll support for IR'sMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@redhat.com> The first em28xx were based on i2c IR's. However, some newer designs are coming with a polling-based IR. Those are done by reading a register set at em28xx. This patch adds core polling support for those devices. Later patches will add support for some device-specific IR's. This patch adds the same basic IR polling code used by bttv, cx88 and saa7134, and shares the common getkey masks defined at ir-common. Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-11-12Don't load em28xx audio module for digital-only devicesMauro Carvalho Chehab
From: Devin Heitmueller <devin.heitmueller@gmail.com> Don't load em28xx audio module for digital-only devices Rework the logic so that the em28xx-alsa module does not get loaded for devices that don't support analog audio (such as the em2874) Signed-off-by: Devin Heitmueller <devin.heitmueller@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-11-12Handle changes to endpoint layout in em2874Mauro Carvalho Chehab
From: Devin Heitmueller <devin.heitmueller@gmail.com> Handle changes to endpoint layout in em2874 Empia moved around their endpoint configuration in newer chips, so accommodate the changes 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-12Fix possible null pointer dereference in info messageMauro Carvalho Chehab
From: Devin Heitmueller <devin.heitmueller@gmail.com> Fix possible null pointer dereference in info message Fix case where we could end up dereferencing a NULL pointer if dev->vdev or dev->vbi_dev were not set properly. Signed-off-by: Devin Heitmueller <devin.heitmueller@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-30V4L: struct device - replace bus_id with dev_name(), dev_set_name()Mauro Carvalho Chehab
From: Kay Sievers <kay.sievers@vrfy.org> This patch is part of a larger patch series which will remove the "char bus_id[20]" name string from struct device. The device name is managed in the kobject anyway, and without any size limitation, and just needlessly copied into "struct device". To set and read the device name dev_name(dev) and dev_set_name(dev) must be used. If your code uses static kobjects, which it shouldn't do, "const char *init_name" can be used to statically provide the name the registered device should have. At registration time, the init_name field is cleared, to enforce the use of dev_name(dev) to access the device name at a later time. We need to get rid of all occurrences of bus_id in the entire tree to be able to enable the new interface. Please apply this patch, and possibly convert any remaining remaining occurrences of bus_id. We want to submit a patch to -next, which will remove bus_id from "struct device", to find the remaining pieces to convert, and finally switch over to the new api, which will remove the 20 bytes array and does no longer have a size limitation. Thanks, Kay Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-Off-By: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-19v4l: use video_device.num instead of minor in video%dHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> The kernel number of a v4l2 node (e.g. videoX, radioX or vbiX) is now independent of the minor number. So instead of using the minor field of the video_device struct one has to use the num field: this always contains the kernel number of the device node. I forgot about this when I did the v4l2 core change, so this patch converts all drivers that use it in one go. Luckily the change is trivial. Priority: high Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> CC: michael@mihu.de CC: mchehab@infradead.org CC: corbet@lwn.net CC: luca.risolia@studio.unibo.it CC: isely@pobox.com CC: pe1rxq@amsat.org CC: royale@zerezo.com CC: mkrufky@linuxtv.org CC: stoth@linuxtv.org
2008-10-04v4l: disconnect kernel number from minorHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> The v4l core creates four different video devices (video, vbi, radio, vtx) and each has its own range of minor numbers. However, modern devices keep increasing the number of devices that they need so a maximum of 64 video devices will not be enough in the future. In addition this scheme makes it very hard to add new device types. This patch disconnects the kernel number allocation (e.g. video0, video1, etc.) from the actual minor number (just pick the first free minor). This allows for much more flexibility in the future. However, it does require the use of udev. For those who cannot use udev a new CONFIG option was created that changes the allocation scheme back to the old behavior. Thanks to Greg KH for suggesting this approach during the 2008 LPC. In addition, several bugs were fixed in the ivtv and cx18 drivers: these drivers try to allocate specific kernel numbers but that scheme contained a bug which caused what should have been e.g. video17 to appear as e.g. video2. Priority: normal Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2008-09-08em28xx: Fix and add some validationsDouglas Schilling Landgraf
From: Douglas Schilling Landgraf <dougsland@linuxtv.org> Fixed and Added some validations Priority: high Signed-off-by: Douglas Schilling Landgraf <dougsland@linuxtv.org>
2008-07-30v4l: move BKL down to the driver level.Hans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> The BKL is now moved from the video_open function in v4l2-dev.c to the various drivers. It seems about a third of the drivers already has a lock of some sort protecting the open(), another third uses video_exclusive_open (yuck!) and the last third required adding the BKL in their open function. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2008-07-26v4l2-dev: remove unused type and type2 field from video_deviceHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> The type and type2 fields were unused and so could be removed. Instead add a vfl_type field that contains the type of the video device. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2008-07-21videodev: move all ioctl callbacks to a new v4l2_ioctl_ops structHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> All ioctl callbacks are now stored in a new v4l2_ioctl_ops struct. Drivers fill in a const struct v4l2_ioctl_ops and video_device just contains a const pointer to it. This ensures a clean separation between the const ops struct and the non-const video_device struct. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>