cascardo/linux.git
7 years ago[media] dvb-usb: avoid link error with dib3000m{b,c|
Arnd Bergmann [Tue, 19 Jul 2016 15:14:35 +0000 (12:14 -0300)]
[media] dvb-usb: avoid link error with dib3000m{b,c|

Tha ARM randconfig builds came up with another rare build failure
for the dib3000mc driver, when dvb-usb-dibusb-mb is built-in and
dib3000mc is a loadable module:

ERROR: "dibusb_dib3000mc_frontend_attach" [drivers/media/usb/dvb-usb/dvb-usb-nova-t-usb2.ko] undefined!
ERROR: "dibusb_dib3000mc_tuner_attach" [drivers/media/usb/dvb-usb/dvb-usb-nova-t-usb2.ko] undefined!

Apparently this used to be a valid configuration (build-time, not
run-time), but broke as part of a cleanup.

I tried reverting the cleanup, but saw that the code was still wrong
then. This version adds a dependency for dib3000mb, to ensure that
dib3000mb does not force the dibusb_dib3000mc_frontend_attach function
to be built-in when dib3000mc is a loadable module.

I have also checked the two other files that were changed in the original
cleanup, and found them to be correct in either version, so I do not
touch that part.

As this is a rather obscure bug, there is no need for backports.

Fixes: 028c70ff42783 ("[media] dvb-usb/dvb-usb-v2: use IS_ENABLED")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-usb: split out common parts of dibusb
Arnd Bergmann [Tue, 19 Jul 2016 15:14:34 +0000 (12:14 -0300)]
[media] dvb-usb: split out common parts of dibusb

Tha ARM randconfig builds came up with another rare build failure
for the dib3000mc driver, when dvb-usb-dibusb-mb is built-in and
dib3000mc is a loadable module:

ERROR: "dibusb_dib3000mc_frontend_attach" [drivers/media/usb/dvb-usb/dvb-usb-nova-t-usb2.ko] undefined!
ERROR: "dibusb_dib3000mc_tuner_attach" [drivers/media/usb/dvb-usb/dvb-usb-nova-t-usb2.ko] undefined!

Apparently this used to be a valid configuration (build-time, not
run-time), but broke as part of a cleanup.

I tried reverting the cleanup, but saw that the code was still wrong
then. This tries to fix the code properly, by moving the problematic
functions into a new file that now is built as a loadable module or
built-in, whichever is correct for a particular configuration. It fixes
the regression as well as the runtime problem that already existed.

The new module dependency chain is now:

   dvb-usb-{dibusb_mc,a800,dib0700,umt-010,gp8psk}   dvb-usb-dibusb-mb
         |                        |                   |          |
   dvb-usb-dibusb-mc-common       |        ___________|          |
         |               |        |        |                     |
   dib3000mc (frontend)  |        |        |         dib3000mb (frontend)
                         |        |        |
                         |        |        |
                        dvb-usb-dibusb-common

I have also checked the two other files that were changed in the original
cleanup, and found them to be correct in either version, so I do not
touch that part.

As this is a rather obscure bug, there is no need for backports.

Fixes: 028c70ff42783 ("[media] dvb-usb/dvb-usb-v2: use IS_ENABLED")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] staging: lirc: add missing platform_device_del() on error
Wei Yongjun [Tue, 19 Jul 2016 11:24:42 +0000 (08:24 -0300)]
[media] staging: lirc: add missing platform_device_del() on error

Add the missing platform_device_del() before return from
lirc_parallel_init() in the error handling case.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
7 years ago[media] cxd2841er: freeze/unfreeze registers when reading stats
Abylay Ospan [Tue, 19 Jul 2016 03:10:20 +0000 (00:10 -0300)]
[media] cxd2841er: freeze/unfreeze registers when reading stats

ensure multiple separate register reads are from the same snapshot

Signed-off-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: split nec protocol into its three variants
Sean Young [Wed, 21 Sep 2016 09:54:19 +0000 (06:54 -0300)]
[media] rc: split nec protocol into its three variants

Currently we do not know what variant (bit length) of the nec protocol
is used, other than from guessing from the length of the scancode. Now
nec will be handled the same way as the sony protocol or the rc6 protocol;
one variant per bit length.

In the future we might want to expose the rc protocol type to userspace
and we don't want to be introducing this world of pain into userspace
too.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: Hauppauge z8f0811 can decode RC6
Sean Young [Mon, 19 Sep 2016 22:21:23 +0000 (19:21 -0300)]
[media] rc: Hauppauge z8f0811 can decode RC6

The hardware does not decode the 16, 20 or 24 bit variety.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: rc6 decoder should report protocol correctly
Sean Young [Mon, 19 Sep 2016 22:21:22 +0000 (19:21 -0300)]
[media] rc: rc6 decoder should report protocol correctly

When reporting decoded protocol use the enum rather than the bitmap.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: rc: nuvoton: simplify nvt_get_rx_ir_data a little
Heiner Kallweit [Tue, 2 Aug 2016 05:45:51 +0000 (02:45 -0300)]
[media] media: rc: nuvoton: simplify nvt_get_rx_ir_data a little

Simplify the code a little.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: rc: nuvoton: remove unneeded call to ir_raw_event_handle
Heiner Kallweit [Tue, 2 Aug 2016 05:45:30 +0000 (02:45 -0300)]
[media] media: rc: nuvoton: remove unneeded call to ir_raw_event_handle

ir_raw_event_handle is called anyway after the hw fifo content stored
in nvt->buf[] has been written to the kfifo. There is not really a
benefit in the potential additional call to ir_raw_event_handle
whilst nvt->buf[] is being processed.
Getting rid of this additional call allows to simplify the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: rc: nuvoton: remove usage of b_idx in nvt_get_rx_ir_data
Heiner Kallweit [Tue, 2 Aug 2016 05:44:44 +0000 (02:44 -0300)]
[media] media: rc: nuvoton: remove usage of b_idx in nvt_get_rx_ir_data

The call to nvt_get_rx_ir_data and nvt_process_rx_ir_data from
the ISR is protected with spinlock nvt->lock. Therefore it's
guaranteed that nvt->pkts is 0 when entering nvt_get_rx_ir_data
(as nvt->pkts is set to 0 at the end of nvt_process_rx_ir_data).
Having said that we can remove b_idx.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: rc: nuvoton: ignore spurious interrupt when logical device is being...
Heiner Kallweit [Sun, 31 Jul 2016 13:42:55 +0000 (10:42 -0300)]
[media] media: rc: nuvoton: ignore spurious interrupt when logical device is being disabled

When removing module nuvoton-cir I get a fifo overrun warning.
It turned out to be caused by a spurious interrupt when the logical CIR
device is being disabled (although no interrupt source bit being set).
Reading the interrupt status register returns 0xff, therefore the fifo
overrun bit is mistakenly interpreted as being set.

Fix this by ignoring interrupts when interrupt source and status register
reads return 0xff.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: rc: fix deadlock when module ir_lirc_codec is removed
Heiner Kallweit [Sun, 31 Jul 2016 11:56:15 +0000 (08:56 -0300)]
[media] media: rc: fix deadlock when module ir_lirc_codec is removed

When removing module ir_lirc_codec I got this deadlock warning.
Fix this by introducing a separate mutex to protect access
to available_protocols instead of using ir_raw_handler_lock
for this purpose.

======================================================
[ INFO: possible circular locking dependency detected ]
4.7.0-next-20160729 #1 Not tainted
-------------------------------------------------------
rmmod/2542 is trying to acquire lock:
 (&dev->lock){+.+.+.}, at: [<ffffffffa03b1267>]
ir_raw_handler_unregister+0x77/0xd0 [rc_core]

but task is already holding lock:
 (ir_raw_handler_lock){+.+.+.}, at: [<ffffffffa03b1212>]
ir_raw_handler_unregister+0x22/0xd0 [rc_core]

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> #1 (ir_raw_handler_lock){+.+.+.}:
       [<ffffffff810ab1f2>] lock_acquire+0xb2/0x1e0
       [<ffffffff815c087f>] mutex_lock_nested+0x5f/0x360
       [<ffffffffa03b1403>] ir_raw_get_allowed_protocols+0x13/0x30 [rc_core]
       [<ffffffffa03af8ea>] store_protocols+0x2fa/0x480 [rc_core]
       [<ffffffff8143e143>] dev_attr_store+0x13/0x20
       [<ffffffff81213c50>] sysfs_kf_write+0x40/0x50
       [<ffffffff81212f60>] kernfs_fop_write+0x150/0x1e0
       [<ffffffff81197613>] __vfs_write+0x23/0x120
       [<ffffffff81198740>] vfs_write+0xb0/0x190
       [<ffffffff81199a34>] SyS_write+0x44/0xa0
       [<ffffffff815c55a5>] entry_SYSCALL_64_fastpath+0x18/0xa8

-> #0 (&dev->lock){+.+.+.}:
       [<ffffffff810aac8c>] __lock_acquire+0x10fc/0x1270
       [<ffffffff810ab1f2>] lock_acquire+0xb2/0x1e0
       [<ffffffff815c087f>] mutex_lock_nested+0x5f/0x360
       [<ffffffffa03b1267>] ir_raw_handler_unregister+0x77/0xd0 [rc_core]
       [<ffffffffa03c8c05>] ir_lirc_codec_exit+0x10/0x12 [ir_lirc_codec]
       [<ffffffff810e1b88>] SyS_delete_module+0x168/0x220
       [<ffffffff815c55a5>] entry_SYSCALL_64_fastpath+0x18/0xa8

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(ir_raw_handler_lock);
                               lock(&dev->lock);
                               lock(ir_raw_handler_lock);
  lock(&dev->lock);

 *** DEADLOCK ***

1 lock held by rmmod/2542:
 #0:  (ir_raw_handler_lock){+.+.+.}, at: [<ffffffffa03b1212>]
ir_raw_handler_unregister+0x22/0xd0 [rc_core]

stack backtrace:
CPU: 0 PID: 2542 Comm: rmmod Not tainted 4.7.0-next-20160729 #1
Hardware name: ZOTAC ZBOX-CI321NANO/ZBOX-CI321NANO, BIOS B246P105 06/01/2015
 0000000000000000 ffff88006e607cc0 ffffffff812715f5 ffffffff8232b230
 ffffffff8232b230 ffff88006e607d00 ffffffff810a846e 00000000790107f0
 ffff880079010818 ffff8800790107f0 1efeb9f4f0dd2e6f ffff880079010000
Call Trace:
 [<ffffffff812715f5>] dump_stack+0x68/0x93
 [<ffffffff810a846e>] print_circular_bug+0x1be/0x210
 [<ffffffff810aac8c>] __lock_acquire+0x10fc/0x1270
 [<ffffffff810bcead>] ? debug_lockdep_rcu_enabled+0x1d/0x20
 [<ffffffff810ab1f2>] lock_acquire+0xb2/0x1e0
 [<ffffffffa03b1267>] ? ir_raw_handler_unregister+0x77/0xd0 [rc_core]
 [<ffffffff815c087f>] mutex_lock_nested+0x5f/0x360
 [<ffffffffa03b1267>] ? ir_raw_handler_unregister+0x77/0xd0 [rc_core]
 [<ffffffff810a980e>] ? trace_hardirqs_on_caller+0xee/0x1b0
 [<ffffffffa03b1267>] ir_raw_handler_unregister+0x77/0xd0 [rc_core]
 [<ffffffffa03c8c05>] ir_lirc_codec_exit+0x10/0x12 [ir_lirc_codec]
 [<ffffffff810e1b88>] SyS_delete_module+0x168/0x220
 [<ffffffff815c55a5>] entry_SYSCALL_64_fastpath+0x18/0xa8

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] Partly revert "[media] rc-core: allow calling rc_open with device not initial...
Ole Ernst [Sat, 30 Jul 2016 13:19:27 +0000 (10:19 -0300)]
[media] Partly revert "[media] rc-core: allow calling rc_open with device not initialized"

