Commit graph

20478 commits

Author SHA1 Message Date
Hans Verkuil c0b50d9512 [media] vivid: BT.2020 R'G'B' is limited range
According to the standard the R'G'B' BT.2020 colorspace is limited
range, not full range. Fix this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 18:11:02 -03:00
Hans Verkuil 1e8faa5945 [media] v4l2-ioctl: tidy up debug messages
Make sure the format fields are reported consistently.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 18:10:51 -03:00
Lad, Prabhakar 8b97e0e3f4 [media] media: am437x-vpfe: embed video_device struct in vpfe_device
Embed video_device struct (video_dev) in vpfe_device and
Unregister path doesn't need to free the video_device
structure, hence, change the video_device.release callback
point to video_device_release_empty.

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>
2015-04-02 18:10:44 -03:00
Lad, Prabhakar 7d87db3df0 [media] media: am437x-vpfe: return error in case memory allocation failure
return error in case devm_kzalloc() fails.

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>
2015-04-02 18:10:42 -03:00
Lad, Prabhakar d37232390f [media] media: am437x-vpfe: match the OF node/i2c addr instead of name
Instead of matching the subdevs with their name, match
it with OF node/ i2c address and adapter number.

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>
2015-04-02 18:10:40 -03:00
Tapasweni Pathak 4eaa3a6cc4 [media] drivers: media: platform: vivid: Fix possible null derefrence
Check for dev_fmt being null before derefrencing it, to assign it
to planes.

Found using Coccinelle.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 18:10:38 -03:00
Hans Verkuil ff05cb4b81 [media] vb2: check if vb2_fop_write/read is allowed
Return -EINVAL if read() or write() is not supported by the queue. This
makes it possible to provide both vb2_fop_read and vb2_fop_write in a
struct v4l2_file_operations since the vb2_fop_* function will check if
the file operation is allowed.

A similar check exists in __vb2_init_fileio() which is called from
__vb2_perform_fileio(), but that check is only done if no file I/O is
active. So the sequence of read() followed by write() would be allowed,
which is obviously a bug.

In addition, vb2_fop_write/read should always return -EINVAL if the
operation is not allowed, and by putting the check in the lower levels
of the code it is possible that other error codes are returned (EBUSY
or ERESTARTSYS).

All these issues are avoided by just doing a quick explicit check.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 18:10:25 -03:00
Laurent Pinchart ee662d44a2 [media] media: am437x: Don't release OF node reference twice
The remote port reference is released both at the end of the OF graph
parsing loop, and in the error code path at the end of the function.
Those two calls will release the same reference, causing the reference
count to go negative.

Fix the problem by removing the second call.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 18:10:06 -03:00
Laurent Pinchart 1cdf60c97a [media] uvcvideo: Validate index during step-wise frame intervals enumeration
Frame intervals exposed as an interval and step (so-called step-wise)
are restricted by the V4L2 API to a single enumeration entry. Return an
error when the index is not zero.

Reported-by: Alexey Smirnoff <fling@member.fsf.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[mchehab@osg.samsung.com: add a missing collon at the end of the return
 statement, in order to avoid compilation breakage]
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 17:31:48 -03:00
Laurent Pinchart fe6524719d [media] uvcvideo: Recognize the Tasco USB microscope
The device is based on an Aveo chipset, implements UVC but advertises a
vendor-specific class on all interfaces.

Support it by listing the USB VID:PID explicitly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 17:30:05 -03:00
Laurent Pinchart 9e68c53910 [media] uvcvideo: Don't call vb2 mmap and get_unmapped_area with queue lock held
videobuf2 has long been subject to AB-BA style deadlocks due to the
queue lock and mmap_sem being taken in different orders for the mmap and
get_unmapped_area operations. The problem has been fixed by making those
two operations callable without taking the queue lock, using an
mmap_lock internal to videobuf2.

The uvcvideo driver still calls the mmap and get_unmapped_area
operations with the queue lock held, resulting in a potential deadlock.
As the operations can now be called without locking the queue, fix it.

Reported-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 17:29:28 -03:00
Sakari Ailus cfa9672243 [media] smiapp: Make pixel_order_str static
pixel_order_str is only referred to in smiapp-core.c, it should be thus
static. Thanks to Hans Verkuil for pointing this out.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 17:28:36 -03:00
Sakari Ailus 3f39fb0f1e [media] smiapp: Use of_property_read_u64_array() to read a 64-bit number array
of_property_read_u64_array() wasn't yet part of the kernel tree when the
functionality was needed. Do use it now.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 17:26:30 -03:00
Sakari Ailus 152635c6ea [media] Revert "[media] smiapp: Don't compile of_read_number() if CONFIG_OF isn't defined"
This reverts commit cb88d7384e.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 17:10:43 -03:00
Marek Szyprowski 6c9fe76536 [media] media: s5p-mfc: fix broken pointer cast on 64bit arch
Unsigned int cannot be used to store casted pointer on 64bit
architecture, so correct such casts to properly use unsigned long
variables.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
[k.debski@samsung.com: removed volatile and __iomem from cast]

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 17:08:28 -03:00
Marek Szyprowski a301ea1f50 [media] media: s5p-mfc: fix mmap support for 64bit arch
TASK_SIZE is depends on the systems architecture (32 or 64 bits) and it
should not be used for defining offset boundary for mmaping buffers for
CAPTURE and OUTPUT queues. This patch fixes support for MMAP calls on
the CAPTURE queue on 64bit architectures (like ARM64).

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 16:59:40 -03:00
Sakari Ailus f95c16ea70 [media] omap3isp: Deprecate platform data support
Print a warning when the driver is used with platform data. Existing
platform data users should move to DT now.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 16:48:07 -03:00
Sakari Ailus da7f3843d2 [media] omap3isp: Add support for the Device Tree
Add the ISP device to omap3 DT include file and add support to the driver to
use it.

Also obtain information on the external entities and the ISP configuration
related to them through the Device Tree in addition to the platform data.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 16:47:48 -03:00
Sakari Ailus b6eec1c493 [media] v4l: of: Read lane-polarities endpoint property
Add lane_polarities field to struct v4l2_of_bus_mipi_csi2 and write the
contents of the lane-polarities property to it. The field tells the polarity
of the physical lanes starting from the first one. Any unused lanes are
ignored, i.e. only the polarity of the used lanes is specified.

Also rework reading the "data-lanes" property a little.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 16:46:42 -03:00
Sakari Ailus 8644cdf972 [media] omap3isp: Replace many MMIO regions by two
The omap3isp MMIO register block is contiguous in the MMIO register space
apart from the fact that the ISP IOMMU register block is in the middle of
the area. Ioremap it at two occasions, and keep the rest of the layout of
the register space internal to the omap3isp driver.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 16:45:07 -03:00
Sakari Ailus 503596a152 [media] omap3isp: Move the syscon register out of the ISP register maps
The syscon register isn't part of the ISP, use it through the syscom driver
regmap instead. The syscom block is considered to be from 343x on ISP
revision 2.0 whereas 15.0 is assumed to have 3630 syscon.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 16:44:18 -03:00
Sakari Ailus 4fcfeca833 [media] omap3isp: Replace mmio_base_phys array with the histogram block base
Only the histogram sub-block driver uses the physical address. Do not store
it for other sub-blocks.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 16:42:52 -03:00
Sakari Ailus 6387b75284 [media] omap3isp: Calculate vpclk_div for CSI-2
The video port clock is l3_ick divided by vpclk_div. This clock must be high
enough for the external pixel rate. The video port requires two clock cycles
to process a pixel.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 16:42:04 -03:00
Sakari Ailus 3494bb0594 [media] omap3isp: Rename regulators to better suit the Device Tree
Rename VDD_CSIPHY1 as vdd-csiphy1 and VDD_CSIPHY2 as vdd-csiphy2.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 16:41:23 -03:00
Sakari Ailus 6890874772 [media] omap3isp: Refactor device configuration structs for Device Tree
Make omap3isp configuration data structures more suitable for consumption by
the DT by separating the I2C bus information of all the sub-devices in a
group and the ISP bus information from each other. The ISP bus information
is made a pointer instead of being directly embedded in the struct.

In the case of the DT only the sensor specific information on the ISP bus
configuration is retained. The structs are renamed to reflect that.

After this change the structs needed to describe device configuration can be
allocated and accessed separately without those needed only in the case of
platform data. The platform data related structs can be later removed once
the support for platform data can be removed.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Igor Grinberg <grinberg@compulab.co.il> (for cm-t35)
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 16:41:01 -03:00
Sakari Ailus 4c8f14861c [media] omap3isp: Platform data could be NULL
Only check for call platform data callback functions if there's platform
data. Also take care of a few other cases where the NULL pdata pointer could
have been accessed, and remove the check for NULL dev->platform_data
pointer.

