Antti Palosaari [Tue, 16 Dec 2014 13:09:20 +0000 (10:09 -0300)]
[media] rtl2832_sdr: convert to platform driver
That SDR driver module was abusing DVB frontend SEC (satellite
equipment controller) device and due to that it was also using
legacy DVB binding. Platform bus is pseudo-bus provided by kernel
driver model and it fits cases like that, where any other busses
are not suitable.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Mon, 15 Dec 2014 04:17:25 +0000 (01:17 -0300)]
[media] rtl2832: merge reg page as a part of reg address
Chips uses 8-bit register addresses with 5 pages. Extend register
address by using register page as a first byte of address, defining
virtual register addresses. That is common method of handling
register pages and regmap also uses it. Remove page + address
conversion glue which was there for regmap.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Sun, 14 Dec 2014 19:39:37 +0000 (16:39 -0300)]
[media] rtl2832: remove unneeded software reset from init()
There is no need to do software reset on init() as it is done a bit
later on end of set_frontend(). Software reset usually means
restarting (resetting to starting point) chip internal state machine
(FSM). Naturally it is done after all parameters are programmed.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
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>
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>
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>
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>
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>
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>
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>
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.
[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
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
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.
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>
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>
[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>
[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>
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>
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>
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>
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>
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>
[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>
[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>
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.
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'
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>
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
[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>
[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).
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.
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>
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.
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.
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.
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.
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.
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.