platform/kernel/linux-3.10.git
9 years agoupstream: [media] em28xx-audio: allocate URBs at device driver init
Mauro Carvalho Chehab [Sun, 29 Dec 2013 00:16:26 +0000 (21:16 -0300)]
upstream: [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>
9 years agoupstream: [media] em28xx: use usb_alloc_coherent() for audio
Mauro Carvalho Chehab [Sat, 28 Dec 2013 14:47:16 +0000 (11:47 -0300)]
upstream: [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>
9 years agoupstream: [media] cx231xx: add support for a CX23103 Video Grabber USB
Links (Markus) [Sat, 4 Jan 2014 22:44:34 +0000 (19:44 -0300)]
upstream: [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>
9 years agoupstream: [media] vb2: Fix comment in __qbuf_dmabuf
Laurent Pinchart [Wed, 1 Jan 2014 12:10:48 +0000 (09:10 -0300)]
upstream: [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>
9 years agoupstream: [media] m88rs2000: Correct m88rs2000_get_fec
Malcolm Priestley [Sat, 28 Dec 2013 17:04:51 +0000 (14:04 -0300)]
upstream: [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>
9 years agoupstream: [media] m88rs2000: Correct m88rs2000_set_fec settings
Malcolm Priestley [Sat, 28 Dec 2013 17:02:44 +0000 (14:02 -0300)]
upstream: [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>
9 years agoupstream: [media] m88rs2000: correct read status lock value
Malcolm Priestley [Sat, 28 Dec 2013 17:00:40 +0000 (14:00 -0300)]
upstream: [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>
9 years agoupstream: [media] e4000: fix error return code
Julia Lawall [Sun, 29 Dec 2013 22:47:35 +0000 (19:47 -0300)]
upstream: [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>
9 years agoupstream: [media] ec168: fix error return code
Julia Lawall [Sun, 29 Dec 2013 22:47:18 +0000 (19:47 -0300)]
upstream: [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>
9 years agoupstream: [media] as102: fix leaks at failure paths in as102_usb_probe()
Alexey Khoroshilov [Fri, 27 Dec 2013 21:18:39 +0000 (18:18 -0300)]
upstream: [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>
9 years agoupstream: [media] cx231xx: Add missing KERN_CONT to i2c debug prints
Matthias Schwarzott [Mon, 23 Dec 2013 11:12:21 +0000 (08:12 -0300)]
upstream: [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>
9 years agoupstream: [media] omap3isp: ccdc: Don't hang when the SBL fails to become idle
Laurent Pinchart [Mon, 9 Dec 2013 14:13:13 +0000 (11:13 -0300)]
upstream: [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>
9 years agoupstream: [media] omap3isp: Refactor modules stop failure handling
Laurent Pinchart [Mon, 16 Dec 2013 02:49:42 +0000 (23:49 -0300)]
upstream: [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>
9 years agoupstream: [media] omap3isp: Cancel streaming when a fatal error occurs
Laurent Pinchart [Mon, 9 Dec 2013 14:36:51 +0000 (11:36 -0300)]
upstream: [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>
9 years agoupstream: [media] export em28xx_release_resources() symbol
Mauro Carvalho Chehab [Tue, 7 Jan 2014 10:05:01 +0000 (08:05 -0200)]
upstream: [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>
9 years agoupstream: [media] media: Remove OOM message after input_allocate_device
Joe Perches [Wed, 23 Oct 2013 19:14:51 +0000 (16:14 -0300)]
upstream: [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>
9 years agoupstream: [media] fix coccinelle warnings
Fengguang Wu [Fri, 20 Dec 2013 10:16:47 +0000 (07:16 -0300)]
upstream: [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>
9 years agoupstream: [media] fix coccinelle warnings
Fengguang Wu [Fri, 20 Dec 2013 10:16:42 +0000 (07:16 -0300)]
upstream: [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>
9 years agoupstream: [media] saa7134: don't set vfd->debug
Hans Verkuil [Sat, 14 Dec 2013 11:28:37 +0000 (08:28 -0300)]
upstream: [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>
9 years agoupstream: [media] saa6588: add support for non-blocking mode
Hans Verkuil [Sat, 14 Dec 2013 11:28:36 +0000 (08:28 -0300)]
upstream: [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>
9 years agoupstream: [media] saa6588: remove unused CMD_OPEN
Hans Verkuil [Sat, 14 Dec 2013 11:28:35 +0000 (08:28 -0300)]
upstream: [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>
9 years agoupstream: [media] saa6752hs: drop compat control code
Hans Verkuil [Sat, 14 Dec 2013 11:28:30 +0000 (08:28 -0300)]
upstream: [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>
9 years agoupstream: [media] saa7134: use V4L2_IN_ST_NO_SIGNAL instead of NO_SYNC
Hans Verkuil [Sat, 14 Dec 2013 11:28:29 +0000 (08:28 -0300)]
upstream: [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>
9 years agoupstream: [media] DocBook: drop the word 'only'
Hans Verkuil [Fri, 13 Dec 2013 16:13:46 +0000 (13:13 -0300)]
upstream: [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>
9 years agoupstream: [media] vb2: Improve file I/O emulation to handle buffers in any order
Hans Verkuil [Fri, 13 Dec 2013 16:13:45 +0000 (13:13 -0300)]
upstream: [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>
9 years agoupstream: [media] vb2: return ENOBUFS in start_streaming in case of too few buffers
Hans Verkuil [Fri, 13 Dec 2013 16:13:44 +0000 (13:13 -0300)]
upstream: [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>
9 years agoupstream: [media] vb2: don't set index, don't start streaming for write()
Hans Verkuil [Fri, 13 Dec 2013 16:13:43 +0000 (13:13 -0300)]
upstream: [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>
9 years agoupstream: [media] vb2: retry start_streaming in case of insufficient buffers
Hans Verkuil [Fri, 13 Dec 2013 16:13:42 +0000 (13:13 -0300)]
upstream: [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>
9 years agoupstream: [media] vb2: remove the 'fileio = NULL' hack
Hans Verkuil [Fri, 13 Dec 2013 16:13:41 +0000 (13:13 -0300)]
upstream: [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>
9 years agoupstream: [media] vb2: fix race condition between REQBUFS and QBUF/PREPARE_BUF
Hans Verkuil [Fri, 13 Dec 2013 16:13:40 +0000 (13:13 -0300)]
upstream: [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>
9 years agoupstream: [media] vb2: simplify qbuf/prepare_buf by removing callback
Hans Verkuil [Fri, 13 Dec 2013 16:13:39 +0000 (13:13 -0300)]
upstream: [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>
9 years agoupstream: [media] videobuf2: Fix CodingStyle
Mauro Carvalho Chehab [Tue, 7 Jan 2014 09:03:09 +0000 (07:03 -0200)]
upstream: [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>
9 years agoupstream: [media] vb2: push the mmap semaphore down to __buf_prepare()
Hans Verkuil [Fri, 13 Dec 2013 16:13:38 +0000 (13:13 -0300)]
upstream: [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>
9 years agoupstream: [media] v4l: ti-vpe: Add a type specifier to describe vpdma data format...
Archit Taneja [Thu, 12 Dec 2013 08:36:04 +0000 (05:36 -0300)]
upstream: [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>
9 years agoupstream: [media] Documentation/DocBook/media/v4l: fix typo, s/packet/packed/
Antonio Ospite [Mon, 16 Dec 2013 08:16:46 +0000 (05:16 -0300)]
upstream: [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>
9 years agoupstream: [media] Documentation/DocBook/media/v4l/subdev-formats.xml: fix a typo
Antonio Ospite [Mon, 16 Dec 2013 08:16:45 +0000 (05:16 -0300)]
upstream: [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>
9 years agoupstream: [media] cx231xx: fix i2c debug prints
Matthias Schwarzott [Thu, 12 Dec 2013 20:41:10 +0000 (17:41 -0300)]
upstream: [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>
9 years agoupstream: [media] cx231xx: Add missing selects for MEDIA_SUBDRV_AUTOSELECT
Matthias Schwarzott [Thu, 12 Dec 2013 20:41:09 +0000 (17:41 -0300)]
upstream: [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>
9 years agoupstream: [media] adv7604: return immediately if the new timings are equal to what...
Mats Randgaard [Thu, 12 Dec 2013 13:13:35 +0000 (10:13 -0300)]
upstream: [media] adv7604: return immediately if the new timings are equal to what is configured

Signed-off-by: Mats Randgaard <matrandg@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] adv7604: set restart_stdi_once flag when signal is lost
Martin Bugge [Thu, 5 Dec 2013 13:34:46 +0000 (10:34 -0300)]
upstream: [media] adv7604: set restart_stdi_once flag when signal is lost

If the restart_stdi_once trick fails to find a valid
format the flag was never reset.

Signed-off-by: Martin Bugge <marbugge@cisco.com>
Cc: Mats Randgaard <matrandg@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] adv7604: adv7604_s_register clean up
Hans Verkuil [Tue, 10 Dec 2013 13:02:43 +0000 (10:02 -0300)]
upstream: [media] adv7604: adv7604_s_register clean up

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] adv7604: support 1366x768 DMT Reduced Blanking
Martin Bugge [Thu, 5 Dec 2013 13:01:17 +0000 (10:01 -0300)]
upstream: [media] adv7604: support 1366x768 DMT Reduced Blanking

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>
9 years agoupstream: [media] adv7511: verify EDID header
Martin Bugge [Tue, 17 Dec 2013 12:17:10 +0000 (09:17 -0300)]
upstream: [media] adv7511: verify EDID header

Ignore EDID's where the header is wrong.

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>
9 years agoupstream: [media] adv7511: add VIC and audio CTS/N values to log_status
Martin Bugge [Thu, 5 Dec 2013 12:06:29 +0000 (09:06 -0300)]
upstream: [media] adv7511: add VIC and audio CTS/N values to log_status

Improve status logging.

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>
9 years agoupstream: [media] adv7511: disable register reset by HPD
Martin Bugge [Thu, 5 Dec 2013 12:02:20 +0000 (09:02 -0300)]
upstream: [media] adv7511: disable register reset by HPD

Whenever the hotplug pin is pulled low the chip resets a whole bunch
of registers. It turns out that this can be turned off on the adv7511.
Do so, as this 'feature' introduces race conditions in setting up
registers, particular when the hotplug pin bounces a lot.

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>
9 years agoupstream: [media] ad9389b: retry setup if the state is inconsistent
Martin Bugge [Tue, 10 Dec 2013 12:00:05 +0000 (09:00 -0300)]
upstream: [media] ad9389b: retry setup if the state is inconsistent

Retry setup if the device is powered off when it should be powered on. This
state can be caused by rapid hotplug toggles.

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>
9 years agoupstream: [media] ad9389b: remove rx-sense irq dependency
Martin Bugge [Tue, 10 Dec 2013 11:58:13 +0000 (08:58 -0300)]
upstream: [media] ad9389b: remove rx-sense irq dependency

Removed dependency on rx-sense interrupt, it's a leftover from obsolete
code. Removing this simplifies the code.

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>
9 years agoupstream: [media] ad9389b: whitespace changes to improve readability
Martin Bugge [Thu, 5 Dec 2013 10:55:42 +0000 (07:55 -0300)]
upstream: [media] ad9389b: whitespace changes to improve readability

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>
9 years agoupstream: [media] ad9389b: verify EDID header
Mats Randgaard [Thu, 5 Dec 2013 10:33:08 +0000 (07:33 -0300)]
upstream: [media] ad9389b: verify EDID header

Ignore EDIDs where the header is wrong.

Signed-off-by: Mats Randgaard <matrandg@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] em28xx: only initialize extensions on the main interface
Mauro Carvalho Chehab [Mon, 6 Jan 2014 08:50:07 +0000 (05:50 -0300)]
upstream: [media] em28xx: only initialize extensions on the main interface

For devices with a separated audio-only interface (em2860), call
em28xx_init_extension() only once.

That fixes a bug with Kworld 305U (eb1a:e305):

    [  658.730715] em2860 #0: V4L2 video device registered as video1
    [  658.730728] em2860 #0: V4L2 VBI device registered as vbi0
    [  658.736907] em2860 #0: Remote control support is not available for this card.
    [  658.736965] em2860 #1: Remote control support is not available for this card.
    [  658.737230] ------------[ cut here ]------------
    [  658.737246] WARNING: CPU: 2 PID: 60 at lib/list_debug.c:36 __list_add+0x8a/0xc0()
    [  658.737256] list_add double add: new=ffff8800a9a40410, prev=ffff8800a9a40410, next=ffffffffa08720d0.
    [  658.737266] Modules linked in: tuner_xc2028 netconsole rc_hauppauge em28xx_rc rc_core tuner_simple tuner_types tda9887 tda8290 tuner tvp5150 msp3400 em28xx_v4l em28xx tveeprom
 v4l2_common fuse ccm nf_conntrack_netbios_ns nf_conntrack_broadcast ipt_MASQUERADE ip6t_REJECT xt_conntrack ebtable_nat ebtable_broute bridge stp llc ebtable_filter ebtables ip6tabl
e_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_security ip6table_raw ip6table_filter ip6_tables iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4
nf_nat nf_conntrack iptable_mangle iptable_security bnep iptable_raw vfat fat arc4 iwldvm mac80211 x86_pkg_temp_thermal coretemp kvm_intel nfsd iwlwifi snd_hda_codec_hdmi kvm snd_hda
_codec_realtek snd_hda_intel snd_hda_codec auth_rpcgss nfs_acl cfg80211 lockd snd_hwdep snd_seq btusb sunrpc crc32_pclmul bluetooth crc32c_intel snd_seq_device snd_pcm uvcvideo r8169
 ghash_clmulni_intel videobuf2_vmalloc videobuf2_memops videobuf2_core snd_page_alloc snd_timer snd videodev mei_me iTCO_wdt mii shpchp joydev mei media iTCO_vendor_support lpc_ich m
icrocode soundcore rfkill serio_raw i2c_i801 mfd_core nouveau i915 ttm i2c_algo_bit drm_kms_helper drm i2c_core mxm_wmi wmi video
    [  658.738601] CPU: 2 PID: 60 Comm: kworker/2:1 Not tainted 3.13.0-rc1+ #18
    [  658.738611] Hardware name: SAMSUNG ELECTRONICS CO., LTD. 550P5C/550P7C/SAMSUNG_NP1234567890, BIOS P04ABI.013.130220.dg 02/20/2013
    [  658.738624] Workqueue: events request_module_async [em28xx]
    [  658.738646]  0000000000000009 ffff8802209dfc68 ffffffff816a3c96 ffff8802209dfcb0
    [  658.738700]  ffff8802209dfca0 ffffffff8106aaad ffff8800a9a40410 ffffffffa08720d0
    [  658.738754]  ffff8800a9a40410 0000000000000000 0000000000000080 ffff8802209dfd00
    [  658.738814] Call Trace:
    [  658.738836]  [<ffffffff816a3c96>] dump_stack+0x45/0x56
    [  658.738851]  [<ffffffff8106aaad>] warn_slowpath_common+0x7d/0xa0
    [  658.738864]  [<ffffffff8106ab1c>] warn_slowpath_fmt+0x4c/0x50
    [  658.738880]  [<ffffffffa0868a7d>] ? em28xx_init_extension+0x1d/0x80 [em28xx]
    [  658.738898]  [<ffffffff81343b8a>] __list_add+0x8a/0xc0
    [  658.738911]  [<ffffffffa0868a98>] em28xx_init_extension+0x38/0x80 [em28xx]
    [  658.738927]  [<ffffffffa086a059>] request_module_async+0x19/0x110 [em28xx]
    [  658.738942]  [<ffffffff810873b5>] process_one_work+0x1f5/0x510
    [  658.738954]  [<ffffffff81087353>] ? process_one_work+0x193/0x510
    [  658.738967]  [<ffffffff810880bb>] worker_thread+0x11b/0x3a0
    [  658.738979]  [<ffffffff81087fa0>] ? manage_workers.isra.24+0x2b0/0x2b0
    [  658.738992]  [<ffffffff8108ea2f>] kthread+0xff/0x120
    [  658.739005]  [<ffffffff8108e930>] ? kthread_create_on_node+0x250/0x250
    [  658.739017]  [<ffffffff816b517c>] ret_from_fork+0x7c/0xb0
    [  658.739029]  [<ffffffff8108e930>] ? kthread_create_on_node+0x250/0x250
    [  658.739040] ---[ end trace c1acd24b354108de ]---
    [  658.739051] em2860 #1: Remote control support is not available for this card.
    [  658.742407] em28xx-audio.c: probing for em28xx Audio Vendor Class
    [  658.742429] em28xx-audio.c: Copyright (C) 2006 Markus Rechberger
    [  658.742440] em28xx-audio.c: Copyright (C) 2007-2011 Mauro Carvalho Chehab
    [  658.744798] em28xx-audio.c: probing for em28xx Audio Vendor Class
    [  658.744823] em28xx-audio.c: Copyright (C) 2006 Markus Rechberger
    [  658.744836] em28xx-audio.c: Copyright (C) 2007-2011 Mauro Carvalho Chehab
    [  658.746849] em28xx-audio.c: probing for em28xx Audio Vendor Class
    [  658.746863] em28xx-audio.c: Copyright (C) 2006 Markus Rechberger
    [  658.746874] em28xx-audio.c: Copyright (C) 2007-2011 Mauro Carvalho Chehab
    ...

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] em28xx: prevent registering wrong interfaces for audio-only
Mauro Carvalho Chehab [Mon, 6 Jan 2014 08:27:47 +0000 (05:27 -0300)]
upstream: [media] em28xx: prevent registering wrong interfaces for audio-only

A few devices (em2860) use a separate interface for audio only
Audio Vendor Class USB. That interface should not be used by
Remote Controller, Analog TV or Digital TV.

Prevents initializing all non-audio extensions for the audio
only interface.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] em28xx: unify module version
Mauro Carvalho Chehab [Fri, 27 Dec 2013 14:14:59 +0000 (11:14 -0300)]
upstream: [media] em28xx: unify module version

Use the same module version on all em28xx sub-modules, and use
the same naming convention to describe the driver.

Reviewed-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] em28xx: check if a device has audio earlier
Mauro Carvalho Chehab [Fri, 27 Dec 2013 03:16:13 +0000 (00:16 -0300)]
upstream: [media] em28xx: check if a device has audio earlier

Better to split chipset detection from the audio setup. So, move the
detection code to em28xx_init_dev().

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] em28xx: improve extension information messages
Mauro Carvalho Chehab [Thu, 26 Dec 2013 15:41:03 +0000 (12:41 -0300)]
upstream: [media] em28xx: improve extension information messages

Add a message with consistent prints before and after each
extension initialization, and provide a better text for module
load.

While here, add a missing sanity check for extension finish
code at em28xx-v4l extension.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] em28xx: make em28xx-video to be a separate module
Mauro Carvalho Chehab [Sun, 22 Dec 2013 16:27:02 +0000 (13:27 -0300)]
upstream: [media] em28xx: make em28xx-video to be a separate module

Now that all analog-specific code are at em28xx-video, convert
it into an em28xx extension and load it as a separate module.

Reviewed-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Tested-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] em28xx: unregister i2c bus 0 if bus 1 fails to register
Mauro Carvalho Chehab [Sun, 5 Jan 2014 11:43:40 +0000 (08:43 -0300)]
upstream: [media] em28xx: unregister i2c bus 0 if bus 1 fails to register

Fix the error handling logic, making it to unregister i2c bus 0, in
case of a failure to register the second bus.

Reported-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] em28xx: move analog-specific init to em28xx-video
Mauro Carvalho Chehab [Sun, 22 Dec 2013 16:16:49 +0000 (13:16 -0300)]
upstream: [media] em28xx: move analog-specific init to em28xx-video

There are several init code inside em28xx-cards that are actually
part of analog initialization. Move the code to em28x-video, in
order to remove part of the mess.

In thesis, no functional changes so far.

Reviewed-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] em28xx: Fix em28xx deplock
Mauro Carvalho Chehab [Fri, 27 Dec 2013 16:01:04 +0000 (13:01 -0300)]
upstream: [media] em28xx: Fix em28xx deplock

When em28xx extensions are loaded/removed, there are two locks:

a single static em28xx_devlist_mutex that registers each extension
and the struct em28xx dev->lock.

When extensions are registered, em28xx_devlist_mutex is taken first,
and then dev->lock.

Be sure that, when extensions are being removed, the same order
will be used.

Reviewed-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] em28xx: some cosmetic changes
Mauro Carvalho Chehab [Sun, 22 Dec 2013 16:13:41 +0000 (13:13 -0300)]
upstream: [media] em28xx: some cosmetic changes

In order to make easier for the next patches, do some
cosmetic changes.

No functional changes.

Reviewed-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] em28xx: move some video-specific functions to em28xx-video
Mauro Carvalho Chehab [Sun, 22 Dec 2013 18:28:26 +0000 (15:28 -0300)]
upstream: [media] em28xx: move some video-specific functions to em28xx-video

Now that we want to split the video handling to a separate
module, move all video-specific functions to em28xx-video.

No functional changes.

Reviewed-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] tuner-xc2028: remove unused code
Mauro Carvalho Chehab [Fri, 27 Dec 2013 02:07:59 +0000 (23:07 -0300)]
upstream: [media] tuner-xc2028: remove unused code

This macro is not used. remove it.

Reviewed-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] tvp5150: make read operations atomic
Mauro Carvalho Chehab [Fri, 27 Dec 2013 02:07:22 +0000 (23:07 -0300)]
upstream: [media] tvp5150: make read operations atomic

Instead of using two I2C operations between write and read,
use just one i2c_transfer. That allows I2C mutexes to not
let any other I2C transfer between the two.

Reviewed-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Tested-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] v4l: omap4iss: Restore irq flags correctly in omap4iss_video_buffer...
Dan Carpenter [Wed, 18 Dec 2013 07:29:24 +0000 (04:29 -0300)]
upstream: [media] v4l: omap4iss: Restore irq flags correctly in omap4iss_video_buffer_next()

The spin_lock_irqsave() macro is not nestable.  The second call will
overwrite the first record of "flags" so the IRQs will not be enabled
correctly at the end of the function.

In the current code, this function is always called from the IRQ handler
so everything works fine and this fix doesn't change anything.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] v4l: omap4iss: use snprintf() to make smatch happy
Dan Carpenter [Mon, 16 Dec 2013 20:19:50 +0000 (17:19 -0300)]
upstream: [media] v4l: omap4iss: use snprintf() to make smatch happy

Smatch complains here because name is a 32 character buffer and we
adding the "OMAP4 ISS " prefix as well for a total of 42 characters.
The sd->name buffer can only hold 32 characters.  I've changed it to use
snprintf() to silence the overflow warning.

Also I have removed the call to strlcpy() which is a no-op.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] em28xx: reduce the polling interval for GPI connected buttons
Frank Schaefer [Sat, 14 Dec 2013 09:40:11 +0000 (06:40 -0300)]
upstream: [media] em28xx: reduce the polling interval for GPI connected buttons

For GPI-connected buttons without (hardware) debouncing, the polling interval
needs to be reduced to detect button presses properly.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] Add USB IDs for Winfast DTV Dongle Mini-D
Robert Backhaus [Fri, 13 Dec 2013 12:59:10 +0000 (09:59 -0300)]
upstream: [media] Add USB IDs for Winfast DTV Dongle Mini-D

GIT_AUTHOR_DATE=1386943312
    Add USB IDs for the WinFast DTV Dongle Mini.
    Device is tested and works fine under MythTV

Signed-off-by: Robert Backhaus <robbak@robbak.com>
Acked-by: Antti Palosaari <crope@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] m88ts2022: fix some style issues reported by checkpatch.pl
Antti Palosaari [Wed, 18 Dec 2013 15:46:45 +0000 (12:46 -0300)]
upstream: [media] m88ts2022: fix some style issues reported by checkpatch.pl

Latest checkpatch.pl has some new requirements for coding style.
Fix some of those.

* remove Free Software Foundation postal address
* use sizeof(*foo), not sizeof(struct foo)

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] m88ds3103: fix some style issues reported by checkpatch.pl
Antti Palosaari [Wed, 18 Dec 2013 15:38:42 +0000 (12:38 -0300)]
upstream: [media] m88ds3103: fix some style issues reported by checkpatch.pl

* remove Free Software Foundation postal address
* add one pair of parenthesis
* use sizeof(*foo), not sizeof(struct foo)

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] m88ds3103: I/O optimize inittab write
Antti Palosaari [Mon, 2 Dec 2013 17:08:53 +0000 (14:08 -0300)]
upstream: [media] m88ds3103: I/O optimize inittab write

Write inittab using reg address auto-increment in order to reduce
I/O a little bit.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] m88ds3103: add default value for reg 56
Antti Palosaari [Mon, 2 Dec 2013 16:38:53 +0000 (13:38 -0300)]
upstream: [media] m88ds3103: add default value for reg 56

Reg 0x56 should be programmed to 0x01. Add default to inittab.

Reported-by: David Howells <dhowells@redhat.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] m88ds3103: remove unneeded AGC from inittab
Antti Palosaari [Mon, 2 Dec 2013 16:11:21 +0000 (13:11 -0300)]
upstream: [media] m88ds3103: remove unneeded AGC from inittab

Optimal AGC is highly depended on used RF tuner and due to that
it is already included to chip configuration. However, inittab
has default AGC value, which was later replaced by one from config.

Add also comment to all chip configuration options about default
values and if those are needed to set or not.

Reported-by: David Howells <dhowells@redhat.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] m88ts2022: reimplement synthesizer calculations
Antti Palosaari [Mon, 2 Dec 2013 04:39:24 +0000 (01:39 -0300)]
upstream: [media] m88ts2022: reimplement synthesizer calculations

Used synthesizer is very typical integer-N PLL, with configurable
reference frequency divider, output frequency divider and of
course N itself. Most common method to calculate values is first
select output divider, then calculate VCO frequency and finally
calculate PLL N from VCO frequency. Do it that way.

Also make some cleanups for filter logic and signal strength.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] m88ds3103: fix TS mode config
Antti Palosaari [Wed, 20 Nov 2013 02:06:39 +0000 (23:06 -0300)]
upstream: [media] m88ds3103: fix TS mode config

TS mode was configured wrongly.

Reported-by: David Howells <dhowells@redhat.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] m88ds3103: use kernel macro to round division
Antti Palosaari [Wed, 20 Nov 2013 01:37:55 +0000 (22:37 -0300)]
upstream: [media] m88ds3103: use kernel macro to round division

DIV_ROUND_CLOSEST does the job and looks better.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] m88ds3103: use I2C mux for tuner I2C adapter
Antti Palosaari [Tue, 19 Nov 2013 23:32:42 +0000 (20:32 -0300)]
upstream: [media] m88ds3103: use I2C mux for tuner I2C adapter

Switch standard I2C adapter to muxed I2C adapter.

David reported that I2C adapter implementation caused deadlock.
I discussed with Jean and he suggested to implement it as a
multiplexed i2c adapter because tuner I2C bus could be seen like
own I2C segment.

Reported-by: David Howells <dhowells@redhat.com>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] m88ds3103: do not use dynamic stack allocation
Antti Palosaari [Thu, 7 Nov 2013 20:35:43 +0000 (17:35 -0300)]
upstream: [media] m88ds3103: do not use dynamic stack allocation

I2C transfer were using dynamic stack allocation. Get rid of it.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] Montage M88TS2022 silicon tuner driver
Antti Palosaari [Mon, 25 Feb 2013 11:43:32 +0000 (08:43 -0300)]
upstream: [media] Montage M88TS2022 silicon tuner driver

M88TS2022 is DVB-S/S2 RF tuner used usually in conjunction with
Montage M88DS3103 DVB-S/S2 demodulator.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] Montage M88DS3103 DVB-S/S2 demodulator driver
Antti Palosaari [Mon, 25 Feb 2013 11:39:16 +0000 (08:39 -0300)]
upstream: [media] Montage M88DS3103 DVB-S/S2 demodulator driver

DVB-S/S2 satellite television demodulator driver.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] dib8000: improve block statistics
Mauro Carvalho Chehab [Tue, 17 Dec 2013 14:34:22 +0000 (11:34 -0300)]
upstream: [media] dib8000: improve block statistics

PER/UCB statistics are collected once on each 1 second.
However, it doesn't provide the total number of packets
needed to calculate PER.

Yet, as we know the bit rate, it is possible to estimate
such number. So, do it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Acked-by: Patrick Boettcher <pboettcher@kernellabs.com>
9 years agoupstream: [media] dib8000: be sure that stats are available before reading them
Mauro Carvalho Chehab [Tue, 17 Dec 2013 13:08:20 +0000 (10:08 -0300)]
upstream: [media] dib8000: be sure that stats are available before reading them

On dib8000, the BER statistics are updated on every 1.25e6 bits.
Adjust the code to only update the statistics after having it
done.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Acked-by: Patrick Boettcher <pboettcher@kernellabs.com>
9 years agoupstream: [media] dib8000: Fix UCB measure with DVBv5 stats
Mauro Carvalho Chehab [Tue, 17 Dec 2013 07:55:26 +0000 (04:55 -0300)]
upstream: [media] dib8000: Fix UCB measure with DVBv5 stats

On dib8000, the block error count is a monotonic 32 bits register.
With DVBv5 stats, we use a 64 bits counter, that it is reset
when a new channel is tuned.

Change the UCB counting start from 0 and to be returned with
64 bits, just like the API requests.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Acked-by: Patrick Boettcher <pboettcher@kernellabs.com>
9 years agoupstream: [media] dib8000: make a better estimation for dBm
Mauro Carvalho Chehab [Tue, 17 Dec 2013 00:45:19 +0000 (21:45 -0300)]
upstream: [media] dib8000: make a better estimation for dBm

Use multiple linear segments to better interpolate the dBm
for the signal strength.

The table that converts from linear strength to dB was
empirically determinated with the help of a signal generator
(DTA-2111).

The entries from -35dBm to -22.5dBm were taken using just
the signal generator and the board.

For the entries from -36dBm to -51dBm, a 16 dB tap was used,
in order to extend its range.

Signals below to -51dBm are just linearly interpolated.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Acked-by: Patrick Boettcher <pboettcher@kernellabs.com>
9 years agoupstream: [media] dib8000: estimate strength in dBm
Mauro Carvalho Chehab [Mon, 16 Dec 2013 23:00:34 +0000 (20:00 -0300)]
upstream: [media] dib8000: estimate strength in dBm

Better to have Signal strength in dB.
This takes a very rough estimation for the signal strength,
that was calibrated using a Dektec DTA-2111 Gold RF generator
and a Pixelview dib8076 stick.

It estimates the signal strength using a linear equation where:
- the max is -22.5 dBm, with returns 55953
- the min is -35.0 dBm, with returns 50110

With -22dBm, the signal strengh is returned as 65535.
Unfortunately, the min strength generated with DTA-2111 is
-35dBm.

It should be noticed that approximating it by a linear equation
is not right. I should probably be splitting it into 0.5 dB
linear segments, in order to get a higher precision, just like
it is done on mb86a20s, but that would force me to add some
attenuators, in order to get dB levels below -35dBm, which is,
btw, strong enough to get signal lock.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Acked-by: Patrick Boettcher <pboettcher@kernellabs.com>
9 years agoupstream: [media] dib8000: add DVBv5 stats
Mauro Carvalho Chehab [Mon, 16 Dec 2013 22:10:59 +0000 (19:10 -0300)]
upstream: [media] dib8000: add DVBv5 stats

The advantage of DVBv5 stats is that it allows adding proper
scales to all measures. use it for this frontend.

This patch adds a basic set of stats, basically cloning what's already
provided by DVBv3 API. Latter patches will improve it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Acked-by: Patrick Boettcher <pboettcher@kernellabs.com>
9 years agoupstream: [media] dib8000: report Interleaving 4 correctly
Mauro Carvalho Chehab [Mon, 16 Dec 2013 07:16:59 +0000 (04:16 -0300)]
upstream: [media] dib8000: report Interleaving 4 correctly

On ISDB-T, the valid values for interleaving are 0, 1, 2 and 4.
While the first 3 are properly reported, the last one is reported
as 3 instead. Fix it.

Tested with a Dektec DTA-2111 RF generator.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Acked-by: Patrick Boettcher <pboettcher@kernellabs.com>
9 years agoupstream: [media] dib8000: improves the auto search mode check logic
Mauro Carvalho Chehab [Sun, 15 Dec 2013 12:57:40 +0000 (09:57 -0300)]
upstream: [media] dib8000: improves the auto search mode check logic

The logic that detects if auto search mode should be used is too
complex.

Also, it doesn't cover all cases, as the dib8000_tune logic
requires either auto mode or a fully specified manual mode.
So, move it to a separate function and add some extra debug
data to help identifying when it falled back to auto mode,
because the manual settings are invalid.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Acked-by: Patrick Boettcher <pboettcher@kernellabs.com>
9 years agoupstream: [media] dib8000: Don't let tuner hang due to a call to get_frontend()
Mauro Carvalho Chehab [Sun, 15 Dec 2013 09:41:20 +0000 (07:41 -0200)]
upstream: [media] dib8000: Don't let tuner hang due to a call to get_frontend()

Both dvbv5-scan and dvbv5-zap tools call FE_GET_PROPERTY inside the
loop that checks for stats. If the frontend doesn't support DVBv5, it
falls back to call the DVBv5 stats APIs(FE_READ_BER, FE_READ_SIGNAL,
FE_READ_SNR and FE_READ_UNCORRECTED_BLOCKS).

A call to FE_GET_PROPERTY makes dvb-frontend core to call get_frontend().

However, due to a race condition on dib8000 between dib8000_get_frontend
and dib8000_tune, if get_frontend occurs too early, it causes the
tune state machine to fail and not get any lock.

This patch adds a workaround code that makes get_frontend() to just
return if none of the frontends have a SYNC. This change fixed the issue
with dvbv5-scan/dvbv5-zap, but a fine-tuned logic might be needed in
the future, when we implement DVBv5 stats on this frontend.

The procedure to test the bug and the fix is the one below:

1) tune into a non-existing frequency with:

$ dvbv5-zap -I dvbv5 -c non_existing_freqs -m 679142857 -t3

2) tune/lock into an existing frequency with:

$ dvbv5-zap -I dvbv5 -c isdb-test -m 479142857
    or
$ dvbv5-scan isdb-test

In this case, 679 MHz carrier doesn't exist. Only 479 MHz does.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Acked-by: Patrick Boettcher <pboettcher@kernellabs.com>
9 years agoupstream: [media] it913x: Add support for Avermedia H335 id 0x0335
Malcolm Priestley [Thu, 12 Dec 2013 19:38:51 +0000 (16:38 -0300)]
upstream: [media] it913x: Add support for Avermedia H335 id 0x0335

Trivial USB ID addition for Avermedia H335.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Cc: stable@vger.kernel.org # v3.11+
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] v4l: sh_vou: Fix warnings due to improper casts and printk formats
Laurent Pinchart [Wed, 11 Dec 2013 12:33:03 +0000 (09:33 -0300)]
upstream: [media] v4l: sh_vou: Fix warnings due to improper casts and printk formats

Use the %zu and %pad printk specifiers to print size_t and dma_addr_t
variables. This fixes warnings on platforms where dma_addr_t has a
different size than int.

Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] a8293: add small sleep in order to settle LNB voltage
Antti Palosaari [Mon, 25 Feb 2013 11:24:18 +0000 (08:24 -0300)]
upstream: [media] a8293: add small sleep in order to settle LNB voltage

PCTV 461e requires that small delay.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] em28xx: add support for Empia EM28178
Antti Palosaari [Mon, 25 Feb 2013 11:19:04 +0000 (08:19 -0300)]
upstream: [media] em28xx: add support for Empia EM28178

New chip version, which is very similar than EM28174.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] v4l: atmel-isi: Should clear bits before set the hardware register
Josh Wu [Tue, 10 Dec 2013 12:25:47 +0000 (09:25 -0300)]
upstream: [media] v4l: atmel-isi: Should clear bits before set the hardware register