This partly reverts commit 078600f514a12fd763ac84c86af68ef5b5267563.

Due to the relocation of input_register_device() call, holding down a
button on an IR remote no longer resulted in repeated key down events.

Signed-off-by: Ole Ernst <olebowle@gmx.com>
Tested-by: Matthias Reichl <hias@horus.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cxd2820r: convert to regmap api
Antti Palosaari [Sat, 13 Aug 2016 16:19:05 +0000 (13:19 -0300)]
[media] cxd2820r: convert to regmap api

Use regmap for I2C register access.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cxd2820r: improve lock detection
Antti Palosaari [Fri, 12 Aug 2016 19:58:05 +0000 (16:58 -0300)]
[media] cxd2820r: improve lock detection

Check demod and ts locks and report lock status according to those.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cxd2820r: correct logging
Antti Palosaari [Wed, 10 Aug 2016 01:00:37 +0000 (22:00 -0300)]
[media] cxd2820r: correct logging

Use correct device for logging functions as we now have it due to
proper I2C client bindings.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cxd2820r: add I2C driver bindings
Antti Palosaari [Tue, 9 Aug 2016 23:49:09 +0000 (20:49 -0300)]
[media] cxd2820r: add I2C driver bindings

Add I2C driver bindings in order to support proper I2C driver
registration with driver core.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cxd2820r: wrap legacy DVBv3 statistics via DVBv5 statistics
Antti Palosaari [Tue, 9 Aug 2016 17:58:21 +0000 (14:58 -0300)]
[media] cxd2820r: wrap legacy DVBv3 statistics via DVBv5 statistics

Return DVBv5 statistics via legacy DVBv3 API.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cxd2820r: dvbv5 statistics for DVB-C
Antti Palosaari [Tue, 9 Aug 2016 02:03:32 +0000 (23:03 -0300)]
[media] cxd2820r: dvbv5 statistics for DVB-C

Implement dvbv5 statistics for DVB-C.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cxd2820r: dvbv5 statistics for DVB-T2
Antti Palosaari [Tue, 9 Aug 2016 00:12:00 +0000 (21:12 -0300)]
[media] cxd2820r: dvbv5 statistics for DVB-T2

Implement dvbv5 statistics for DVB-T2.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cxd2820r: dvbv5 statistics for DVB-T
Antti Palosaari [Mon, 8 Aug 2016 23:13:45 +0000 (20:13 -0300)]
[media] cxd2820r: dvbv5 statistics for DVB-T

Implement dvbv5 statistics for DVB-T.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cxd2820r: improve IF frequency setting
Antti Palosaari [Mon, 8 Aug 2016 18:54:10 +0000 (15:54 -0300)]
[media] cxd2820r: improve IF frequency setting

Use 64-bit calculation.

Return error if tuner does not provide get_if_frequency() callback.
All currently used tuners has it.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: Add flags to tell whether to take graph mutex for an IOCTL
Sakari Ailus [Wed, 27 Apr 2016 13:15:52 +0000 (10:15 -0300)]
[media] media: Add flags to tell whether to take graph mutex for an IOCTL

New IOCTLs (especially for the request API) do not necessarily need the
graph mutex acquired. Leave this up to the drivers.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: Refactor copying IOCTL arguments from and to user space
Sakari Ailus [Tue, 3 May 2016 21:42:13 +0000 (18:42 -0300)]
[media] media: Refactor copying IOCTL arguments from and to user space

Refactor copying the IOCTL argument structs from the user space and back,
in order to reduce code copied around and make the implementation more
robust.

As a result, the copying is done while not holding the graph mutex.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: Unify IOCTL handler calling
Sakari Ailus [Tue, 3 May 2016 21:35:12 +0000 (18:35 -0300)]
[media] media: Unify IOCTL handler calling

Each IOCTL handler can be listed in an array instead of using a large and
cumbersome switch. Do that.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: Determine early whether an IOCTL is supported
Sakari Ailus [Wed, 27 Apr 2016 12:39:17 +0000 (09:39 -0300)]
[media] media: Determine early whether an IOCTL is supported

