platform/kernel/linux-exynos.git
9 years ago[media] rtl2832: implement PID filter
Antti Palosaari [Sun, 14 Dec 2014 17:07:35 +0000 (14:07 -0300)]
[media] rtl2832: implement PID filter

Implement PID filter. This demod has PID filter size of 32 PIDs.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2832: define more demod lock statuses
Antti Palosaari [Sun, 14 Dec 2014 15:15:55 +0000 (12:15 -0300)]
[media] rtl2832: define more demod lock statuses

Demod lock flags are derived from demod state machine states. States
are running from 1 to 11, where highest state 11 means demod is
fully locked and streaming. Naturally smaller state numbers means
there is some partial locks.

Define now state 10 as missing synch and lock.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2832: drop FE i2c gate control support
Antti Palosaari [Sun, 14 Dec 2014 14:56:08 +0000 (11:56 -0300)]
[media] rtl2832: drop FE i2c gate control support

We don't need it anymore as all users are using muxed I2C adapter.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl28xxu: use demod mux I2C adapter for every tuner
Antti Palosaari [Sun, 14 Dec 2014 14:45:55 +0000 (11:45 -0300)]
[media] rtl28xxu: use demod mux I2C adapter for every tuner

Tuners are connected to demod I2C adapter. Use that muxed adapter
for each tuner. That allows us to get rid of hackish FE gate control
solution.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2832: implement DVBv5 signal strength statistics
Antti Palosaari [Sun, 14 Dec 2014 14:00:50 +0000 (11:00 -0300)]
[media] rtl2832: implement DVBv5 signal strength statistics

Estimate signal strength from IF digital AGC.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2832: wrap DVBv5 BER to DVBv3
Antti Palosaari [Sun, 14 Dec 2014 13:10:22 +0000 (10:10 -0300)]
[media] rtl2832: wrap DVBv5 BER to DVBv3

Change legacy DVBv3 read BER to return values calculated by DVBv5
statistics.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2832: wrap DVBv5 CNR to DVBv3 SNR
Antti Palosaari [Sun, 14 Dec 2014 13:05:49 +0000 (10:05 -0300)]
[media] rtl2832: wrap DVBv5 CNR to DVBv3 SNR

Change legacy DVBv3 read SNR to return values calculated by DVBv5
statistics.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2832: implement DVBv5 BER statistic
Antti Palosaari [Sun, 14 Dec 2014 12:59:20 +0000 (09:59 -0300)]
[media] rtl2832: implement DVBv5 BER statistic

DVBv5 BER.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2832: implement DVBv5 CNR statistic
Antti Palosaari [Sun, 14 Dec 2014 09:55:43 +0000 (06:55 -0300)]
[media] rtl2832: implement DVBv5 CNR statistic

DVBv5 CNR.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2832: convert to regmap API
Antti Palosaari [Sun, 14 Dec 2014 07:45:57 +0000 (04:45 -0300)]
[media] rtl2832: convert to regmap API

Use regmap to cover register access routines.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl28xxu: use platform data config for rtl2832 demod
Antti Palosaari [Sat, 13 Dec 2014 08:44:05 +0000 (05:44 -0300)]
[media] rtl28xxu: use platform data config for rtl2832 demod

Use platform data configuration for rtl2832 demod driver. Old
configuration are still left as it is used for rtl2832_sdr driver.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2832: move all configuration to platform data struct
Antti Palosaari [Sat, 13 Dec 2014 08:26:27 +0000 (05:26 -0300)]
[media] rtl2832: move all configuration to platform data struct

Move all needed configuration values to platform data structure
and remove old configuration code where possible.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2832: enhance / fix logging
Antti Palosaari [Sat, 13 Dec 2014 05:28:33 +0000 (02:28 -0300)]
[media] rtl2832: enhance / fix logging

Pass correct device pointer to dev_* logging functions in order
print logs correctly.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2832: rename driver state variable from 'priv' to 'dev'
Antti Palosaari [Sat, 13 Dec 2014 03:37:43 +0000 (00:37 -0300)]
[media] rtl2832: rename driver state variable from 'priv' to 'dev'

Rename it device state variable to dev. Both priv and dev are very
common terms for such variable in kernel, but I like use dev in
order to keep drivers consistent.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2832: remove exported resources
Antti Palosaari [Sat, 13 Dec 2014 03:21:04 +0000 (00:21 -0300)]
[media] rtl2832: remove exported resources

Exported resources are not needed anymore as all users are using
callbacks carried via platform data. Due to that we will remove
those.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl28xxu: use rtl2832 demod callbacks accessing its resources
Antti Palosaari [Sat, 13 Dec 2014 03:09:57 +0000 (00:09 -0300)]
[media] rtl28xxu: use rtl2832 demod callbacks accessing its resources

Switch demod resource use from exported symbols to callbacks its
provides.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2832: add platform data callbacks for exported resources
Antti Palosaari [Sat, 13 Dec 2014 02:16:19 +0000 (23:16 -0300)]
[media] rtl2832: add platform data callbacks for exported resources

Add callback for all of those functions which are currently
exported using EXPORT_SYMBOL. That allows us convert every user to
callbacks and eventually all exported symbols could be removed.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2830: convert to regmap API
Antti Palosaari [Fri, 12 Dec 2014 04:03:51 +0000 (01:03 -0300)]
[media] rtl2830: convert to regmap API

