Andy Shevchenko [Fri, 17 Feb 2012 07:57:08 +0000 (04:57 -0300)]
[media] media: tuners: append $(srctree) to -I parameters
Without this we have got the warnings like following if build with "make W=1
O=/var/tmp":
cc1: warning: drivers/media/dvb/dvb-core: No such file or directory [enabled by default]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Andy Shevchenko [Fri, 17 Feb 2012 07:57:07 +0000 (04:57 -0300)]
[media] media: video: append $(srctree) to -I parameters
Without this we have got the warnings like following if build with "make W=1
O=/var/tmp":
CHECK drivers/media/video/videobuf-vmalloc.c
CC [M] drivers/media/video/videobuf-vmalloc.o
+cc1: warning: drivers/media/dvb/dvb-core: No such file or directory [enabled by default]
+cc1: warning: drivers/media/dvb/frontends: No such file or directory [enabled by default]
+cc1: warning: drivers/media/dvb/dvb-core: No such file or directory [enabled by default]
+cc1: warning: drivers/media/dvb/frontends: No such file or directory [enabled by default]
LD drivers/media/built-in.o
Dan Carpenter [Fri, 17 Feb 2012 05:44:10 +0000 (02:44 -0300)]
[media] s2255drv: fix some endian bugs
I don't have this hardware and I don't know the subsystem very well. So
please review this patch carefully. The original code definitely looks
buggy though.
Sparse complains about some endian bugs where little endian bugs are
treated as cpu endian.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Dean Anderson <linux-dev@sensoray.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Dan Carpenter [Fri, 17 Feb 2012 05:43:27 +0000 (02:43 -0300)]
[media] s2255drv: cleanup vidioc_enum_fmt_cap()
"f" wasn't checked consistently, so static checkers complain. This
function is always called with a valid "f" pointer, so I have removed
the check.
Also the indenting was messed up.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Dean Anderson <linux-dev@sensoray.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
James Hogan [Wed, 15 Feb 2012 14:24:21 +0000 (11:24 -0300)]
[media] rc/ir-raw: use kfifo_rec_ptr_1 instead of kfifo
Raw IR events are passed to the raw event thread through a kfifo. The
size of the event struct is 12 bytes, and space for 512 events is
reserved in the kfifo (6144 bytes), however this is rounded down to 4096
bytes (the next power of 2) by __kfifo_alloc().
4096 bytes is not divisible by 12 therefore if the fifo fills up a third
of a record will be written in the end of the kfifo by
ir_raw_event_store() because the recsize of the fifo is 0 (it doesn't
have records). When this is read by ir_raw_event_thread() a corrupted or
partial record will be read, and in the case of a partial record the
BUG_ON(retval != sizeof(ev)) gets hit too.
According to samples/kfifo/record-example.c struct kfifo_rec_ptr_1 can
handle records of a length between 0 and 255 bytes, so change struct
ir_raw_event_ctrl to use that instead of struct kfifo.
Signed-off-by: James Hogan <james.hogan@imgtec.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Javier Martin [Wed, 22 Feb 2012 10:59:34 +0000 (07:59 -0300)]
[media] media: i.MX27 camera: more efficient discard buffer handling
Some elements of 'mx2_buffer' are grouped together in another
auxiliary structure. This way we don't need to have unused
'vb2_buffer' structures for both discard buffers.
Signed-off-by: Javier Martin <javier.martin@vista-silicon.com> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Javier Martin [Tue, 7 Feb 2012 10:14:42 +0000 (07:14 -0300)]
[media] media i.MX27 camera: improve discard buffer handling
The way discard buffer was previously handled lead
to possible races that made a buffer that was not
yet ready to be overwritten by new video data. This
is easily detected at 25fps just adding "#define DEBUG"
to enable the "memset" check and seeing how the image
is corrupted.
A new "discard" queue and two discard buffers have
been added to make them flow trough the pipeline
of queues and thus provide suitable event ordering.
Signed-off-by: Javier Martin <javier.martin@vista-silicon.com> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Javier Martin [Mon, 30 Jan 2012 12:14:11 +0000 (09:14 -0300)]
[media] media i.MX27 camera: add start_stream and stop_stream callbacks
Add "start_stream" and "stop_stream" callback in order to enable
and disable the eMMa-PrP properly and save CPU usage avoiding
IRQs when the device is not streaming. This also makes the driver
return 0 as the sequence number of the first frame.
Signed-off-by: Javier Martin <javier.martin@vista-silicon.com>
[g.liakhovetski@gmx.de: remove the mx27_camera_emma() macro] Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Sascha Hauer [Mon, 20 Feb 2012 10:55:24 +0000 (07:55 -0300)]
[media] V4L: mx2_camera: remove unsupported i.MX27 DMA mode, make EMMA mandatory
The i.MX27 DMA support was introduced with the initial commit of this
driver and originally created by me. However, I never got this stable
due to the racy DMA engine and used the EMMA engine instead. As the DMA
support is most probably unused and broken in its current state, remove
it. EMMA becomes the only supported mode on i.MX27.
This also helps us get rid of another user of the legacy i.MX DMA
support and remove the dependency on ARCH_MX* macros as these are
scheduled for removal.
Xi Wang [Tue, 14 Feb 2012 17:32:41 +0000 (14:32 -0300)]
[media] lgdt330x: fix signedness error in i2c_read_demod_bytes()
The error handling in lgdt3303_read_status() and lgdt330x_read_ucblocks()
doesn't work, because i2c_read_demod_bytes() returns a u8 and (err < 0)
is always false.
Gianluca Gennari [Tue, 14 Feb 2012 12:25:00 +0000 (09:25 -0300)]
[media] as102: map URB DMA addresses in the driver
On a set-top-box based on the Broadcom 7405 SoC (MIPS), the Abilis as102 driver
causes a kernel oops while trying to map the URB stream buffers DMA addresses:
CPU 0 Unable to handle kernel paging request at virtual address 007b9900,
epc == 80010cc4, ra == 8039d108
On other boxes based on older SoCs (7401) this doesn't happen, so it looks like
a bug in the kernel specific to MIPS SMP. This issue has been reproduced on
several kernel versions from 2.6.18 to 3.1.0.
Since the base DMA address and the offsets are known, it is possible to map
the DMA addresses of the URB buffers directly in the driver. This workaround
fixes the problem and has been tested on both MIPS and x86 CPUs with success.
By the way, with this fix the driver works perfectly fine on the set-top-box:
both UHF and VHF frequencies are tuned without problems, and zapping is quite
fast. SNR and signal strength reports seems to work fine, too.
The only remaining problem (on both the PC and the set-top-box) is that after
a soft reboot the device is not recognized again by the kernel. It requires
a power cycle (or a manual unplug/replug) to be recognized again. So probably
the device state is not reset properly at shut-down.
Gianluca Gennari [Mon, 13 Feb 2012 16:59:22 +0000 (13:59 -0300)]
[media] em28xx: pre-allocate DVB isoc transfer buffers
On MIPS/ARM set-top-boxes, as well as old x86 PCs, memory allocation failures
in the em28xx driver are common, due to memory fragmentation over time, that
makes impossible to allocate large chunks of coherent memory.
A typical system with 256/512 MB of RAM fails after just 1 day of uptime (see
the old thread for detailed reports and crashlogs).
In fact, the em28xx driver allocates memory for USB isoc transfers at runtime,
as opposite to the dvb-usb drivers that allocates the USB buffers when the
device is initialized, and frees them when the device is disconnected.
Moreover, in digital mode the USB isoc transfer buffers are freed, allocated
and cleared every time the user selects a new channel, wasting time and
resources.
This patch solves both problems by allocating DVB isoc transfer buffers in
em28xx_usb_probe(), and freeing them in em28xx_usb_disconnect().
In fact, the buffers size and number depend only on the max USB packet size
that is parsed from the USB descriptors in em28xx_usb_probe(), so it can
never change for a given device.
This approach makes no sense in analog mode (as the buffer size depends on
the alternate mode selected at runtime), the patch creates two separate sets
of buffers for digital and analog modes.
For digital-only devices, USB buffers are created when the device is probed
and freed when the device is disconnected.
For analog-only devices, nothing changes: isoc buffers are created at runtime.
For hybrid devices, two sets of buffers are maintained: the digital-mode
buffers are created when the device is probed, and freed when the device is
disconnected; analog-mode buffers are created/destroyed at runtime as before.
So, in analog mode, digital and analog buffers coexists at the same time: this
can be justified by the fact that digital mode is by far more commonly used
nowadays, so it makes sense to optimize the driver for this use case scenario.
The patch has been tested in the last few days on a x86 PC and a MIPS
set-top-box, with the PCTV 290e (digital only) and the Terratec Hybrid XS
(hybrid device). With the latter, I switched several times between analog and
digital mode (Kaffeine/TvTime) with no issue at all.
I unplugged/plugged the devices several times with no problem.
Also, after over 3 days of normal usage in the MPIS set-top-box, the PCTV 290e
was still up and running.
Jean Delvare [Sun, 12 Feb 2012 18:03:03 +0000 (15:03 -0300)]
[media] cx22702: Fix signal strength
The signal strength value returned is not quite correct, it decreases
when I increase the gain of my antenna, and vice versa. It also
doesn't span over the whole 0x0000-0xffff range. Compute a value which
at least increases when signal strength increases, and spans the whole
allowed range.
In practice I get 67% with my antenna fully amplified and 51% with
no amplification. This is close enough to what I get on my other
DVB-T adapter with the same antenna.
Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Steven Toth <stoth@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] gspca - zc3xx: Do automatic transfer control for hv7131r and pas202b
The bridge register 11 reports the current transfer status.
This value is used to know about a possible overflow and to adjust
the transfer parameters (registers 07 and 08).
[media] gspca - zc3xx: Adjust the JPEG decompression tables
As the bridge register 08 defines the JPEG compression quality,
it must be changed on JPEG quality change and also, the decompression
tables must be adjusted when the register varies.
[mchehab@redhat.com: replace a // comment by a /* */ one] Signed-off-by: Jean-François Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] gspca - sonixj: Add exposure, gain and auto exposure for po2030n
The auto gain uses the knee algorithm.
Adding the setexposure control function forced to:
- rename of the previous function setexposure
- add a specific auto setting function
- copyright change
- use the kbuild module name for messages
- change module author
- remove '__' from the variable types
- use u8 instead of 'unsigned char'
- simplify the error messages
- remove useless initialization
- remove useless traces
For encoding, the destination format now needs to be set to V4L2_PIX_FMT_JPEG
and the subsampling (4:2:2 or 4:2:0) needs to be set using the respective
control (V4L2_CID_JPEG_CHROMA_SUBSAMPLING). Required buffer size for
destination image during encoding is no longer deduced from the format (which
generally implied overestimation), but needs to be given from userspace in
sizeimage.
Not strictly related to the added controls, this patch also fixes setting the
subsampling of the destination image for decoding, depending on the destination
format.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Javier Martin [Thu, 16 Feb 2012 15:19:08 +0000 (12:19 -0300)]
[media] media: vb2: support userptr for PFN mappings
Some video devices need to use contiguous memory which is
not backed by pages as it happens with vmalloc. This patch
provides USERPTR handling for those devices.
Signed-off-by: Javier Martin <javier.martin@vista-silicon.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] s5p-csis: Convert to the device managed resources
The devm_* functions are used in the platform device probe() for data
that is freed on driver removal. The managed device layer takes care
of undoing actions taken in the probe callback() and freeing resources
on driver detach. This eliminates the need for manually releasing
resources and simplifies error handling.
[media] s5p-fimc: Replace the crop ioctls with VIDIOC_S/G_SELECTION
Add support for cropping and composition setup on the video capture
node through VIDIOC_S/G_SELECTION ioctls. S/G_CROP, CROPCAP ioctls
are still supported for applications since the core will translate
them to *_selection handler calls.
[media] s5p-fimc: Convert to the device managed resources
The devm_* functions are used in the platform device probe() for data
that is freed on driver removal. The managed device layer takes care
of undoing actions taken in the probe callback() and freeing resources
on driver detach. This eliminates the need for manually releasing
resources and simplifies error handling.
[media] s5p-csis: Add explicit dependency on REGULATOR
The driver used the regulator API so it should depend on REGULATOR.
[mchehab@redhat.com: break depends on on two lines, instead of using a \] Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Il 29/02/2012 22:30, Geert Uytterhoeven ha scritto:
> http://kisskb.ellerman.id.au/kisskb/buildresult/5759200/ ERROR:
> "__udivdi3" [drivers/media/dvb/frontends/rtl2830.ko] undefined!
>
The following patch fixed the warning on my 32 bit system.
This patch replaces VIDIOC_S/G_JPEGCOMP ioctl handlers with
V4L2_CID_JPEG_QUALITY control. Additionally it enables JPEG subsampling
and the restart interval configuration through V4L2_CID_JPEG_SUBSAMPLING
and V4L2_CID_JPEG_RESTART_INTERVAL controls. For the decoder video node
only V4L2_CID_JPEG_SUBSAMPLING is available as a read-only control.
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The V4L2_CID_JPEG_CLASS control class is intended to expose various
adjustable parameters of JPEG encoders and decoders. Following controls
are defined:
This covers only a part of relevant standard specifications. More
controls should be added in future if required.
The purpose of V4L2_CID_JPEG_CLASS class is also to replace some
functionality covered by VIDIOC_S/G_JPEGCOMP ioctls, i.e. the JPEG
markers presence and compression quality control. The applications
and drivers should switch from the ioctl to control based API, as
described in the subsequent patches for the Media API DocBook.
Antti Palosaari [Thu, 4 Aug 2011 23:27:19 +0000 (20:27 -0300)]
[media] rtl2830: correct I2C functionality
Implement I2C functionality according to real RTL2830 demod.
Do not send register page in first byte of each I2C write, instead
use logic to set page using own write when needed. Page register is
physical register 0 as generally used.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Antti Palosaari [Sat, 9 Jul 2011 02:36:07 +0000 (23:36 -0300)]
[media] Realtek RTL28xxU serie DVB USB interface driver
For now it supports only Realtek RTL2831U chip.
RTL2831U is integrated DVB USB interface and DVB-T demod.
DVB-T demod integrated to RTL2831U is Realtek RTL2830.
Supported tuners are QT1010, MT2060 and MXL5005S.
Signed-off-by: Antti Palosaari <crope@iki.fi>
[mchehab@redhat.com: fix a small typo] Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
SiI9234 is a converter of HDMI signal into MHL. The chip is present on some
boards from Samsung S5P family. The chip's configuration procedure is based on
MHD_SiI9234 driver created by doonsoo45.kim.
The driver is using:
- i2c framework
- v4l2 framework
- runtime PM
Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Julia Lawall [Mon, 13 Feb 2012 13:34:58 +0000 (10:34 -0300)]
[media] v4l: s5p-tv: use devm_ functions
The various devm_ functions allocate memory that is released when a driver
detaches. This patch uses these functions for data that is allocated in
the probe function of a platform device and is only freed in the remove
function.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Javier Martin [Fri, 13 Jan 2012 09:31:57 +0000 (06:31 -0300)]
[media] MX2: Add platform definitions for eMMa-PrP device
eMMa-PrP device included in Freescale i.MX2 chips can also
be used separately to process memory buffers. This patch
provides arch glue code for the driver which provides this
functionality.
Acked-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Javier Martin <javier.martin@vista-silicon.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Javier Martin [Fri, 13 Jan 2012 09:31:02 +0000 (06:31 -0300)]
[media] MEM2MEM: Add support for eMMa-PrP mem2mem operations
i.MX2x SoCs have a PrP which is capable of resizing and format
conversion of video frames. This driver provides support for
resizing and format conversion from YUYV to YUV420.
This operation is of the utmost importance since some of these
SoCs like i.MX27 include an H.264 video codec which only
accepts YUV420 as input.
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Javier Martin <javier.martin@vista-silicon.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Taylor Ralph [Fri, 21 Oct 2011 02:33:23 +0000 (23:33 -0300)]
[media] hdpvr: update picture controls to support firmware versions > 0.15
Correctly sets the max/min/default values for the hdpvr picture
controls. The reason the current values didn't cause a problem until now
is because any firmware <= 0.15 didn't support them. The latest firmware
releases properly support picture controls and the values in the patch
are derived from the windows driver using SniffUSB2.0.
Thanks to Devin Heitmueller for helping me.
Signed-off-by: Taylor Ralph <tralph@mythtv.org> Thanks-to: Devin Heitmueller <dheitmueller@kernellabs.com> Acked-by: Jarod Wilson <jarod@redhat.com> Reviewed-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Randy Dunlap [Thu, 2 Feb 2012 17:40:30 +0000 (14:40 -0300)]
[media] wl128x: fix build errors when GPIOLIB is not enabled
From: Randy Dunlap <rdunlap@xenotime.net>
Fix wl128x Kconfig to depend on GPIOLIB since TI_ST also
depends on GPIOLIB.
(.text+0xe6d60): undefined reference to `st_register'
(.text+0xe7016): undefined reference to `st_unregister'
(.text+0xe70ce): undefined reference to `st_unregister'
Michael Krufky [Wed, 8 Feb 2012 17:57:39 +0000 (14:57 -0300)]
[media] xc5000: drivers should specify chip revision rather than firmware
Specify chip revision at attach time rather than a firmware image.
This is a better way to ensure that the correct firmware is loaded
for the correct revision of the chip.
Signed-off-by: Michael Krufky <mkrufky@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Michael Krufky [Tue, 7 Feb 2012 05:39:36 +0000 (02:39 -0300)]
[media] xc5000: remove static dependencies on xc5000 created by previous changesets
convert the firmware configuration attach-time parameter from
a pointer to an integer so as to remove the static dependency
created by the previous changesets.
Signed-off-by: Michael Krufky <mkrufky@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Michael Krufky [Mon, 6 Feb 2012 22:40:32 +0000 (19:40 -0300)]
[media] xc5000: allow drivers to set desired firmware in xc5000_attach
newer versions of the xc5000 silicon require newer firmware
while remaining 100% driver compatible. original versions
of the xc5000a continue to use the same firmware.
Signed-off-by: Michael Krufky <mkrufky@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>