Albert Wang [Wed, 1 Aug 2012 05:45:41 +0000 (02:45 -0300)]
[media] media: soc_camera: don't clear pix->sizeimage in JPEG mode
In JPEG mode, the size of image is variable due to different JPEG compression
rate. We only can get the pix->sizeimage from the user.
If we clear pix->sizeimage in soc_camera_try_fmt() then we will get it from:
ret = soc_mbus_image_size(xlate->host_fmt, pix->bytesperline,
pix->height);
if (ret < 0)
return ret;
pix->sizeimage = max_t(u32, pix->sizeimage, ret);
In general, this sizeimage will be larger than the actul JPEG image size.
But vb2 will check the buffer and size of image in __qbuf_userptr():
/* Check if the provided plane buffer is large enough */
if (planes[plane].length < q->plane_sizes[plane])
So we shouldn't clear the pix->sizeimage and also shouldn't re-calculate
the pix->sizeimage in soc_mbus_image_size() in JPEG mode
We also shouldn't re-calculate pix->bytesperline:
ret = soc_mbus_bytes_per_line(pix->width, xlate->host_fmt);
if (ret < 0)
return ret;
Liu Ying [Mon, 6 Aug 2012 06:02:08 +0000 (03:02 -0300)]
[media] media: mx3_camera: Improve data bus width check code for probe
This patch contains code change only to use the present macro-
MX3_CAMERA_DATAWIDTH_MASK to check valid camera platform data
bus width instead of enumerating every possible data bus width.
Alex Gershgorin [Thu, 2 Aug 2012 15:32:41 +0000 (12:32 -0300)]
[media] mt9v022: Add support for mt9v024
Driver for mt9v022 camera sensor is fully compatible for mt9v024 camera sensor
with the exception of several registers which have been changed addresses.
mt9v024 also has improved and additional features, but they are currently not in use.
Javier Martin [Wed, 1 Aug 2012 09:16:44 +0000 (06:16 -0300)]
[media] media: mx2_camera: Fix clock handling for i.MX27
On i.MX27 two clocks are required: emma-ipg and emma-ahb. The ahb clock
has to be requested using both a device and a connection ID.
Signed-off-by: Javier Martin <javier.martin@vista-silicon.com>
[g.liakhovetski@gmx.de: rebase to the current media tree] Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Alex Gershgorin [Wed, 1 Aug 2012 08:05:10 +0000 (05:05 -0300)]
[media] media: mx3_camera: buf_init() add buffer state check
This patch checks the state of the buffer when calling .buf_init() method.
This is needed for the USERPTR buffer type, because in that case
.buf_init() is called every time a buffer is queued, and not only once
during the preparation stage, like in the MMAP case. Without this check
buffers get initialised repeatedly, which also leads to the allocation
of new DMA descriptors, of which there is only a final relatively small
number available. Both MMAP and USERPTR methods were successfully tested.
Emil Goode [Tue, 14 Aug 2012 20:44:42 +0000 (17:44 -0300)]
[media] media: coda: add const qualifiers
The commit 98d7bbb9 changed *of_device_id.data to const
which introduced warnings in various places that have mostly
been fixed. This patch fixes one such warning by introducing
two const qualifiers.
GCC warning:
drivers/media/platform/coda.c:1785:16: warning:
assignment discards ‘const’ qualifier
from pointer target type [enabled by default]
Signed-off-by: Emil Goode <emilgoode@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Julia Lawall [Tue, 14 Aug 2012 12:23:06 +0000 (09:23 -0300)]
[media] drivers/media/platform/mx2_emmaprp.c: use devm_kzalloc and devm_clk_get
Using devm_kzalloc simplifies the code and ensures that the use of
devm_request_irq is safe. When kzalloc and kfree were used, the interrupt
could be triggered after the handler's data argument had been freed.
This also introduces some missing initializations of the return variable
ret, and uses devm_request_and_ioremap instead of the combination of
devm_request_mem_region and devm_ioremap.
The problem of a free after a devm_request_irq was found using the
following semantic match (http://coccinelle.lip6.fr/)
devm_request_irq@p1(e1,e2,...,x)
... when any
when != e2 = a
when != x = b
if (...) {
... when != e2 = c
when != x = d
free@p2(...,x,...);
...
return ...;
}
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Dan Carpenter [Tue, 14 Aug 2012 06:03:35 +0000 (03:03 -0300)]
[media] stk1160: remove unneeded check
"card" is a valid pointer here because we checked snd_card_create() for
error returns. Checking after a dereference makes the static checkers
complain.
Dan Carpenter [Tue, 14 Aug 2012 05:58:56 +0000 (02:58 -0300)]
[media] mem2mem_testdev: unlock and return error code properly
We recently added locking to this function, but there was an error path
which accidentally returned holding a lock. Also we returned zero on
failure on some paths instead of the error code.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Dan Carpenter [Tue, 14 Aug 2012 05:51:20 +0000 (02:51 -0300)]
[media] it913x-fe: use ARRAY_SIZE() as a cleanup
This code looks suspicious, but it turns out that "nv" is an array of u8
so sizeof() is the same as ARRAY_SIZE(). Using ARRAY_SIZE() is more
readable though.
[media] V4L: soc-camera: add selection API host operations
Add .get_selection() and .set_selection() soc-camera host driver
operations. Additionally check, that the user is not trying to change the
output sizes during a running capture.
[media] ov772x: Make to_ov772x convert from v4l2_subdev to ov772x_priv
Conversion from i2c_client to ov772x_priv is only needed in a single
location, while conversion from v4l2_subdev to ov772x_priv is needed in
several locations. Perform the former manually, and use to_ov772x for
the later.
[media] ov772x: Select the default format at probe time
The format and window size are only initialized during the first g_fmt
call. This leaves the device in an inconsistent state after
initialization, which will cause problems when implementing pad
operations. Move the format and window size initialization to probe
time.
[media] soc-camera: Push probe-time power management to drivers
Several client drivers access the hardware at probe time, for instance
to read the probe chip ID. Such chips need to be powered up when being
probed.
soc-camera handles this by powering chips up in the soc-camera probe
implementation. However, this will break with non soc-camera hosts that
don't perform the same operations.
Fix the problem by pushing the power up/down from the soc-camera core
down to individual drivers on a needs basis.
[media] soc-camera: Add and use soc_camera_power_[on|off]() helper functions
Instead of forcing all soc-camera drivers to go through the mid-layer to
handle power management, create soc_camera_power_[on|off]() functions
that can be called from the subdev .s_power() operation to manage
regulators and platform-specific power handling. This allows non
soc-camera hosts to use soc-camera-aware clients.
[media] soc-camera: Continue the power off sequence if one of the steps fails
Powering off a device is a "best effort" task: failure to execute one of
the steps should not prevent the next steps to be executed. For
instance, an I2C communication error when putting the chip in stand-by
mode should not prevent the more agressive next step of turning the
chip's power supply off.
[media] soc_camera: Don't call .s_power() during probe
The .s_power() call only covers the .g_mbus_fmt() operation call.
Several clients required to be powered on to retrieve the current mbus
format but have now been fixed. The .s_power() call is thus not needed
anymore and can be removed.
[media] b2c2: fix driver's build due to the lack of pci DMA code
Fix a one-character typo at the makefile.
drivers/built-in.o: In function `flexcop_pci_remove':
flexcop-pci.c:(.text+0x20d1a28): undefined reference to `flexcop_dma_free'
flexcop-pci.c:(.text+0x20d1a3e): undefined reference to `flexcop_dma_free'
drivers/built-in.o: In function `flexcop_pci_stream_control':
flexcop-pci.c:(.text+0x20d2396): undefined reference to `flexcop_dma_config'
flexcop-pci.c:(.text+0x20d23b3): undefined reference to `flexcop_dma_config'
flexcop-pci.c:(.text+0x20d23cf): undefined reference to `flexcop_dma_config_timer'
flexcop-pci.c:(.text+0x20d23f5): undefined reference to `flexcop_dma_xfer_control'
flexcop-pci.c:(.text+0x20d244c): undefined reference to `flexcop_dma_control_timer_irq'
flexcop-pci.c:(.text+0x20d24b0): undefined reference to `flexcop_dma_control_timer_irq'
flexcop-pci.c:(.text+0x20d2507): undefined reference to `flexcop_dma_xfer_control'
drivers/built-in.o: In function `flexcop_pci_probe':
flexcop-pci.c:(.text+0x20d28d2): undefined reference to `flexcop_dma_allocate'
flexcop-pci.c:(.text+0x20d2907): undefined reference to `flexcop_dma_allocate'
flexcop-pci.c:(.text+0x20d2923): undefined reference to `flexcop_dma_free'
Javier Martin [Thu, 26 Jul 2012 10:20:36 +0000 (07:20 -0300)]
[media] Schedule removal of i.MX25 support in mx2_camera.c
Support for i.MX25 in mx2_camera.c has been broken
for a year. Furthermore, i.MX25 video capture HW
doesn't have much in common with i.MX27. A separate
driver would be desirable.
Signed-off-by: Javier Martin <javier.martin@vista-silicon.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Manoel Pinheiro [Thu, 19 May 2011 17:16:57 +0000 (14:16 -0300)]
[media] saa7134-dvb: Fix kworld sbtvd I2C gate control
The correct place to put i2c_gate_ctrl is before calling tda18271_attach,
because the driver tda18271 will use it to enable or disable the i2c-bus
from the demodulator to the tuner.
And thus eliminate the error message: "Unknown device (255) detected
@ 1-00c0, device not supported" in the driver tda18271.
In the device kworld_sbtvd (hybrid analog and digital TV) the control
of the i2c-bus to tuner is done in the analog demodulator and not in
the digital demodulator.
David Härdeman [Thu, 28 Apr 2011 14:14:03 +0000 (11:14 -0300)]
[media] rc-core: move timeout and checks to lirc
The lirc TX functionality expects the process which writes (TX) data to
the lirc dev to sleep until the actual data has been transmitted by the
hardware.
Since the same timeout calculation is duplicated in more than one driver
(and would have to be duplicated in even more drivers as they gain TX
support), it makes sense to move this timeout calculation to the lirc
layer instead.
At the same time, centralize some of the sanity checks.
Signed-off-by: David Härdeman <david@hardeman.nu> Cc: Jarod Wilson <jwilson@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] lmedm04: fix data usage past the end of the buffer
On Mon, 2012-08-13 at 19:58 +0300, Dan Carpenter wrote:
> Hello Mauro Carvalho Chehab,
>
> The patch db6651a9ebb3: "[media] lmedm04: fix build" from Aug 12,
> 2012, leads to the following warning:
> drivers/media/dvb/dvb-usb-v2/lmedm04.c:769 lme2510_download_firmware()
> error: usb_control_msg() 'data' too small (128 vs 265)
>
> 737 data = kzalloc(128, GFP_KERNEL);
> ^^^
> data is 128 bytes.
Michael Krufky [Mon, 21 May 2012 20:47:15 +0000 (17:47 -0300)]
[media] DVB: improve handling of TS packets containing a raised TEI bit
When the TEI bit is raised, we should not trust any of the contents of
the packet in question, including but not limited to its PID number.
Considering that we don't trust the PID number of this packet, we should
not proceed to check the packet counter (if dvb_demux_tscheck is set).
We should expect to see at least one discontinuity after a bad packet is
received, so any time a TEI is detected, a following TS packet counter
mismatch is to be expected.
There is no real reason to ever allow bad packets to pass through the
kernel demux, other than for purposes of attempting error correction via
software or statistical information.
However, since we have always passed these bad packets though the demux,
we should not change this default behavior.
Without altering module options, this patch merely prevents the
TS packet counter check on packets containing a raised TEI.
If module option dvb_demux_feed_err_pkts is set to 0, the kernel demux
will drop these error packets entirely, preventing any possibility of
corruption caused by userspace programs that are expecting valid data.
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
These double "const" were introduced in v2.6.37-rc1~64^2~464 (V4L/DVB:
drivers/media: Make static data tables and strings const, 2010-08-25).
The address of an array is already immutable by definition, so for
what it's worth, with or without a clarified commit message,
[mchehab@redhat.com: Tested with "gcc -s" (version 4.7.0):
the produced asm is indeed equal before and after this patch] Signed-off-by: Emil Goode <emilgoode@gmail.com> Acked-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] frontend.h, Docbook: Improve status documentation
No functional changes. It just improves the description of the frontend
status, using Documentation/kernel-doc-nano-HOWTO.txt for the status
enumeration, and a table inside the DocBook.
Timo Kokkonen [Fri, 10 Aug 2012 09:16:36 +0000 (06:16 -0300)]
[media] media: rc: Introduce RX51 IR transmitter driver
This is the driver for the IR transmitter diode found on the Nokia
N900 (also known as RX51) device. The driver is mostly the same as
found in the original 2.6.28 based kernel that comes with the device.
The following modifications have been made compared to the original
driver version:
- Adopt to the changes that has happen in the kernel during the past
five years, such as the change in the include paths
- The OMAP DM-timers require much more care nowadays. The timers need
to be enabled and disabled or otherwise many actions fail. Timers
must not be freed without first stopping them or otherwise the timer
cannot be requested again.
The code has been tested with sending IR codes with N900 device
running Debian userland. The device receiving the codes was Anysee
DVB-C USB receiver.
Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi> Cc: Tony Lindgren <tony@atomide.com> Cc: linux-omap@vger.kernel.org Cc: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Andy Shevchenko [Tue, 7 Aug 2012 15:43:07 +0000 (12:43 -0300)]
[media] gspca: use %*ph to print small buffers
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] dvb: get rid of fe_ioctl_override callback
This callback were meant to allow overriding a FE callback, before its
call, but it is not really needed, as the callback can be intercepted
after tuner attachment.
Worse than that, only DVBv3 calls are intercepted this way, so a DVBv5
application will produce different effects than a DVBv3 one.
So, get rid of it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Acked-by: Antti Palosaari <crope@iki.fi> Reviewed-by: Antti Palosaari <crope@iki.fi>
Julia Lawall [Tue, 31 Jul 2012 08:21:36 +0000 (05:21 -0300)]
[media] drivers/media/radio/radio-si4713.c: 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> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Julia Lawall [Tue, 31 Jul 2012 08:21:35 +0000 (05:21 -0300)]
[media] drivers/media/radio/radio-wl1273.c: 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.
In two cases, the original memory allocation function was kmalloc, which
has been changed to a zeroing allocation to benefit from the devm function.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Julia Lawall [Tue, 31 Jul 2012 08:21:37 +0000 (05:21 -0300)]
[media] drivers/media/radio/radio-timb.c: 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> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>