In the ISI driver it reads the config register to get original value,
then set the correct FRATE_DIV and YCC_SWAP_MODE directly. This will
cause some bits overlap.

So we need to clear these bits first, then set correct value. This patch
fix it.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] v4l: atmel-isi: Fix color component ordering
Laurent Pinchart [Wed, 4 Dec 2013 16:19:11 +0000 (13:19 -0300)]
upstream: [media] v4l: atmel-isi: Fix color component ordering

The ISI_CFG2.YCC_SWAP field controls color component ordering. The
datasheet lists the following orderings for the memory formats.

YCC_SWAP Byte 0 Byte 1 Byte 2 Byte 3
00: Default Cb(i) Y(i) Cr(i) Y(i+1)
01: Mode1 Cr(i) Y(i) Cb(i) Y(i+1)
10: Mode2 Y(i) Cb(i) Y(i+1) Cr(i)
11: Mode3 Y(i) Cr(i) Y(i+1) Cb(i)

This is based on a sensor format set to CbYCrY (UYVY). The driver
hardcodes the output memory format to YUYV, configure the ordering
accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] v4l: atmel-isi: Make the MCK clock optional
Laurent Pinchart [Sat, 23 Nov 2013 02:06:54 +0000 (23:06 -0300)]
upstream: [media] v4l: atmel-isi: Make the MCK clock optional