Removing the check for NULL dev->platform_data isn't strictly needed by the
DT support but there's no harm from that either: the device now can be used
without sensors, for instance.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 16:39:14 -03:00
Laurent Pinchart 64904b574e [media] omap3isp: DT support for clocks
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 16:38:03 -03:00
Sakari Ailus 703e6f625b [media] omap3isp: Separate external link creation from platform data parsing
Move the code which connects the external entity to an ISP entity into a
separate function. This disconnects it from parsing the platform data.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 16:37:26 -03:00
Sakari Ailus 8b3aff7cdd [media] omap3isp: Avoid a BUG_ON() in media_entity_create_link()
If an uninitialised v4l2_subdev struct was passed to
media_entity_create_link(), one of the BUG_ON()'s in the function will be
hit since media_entity.num_pads will be zero. Avoid this by checking whether
the num_pads field is non-zero for the interface.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 16:37:21 -03:00
Sakari Ailus 697cca21b0 [media] omap3isp: Fix error handling in probe
The mutex was not destroyed correctly if dma_coerce_mask_and_coherent()
failed for some reason.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 16:37:17 -03:00
Laurent Pinchart 0ff4e419dc [media] media: omap3isp: hist: Move histogram DMA to DMA engine
Replace the custom OMAP DMA API usage by DMA engine. Feature-wise the
driver has lost the ability to get notified of DMA transfers failure
through the completion handler, as the DMA engine API doesn't expose
that status information.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 16:37:13 -03:00
Laurent Pinchart 32346b9cc0 [media] media: omap3isp: video: Use v4l2_get_timestamp()
Replace the open-coded copy by a function call.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 16:32:55 -03:00
Lad, Prabhakar 13dab904d5 [media] media: omap3isp: video: drop setting of vb2 buffer state to VB2_BUF_STATE_ACTIVE
There isn't a need to assign the state of vb2_buffer to active
as this is already done by the core.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 16:32:32 -03:00
Laurent Pinchart 9be2936959 [media] media: omap3isp: video: Don't call vb2 mmap with queue lock held
videobuf2 has long been subject to AB-BA style deadlocks due to the
queue lock and mmap_sem being taken in different orders for the mmap
operation. The problem has been fixed by making this operation callable
without taking the queue lock, using an mmap_lock internal to videobuf2.

The omap3isp driver still calls the mmap operation with the queue lock
held, resulting in a potential deadlock. As the operation can now be
called without locking the queue, fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 16:31:14 -03:00
Olli Salonen 18acc6ace5 [media] si2157: extend frequency range for ATSC
The Si2157 tuner supports ATSC in addition to DVB-T and DVB-C. Extend
minimum frequency range to cover the complete ATSC/QAM-B range.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-01 06:22:26 -03:00
Hans Verkuil 17bef88524 [media] v4l2-subdev: add support for the new enum_frame_interval 'which' field
Support the new 'which' field in the enum_frame_interval ops. Most drivers do not
need to be changed since they always returns the same enumeration regardless
of the 'which' field.

Tested for ov7670 and marvell-ccic on a OLPC XO-1 laptop.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-23 12:01:15 -07:00
Hans Verkuil 5778e749c1 [media] v4l2-subdev: add support for the new enum_frame_size 'which' field
Support the new 'which' field in the enum_frame_size ops. Most drivers do not
need to be changed since they always returns the same enumeration regardless
of the 'which' field.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Tested-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-23 11:48:55 -07:00
Hans Verkuil 3f1ccf16f3 [media] v4l2-subdev: support new 'which' field in enum_mbus_code
Support the new 'which' field in the enum_mbus_code ops. Most drivers do not
need to be changed since they always return the same enumeration regardless
of the 'which' field.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-23 11:46:38 -07:00
Hans Verkuil 20058f9091 [media] v4l2-subdev.c: add 'which' checks for enum ops
Return an error if an invalid 'which' valid is passed in.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Tested-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-23 11:45:07 -07:00
Hans Verkuil f7234138f1 [media] v4l2-subdev: replace v4l2_subdev_fh by v4l2_subdev_pad_config
If a subdevice pad op is called from a bridge driver, then there is
no v4l2_subdev_fh struct that can be passed to the subdevice. This
made it hard to use such subdevs from a bridge driver.

This patch replaces the v4l2_subdev_fh pointer by a v4l2_subdev_pad_config
pointer in the pad ops. This allows bridge drivers to use the various
try_ pad ops by creating a v4l2_subdev_pad_config struct and passing it
along to the pad op.

The v4l2_subdev_get_try_* macros had to be changed because of this, so
I also took the opportunity to use the full name of the v4l2_subdev_get_try_*
functions in the __V4L2_SUBDEV_MK_GET_TRY macro arguments: if you now do
'git grep v4l2_subdev_get_try_format' you will actually find the header
where it is defined.

One remark regarding the drivers/staging/media/davinci_vpfe patches: the
*_init_formats() functions assumed that fh could be NULL. However, that's
not true for this driver, it's always set. This is almost certainly a copy
and paste from the omap3isp driver. I've updated the code to reflect the
fact that fh is never NULL.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Tested-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-23 11:41:36 -07:00
Benjamin Larsson 3b786f1316 [media] mn88473: calculate the IF register values
Add xtal as a configuration parameter so it can be used
in the IF register value calculation. If not set in the
configuration then use a default value.

Signed-off-by: Benjamin Larsson <benjamin@southpole.se>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 13:07:55 -03:00
Uwe Kleine-König 269bd1324f [media] media: adv7604: improve usage of gpiod API
Since 39b2bbe3d7 (gpio: add flags argument to gpiod_get*() functions)
which appeared in v3.17-rc1, the gpiod_get* functions take an additional
parameter that allows to specify direction and initial value for output.
Simplify accordingly.

Moreover use devm_gpiod_get_index_optional instead of
devm_gpiod_get_index with ignoring all errors.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 11:26:40 -03:00
Simon Farnsworth 48ab45adcc [media] cx18: Fix bytes_per_line
Current GStreamer userspace respects the bytes_per_line from the driver. Set
it to something reasonable for the format chosen.

Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 11:24:34 -03:00
Lad, Prabhakar ac0b2b3072 [media] media: omap/omap_vout: fix type of input members to omap_vout_setup_vrfb_bufs()
the declaration for omap_vout_setup_vrfb_bufs() said it
needed 'u32 static_vrfb_allocation' but definition
took 'bool static_vrfb_allocation', this patch fixes the
declaration so that it matches with the definition and
pass a bool instead of int to the call, also included
omap_vout_vrfb.h in omap_vout_vrfb.c file so that sparse doesn't
complain of making omap_vout_setup_vrfb_bufs() as static function.

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>
2015-03-03 11:22:58 -03:00
Lad, Prabhakar 460eac3fee [media] media: i2c: ths7303: drop module param debug
this patch drops module param 'debug' as it was never used.

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>
2015-03-03 11:21:57 -03:00
Lad, Prabhakar c3718de559 [media] media: drop call to v4l2_device_unregister_subdev()
These drivers are moved to support asynchronous probing,
v4l2_async_unregister_subdev() unregisters the subdev so
there isn't a need to explicitly call v4l2_device_unregister_subdev().

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>
2015-03-03 11:21:41 -03:00
Gilles Risch 1fe0fbd69a [media] Basic support for the Elgato EyeTV Hybrid INT 2008 USB Stick
This patch will add basic support for the Elgato EyeTV Hybrid INT
2008 USB Stick.

Signed-off-by: Gilles Risch <gilles.risch@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 11:20:50 -03:00
Wei Yongjun 03983e5db1 [media] v4l2: remove unused including <linux/version.h>
Remove including <linux/version.h> that don't need it.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 11:20:12 -03:00
Shuah Khan 41071bb8c7 [media] media: au0828 - embed vdev and vbi_dev structs in au0828_dev
Embed video_device structs vdev and vbi_dev in au0828_dev.
With this change, dynamic allocation and error path logic
in au0828_analog_register() is removed as it doesn't need
to allocate and handle allocation errors. Unregister path
doesn't need to free the now static video_device structures,
hence, changed video_device.release in au0828_video_template
to point to video_device_release_empty.

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>
2015-03-03 11:19:52 -03:00
Lad, Prabhakar c5036d61e0 [media] media: au0828: drop vbi_buffer_filled() and re-use buffer_filled()
The vbi_buffer_filled() and buffer_filled() did the same functionality
except for incrementing the buffer sequence, this patch drops the
vbi_buffer_filled() and re-uses buffer_filled() for vbi buffers
as well by adding the check for vb2-queue type while incrementing
the sequence numbers. Along side this patch aligns the input parameters
of buffer_filled() function appropriately.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-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>
2015-03-03 11:17:56 -03:00
Tapasweni Pathak 48205533ba [media] drivers: media: i2c : s5c73m3: Replace dev_err with pr_err
Replace dev_err statement with pr_err to fix null dereference.

Found by Coccinelle.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 11:16:36 -03:00
Olli Salonen 3f845f3c4c [media] saa7164: free_irq before pci_disable_device
Free the IRQ before disabling the device. Otherwise errors like this when unloading the module:

[21135.458560] ------------[ cut here ]------------
[21135.458569] WARNING: CPU: 4 PID: 1696 at /home/apw/COD/linux/fs/proc/generic.c:521 remove_proc_entry+0x1a1/0x1b0()
[21135.458572] remove_proc_entry: removing non-empty directory 'irq/47', leaking at least 'saa7164[0]'

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 11:16:09 -03:00
Fabian Frederick f35593fdc8 [media] saa7146: replace current->state by set_current_state()
Use helper functions to access current->state.
Direct assignments are prone to races and therefore buggy.

current->state = TASK_RUNNING can be replaced by __set_current_state()

Thanks to Peter Zijlstra for the exact definition of the problem.

Suggested-By: Peter Zijlstra <peterz@infradead.org>

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 11:15:42 -03:00
Olli Salonen 809abdbf46 [media] cx231xx: Hauppauge HVR-955Q ATSC/QAM tuner
Hauppauge HVR-955Q is a ATSC/QAM USB tuner with LGDT3306A demodulator and SiLabs Si2157-A30 tuner.