Preparation for refactoring media IOCTL handling to unify common parts.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] exynos4-is: add of_platform_populate() call for FIMC-IS child devices
Sylwester Nawrocki [Tue, 13 Sep 2016 11:59:49 +0000 (08:59 -0300)]
[media] exynos4-is: add of_platform_populate() call for FIMC-IS child devices

Instead of relying on the "simple-bus" compatible and the driver core
populating FIMC-IS child devices make the fimc-is driver populating
its child devices.  This prevents issues related to accessing ISP_I2C
clock registers with corresponding power domain switched off, which
popped out after applying some pending IOMMU driver patches.  Now the
I2C_ISP child devices will be instantiated only when required parent
device drivers are initialized and ready.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] exynos4-is: Clear isp-i2c adapter power.ignore_children flag
Sylwester Nawrocki [Tue, 13 Sep 2016 14:39:33 +0000 (11:39 -0300)]
[media] exynos4-is: Clear isp-i2c adapter power.ignore_children flag

Since commit 04f59143b571161d25315dd52d7a2ecc022cb71a
("i2c: let I2C masters ignore their children for PM")
the power.ignore_children flag is set when registering an I2C
adapter.  Since I2C transfers are not managed by the fimc-isp-i2c
driver its clients use pm_runtime_* calls directly to communicate
required power state of the bus controller.

However, when the power.ignore_children flag is set that doesn't
work, so clear that flag back after registering the adapter.
While at it drop pm_runtime_enable() call on the i2c_adapter
as it is already done by the I2C subsystem when registering
I2C adapter.

This patch is meant as a minimal change to fix the regression,
eventually the I2C_ISPx clock handling will be moved to the
top level fimc-is driver and whole runtime PM code is going to
be dropped from the fimc-is-i2c module.

Cc: <stable@vger.kernel.org> # 4.7+
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] s5c73m3: Fix entity function assignment for the OIF subdev
Sylwester Nawrocki [Thu, 1 Sep 2016 11:47:07 +0000 (08:47 -0300)]
[media] s5c73m3: Fix entity function assignment for the OIF subdev

Suppresses warnings like:
s5p-fimc-md camera: Entity type for entity S5C73M3-OIF was not initialized!

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] s5k6a3: Add missing entity function initialization
Sylwester Nawrocki [Thu, 1 Sep 2016 11:47:06 +0000 (08:47 -0300)]
[media] s5k6a3: Add missing entity function initialization

Suppresses warning like:
s5p-fimc-md camera: Entity type for entity S5K6A3 13-0010 was not initialized!

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] exynos4-is: Add missing entity function initialization
Sylwester Nawrocki [Thu, 1 Sep 2016 11:47:05 +0000 (08:47 -0300)]
[media] exynos4-is: Add missing entity function initialization

Suppresses following warnings:

s5p-fimc-md camera: Entity type for entity FIMC.0 was not initialized!
s5p-fimc-md camera: Entity type for entity FIMC.1 was not initialized!
s5p-fimc-md camera: Entity type for entity s5p-mipi-csis.0 was not initialized!
s5p-fimc-md camera: Entity type for entity s5p-mipi-csis.1 was not initialized!
s5p-fimc-md camera: Entity type for entity FIMC-LITE.0 was not initialized!
s5p-fimc-md camera: Entity type for entity FIMC-LITE.1 was not initialized!
s5p-fimc-md camera: Entity type for entity FIMC-IS-ISP was not initialized!

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] exynos4-is: Improve clock management
Marek Szyprowski [Wed, 31 Aug 2016 13:25:17 +0000 (10:25 -0300)]
[media] exynos4-is: Improve clock management

There is no need to keep all clocks prepared all the time. Call to
clk_prepare/unprepare can be done on demand from runtime pm callbacks
(it is allowed to call sleeping functions from that context).

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] exynos4-is: Add support for all required clocks
Marek Szyprowski [Wed, 31 Aug 2016 13:25:16 +0000 (10:25 -0300)]
[media] exynos4-is: Add support for all required clocks

This patch adds 3 more clocks to Exynos4 ISP driver. Enabling them is
needed to make the hardware operational. Till now it worked only because
those clocks were registered with IGNORE_UNUSED flag and were enabled
by default after SoC reset.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] s5p-cec: Fix memory allocation failure check
Christophe JAILLET [Wed, 31 Aug 2016 13:45:04 +0000 (10:45 -0300)]
[media] s5p-cec: Fix memory allocation failure check

It is likely that checking the result of the memory allocation just above
is expected here.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] s5p-cec: fix system and runtime PM integration
Marek Szyprowski [Wed, 31 Aug 2016 12:55:58 +0000 (09:55 -0300)]
[media] s5p-cec: fix system and runtime PM integration

Use generic helpers instead of open-coding usage of runtime PM for system
sleep PM, which was potentially broken for some corner cases.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] s5p-jpeg: fix system and runtime PM integration
Marek Szyprowski [Wed, 31 Aug 2016 12:55:59 +0000 (09:55 -0300)]
[media] s5p-jpeg: fix system and runtime PM integration

Use generic helpers instead of open-coding usage of runtime PM for system
sleep PM, which was potentially broken for some corner cases.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] get rid of a number of problems at the cross references
Mauro Carvalho Chehab [Thu, 22 Sep 2016 10:59:03 +0000 (07:59 -0300)]
[media] get rid of a number of problems at the cross references

As warned by linuxdoc[1] tool, using:

$ for i in $(git grep kernel-doc Documentation/media/kapi/|cut -d: -f4); do kernel-lintdoc --sloppy $i; done

    include/media/v4l2-dev.h:118 :WARN: function name from comment differs:  v4l2_prio_close <--> v4l2_prio_check
    include/media/v4l2-mc.h:56 [kernel-doc WARN] : enum name from comment differs:  if_vid_dec_index <--> if_vid_dec_pad_index
    include/media/v4l2-mc.h:71 [kernel-doc WARN] : enum name from comment differs:  if_aud_dec_index <--> if_aud_dec_pad_index
    include/media/v4l2-mem2mem.h:396 [kernel-doc WARN] : function name from comment differs:  v4l2_m2m_num_src_bufs_ready <--> v4l2_m2m_num_dst_bufs_ready
    drivers/media/dvb-core/dvb_math.h:28 [kernel-doc WARN] : function name from comment differs:  cintlog2 <--> intlog2
    include/media/v4l2-subdev.h:215 [kernel-doc WARN] : struct name from comment differs:  s_radio <--> v4l2_subdev_tuner_ops
    include/media/v4l2-subdev.h:890 [kernel-doc WARN] : function name from comment differs:  v4l2_set_subdevdata <--> v4l2_set_subdev_hostdata
    include/media/v4l2-subdev.h:901 [kernel-doc WARN] : function name from comment differs:  v4l2_get_subdevdata <--> v4l2_get_subdev_hostdata
    drivers/media/dvb-core/dvb_ringbuffer.h:196 [kernel-doc WARN] : function name from comment differs:  dvb_ringbuffer_writeuser <--> dvb_ringbuffer_write_user
    include/media/videobuf2-core.h:399 [kernel-doc WARN] : struct name from comment differs:  vb2_ops <--> vb2_buf_ops
    include/media/media-entity.h:132 [kernel-doc ERROR] : duplicate parameter definition 'source'
    include/media/media-entity.h:477 [kernel-doc WARN] : function name from comment differs:  media_entity_enum_test <--> media_entity_enum_test_and_set
    include/media/media-entity.h:535 [kernel-doc WARN] : function name from comment differs:  gobj_to_entity <--> gobj_to_pad
    include/media/media-entity.h:544 [kernel-doc WARN] : function name from comment differs:  gobj_to_entity <--> gobj_to_link
    include/media/media-entity.h:553 [kernel-doc WARN] : function name from comment differs:  gobj_to_entity <--> gobj_to_intf
    include/media/media-entity.h:562 [kernel-doc WARN] : function name from comment differs:  gobj_to_entity <--> intf_to_devnode
    include/media/rc-core.h:234 [kernel-doc WARN] : function name from comment differs:  rc_open <--> rc_close
    include/media/v4l2-ctrls.h:397 [kernel-doc WARN] : missing initial short description of 'v4l2_ctrl_handler_init'
    include/media/v4l2-dev.h:118 [kernel-doc WARN] : function name from comment differs:  v4l2_prio_close <--> v4l2_prio_check
    include/media/v4l2-event.h:225 [kernel-doc WARN] : missing initial short description of 'v4l2_src_change_event_subscribe'