ISI_MCK is the sensor master clock. It should be handled by the sensor
driver directly, as the ISI has no use for that clock. Make the clock
optional here while platforms transition to the correct model.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] v4l: atmel-isi: Reset the ISI when starting the stream
Laurent Pinchart [Sun, 3 Nov 2013 00:25:06 +0000 (21:25 -0300)]
upstream: [media] v4l: atmel-isi: Reset the ISI when starting the stream

The queue setup operation isn't the right place to reset the ISI. Move
the reset call to the start streaming operation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] v4l: atmel-isi: Defer clock (un)preparation to enable/disable time
Laurent Pinchart [Mon, 25 Nov 2013 15:21:33 +0000 (12:21 -0300)]
upstream: [media] v4l: atmel-isi: Defer clock (un)preparation to enable/disable time

The PCLK and MCK clocks are prepared and unprepared at probe and remove
time. Clock (un)preparation isn't needed before enabling/disabling the
clocks, and the enable/disable operation happen in non-atomic context.
We can thus defer (un)preparation to enable/disable time.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] v4l: atmel-isi: Use devm_* managed allocators
Laurent Pinchart [Mon, 25 Nov 2013 15:13:50 +0000 (12:13 -0300)]
upstream: [media] v4l: atmel-isi: Use devm_* managed allocators