Use regmap to cover register access routines.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2830: implement own I2C locking
Antti Palosaari [Tue, 9 Dec 2014 19:14:41 +0000 (16:14 -0300)]
[media] rtl2830: implement own I2C locking

Own I2C locking is needed due to two special reasons:
1) Chips uses multiple register pages/banks on single I2C slave.
Page is changed via I2C register access.
2) Chip offers muxed/gated I2C adapter for tuner. Gate/mux is
controlled by I2C register access.

Due to these reasons, I2C locking did not fit very well.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl28xxu: add support for RTL2831U/RTL2830 PID filter
Antti Palosaari [Tue, 9 Dec 2014 19:10:14 +0000 (16:10 -0300)]
[media] rtl28xxu: add support for RTL2831U/RTL2830 PID filter

RTL2830 demod integrated to RTL2831U has PID filter. PID filtering
is provided by rtl2830 demod driver. Add support for it.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2830: implement PID filter
Antti Palosaari [Tue, 9 Dec 2014 19:08:44 +0000 (16:08 -0300)]
[media] rtl2830: implement PID filter

Implement PID filter.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2830: wrap DVBv5 CNR to DVBv3 SNR
Antti Palosaari [Tue, 9 Dec 2014 13:48:10 +0000 (10:48 -0300)]
[media] rtl2830: wrap DVBv5 CNR to DVBv3 SNR

Change legacy DVBv3 read SNR to return values calculated by DVBv5
statistics.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2830: wrap DVBv5 BER to DVBv3
Antti Palosaari [Tue, 9 Dec 2014 13:27:32 +0000 (10:27 -0300)]
[media] rtl2830: wrap DVBv5 BER to DVBv3

Change legacy DVBv3 read BER to return values calculated by DVBv5
statistics.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2830: wrap DVBv5 signal strength to DVBv3
Antti Palosaari [Tue, 9 Dec 2014 13:20:01 +0000 (10:20 -0300)]
[media] rtl2830: wrap DVBv5 signal strength to DVBv3

Change legacy DVBv3 signal strength to return values calculated by
DVBv5 statistics.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2830: implement DVBv5 BER statistic
Antti Palosaari [Tue, 9 Dec 2014 12:45:16 +0000 (09:45 -0300)]
[media] rtl2830: implement DVBv5 BER statistic

DVBv5 BER.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2830: implement DVBv5 signal strength statistics
Antti Palosaari [Tue, 9 Dec 2014 11:49:44 +0000 (08:49 -0300)]
[media] rtl2830: implement DVBv5 signal strength statistics

Estimate signal strength from IF AGC.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2830: implement DVBv5 CNR statistic
Antti Palosaari [Tue, 9 Dec 2014 09:14:36 +0000 (06:14 -0300)]
[media] rtl2830: implement DVBv5 CNR statistic

DVBv5 CNR.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2830: style related changes
Antti Palosaari [Tue, 9 Dec 2014 05:31:53 +0000 (02:31 -0300)]
[media] rtl2830: style related changes

Trivial changes proposed by checkpatch.pl and some more.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2830: get rid of internal config data
Antti Palosaari [Tue, 9 Dec 2014 03:24:13 +0000 (00:24 -0300)]
[media] rtl2830: get rid of internal config data

Remove internal config and use configuration values directly from
the platform data.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2830: fix logging
Antti Palosaari [Tue, 9 Dec 2014 02:32:19 +0000 (23:32 -0300)]
[media] rtl2830: fix logging

Pass correct device for dev_foo() logging in order to print logs
correctly.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2830: carry pointer to I2C client for every function
Antti Palosaari [Tue, 9 Dec 2014 01:47:21 +0000 (22:47 -0300)]
[media] rtl2830: carry pointer to I2C client for every function

As a I2C driver struct i2c_client is top level structure representing
the driver. Use it as parameter to carry all needed information for
each function in order to simplify things.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2830: rename 'priv' to 'dev'
Antti Palosaari [Tue, 9 Dec 2014 01:31:28 +0000 (22:31 -0300)]
[media] rtl2830: rename 'priv' to 'dev'

Use name 'dev' for device state instance as it is more common and
also one letter shorter.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2830: get rid of legacy DVB driver binding
Antti Palosaari [Tue, 9 Dec 2014 01:20:55 +0000 (22:20 -0300)]
[media] rtl2830: get rid of legacy DVB driver binding

Remove legacy DVB binding as all users are using I2C binding.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl28xxu: use I2C binding for RTL2830 demod driver
Antti Palosaari [Mon, 8 Dec 2014 01:02:23 +0000 (22:02 -0300)]
[media] rtl28xxu: use I2C binding for RTL2830 demod driver

rtl2830 driver supports now I2C model too. Start using it.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2830: convert driver to kernel I2C model
Antti Palosaari [Sun, 7 Dec 2014 07:07:29 +0000 (04:07 -0300)]
[media] rtl2830: convert driver to kernel I2C model

Convert driver to kernel I2C model. Old DVB proprietary model is
still left there also.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] dvb-usb-v2: add pointer to 'struct usb_interface' for driver usage
Antti Palosaari [Wed, 17 Dec 2014 11:10:49 +0000 (08:10 -0300)]
[media] dvb-usb-v2: add pointer to 'struct usb_interface' for driver usage