[1] https://return42.github.io/linuxdoc/linux.html

The above are real issues at the documentation. On several cases,
caused by cut-and-paste.

 Fix them.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: doc: Remove row numbers from tables
Laurent Pinchart [Mon, 5 Sep 2016 11:44:34 +0000 (08:44 -0300)]
[media] v4l: doc: Remove row numbers from tables

Shorten the tables by removing row numbers in comments, allowing for
later insertion of rows with minimal diffs.

All changes have been generated by the following script.

import io
import re
import sys

def process_table(fname, data):
if fname.endswith('hist-v4l2.rst'):
data = re.sub(u'\n{1,2}\t( ?)  -( ?) ?', u'\n\t\\1 -\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n(\t|       )-  \.\. row [0-9]+\n\t  ?-( ?) ?', u'\\1* -\\2', data, flags = re.MULTILINE)
else:
data = re.sub(u'\n{1,2}       -( ?) ?', u'\n      -\\1', data, flags = re.MULTILINE)
data = re.sub(u'(\n?)(\n\n    -  \.\. row 1\n)', u'\n\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n    -  \.\. row [0-9]+\n      -( ?) ?', u'    * -\\1', data, flags = re.MULTILINE)
data = re.sub(u'\n    -  \.\. row [0-9]+\n       \.\. (_[A-Z0-9_`-]*:)', u'\n    -  .. \\1', data, flags = re.MULTILINE)
data = re.sub(u'\n    -  \.\. (_[A-Z0-9_`-]*:)\n      -', u'    * .. \\1\n\n      -', data, flags = re.MULTILINE)
data = re.sub(u'^       - ', u'      -', data, flags = re.MULTILINE)
data = re.sub(u'^(\t{1,2})  ', u'\\1', data, flags = re.MULTILINE)

return data

def process_file(fname, data):
buf = io.StringIO(data)
output = ''
in_table = False
table_separator = 0

for line in buf.readlines():
if line.find('.. flat-table::') != -1:
in_table = True
table = ''
elif in_table and not re.match('^[\t\n]|(    )', line):
in_table = False
output += process_table(fname, table)

if in_table:
table += line
else:
output += line

if in_table:
in_table = False
output += process_table(fname, table)

return output

fname = sys.argv[1]

data = file(fname, 'rb').read().decode('utf-8')
data = process_file(fname, data)
file(fname, 'wb').write(data.encode('utf-8'))

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
7 years ago[media] v4l: doc: Prepare for table reorganization
Laurent Pinchart [Wed, 21 Sep 2016 08:13:08 +0000 (05:13 -0300)]
[media] v4l: doc: Prepare for table reorganization

Fix a few indentation issues to enable automated table reorganization
by a regex-based script.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agoMerge tag 'docs-next' of git://git.lwn.net/linux.git into patchwork
Mauro Carvalho Chehab [Mon, 19 Sep 2016 19:35:26 +0000 (16:35 -0300)]
Merge tag 'docs-next' of git://git.lwn.net/linux.git into patchwork

Merge back from docs-next in order to get the cdomain extension.

With such extension, the number of warnings when building docs
in nitpick mode reduced from 22 to 2 warnings.

* docs-next/docs-next:
  docs/driver-model: fix typo
  DMA-API-HOWTO: <asm/generic/scatterlist.h> is no more
  doc-rst:c-domain: function-like macros arguments
  doc-rst:c-domain: fix sphinx version incompatibility
  Documentation/filesystems: Fixed typo
  docs: Don't format internal MPT docs
  docs: split up serial-interfaces.rst
  docs: Pull the HSI documentation together
  docs: Special-case function-pointer parameters in kernel-doc
  docs: make kernel-doc handle varargs properly
  x86: fix memory ranges in mm documentation
  documentation/scsi: Remove nodisconnect parameter
  doc: ioctl: Add some clarifications to botching-up-ioctls
  docs: split up the driver book
  Docs: sphinxify device-drivers.tmpl

7 years ago[media] media: rcar-vin: use sink pad index for DV timings
Ulrich Hecht [Thu, 15 Sep 2016 17:33:24 +0000 (14:33 -0300)]
[media] media: rcar-vin: use sink pad index for DV timings

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rcar-vin: implement EDID control ioctls
Ulrich Hecht [Thu, 15 Sep 2016 17:33:23 +0000 (14:33 -0300)]
[media] rcar-vin: implement EDID control ioctls

Adds G_EDID and S_EDID.

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] MAINTAINERS: Add entry for the Renesas VIN driver
Niklas Söderlund [Thu, 15 Sep 2016 12:18:36 +0000 (09:18 -0300)]
[media] MAINTAINERS: Add entry for the Renesas VIN driver

The driver is maintained and supported, document it as such.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: rcar-vin: add support for V4L2_FIELD_ALTERNATE
Niklas Söderlund [Fri, 2 Sep 2016 16:45:01 +0000 (13:45 -0300)]
[media] media: rcar-vin: add support for V4L2_FIELD_ALTERNATE

The HW can capture both ODD and EVEN fields in separate buffers so it's
possible to support V4L2_FIELD_ALTERNATE. This patch add support for
this mode.

At probe time and when S_STD is called the driver will default to use
V4L2_FIELD_INTERLACED if the subdevice reports V4L2_FIELD_ALTERNATE. The
driver will only change the field type if the subdevice implements
G_STD, if not it will keep the default at V4L2_FIELD_ALTERNATE.

The user can always explicitly ask for V4L2_FIELD_ALTERNATE in S_FMT and
the driver will use that field format.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: rcar-vin: fix height for TOP and BOTTOM fields
Niklas Söderlund [Fri, 2 Sep 2016 16:45:00 +0000 (13:45 -0300)]
[media] media: rcar-vin: fix height for TOP and BOTTOM fields

The height used for V4L2_FIELD_TOP and V4L2_FIELD_BOTTOM where wrong.
The frames only contain one field so the height should be half of the
frame.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: rcar-vin: fix bug in scaling
Niklas Söderlund [Fri, 2 Sep 2016 16:44:59 +0000 (13:44 -0300)]
[media] media: rcar-vin: fix bug in scaling

It was not possible to scale beyond the image size of the video source
limitation. The output frame would be bigger but the captured image was
limited to the size of the video source.

The error was that the crop boundary was set after the requested frame
size and not the video source size. This patch breaks out the resetting
of the crop, compose and format to separate functions so the error wont
creep back.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: rcar-vin: allow field to be changed
Niklas Söderlund [Fri, 2 Sep 2016 16:44:58 +0000 (13:44 -0300)]
[media] media: rcar-vin: allow field to be changed

The driver forced whatever field was set by the source subdevice to be
used. This patch allows the user to change from the default field.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: rcar-vin: make V4L2_FIELD_INTERLACED standard dependent
Niklas Söderlund [Fri, 2 Sep 2016 16:44:57 +0000 (13:44 -0300)]
[media] media: rcar-vin: make V4L2_FIELD_INTERLACED standard dependent

The field V4L2_FIELD_INTERLACED is standard dependent and should not
unconditionally be equivalent to V4L2_FIELD_INTERLACED_TB.

