Hans Verkuil [Mon, 13 Jan 2014 09:58:12 +0000 (06:58 -0300)]
[media] solo6x10: fix broken PAL support
The video_type was never set correctly for PAL: it's not a bool, instead
it is a register value.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: tomdev@freenet.de
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Tim Mester [Tue, 7 Jan 2014 04:29:25 +0000 (01:29 -0300)]
[media] au0828: Add option to preallocate digital transfer buffers
Added command line parameter preallocate_big_buffers so that the digital
transfer buffers can be allocated when the driver is registered. They
do not have to be allocated every time a feed is started.
Signed-off-by: Tim Mester <tmester@ieee.org>
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Tim Mester [Tue, 7 Jan 2014 04:29:24 +0000 (01:29 -0300)]
[media] au8028: Fix cleanup on kzalloc fail
Free what was allocated if there is a failure allocating
transfer buffers.
Stop the feed on a start feed error. The stop feed is not always called
if start feed fails. If the feed is not stopped on error, then the driver
will be stuck so that it can never start feeding again.
[m.chehab@samsung.com: CodingStyle cleanup]
Signed-off-by: Tim Mester <tmester@ieee.org>
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Kiran AVND [Mon, 16 Dec 2013 09:40:42 +0000 (06:40 -0300)]
[media] s5p-mfc: Add controls to set vp8 enc profile
Add v4l2 controls to set desired profile for VP8 encoder.
Acceptable levels for VP8 encoder are
0: Version 0
1: Version 1
2: Version 2
3: Version 3
Signed-off-by: Kiran AVND <avnd.kiran@samsung.com>
Signed-off-by: Pawel Osciak <posciak@chromium.org>
Signed-off-by: Arun Kumar K <arun.kk@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Marek Szyprowski [Tue, 3 Dec 2013 13:12:51 +0000 (10:12 -0300)]
[media] media: s5p_mfc: remove s5p_mfc_get_node_type() function
s5p_mfc_get_node_type() relies on get_index() helper function, which in
turn relies on video_device index numbers assigned on driver
registration. All this code is not really needed, because there is
already access to respective video_device structures via common
s5p_mfc_dev structure. This fixes the issues introduced by patch
1056e4388b0454917a512618c8416a98628fc9ce ("v4l2-dev: Fix race condition
on __video_register_device"), which has been merged in v3.12-rc1.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: stable@vger.kernel.org
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Arun Kumar K [Fri, 15 Nov 2013 05:29:22 +0000 (02:29 -0300)]
[media] s5p-mfc: Add QP setting support for vp8 encoder
Adds v4l2 controls to set MIN, MAX QP values and
I, P frame QP for vp8 encoder.
Signed-off-by: Kiran AVND <avnd.kiran@samsung.com>
Signed-off-by: Arun Kumar K <arun.kk@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Mauro Carvalho Chehab [Sun, 12 Jan 2014 14:08:22 +0000 (11:08 -0300)]
[media] em28xx: fix xc3028 demod and firmware setup on DVB
Now that em28xx can be compiled without V4L support, we should
call em28xx_setup_xc3028() on both em28xx-v4l and em28xx-dvb
modules.
Reported-by: Chris Lee <updatelee@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Mauro Carvalho Chehab [Mon, 13 Jan 2014 07:59:30 +0000 (05:59 -0200)]
[media] nxt200x: increase write buffer size
The buffer size on nxt200x is not enough:
...
> Dec 20 10:52:04 rich kernel: [ 31.747949] nxt200x: nxt200x_writebytes: i2c wr reg=002c: len=255 is too big!
...
Increase it to 256 bytes.
Reported-by: Rich Freeman <rich0@gentoo.org>
Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Mauro Carvalho Chehab [Sun, 12 Jan 2014 13:21:42 +0000 (10:21 -0300)]
[media] em28xx-audio: return -ENODEV when the device is disconnected
If em28xx is disconnected, return -ENODEV to all PCM callbacks.
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Mauro Carvalho Chehab [Sun, 12 Jan 2014 13:10:34 +0000 (10:10 -0300)]
[media] em28xx-audio: split URB initialization code
The URB calculus code may eventually be moved to some other
place, like at pcm open, if it ends by needing more setups, like
working with different bit rates, or different audio latency.
So, move it into a separate routine. That also makes the code
more readable.
No functional changes.
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Mauro Carvalho Chehab [Sun, 12 Jan 2014 12:22:29 +0000 (09:22 -0300)]
[media] em28xx-audio: don't wait for lock in non-block mode
Pulseaudio has the bad habit of stopping a streaming audio if
a device, opened in non-block mode, waits.
It is impossible to avoid em28xx to wait, as it will send commands
via I2C, and other I2C operations may be happening (firmware
transfers, Remote Controller polling, etc). Yet, as each em28xx
subdriver locks em28xx-dev to protect the access to the hardware,
it is possible to minimize the audio glitches by returning -EAGAIN
to pulseaudio, if the lock is already taken by another subdriver.
Reported-by: Antti Palosaari <crope@iki.fi>
Tested-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Mauro Carvalho Chehab [Fri, 10 Jan 2014 16:29:16 +0000 (13:29 -0300)]
[media] em28xx-audio: fix the period size in bytes
If the period size is wrong, userspace will assume a wrong delay
any may negociate an inadequate value.
The em28xx devices use 8 for URB interval, in microframes,
and the driver programs it to have 64 packets.
That means that the IRQ sampling period is 125 * 8 * 64,
with is equal to 64 ms.
So, that's the minimal latency with the current settings. It is
possible to program a lower latency, by using less than 64 packets,
but that increases the amount of bandwitdh used, and the number of
IRQ events per second.
In any case, in order to support it, the driver logic should be
changed to fill those parameters in realtime.
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Mauro Carvalho Chehab [Fri, 10 Jan 2014 08:53:24 +0000 (05:53 -0300)]
[media] em28xx-audio: don't hardcode audio URB calculus
The current code hardcodes the number of audio URBs, the number
of packets per URB and the maximum URB size.
This is not a good idea, as it:
- wastes more bandwidth than necessary, by using a very
large number of packets;
- those constants are bound to an specific scenario, with
a bandwidth of 48 kHz;
- don't take the maximum endpoint size into account;
- with urb->interval = 1 on xHCI, those constraints cause a "funny"
setup: URBs with 64 packets inside, with only 24 bytes total. E. g.
a complete waste of space.
Change the code to do dynamic URB audio calculus and allocation.
For now, use the same constraints as used before this patch, to
avoid regressions.
A good scenario (tested) seems to use those defines, instead:
#define EM28XX_MAX_AUDIO_BUFS 8
#define EM28XX_MIN_AUDIO_PACKETS 2
But let's not do such change here, letting the optimization to
happen on latter patches, after more tests.
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Mauro Carvalho Chehab [Fri, 10 Jan 2014 09:59:09 +0000 (06:59 -0300)]
[media] em28xx-audio: Fix error path
De-allocate memory and free sound if an error happens.
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Mauro Carvalho Chehab [Fri, 10 Jan 2014 08:43:09 +0000 (05:43 -0300)]
[media] em28xx-audio: use bInterval on em28xx-audio
Just filling urb->interval with 1 is wrong, and causes a different
behaviour with xHCI.
With EHCI, the URB size is typically 192 bytes. However, as
xHCI specifies intervals in microframes, the URB size becomes
too short (24 bytes).
With this patch, the interval will be properly initialized, and
the device will behave the same if connected into a xHCI or an
EHCI device port.
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Mauro Carvalho Chehab [Mon, 6 Jan 2014 12:17:53 +0000 (09:17 -0300)]
[media] em28xx-i2c: add timeout debug information if i2c_debug enabled
If i2c_debug is enabled, we splicitly want to know when a
device fails with timeout.
If i2c_debug==2, this is already provided, for each I2C transfer
that fails.
However, most of the time, we don't need to go that far. We just
want to know that I2C transfers fail.
So, add such errors for normal (ret == 0x10) I2C aborted timeouts.
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Mauro Carvalho Chehab [Sat, 28 Dec 2013 11:23:30 +0000 (08:23 -0300)]
[media] em28xx-i2c: cleanup I2C debug messages
The I2C output messages is too polluted. Clean it a little
bit, by:
- use the proper core support for memory dumps;
- hide most stuff under the i2c_debug umbrella;
- add the missing KERN_CONT where needed;
- use 2 levels or verbosity. Only the second one
will show the I2C transfer data.
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Mauro Carvalho Chehab [Sat, 4 Jan 2014 08:42:11 +0000 (05:42 -0300)]
[media] em28xx-i2c: Fix error code for I2C error transfers
Follow the error codes for I2C as described at Documentation/i2c/fault-codes.
In the case of the I2C status register (0x05), this is mapped into:
- ENXIO - when reg 05 returns 0x10
- ETIMEDOUT - when the device is not temporarily not responding
(e. g. reg 05 returning something not 0x10 or 0x00)
- EIO - for generic I/O errors that don't fit into the above.
In the specific case of 0-byte reads, used only during I2C device
probing, it keeps returning -ENODEV.
TODO: return EBUSY when reg 05 returns 0x20 on em2874 and upper.
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Mauro Carvalho Chehab [Sat, 28 Dec 2013 10:42:47 +0000 (07:42 -0300)]
[media] em28xx: use a better value for I2C timeouts
In the lack of a better spec, let's assume the timeout
values compatible with SMBus spec:
http://smbus.org/specs/smbus110.pdf
at chapter 8 - Electrical Characteristics of SMBus devices
Ok, SMBus is a subset of I2C, and not all devices will be
following it, but the timeout value before this patch was not
even following the spec.
So, while we don't have a better guess for it, use 35 + 1
ms as the timeout.
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Mauro Carvalho Chehab [Sun, 5 Jan 2014 12:45:50 +0000 (09:45 -0300)]
[media] em28xx: rename I2C timeout to EM28XX_I2C_XFER_TIMEOUT
This macro is used by all em28xx devices, and not just em2800.
Reviewed-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Mauro Carvalho Chehab [Sat, 4 Jan 2014 08:42:11 +0000 (05:42 -0300)]
[media] em28xx: convert i2c wait completion logic to use jiffies
The I2C wait completion/timeout logic currently assumes that
msleep(5) will wait exaclty 5 ms. This is not true at all,
as it depends on CONFIG_HZ.
Convert it to use jiffies, in order to not wait for more time
than needed.
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Mauro Carvalho Chehab [Fri, 27 Dec 2013 03:28:57 +0000 (00:28 -0300)]
[media] em28xx: properly implement AC97 wait code
Instead of assuming that msleep() is precise, use a jiffies
based code to wait for AC97 to be available.
Reviewed-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Mauro Carvalho Chehab [Mon, 6 Jan 2014 09:52:43 +0000 (06:52 -0300)]
[media] tuner-xc2028: Don't read status if device is powered down
That removes those timeout errors:
[ 3675.930940] xc2028 19-0061: Device is Xceive 3028 version 1.0, firmware version 2.7
[ 3676.060487] xc2028 19-0061: divisor= 00 00 8d d0 (freq=567.250)
[ 3676.349449] xc2028 19-0061: Putting xc2028/3028 into poweroff mode.
[ 3698.247645] xc2028 19-0061: xc2028_get_reg 0002 called
[ 3698.253276] em2860 #0: I2C transfer timeout on writing to addr 0xc2
[ 3698.253301] xc2028 19-0061: i2c input error: rc = -121 (should be 2)
[ 3698.253327] xc2028 19-0061: xc2028_signal called
[ 3698.253339] xc2028 19-0061: xc2028_get_reg 0002 called
[ 3698.259283] em2860 #0: I2C transfer timeout on writing to addr 0xc2
[ 3698.259312] xc2028 19-0061: i2c input error: rc = -121 (should be 2)
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Mauro Carvalho Chehab [Mon, 6 Jan 2014 09:39:51 +0000 (06:39 -0300)]
[media] tuner-xc2028: Don't try to sleep twice
Only send a power down command for the device if it is not already
in power down state. That prevents a timeout when trying to talk
with the device.
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Mauro Carvalho Chehab [Sun, 29 Dec 2013 00:16:26 +0000 (21:16 -0300)]
[media] em28xx-audio: allocate URBs at device driver init
Instead of allocating/deallocating URBs and transfer buffers
every time stream is started/stopped, just do it once.
That reduces the memory allocation pressure and makes the
code that start/stop streaming a way simpler.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Mauro Carvalho Chehab [Sat, 28 Dec 2013 14:47:16 +0000 (11:47 -0300)]
[media] em28xx: use usb_alloc_coherent() for audio
Instead of allocating transfer buffers with kmalloc() use
usb_alloc_coherent().
This patch should make it work also with ARM CPUs.
Reviewed-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Links (Markus) [Sat, 4 Jan 2014 22:44:34 +0000 (19:44 -0300)]
[media] cx231xx: add support for a CX23103 Video Grabber USB
Add a new USB ID to the driver.
Signed-off-by: Links (Markus) <help.markus+git@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Laurent Pinchart [Wed, 1 Jan 2014 12:10:48 +0000 (09:10 -0300)]
[media] vb2: Fix comment in __qbuf_dmabuf
The comment incorrectly explains that the code verifies information
provided by userspace, while verification has been performed earlier in
reality. Fix it.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Malcolm Priestley [Sat, 28 Dec 2013 17:04:51 +0000 (14:04 -0300)]
[media] m88rs2000: Correct m88rs2000_get_fec
Value of fec is achieved by the upper nibble bits 6,7 & 8.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Malcolm Priestley [Sat, 28 Dec 2013 17:02:44 +0000 (14:02 -0300)]
[media] m88rs2000: Correct m88rs2000_set_fec settings
Register 0x70 is used to set fec, register 0x76 is used to get fec
Register 0x76 is set to 0x8.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Malcolm Priestley [Sat, 28 Dec 2013 17:00:40 +0000 (14:00 -0300)]
[media] m88rs2000: correct read status lock value
The correct lock values is when bits of the value 0xee are set.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Malcolm Priestley [Tue, 24 Dec 2013 16:18:46 +0000 (13:18 -0300)]
[media] m88rs2000: set symbol rate accurately
Current setting of symbol rate is not very actuate causing
loss of lock.
Covert temp to u64 and use mclk to calculate from big number.
Calculate symbol rate by dividing symbol rate by 1000 times
1 << 24 and dividing sum by mclk.
Add other symbol rate settings to function registers 0xa0-0xa3.
In set_frontend add changes to register 0xf1 this must be done
prior call to fe_reset. Register 0x00 doesn't need a second
write of 0x1
Applied after patch
m88rs2000: add m88rs2000_set_carrieroffset
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Cc: stable@vger.kernel.org # v3.9+
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Malcolm Priestley [Tue, 24 Dec 2013 16:17:12 +0000 (13:17 -0300)]
[media] m88rs2000: add m88rs2000_set_carrieroffset
Set the carrier offset correctly using the default mclk values.
Add function m88rs2000_get_mclk to calculate the mclk value
against crystal frequency which will later be used for
other functions.
Add function m88rs2000_set_carrieroffset to calculate
and set the offset value.
variable offset becomes a signed value.
Register 0x86 is set the appropriate value according to
remainder value of frequency % 192857 calculation as
shown.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Cc: stable@vger.kernel.org # v3.9+
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Julia Lawall [Sun, 29 Dec 2013 22:47:35 +0000 (19:47 -0300)]
[media] e4000: fix error return code
Set the return variable to an error code as done elsewhere in the function.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != &ret
*if(...)
{
... when != ret = e2
when forall
return ret;
}
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Julia Lawall [Sun, 29 Dec 2013 22:47:18 +0000 (19:47 -0300)]
[media] ec168: fix error return code
The rest of the function uses ret to store the return value, even setting
ret to i a few lines before this, so return ret instead of i.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != &ret
*if(...)
{
... when != ret = e2
when forall
return ret;
}
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Alexey Khoroshilov [Fri, 27 Dec 2013 21:18:39 +0000 (18:18 -0300)]
[media] as102: fix leaks at failure paths in as102_usb_probe()
Failure handling is incomplete in as102_usb_probe().
The patch implements proper resource deallocations.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Tue, 24 Dec 2013 15:42:19 +0000 (12:42 -0300)]
[media] [for,v3.14] sn9c102: fix build dependency
This driver should only build if MEDIA_USB_SUPPORT is set.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Jim Davis <jim.epost@gmail.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Sachin Kamat [Tue, 24 Dec 2013 11:42:05 +0000 (08:42 -0300)]
[media] s5k5baf: Fix potential NULL pointer dereferencing
Dereference 'fw' after the NULL check.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Sachin Kamat [Tue, 24 Dec 2013 11:42:04 +0000 (08:42 -0300)]
[media] s5k5baf: Fix checkpatch error
Fixes the following error:
ERROR: return is not a function, parentheses are not required
FILE: drivers/media/i2c/s5k5baf.c:1353:
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Sachin Kamat [Tue, 24 Dec 2013 11:42:03 +0000 (08:42 -0300)]
[media] s5k5baf: Fix build warning
Fixes the following warnings:
drivers/media/i2c/s5k5baf.c: In function 's5k5baf_fw_parse':
drivers/media/i2c/s5k5baf.c:362:3: warning:
format '%d' expects argument of type 'int', but argument 3 has type 'size_t' [-Wformat=]
drivers/media/i2c/s5k5baf.c:383:4: warning:
format '%d' expects argument of type 'int', but argument 4 has type 'size_t' [-Wformat=]
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Matthias Schwarzott [Mon, 23 Dec 2013 11:12:21 +0000 (08:12 -0300)]
[media] cx231xx: Add missing KERN_CONT to i2c debug prints
Fix continuation lines.
[m.chehab@samsung.com: This was actually part of a v2 patch meant to
fix i2c debug prints. As version 1 was already applied, I'm applying
here the diff and fixing the patch subject/description]
Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Frank Schaefer [Sun, 22 Dec 2013 14:17:46 +0000 (11:17 -0300)]
[media] em28xx: fix I2S audio sample rate definitions and info output
The audio configuration in chip config register 0x00 and eeprom are always
consistent. But currently the audio configuration #defines for the chip config
register say 0x20 means 3 sample rates and 0x30 5 sample rates, while the eeprom
info output says 0x20 means 1 sample rate and 0x30 3 sample rates.
I've checked the datasheet excerpts I have and it seems that the meaning of
these bits is different for em2820/40 (1 and 3 sample rates) and em2860+
(3 and 5 smaple rates).
I have also checked my Hauppauge WinTV USB 2 (em2840) and the chip/eeprom
audio config 0x20 matches the sample rates reproted by the USB device
descriptor (32k only).
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Valentine Barshak [Thu, 26 Dec 2013 15:31:49 +0000 (12:31 -0300)]
[media] media: soc_camera: rcar_vin: Add preliminary R-Car M2 support
This adds R-Car M2 (R8A7791) VIN support. Both H2 and M2
variants look the same from the driver's point of view,
so use GEN2 id for both.
Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[g.liakhovetski@gmx.de: removed changelog from commit message]
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Laurent Pinchart [Mon, 9 Dec 2013 14:13:13 +0000 (11:13 -0300)]
[media] omap3isp: ccdc: Don't hang when the SBL fails to become idle
Under abnormal conditions (such as glitches on the HSYNC/VSYNC signals)
the CCDC output SBL can fail to become idle. The driver currently logs
this condition to the kernel log and doesn't restart the CCDC. This
results in CCDC video capture hanging without any notification to
userspace.
Cancel the pipeline and mark the CCDC as crashed instead of hanging.
Userspace will be notified of the problem and will then be able to close
and reopen the device to trigger a reset of the ISP.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Laurent Pinchart [Mon, 16 Dec 2013 02:49:42 +0000 (23:49 -0300)]
[media] omap3isp: Refactor modules stop failure handling
Modules failing to stop are fatal errors for the preview engine only.
Flag that condition separately from the other stop failures to prepare
support for more fatal errors.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Laurent Pinchart [Mon, 9 Dec 2013 14:36:51 +0000 (11:36 -0300)]
[media] omap3isp: Cancel streaming when a fatal error occurs
When a fatal error that prevents any further video streaming occurs in a
pipeline, all queued buffers must be marked as erroneous and new buffers
must be prevented from being queued. Implement this behaviour with a new
omap3isp_pipeline_cancel_stream() function that can be used by
submodules to cancel streaming.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Mauro Carvalho Chehab [Tue, 7 Jan 2014 10:05:01 +0000 (08:05 -0200)]
[media] export em28xx_release_resources() symbol
As reported by the kbuild test robot:
All error/warnings:
>> ERROR: "em28xx_release_resources" [drivers/media/usb/em28xx/em28xx-v4l.ko] undefined!
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Fri, 20 Dec 2013 12:04:44 +0000 (09:04 -0300)]
[media] davinci-vpfe: fix compile error
The include for delay.h was missing.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Ricardo Ribalda [Tue, 26 Nov 2013 08:31:42 +0000 (05:31 -0300)]
[media] videodev2: Set vb2_rect's width and height as unsigned
As discussed on the media summit 2013, there is no reason for the width
and height to be signed.
Therefore this patch is an attempt to convert those fields from __s32 to
__u32.
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi> (documentation and smiapp)
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Joe Perches [Wed, 23 Oct 2013 19:14:51 +0000 (16:14 -0300)]
[media] media: Remove OOM message after input_allocate_device
Emitting an OOM message isn't necessary after input_allocate_device
as there's a generic OOM and a dump_stack already done.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Fengguang Wu [Fri, 20 Dec 2013 10:16:47 +0000 (07:16 -0300)]
[media] fix coccinelle warnings
drivers/staging/media/bcm2048/radio-bcm2048.c:2255:3-4: Unneeded semicolon
Removes unneeded semicolon.
Generated by: coccinelle/misc/semicolon.cocci
CC: Hans Verkuil <hans.verkuil@cisco.com>
CC: Mauro Carvalho Chehab <m.chehab@samsung.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Fengguang Wu [Fri, 20 Dec 2013 10:16:42 +0000 (07:16 -0300)]
[media] fix coccinelle warnings
drivers/staging/media/bcm2048/radio-bcm2048.c:2632:1-7: Replace memcpy with struct assignment
/c/kernel-tests/src/cocci/drivers/staging/media/bcm2048/radio-bcm2048.c:744:1-7: Replace memcpy with struct assignment
/c/kernel-tests/src/cocci/drivers/staging/media/bcm2048/radio-bcm2048.c:2360:3-9: Replace memcpy with struct assignment
Generated by: coccinelle/misc/memcpy-assign.cocci
CC: Hans Verkuil <hans.verkuil@cisco.com>
CC: Mauro Carvalho Chehab <m.chehab@samsung.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Sat, 14 Dec 2013 11:28:37 +0000 (08:28 -0300)]
[media] saa7134: don't set vfd->debug
You can set this through sysfs, so don't mix the two.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Sat, 14 Dec 2013 11:28:36 +0000 (08:28 -0300)]
[media] saa6588: add support for non-blocking mode
saa6588 always blocked while waiting for data, even if the filehandle
was in non-blocking mode.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Sat, 14 Dec 2013 11:28:35 +0000 (08:28 -0300)]
[media] saa6588: remove unused CMD_OPEN
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Sat, 14 Dec 2013 11:28:34 +0000 (08:28 -0300)]
[media] saa6588: after calling CMD_CLOSE, CMD_POLL is broken
CMD_CLOSE sets data_available_for_read to 1, which is necessary to do the
wakeup call, but it is never reset to 0.
Because of this calling CMD_POLL afterwards will always return that data is
available, even if there isn't any.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Sat, 14 Dec 2013 11:28:33 +0000 (08:28 -0300)]
[media] saa7134: drop log_status for radio
There are no controls for the radio node, so just drop support for this ioctl.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Sat, 14 Dec 2013 11:28:32 +0000 (08:28 -0300)]
[media] saa6752hs.h: drop empty header
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Sat, 14 Dec 2013 11:28:31 +0000 (08:28 -0300)]
[media] saa6752hs: move to media/i2c
This driver is independent from saa7134, so there is no reason why this
shouldn't be in media/i2c like all other i2c media drivers.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Sat, 14 Dec 2013 11:28:30 +0000 (08:28 -0300)]
[media] saa6752hs: drop compat control code
The saa7134 driver is now converted to the control framework, so drop the
control compat code in saa6752hs.c.
Also add 'const' to several static arrays.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Sat, 14 Dec 2013 11:28:29 +0000 (08:28 -0300)]
[media] saa7134: use V4L2_IN_ST_NO_SIGNAL instead of NO_SYNC
NO_SYNC was meant for DVB and shouldn't be used anymore.
In this case NO_SIGNAL is a good alternative.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Sat, 14 Dec 2013 11:28:28 +0000 (08:28 -0300)]
[media] saa7134: add support for control events
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Sat, 14 Dec 2013 11:28:27 +0000 (08:28 -0300)]
[media] saa7134: share resource management between normal and empress nodes
The empress video node can share resource management with the normal
video nodes, thus allowing for code sharing and making the empress node
non-exclusive.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Sat, 14 Dec 2013 11:28:26 +0000 (08:28 -0300)]
[media] saa7134: remove dev from saa7134_fh, use saa7134_fh for empress node
Use the saa7134_fh struct for the empress video node as well, drop the dev
pointer from that struct since we can use drvdata for that.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Sat, 14 Dec 2013 11:28:25 +0000 (08:28 -0300)]
[media] saa7134: cleanup radio/video/empress ioctl handling
The video and empress nodes can share various ioctls.
Drop the input/std ioctls from the radio node (out of spec).
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Sat, 14 Dec 2013 11:28:24 +0000 (08:28 -0300)]
[media] saa7134: convert to the control framework
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Sat, 14 Dec 2013 11:28:23 +0000 (08:28 -0300)]
[media] saa7134: move the queue data from saa7134_fh to saa7134_dev
These fields are global, not per-filehandle.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Fri, 13 Dec 2013 16:13:46 +0000 (13:13 -0300)]
[media] DocBook: drop the word 'only'
There are already video output drivers that allow STREAMON without
any buffers queued, and with the change in vb2 there are now more
drivers like that.
So saying "The ioctl will succeed only when at least one output
buffer is in the incoming queue." isn't true. Just drop the word
'only'. We cannot say that it will also work if no output buffers are
queued as long as not all drivers are converted to vb2.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Fri, 13 Dec 2013 16:13:45 +0000 (13:13 -0300)]
[media] vb2: Improve file I/O emulation to handle buffers in any order
videobuf2 file I/O emulation assumed that buffers dequeued from the
driver would return in the order they were enqueued in the driver.
Improve the file I/O emulator's book-keeping to remove this assumption.
Also set the buf->size properly if a write() dequeues a buffer and the
VB2_FILEIO_WRITE_IMMEDIATELY flag is set.
Based on an initial patch by Andy Walls.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Fri, 13 Dec 2013 16:13:44 +0000 (13:13 -0300)]
[media] vb2: return ENOBUFS in start_streaming in case of too few buffers
This works together with the retry_start_streaming mechanism to allow userspace
to start streaming even if not all required buffers have been queued.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Cc: Tomasz Stanislawski <t.stanislaws@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Kamil Debski <k.debski@samsung.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Fri, 13 Dec 2013 16:13:43 +0000 (13:13 -0300)]
[media] vb2: don't set index, don't start streaming for write()
Two fixes:
- there is no need to set the index when calling dqbuf: dqbuf will
overwrite it.
- __vb2_init_fileio already starts streaming for write(), so there is
no need to do it again in __vb2_perform_fileio. It can never have
worked anyway: either __vb2_init_fileio succeeds in starting streaming
or it is never going to happen.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Fri, 13 Dec 2013 16:13:42 +0000 (13:13 -0300)]
[media] vb2: retry start_streaming in case of insufficient buffers
If start_streaming returns -ENOBUFS, then it will be retried the next time
a buffer is queued. This means applications no longer need to know how many
buffers need to be queued before STREAMON can be called. This is particularly
useful for output stream I/O.
If a DMA engine needs at least X buffers before it can start streaming, then
for applications to get a buffer out as soon as possible they need to know
the minimum number of buffers to queue before STREAMON can be called. You can't
just try STREAMON after every buffer since on failure STREAMON will dequeue
all your buffers. (Is that a bug or a feature? Frankly, I'm not sure).
This patch simplifies applications substantially: they can just call STREAMON
at the beginning and then start queuing buffers and the DMA engine will
kick in automagically once enough buffers are available.
This also fixes using write() to stream video: the fileio implementation
calls streamon without having any queued buffers, which will fail today for
any driver that requires a minimum number of buffers.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Fri, 13 Dec 2013 16:13:41 +0000 (13:13 -0300)]
[media] vb2: remove the 'fileio = NULL' hack
The read/write implementation in vb2 reuses existing vb2 functions, but
it sets q->fileio to NULL before calling them in order to skip the
'q->fileio != NULL' check.
This works today due to the synchronous nature of read/write, but it
1) is ugly, and 2) will fail in an asynchronous use-case such as a
thread queuing and dequeuing buffers. This last example will be necessary
in order to implement vb2 DVB support.
This patch removes the hack by splitting up the dqbuf/qbuf/streamon/streamoff
functions into an external and an internal version. The external version
checks q->fileio and then calls the internal version. The read/write
implementation now just uses the internal version, removing the need to
set q->fileio to NULL.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Fri, 13 Dec 2013 16:13:40 +0000 (13:13 -0300)]
[media] vb2: fix race condition between REQBUFS and QBUF/PREPARE_BUF
When preparing a buffer the queue lock is released for a short while
if the memory mode is USERPTR (see __buf_prepare for the details), which
would allow a race with a REQBUFS which can free the buffers. Removing the
buffers from underneath __buf_prepare is obviously a bad idea, so we
check if any of the buffers is in the state PREPARING, and if so we
just return -EAGAIN.
If this happens, then the application does something really strange. The
REQBUFS call can be retried safely, since this situation is transient.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Fri, 13 Dec 2013 16:13:39 +0000 (13:13 -0300)]
[media] vb2: simplify qbuf/prepare_buf by removing callback
The callback used to merge the common code of the qbuf/prepare_buf
code can be removed now that the mmap_sem handling is pushed down to
__buf_prepare(). This makes the code more readable.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Mauro Carvalho Chehab [Tue, 7 Jan 2014 09:03:09 +0000 (07:03 -0200)]
[media] videobuf2: Fix CodingStyle
Changeset
b18a8ff29d80 added a comment violating the 80cols max size,
with no good reason.
Fix it.
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Fri, 13 Dec 2013 16:13:38 +0000 (13:13 -0300)]
[media] vb2: push the mmap semaphore down to __buf_prepare()
Rather than taking the mmap semaphore at a relatively high-level function,
push it down to the place where it is really needed.
It was placed in vb2_queue_or_prepare_buf() to prevent racing with other
vb2 calls. The only way I can see that a race can happen is when two
threads queue the same buffer. The solution for that it to introduce
a PREPARING state.
Moving it down offers opportunities to simplify the code.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Archit Taneja [Thu, 12 Dec 2013 08:36:04 +0000 (05:36 -0300)]
[media] v4l: ti-vpe: Add a type specifier to describe vpdma data format type
The struct vpdma_data_format holds the color format depth and the data_type
value needed to be programmed in the data descriptors. However, it doesn't
tell what type of color format is it, i.e, whether it is RGB, YUV or Misc.
This information is needed when by vpdma library when forming descriptors. We
modify the depth parameter for the chroma portion of the NV12 format. For this,
we check if the data_type value is C420. This isn't sufficient as there are
many YUV and RGB vpdma formats which have the same data_type value. Hence, we
need to hold the type of the color format for the above case, and possibly more
cases in the future.
Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Archit Taneja [Thu, 12 Dec 2013 08:36:03 +0000 (05:36 -0300)]
[media] v4l: ti-vpe: enable CSC support for VPE
Use the csc library functions to configure the CSC block in VPE.
Some changes are required in try_fmt to handle the pix->colorspace parameter
more correctly. Previously, we copied the source queue colorspace to the
destination queue colorspace as we didn't support RGB formats. Now, we configure
pix->colorspace based on the color format set(and the height of the image if
it's a YUV format).
Add basic RGB color formats to the list of supported vpe formats.
If the destination format is RGB colorspace, we also need to use the RGB output
port instead of the Luma and Chroma output ports. This requires configuring the
output data descriptors differently.
Also, make the default colorspace V4L2_COLORSPACE_SMPTE170M as that resembles
the Standard Definition colorspace more closely.
Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Archit Taneja [Thu, 12 Dec 2013 08:36:02 +0000 (05:36 -0300)]
[media] v4l: ti-vpe: Add helper to perform color conversion
The CSC block can be used for color space conversion between YUV and RGB
formats.
It is configurable via a programmable set of coefficients. Add functionality to
choose the appropriate CSC coefficients and program them in the CSC registers.
We take the source and destination colorspace formats as the arguments, and
choose the coefficient table accordingly.
YUV to RGB coefficients are provided for standard and high definition
colorspaces. The coefficients can also be limited or full range. For now, only
full range coefficients are chosen. We would need some sort of control ioctl for
the user to specify the range needed. Not sure if there is a generic control
ioctl for this already?
Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Archit Taneja [Thu, 12 Dec 2013 08:36:01 +0000 (05:36 -0300)]
[media] v4l: ti-vpe: create a color space converter block library
VPE and VIP IPs in DAR7x contain a color space converter(CSC) sub block. Create
a library which will perform CSC related configurations and hold CSC register
definitions. The functions provided by this library will be called by the vpe
and vip drivers using a csc_data handle.
The vpe_dev holds the csc_data handle. The handle represents an instance of the
CSC hardware, and the vpe driver uses it to access the CSC register offsets or
helper functions to configure these registers.
The CSC register offsets are now relative to the CSC block itself, so we need
to use the macro GET_OFFSET_TOP to get the CSC register offset relative to the
VPE IP in the vpe driver.
Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Archit Taneja [Thu, 12 Dec 2013 08:36:00 +0000 (05:36 -0300)]
[media] v4l: ti-vpe: enable basic scaler support
Add the required SC register configurations which lets us perform linear scaling
for the supported range of horizontal and vertical scaling ratios.
The horizontal scaler performs polyphase scaling using it's 8 tap 32 phase
filter, decimation is performed when downscaling passes beyond 2x or 4x.
The vertical scaler performs polyphase scaling using it's 5 tap 32 phase filter,
it switches to a simpler form of scaling using the running average filter when
the downscale ratio is more than 4x.
Many of the SC features like peaking, trimming and non-linear scaling aren't
implemented for now. Only the minimal register fields required for basic scaling
operation are configured.
The function to configure SC registers takes the sc_data handle, the source and
destination widths and heights, and the scaler address data block offsets for
the current context so that they can be configured.
Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Archit Taneja [Thu, 12 Dec 2013 08:35:59 +0000 (05:35 -0300)]
[media] v4l: ti-vpe: make vpe driver load scaler coefficients
Make the driver allocate dma buffers to store horizontal and scaler coeffs.
Use the scaler library api to choose and copy scaler coefficients to a
the above buffers based on the scaling ratio. Since the SC block comes after
the de-interlacer, make sure that the source height is doubled if de-interlacer
was used.
These buffers now need to be used by VPDMA to load the coefficients into the
SRAM within SC.
In device_run, add configuration descriptors which have payloads pointing to
the scaler coefficients in memory. Use the members in sc_data handle to prevent
addition of these descriptors if there isn't a need to re-load coefficients into
SC. This comes helps unnecessary re-loading of the coefficients when we switch
back and forth between vpe contexts.
Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Archit Taneja [Thu, 12 Dec 2013 08:35:58 +0000 (05:35 -0300)]
[media] v4l: ti-vpe: support loading of scaler coefficients
The SC block in VPE/VIP contains a SRAM within it. This internal memory
requires to be loaded with appropriate scaler coefficients from a contiguous
block of memory through VPDMA.
The horizontal and vertical scaler each require 2 sets of scaler coefficients
for luma and chroma scaling. The horizontal polyphase scaler requires
coefficients for a 32 phase and 8 tap filter. Similarly, the vertical scaler
requires coefficients for a 5 tap filter.
The choice of the scaler coefficients depends on the scaling ratio. Add
coefficient tables for different scaling ratios in sc_coeffs.h. In the case of
horizontal downscaling, we need to consider the change in ratio caused by
decimation performed by the horizontal scaler.
In order to load the scaler coefficients via VPDMA, a configuration descriptor
is used in block mode. The payload for the descriptor is the scaler coefficients
copied to memory. Coefficients for each phase have to be placed in memory in a
particular order understood by the scaler hardware.
The choice of the scaler coefficients, and the loading of the coefficients from
our tables to a contiguous buffer is managed by the functions
sc_set_hs_coefficients and sc_set_vs_coefficients.
The sc_data handle is now added with some parameters to describe the state of
the coefficients loaded in the SC block. 'loaded_coeff_h' and 'loaded_coeff_v'
hold the address of the last dma buffer which was used by VPDMA to copy
coefficients. This information can be used by a vpe mem-to-mem context to decide
whether it should load coefficients or not. 'hs_index' and 'vs_index' provide
some optimization by preventing loading of coefficients if the scaling ratio
didn't change between 2 contexts. 'load_coeff_h' and 'load_coeff_v' tell the
vpe/vip driver whether we need to load the coefficients through VPDMA or not.
Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Archit Taneja [Thu, 12 Dec 2013 08:35:57 +0000 (05:35 -0300)]
[media] v4l: ti-vpe: create a scaler block library
VPE and VIP IPs in DAR7x contain a scaler(SC) sub block. Create a library which
will perform scaler block related configurations and hold SC register
definitions. The functions provided by this library will be called by the vpe
and vip drivers using a sc_data handle.
The vpe_dev holds the sc_data handle. The handle represents an instance of the
SC hardware, and the vpe driver uses it to access the scaler register offsets
or helper functions to configure these registers.
We move the SC register definitions to sc.h so that they aren't specific to
VPE anymore. The register offsets are now relative to the sub-block, and not the
VPE IP as a whole. In order for VPDMA to configure registers, it requires it's
offset from the top level VPE module. A macro called GET_OFFSET_TOP is added to
return the offset of the register relative to the VPE IP.
Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Mon, 16 Dec 2013 08:45:37 +0000 (05:45 -0300)]
[media] v4l2: move tracepoints to video_usercopy
The (d)qbuf ioctls were traced in the low-level v4l2 ioctl function. The
trace was outside the serialization lock, so that can affect the usefulness
of the timing. In addition, the __user pointer was expected instead of a
proper kernel pointer.
By moving the tracepoints to video_usercopy we ensure that the trace calls
use the correct kernel pointer, and that it happens right after the ioctl
call to the driver, so certainly inside the serialization lock.
In addition, we only trace if the call was successful.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Wade Farnsworth <wade_farnsworth@mentor.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Antonio Ospite [Mon, 16 Dec 2013 08:16:46 +0000 (05:16 -0300)]
[media] Documentation/DocBook/media/v4l: fix typo, s/packet/packed/
Change "packet" to "packed" where the doc is talking about packed data
formats.
Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Antonio Ospite [Mon, 16 Dec 2013 08:16:45 +0000 (05:16 -0300)]
[media] Documentation/DocBook/media/v4l/subdev-formats.xml: fix a typo
The xref to the v4l2-mbus-pixelcode-yuv8 table gets rendered as "Table
4.22, “YUV Formats”", so use the verb in the third person singular
because it refers to "Table":
s/list/lists/
Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Matthias Schwarzott [Thu, 12 Dec 2013 20:41:10 +0000 (17:41 -0300)]
[media] cx231xx: fix i2c debug prints
Do not shift the already 7bit i2c address.
Print a message also for write+read transactions.
For write+read, print the read buffer correctly instead of using the write
buffer.
Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Matthias Schwarzott [Thu, 12 Dec 2013 20:41:09 +0000 (17:41 -0300)]
[media] cx231xx: Add missing selects for MEDIA_SUBDRV_AUTOSELECT
The two drivers LGDT3305 and TDA18271C2DD were not autoselected, so the
cx231xx_dvb module could not be loaded when MEDIA_SUBDRV_AUTOSELECT=y.
Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Wei Yongjun [Thu, 12 Dec 2013 06:49:54 +0000 (03:49 -0300)]
[media] radio-bcm2048: fix missing unlock on error in bcm2048_rds_fifo_receive()
Add the missing unlock before return from function bcm2048_rds_fifo_receive()
in the error handling case.
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Fri, 20 Dec 2013 09:15:13 +0000 (06:15 -0300)]
[media] adv7842: add drive strength enum and sync names with adv7604
Add a proper driver strength enum and use the same names in the platform
data as with adv7604.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Tue, 17 Dec 2013 13:09:51 +0000 (10:09 -0300)]
[media] adv7842: initialize timings to CEA 640x480p59.94
This timing must be supported by all HDMI equipment, so that's a
reasonable default.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Hans Verkuil [Fri, 20 Dec 2013 09:03:58 +0000 (06:03 -0300)]
[media] adv7842: set LLC DLL phase from platform_data
The correct LLC DLL phase depends on the board layout, so this
should be part of the platform_data.
Also updated the platform_data in ezkit to ensure that what was the old
default value is now explicitly specified, so the behavior for that board
is unchanged.
Tested-by: Martin Bugge <marbugge@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Scott Jiang <scott.jiang.linux@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Martin Bugge [Thu, 12 Dec 2013 13:10:57 +0000 (10:10 -0300)]
[media] adv7842: return 0 if no change in s_dv_timings
Return 0 if the new timings are equal to the current timings as
it caused extra cp-loss/lock interrupts.
Signed-off-by: Martin Bugge <marbugge@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Martin Bugge [Thu, 5 Dec 2013 15:22:53 +0000 (12:22 -0300)]
[media] adv7842: Composite sync adjustment
Signed-off-by: Martin Bugge <marbugge@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Martin Bugge [Fri, 20 Dec 2013 09:02:24 +0000 (06:02 -0300)]
[media] adv7842: obtain free-run mode from the platform_data
The free-run mode can be board-specific.
Also updated the platform_data in ezkit to ensure that what was the old
default value is now explicitly specified, so the behavior for that board
is unchanged.
Signed-off-by: Martin Bugge <marbugge@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Scott Jiang <scott.jiang.linux@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Martin Bugge [Thu, 5 Dec 2013 15:18:14 +0000 (12:18 -0300)]
[media] adv7842: composite sd-ram test, clear timings before setting
Must clear timings before setting after test to recover.
Signed-off-by: Martin Bugge <marbugge@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Martin Bugge [Tue, 10 Dec 2013 15:01:59 +0000 (12:01 -0300)]
[media] adv7842: enable HDMI/DVI mode irq
Signed-off-by: Martin Bugge <marbugge@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Martin Bugge [Thu, 5 Dec 2013 15:14:45 +0000 (12:14 -0300)]
[media] adv7842: i2c dummy clients registration
Clear i2c_clients ptr when unregistered.
Warn if configured i2c-addr is zero.
Signed-off-by: Martin Bugge <marbugge@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>