platform/kernel/linux-3.10.git
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>
9 years agoupstream: [media] si4713: print product number
Eduardo Valentin [Tue, 5 Nov 2013 14:18:43 +0000 (11:18 -0300)]
upstream: [media] si4713: print product number

Print the PN value, useful to check what chip the dev board has.

Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] si4713: si4713_set_rds_radio_text overwrites terminating \0
Hans Verkuil [Tue, 15 Oct 2013 15:24:45 +0000 (12:24 -0300)]
upstream: [media] si4713: si4713_set_rds_radio_text overwrites terminating \0

si4713_set_rds_radio_text will overwrite the terminating zero at the
end of the rds radio text string in order to send out a carriage return
as per the RDS spec.
Use a separate char buffer for the CR instead of corrupting the control
string.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Eduardo Valentin <edubezval@gmail.com>
Acked-by: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] si4713: move supply list to si4713_platform_data
Dinesh Ram [Tue, 15 Oct 2013 15:24:44 +0000 (12:24 -0300)]
upstream: [media] si4713: move supply list to si4713_platform_data

The supply list is needed by the platform driver, but not by the usb driver.
So this information belongs to the platform data and should not be hardcoded
in the subdevice driver.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Eduardo Valentin <edubezval@gmail.com>
Acked-by: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] si4713: Added the USB driver for Si4713
Dinesh Ram [Tue, 15 Oct 2013 15:24:42 +0000 (12:24 -0300)]
upstream: [media] si4713: Added the USB driver for Si4713

This is the USB driver for the Silicon Labs development board.
It contains the Si4713 FM transmitter chip.

Signed-off-by: Dinesh Ram <dinesh.ram@cern.ch>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Eduardo Valentin <edubezval@gmail.com>
Acked-by: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] si4713: Bug fix for si4713_tx_tune_power() method in the i2c driver
Dinesh Ram [Tue, 15 Oct 2013 15:24:40 +0000 (12:24 -0300)]
upstream: [media] si4713: Bug fix for si4713_tx_tune_power() method in the i2c driver

In the si4713_tx_tune_power() method, the args array element 'power'
can take values between SI4713_MIN_POWER and SI4713_MAX_POWER. power = 0
is also valid. All the values (0 > power < SI4713_MIN_POWER) are illegal
and hence are all mapped to SI4713_MIN_POWER.

Signed-off-by: Dinesh Ram <dinesh.ram@cern.ch>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Eduardo Valentin <edubezval@gmail.com>
Acked-by: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] si4713: Reorganized includes in si4713.c/h
Dinesh Ram [Tue, 15 Oct 2013 15:24:39 +0000 (12:24 -0300)]
upstream: [media] si4713: Reorganized includes in si4713.c/h

Moved the header <linux/regulator/consumer.h> from si4713.c to si4713.h

Signed-off-by: Dinesh Ram <dinesh.ram@cern.ch>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Eduardo Valentin <edubezval@gmail.com>
Acked-by: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] si4713: Modified i2c driver to handle cases where interrupts are...
Dinesh Ram [Tue, 15 Oct 2013 15:24:38 +0000 (12:24 -0300)]
upstream: [media] si4713: Modified i2c driver to handle cases where interrupts are not used

Checks have been introduced at several places in the code to test if an
interrupt is set or not. For devices which do not use the interrupt, to
get a valid response, within a specified timeout, the device is polled
instead.

Signed-off-by: Dinesh Ram <dinesh.ram@cern.ch>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Eduardo Valentin <edubezval@gmail.com>
Acked-by: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] si4713: Reorganized drivers/media/radio directory
Dinesh Ram [Tue, 15 Oct 2013 15:24:37 +0000 (12:24 -0300)]
upstream: [media] si4713: Reorganized drivers/media/radio directory

Added a new si4713 directory which will contain all si4713 related files.
Also updated Makefile and Kconfig

Signed-off-by: Dinesh Ram <dinesh.ram@cern.ch>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Eduardo Valentin <edubezval@gmail.com>
Acked-by: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] staging: media: davinci_vpfe: Rewrite return statement in vpfe_video.c
Lisa Nguyen [Wed, 11 Dec 2013 06:09:22 +0000 (03:09 -0300)]
upstream: [media] staging: media: davinci_vpfe: Rewrite return statement in vpfe_video.c

Rewrite the return statement in vpfe_video.c. This will prevent
the checkpatch.pl script from generating a warning saying
to remove () from this particular return statement.

Signed-off-by: Lisa Nguyen <lisa@xenapiadmin.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] staging: media: davinci_vpfe: Remove spaces before semicolons
Lisa Nguyen [Mon, 28 Oct 2013 21:23:34 +0000 (18:23 -0300)]
upstream: [media] staging: media: davinci_vpfe: Remove spaces before semicolons