Top level pointer on USB probe is struct usb_interface *. Add that
pointer to struct dvb_usb_device that drivers could use it, for
dev_* logging and more.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] smipcie: return more proper value in interrupt handler
Nibble Max [Thu, 25 Dec 2014 08:18:31 +0000 (05:18 -0300)]
[media] smipcie: return more proper value in interrupt handler

Although IRQ_HANDLED is "safe" value to return,
it is better to let the kernel know whether the driver handle the interrupt or not.

Signed-off-by: Nibble Max <nibble.max@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: platform: fix platform_no_drv_owner.cocci warnings
Fengguang Wu [Fri, 30 Jan 2015 02:26:10 +0000 (23:26 -0300)]
[media] media: platform: fix platform_no_drv_owner.cocci warnings

drivers/media/platform/am437x/am437x-vpfe.c:2767:3-8: No need to set .owner here. The core will do it.

 Remove .owner field if calls are used which set it automatically

Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci

CC: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] marvell-ccic: MMP_CAMERA no longer builds
Arnd Bergmann [Wed, 28 Jan 2015 22:11:20 +0000 (19:11 -0300)]
[media] marvell-ccic: MMP_CAMERA no longer builds

The mmp ccic driver expects a platform_data structure that does not exist
in the mainline kernel and presumably was changed in a kernel fork, which
leads to build errors now:

media/platform/marvell-ccic/mmp-driver.c: In function 'mmpcam_calc_dphy':
media/platform/marvell-ccic/mmp-driver.c:252:15: error: 'struct mmp_camera_platform_data' has no member named 'dphy3_algo'
  switch (pdata->dphy3_algo) {
               ^
media/platform/marvell-ccic/mmp-driver.c:253:7: error: 'DPHY3_ALGO_PXA910' undeclared (first use in this function)
  case DPHY3_ALGO_PXA910:
       ^
media/platform/marvell-ccic/mmp-driver.c:253:7: note: each undeclared identifier is reported only once for each function it appears in
media/platform/marvell-ccic/mmp-driver.c:257:8: error: 'struct mmp_camera_platform_data' has no member named 'dphy'

This marks the driver as 'BROKEN' but keeps the code around.
Alternatively it could be removed entirely.

Fixes: 05fed81625bf75 ("[media] marvell-ccic: add MIPI support for marvell-ccic driver")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Cc: Libin Yang <lbyang@marvell.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] staging: bcm2048: Delete an unnecessary check before the function call "video...
Markus Elfring [Mon, 2 Feb 2015 12:20:23 +0000 (09:20 -0300)]
[media] staging: bcm2048: Delete an unnecessary check before the function call "video_unregister_device"

The video_unregister_device() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: ti-vpe: Use mem-to-mem ioctl helpers
Prabhakar Lad [Fri, 19 Dec 2014 13:52:04 +0000 (10:52 -0300)]
[media] media: ti-vpe: Use mem-to-mem ioctl helpers

1: Simplify the vpe mem-to-mem driver by using the m2m ioctl
   and vb2 helpers.
2: Align and arranged the v4l2_ioctl_ops.
3: Fixes a typo.
4: Use of_match_ptr() instead of explicitly defining the macro
   to NULL in case CONFIG_OF is not defined.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] dib8000: upd_demod_gain_period should be u32
Mauro Carvalho Chehab [Tue, 23 Dec 2014 14:21:12 +0000 (11:21 -0300)]
[media] dib8000: upd_demod_gain_period should be u32

X-Patchwork-Delegate: m.chehab@samsung.com
As shown at the code, upd_demod_gain_period is used to write
to two 16-bit registers:
    dib8000_write_word(state, 1946, upd_demod_gain_period & 0xFFFF);
    dib8000_write_word(state, 1947, reg | (1<<14) | ((upd_demod_gain_period >> 16) & 0xFF));

So, it should be declared as u32.

This fixes the following smatch warning:
drivers/media/dvb-frontends/dib8000.c:1282 dib8000_agc_startup() warn: right shifting more than type allows

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] cx23885: move CI/MAC registration to a separate function
Mauro Carvalho Chehab [Tue, 23 Dec 2014 15:48:07 +0000 (13:48 -0200)]
[media] cx23885: move CI/MAC registration to a separate function

As reported by smatch:
drivers/media/pci/cx23885/cx23885-dvb.c:2080 dvb_register() Function too hairy.  Giving up.

This is indeed a too complex function, with lots of stuff inside.
Breaking this into two functions makes it a little bit less hairy.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: au0828 - convert to use videobuf2
Shuah Khan [Thu, 29 Jan 2015 16:41:32 +0000 (13:41 -0300)]
[media] media: au0828 - convert to use videobuf2

Convert au0828 to use videobuf2. Tested with NTSC.
Tested video and vbi devices with xawtv, tvtime,
and vlc. Ran v4l2-compliance to ensure there are
no failures.

Video compliance test results summary:
Total: 75, Succeeded: 75, Failed: 0, Warnings: 18

Vbi compliance test results summary:
Total: 75, Succeeded: 75, Failed: 0, Warnings: 0

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Reviewed-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: fix au0828 compile error from au0828_boards initialization
Shuah Khan [Tue, 13 Jan 2015 02:56:55 +0000 (23:56 -0300)]
[media] media: fix au0828 compile error from au0828_boards initialization