This patch adds a check to see if the video standard can be obtained and
if it's a 60 Hz format. If the condition is met V4L2_FIELD_INTERLACED
is treated as V4L2_FIELD_INTERLACED_BT if not as
V4L2_FIELD_INTERLACED_TB.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: adv7180: fill in mbus format in set_fmt
Niklas Söderlund [Fri, 2 Sep 2016 16:44:56 +0000 (13:44 -0300)]
[media] media: adv7180: fill in mbus format in set_fmt

If the V4L2_SUBDEV_FORMAT_TRY is used in set_fmt the width, height etc
would not be filled.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] adv7180: rcar-vin: change mbus format to UYVY
Niklas Söderlund [Fri, 2 Sep 2016 15:37:06 +0000 (12:37 -0300)]
[media] adv7180: rcar-vin: change mbus format to UYVY

The media bus format reported by the adv7180 is wrong. Steve Longerbeam
posted a patch which changed the format to UYVY8_2X8 with the commit
message:

  Change the media bus format from YUYV8_2X8 to UYVY8_2X8. Colors
  now look correct when capturing with the i.mx6 backend. The other
  option is to set the SWPC bit in register 0x27 to swap the Cr and Cb
  output samples.

The rcar-vin driver was developed and tested with the adv7180 and
therefor suffers from the same issue, looking for the wrong media bus
format. The two errors corrected each other.

This patch takes Steve's patch and merge it with a fix for rcar-vin
driver. The rcar-vin driver is used used in together with the adv7180
och Koelsch and this ensures it will not break while fixing the adv7180
issue. I checked wit Steve and he was fine with me merging the patches.

ADV7180 parts:

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Suggested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] soc-camera/rcar-vin: remove obsolete driver
Hans Verkuil [Mon, 1 Aug 2016 07:54:24 +0000 (04:54 -0300)]
[media] soc-camera/rcar-vin: remove obsolete driver

This driver has been replaced by the non-soc-camera rcar-vin driver.
The soc-camera framework is being deprecated, so drop this older
rcar-vin driver in favor of the newer version that does not rely on
this deprecated framework.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] hva: fix sparse warnings
Hans Verkuil [Fri, 16 Sep 2016 08:23:53 +0000 (05:23 -0300)]
[media] hva: fix sparse warnings

drivers/media/platform/sti/hva/hva-v4l2.c:43:22: warning: symbol 'hva_encoders' was not declared. Should it be static?
drivers/media/platform/sti/hva/hva-v4l2.c:1401:24: warning: symbol 'hva_driver' was not declared. Should it be static?

Make these static.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] mxl111sf-tuner: constify dvb_tuner_ops structures
Julia Lawall [Sun, 11 Sep 2016 14:44:14 +0000 (11:44 -0300)]
[media] mxl111sf-tuner: constify dvb_tuner_ops structures

These structures are only used to copy into other structures, so declare
them as const.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct dvb_tuner_ops i@p = { ... };

@ok1@
identifier r.i;
expression e;
position p;
@@
e = i@p

@ok2@
identifier r.i;
expression e1, e2;
position p;
@@
memcpy(e1, &i@p, e2)

@bad@
position p != {r.p,ok1.p,ok2.p};
identifier r.i;
struct dvb_tuner_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct dvb_tuner_ops i = { ... };
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] staging: media: omap4iss: mark omap4iss_flush() static
Baoyou Xie [Sun, 4 Sep 2016 06:41:41 +0000 (03:41 -0300)]
[media] staging: media: omap4iss: mark omap4iss_flush() static

We get 1 warning when building kernel with W=1:
drivers/staging/media/omap4iss/iss.c:64:6: warning: no previous prototype for 'omap4iss_flush' [-Wmissing-prototypes]

In fact, this function is only used in the file in which it is
declared and don't need a declaration, but can be made static.
so this patch marks this function with 'static'.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] lgdt3306a: fix spelling mistake "supportted" -> "supported"
Colin Ian King [Thu, 1 Sep 2016 11:09:41 +0000 (08:09 -0300)]
[media] lgdt3306a: fix spelling mistake "supportted" -> "supported"

Trivial fix to spelling mistake in pr_warn message.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc/streamzap: fix spelling mistake "sumbiting" -> "submitting"
Colin Ian King [Thu, 1 Sep 2016 11:03:14 +0000 (08:03 -0300)]
[media] rc/streamzap: fix spelling mistake "sumbiting" -> "submitting"

Trivial fix to spelling mistake in dev_err message.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] constify i2c_algorithm structures
Julia Lawall [Mon, 29 Aug 2016 13:12:01 +0000 (10:12 -0300)]
[media] constify i2c_algorithm structures

These i2c_algorithm structures are only stored in the alg field of an
i2c_adapter structure, which is declared as const.  This declare the
structures as const as well.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct i2c_algorithm i@p = { ... };

@ok@
identifier r.i;
struct i2c_adapter e;
position p;
@@
e.alg = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct i2c_algorithm i = { ... };
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] Input: v4l-touch - add copyright lines
Nick Dyer [Thu, 15 Sep 2016 20:30:43 +0000 (17:30 -0300)]
[media] Input: v4l-touch - add copyright lines

Add copyright lines for Zodiac who paid for the V4L touch work.

Signed-off-by: Nick Dyer <nick@shmanahar.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] usb: gadget: uvc: add V4L2 dependency
Arnd Bergmann [Mon, 12 Sep 2016 15:34:57 +0000 (12:34 -0300)]
[media] usb: gadget: uvc: add V4L2 dependency

Building the UVC gadget into the kernel fails to build when
CONFIG_VIDEO_V4L2 is a loadable module:

drivers/usb/gadget/function/usb_f_uvc.o: In function `uvc_function_ep0_complete':
uvc_configfs.c:(.text.uvc_function_ep0_complete+0x84): undefined reference to `v4l2_event_queue'
drivers/usb/gadget/function/usb_f_uvc.o: In function `uvc_function_disable':
uvc_configfs.c:(.text.uvc_function_disable+0x34): undefined reference to `v4l2_event_queue'

Adding a dependency in USB_CONFIGFS_F_UVC (which is a bool symbol)
make the 'select USB_F_UVC' statement turn the USB_F_UVC into 'm'
whenever CONFIG_VIDEO_V4L2=m too, avoiding the link failure.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] atmel-isc: mark PM functions as __maybe_unused
Arnd Bergmann [Mon, 12 Sep 2016 15:32:58 +0000 (12:32 -0300)]
[media] atmel-isc: mark PM functions as __maybe_unused

The newly added atmel-isc driver uses SET_RUNTIME_PM_OPS() to
refer to its suspend/resume functions, causing a warning when
CONFIG_PM is not set:

media/platform/atmel/atmel-isc.c:1477:12: error: 'isc_runtime_resume' defined but not used [-Werror=unused-function]
media/platform/atmel/atmel-isc.c:1467:12: error: 'isc_runtime_suspend' defined but not used [-Werror=unused-function]

This adds __maybe_unused annotations to avoid the warning without
adding an error-prone #ifdef around it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] ad5820: use __maybe_unused for PM functions
Arnd Bergmann [Mon, 12 Sep 2016 15:32:57 +0000 (12:32 -0300)]
[media] ad5820: use __maybe_unused for PM functions

The new ad5820 driver uses #ifdef to hide the suspend/resume functions,
but gets it wrong when CONFIG_PM_SLEEP is disabled:

drivers/media/i2c/ad5820.c:286:12: error: 'ad5820_resume' defined but not used [-Werror=unused-function]
drivers/media/i2c/ad5820.c:274:12: error: 'ad5820_suspend' defined but not used [-Werror=unused-function]

This replaces the #ifdef with a __maybe_unused annotation that is
simpler and harder to get wrong, avoiding the warning.

Fixes: bee3d5115611 ("[media] ad5820: Add driver for auto-focus coil")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] Input: synaptics-rmi4: disallow impossible configuration
Arnd Bergmann [Mon, 12 Sep 2016 15:30:33 +0000 (12:30 -0300)]
[media] Input: synaptics-rmi4: disallow impossible configuration

The newly added debug mode for the synaptics-rmi4 driver relies on
the v4l2 interface and vb2_vmalloc, but those might be configured
as loadable modules when the driver itself is built-in, resulting
in a link failure:

drivers/input/rmi4/rmi_core.o: In function `rmi_f54_remove':
rmi_f54.c:(.text.rmi_f54_remove+0x14): undefined reference to `video_unregister_device'
rmi_f54.c:(.text.rmi_f54_remove+0x20): undefined reference to `v4l2_device_unregister'
drivers/input/rmi4/rmi_core.o: In function `rmi_f54_vidioc_s_input':
rmi_f54.c:(.text.rmi_f54_vidioc_s_input+0x10): undefined reference to `video_devdata'
drivers/input/rmi4/rmi_core.o: In function `rmi_f54_vidioc_g_input':
rmi_f54.c:(.text.rmi_f54_vidioc_g_input+0x10): undefined reference to `video_devdata'
drivers/input/rmi4/rmi_core.o: In function `rmi_f54_vidioc_fmt':
rmi_f54.c:(.text.rmi_f54_vidioc_fmt+0x10): undefined reference to `video_devdata'
drivers/input/rmi4/rmi_core.o: In function `rmi_f54_vidioc_enum_input':
rmi_f54.c:(.text.rmi_f54_vidioc_enum_input+0x10): undefined reference to `video_devdata'
drivers/input/rmi4/rmi_core.o: In function `rmi_f54_vidioc_querycap':
...

The best workaround I could come up with is to disallow the debug
mode unless it's actually possible to call it.

Fixes: 3a762dbd5347 ("[media] Input: synaptics-rmi4 - add support for F54 diagnostics")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Nick Dyer <nick@shmanahar.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] Input: atmel_mxt: disallow impossible configuration
Arnd Bergmann [Mon, 12 Sep 2016 15:30:32 +0000 (12:30 -0300)]
[media] Input: atmel_mxt: disallow impossible configuration

The newnly added debug mode for the atmel_mxt_ts driver relies on
the v4l2 interface and vb2_vmalloc, but those might be configured
as loadable modules when the driver itself is built-in, resulting
in a link failure:

drivers/input/touchscreen/atmel_mxt_ts.o: In function `mxt_vidioc_querycap':
atmel_mxt_ts.c:(.text.mxt_vidioc_querycap+0x10): undefined reference to `video_devdata'
drivers/input/touchscreen/atmel_mxt_ts.o: In function `mxt_buffer_queue':
atmel_mxt_ts.c:(.text.mxt_buffer_queue+0x20): undefined reference to `vb2_plane_vaddr'
atmel_mxt_ts.c:(.text.mxt_buffer_queue+0x164): undefined reference to `vb2_buffer_done'
drivers/input/touchscreen/atmel_mxt_ts.o: In function `mxt_free_object_table':
atmel_mxt_ts.c:(.text.mxt_free_object_table+0x18): undefined reference to `video_unregister_device'
atmel_mxt_ts.c:(.text.mxt_free_object_table+0x20): undefined reference to `v4l2_device_unregister'

The best workaround I could come up with is to disallow the debug
mode unless it's actually possible to call it.

Fixes: ecfdd7e2660e ("[media] Input: atmel_mxt_ts - output diagnostic debug via V4L2 device")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Nick Dyer <nick@shmanahar.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] tuners: constify dvb_tuner_ops structures
Julia Lawall [Sun, 11 Sep 2016 14:44:13 +0000 (11:44 -0300)]
[media] tuners: constify dvb_tuner_ops structures

These structures are only used to copy into other structures, so declare
them as const.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct dvb_tuner_ops i@p = { ... };

@ok1@
identifier r.i;
expression e;
position p;
@@
e = i@p

@ok2@
identifier r.i;
expression e1, e2;
position p;
@@
memcpy(e1, &i@p, e2)

@bad@
position p != {r.p,ok1.p,ok2.p};
identifier r.i;
struct dvb_tuner_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct dvb_tuner_ops i = { ... };
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-frontends: constify dvb_tuner_ops structures
Julia Lawall [Sun, 11 Sep 2016 14:44:12 +0000 (11:44 -0300)]
[media] dvb-frontends: constify dvb_tuner_ops structures

These structures are only used to copy into other structures, so declare
them as const.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct dvb_tuner_ops i@p = { ... };

@ok1@
identifier r.i;
expression e;
position p;
@@
e = i@p

@ok2@
identifier r.i;
expression e1, e2;
position p;
@@
memcpy(e1, &i@p, e2)

@bad@
position p != {r.p,ok1.p,ok2.p};
identifier r.i;
struct dvb_tuner_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct dvb_tuner_ops i = { ... };
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] constify local structures
Julia Lawall [Sun, 11 Sep 2016 13:05:55 +0000 (10:05 -0300)]
[media] constify local structures

For structure types defined in the same file or local header files, find
top-level static structure declarations that have the following
properties:
1. Never reassigned.
2. Address never taken
3. Not passed to a top-level macro call
4. No pointer or array-typed field passed to a function or stored in a
variable.
Declare structures having all of these properties as const.

Done using Coccinelle.
Based on a suggestion by Joe Perches <joe@perches.com>.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] pci: constify vb2_ops structures
Julia Lawall [Thu, 8 Sep 2016 23:59:18 +0000 (20:59 -0300)]
[media] pci: constify vb2_ops structures

Check for vb2_ops structures that are only stored in the ops field of a
vb2_queue structure.  That field is declared const, so vb2_ops structures
that have this property can be declared as const also.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct vb2_ops i@p = { ... };

@ok@
identifier r.i;
struct vb2_queue e;
position p;
@@
e.ops = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
struct vb2_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct vb2_ops i = { ... };
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] platform: constify vb2_ops structures
Julia Lawall [Thu, 8 Sep 2016 23:59:10 +0000 (20:59 -0300)]
[media] platform: constify vb2_ops structures

Check for vb2_ops structures that are only stored in the ops field of a
vb2_queue structure.  That field is declared const, so vb2_ops structures
that have this property can be declared as const also.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct vb2_ops i@p = { ... };

@ok@
identifier r.i;
struct vb2_queue e;
position p;
@@
e.ops = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
struct vb2_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct vb2_ops i = { ... };
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Fabien Dessenne <fabien.dessenne@st.com>
Reviewed-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Reviewed-by: Benoit Parrot <bparrot@ti.com>
[hans.verkuil@cisco.com: dropped soc_camera/rcar_vin.c patch because that driver will be removed]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] usb: constify vb2_ops structures
Julia Lawall [Thu, 8 Sep 2016 23:59:01 +0000 (20:59 -0300)]
[media] usb: constify vb2_ops structures

Check for vb2_ops structures that are only stored in the ops field of a
vb2_queue structure.  That field is declared const, so vb2_ops structures
that have this property can be declared as const also.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct vb2_ops i@p = { ... };

@ok@
identifier r.i;
struct vb2_queue e;
position p;
@@
e.ops = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
struct vb2_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct vb2_ops i = { ... };
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] ov9650: add support for asynchronous probing
Javier Martinez Canillas [Thu, 8 Sep 2016 13:05:40 +0000 (10:05 -0300)]
[media] ov9650: add support for asynchronous probing

Allow the sub-device to be probed asynchronously so a bridge driver that's
waiting for the device can be notified and its .bound callback executed.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Tested-by: H . Nikolaus Schaller <hns@goldelico.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] usb: constify snd_pcm_ops structures
Julia Lawall [Thu, 8 Sep 2016 00:59:06 +0000 (21:59 -0300)]
[media] usb: constify snd_pcm_ops structures

Check for snd_pcm_ops structures that are only stored in the ops field of a
snd_soc_platform_driver structure or passed as the third argument to
snd_pcm_set_ops.  The corresponding field or parameter is declared const,
so snd_pcm_ops structures that have this property can be declared as const
also.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct snd_pcm_ops i@p = { ... };

@ok1@
identifier r.i;
struct snd_soc_platform_driver e;
position p;
@@
e.ops = &i@p;