Only digital TV has been tested (both ATSC and QAM256).

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:36:12 -03:00
Olli Salonen c28aebe178 [media] si2157: IF frequency for ATSC and QAM
For supporting ATSC and QAM modes the driver should use a smaller IF frequency than 5 MHz.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:35:08 -03:00
Mauro Carvalho Chehab 95f22c5aae [media] lgdt3306a: Minor source code cleanups
Fix a few minor CodingStyle issues at the source code:
	- Use proper multi-line comments;
	- Align the log tables;
	- Remove the .type from dvb_frontend_ops, since this is not
	  needed anymore (since the drivers conversion to DVBv5);
	- Remove emacs format macro.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:34:15 -03:00
Mauro Carvalho Chehab 534f4364f9 [media] lgdt3306a: Break long lines
Fix most of checkpatch warnings like:
	WARNING: line over 80 characters

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:34:15 -03:00
Mauro Carvalho Chehab 9369fe012d [media] lgdt3306a: constify log tables
Ideally, we should be replacing this function by intlog10().

While we don't do that, let's at least constify the tables,
in order to remove its code footfrint, and get rid of nelems.

This also fixes a few 80-cols CodingStyle warnings.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:34:14 -03:00
Mauro Carvalho Chehab c9897649db [media] lbdt3306a: remove uneeded braces
WARNING: braces {} are not necessary for any arm of this statement
+		if (ret == 0) {
[...]
+		} else {
[...]

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:34:14 -03:00
Mauro Carvalho Chehab b4e43e959b [media] lgdt3306a: Don't use else were not needed
Get rid of the remaining checkpatch.pl warnings:
	WARNING: braces {} are not necessary for any arm of this statement

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:34:14 -03:00
Mauro Carvalho Chehab b1a88c713a [media] lbdt3306a: simplify the lock status check
The logic there is too complex and it looks like an inifite
loop.

So, simplify the logic and implement it as a for loop.

This gets rid of the following checkpatch.pl warnings:

WARNING: else is not generally useful after a break or return
+			return LG3306_UNLOCK;
+		} else {

WARNING: else is not generally useful after a break or return
+			return LG3306_UNLOCK;
+		} else {

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:34:13 -03:00
Mauro Carvalho Chehab 097117cab5 [media] lbdt3306a: rework at printk macros
Use pr_foo() where there's a direct replacement. For debug, use
custom-made macros, for now, as there are 3 different debug levels.

We should get rid of those some day, specially since several such
macros can be just removed, as Kernel trace would provide about
the same output.

This gets rid of some checkpatch errors:

WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(...  to printk(KERN_INFO ...
+#define lg_info(fmt, arg...)	printk(KERN_INFO "lgdt3306a: " fmt, ##arg)

ERROR: Macros with complex values should be enclosed in parentheses
+#define lg_dbg(fmt, arg...) if (debug & DBG_INFO)			\
+				lg_printk(KERN_DEBUG,         fmt, ##arg)

ERROR: Macros with complex values should be enclosed in parentheses
+#define lg_reg(fmt, arg...) if (debug & DBG_REG)			\
+				lg_printk(KERN_DEBUG,         fmt, ##arg)

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:34:13 -03:00
Mauro Carvalho Chehab e2c47fa7dd [media] lgdt3306a: Remove FSF address
Fix this CodingStyle error:

	ERROR: Do not include the paragraph about writing to the Free Software Foundation's mailing address from the sample GPL notice. The FSF has changed addresses in the past, and may do so ag$
	#56: FILE: drivers/media/dvb-frontends/lgdt3306a.c:19:
	+ *    along with this program; if not, write to the Free Software$

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:34:13 -03:00
Mauro Carvalho Chehab ee0133eea0 [media] lgdt3306a: properly handle I/O errors
Fixes the following smatch errors:

drivers/media/dvb-frontends/lgdt3306a.c: In function 'lgdt3306a_set_if':
drivers/media/dvb-frontends/lgdt3306a.c:695:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
  int ret;
      ^
drivers/media/dvb-frontends/lgdt3306a.c: In function 'lgdt3306a_monitor_vsb':
drivers/media/dvb-frontends/lgdt3306a.c:1033:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
  int ret;
      ^
drivers/media/dvb-frontends/lgdt3306a.c: In function 'lgdt3306a_check_oper_mode':
drivers/media/dvb-frontends/lgdt3306a.c:1082:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
  int ret;
      ^
drivers/media/dvb-frontends/lgdt3306a.c: In function 'lgdt3306a_check_lock_status':
drivers/media/dvb-frontends/lgdt3306a.c:1109:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
  int ret;
      ^
drivers/media/dvb-frontends/lgdt3306a.c: In function 'lgdt3306a_check_neverlock_status':
drivers/media/dvb-frontends/lgdt3306a.c:1185:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
  int ret;
      ^
drivers/media/dvb-frontends/lgdt3306a.c: In function 'lgdt3306a_pre_monitoring':
drivers/media/dvb-frontends/lgdt3306a.c:1199:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
  int ret;
      ^
drivers/media/dvb-frontends/lgdt3306a.c: In function 'lgdt3306a_get_packet_error':
drivers/media/dvb-frontends/lgdt3306a.c:1310:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
  int ret;
      ^

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:34:12 -03:00
Mauro Carvalho Chehab a132fef816 [media] lgdt3306a: don't go past the buffer
As warned by smatch:
	drivers/media/dvb-frontends/lgdt3306a.c:1354 log10_x1000() error: buffer overflow 'valx_x10' 14 <= 14
	drivers/media/dvb-frontends/lgdt3306a.c:1355 log10_x1000() error: buffer overflow 'log10x_x1000' 14 <= 14

There's a potential of returning a value out of the buffer. Fix it.

While here, remove the ugly braced block.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:34:12 -03:00
Mauro Carvalho Chehab 15c546e1c8 [media] lgdt3306a: one bit fields should be unsigned
Fix two smatch warnings:
	drivers/media/dvb-frontends/lgdt3306a.h:53:28: error: dubious one-bit signed bitfield
	drivers/media/dvb-frontends/lgdt3306a.h:56:33: error: dubious one-bit signed bitfield

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:34:12 -03:00
Mauro Carvalho Chehab c43e651205 [media] lgdt3306a: Use IS_ENABLED() for attach function
Simplify the check if CONFIG_DVB_LGDT3306A is enabled, use the
IS_ENABLED() macro, just like the other frontend modules.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:34:12 -03:00
Mauro Carvalho Chehab 4937ba94a0 [media] lgdt3306a: Use hexadecimal values in lowercase
While this is not a mandatory rule at the CodingStyle, we prefer
hexadecimal values in lowercase. Currently, there's a mix of lowercase
and uppercase ons at lgdt3306a. So, convert all to lowercase with this
small script:

	perl -ne 'if (m,0x([\dA-F]+),) { $o=$1; $n=lc $1; s,0x($o),0x$n, } print $_'

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:34:11 -03:00
Michael Ira Krufky 34a5a2f811 [media] lgdt3306a: more small whitespace cleanups
Just CodingStyle. No functional changes.

Signed-off-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:34:11 -03:00
Michael Ira Krufky 831a91120a [media] lgdt3306a: typo fix
fix WARNING: 'supress' may be misspelled - perhaps 'suppress'?

Signed-off-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:34:11 -03:00
Michael Ira Krufky cb4671c87f [media] lgdt3306a: fix WARNING: please, no spaces at the start of a line
Properly indent register initialization tables.

Signed-off-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:34:10 -03:00
Michael Ira Krufky 6da7ac9857 [media] lgdt3306a: fix ERROR: do not use C99 // comments
Replace C99 comments by /* */ blocks.

Signed-off-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:34:10 -03:00
Michael Ira Krufky f883d603d4 [media] lgdt3306a: do not add new typedefs
We should not be using typedefs at the Kernel, as this makes harder
for reviewers to understand the code.

Signed-off-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:34:10 -03:00
Michael Ira Krufky ae21e44777 [media] lgdt3306a: fix ERROR: do not use assignment in if condition
Just CodingStyle fix.

Signed-off-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:34:09 -03:00
Michael Ira Krufky ebd9175ea4 [media] lgdt3306a: move EXPORT_SYMBOL to be just after function
Fixes CodingStyle error:
	WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable.

Signed-off-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:34:09 -03:00
Michael Ira Krufky c714efe458 [media] lgdt3306a: remove unnecessary 'else'
No need for an else, as the previous if will return.

Signed-off-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:34:09 -03:00
Michael Ira Krufky 8e8cd34eaa [media] lgdt3306a: clean up whitespace & unneeded brackets
No functional changes.

Signed-off-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:34:08 -03:00
Fred Richter b63b36fa44 [media] DVB: add support for LG Electronics LGDT3306A ATSC/QAM-B Demodulator
This ATSC/QAM-B demodulator is used by several new devices.

Add support for it. Other patches will fix CodingStyle issues.

Signed-off-by: Fred Richter <frichter@hauppauge.com>
Signed-off-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:34:08 -03:00
Hans Verkuil 2438e78a48 [media] v4l2-core: drop g/s_priority ops
The handling of VIDIOC_G/S_PRIORITY is now entirely done by the V4L2
core, so we can drop the g/s_priority ioctl ops.

We do have to make sure though that when S_PRIORITY is called we check
that the driver used struct v4l2_fh. This check can be removed once all
drivers are converted to that structure.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 17:09:43 -03:00
Hans Verkuil cee05cb359 [media] pvrusb2: use struct v4l2_fh
By using struct v4l2_fh both the prio handling and the linked list
implementation in pvrusb2 can be removed since both are now done in
the v4l2 core if you use struct v4l2_fh.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 17:08:48 -03:00
Hans Verkuil 5cf6f7f327 [media] v4l2-core: remove the old .ioctl BKL replacement
To keep V4L2 drivers that did not yet convert to unlocked_ioctl happy,
the v4l2 core had a .ioctl file operation that took a V4L2 lock.

The last drivers are now converted to unlocked_ioctl, so all this
old code can now be removed.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 17:06:56 -03:00
Hans Verkuil ab91c61129 [media] pvrusb2: replace .ioctl by .unlocked_ioctl
As far as I can tell pvrusb2 does its own locking, so there is
no need to use .ioctl.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 17:03:42 -03:00
Pablo Anton b44b2e06ae [media] media: i2c: ADV7604: Rename adv7604 prefixes
It is confusing which parts of the driver are adv7604 specific, adv7611
specific or common for both. This patch renames any adv7604 prefixes (both
for functions and defines) to adv76xx whenever they are common.

Signed-off-by: Pablo Anton <pablo.anton@vodalys-labs.com>
Signed-off-by: Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com>
[hans.verkuil@cisco.com: rebased and renamed ADV76xx_fsc to ADV76XX_FSC]
[hans.verkuil@cisco.com: kept the existing adv7604 driver name]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 16:59:32 -03:00
Nicholas Mc Guire c973f76e7e [media] media: radio: handle timeouts
Add handling for timeout case.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 16:50:42 -03:00
Nicholas Mc Guire daa939db21 [media] media: radio: assign wait_for_completion_timeout to appropriately typed var
wait_for_completion_timeout() returns unsigned long not int. This assigns
the return value to an appropriately typed variable (also helps keep
static code checkers happy).

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 16:49:58 -03:00
jean-michel.hautbois@vodalys.com 80f4944ec2 [media] media: adv7604: CP CSC uses a different register on adv7604 and adv7611
The bits are the same, but register is 0xf4 on ADV7611 instead of 0xfc.
When reading back the value in log_status, differentiate both.

Signed-off-by: Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 14:56:21 -03:00
Nicholas Mc Guire 61765a5032 [media] si470x: fixup wait_for_completion_timeout return handling
return type of wait_for_completion_timeout is unsigned long not int. A
appropriately named variable of type unsigned long is added and the
assignments fixed up.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 14:55:44 -03:00
jean-michel.hautbois@vodalys.com 5851462531 [media] media: i2c: ADV7604: In free run mode, signal is locked
The CP_NON_STD_VIDEO bit indicates an input not aligned with DV timings.
If there is no input, and chip is in free run mode, consider we are locked.

Signed-off-by: Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com>
[hans.verkuil@cisco.com: put both conditions in one 'if']
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 14:54:22 -03:00
Markus Elfring 8aa9eb9059 [media] au0828: Delete unnecessary checks 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>
2015-03-02 14:53:46 -03:00
Markus Elfring 704b3f4c11 [media] stk-webcam: Delete an unnecessary check before the function call "vfree"
The vfree() function performs also input parameter validation.
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>
2015-03-02 14:53:27 -03:00
Prashant Laddha d585c1e14a [media] vivid sdr: fix broken sine tone generated for sdr FM
FM (frequency modulated) signal for SDR is generated by varying the
phase, where phase variation is proportional to input signal. It is
seen that, the larger phase increments leads to discontinuities in
the signal recovered after demodulation. Reducing the extent of phase
variation with respect to input signal, equivalent to reducing the
modulation index.

Tested using FM receiver flow graph in gnuradio-companion.

Cc: Antti Palosaari <crope@iki.fi>
Signed-off-by: Prashant Laddha <prladdha@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 14:53:04 -03:00
Prashant Laddha 4e30a37345 [media] vivid sdr: Use LUT based implementation for sin/cos()
The common implementation for sin/cos in include/linux/fixp-arith.h
has been improved recently to provide higher precision.

Replacing native implementation of sin/cos in vivid sdr with common
implementation. This serves two purposes:

1. Improved accuracy: the native implementation based on the Taylor
   series is more prone to rounding errors.
2. Reuse of common function: this is better compared to maintaining
   native versions for each driver.

Suggested by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Antti Palosaari <crope@iki.fi>
Signed-off-by: Prashant Laddha <prladdha@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 14:51:32 -03:00
Mauro Carvalho Chehab 559addc25b [media] fixp-arith: replace sin/cos table by a better precision one
The cos table used at fixp-arith.h has only 8 bits of precision.
That causes problems if it is reused on other drivers.

As some media drivers require a higher precision sin/cos
implementation, replace the current implementation by one that
will provide 32 bits precision.

The values generated by the new implementation matches the
32 bit precision of glibc's sin for an angle measured in
integer degrees.

It also provides support for fractional angles via linear
interpolation. On experimental calculus, when used a table
with a 0.001 degree angle, the maximum error for sin is
0.000038, which is likely good enough for practical purposes.

There are some logic there that seems to be specific to the
usage inside ff-memless.c. Move those logic to there, as they're
not needed elsewhere.

Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Prashant Laddha <prladdha@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 14:50:06 -03:00
Christian Engelmayer 96df988bb9 [media] cx88: Fix possible leak in cx8802_probe()
In case allocation vb2_dma_sg_init_ctx() fails during cx8802_probe(), the
already allocated cx8802 device structure memory is not freed in the used
exit path. Thus adapt the cleanup handling accordingly. Detected by Coverity
CID 1260065.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 14:47:19 -03:00
Alexey Khoroshilov 2160abb294 [media] sh_vou: fix memory leak on error paths in sh_vou_open()
Memory allocated for sh_vou_file is not deallocated
on error paths in sh_vou_open().

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>
2015-03-02 14:46:48 -03:00
Geert Uytterhoeven 50d8e46faf [media] timberdale: VIDEO_TIMBERDALE should depend on HAS_DMA
If NO_DMA=y:

    warning: (VIDEO_OMAP2_VOUT && VIDEO_VIU && VIDEO_TIMBERDALE) selects VIDEOBUF_DMA_CONTIG which has unmet direct dependencies (MEDIA_SUPPORT && HAS_DMA)

    drivers/built-in.o: In function `__videobuf_dc_free':
    videobuf-dma-contig.c:(.text+0x6f4d32): undefined reference to `dma_free_coherent'
    drivers/built-in.o: In function `__videobuf_dc_alloc':
    videobuf-dma-contig.c:(.text+0x6f4fe6): undefined reference to `dma_alloc_coherent'
    drivers/built-in.o: In function `__videobuf_mmap_mapper':
    videobuf-dma-contig.c:(.text+0x6f518e): undefined reference to `dma_free_coherent'

Commit 244829226f ("[media] timberdale: do not select TIMB_DMA")
dropped the dependency of VIDEO_TIMBERDALE on DMADEVICES, and thus the
implicit dependency on HAS_DMA.  VIDEO_TIMBERDALE selects
VIDEOBUF_DMA_CONTIG, which bypasses its dependency on HAS_DMA.  Make
VIDEO_TIMBERDALE depend on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 14:40:40 -03:00
Geert Uytterhoeven a5d7c92c1b [media] am437x: VIDEO_AM437X_VPFE should depend on HAS_DMA
If NO_DMA=y:

    warning: (VIDEO_AM437X_VPFE && VIDEO_DM365_VPFE && VIDEO_DT3155 && VIDEO_OMAP4) selects VIDEOBUF2_DMA_CONTIG which has unmet direct dependencies (MEDIA_SUPPORT && HAS_DMA)

    drivers/media/v4l2-core/videobuf2-dma-contig.c: In function ‘vb2_dc_mmap’:
    drivers/media/v4l2-core/videobuf2-dma-contig.c:207: error: implicit declaration of function ‘dma_mmap_coherent’
    drivers/media/v4l2-core/videobuf2-dma-contig.c: In function ‘vb2_dc_get_base_sgt’:
    drivers/media/v4l2-core/videobuf2-dma-contig.c:390: error: implicit declaration of function ‘dma_get_sgtable’

VIDEO_AM437X_VPFE selects VIDEOBUF2_DMA_CONTIG, which bypasses its
dependency on HAS_DMA.  Make VIDEO_AM437X_VPFE depend on HAS_DMA to fix
this.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
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>
2015-03-02 14:40:18 -03:00
Nicholas Mc Guire 9713883b0f [media] cx231xx: drop condition with no effect
The if and the else code are identical - so the condition has no effect
on the effective code.
This patch removes the condition and the duplicated code.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 14:39:32 -03:00
Mauro Carvalho Chehab f704eab5b6 [media] siano: avoid a linkedit error if !MC
If the media controller (MC) is not enabled, it will compile
fine, but will fail at the linkedition:

 ERROR: "media_device_unregister" [drivers/media/usb/siano/smsusb.ko] undefined!

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 14:17:01 -03:00
Mauro Carvalho Chehab 89a2c1d60a [media] use a function for DVB media controller register
This is really a simple function, but using it avoids to have
if's inside the drivers.

Also, the kABI becomes a little more clearer.

This shouldn't generate any overhead, and the type check
will happen when compiling with MC DVB enabled.

So, let's do it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 11:29:39 -03:00
Mauro Carvalho Chehab 872b9dbedd [media] dvb: Avoid warnings when compiled without the media controller
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c: In function ‘dvb_usbv2_adapter_dvb_exit’:
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:531:25: warning: unused variable ‘d’ [-Wunused-variable]
  struct dvb_usb_device *d = adap_to_d(adap);
                         ^
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:403:13: warning: ‘dvb_usbv2_media_device_register’ defined but not used [-Wunused-function]
 static void dvb_usbv2_media_device_register(struct dvb_usb_adapter *adap)

drivers/media/usb/dvb-usb/dvb-usb-dvb.c:97:13: warning: ‘dvb_usb_media_device_register’ defined but not used [-Wunused-function]
 static void dvb_usb_media_device_register(struct dvb_usb_adapter *adap)
             ^

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 11:25:45 -03:00
Mauro Carvalho Chehab 480884b647 [media] dvbdev: use adapter arg for dvb_create_media_graph()
Instead of using media_dev argument for dvb_create_media_graph(),
use the adapter.

That allows to create a stub for this function, if compiled
without DVB support, avoiding to add extra if's at the drivers.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 11:25:38 -03:00
Mauro Carvalho Chehab a3dfc6d925 [media] dvb-usb: create one media_dev per adapter
Instead of assuming just one adapter, change the code to store
one media controller per adapter.

This works fine for dvb-usb, as, on all drivers here, it is not
possible to write a media graph that would mix resources between
the two different adapters.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 09:52:26 -03:00
Rafael Lourenço de Lima Chehab 496ccf92b9 [media] dvb-usb: add support for the media controller at USB driver
Create a struct media_device and add it to the dvb adapter.

Please notice that the tuner is not mapped yet by the dvb core.

[mchehab@osg.samsung.com: use config option MEDIA_CONTROLLER_DVB]
Signed-off-by: Rafael Lourenço de Lima Chehab <chehabrafael@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 09:52:26 -03:00
Mauro Carvalho Chehab 823b460ee7 [media] dvb-usb-v2: create one media_dev per adapter
Instead of assuming just one adapter, change the code to store
one media controller per adapter.

This works fine for dvb-usb, as, on all drivers here, it is not
possible to write a media graph that would mix resources between
the two different adapters.

Acked-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 09:52:25 -03:00
Rafael Lourenço de Lima Chehab 6f6c77d8d2 [media] dvb-usb-v2: add support for the media controller at USB driver
Create a struct media_device and add it to the dvb adapter.

Please notice that the tuner is not mapped yet by the dvb core.

[mchehab@osg.samsung.com: use config option MEDIA_CONTROLLER_DVB due to a rebase]
Signed-off-by: Rafael Lourenço de Lima Chehab <chehabrafael@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 09:49:07 -03:00
Mauro Carvalho Chehab 4b208f8b56 [media] siano: register media controller earlier
We need to initialize the media controller earlier, as the core
will call the smsdvb hotplug during register time. Ok, this is
an async operation, so, when the module is not loaded, the media
controller works.

However, if the module is already loaded, nothing will be
registered at the media controller, as it will load too late.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 09:10:39 -03:00
Mauro Carvalho Chehab fb372a434d [media] siano: print a message if DVB register succeeds
Right now, this is a debug message, misplaced. Promote it
to an info message, as it helps to discover if something
bad happened during device init.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 09:10:05 -03:00
Mauro Carvalho Chehab d9f3836b7b [media] siano: get rid of sms_dbg parameter
All siano modules have a sms_dbg parameter. Now that we're using
the standard pr_debug() macro, we can get rid of it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 09:10:05 -03:00
Mauro Carvalho Chehab 0dd5f20cb3 [media] siano: get rid of sms_info()
On most cases, sms_info() should actually be pr_debug(), but,
on other places, it should be pr_info().

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 09:10:04 -03:00
Mauro Carvalho Chehab 6908368879 [media] siano: replace sms_debug() by pr_debug()
There's no reason to use a macro here. Just replace everything,
and let those debug messages to be activated via dynamic printk.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 09:10:04 -03:00
Mauro Carvalho Chehab 9b283e6796 [media] siano: replace sms_log() by pr_debug()
Despite its name, those functions are acutally debug
prints for the IR part of the driver. So, properly
map them using pr_debug()

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 09:10:03 -03:00
Mauro Carvalho Chehab 5ed0a2c7ec [media] siano: replace sms_err by pr_err
Originally, sms_err() would be also displaying the line where
the error occurs, but the messages are clear enough. Also,
the function is always printed. So, no need for it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 09:10:02 -03:00
Mauro Carvalho Chehab 535bd1e96e [media] siano: replace sms_warn() by pr_warn()
There's no reason for a sms' own sms_warn macro. Just replace
it by the standard pr_warn().

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 09:10:02 -03:00
Mauro Carvalho Chehab 5e022d1aa0 [media] siano: use pr_* print functions
Instead of defining its own set of printk functions, let's
use the common Kernel debug logic provided by pr_foo functions.

As a first step, let's just define the existing macros as the
Kernel ones.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 09:10:01 -03:00
Mauro Carvalho Chehab 46b1e21fe5 [media] siano: add support for the media controller at USB driver
Adding support for the media controller for a pure DVB device
is simple: just create a struct media_device and add it to the
dvb adapter. After creating all DVB devices, we need to call
the DVB core, for it to create the media graph.

More work is needed for pure DVB tuners, but this is hidden
at the Siano driver, just like several others non-hybrid
devices. So, this is streight forward.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 08:46:48 -03:00
Mauro Carvalho Chehab 7e4f23d53d [media] cx25840: better document the media pads
Use an enum to better document the media pads.

No functional changes.

Suggested-by: Prabhakar Lad <prabhakar.csengg@gmail.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 08:45:58 -03:00
Mauro Carvalho Chehab db74935905 [media] cx25840: fix return logic when media entity init fails
There's no need to free state, as it was allocated via devm_kzalloc().

Also, let's return the error code, instead of something else.

Reported-by: Prabhakar Lad <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 08:45:42 -03:00
Mauro Carvalho Chehab 3d263114c4 [media] cx231xx: enable the analog tuner at buffer setup
buf_prepare callback is called for every queued buffer. This is
an overkill. Call it at buf_setup, as this should be enough.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 08:45:25 -03:00
Mauro Carvalho Chehab 7e2b41e912 [media] cx231xx: Improve the media controller comment
There are two problems at the comment:
- it is badly idented;
- its comment doesn't mean anything.

Fix it.

Requested-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 08:45:01 -03:00
Mauro Carvalho Chehab 18e8d630cc [media] cx25840: better document the media controller TODO
Analog video inputs are the tuner, plus composite, svideo, etc,
 e. g. the input pat should actually be like:

                ___________
TUNER --------> |         |
                |         |
SVIDEO .......> | cx25840 |
                |         |
COMPOSITE1 ...> |_________|

(in the above, dashes represent the enabled link, and periods
represent the disabled ones)

In other words, if we want to properly represent the pipeline,
it should be possible to see via the media controller if the tuner
is being used as an image source, or if the source is something else.

I didn't map those other inputs here yet, due to a few things:
- The extra inputs would require subdevs that won't be controlled
- I was in doubt about the best way for doing that
- That would likely require some extra setup for cx25840 caller
  drivers, in order to represent what of the possible internal
  inputs are actually used on each specific board

Actually, at least for now, I was unable to see much benefit
on adding such map now, so let's just document it, as this could
be added later on, as needed.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 08:44:40 -03:00
Mauro Carvalho Chehab e4fd3bc504 [media] dvb core: rename the media controller entities
Prefix all DVB media controller entities with "dvb-" and use dash
instead of underline at the names.

Requested-by: Hans Verkuil <hans.verkuil@cisco.com>

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 08:44:19 -03:00
Mauro Carvalho Chehab daf77bd9c2 [media] tuner-core: fix compilation if the media controller is not defined
drivers/media/v4l2-core/tuner-core.c:440:7: error: 'struct v4l2_subdev' has no member named 'entity'
     t->sd.entity.name = t->name;

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 08:44:04 -03:00
Mauro Carvalho Chehab 63ba8c7518 [media] cx231xx: fix compilation if the media controller is not defined
drivers/media/usb/cx231xx/cx231xx-cards.c: In function ‘cx231xx_usb_probe’:
drivers/media/usb/cx231xx/cx231xx-cards.c:1589:15: error: ‘struct v4l2_device’ has no member named ‘mdev’
  dev->v4l2_dev.mdev = dev->media_dev;
               ^
drivers/media/usb/cx231xx/cx231xx-cards.c:1589:26: error: ‘struct cx231xx’ has no member named ‘media_dev’
  dev->v4l2_dev.mdev = dev->media_dev;
                          ^
scripts/Makefile.build:257: recipe for target 'drivers/media/usb/cx231xx/cx231xx-cards.o' failed

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 08:43:49 -03:00
Mauro Carvalho Chehab c1bd57d30b [media] dvb-frontend: remove a warning
if CONFIG_MEDIA_CONTROLLER_DVB is not selected, it is now
producing this warning:

drivers/media/dvb-core/dvb_frontend.c: In function ‘dvb_frontend_thread’:
drivers/media/dvb-core/dvb_frontend.c:695:6: warning: unused variable ‘ret’ [-Wunused-variable]
  int ret;
      ^

Reported-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 08:43:29 -03:00
Mauro Carvalho Chehab 8a26a258bd [media] dvb core: only start media entity if not NULL
The logic there tries to start the media entity even if it
doesn't exist, causing this bug:

	[  314.356162] BUG: unable to handle kernel NULL pointer dereference at 0000000000000010
	[  314.356202] IP: [<ffffffffa02ef74c>] media_entity_pipeline_start+0x1c/0x390 [media]

Reported-by: Gert-Jan van der Stroom <gjstroom@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-23 16:10:54 -03:00
Mauro Carvalho Chehab 99a85b901e Linux 34.0-rc1
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJU6pFJAAoJEHm+PkMAQRiG2OwH/24nDK+l9zkaRs0xJsVh+qiW
 8A2N1od0ickz43iMk48jfeWGkFOkd4izyvan/daJshJOE1Y5lCdSs7jq/OXVOv9L
 G0+KQUoC5NL0hqYKn1XJPFluNQ1yqMvrDwQt99grDGzruNGBbwHuBhAQmgzpj1nU
 do8KrGjr7ft1Rzm4mOAdET/ExWiF+mRSJSxxOv598HbsIRdM5wgn0hHjPlqDxmLN
 KH4r3YYEm0cHyjf4Krse0+YdhqdamRGJlmYxJgEsYNwCoMwkmHlLTc71diseUhrg
 r/VYIYQvpAA6Yvgw8rJ0N5gk/sJJig+WyyPhfQuc2bD5sbL9eO7mPnz2UP7z7ss=
 =vXB6
 -----END PGP SIGNATURE-----

Merge tag 'v4.0-rc1' into patchwork

Linux 34.0-rc1

* tag 'v4.0-rc1': (8947 commits)
  Linux 4.0-rc1
  autofs4 copy_dev_ioctl(): keep the value of ->size we'd used for allocation
  procfs: fix race between symlink removals and traversals
  debugfs: leave freeing a symlink body until inode eviction
  Documentation/filesystems/Locking: ->get_sb() is long gone
  trylock_super(): replacement for grab_super_passive()
  fanotify: Fix up scripted S_ISDIR/S_ISREG/S_ISLNK conversions
  Cachefiles: Fix up scripted S_ISDIR/S_ISREG/S_ISLNK conversions
  VFS: (Scripted) Convert S_ISLNK/DIR/REG(dentry->d_inode) to d_is_*(dentry)
  SELinux: Use d_is_positive() rather than testing dentry->d_inode
  Smack: Use d_is_positive() rather than testing dentry->d_inode
  TOMOYO: Use d_is_dir() rather than d_inode and S_ISDIR()
  Apparmor: Use d_is_positive/negative() rather than testing dentry->d_inode
  Apparmor: mediated_filesystem() should use dentry->d_sb not inode->i_sb
  VFS: Split DCACHE_FILE_TYPE into regular and special types
  VFS: Add a fallthrough flag for marking virtual dentries
  VFS: Add a whiteout dentry type
  VFS: Introduce inode-getting helpers for layered/unioned fs environments
  kernel: make READ_ONCE() valid on const arguments
  blk-throttle: check stats_cpu before reading it from sysfs
  ...
2015-02-23 16:02:19 -03:00
Mauro Carvalho Chehab 135f9be919 [media] dvb_frontend: start media pipeline while thread is running
While the DVB thread is running, the media pipeline should be
streaming. This should prevent any attempt of using the analog
TV while digital TV is working, and vice-versa.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13 21:10:17 -02:00
Mauro Carvalho Chehab 0f0fa90bd0 [media] cx231xx: enable tuner->decoder link at videobuf start
The tuner->decoder needs to be enabled when we're about to
start streaming.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13 21:10:16 -02:00
Mauro Carvalho Chehab 9239effd53 [media] dvb-frontend: enable tuner link when the FE thread starts
If the dvb frontend thread starts, the tuner should be switched
to the frontend. Add a code that ensures that this will happen,
using the media controller.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13 21:10:16 -02:00
Mauro Carvalho Chehab 6bb0b1829b [media] dvbdev: enable DVB-specific links
For now, let's keep the DVB-specific media controller links enabled
by default. On most devices, this is fixed anyway, so no big issue.

Ok, the demux actually have dynamic links based on the filters, but
we don't represent them yet, as the media controller currently lacks
the capability of dynamically create/delete entities.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13 21:10:16 -02:00
Mauro Carvalho Chehab 54e339a960 [media] cx231xx: create DVB graph
cx231xx is simple with regards to DVB: all boards have just one
DVB adapter. So, we can use the default DVB helper function to
create the DVB media graph.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13 21:10:16 -02:00
Mauro Carvalho Chehab 4155109aa8 [media] dvbdev: add a function to create DVB media graph
We need to create a DVB graph, linking the several DVB devnodes.

Add such function. Please notice that this helper function
doesn't take into account devices with multiple DVB adapters
and frontends.

For devices with multiple adapters, they should either create two
different media controller instances or to improve this function
to take the adapter ID into account.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13 21:10:15 -02:00
Mauro Carvalho Chehab 3bde1b7840 [media] dvbdev: represent frontend with two pads
While on some devices the tuner is bound inside the frontend,
other devices use a separate subdevice for it.

So, in order to be more generic, better to map it with two
pads.

That will allows to use the media controller to lock the tuner
between the DVB and the V4L2 sub-drivers, on hybrid devices.

While here, change the logic to use pad 0 as sink for devices
with both sink and source pads.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13 21:10:15 -02:00
Mauro Carvalho Chehab d35a9855a8 [media] cx231xx: create media links for analog mode
Now that we have entities and pads, let's create media links
between them, for analog setup.

We may not have all the links for digital yet, as the dvb extention
may not be loaded yet.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13 21:10:15 -02:00
Mauro Carvalho Chehab b6a40e7280 [media] cx231xx: initialize video/vbi pads
Both video and vbi are sink pads. Initialize them as such.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13 21:10:14 -02:00
Mauro Carvalho Chehab 8cd61969c8 [media] cx25840: fill the media controller entity
Instead of keeping the media controller entity not initialized,
fill it and create the pads for cx25840.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13 21:10:14 -02:00
Mauro Carvalho Chehab 00a5a4bf7b [media] tuner-core: properly initialize media controller subdev
Properly initialize tuner core subdev at the media controller.

That requires a new subtype at the media controller API.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13 21:10:14 -02:00
Mauro Carvalho Chehab 172e9d3c88 [media] dvbdev: add pad for the DVB devnodes
We want to represent the links between the several DVB devnodes,
so let's create PADs for them.

The DVB net devnode is a different matter, as it is not related
to the media stream, but with network. So, at least for now, let's
not add any pad for it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13 21:10:14 -02:00
Mauro Carvalho Chehab e3d65c33e3 [media] dvb_net: add support for DVB net node at the media controller
Make the dvb core network support aware of the media controller and
register the corresponding devices.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13 21:10:13 -02:00
Mauro Carvalho Chehab 738a1b1e13 [media] dvb_ca_en50221: add support for CA node at the media controller
Make the dvb core CA support aware of the media controller and
register the corresponding devices.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13 21:10:13 -02:00
Mauro Carvalho Chehab 8afd52ef92 [media] dmxdev: add support for demux/dvr nodes at media controller
Make the dvb core demux support aware of the media controller and
register the corresponding devices.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13 21:10:13 -02:00
Mauro Carvalho Chehab c1b31b1e82 [media] dvb_frontend: add media controller support for DVB frontend
Now that the dvb core is capable of registering devices via the
media controller, add support for the DVB frontend devices.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13 21:10:13 -02:00
Mauro Carvalho Chehab 1d058bdcf5 [media] cx231xx: add media controller support
Let's add media controller support for this driver and register it
for both V4L and DVB.

The media controller on this driver is not mandatory, as it can fully
work without it. So, if the media controller register fails, just print
an error message, but proceed with device registering.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13 21:10:12 -02:00
Mauro Carvalho Chehab a0246e02f4 [media] dvbdev: add support for media controller
Provide a way to register media controller device nodes
at the DVB core.

Please notice that the dvbdev callers also require changes
for the devices to be registered via the media controller.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13 21:10:12 -02:00
Mauro Carvalho Chehab e31a0ba7df [media] media: Fix DVB devnode representation at media controller
The previous provision for DVB media controller support were to
define an ID (likely meaning the adapter number) for the DVB
devnodes.

This is just plain wrong. Just like V4L, DVB devices (and any other
device node)) are uniquely identified via a (major, minor) tuple.

This is enough to uniquely identify a devnode, no matter what
API it implements.

So, before we go too far, let's mark the old v4l, fb, dvb and alsa
"devnode" info as deprecated, and just call it as "dev".

We can latter add fields specific to each API if needed.

As we don't want to break compilation on already existing apps,
let's just keep the old definitions as-is, adding a note that
those are deprecated at media-entity.h.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13 21:10:10 -02:00
Andrea Arcangeli 7e33912849 mm: gup: use get_user_pages_unlocked
This allows those get_user_pages calls to pass FAULT_FLAG_ALLOW_RETRY to
the page fault in order to release the mmap_sem during the I/O.

Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Andres Lagar-Cavilla <andreslc@google.com>
Cc: Peter Feiner <pfeiner@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-02-11 17:06:05 -08:00
Zhangfei Gao bc0c5aa35a [media] ir-hix5hd2: remove writel/readl_relaxed define
Commit 9439eb3ab9 ("asm-generic: io: implement relaxed
accessor macros as conditional wrappers") has added
{read,write}{b,w,l,q}_relaxed to include/asm-generic/io.h

Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-11 20:23:52 -02:00
Luis de Bethencourt d6d4c0e00f [media] gpsca: remove the risk of a division by zero
As reported by Peter Kovar, there's a potential risk of a division by
zero on calls to jpeg_set_qual() when quality is zero.

As quality can't be 0 or lower than that, add an extra clause to cover
this special case.

Signed-off-by: Luis de Bethencourt <luis.bg@samsung.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-10 21:38:40 -02:00
Joe Perches 4bad5d2d25 [media] dvb_net: Convert local hex dump to print_hex_dump_debug
Use the generic facility instead of a home-grown one.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 18:24:44 -02:00
Joe Perches 5c7c0ca02f [media] dvb_net: Use standard debugging facilities
Convert dprintk to netdev_dbg where appropriate.
Remove dvb_net_debug module_param.
Remove __func__ from output as that can be added by dynamic_debug.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 18:24:29 -02:00
Joe Perches be87b90f8c [media] dvb_net: Use vsprintf %pM extension to print Ethernet addresses
No need for more macros, so remove them and use the kernel extension.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 18:23:58 -02:00
Martin Kepplinger 2948c01c2b [media] stb0899: use sign_extend32() for sign extension
Instead of implement its own logic, use the already-defined one.

Signed-off-by: Martin Kepplinger <martink@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 18:16:18 -02:00
Olli Salonen 17d4d6ae09 [media] si2168: add support for 1.7MHz bandwidth
This patch is based on Antti's silabs branch.

Add support for 1.7 MHz bandwidth. Supported in all versions of Si2168 according to short data sheets.

[mchehab@osg.samsung.com: Fix CodingStyle]
Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 18:13:12 -02:00
Olli Salonen 683e98b602 [media] si2168: return error if set_frontend is called with invalid parameters
This patch should is based on Antti's silabs branch.

According to dvb-frontend.h set_frontend may be called with bandwidth_hz set to 0 if automatic bandwidth is required. Si2168 does not support automatic bandwidth and does not declare FE_CAN_BANDWIDTH_AUTO in caps.

This patch will change the behaviour in a way that EINVAL is returned if bandwidth_hz is 0.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 18:12:46 -02:00
Andy Shevchenko 3656cddd50 [media] lirc_dev: avoid potential null-dereference
We have to check pointer for NULL and then dereference it.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 17:33:42 -02:00
Akihiro Tsukada e601044212 [media] dvb: tc90522: re-add symbol-rate report
symbol-rate report was wrongly removed off by the commit:906aaf5a .

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 17:16:52 -02:00
Malcolm Priestley 8716901384 [media] lmedm04: add read snr, signal strength and ber call backs
This allows calling the original functions providing the streaming is off.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 17:16:33 -02:00
Malcolm Priestley 743ab6a1cc [media] lmedm04: Create frontend call back for read status
Create dm04_read_status to check lock through either interrupt values
or directly by the call back.

When the device is not streaming the frontends original call back is
used. When streaming has started it turns off I2C messaging by
setting st->i2c_talk_onoff to zero. I2C can only be turn on again
by one of the other allowed frontend calls.

All old code is removed from lme2510_msg and this function only needs
to set st->i2c_talk_onoff to 1.

The lock status is saved and when the frondend is locked is maintained
by lme2510_int_response who will now just kill the lock.

The call back for rs2000 tuner is nologer required.

All frontend types have been tested.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 17:16:13 -02:00
Malcolm Priestley d8bad1e2ab [media] lmedm04: create frontend callbacks for signal/snr/ber/ucblocks
Create call backs dm04_read_signal_strength, dm04_read_snr and
move dm04_read_ber and dm04_read_ucblocks for all frontends

Removing the I2C filtering from lme2510_msg and the old rs2000 callbacks.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 17:15:29 -02:00
Malcolm Priestley 15e1ce3318 [media] lmedm04: Fix usb_submit_urb BOGUS urb xfer, pipe 1 != type 3 in interrupt urb
A quirk of some older firmwares that report endpoint pipe type as PIPE_BULK
but the endpoint otheriwse functions as interrupt.

Check if usb_endpoint_type is USB_ENDPOINT_XFER_BULK and set as usb_rcvbulkpipe.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 17:14:42 -02:00
Malcolm Priestley cfcd7b8258 [media] lmedm04: Increase Interupt due time to 200 msec
Ocassionally the device fails to report back an interrupt urb status which
results in false no lock trigger on the RS2000 demodulator.

Increase time from 60 msecs to 200 msecs.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Cc: <stable@vger.kernel.org> # v3.17+
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 17:14:00 -02:00
Mauro Carvalho Chehab 86c330fa59 [media] cx88-dvb: whitespace cleanup
X-Patchwork-Delegate: m.chehab@samsung.com
Fix the following smatch warning:
	drivers/media/pci/cx88//cx88-dvb.c:1508 dvb_register() warn: if statement not indented

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 17:12:12 -02:00
Mauro Carvalho Chehab e181b1f190 [media] rtl28xxu: properly initialize pdata
As complained by smatch:
	drivers/media/usb/dvb-usb-v2/rtl28xxu.c:1159 rtl2832u_tuner_attach() info: 'pdata' is not actually initialized (unreached code).

Cc: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:38:48 -02:00
Mauro Carvalho Chehab bda977b731 [media] rtl2832: declare functions as static
drivers/media/dvb-frontends/rtl2832.c:157:5: warning: no previous prototype for ‘rtl2832_bulk_write’ [-Wmissing-prototypes]
 int rtl2832_bulk_write(struct i2c_client *client, unsigned int reg,
     ^
drivers/media/dvb-frontends/rtl2832.c:169:5: warning: no previous prototype for ‘rtl2832_update_bits’ [-Wmissing-prototypes]
 int rtl2832_update_bits(struct i2c_client *client, unsigned int reg,
     ^
drivers/media/dvb-frontends/rtl2832.c:181:5: warning: no previous prototype for ‘rtl2832_bulk_read’ [-Wmissing-prototypes]
 int rtl2832_bulk_read(struct i2c_client *client, unsigned int reg, void *val,

Cc: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:38:43 -02:00
Mauro Carvalho Chehab d858b0e787 [media] rtl2830: declare functions as static
drivers/media/dvb-frontends/rtl2830.c:21:5: warning: no previous prototype for ‘rtl2830_bulk_write’ [-Wmissing-prototypes]
 int rtl2830_bulk_write(struct i2c_client *client, unsigned int reg,
     ^
drivers/media/dvb-frontends/rtl2830.c:33:5: warning: no previous prototype for ‘rtl2830_update_bits’ [-Wmissing-prototypes]
 int rtl2830_update_bits(struct i2c_client *client, unsigned int reg,
     ^
drivers/media/dvb-frontends/rtl2830.c:45:5: warning: no previous prototype for ‘rtl2830_bulk_read’ [-Wmissing-prototypes]
 int rtl2830_bulk_read(struct i2c_client *client, unsigned int reg, void *val,
     ^

Cc: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:38:29 -02:00
Antti Palosaari cecc589620 [media] rtl2832_sdr: add kernel-doc comments for platform_data
Add kernel-doc comments for platform_data configuration structure.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:31:01 -02:00
Antti Palosaari 2f74b7c2f8 [media] rtl2832: add kernel-doc comments for platform_data
Add kernel-doc comments for platform_data configuration structure.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:30:47 -02:00
Antti Palosaari 61c309ffcd [media] rtl2830: add kernel-doc comments for platform_data
Add kernel-doc comments for platform_data configuration structure.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:30:26 -02:00
Antti Palosaari b410dae43c [media] rtl2832: implement own lock for regmap
Introduce own lock to silence lockdep warning. lockdep validator
makes wrong decision when two similar (&map->mutex) locks were taken
recursively, even those are different mutexes in a two different
drivers. After that patch, functionality remains same, but mutex names
are different. That is a temporary hack, proper solution is make
regmap aware of locked nested locking rules.

=============================================
[ INFO: possible recursive locking detected ]
3.18.0-rc4+ #4 Tainted: G           O
---------------------------------------------
kdvb-ad-0-fe-0/2814 is trying to acquire lock:
 (&map->mutex){+.+.+.}, at: [<ffffffff814ec90f>] regmap_lock_mutex+0x2f/0x40

but task is already holding lock:
 (&map->mutex){+.+.+.}, at: [<ffffffff814ec90f>] regmap_lock_mutex+0x2f/0x40

other info that might help us debug this:
 Possible unsafe locking scenario:
       CPU0
       ----
  lock(&map->mutex);
  lock(&map->mutex);

 *** DEADLOCK ***
 May be due to missing lock nesting notation
1 lock held by kdvb-ad-0-fe-0/2814:
 #0:  (&map->mutex){+.+.+.}, at: [<ffffffff814ec90f>] regmap_lock_mutex+0x2f/0x40

stack backtrace:
CPU: 3 PID: 2814 Comm: kdvb-ad-0-fe-0 Tainted: G           O 3.18.0-rc4+ #4
Hardware name: System manufacturer System Product Name/M5A78L-M/USB3, BIOS 2001    09/11/2014
 0000000000000000 00000000410c8772 ffff880293af3868 ffffffff817a6f82
 0000000000000000 ffff8800b3462be0 ffff880293af3968 ffffffff810e7f94
 ffff880293af3888 00000000410c8772 ffffffff82dfee60 ffffffff81ab8f89
Call Trace:
 [<ffffffff817a6f82>] dump_stack+0x4e/0x68
 [<ffffffff810e7f94>] __lock_acquire+0x1ea4/0x1f50
 [<ffffffff810e2a7d>] ? trace_hardirqs_off+0xd/0x10
 [<ffffffff817b01f3>] ? _raw_spin_lock_irqsave+0x83/0xa0
 [<ffffffff810e13e6>] ? up+0x16/0x50
 [<ffffffff810e2a7d>] ? trace_hardirqs_off+0xd/0x10
 [<ffffffff817af8bf>] ? _raw_spin_unlock_irqrestore+0x5f/0x70
 [<ffffffff810e9069>] lock_acquire+0xc9/0x170
 [<ffffffff814ec90f>] ? regmap_lock_mutex+0x2f/0x40
 [<ffffffff817ab50e>] mutex_lock_nested+0x7e/0x430
 [<ffffffff814ec90f>] ? regmap_lock_mutex+0x2f/0x40
 [<ffffffff814ec90f>] ? regmap_lock_mutex+0x2f/0x40
 [<ffffffff817a530b>] ? printk+0x70/0x86
 [<ffffffff8110d9e8>] ? mod_timer+0x168/0x240
 [<ffffffff814ec90f>] regmap_lock_mutex+0x2f/0x40
 [<ffffffff814f08d9>] regmap_update_bits+0x29/0x60
 [<ffffffffa03e9778>] rtl2832_select+0x38/0x70 [rtl2832]
 [<ffffffffa039b03d>] i2c_mux_master_xfer+0x3d/0x90 [i2c_mux]
 [<ffffffff815da493>] __i2c_transfer+0x73/0x2e0
 [<ffffffff815dbaba>] i2c_transfer+0x5a/0xc0
 [<ffffffff815dbb6e>] i2c_master_send+0x4e/0x70
 [<ffffffffa03ff25a>] regmap_i2c_write+0x1a/0x50 [regmap_i2c]
 [<ffffffff817ab713>] ? mutex_lock_nested+0x283/0x430
 [<ffffffff814f06b2>] _regmap_raw_write+0x862/0x880
 [<ffffffff814ec90f>] ? regmap_lock_mutex+0x2f/0x40
 [<ffffffff814f0744>] _regmap_bus_raw_write+0x74/0xa0
 [<ffffffff814ef3d2>] _regmap_write+0x92/0x140
 [<ffffffff814f0b7b>] regmap_write+0x4b/0x70
 [<ffffffffa032b090>] ? dvb_frontend_release+0x110/0x110 [dvb_core]
 [<ffffffffa05141d4>] e4000_init+0x34/0x210 [e4000]
 [<ffffffffa032a029>] dvb_frontend_init+0x59/0xc0 [dvb_core]
 [<ffffffff810bde30>] ? finish_task_switch+0x80/0x180
 [<ffffffff810bddf2>] ? finish_task_switch+0x42/0x180
 [<ffffffffa032b116>] dvb_frontend_thread+0x86/0x7b0 [dvb_core]
 [<ffffffff817a9203>] ? __schedule+0x343/0x930
 [<ffffffffa032b090>] ? dvb_frontend_release+0x110/0x110 [dvb_core]
 [<ffffffff810b826b>] kthread+0x10b/0x130
 [<ffffffff81020099>] ? sched_clock+0x9/0x10
 [<ffffffff810b8160>] ? kthread_create_on_node+0x250/0x250
 [<ffffffff817b063c>] ret_from_fork+0x7c/0xb0
 [<ffffffff810b8160>] ? kthread_create_on_node+0x250/0x250

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:28:12 -02:00
Antti Palosaari 670ef05f82 [media] rtl28xxu: correct reg access routine name prefixes
Use rtl28xxu_ prefix for all register access routine names.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:27:33 -02:00
Antti Palosaari 723abfd787 [media] rtl28xxu: merge rtl2831u and rtl2832u properties
As all the callbacks are already same we could merge device
properties struct too and save space.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:27:04 -02:00
Antti Palosaari de701f0ff1 [media] rtl28xxu: merge chip type specific all callbacks
Merge all chip type specific prefixed (rtl2831u_ and rtl2832u_)
callback to top level callback prefixed as rtl28xxu_.

rtl2831u_foo() => rtl28xxu_foo()
rtl2832u_foo() => rtl28xxu_foo()

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:26:37 -02:00
Antti Palosaari d0f232e823 [media] rtl28xxu: add heuristic to detect chip type
Detect automatically whether chip is old RTL2831U or newer
RTL2832U/RTL2832P. Detection is based I2C command that is found only
from newer RTL2832U models.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:25:24 -02:00
Antti Palosaari c56222a6b2 [media] rtl28xxu: move usb buffers to state
Buffer needed for USB control message is small so move it to state
and get rid of alloc/free used for each control message.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:24:49 -02:00
Antti Palosaari 5ba4ca1a14 [media] rtl28xxu: fix logging
Pass correct device pointer to dev_* logging in order to print
module name and bus id correctly.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:24:15 -02:00
Antti Palosaari 9a02e8fdef [media] rtl28xxu: rename state variable 'priv' to 'dev'
I prefer dev over priv and I want keep all my drivers in line with
that.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:23:58 -02:00
Antti Palosaari 0d117901b6 [media] rtl2832: remove internal mux I2C adapter
There was 2 muxed I2C adapters, one for demod tuner bus and one for
internal use. Idea of internal I2C adapter was to force I2C repeater
close when demod access its registers. Driver has also delayed work
queue based method to close I2C repeater.

After regmap conversion internal I2C adapter based repeater close
left unused - only work queue method was in use. We could not use
internal mux adapter method with regmap as it makes recursive regmap
call, which causes deadlock as regmap has own locking. Due to that
remove whole method totally.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:23:09 -02:00
Antti Palosaari d5eec231be [media] rtl2832_sdr: refcount to rtl28xxu
We are consumer of DVB frontend provided by rtl28xxu module. Due to
that we must use refcount to ensure none could remove rtl28xxu when
we are alive (or when we are streaming, if more fine-grained
refcounting is wanted).

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:22:24 -02:00
Antti Palosaari 6a53fa2350 [media] rtl28xxu: do not refcount rtl2832_sdr module
This driver, rtl28xxu, offers frontend service for rtl2832_sdr
module, thus we are producer and rtl2832_sdr module is consumer.
Due to that, reference counting should be done in way rtl2832_sdr
takes refrence to rtl28xxu. Remove wrong refcount.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:21:48 -02:00
Antti Palosaari a6f62431a0 [media] rtl28xxu: simplify FE callback handling
Logic is so simple that there is no idea to separate tuner selection to
own function, instead do it in a callback and get rid of one function.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:21:19 -02:00
Antti Palosaari 1dbbdceeb6 [media] rtl28xxu: fix DVB FE callback
DVB FE callback functionality went broken after I moved tuners to
demod muxed I2C adapter. That happens because driver state was
carried by I2C adapter and when mux is used there is one adapter
more in a chain.
USB adapter <-> I2C adapter <-> muxed I2C adapter

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:20:46 -02:00
Antti Palosaari a08c378119 [media] rtl2832: implement sleep
Put demod to soft reset in order to save power when sleep. That drops
power usage ~30mA @5V on USB dongle I tested. In real life it does
not matter much as USB IF powers off demod too, but now it is done
twice - demod and USB IF.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:20:02 -02:00
Antti Palosaari 75c24005ee [media] rtl2832: claim copyright and module author
I have implemented tons of things for that driver, more than anyone
else, so lets claim copyright and module authorship.

Cc: Thomas Mair <thomas.mair86@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:19:24 -02:00
Antti Palosaari cd559e0b13 [media] rtl2832: cleanups and minor changes
Remove all the stuff that is not needed anymore. Rename variable.
Remove extra new lines.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:18:51 -02:00
Antti Palosaari 3bda2bf1f8 [media] rtl2832_sdr: cleanups
Small cleanups. Remove unneeded variables. Some checkpatch issues.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:18:03 -02:00
Antti Palosaari e4e78693a1 [media] rtl2832_sdr: fix logging
Pass correct device, platform device, for logging system in order
to format printouts correctly.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:17:24 -02:00
Antti Palosaari 488be13a5e [media] rtl28xxu: use master I2C adapter for slave demods
Both mn88472 and mn88473 slave demods are connected to master I2C
bus, not the bus behind master demod I2C gate like tuners. Use
correct bus.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:16:47 -02:00
Antti Palosaari a2f7f220df [media] rtl28xxu: switch SDR module to platform driver
RTL2832 SDR module implements kernel platform driver. Change old
binding to that one.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:16:17 -02:00
Antti Palosaari 63bdab5d31 [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>
2015-02-03 16:15:43 -02:00
Antti Palosaari 725b7f3046 [media] rtl2832_sdr: rename state variable from 's' to 'dev'
'dev' sounds better than 's' for such variable.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:13:17 -02:00
Antti Palosaari 0aa32ef9b3 [media] rtl2832: provide register IO callbacks
Provide register read and write callbacks for SDR module.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:12:34 -02:00
Antti Palosaari eec21beb35 [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>
2015-02-03 16:12:07 -02:00
Antti Palosaari 5e5d52a00f [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>
2015-02-03 16:11:17 -02:00
Antti Palosaari dcadb82a7a [media] rtl2832: use regmap reg cache
Enable regmap register cache in order to reduce IO.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:10:54 -02:00
Antti Palosaari e20b0cf2f3 [media] rtl28xxu: add support for RTL2832U/RTL2832 PID filter
RTL2832 demod integrated into RTL2832U has PID filter. PID filtering
is provided by rtl2832 demod driver. Add support for it.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:10:19 -02:00
Antti Palosaari 4b01e01a81 [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>
2015-02-03 16:09:56 -02:00
Antti Palosaari 1c7da405c6 [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>
2015-02-03 16:09:19 -02:00
Antti Palosaari c65dbf652d [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>
2015-02-03 16:08:37 -02:00
Antti Palosaari 164f3d2a83 [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>
2015-02-03 16:08:16 -02:00