This simplifies error and cleanup code paths.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] v4l: atmel-isi: remove SOF wait in start_streaming()
Josh Wu [Thu, 24 Oct 2013 07:27:11 +0000 (04:27 -0300)]
upstream: [media] v4l: atmel-isi: remove SOF wait in start_streaming()

when a userspace applications calls the VIDIOC_STREAMON ioctl. The
V4L2 core calls the soc_camera_streamon function, which is responsible
for starting the video stream. It does so by first starting the atmel-isi
host by a call to the vb2_streamon function, and then starting the sensor
by a call to the video.s_stream sensor subdev operation.
That means we wait for a SOF in start_streaming() before call sensor's
s_stream(). It is possible no VSYNC interrupt arrive as the sensor
hasn't been started yet.
To avoid such case, this patch remove the code to wait for the VSYNC
interrupt. And such code is not necessary.

Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] si4713: coding style time-related cleanups
Hans Verkuil [Fri, 6 Dec 2013 09:48:49 +0000 (06:48 -0300)]
upstream: [media] si4713: coding style time-related cleanups

Fix the non-whitespace checkpatch errors/warnings.
Replace msleep with usleep_range and the jiffies comparison with
time_is_after_jiffies().

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Eduardo Valentin <edubezval@gmail.com>
Acked-by: Dinesh Ram <dinesh.ram@cern.ch>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] si4713: coding style whitespace cleanups
Hans Verkuil [Fri, 6 Dec 2013 09:48:49 +0000 (06:48 -0300)]
upstream: [media] si4713: coding style whitespace cleanups

Fix most whitespace-related checkpatch errors/warnings.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Eduardo Valentin <edubezval@gmail.com>
Acked-by: Dinesh Ram <dinesh.ram@cern.ch>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>