@ok2@
identifier r.i;
expression e1, e2;
position p;
@@
snd_pcm_set_ops(e1, e2, &i@p)

@bad@
position p != {r.p,ok1.p,ok2.p};
identifier r.i;
struct snd_pcm_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct snd_pcm_ops i = { ... };
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] pci: constify snd_pcm_ops structures
Julia Lawall [Thu, 8 Sep 2016 00:44:39 +0000 (21:44 -0300)]
[media] pci: constify snd_pcm_ops structures

Check for snd_pcm_ops structures that are only stored in the ops field of a
snd_soc_platform_driver structure or passed as the third argument to
snd_pcm_set_ops.  The corresponding field or parameter is declared const,
so snd_pcm_ops structures that have this property can be declared as const
also.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct snd_pcm_ops i@p = { ... };

@ok1@
identifier r.i;
struct snd_soc_platform_driver e;
position p;
@@
e.ops = &i@p;

@ok2@
identifier r.i;
expression e1, e2;
position p;
@@
snd_pcm_set_ops(e1, e2, &i@p)

@bad@
position p != {r.p,ok1.p,ok2.p};
identifier r.i;
struct snd_pcm_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct snd_pcm_ops i = { ... };
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] vsp1: fix CodingStyle violations on multi-line comments
Mauro Carvalho Chehab [Mon, 19 Sep 2016 18:18:01 +0000 (15:18 -0300)]
[media] vsp1: fix CodingStyle violations on multi-line comments

Several multi-line comments added at the vsp1 patch series
violate the Kernel CodingStyle. Fix them.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: vsp1: Disable VYUY on Gen3
Laurent Pinchart [Thu, 15 Sep 2016 19:08:09 +0000 (16:08 -0300)]
[media] v4l: vsp1: Disable VYUY on Gen3

The VYUY format isn't supported on Gen3 hardware, disable it.

Gen2 hardware supports VYUY in practice even though the documentation
doesn't advertise it, so keep it for Gen2 devices.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: vsp1: Fix spinlock in mixed IRQ context function
Laurent Pinchart [Tue, 13 Sep 2016 23:19:29 +0000 (20:19 -0300)]
[media] v4l: vsp1: Fix spinlock in mixed IRQ context function

The wpf_configure() function can be called both from IRQ and non-IRQ
contexts, use spin_lock_irqsave().

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: vsp1: Support multiple partitions per frame
Kieran Bingham [Mon, 12 Sep 2016 02:26:35 +0000 (23:26 -0300)]
[media] v4l: vsp1: Support multiple partitions per frame

Adapt vsp1_video_pipeline_run() such that it can iterate each partition
required for constructing this frame's display list chain in the event
that multiple display lists are required to process in hardware.

The first display list is held as the head list object, whilst any
following parition display lists are linked to the head by means of
vsp1_dl_list_add_chain().

Linking the chained display list headers to process using the auto start
mechanism of the hardware is performed during the vsp1_dl_list_commit().

Signed-off-by: Kieran Bingham <kieran+renesas@bingham.xyz>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: vsp1: Determine partition requirements for scaled images
Kieran Bingham [Tue, 12 Jul 2016 13:06:34 +0000 (10:06 -0300)]
[media] v4l: vsp1: Determine partition requirements for scaled images

The partition algorithm needs to determine the capabilities of each
entity in the pipeline to identify the correct maximum partition width.

Extend the vsp1 entity operations to provide a max_width operation and
use this call to calculate the number of partitions that will be
processed by the algorithm.

Gen 2 hardware does not require multiple partitioning, and as such
will always return a single partition.

Signed-off-by: Kieran Bingham <kieran+renesas@bingham.xyz>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: vsp1: Support chained display lists
Kieran Bingham [Tue, 12 Jul 2016 16:49:46 +0000 (13:49 -0300)]
[media] v4l: vsp1: Support chained display lists

When display lists are linked in a chain, they will be processed
automatically by the hardware, with each list linking to the next. Only
on the last display list will the frame end interrupt be fired to mark
the completion event.

Upon frame-end, the chain will be iterated to release each display list
back to the free list.

The chained lists use case (image partitioning) can require up to 64
lists per frame in the worst case scenario, bump up the number of
preallocated lists.

Signed-off-by: Kieran Bingham <kieran+renesas@bingham.xyz>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: vsp1: Replace .set_memory() with VSP1_ENTITY_PARAMS_PARTITION
Laurent Pinchart [Mon, 12 Sep 2016 12:50:13 +0000 (09:50 -0300)]
[media] v4l: vsp1: Replace .set_memory() with VSP1_ENTITY_PARAMS_PARTITION

The new VSP1_ENTITY_PARAMS_PARTITION configuration parameters type
covers all registers that need to be configured for every partition.
This prepares for support of image partitioning, and replaces the
.set_memory() operation as the memory registers take different values
for every partition.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: vsp1: Pass parameter type to entity configuration operation
Laurent Pinchart [Sun, 11 Sep 2016 22:39:30 +0000 (19:39 -0300)]
[media] v4l: vsp1: Pass parameter type to entity configuration operation

Replace the current boolean parameter (full / !full) with an explicit
enum.

- VSP1_ENTITY_PARAMS_INIT for parameters to be configured at pipeline
  initialization time only (V4L2 stream on or DRM atomic update)
- VSP1_ENTITY_PARAMS_RUNTIME for all parameters that can be freely
  modified at runtime (through V4L2 controls)

This will allow future extensions when implementing image partitioning
support.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: vsp1: Fix RPF cropping
Laurent Pinchart [Mon, 12 Sep 2016 15:38:36 +0000 (12:38 -0300)]
[media] v4l: vsp1: Fix RPF cropping

The RPF cropping offset for the chroma planes is incorrectly computed,
it needs to be divided by the horizontal subsampling factor.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: vsp1: Disable cropping on WPF sink pad
Laurent Pinchart [Mon, 12 Sep 2016 01:41:06 +0000 (22:41 -0300)]
[media] v4l: vsp1: Disable cropping on WPF sink pad

Cropping on the WPF sink pad restricts the left and top coordinates to
0-255. The same result can be obtained by cropping on the RPF without
any such restriction, this feature isn't useful. Disable it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: vsp1: Use DFE instead of FRE for frame end
Kieran Bingham [Tue, 6 Sep 2016 09:55:02 +0000 (06:55 -0300)]
[media] v4l: vsp1: Use DFE instead of FRE for frame end

The DFE and FRE interrupts are both fired at frame completion, as each
display list processes a single frame. This won't be true anymore when
using image partitioning, switch to DFE in preparation.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran+renesas@bingham.xyz>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: vsp1: Repair race between frame end and qbuf handler
Kieran Bingham [Tue, 6 Sep 2016 17:07:09 +0000 (14:07 -0300)]
[media] v4l: vsp1: Repair race between frame end and qbuf handler

The frame-end function releases and completes the buffers on the input
and output entities of the pipe before marking the pipe->state as
'STOPPED'. This introduces a race whereby with the pipe->state still
'RUNNING', a QBUF handler can commence processing a frame before the
frame_end function has completed.

In the event that this happens, a frame queued by QBUF hangs due to the
incorrect pipe->state setting which prevents vsp1_pipeline_run from
issuing a CMD_STRCMD.

By locking the entire function we prevent this from occurring, but we
also change the locking state of the buffer release code. This has been
analysed visually as acceptable, but it must be considered that this now
causes the video->irqlock to be taken under the pipe->irqlock context.

Signed-off-by: Kieran Bingham <kieran+renesas@bingham.xyz>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: vsp1: Ensure pipeline locking in resume path
Kieran Bingham [Fri, 2 Sep 2016 10:48:27 +0000 (07:48 -0300)]
[media] v4l: vsp1: Ensure pipeline locking in resume path

The vsp1_pipeline_ready() and vsp1_pipeline_run() functions must be
called with the pipeline lock held, fix the resume code path.