au0828 picked up UNSET from videobuf-core.h and fails to compile
if videobuf-core.h isn't included. Change it to use -1U instead
to fix the problem.

    drivers/media/usb/au0828/au0828-cards.c:47:17: error: â€˜UNSET’ undeclared here (not in a function)
       .tuner_type = UNSET,

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: fix au0828_analog_register() to not free au0828_dev
Shuah Khan [Sun, 21 Dec 2014 03:24:48 +0000 (00:24 -0300)]
[media] media: fix au0828_analog_register() to not free au0828_dev

au0828_analog_register() frees au0828_dev when it fails to
locate isoc endpoint. au0828_usb_probe() continues with dvb
and rc probe and registration assuming dev is still valid.
When au0828_analog_register() fails to locate isoc endpoint,
it should return without free'ing au0828_dev. Otherwise, the
probe will fail as dev is null when au0828_dvb_register() is
called.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] Add MAINTAINERS entry for the adv7180
Lars-Peter Clausen [Fri, 23 Jan 2015 15:52:34 +0000 (12:52 -0300)]
[media] Add MAINTAINERS entry for the adv7180

Add myself as the maintainer for the adv7180 video subdev driver.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Federico Vaga <federico.vaga@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] adv7180: Add fast switch support
Lars-Peter Clausen [Fri, 23 Jan 2015 15:52:33 +0000 (12:52 -0300)]
[media] adv7180: Add fast switch support

In fast switch mode the adv7180 (and similar) can lock onto a new signal
faster when switching between different inputs. As a downside though it is
no longer able to auto-detect the incoming format.

The fast switch mode is exposed as a boolean v4l control that allows
userspace applications to either enable or disable fast switch mode.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Federico Vaga <federico.vaga@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] adv7180: Add I2P support
Lars-Peter Clausen [Fri, 23 Jan 2015 15:52:32 +0000 (12:52 -0300)]
[media] adv7180: Add I2P support

Some of the devices supported by this driver have a interlaced-to-
progressive converter which can optionally be enabled. This patch adds
support for enabling and disabling the I2P converter on such devices.

I2P mode can be enabled by selecting V4L2_FIELD_NONE instead of
V4L2_FIELD_INTERLACED for the format.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Federico Vaga <federico.vaga@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] adv7180: Add support for the adv7280-m/adv7281-m/adv7281-ma/adv7282-m
Lars-Peter Clausen [Fri, 23 Jan 2015 15:52:31 +0000 (12:52 -0300)]
[media] adv7180: Add support for the adv7280-m/adv7281-m/adv7281-ma/adv7282-m

This patch adds support for the adv7280-m/adv2781-m/adv7281-ma/adv7282-m
devices to the adv7180 driver. They are very similar to the
adv7280/adv7281/adv7282 but instead of parallel video out they feature a
MIPI CSI2 transmitter.

The CSI2 transmitter is configured via a separate I2C address, so we need to
register a dummy device for it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Federico Vaga <federico.vaga@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] adv7180: Add support for the adv7280/adv7281/adv7282
Lars-Peter Clausen [Fri, 23 Jan 2015 15:52:30 +0000 (12:52 -0300)]
[media] adv7180: Add support for the adv7280/adv7281/adv7282

This patch adds support for the adv7280/adv7281/adv7282 devices to the
adv7180 driver. They are very similar to the adv7182, the main difference
from the drivers point of view are some different tuning constants for
improved video performance.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Federico Vaga <federico.vaga@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] adv7180: Add support for the adv7182
Lars-Peter Clausen [Fri, 23 Jan 2015 15:52:29 +0000 (12:52 -0300)]
[media] adv7180: Add support for the adv7182

This patch adds support for the adv7182 to the adv7180 driver. The adv7182
is similar to the adv7180, the main difference from the driver's point of
view is how the video input and how the input format are selected.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Federico Vaga <federico.vaga@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] adv7180: Prepare for multi-chip support
Lars-Peter Clausen [Fri, 23 Jan 2015 15:52:28 +0000 (12:52 -0300)]
[media] adv7180: Prepare for multi-chip support

The adv7180 is part of a larger family of device, which have all a very
similar register map layout. This patch prepares the adv7180 driver for
support for multiple different devices. For now the only difference we care
about is the number of input channel configurations. Also the way the input
format is configured slightly differs between some devices.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Federico Vaga <federico.vaga@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] adv7180: Consolidate video mode setting
Lars-Peter Clausen [Fri, 23 Jan 2015 15:52:27 +0000 (12:52 -0300)]
[media] adv7180: Consolidate video mode setting

We have basically the same code to set the video standard in init_device()
and adv7180_s_std(). Factor this out into a common helper function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Federico Vaga <federico.vaga@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] adv7180: Add media controller support
Lars-Peter Clausen [Fri, 23 Jan 2015 15:52:26 +0000 (12:52 -0300)]
[media] adv7180: Add media controller support

Add media controller support to the adv7180 driver by registering a media
entity instance for it as well as implementing pad ops for configuring the
format.

As there currently don't seem to be any users of the video ops format
operations those are removed as well in this patch.

Also set the V4L2_SUBDEV_FL_HAS_DEVNODE flag for the subdevice so it is
possible to create a subdevice device node.

Since the driver now depends on VIDEO_V4L2_SUBDEV_API all drivers which
select the driver need to depend on that symbol as well.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Federico Vaga <federico.vaga@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] adv7180: Reset the device before initialization
Lars-Peter Clausen [Fri, 23 Jan 2015 15:52:25 +0000 (12:52 -0300)]
[media] adv7180: Reset the device before initialization