Remove unnecessary spaces before semicolons to meet kernel
coding style.

Signed-off-by: Lisa Nguyen <lisa@xenapiadmin.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] v4l: of: Drop endpoint node reference in v4l2_of_get_remote_port()
Laurent Pinchart [Fri, 17 May 2013 10:31:04 +0000 (07:31 -0300)]
upstream: [media] v4l: of: Drop endpoint node reference in v4l2_of_get_remote_port()

The v4l2_of_get_remote_port() function acquires a reference to an
endpoint node through a phandle and then returns the node's parent,
without dropping the reference to the endpoint node. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] v4l: of: Remove struct v4l2_of_endpoint remote field
Laurent Pinchart [Fri, 17 May 2013 10:31:04 +0000 (07:31 -0300)]
upstream: [media] v4l: of: Remove struct v4l2_of_endpoint remote field

The field isn't set when parsing the endpoint. Remove it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] v4l: of: Return an int in v4l2_of_parse_endpoint()
Laurent Pinchart [Fri, 17 May 2013 10:31:04 +0000 (07:31 -0300)]
upstream: [media] v4l: of: Return an int in v4l2_of_parse_endpoint()

When CONFIG_OF is not defined the v4l2_of_parse_endpoint() function is
defined as a stub that returns -ENOSYS. Make the real function return an
integer as well to be able to differentiate between the two cases.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] v4l: vsp1: Add LUT support
Laurent Pinchart [Wed, 10 Jul 2013 15:03:30 +0000 (12:03 -0300)]
upstream: [media] v4l: vsp1: Add LUT support

The Look-Up Table looks up values in 8-bit indexed tables separately for
each color component.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] v4l: vsp1: Add SRU support
Laurent Pinchart [Wed, 10 Jul 2013 15:03:30 +0000 (12:03 -0300)]
upstream: [media] v4l: vsp1: Add SRU support

The Super Resolution Unit performs super resolution processing with
optional upscaling by a factor of two.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] v4l: vsp1: Add HST and HSI support
Laurent Pinchart [Wed, 10 Jul 2013 20:30:14 +0000 (17:30 -0300)]
upstream: [media] v4l: vsp1: Add HST and HSI support

The Hue Saturation value Transform and Hue Saturation value Inverse
transform entities convert from RGB to HSV and back.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] v4l: Add media format codes for AHSV8888 on 32-bit busses
Laurent Pinchart [Wed, 10 Jul 2013 15:05:06 +0000 (12:05 -0300)]
upstream: [media] v4l: Add media format codes for AHSV8888 on 32-bit busses

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] v4l: vsp1: Add cropping support
Laurent Pinchart [Sat, 24 Aug 2013 23:49:58 +0000 (20:49 -0300)]
upstream: [media] v4l: vsp1: Add cropping support

Implement the get and set selection operations on the RPF and WPF
entities. Only the crop targets are currently available.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] v4l: vsp1: Supply frames to the DU continuously
Laurent Pinchart [Tue, 15 Oct 2013 21:58:43 +0000 (18:58 -0300)]
upstream: [media] v4l: vsp1: Supply frames to the DU continuously

When operating in DU output mode (deep pipeline to the DU through the
LIF), the VSP1 needs to constantly supply frames to the display. To
ensure reuse the last queued buffer instead of returning it to the user.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] mt9v032: Add support for the MT9V034
Laurent Pinchart [Mon, 2 Dec 2013 15:01:03 +0000 (12:01 -0300)]
upstream: [media] mt9v032: Add support for the MT9V034

The MT9V034 sensor is very similar to the MT9V032, with a couple of
different registers and parameters.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] mt9v032: Add support for model-specific parameters
Laurent Pinchart [Mon, 2 Dec 2013 14:59:52 +0000 (11:59 -0300)]
upstream: [media] mt9v032: Add support for model-specific parameters

To prepare support of the MT9V034, add the necessary infrastructure to
support model-specific parameters.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] mt9v032: Add support for monochrome models
Laurent Pinchart [Wed, 4 Dec 2013 18:31:13 +0000 (15:31 -0300)]
upstream: [media] mt9v032: Add support for monochrome models

Identify the model based on the I2C device name and configure formats
accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
9 years agoupstream: [media] mt9v032: Fix binning configuration
Laurent Pinchart [Mon, 2 Dec 2013 19:39:18 +0000 (16:39 -0300)]
upstream: [media] mt9v032: Fix binning configuration

The sensor can scale the image down using binning by 1, 2 or 4 in both
directions. Update size enumeration and ratio and binning factor
computation accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>