Signed-off-by: Kieran Bingham <kieran+renesas@bingham.xyz>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: vsp1: Protect against race conditions between get and set format
Laurent Pinchart [Sun, 26 Jun 2016 11:09:31 +0000 (08:09 -0300)]
[media] v4l: vsp1: Protect against race conditions between get and set format

The subdev userspace API isn't serialized in the core, serialize access
to formats and selection rectangles in the driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: vsp1: Prevent pipelines from running when not streaming
Laurent Pinchart [Fri, 8 Jul 2016 09:20:51 +0000 (06:20 -0300)]
[media] v4l: vsp1: Prevent pipelines from running when not streaming

Pipelines can only be run if all their video nodes are streaming. Commit
b4dfb9b35a19 ("[media] v4l: vsp1: Stop the pipeline upon the first
STREAMOFF") fixed the pipeline stop sequence, but introduced a race
condition that makes it possible to run a pipeline after stopping the
stream on a video node by queuing a buffer on the other side of the
pipeline.

Fix this by clearing the buffers ready flag when stopping the stream,
which will prevent the QBUF handler from running the pipeline.

Fixes: b4dfb9b35a19 ("[media] v4l: vsp1: Stop the pipeline upon the first STREAMOFF")

Reported-by: Kieran Bingham <kieran@bingham.xyz>
Tested-by: Kieran Bingham <kieran@bingham.xyz>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] gs1662: make checkpatch happy
Mauro Carvalho Chehab [Mon, 19 Sep 2016 17:39:49 +0000 (14:39 -0300)]
[media] gs1662: make checkpatch happy

WARNING: line over 80 characters
+      GS_HEIGHT_MAX, GS_PIXELCLOCK_MIN, GS_PIXELCLOCK_MAX,

WARNING: line over 80 characters
+ if (v4l2_match_dv_timings(timings, &reg_fmt[i].format, 0, false))

WARNING: Block comments use a trailing */ on a separate line
+  * which looks like a video signal activity.*/

WARNING: else is not generally useful after a break or return
+ return gs_write_register(gs->pdev, REG_FORCE_FMT, reg_value);
+ } else {

WARNING: Block comments use a trailing */ on a separate line
+  * which looks like a video signal activity.*/

ERROR: spaces required around that '=' (ctx:VxW)
+ .enum_dv_timings= gs_enum_dv_timings,
                  ^

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media Kconfig: improve the spi integration
Hans Verkuil [Thu, 15 Sep 2016 15:18:14 +0000 (12:18 -0300)]
[media] media Kconfig: improve the spi integration

The SPI driver looked a bit lonely in the config menu, and it didn't
support the autoselect. Shift things around a bit so it looks more logical.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] Add GS1662 driver, a video serializer
Charles-Antoine Couret [Thu, 15 Sep 2016 15:29:51 +0000 (12:29 -0300)]
[media] Add GS1662 driver, a video serializer

You can read datasheet here:
http://www.c-dis.net/media/871/GS1662_Datasheet.pdf

It's a component which supports HD and SD CEA or SDI formats
to SDI output. It's configured through SPI bus.

GS1662 driver is implemented as v4l2 subdev.

Signed-off-by: Charles-Antoine Couret <charles-antoine.couret@nexvision.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] videodev2.h.rst.exceptions: fix warnings
Mauro Carvalho Chehab [Mon, 19 Sep 2016 17:27:25 +0000 (14:27 -0300)]
[media] videodev2.h.rst.exceptions: fix warnings

Changeset ab6343956f9c ("[media] V4L2: Add documentation for SDI timings
and related flags") added documentation for new V4L2 defines, but
it forgot to update videodev2.h.rst.exceptions to point to where
the documentation for those new values will be inside the book,
causing those warnings:

    Documentation/output/videodev2.h.rst:6: WARNING: undefined label: v4l2-dv-bt-std-sdi (if the link has no caption the label must precede a section header)
    Documentation/output/videodev2.h.rst:6: WARNING: undefined label: v4l2-dv-fl-first-field-extra-line (if the link has no caption the label must precede a section header)
    Documentation/output/videodev2.h.rst:6: WARNING: undefined label: v4l2-in-st-no-v-lock (if the link has no caption the label must precede a section header)
    Documentation/output/videodev2.h.rst:6: WARNING: undefined label: v4l2-in-st-no-std-lock (if the link has no caption the label must precede a section header)

Fixes: ab6343956f9c ("[media] V4L2: Add documentation for SDI timings and related flags")

Cc: Charles-Antoine Couret <charles-antoine.couret@nexvision.fr>
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] V4L2: Add documentation for SDI timings and related flags
Charles-Antoine Couret [Thu, 15 Sep 2016 13:53:55 +0000 (10:53 -0300)]
[media] V4L2: Add documentation for SDI timings and related flags

Describe new needed constants defined by SDI format.

Signed-off-by: Charles-Antoine Couret <charles-antoine.couret@nexvision.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] SDI: add flag for SDI formats and SMPTE 125M definition
Charles-Antoine Couret [Thu, 15 Sep 2016 15:29:50 +0000 (12:29 -0300)]
[media] SDI: add flag for SDI formats and SMPTE 125M definition

Adding others generic flags, which could be used by many
components like GS1662.

Signed-off-by: Charles-Antoine Couret <charles-antoine.couret@nexvision.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agoMAINTAINERS: update documentation for media subsystem
Mauro Carvalho Chehab [Mon, 12 Sep 2016 15:48:54 +0000 (12:48 -0300)]
MAINTAINERS: update documentation for media subsystem

With ReST conversion, the media subsystem documentation is now
located on different directories.

Update them.

Suggested-by: Joe Perches <joe@perches.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Cc: linux-doc <linux-doc@vger.kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] vivid: fix error return code in vivid_create_instance()
Wei Yongjun [Thu, 15 Sep 2016 03:36:09 +0000 (00:36 -0300)]
[media] vivid: fix error return code in vivid_create_instance()

Fix to return error code -ENOMEM from the memory or workqueue alloc
error handling case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] pxa_camera: remove duplicated include from pxa_camera.c
Wei Yongjun [Thu, 15 Sep 2016 02:22:03 +0000 (23:22 -0300)]
[media] pxa_camera: remove duplicated include from pxa_camera.c

Remove duplicated include.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] pxa_camera: fix error return code in pxa_camera_probe()
Wei Yongjun [Thu, 15 Sep 2016 02:21:45 +0000 (23:21 -0300)]
[media] pxa_camera: fix error return code in pxa_camera_probe()

Fix to return error code -ENODEV from dma_request_slave_channel_compat()
error handling case instead of 0, as done elsewhere in this function.

Also fix to release resources in v4l2_clk_register() error handling.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] tw5864: constify struct video_device template
Andrey Utkin [Mon, 12 Sep 2016 23:02:38 +0000 (20:02 -0300)]
[media] tw5864: constify struct video_device template

tw5864_video_template is used for filling of actual video_device
structures. It is copied by value, and is not used for anything else.

Signed-off-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] tw5864: constify vb2_ops structure
Andrey Utkin [Mon, 12 Sep 2016 23:02:37 +0000 (20:02 -0300)]
[media] tw5864: constify vb2_ops structure

Inspired by "[media] pci: constify vb2_ops structures" patch
from Julia Lawall (dated 9 Sep 2016).

Signed-off-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] pulse8-cec: avoid uninitialized data use
Arnd Bergmann [Mon, 12 Sep 2016 08:43:49 +0000 (05:43 -0300)]
[media] pulse8-cec: avoid uninitialized data use

Building with -Wmaybe-uninitialized reveals the use on an uninitialized
variable containing the physical address of the device whenever
firmware before version 2 is used:

drivers/staging/media/pulse8-cec/pulse8-cec.c: In function 'pulse8_connect':
drivers/staging/media/pulse8-cec/pulse8-cec.c:447:2: error: 'pa' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This sets the address to CEC_PHYS_ADDR_INVALID in this case, so we don't
try to write back the uninitialized data to the device.

Fixes: e28a6c8b3fcc ("[media] pulse8-cec: sync configuration with adapter")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>