Reset the device when initializing it so it is in a good known state and the
assumed register settings matches the actual register settings.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Federico Vaga <federico.vaga@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] adv7180: Do implicit register paging
Lars-Peter Clausen [Fri, 23 Jan 2015 15:52:24 +0000 (12:52 -0300)]
[media] adv7180: Do implicit register paging

The ad7180 has multiple register pages which can be switched between by
writing to a register. Currently the driver manually switches between pages
whenever a register outside of the default register map is accessed and
switches back after it has been accessed. This is a bit tedious and also
potential source for bugs.

This patch adds two helper functions that take care of switching between
pages and reading/writing the register. The register numbers for registers
are updated to encode both the page (in the upper 8-bits) and the register
(in the lower 8-bits) numbers.

Having multiple pages means that a register access is not a single atomic
i2c_smbus_write_byte_data() or i2c_smbus_read_byte_data() call and we need
to make sure that concurrent register access does not race against each
other.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Federico Vaga <federico.vaga@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] adv7180: Cleanup register define naming
Lars-Peter Clausen [Fri, 23 Jan 2015 15:52:23 +0000 (12:52 -0300)]
[media] adv7180: Cleanup register define naming

Consistently prefix register defines with ADV7180_REG. Also remove the "ADI"
from register names, the ADV7180 prefix should provide enough of a namespace
separation.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Federico Vaga <federico.vaga@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] adv7180: Pass correct flags to request_threaded_irq()
Lars-Peter Clausen [Fri, 23 Jan 2015 15:52:21 +0000 (12:52 -0300)]
[media] adv7180: Pass correct flags to request_threaded_irq()

Most IRQ controllers support different types of interrupts. The adv7180
generates falling edge interrupts, so make sure to pass IRQF_TRIGGER_FALLING
to request_threaded_irq() so the IRQ controller is configured for the
correct mode.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Federico Vaga <federico.vaga@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] adv7180: Do not request the IRQ again during resume
Lars-Peter Clausen [Fri, 23 Jan 2015 15:52:20 +0000 (12:52 -0300)]
[media] adv7180: Do not request the IRQ again during resume

Currently the IRQ is requested from within the init_device() function. This
function is not only called during device probe, but also during resume
causing the driver to try to request the IRQ again. Move requesting the IRQ
from init_device() to the probe function to make sure that it is only
requested once.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Federico Vaga <federico.vaga@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] davinci: add V4L2 dependencies
Arnd Bergmann [Thu, 29 Jan 2015 16:12:05 +0000 (13:12 -0300)]
[media] davinci: add V4L2 dependencies

The davinci media drivers use videobuf2, which they enable through
a 'select' statement. If one of these drivers is built-in, but
the v4l2 core is a loadable modules, we end up with a link
error:

drivers/built-in.o: In function `vb2_fop_mmap':
:(.text+0x113e84): undefined reference to `video_devdata'
drivers/built-in.o: In function `vb2_ioctl_create_bufs':
:(.text+0x114710): undefined reference to `video_devdata'
drivers/built-in.o: In function `vb2_ioctl_reqbufs':
:(.text+0x114ed8): undefined reference to `video_devdata'
drivers/built-in.o: In function `vb2_ioctl_querybuf':
:(.text+0x115530): undefined reference to `video_devdata'

To solve this, we need to add a dependency on VIDEO_V4L2,
which enforces that the davinci drivers themselves can only
be loadable modules if V4L2 is not built-in, and they do
not cause the videobuf2 code to be built-in.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid: use consistent colorspace/Y'CbCr Encoding strings
Hans Verkuil [Thu, 29 Jan 2015 11:22:37 +0000 (08:22 -0300)]
[media] vivid: use consistent colorspace/Y'CbCr Encoding strings

Keep the colorspace and encoding names consistent with what is
used elsewhere (primarily the utilities in v4l-utils.git).

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] siano: fix Kconfig dependencies
Arnd Bergmann [Wed, 28 Jan 2015 21:17:44 +0000 (18:17 -0300)]
[media] siano: fix Kconfig dependencies

The USB and MMC front-ends to the siano driver both only make
sense when combined with the SMS_SIANO_MDTV driver. That driver
already requires RC_CORE to not be a module, so we also need
to add that dependency here.

drivers/built-in.o: In function `smssdio_remove':
:(.text+0x155bd8): undefined reference to `smscore_putbuffer'
:(.text+0x155bdc): undefined reference to `smscore_unregister_device'
drivers/built-in.o: In function `smssdio_interrupt':
:(.text+0x155e4c): undefined reference to `smsendian_handle_rx_message'
:(.text+0x155e50): undefined reference to `smscore_onresponse'
:(.text+0x155e54): undefined reference to `smscore_getbuffer'
:(.text+0x155e58): undefined reference to `smscore_putbuffer'
drivers/built-in.o: In function `smssdio_sendrequest':
:(.text+0x155f20): undefined reference to `smsendian_handle_tx_message'
drivers/built-in.o: In function `smssdio_probe':
:(.text+0x15610c): undefined reference to `sms_get_board'
:(.text+0x156114): undefined reference to `smscore_register_device'
:(.text+0x156118): undefined reference to `smscore_set_board_id'
:(.text+0x156128): undefined reference to `smscore_unregister_device'
:(.text+0x156140): undefined reference to `smscore_start_device'

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] radio/aimslab: use mdelay instead of udelay
Arnd Bergmann [Wed, 28 Jan 2015 21:17:42 +0000 (18:17 -0300)]
[media] radio/aimslab: use mdelay instead of udelay

Large udelay values are not allowed on the ARM architecture
and result in a build error like

ERROR: "__bad_udelay" [drivers/media/radio/radio-aimslab.ko] undefined!

This changes the aimslab radio driver to use an equivalent mdelay
statement.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] timberdale: do not select TIMB_DMA
Arnd Bergmann [Wed, 28 Jan 2015 21:17:41 +0000 (18:17 -0300)]
[media] timberdale: do not select TIMB_DMA

The timberdale media driver requires the use of the respective
dma engine driver, but that may not be enabled, causing a
Kconfig warning:

warning: (VIDEO_TIMBERDALE) selects TIMB_DMA which has unmet direct dependencies (DMADEVICES && MFD_TIMBERDALE)

This fixes the dependency by removing the inappropriate 'select'
statement and replacing it with a direct dependency on the
drivers that provide the services this needs.

Fixes: 7155043c2d027 ("[media] enable COMPILE_TEST for media drivers")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: am437x: fix sparse warnings
Prabhakar Lad [Mon, 26 Jan 2015 14:50:15 +0000 (11:50 -0300)]
[media] media: am437x: fix sparse warnings

This patch fixes following spare warnings:

drivers/media/platform/am437x/am437x-vpfe.c:66:28: warning: symbol 'vpfe_standards' was not declared. Should it be static?
drivers/media/platform/am437x/am437x-vpfe.c:2202:57: warning: incorrect type in argument 2 (different address spaces)
drivers/media/platform/am437x/am437x-vpfe.c:2202:57:    expected void [noderef] <asn:1>*params
drivers/media/platform/am437x/am437x-vpfe.c:2202:57:    got void *param
include/linux/spinlock.h:364:9: warning: context imbalance in 'vpfe_start_streaming' - unexpected unlock

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] pvrusb2: use msecs_to_jiffies for conversion
Nicholas Mc Guire [Thu, 22 Jan 2015 10:39:11 +0000 (07:39 -0300)]
[media] pvrusb2: use msecs_to_jiffies for conversion

This is only an API consolidation and should make things more readable

Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] MAINTAINERS: Update solo6x10 entry
Ismael Luceno [Tue, 20 Jan 2015 14:43:50 +0000 (11:43 -0300)]
[media] MAINTAINERS: Update solo6x10 entry

Re-add Ismael Luceno as co-maintainer (with personal email address).

Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] cx231xx: don't use dev it not allocated
Mauro Carvalho Chehab [Mon, 2 Feb 2015 12:52:26 +0000 (10:52 -0200)]
[media] cx231xx: don't use dev it not allocated

changeset 5eeb3014827f added a fixup at the error check
code. However, it introduced a new error:

drivers/media/usb/cx231xx/cx231xx-cards.c:1586 cx231xx_usb_probe() error: we previously assumed 'dev' could be null (see line 1430)

This happens when dev = kmalloc() fails. So, instead of relying
on it to succeed, just change the parameter of clear_bit() from
'dev->devno' to 'nr'.

Cc: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] cx231xx: fix usbdev leak on failure paths in cx231xx_usb_probe()
Alexey Khoroshilov [Fri, 16 Jan 2015 22:55:26 +0000 (19:55 -0300)]
[media] cx231xx: fix usbdev leak on failure paths in cx231xx_usb_probe()

Commit b7085c086475 ("cx231xx: convert from pr_foo to dev_foo")
moves usb_get_dev(interface_to_usbdev(interface)) to the beginning
of cx231xx_usb_probe() to use udev->dev in dev_err(),
but it does not make sure usbdev is put on all failure paths.

Later dev_err(udev->dev) was replaced by dev_err(d).
So the patch moves usb_get_dev() below (before the first use)
and fixes another failure path.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rcar_vin: move buffer management to .stop_streaming handler
William Towle [Mon, 26 Jan 2015 17:08:40 +0000 (14:08 -0300)]
[media] rcar_vin: move buffer management to .stop_streaming handler

This commit moves the "buffer in use" logic from the .buf_cleanup
handler into .stop_streaming, based on advice that this is its
proper logical home.

By ensuring the list of pointers in priv->queue_buf[] is managed
as soon as possible, we avoid warnings concerning buffers in ACTIVE
state when the system cleans up after streaming stops. This fixes a
problem with modification of buffers after their content has been
cleared for passing to userspace.

After the refactoring, the buf_init and buf_cleanup functions were
found to contain only initialisation/release steps as are carried out
elsewhere if omitted; these functions and references were removed.

Signed-off-by: William Towle <william.towle@codethink.co.uk>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rcar_vin: helper function for streaming stop
Ian Molton [Mon, 26 Jan 2015 17:08:39 +0000 (14:08 -0300)]
[media] rcar_vin: helper function for streaming stop

The code that tests that capture from a stream has stopped is
presently insufficient and the potential for a race condition
exists where frame capture may generate an interrupt between
requesting the capture process halt and freeing buffers.

This patch refactors code out of rcar_vin_videobuf_release() and
into rcar_vin_wait_stop_streaming(), and ensures there are calls
in places where we need to know that capturing has finished.

Signed-off-by: Ian Molton <ian.molton@codethink.co.uk>
Signed-off-by: William Towle <william.towle@codethink.co.uk>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] ov2640: use the v4l2 size definitions
Josh Wu [Tue, 25 Nov 2014 08:54:28 +0000 (05:54 -0300)]
[media] ov2640: use the v4l2 size definitions

Reuse the v4l2 size definitions from v4l2-image-sizes.h.
So we can remove the rudundent definitions from ov2640.c.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] soc-camera: remove redundant code
Guennadi Liakhovetski [Sun, 1 Feb 2015 15:06:17 +0000 (12:06 -0300)]
[media] soc-camera: remove redundant code

A hunk, removing this code has been lost between versions 6 and 7 of
patch "soc-camera: add V4L2-async support." The code is harmless, but
redundant.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] soc_camera: use vb2_ops_wait_prepare/finish helper
Lad, Prabhakar [Wed, 26 Nov 2014 22:42:27 +0000 (19:42 -0300)]
[media] soc_camera: use vb2_ops_wait_prepare/finish helper

This patch drops driver specific wait_prepare() and
wait_finish() callbacks from vb2_ops and instead uses
the the helpers vb2_ops_wait_prepare/finish() provided
by the vb2 core, the lock member of the queue needs
to be initalized to a mutex so that vb2 helpers
vb2_ops_wait_prepare/finish() can make use of it.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Cc: Josh Wu <josh.wu@atmel.com>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] coda: simplify check in coda_buf_queue
Philipp Zabel [Fri, 23 Jan 2015 16:51:35 +0000 (13:51 -0300)]
[media] coda: simplify check in coda_buf_queue

Now that the bitstream buffer is only allocated for the BIT decoder
case, we can use bitstream.size to check for bitstream ringbuffer
operation.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] coda: allocate bitstream ringbuffer only for BIT decoder
Philipp Zabel [Fri, 23 Jan 2015 16:51:34 +0000 (13:51 -0300)]
[media] coda: allocate bitstream ringbuffer only for BIT decoder

The BIT encoder does not use a per-context bitstream ringbuffer as it encodes
directly into the videobuf2 capture queue's buffers. Avoid allocation of the
bitstream ringbuffer for encoder contexts.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] coda: add support for contexts that do not use the BIT processor
Philipp Zabel [Fri, 23 Jan 2015 16:51:33 +0000 (13:51 -0300)]
[media] coda: add support for contexts that do not use the BIT processor

In preparation for CODA9 JPEG support, allow contexts that
control hardware units directly, without the BIT processor.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] coda: free context buffers under buffer mutex
Philipp Zabel [Fri, 23 Jan 2015 16:51:32 +0000 (13:51 -0300)]
[media] coda: free context buffers under buffer mutex

Make sure the buffer_mutex lock is taken in coda_bit_release
while coda_free_framebuffers and coda_free_context_buffers
are called.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] coda: make seq_end_work optional
Philipp Zabel [Fri, 23 Jan 2015 16:51:31 +0000 (13:51 -0300)]
[media] coda: make seq_end_work optional

In preparation for CODA9 JPEG support, which doesn't have to call
SEQ_END on the BIT processor.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] coda: switch BIT decoder source queue to vmalloc
Philipp Zabel [Fri, 23 Jan 2015 16:51:30 +0000 (13:51 -0300)]
[media] coda: switch BIT decoder source queue to vmalloc

Since we have to copy from input buffers into the bitstream ringbuffer
with the CPU, there is no need for contiguous DMA buffers on the decoder
input side.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] coda: add coda_estimate_sizeimage and use it in set_defaults
Philipp Zabel [Fri, 23 Jan 2015 16:51:29 +0000 (13:51 -0300)]
[media] coda: add coda_estimate_sizeimage and use it in set_defaults

Call coda_estimate_sizeimage from both try_fmt and set_defaults to
avoid this v4l2-compliance warning on the h.264 decoder video device:

    G_FMT:     1920x1088, 32315559, 1, 1920, 1048576, 3, 0, 0, feedcafe
    TRY/S_FMT: 1920x1088, 32315559, 1, 1920, 3133440, 3, 0, 0, feedcafe
    fail: v4l2-test-formats.cpp(948): Video Capture: S_FMT(G_FMT) != G_FMT

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] coda: don't ever use subsampling ping-pong buffers as reconstructed reference...
Philipp Zabel [Fri, 23 Jan 2015 16:51:28 +0000 (13:51 -0300)]
[media] coda: don't ever use subsampling ping-pong buffers as reconstructed reference buffers

On i.MX6, two subsampling ping-pong buffers are used for motion estimation and
deblocking They should not be counted as framebuffers, or they will be also used
to store reconstructed frames, causing visible artifacts in P-frames.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] coda: issue seq_end_work during stop_streaming
Philipp Zabel [Fri, 23 Jan 2015 16:51:27 +0000 (13:51 -0300)]
[media] coda: issue seq_end_work during stop_streaming

This patch queues seq_end_work and flushes the queue during stop_streaming
and clears the ctx->initialized flag. This allows to start streaming again
after stopping streaming without releasing the context.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] coda: remove unused isequence, reset qsequence in stop_streaming
Philipp Zabel [Fri, 23 Jan 2015 16:51:26 +0000 (13:51 -0300)]
[media] coda: remove unused isequence, reset qsequence in stop_streaming

The isequence counter is never used, qsequence counts the buffers queued into
the bit decoder bitstream ringbuffer. It needs to be reset in stop_streaming.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] coda: fix width validity check when starting to decode
Markus Pargmann [Fri, 23 Jan 2015 16:51:25 +0000 (13:51 -0300)]
[media] coda: fix width validity check when starting to decode

Compare rounded up width to fit into bytesperline.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] coda: clear RET_DEC_PIC_SUCCESS flag in prepare_decode
Philipp Zabel [Fri, 23 Jan 2015 16:51:24 +0000 (13:51 -0300)]
[media] coda: clear RET_DEC_PIC_SUCCESS flag in prepare_decode

To make sure a set RET_DEC_PIC_SUCCESS flag is not a leftover from
a previous successful run, clear it in prepare_decode.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] coda: initialize SRAM on probe
Philipp Zabel [Fri, 23 Jan 2015 16:51:23 +0000 (13:51 -0300)]
[media] coda: initialize SRAM on probe

Zeroing the SRAM on probe helps with debugging SRAM contents.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] coda: properly clear f_cap in coda_s_fmt_vid_out
Philipp Zabel [Fri, 23 Jan 2015 16:51:22 +0000 (13:51 -0300)]
[media] coda: properly clear f_cap in coda_s_fmt_vid_out

Properly zero the structure on the stack before using it.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] coda: fix try_fmt_vid_out colorspace setting
Philipp Zabel [Fri, 23 Jan 2015 16:51:21 +0000 (13:51 -0300)]
[media] coda: fix try_fmt_vid_out colorspace setting

v4l2-compliance complains about invalid colorspace settings being accepted
on the output side. This patch only allows REC709 and JPEG.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] coda: fix job_ready debug reporting for bitstream decoding
Philipp Zabel [Fri, 23 Jan 2015 16:51:20 +0000 (13:51 -0300)]
[media] coda: fix job_ready debug reporting for bitstream decoding

Clarify whether job_ready returns false because the context is on hold, waiting
for new input buffers, whether there are not enough input buffers to fill two
into the bitstream, or whether there is not enough data in the bitstream buffer
for the bitstream reader hardware to read a whole frame.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] coda: adjust sequence offset after unexpected decoded frame
Lucas Stach [Fri, 23 Jan 2015 16:51:19 +0000 (13:51 -0300)]
[media] coda: adjust sequence offset after unexpected decoded frame

If userspace doesn't properly separate the bitstream input into
individual frames (which may happen for example on slightly
corrupted streams) the CODA hardware may decode more frames
than we expect. We already log an error in this case, but it's
also necessary to adjust the sequence offset. Otherwise we
spam the log with a sequence number mismatch on every frame
frame after the unexpected one.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] coda: move meta out of padding
Philipp Zabel [Fri, 23 Jan 2015 16:51:18 +0000 (13:51 -0300)]
[media] coda: move meta out of padding

Handle an empty buffer metadata list without crashing. This can happen
if the decoder is fed a broken stream, or multiple compressed frames in
a single queued buffer.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] coda: remove context debugfs entry last
Philipp Zabel [Fri, 23 Jan 2015 16:51:17 +0000 (13:51 -0300)]
[media] coda: remove context debugfs entry last

Do not remove the per-context debugfs directory before the
per-buffer debugfs entries contained therein.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] coda: fix encoder rate control parameter masks
Philipp Zabel [Fri, 23 Jan 2015 16:51:15 +0000 (13:51 -0300)]
[media] coda: fix encoder rate control parameter masks

This patch fixes the ENC_SEQ_RC_PARA initial delay and bitrate masks.
These bit fields are 15 bit wide, not 7 bit.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] s5p-mfc: remove unnecessary version.h inclusion
Fabian Frederick [Mon, 29 Dec 2014 14:29:41 +0000 (11:29 -0300)]
[media] s5p-mfc: remove unnecessary version.h inclusion

Based on versioncheck.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] s5p-g2d: remove unnecessary version.h inclusion
Fabian Frederick [Mon, 29 Dec 2014 14:29:40 +0000 (11:29 -0300)]
[media] s5p-g2d: remove unnecessary version.h inclusion

Based on versioncheck.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media-doc: Fix MFC display delay control doc
Nicolas Dufresne [Mon, 15 Dec 2014 21:10:59 +0000 (18:10 -0300)]
[media] media-doc: Fix MFC display delay control doc

The V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY_ENABLE control
is a boolean but was documented as a integer. The documentation was
also slightly miss-leading.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Acked-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] s5p-mfc-dec: Don't use encoder stop command
Nicolas Dufresne [Mon, 15 Dec 2014 21:10:58 +0000 (18:10 -0300)]
[media] s5p-mfc-dec: Don't use encoder stop command

The decoder should handle V4L2_DEC_CMD_STOP to trigger drain,
but it currently expecting V4L2_ENC_CMD_STOP.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Acked-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] s5p-mfc-v6+: Use display_delay_enable CID
Nicolas Dufresne [Mon, 15 Dec 2014 21:10:57 +0000 (18:10 -0300)]
[media] s5p-mfc-v6+: Use display_delay_enable CID

The MFC driver has two controls, DISPLAY_DELAY and DISPLAY_DELAY_ENABLE
that allow forcing the decoder to return a decoded frame sooner
regardless of the order. The added support for firmware version 6 and
higher was not taking into account the DISPLAY_DELAY_ENABLE boolean.
Instead it had a comment stating that DISPLAY_DELAY should be set to a
negative value to disable it. This is not possible since the control
range is from 0 to 65535. This feature was also supposed to be disabled
by default in order to produce frames in display order.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Acked-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>