Commit Graph

22129 Commits

Author SHA1 Message Date
Mauro Carvalho Chehab 59ecd59d78 [media] omap3/omap4/davinci: get rid of MEDIA_ENT_T_V4L2_SUBDEV abuse
On omap3/omap4/davinci drivers, MEDIA_ENT_T_V4L2_SUBDEV macro is
abused in order to "simplify" the pad checks.

Basically, it does a logical or of this macro, in order to check
for a local index and if the entity is either a subdev or not.

As we'll get rid of MEDIA_ENT_T_V4L2_SUBDEV macro, replace it by
2 << 16 where it occurs, and add a note saying that the code
there is actually a hack.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:50 -02:00
Mauro Carvalho Chehab 3efdf62c5f [media] media: use macros to check for V4L2 subdev entities
Instead of relying on media subtype, use the new macros to detect
if an entity is a subdev or an A/V DMA entity.

Please note that most drivers assume that there's just AV_DMA or
V4L2 subdevs. This is not true anymore, as we've added MC support
for DVB, and there are plans to add support for ALSA and FB/DRM
too.

Ok, on the current pipelines supported by those drivers, just V4L
stuff are there, but, assuming that some day a pipeline that also
works with other subsystems will ever added, it is better to add
explicit checks for the AV_DMA stuff.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:50 -02:00
Mauro Carvalho Chehab cf49066152 [media] replace all occurrences of MEDIA_ENT_T_DEVNODE_V4L
Now that interfaces and entities are distinct, it makes no sense
of keeping something named as MEDIA_ENT_T_DEVNODE.

This change was done with this script:

	for i in $(git grep -l MEDIA_ENT_T|grep -v uapi/linux/media.h); do sed s,MEDIA_ENT_T_DEVNODE_V4L,MEDIA_ENT_T_V4L2_VIDEO, <$i >a && mv a $i; done

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:49 -02:00
Mauro Carvalho Chehab 32fdc0e1a8 [media] uapi/media.h: Fix entity namespace
Now that interfaces got created, we need to fix the entity
namespace.

So, let's create a consistent new namespace and add backward
compatibility macros to keep the old namespace preserved.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:49 -02:00
Mauro Carvalho Chehab 8ddb90d2e5 [media] dvbdev: add support for indirect interface links
Some interfaces indirectly control multiple entities.
Add support for those.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:48 -02:00
Mauro Carvalho Chehab 57cf79b79b [media] media: add a linked list to track interfaces by mdev
The media device should list the interface objects, so add a linked list
for those interfaces in struct media_device.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:48 -02:00
Mauro Carvalho Chehab 8211b187ec [media] dvbdev: add support for interfaces
Now that the infrastruct for that is set, add support for
interfaces.

Please notice that we're missing two links:
	DVB FE intf    -> tuner
	DVB demux intf -> dvr

Those should be added latter, after having the entire graph
set. With the current infrastructure, those should be added
at dvb_create_media_graph(), but it would also require some
extra core changes, to allow the function to enumerate the
interfaces.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:48 -02:00
Mauro Carvalho Chehab 1283f849dc [media] media-entity: add a helper function to create interface
As we'll be adding other interface types in the future, put the
common interface create code on a separate function.

Suggested-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>
2016-01-11 12:18:48 -02:00
Mauro Carvalho Chehab 86e2662071 [media] media: add support to link interfaces and entities
Now that we have a new graph object called "interfaces", we
need to be able to link them to the entities.

Add a linked list to the interfaces to allow them to be
linked to the entities.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:47 -02:00
Mauro Carvalho Chehab 3c0e266fba [media] media: make link debug printk more generic
Remove entity name from the link as this exists only if the object
type is PAD on both link ends.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:47 -02:00
Mauro Carvalho Chehab 23615de5ee [media] media: make add link more generic
The media_entity_add_link() function takes an entity
as an argument just to get the list head.

Make it more generic by changing the function argument
to list_head.

No functional changes.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:47 -02:00
Mauro Carvalho Chehab 57208e5e25 [media] media: convert links from array to list
The entire logic that represent graph links were developed on a
time where there were no needs to dynamic remove links. So,
although links are created/removed one by one via some
functions, they're stored as an array inside the entity struct.

As the array may grow, there's a logic inside the code that
checks if the amount of space is not enough to store
the needed links. If it isn't the core uses krealloc()
to change the size of the link, with is bad, as it
leaves the memory fragmented.

So, convert links into a list.

Also, currently,  both source and sink entities need the link
at the graph traversal logic inside media_entity. So there's
a logic duplicating all links. That makes it to spend
twice the memory needed. This is not a big deal for today's
usage, where the number of links are not big.

Yet, if during the MC workshop discussions, it was said that
IIO graphs could have up to 4,000 entities. So, we may
want to remove the duplication on some future. The problem
is that it would require a separate linked list to store
the backlinks inside the entity, or to use a more complex
algorithm to do graph backlink traversal, with is something
that the current graph traversal inside the core can't cope
with. So, let's postpone a such change if/when it is actually
needed.

It should also be noticed that the media_link structure uses
44 bytes on 32-bit architectures and 84 bytes on 64-bit
architecture. It will thus be allocated out of the 64-bytes and
96-bytes pools respectively. That's a 12.5% memory waste on
64-bit architectures and 31.25% on 32-bit architecture.
A linked list is less efficient than an array in this case, but
this could later be optimized if we can get rid of the reverse
links (with would reduce memory allocation by 50%).

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:46 -02:00
Mauro Carvalho Chehab 8f6d368f72 [media] media: Don't accept early-created links
Links are graph objects that represent the links of two already
existing objects in the graph.

While with the current implementation, it is possible to create
the links earlier, It doesn't make any sense to allow linking
two objects when they are not both created.

So, remove the code that would be handling those early-created
links and add a BUG_ON() to ensure that.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:46 -02:00
Javier Martinez Canillas ada58ced50 [media] smiapp: create pad links after subdev registration
The smiapp driver creates the pads links before the media entity is
registered with the media device. This doesn't work now that object
IDs are used to create links so the media_device has to be set.

Move entity registration logic before pads links creation.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:46 -02:00
Javier Martinez Canillas c5a98cac6e [media] uvcvideo: create pad links after subdev registration
The uvc driver creates the pads links before the media entity is
registered with the media device. This doesn't work now that obj
IDs are used to create links so the media_device has to be set.

Move entities registration logic before pads links creation.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:46 -02:00
Javier Martinez Canillas c7621b3044 [media] v4l: vsp1: separate links creation from entities init
The vsp1 driver initializes the entities and creates the pads links
before the entities are registered with the media device. This doesn't
work now that object IDs are used to create links so the media_device
has to be set.

Split out the pads links creation from the entity initialization so are
made after the entities registration.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:45 -02:00
Javier Martinez Canillas 7213fe7eec [media] v4l: vsp1: create pad links after subdev registration
The vsp1 driver creates the pads links before the media entities are
registered with the media device. This doesn't work now that object
IDs are used to create links so the media_device has to be set.

Move entities registration logic before pads links creation.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:45 -02:00
Javier Martinez Canillas 68a57fa93a [media] omap3isp: create links after all subdevs have been bound
The omap3isp driver parses the graph endpoints to know how many subdevices
needs to be registered async and register notifiers callbacks for to know
when these are bound and when the async registrations are completed.

Currently the entities pad are linked with the correct ISP input interface
when the subdevs are bound but it happens before entitities are registered
with the media device so that won't work now that the entity links list is
initialized on device registration.

So instead creating the pad links when the subdevice is bound, create them
on the complete callback once all the subdevices have been bound but only
try to create for the ones that have a bus configuration set during bound.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:44 -02:00
Javier Martinez Canillas f2f6da0d77 [media] omap3isp: separate links creation from entities init
The omap3isp driver initializes the entities and creates the pads links
before the entities are registered with the media device. This does not
work now that object IDs are used to create links so the media_device
has to be set.

Split out the pads links creation from the entity initialization so the links
are created after the entities have been registered with the media device.

Suggested-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:44 -02:00
Mauro Carvalho Chehab 27e543fa87 [media] media: add functions to allow creating interfaces
Interfaces are different than entities: they represent a
Kernel<->userspace interaction, while entities represent a
piece of hardware/firmware/software that executes a function.

Let's distinguish them by creating a separate structure to
store the interfaces.

Later patches should change the existing drivers and logic
to split the current interface embedded inside the entity
structure (device nodes) into a separate object of the graph.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:44 -02:00
Javier Martinez Canillas d10c98949d [media] media: use entity.graph_obj.mdev instead of .parent
The struct media_entity has a .parent field that stores a pointer
to the parent struct media_device. But recently a media_gobj was
embedded into the entities and since struct media_gojb already has
a pointer to a struct media_device in the .mdev field, the .parent
field becomes redundant and can be removed.

This patch replaces all the usage of .parent by .graph_obj.mdev so
that field will become unused and can be removed on a later patch.

No functional changes.

The transformation was made using the following coccinelle spatch:

@@
struct media_entity *me;
@@

- me->parent
+ me->graph_obj.mdev

@@
struct media_entity *link;
@@

- link->source->entity->parent
+ link->source->entity->graph_obj.mdev

@@
struct exynos_video_entity *ve;
@@

- ve->vdev.entity.parent
+ ve->vdev.entity.graph_obj.mdev

Suggested-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:43 -02:00
Mauro Carvalho Chehab 8df00a1581 [media] media: rename the function that create pad links
With the new API, a link can be either between two PADs or between an interface
and an entity. So, we need to use a better name for the function that create
links between two pads.

So, rename the such function to media_create_pad_link().

No functional changes.

This patch was created via this shell script:
	for i in $(find drivers/media -name '*.[ch]' -type f) $(find drivers/staging/media -name '*.[ch]' -type f) $(find include/ -name '*.h' -type f) ; do sed s,media_entity_create_link,media_create_pad_link,g <$i >a && mv a $i; done

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:43 -02:00
Mauro Carvalho Chehab 39a956c414 [media] media: add a debug message to warn about gobj creation/removal
It helps to check if the media controller is doing the
right thing with the object creation and removal.

No extra code/data will be produced if DEBUG or
CONFIG_DYNAMIC_DEBUG is not enabled.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:42 -02:00
Mauro Carvalho Chehab 8f5a3188fb [media] media: add messages when media device gets (un)registered
We can only free the media device after being sure that no
graph object is used.

In order to help tracking it, let's add debug messages
that will print when the media controller gets registered
or unregistered.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:42 -02:00
Mauro Carvalho Chehab 6b6a427805 [media] media: use media_gobj inside links
Just like entities and pads, links also need to have unique
Object IDs along a given media controller.

So, let's add a media_gobj inside it and initialize
the object then a new link is created.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:42 -02:00
Mauro Carvalho Chehab 18710dc67a [media] media: use media_gobj inside pads
PADs also need unique object IDs that won't conflict with
the entity object IDs.

The pad objects are currently created via media_entity_init()
and, once created, never change.

While this will likely change in the future in order to
support dynamic changes, for now we'll keep PADs as arrays
and initialize the media_gobj embedded structs when
registering the entity.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:42 -02:00
Mauro Carvalho Chehab bfab2aaccc [media] media: use media_gobj inside entities
As entities are graph objects, let's embed media_gobj
on it. That ensures an unique ID for entities that can be
global along the entire media controller.

For now, we'll keep the already existing entity ID. Such
field need to be dropped at some point, but for now, let's
not do this, to avoid needing to review all drivers and
the userspace apps.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:41 -02:00
Mauro Carvalho Chehab ec6e4c9506 [media] media: add a common struct to be embed on media graph objects
Due to the MC API proposed changes, we'll need to have an unique
object ID for all graph objects, and have some shared fields
that will be common on all media graph objects.

Right now, the only common object is the object ID, but other
fields will be added later on.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:41 -02:00
Javier Martinez Canillas e0077cfdee [media] omap3isp: get entity ID using media_entity_id()
Accessing media_entity ID should now use media_entity_id() macro to
obtain the entity ID, as a next patch will remove the .id field from
struct media_entity .

So, get rid of it, otherwise the omap3isp driver will fail to build.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:41 -02:00
Mauro Carvalho Chehab fa762394fd [media] media: create a macro to get entity ID
Instead of accessing directly entity.id, let's create a macro,
as this field will be moved into a common struct later on.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:40 -02:00
Mauro Carvalho Chehab 20fe0319de [media] au0828: Fix the logic that enables the analog demoder link
This logic was broken on the original patch, likely due to a
cut-and-paste mistake.

Fix it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:40 -02:00
Mauro Carvalho Chehab 21a0654200 [media] Kconfig: Re-enable Media controller support for DVB
This was depending on broken because we're working at the
Media Controller API, with has... issues.

As this got fixed, we can re-enable it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:40 -02:00
Mauro Carvalho Chehab 1809510715 [media] media: get rid of unused "extra_links" param on media_entity_init()
Currently, media_entity_init() creates an array with the links,
allocated at init time. It provides a parameter (extra_links)
that would allocate more links than the current needs, but this
is not used by any driver.

As we want to be able to do dynamic link allocation/removal,
we'll need to change the implementation of the links. So,
before doing that, let's first remove that extra unused
parameter, in order to cleanup the interface first.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:39 -02:00
Mauro Carvalho Chehab 0158e7b6a2 [media] au0828: Cache the decoder info at au0828 dev structure
Instead of seeking for the decoder every time analog stream is
started, cache it. This simplifies the code a little bit.

Requested-by: Hans Verkuil <hverkuil@xs4all.nl>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:39 -02:00
Rafael Lourenço de Lima Chehab bed6919665 [media] au0828: Add support for media controller
Add support for analog and dvb tv using media controller.

Signed-off-by: Rafael Lourenço de Lima Chehab <chehabrafael@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:39 -02:00
Shuah Khan e576d60bb2 [media] media: define Media Controller API when CONFIG_MEDIA_CONTROLLER enabled
Change to define Media Controller API when CONFIG_MEDIA_CONTROLLER
is enabled. Define stubs for CONFIG_MEDIA_CONTROLLER disabled case.
This will help avoid drivers needing to enclose Media Controller
code within ifdef CONFIG_MEDIA_CONTROLLER block.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:05:48 -02:00
Shuah Khan d062f91193 [media] media: new media controller API for device resource support
Add new media controller API to allocate media device as a
device resource. When a media device is created on the main
struct device which is the parent device for the interface
device, it will be available to all drivers associated with
that interface. For example, if a usb media device driver
creates the media device on the main struct device which is
common for all the drivers that control the media device,
including the non-media ALSA driver, media controller API
can be used to share access to the resources on the media
device. This new interface provides the above described
feature. A second interface that finds and returns the media
device is added to allow drivers to find the media device
created by any of the drivers associated with the device.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:05:48 -02:00
Mauro Carvalho Chehab c3152592e7 Merge branch 'patchwork' into v4l_for_linus
* patchwork: (204 commits)
  [media] rc: sunxi-cir: Initialize the spinlock properly
  [media] rtl2832: do not filter out slave TS null packets
  [media] rtl2832: print reg number on error case
  [media] rtl28xxu: return demod reg page from driver cache
  [media] coda: enable MPEG-2 ES decoding
  [media] coda: don't start streaming without queued buffers
  [media] coda: hook up vidioc_prepare_buf
  [media] coda: relax coda_jpeg_check_buffer for trailing bytes
  [media] coda: make to_coda_video_device static
  [media] s5p-mfc: remove volatile attribute from MFC register addresses
  [media] s5p-mfc: merge together s5p_mfc_hw_call and s5p_mfc_hw_call_void
  [media] s5p-mfc: use spinlock to protect MFC context
  [media] s5p-mfc: remove unnecessary callbacks
  [media] s5p-mfc: make queue cleanup code common
  [media] s5p-mfc: use one implementation of s5p_mfc_get_new_ctx
  [media] s5p-mfc: constify s5p_mfc_codec_ops structures
  [media] au8522: Avoid memory leak for device config data
  [media] ir-lirc-codec.c: don't leak lirc->drv-rbuf
  [media] uvcvideo: small cleanup in uvc_video_clock_update()
  [media] uvcvideo: Fix reading the current exposure value of UVC
  ...
2016-01-11 11:13:27 -02:00
Jacek Anaszewski fa1706c42e media: flash: use led_set_brightness_sync for torch brightness
LED subsystem shifted responsibility for choosing between SYNC or ASYNC
way of setting brightness from drivers to the caller. Adapt the wrapper
to those changes.

Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: linux-media@vger.kernel.org
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-04 09:57:31 +01:00
Tomi Valkeinen f3dab1e317 omapfb: take omapfb's private omapdss into use
omapfb's private copy of omapdss is now ready to be used.

This patch makes omapfb use its private omapdss and display drivers, and
also makes omap_vout (which uses omapfb) to depend on omapfb.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Dave Airlie <airlied@gmail.com>
Acked-by: Rob Clark <robdclark@gmail.com>
2015-12-29 11:07:47 +02:00
Chen-Yu Tsai 768acf46e1 [media] rc: sunxi-cir: Initialize the spinlock properly
The driver allocates the spinlock but fails to initialize it correctly.
The kernel reports a BUG indicating bad spinlock magic when spinlock
debugging is enabled.

Call spin_lock_init() on it to initialize it correctly.

Fixes: b4e3e59fb5 ("[media] rc: add sunxi-ir driver")

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-23 15:51:40 -02:00
Antti Palosaari 4020c18a94 [media] rtl2832: do not filter out slave TS null packets
Do not remove slave TS NULL padding PID (0x1fff) by default as
there is no real need. After that whole TS is passed to kernel sw
PID filter.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-23 14:12:31 -02:00
Antti Palosaari 891e055938 [media] rtl2832: print reg number on error case
It is hard to debug possible I2C failures without knowing the
possible register itself. Add register number to error printing.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-23 14:11:30 -02:00
Antti Palosaari 31d60f1bc5 [media] rtl28xxu: return demod reg page from driver cache
Return current active rtl2830/rtl2832 register page from the driver
cache in order to reduce I2C I/O. Register page is already cached
due to I2C write needs.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-23 14:11:02 -02:00
Philipp Zabel 95847f4010 [media] coda: enable MPEG-2 ES decoding
Hook up the MPEG-2 ES decoder.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-23 14:04:01 -02:00
Philipp Zabel 49b966fa45 [media] coda: don't start streaming without queued buffers
We could support start streaming with an empty output queue for the
BIT decoders due to the bitstream buffer which could still contain
data at this point, but there is really no reason for userspace to
expect this to work. Simplify the code by disallowing it.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-23 14:03:35 -02:00
Philipp Zabel bb757d7bd3 [media] coda: hook up vidioc_prepare_buf
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-23 14:02:38 -02:00
Philipp Zabel d4de047b53 [media] coda: relax coda_jpeg_check_buffer for trailing bytes
coda_jpeg_check_buffer only cares about the buffer length and contents,
so change the parameter type back from v4l2_vb2_buffer to just the
vb2_buffer.
Instead of just checking the first and last bytes for the SOI and EOI
markers, relax the EOI marker check a bit and allow up to 32 trailing
bytes after the EOI marker as hardware generated JPEGs sometimes contain
some alignment overhead.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-23 14:02:14 -02:00
Philipp Zabel 5542570ea9 [media] coda: make to_coda_video_device static
This function is not used outside coda-common.c.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-23 14:00:53 -02:00
Andrzej Hajda 54774f8600 [media] s5p-mfc: remove volatile attribute from MFC register addresses
MFC register addresses are used only by writel/readl macros which already
takes care of proper register accessing.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-23 14:00:22 -02:00
Andrzej Hajda fdd1d4b0a0 [media] s5p-mfc: merge together s5p_mfc_hw_call and s5p_mfc_hw_call_void
Both macros can be merged into one.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-23 13:59:46 -02:00
Andrzej Hajda 7969b12523 [media] s5p-mfc: use spinlock to protect MFC context
MFC driver uses dev->irqlock spinlock to protect queues only, but many context
fields require protection also - they can be accessed concurrently
from IOCTLs and IRQ handler. The patch increases protection range of irqlock
to those fields also.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-23 13:58:36 -02:00
Andrzej Hajda 8eceb9a007 [media] s5p-mfc: remove unnecessary callbacks
Many version specific functions are not called by common code, so there
is no need to use callbacks. Additionally some of them are not used at all,
so they can be safely removed.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-23 13:57:07 -02:00
Andrzej Hajda 62bbd72b09 [media] s5p-mfc: make queue cleanup code common
Code for queue cleanup has nothing specific to hardware version.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-23 13:56:14 -02:00
Andrzej Hajda 05d1d0f020 [media] s5p-mfc: use one implementation of s5p_mfc_get_new_ctx
Both version of MFC driver use functions with the same body and name.
The patch moves them to common location. It also simplifies it.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-23 13:54:22 -02:00
Julia Lawall 4e9691aa40 [media] s5p-mfc: constify s5p_mfc_codec_ops structures
The s5p_mfc_codec_ops structures are never modified, so declare them as
const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-23 13:52:30 -02:00
Mauro Carvalho Chehab aa37763fa4 [media] au8522: Avoid memory leak for device config data
As reported by kmemleak:

	unreferenced object 0xffff880321e1da40 (size 32):
	  comm "modprobe", pid 3309, jiffies 4295019569 (age 2359.636s)
	  hex dump (first 32 bytes):
	    47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  G...............
	    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
	  backtrace:
	    [<ffffffff82278c8e>] kmemleak_alloc+0x4e/0xb0
	    [<ffffffff8153c08c>] kmem_cache_alloc_trace+0x1ec/0x280
	    [<ffffffffa13a896a>] au8522_probe+0x19a/0xa30 [au8522_decoder]
	    [<ffffffff81de0032>] i2c_device_probe+0x2b2/0x490
	    [<ffffffff81ca7004>] driver_probe_device+0x454/0xd90
	    [<ffffffff81ca7c1b>] __device_attach_driver+0x17b/0x230
	    [<ffffffff81ca15da>] bus_for_each_drv+0x11a/0x1b0
	    [<ffffffff81ca6a4d>] __device_attach+0x1cd/0x2c0
	    [<ffffffff81ca7d43>] device_initial_probe+0x13/0x20
	    [<ffffffff81ca451f>] bus_probe_device+0x1af/0x250
	    [<ffffffff81c9e0f3>] device_add+0x943/0x13b0
	    [<ffffffff81c9eb7a>] device_register+0x1a/0x20
	    [<ffffffff81de8626>] i2c_new_device+0x5d6/0x8f0
	    [<ffffffffa0d88ea4>] v4l2_i2c_new_subdev_board+0x1e4/0x250 [v4l2_common]
	    [<ffffffffa0d88fe7>] v4l2_i2c_new_subdev+0xd7/0x110 [v4l2_common]
	    [<ffffffffa13b2f76>] au0828_card_analog_fe_setup+0x2e6/0x3f0 [au0828]

Checking where the error happens:
	(gdb) list *au8522_probe+0x19a
	0x99a is in au8522_probe (drivers/media/dvb-frontends/au8522_decoder.c:761).
	756			printk(KERN_INFO "au8522_decoder attach existing instance.\n");
	757			break;
	758		}
	759
	760		demod_config = kzalloc(sizeof(struct au8522_config), GFP_KERNEL);
	761		if (demod_config == NULL) {
	762			if (instance == 1)
	763				kfree(state);
	764			return -ENOMEM;
	765		}

Shows that the error path is not being handled properly.

The are actually several issues here:

1) config free should have been calling hybrid_tuner_release_state()
function, by calling au8522_release_state();

2) config is only allocated at the digital part. On the analog one,
it is received from the caller.

A complex logic could be added to address it, however, it is simpler
to just embeed config inside the state.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-21 17:39:32 -02:00
Mauro Carvalho Chehab c77adf214b [media] ir-lirc-codec.c: don't leak lirc->drv-rbuf
As reported by kmemleak:

	unreferenced object 0xffff8802adae0ba0 (size 192):
	  comm "modprobe", pid 3024, jiffies 4296503588 (age 324.368s)
	  hex dump (first 32 bytes):
	    00 00 00 00 ad 4e ad de ff ff ff ff 00 00 00 00  .....N..........
	    ff ff ff ff ff ff ff ff c0 48 25 a0 ff ff ff ff  .........H%.....
	  backtrace:
	    [<ffffffff82278c8e>] kmemleak_alloc+0x4e/0xb0
	    [<ffffffff8153c08c>] kmem_cache_alloc_trace+0x1ec/0x280
	    [<ffffffffa0250f0d>] ir_lirc_register+0x8d/0x7a0 [ir_lirc_codec]
	    [<ffffffffa07372b8>] ir_raw_event_register+0x318/0x4b0 [rc_core]
	    [<ffffffffa07351ed>] rc_register_device+0xf2d/0x1450 [rc_core]
	    [<ffffffffa13c5451>] au0828_rc_register+0x7d1/0xa10 [au0828]
	    [<ffffffffa13b0dc2>] au0828_usb_probe+0x6c2/0xcf0 [au0828]
	    [<ffffffff81d7619d>] usb_probe_interface+0x45d/0x940
	    [<ffffffff81ca7004>] driver_probe_device+0x454/0xd90
	    [<ffffffff81ca7a61>] __driver_attach+0x121/0x160
	    [<ffffffff81ca141f>] bus_for_each_dev+0x11f/0x1a0
	    [<ffffffff81ca5d4d>] driver_attach+0x3d/0x50
	    [<ffffffff81ca5039>] bus_add_driver+0x4c9/0x770
	    [<ffffffff81ca944c>] driver_register+0x18c/0x3b0
	    [<ffffffff81d71e58>] usb_register_driver+0x1f8/0x440
	    [<ffffffffa13680b7>] 0xffffffffa13680b7

	0xf3d is in ir_lirc_register (drivers/media/rc/ir-lirc-codec.c:348).
	343		drv = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL);
	344		if (!drv)
	345			return rc;
	346
	347		rbuf = kzalloc(sizeof(struct lirc_buffer), GFP_KERNEL);
	348		if (!rbuf)
	349			goto rbuf_alloc_failed;
	350
	351		rc = lirc_buffer_init(rbuf, sizeof(int), LIRCBUF_SIZE);
	352		if (rc)

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-21 14:59:36 -02:00
Linus Walleij 0529357f10 Linux 4.4-rc6
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJWd0J7AAoJEHm+PkMAQRiGm+cIAIWUlh9PQY5nH2C8Jta4HyTq
 u/MNLCoKM1LUjG7ZBryFxFG3X6BBMpfzUF011Nv5XC7oQj845dYxWK6f+lIKTq6N
 8KsQkVrSv5SJ48o5Vj/ZTTrNt4rN54l0Camuwk8YXdtq6r6FSGzEkn33PQvQArAz
 z3Jln+dZod7NE7QhQqZHbTKvQTNuG0dkV/sEHHW4OoMo5Ag4KutZtlheQc9XdM9F
 jz0uEu4Nc3yHQM+DpuQ5qp3wSsUXoqcYRbsdpxwdeGgWXPqbkNBVgwlr68RsjQ0g
 HqIn2Bln7mJvJ7iZCWvniMHVrYHOPKceHjOsYgXRDUEav/2mA7Dyjj6ttbmNuOg=
 =5AQv
 -----END PGP SIGNATURE-----

Merge tag 'v4.4-rc6' into devel

Linux 4.4-rc6
2015-12-21 09:36:21 +01:00
Linus Torvalds 76b8ebdc4c media fixes for v4.4-rc6
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWdEIhAAoJEAhfPr2O5OEV+AMP/16Z0z2CTNf+75XmyZpJQyg6
 z+K2gfziU/LdRfxN40cDtpBkQf6eSH4MHFhPq0bHUg7yQJinRxJZBJsYZlh6w1K0
 714oj5A6QIxdWBUOKMvdHv8j033XB7BYCAOL8eUCebbQ3fvGXPp5bCZZHV/Cxc0c
 veEhVIMD1EMaJHIWSIAZvQ0ixY5d3c5YrWhJItlsHkwvl8R6vLlSnVTUYGeORN5h
 P40fS0X2v2w7rhOlGE8pN/3GAYfY3fRy94SBaG6xnOgdvKV/mbw424xkpB+vJ3IQ
 qHKrVuZVT0dysNXMpOkdfjy1SpJ3iF/scmqSr+OeB/hENrzMs5bgOynmc/ldGkR4
 FD3HFZ/3FkpIjtQ0ec9kexFdGF86YzEf6ujr3aX2l8/l75I8APHjt7P80lv6sabr
 jiPSil0d4g1zd/3UGAeUr+HbiWIP+tDSaJkGUFo5wZz8Q0oHXbTBou4BI11cO2wn
 CFnPG8PWHE/YVLhkUAz/gkkUnRAqLCi6fWOTwz7oSdxr8Hp85TtG9v47WlZrVM66
 StTn8Y7U6FcBC5EU2RL4WWMavOfJOWi7GLp6c+OKcYpL0XI6BG0ViM48pgqgo4I/
 Z3p/uN8frZ/VFy628DZUpHs0kZNkvuwPfW9GSrkX1EGGIn/2CpFzJLCt4r5Bi3NY
 5GyJisSX1SSaj/25uPtk
 =81gm
 -----END PGP SIGNATURE-----

Merge tag 'media/v4.4-3' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull media fixes from Mauro Carvalho Chehab.

* tag 'media/v4.4-3' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
  [media] airspy: increase USB control message buffer size
  [media] hackrf: move RF gain ctrl enable behind module parameter
  [media] hackrf: fix possible null ptr on debug printing
  [media] Revert "[media] ivtv: avoid going past input/audio array"
2015-12-18 15:41:35 -08:00
Antti Palosaari aa0850e1d5 [media] airspy: increase USB control message buffer size
Driver requested device firmware version string during probe using
only 24 byte long buffer. That buffer is too small for newer firmware
versions, which causes device firmware hang - device stops responding
to any commands after that. Increase buffer size to 128 which should
be enough for any current and future version strings.

Link: https://github.com/airspy/host/issues/27

Cc: <stable@vger.kernel.org> # 3.17+
Reported-by: Benjamin Vernoux <bvernoux@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 15:25:29 -02:00
Antti Palosaari d47fa5315c [media] hackrf: move RF gain ctrl enable behind module parameter
Used Avago MGA-81563 RF amplifier could be destroyed pretty easily
with too strong signal or transmitting to bad antenna.
Add module parameter 'enable_rf_gain_ctrl' which allows enabling
RF gain control - otherwise, default without the module parameter,
RF gain control is set to 'grabbed' state which prevents setting
value to the control.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 15:25:29 -02:00
Antti Palosaari eb35cf47c3 [media] hackrf: fix possible null ptr on debug printing
drivers/media/usb/hackrf/hackrf.c:1533 hackrf_probe()
error: we previously assumed 'dev' could be null (see line 1366)

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 15:25:29 -02:00
Mauro Carvalho Chehab dfcf36d904 [media] Revert "[media] ivtv: avoid going past input/audio array"
This patch broke ivtv logic, as reported at
 https://bugzilla.redhat.com/show_bug.cgi?id=1278942

This reverts commit 09290cc885.

Cc: stable@vger.kernel.org # for v4.1 and upper
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 15:25:29 -02:00
Dan Carpenter 0aff8a894a [media] uvcvideo: small cleanup in uvc_video_clock_update()
Smatch is not smart enough to see that "&stream->clock.lock" and
"&clock->lock" are the same thing so it complains about the locking
here.  Let's make it more consistent.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 15:21:35 -02:00
Anton V. Shokurov 1ab8c3fc75 [media] uvcvideo: Fix reading the current exposure value of UVC
V4L2_CID_EXPOSURE_ABSOLUTE property does not return an updated value when
autoexposure (V4L2_CID_EXPOSURE_AUTO) is turned on. This patch fixes this
issue by adding the UVC_CTRL_FLAG_AUTO_UPDATE flag.

Tested on a C920 camera.

Signed-off-by: Anton V. Shokurov <shokurov.anton.v@yandex.ru>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 15:21:34 -02:00
Mauro Carvalho Chehab f0b0faff78 [media] cx23885-dvb: move initialization of a8293_pdata
Smatch complains about where the au8293_data is placed:

drivers/media/pci/cx23885/cx23885-dvb.c:2174 dvb_register() info: 'a8293_pdata' is not actually initialized (unreached code).

It is not actually expected to have such initialization at

switch {
	foo = bar;

	case:
...
}

Not really sure how gcc does that, but this is something that I would
expect that different compilers would do different things.

David Howells checked with the compiler people: it's not really expected to
initialise as expected.

So, move the initialization outside the switch(), making smatch to
shut up one warning.

Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 15:20:44 -02:00
Mauro Carvalho Chehab aee5f29e5a [media] cx23885-dvb: initialize a8293_pdata
As reported by smatch:
	drivers/media/pci/cx23885/cx23885-dvb.c:2174 dvb_register() info: 'a8293_pdata' is not actually initialized (unreached code).

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 14:15:56 -02:00
Mauro Carvalho Chehab b62ef37c6e [media] videobuf2: avoid memory leak on errors
As reported by smatch:
	drivers/media/v4l2-core/videobuf2-core.c:2415 __vb2_init_fileio() warn: possible memory leak of 'fileio'

While here, avoid the usage of sizeof(struct foo_struct).

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 14:13:38 -02:00
Hans Verkuil 58e1ba3ce6 [media] videobuf2-core: fix plane_sizes handling in VIDIOC_CREATE_BUFS
The handling of q->plane_sizes was wrong in vb2_core_create_bufs().
The q->plane_sizes array was global and it was overwritten by create_bufs.
So if reqbufs was called with e.g. size 100000 then q->plane_sizes[0] would
be set to 100000. If create_bufs was called afterwards with size 200000,
then q->plane_sizes[0] would be overwritten with the new value. Calling
create_bufs again for size 100000 would cause an error since 100000 is now
less than q->plane_sizes[0].

This patch fixes this problem by 1) removing q->plane_sizes and using the
vb->planes[].length field instead, and 2) by introducing a min_length field
in struct vb2_plane. This field is set to the plane size as returned by
the queue_setup op and is the minimum required plane size. So user pointers
or dmabufs should all be at least this size.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 14:05:58 -02:00
Hans Verkuil 20eedf0e16 [media] videobuf2-core: call __setup_offsets before buf_init()
Ensure that the offsets are correct before buf_init() is called.
As a consequence the __setup_offsets() function now sets up the
offsets for the given buffer instead of for all new buffers.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 14:04:29 -02:00
Hans Verkuil e32f856ab2 [media] videobuf2-core: fill in q->bufs[vb->index] before buf_init()
Fill in q->bufs[vb->index] before the call to buf_init: it makes
sense that this is initialized correctly.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 14:03:54 -02:00
Hans Verkuil 489648afcd [media] videobuf2-core: move __setup_lengths into __vb2_queue_alloc()
Rather than setting up the lengths at the end, set them up when
the vb2_buffer is allocated. This also ensures that buf_init()
sees the right length values.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 14:03:00 -02:00
Hans Verkuil 10cc3b1e12 [media] videobuf2-core: fill_user_buffer and copy_timestamp should return void
This ops can never fail, so make these void functions.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 14:00:50 -02:00
Hans Verkuil df868ea1c8 [media] videobuf2-core.c: update module description
This module is no longer V4L2 specific, so update the module description
accordingly.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 13:58:27 -02:00
Junghak Sung af3bac1a7c [media] media: videobuf2: Move vb2_fileio_data and vb2_thread to core part
Move things related with vb2 file I/O and vb2_thread without doing any
functional changes. After that, videobuf2-internal.h is removed because
it is not necessary any more.

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 13:58:09 -02:00
Junghak Sung 70433a152f [media] media: videobuf2: Refactor vb2_fileio_data and vb2_thread
Replace v4l2-stuffs with common things in struct vb2_fileio_data and
vb2_thread().

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 13:56:34 -02:00
Junghak Sung dcbc216d33 [media] media: videobuf2: last_buffer_queued is set at fill_v4l2_buffer()
The location in which last_buffer_queued is set is moved to fill_v4l2_buffer().
So, __vb2_perform_fileio() can use vb2_core_dqbuf() instead of
vb2_internal_dqbuf().

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 13:55:35 -02:00
Junghak Sung 49d8ab9fea [media] media: videobuf2: Separate vb2_poll()
Separate vb2_poll() into core and v4l2 part.

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 13:55:03 -02:00
Junghak Sung 959c3ef336 [media] media: videobuf2: Add copy_timestamp to struct vb2_queue
Add copy_timestamp to struct vb2_queue as a flag set if vb2-core should
copy timestamps.

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 13:54:33 -02:00
Junghak Sung d6dd645eae [media] media: videobuf2: Move timestamp to vb2_buffer
Move timestamp from struct vb2_v4l2_buffer to struct vb2_buffer
for common use, and change its type to u64 in order to handling
y2038 problem. This patch also includes all device drivers' changes related to
this restructuring.

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 13:53:31 -02:00
Hans Verkuil 9057bc2b35 [media] solo6x10: use v4l2_get_timestamp to fill in buffer timestamp
The timestamp of a v4l2_buffer was advertised as being CLOCK_MONOTONIC,
but instead a timestamp from a header field was used. This is inconsistent
and not what applications expect. Use v4l2_get_timestamp to properly
set the timestamp.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 13:49:47 -02:00
Hans Verkuil df9ecb0cad [media] vb2: drop v4l2_format argument from queue_setup
The queue_setup callback has a void pointer that is just for V4L2
and is the pointer to the v4l2_format struct that was passed to
VIDIOC_CREATE_BUFS. The idea was that drivers would use the information
from that struct to buffers suitable for the requested format.

After the vb2 split series this pointer is now a void pointer,
which is ugly, and the reality is that all existing drivers will
effectively just look at the sizeimage field of v4l2_format.

To make this more generic the queue_setup callback is changed:
the void pointer is dropped, instead if the *num_planes argument
is 0, then use the current format size, if it is non-zero, then
it contains the number of requested planes and the sizes array
contains the requested sizes. If either is unsupported, then return
-EINVAL, otherwise use the requested size(s).

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 13:48:19 -02:00
Hans Verkuil ecc2fe20e6 [media] cx23885: video instead of vbi register used
The VID_A_GPCNT register is for video, not vbi. Read from the right
register and don't write to the video register.

Based upon Devin's initial patch made for an older kernel which I
cleaned up and rebased. Thanks to Kernel Labs for that work.

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 13:37:12 -02:00
Hans Verkuil 6c43a2178e [media] cx23885: add support for ViewCast 260e and 460e
Add support for these two new cards.

Based upon Devin's initial patch made for an older kernel which I
cleaned up and rebased. Thanks to Kernel Labs for that work.

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 13:36:43 -02:00
Hans Verkuil fc279cc288 [media] cs3308: add new 8-channel volume control driver
Add simple support for this 8 channel volume control driver.
Currently all it does is to unmute all 8 channels.

Based upon Devin's initial patch made for an older kernel which I
cleaned up and rebased. Thanks to Kernel Labs for that work.

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 13:35:51 -02:00
Hans Verkuil bfd1bbfb54 [media] cx25840: initialize the standard to NTSC_M
This is necessary since the *_std_setup functions rely on a valid state->std
field.

Also fix the cx23888_std_setup() to test for 60Hz instead of NTSC, just like
cx25840_std_setup() does.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 13:35:01 -02:00
Hans Verkuil e69d89420e [media] cx25840: fix cx25840_s_stream for cx2388x and cx231xx
For those two devices the code wrote to addresses 0x115/6, but on
those devices those addresses have nothing to do with power controls.
So clearly this never worked. Rather than writing to bogus addresses,
just do nothing for the cx2388x and cx231xx.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 13:34:32 -02:00
Hans Verkuil 499ebed3ec [media] cx25840: relax a Vsrc check
The cx23888 reports a slightly different Vsrc value than the other
chip variants do. Relax the check by 1, otherwise cx25840_set_fmt()
would fail for the cx23888.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 13:33:22 -02:00
Hans Verkuil ee61cd9f12 [media] cx25840: more cx23888 register address changes
The cx23888 also moves the following registers around:

!cx23888	cx23888
--------	-------
0x418, 0x41c	0x434, 0x438
0x420		0x418 (expect for bit 29 which has a different meaning)
0x478		0x454

Also drop the set_input code where the scaler is changed: this does not
belong here, changing the input should not change the scaler.

And that's besides the fact that that code is plain wrong.

After this change the cx23888 behaves much better. In particular, calling
set_input no longer changes the saturation to 0, causing a grayscale
image.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 13:32:55 -02:00
Hans Verkuil cdf472d32a [media] cx25840: fix VBI support for cx23888
The cx23888 has the VBI registers at different addresses compared to
the other variants. In most cases it is a fixed offset, but not always.

Update the code so the right registers are written for the cx23888.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 13:31:24 -02:00
Hans Verkuil 80954cbbe4 [media] ivtv/cx18: fix inverted pixel aspect ratio
These two drivers reported the pixel aspect ratio the wrong way around.
This caused qv4l2 to scale the image incorrectly.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 13:30:18 -02:00
Hans Verkuil e25cb20013 [media] cx231xx: fix NTSC cropcap, add missing cropcap for 417
The pixelaspect ratio was set incorrectly for 60Hz formats.
And since cropcap wasn't implemented at all for the -417 (compressed
video) the pixelaspect was unknown for compressed video.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 13:29:49 -02:00
Hans Verkuil e80bf856af [media] cx23885: fix format/crop handling
While testing the cx23885 driver with various TV standards I found
a number of bugs:

1) norm_maxw() returned 768 instead of 720 for PAL formats. This should
   always be 720, so drop this inline function and just always use 720.
2) cropcap() was missing, so the pixelaspect was never known and qv4l2 would
   scale the image incorrectly. Add cropcap support.
3) cx23885_set_tvnorm() should just return 0 if the same standard was
   set again. If another standard is set, then reset the width/height and
   call set_fmt for the subdevs.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18 13:29:13 -02:00
Mauro Carvalho Chehab 52d60eb7e6 Revert "[media] UVC: Add support for ds4 depth camera"
This reverts commit 120c41d347.

The patch doesn't add the corresponding documentation bits to the
media infrastructure uAPI DocBook. Also, they're for 3D formats,
with requre further discussions.

Requested-by: Hans Verkuil <hverkuil@xs4all.nl>
Requested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-12-12 08:10:40 -02:00
Masanari Iida e3d132d123 treewide: Fix typos in printk
This patch fix multiple spelling typos found in
various part of kernel.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2015-12-08 14:59:19 +01:00
Mauro Carvalho Chehab 991ce92f8d [media] use https://linuxtv.org for LinuxTV URLs
While https was always supported on linuxtv.org, only in
Dec 3 2015 the website is using valid certificates.

As we're planning to drop pure http support on some
future, change all references at the media subsystem
to point to the https URL instead.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-04 10:38:59 -02:00
Matthias Schwarzott b046d3ad38 [media] tda10071: Fix dependency to REGMAP_I2C
Without I get this error for by dvb-card:
  tda10071: Unknown symbol devm_regmap_init_i2c (err 0)
  cx23885_dvb_register() dvb_register failed err = -22
  cx23885_dev_setup() Failed to register dvb adapters on VID_B

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-03 15:27:39 -02:00
Lars-Peter Clausen f7488c50f3 [media] dm1105: Remove unnecessary synchronize_irq() before free_irq()
Calling synchronize_irq() right before free_irq() is quite useless. On one
hand the IRQ can easily fire again before free_irq() is entered, on the
other hand free_irq() itself calls synchronize_irq() internally (in a race
condition free way), before any state associated with the IRQ is freed.

Patch was generated using the following semantic patch:
// <smpl>
@@
expression irq;
@@
-synchronize_irq(irq);
 free_irq(irq, ...);
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-03 15:09:28 -02:00
Heiner Kallweit c1500ba0b6 [media] media: rc: remove unneeded code
Now that that the decoder modules are loaded on-demand we can move
loading the lirc module to rc_register_device directly and remove
unneeded functions and comments.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
2015-12-03 15:01:11 -02:00
Matthias Schwarzott 94c1733468 [media] si2165: Add DVB-C support for HVR-4400/HVR-5500
It works only for HVR-4400/HVR-5500.
For WinTV-HVR-930C-HD it fails with bad/no reception
for unknown reasons.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-03 12:21:27 -02:00
Matthias Schwarzott 3b0c9807b7 [media] si2165: Prepare si2165_set_frontend() for future DVB-C support
The current si2165_set_frontend() function actually works only for DVB-T.
Split it into two functions, preparing the code to support DVB-C.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-03 12:19:57 -02:00
Matthias Schwarzott 25e7375309 [media] si2165: set list of DVB-T registers together
Use si2165_write_reg_list() to do the DVB-T mode initialization altogether.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-03 12:17:07 -02:00
Matthias Schwarzott 542fb3c56b [media] si2165: Simplify si2165_set_if_freq_shift usage
si2165_set_if_freq_shift() needs to call get_if_frequency() in order to do
the right shift. Add such logic inside the function, simplifying the logic
for the callers.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-03 12:10:12 -02:00
Matthias Schwarzott 75d62fc046 [media] si2165: move setting ts config to init
The TS config is fixed, so no need to write it for each tune.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-03 12:07:03 -02:00
Matthias Schwarzott eae56684a0 [media] si2165: only write agc registers after reset before start_syncro
Datasheet says they must be rewritten after reset.
But it only makes sense to write them when trying to tune afterwards.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-03 12:06:16 -02:00
Matthias Schwarzott a5293dbd70 [media] si2165: create function si2165_write_reg_list for writing register lists
It is common the need of writing a table of values. Add a function to provide a
helper to address such case. This will allow further code cleanups.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-03 12:03:23 -02:00
Matthias Schwarzott c1c49674ea [media] si2165: rename si2165_set_parameters to si2165_set_frontend
No functional changes.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-03 12:01:31 -02:00
Matthias Schwarzott d9a201df56 [media] si2165: rename frontend -> fe
No functional changes.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-03 12:00:54 -02:00
Aviv Greenberg 120c41d347 [media] UVC: Add support for ds4 depth camera
Add support for Intel DS4 depth camera in uvc driver.
This includes adding new uvc GUIDs for the new pixel formats,
adding new V4L pixel format definition to user api headers,
and updating the uvc driver GUID-to-4cc tables with the new formats.

Change-Id: If240d95a7d4edc8dcc3e02d58cd8267a6bbf6fcb

Tested-by: Greenberg, Aviv D <aviv.d.greenberg@intel.com>
Signed-off-by: Aviv Greenberg <aviv.d.greenberg@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-03 11:37:44 -02:00
Julia Lawall 083206fc3f [media] cx231xx: constify cx2341x_handler_ops structures
The cx2341x_handler_ops structures are never modified, so declare them as
const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-03 11:27:08 -02:00
Julia Lawall 22dbec265c [media] media, sound: tea575x: constify snd_tea575x_ops structures
The snd_tea575x_ops structures are never modified, so declare them as
const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-03 11:26:45 -02:00
Hans Verkuil 85f9e06c59 [media] v4l2-dv-timings: add new arg to v4l2_match_dv_timings
Add the new match_reduced_fps argument to v4l2_match_dv_timings().
Depending on the situation you may or may not desire to match the
reduced_fps flag. Typically only HDMI transmitters will need to
check for this flag.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-03 11:26:14 -02:00
Mauro Carvalho Chehab 10897dacea Linux 4.4-rc2
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJWUmHZAAoJEHm+PkMAQRiGHtcH/RVRsn8re0WdRWYaTr9+Hknm
 CGlRJN4LKecttgYQ/2bS1QsDbt8usDPBiiYVopqGXQxPBmjyDAqPjsa+8VzCaVc6
 WA+9LDB+PcW28lD6BO+qSZCOAm7hHSZq7dtw9x658IqO+mI2mVeCybsAyunw2iWi
 Kf5q90wq6tIBXuT8YH9MXGrSCQw00NclbYeYwB9CmCt9hT/koEFBdl7uFUFitB+Q
 GSPTz5fXhgc5Lms85n7flZlrVKoQKmtDQe4/DvKZm+SjsATHU9ru89OxDBdS5gSG
 YcEIM4zc9tMjhs3GC9t6WXf6iFOdctum8HOhUoIN/+LVfeOMRRwAhRVqtGJ//Xw=
 =DCUg
 -----END PGP SIGNATURE-----

Merge tag 'v4.4-rc2' into patchwork

Linux 4.4-rc2

Several PCI media drivers got broken on Kernel 4.4-rc1, due to
pci_set_dma_mask() regressions. So, we need to add those fixes back
for the media drivers to work again.

* tag 'v4.4-rc2': (335 commits)
  Linux 4.4-rc2
  slab/slub: adjust kmem_cache_alloc_bulk API
  slub: add missing kmem cgroup support to kmem_cache_free_bulk
  slub: fix kmem cgroup bug in kmem_cache_alloc_bulk
  slub: optimize bulk slowpath free by detached freelist
  slub: support for bulk free with SLUB freelists
  parisc: Map kernel text and data on huge pages
  parisc: Add Huge Page and HUGETLBFS support
  parisc: Use long branch to do_syscall_trace_exit
  parisc: Increase initial kernel mapping to 32MB on 64bit kernel
  parisc: Initialize the fault vector earlier in the boot process.
  parisc: Add defines for Huge page support
  parisc: Drop unused MADV_xxxK_PAGES flags from asm/mman.h
  serial: export fsl8250_handle_irq
  serial: 8250_mid: Add missing dependency
  tty: audit: Fix audit source
  serial: etraxfs-uart: Fix crash
  serial: fsl_lpuart: Fix earlycon support
  bcm63xx_uart: Use the device name when registering an interrupt
  tty: Fix direct use of tty buffer work
  ...
2015-11-23 14:16:58 -02:00
Christoph Hellwig 1a47de6e4a various: fix pci_set_dma_mask return value checking
pci_set_dma_mask returns a negative errno value, not a bool like
pci_dma_supported.  This of course was just a giant test for attention :)

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reported-by: Jongman Heo <jongman.heo@samsung.com>
Tested-by: Jongman Heo <jongman.heo@samsung.com>	[pcnet32]
Acked-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Antti Palosaari <crope@iki.fi>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-11-20 16:17:32 -08:00
Arnd Bergmann ca78946853 [media] davinci: add i2c Kconfig dependencies
All the davinci media drivers are using the i2c framework, and
fail to build if that is ever disabled, e.g.:

media/platform/davinci/vpif_display.c: In function 'vpif_probe':
media/platform/davinci/vpif_display.c:1298:14: error: implicit declaration of function 'i2c_get_adapter' [-Werror=implicit-function-declaration]

This adds explicit Kconfig dependencies so we don't see the
driver options if I2C is turned off.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 12:03:52 -02:00
Mauro Carvalho Chehab a733a41a50 [media] fix dvb_frontend_sleep_until() logic
As pointed by Laurent Navet:
	"Calling ktime_add_us() seems useless as is only useful
	 for it's return value which is ignored."

That's reported by coverity CID 1309761.

Laurent proposed to just remove ktime_add_us, but the fact is that
the logic of this function is broken. Instead, we need to use the
value of the timeout, and ensure that it will work on the loops
to emulate the legacy DiSEqC ioctl (FE_DISHNETWORK_SEND_LEGACY_CMD).

Please notice that the logic was also broken if, for any reason,
msleep() would sleep a little less than what it was expected, as
newdelta would be smaller than delta, and udelay() would not be called.

It should also be noticed that nobody noticed that trouble before
likely because the FE_DISHNETWORK_SEND_LEGACY_CMD is not used
anymore by modern DVB applications.

Reported-by: Laurent Navet <laurent.navet@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 11:57:08 -02:00
Heiner Kallweit 439be34800 [media] media: cx23885: fix type of allowed_protos
Protocol lists are represented as 64-bit bitmaps,
therefore use u64 instead of unsigned long.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 11:54:21 -02:00
Mauro Carvalho Chehab 850c8a7d68 smsir.h: remove a now duplicated definition (IR_DEFAULT_TIMEOUT)
This macro is now part of the core. Remove from Siano driver.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 11:41:36 -02:00
Heiner Kallweit d80ca8bd71 [media] media: rc: move check whether a protocol is enabled to the core
Checking whether a protocol is enabled and calling the related decoder
functions should be done by the rc core, not the protocol handlers.

Properly handle lirc considering that no protocol bit is set for lirc.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 11:39:17 -02:00
Heiner Kallweit acc1c3c688 [media] media: rc: load decoder modules on-demand
Remove code for unconditional decoder module loading (except lirc).

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 11:38:41 -02:00
Heiner Kallweit 53df877717 [media] media: rc: constify struct proto_names
Declare struct proto_names and its member name as const.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 11:38:14 -02:00
Heiner Kallweit 9f0bf366d7 [media] media: rc: preparation for on-demand decoder module loading
Prepare on-demand decoder module loading by adding a module_name member
to struct proto_names and introducing the related load function.

After this patch of the series the decoder modules are still loaded
unconditionally.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 11:37:40 -02:00
Heiner Kallweit 93cffffc18 [media] media: rc: fix decoder module unloading
Currently, if a decoder module is unloadad, the respective protocol
is still shown as enabled (if it was enabled before).
Fix this by resetting the respective protocol bits if a decoder
module is unloaded.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 11:36:29 -02:00
Vladis Dronov fa52bd506f [media] usbvision: fix crash on detecting device with invalid configuration
The usbvision driver crashes when a specially crafted usb device with invalid
number of interfaces or endpoints is detected. This fix adds checks that the
device has proper configuration expected by the driver.

Reported-by: Ralf Spenneberg <ralf@spenneberg.net>
Signed-off-by: Vladis Dronov <vdronov@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 11:36:02 -02:00
Arno Bauernöppel 1efc21701d [media] Add support for dvb usb stick Hauppauge WinTV-soloHD
This patch adds support for the DVB-T/C/T2 usb stick WinTV-soloHD from
Hauppauge. It adds the usb ID 2040:0264 Hauppauge to the cards of the
driver em28xx.

I successfully tested DVB-T/C and the IR remote control with the
firmware dvb-demod-si2168-b40-01.fw.

Signed-off-by: Arno Bauernoeppel <arno@aziraphale.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 11:34:32 -02:00
Matthias Schwarzott 18349f4009 [media] si2165: fix checkpatch issues
Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 11:23:42 -02:00
Matthias Schwarzott 599bedb7d1 [media] cx231xx_dvb: use demod_i2c for demod attach
Tested:
* CX231XX_BOARD_HAUPPAUGE_930C_HD_1113xx
* CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx

Not Tested:
* CX231XX_BOARD_HAUPPAUGE_EXETER
* CX231XX_BOARD_HAUPPAUGE_955Q

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 11:23:06 -02:00
Julia Lawall 9bca62661e [media] ttusb-dec: constify ttusbdecfe_config structure
The ttusbdecfe_config structure is never modified, so declare it
as const.

Other references to this structure type were already declared as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 11:22:15 -02:00
Julia Lawall 9c5e44a076 [media] drivers/media/usb/dvb-usb-v2: constify mxl111sf_demod_config structure
The mxl111sf_demod_config structure is never modified, so declare it
as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 11:20:18 -02:00
Walter Cheuk c0a182b699 [media] tv tuner max2165 driver: extend frequency range
Extend the frequency range to cover Hong Kong's digital TV broadcasting;
RTHK TV uses 802MHz and is not covered now. Tested on my TV tuner card
"MyGica X8558 Pro".

Signed-off-by: Walter Cheuk <wwycheuk@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 11:19:42 -02:00
Laurent Pinchart b446631c5a [media] v4l: omap_vout: Don't free buffers if they haven't been allocated
The VRFB buffers are freed when the device is closed even if they
haven't been allocated by a call to VIDIOC_REQBUFS, resulting in a
crash. Fix it by not trying to free buffers that are not allocated.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 11:15:20 -02:00
Laurent Pinchart 8afe97be37 [media] uvcvideo: Enable UVC 1.5 device detection
UVC 1.5 devices report a bInterfaceProtocol value set to 1 in their
interface descriptors. The uvcvideo driver only matches on
bInterfaceProtocol 0, preventing those devices from being detected.

More changes to the driver are needed for full UVC 1.5 compatibility.
However, at least the UVC 1.5 Microsoft Surface Pro 3 cameras have been
reported to work out of the box with the driver with an updated match
table.

Enable UVC 1.5 support in the match table to support the devices that
can work with the current driver implementation. Devices that can't will
fail, but that's hardly a regression as they're currently not detected
at all anyway.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 11:13:19 -02:00
Markus Elfring 1ea7252d97 [media] c8sectpfe: Combine three checks into a single if block
The variable "tsin" was checked three times in a loop iteration of the
c8sectpfe_tuner_unregister_frontend() function.
This implementation detail could be improved by the combination of the
involved statements into a single if block so that this variable will be
checked only once there.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 10:10:22 -02:00
Markus Elfring 06b6fea859 [media] c8sectpfe: Delete unnecessary checks before two function calls
The functions i2c_put_adapter() and module_put() test whether their
argument is NULL and then return immediately.
Thus the tests around their calls are not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 10:09:56 -02:00
Heiner Kallweit 4dc0e908a5 [media] media: rc-core: simplify logging in rc_register_device
Simplify the logging.

I had some doubts about using the elvis operator as it's GNU extension.
However GNU extensions are explicitely allowed and this operator is
used at several places in the kernel code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 09:38:19 -02:00
Heiner Kallweit 211477fe35 [media] media: rc: nuvoton-cir: replace nvt_pr with dev_ functions
Replace nvt_pr with the respective dev_ functions thus slightly
simplifying the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 09:37:34 -02:00
Heiner Kallweit af08233433 [media] media: rc: nuvoton-cir: switch chip detection message to info level
Switch the info about the detected chip type from debug to info level
as it might be useful not only for debugging purposes.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 09:37:11 -02:00
Heiner Kallweit 068fb7ddd5 [media] media: rc: nuvoton-cir: simplify debug code
Instead of explicitely checking debug use nvt_dbg like in other parts
of the driver thus simplifying the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 09:36:48 -02:00
Heiner Kallweit d0b528d5f7 [media] media: rc: nuvoton-cir: add support for the NCT6779D
Add support for the NCT6779D. It's found e.g. on the Zotac CI321 mini-pc
and I successfully tested it on this device.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 09:36:15 -02:00
Heiner Kallweit 6a5a336079 [media] media: rc: nuvoton-cir: make nvt_hw_detect void
nvt_hw_detect always returns 0, therefore make it return void.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 09:35:54 -02:00
Heiner Kallweit b5cf725c04 [media] media: rc: nuvoton-cir: improve chip detection
Make the chip detection code more similar to the one used for the
same chips in watchdog/w83627hf_wdt.c and hwmon/w83627ehf.c.

Apart from better maintainability we gain
- unified naming of chips (e.g. 677C -> NCT6776F)
- driver works with all revisions of the chips
  (least 4 bits of id are masked)

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 09:35:32 -02:00
Heiner Kallweit 099256e58e [media] media: rc: nuvoton-cir: switch resource handling to devm functions
Switch to managed resource handling using the devm_ functions.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 09:34:28 -02:00
Heiner Kallweit d5b04311cb [media] media: rc: nuvoton-cir: remove unneeded lock
chip_major / chip_minor are accessed sequentially in probe only.
Therefore no lock is needed.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 09:34:02 -02:00
Heiner Kallweit 2bbf9e061a [media] media: rc: nuvoton-cir: remove unneeded IRQ_RETVAL usage
Using IRQ_RETVAL is unneeded here. IRQ_NONE / IRQ_HANDLED can be
returned directly.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 09:33:27 -02:00
Heiner Kallweit 1b0621af50 [media] media: rc: ir-sharp-decoder: add support for Denon variant of the protocol
Denon also uses the Sharp protocol, however with different check bits.

It would have been also possible to add this as a separate protocol
but this may not be worth the effort.

Successfully tested with a Denon RC-1002 remote control.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 09:32:35 -02:00
Tina Ruchandani dd4c22a61e [media] rc-core: Remove 'struct timeval' usage
streamzap uses 'struct timeval' to store the start time of a signal for
gap tracking. struct timeval uses a 32-bit seconds representation which
will overflow in year 2038 and beyond. Replace struct timeval with ktime_t
which uses a 64-bit seconds representation and is 2038 safe. This patch
uses ktime_get_real() preserving the use of wall-clock time in the
original code.

Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 09:31:45 -02:00
Alberto Mardegan 8c47311d34 [media] em28xx: add Terratec Cinergy T XS (MT2060)
The Terratec Cinergy T XS is a DVB-T receiver with no analog TV tuner.
This patch adds support for the cards carrying the mt2060 tuner; it's
unclear whether there are cards sold under the same name which use a
different tuner.
As long as there are no reports of such cards, and indeed as long as
there are no working drivers for them, we assume that the USB device
[0ccd:0043] is carrying the mt2060 tuner.

Signed-off-by: Alberto Mardegan <mardy@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 09:29:16 -02:00
Julia Lawall cea590d46f [media] v4l: xilinx-vipp: add missing of_node_put
for_each_child_of_node performs an of_node_get on each iteration, so
a break out of the loop requires an of_node_put.

A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):

// <smpl>
@@
expression root,e;
local idexpression child;
@@

 for_each_child_of_node(root, child) {
   ... when != of_node_put(child)
       when != e = child
(
   return child;
|
+  of_node_put(child);
?  return ...;
)
   ...
 }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 09:27:17 -02:00
Julia Lawall cc331d37fe [media] v4l: xilinx-tpg: add missing of_node_put
for_each_child_of_node performs an of_node_get on each iteration, so
a break out of the loop requires an of_node_put.

A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):

// <smpl>
@@
expression root,e;
local idexpression child;
@@

 for_each_child_of_node(root, child) {
   ... when != of_node_put(child)
       when != e = child
(
   return child;
|
+  of_node_put(child);
?  return ...;
)
   ...
 }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 09:26:55 -02:00
Christian Engelmayer b771852270 [media] as102: fix potential double free in as102_fw_upload()
In case the request to locate the firmware file part 2 fails, the error
path releases the already freed firmware memory location again. Thus
reset the firmware pointer to NULL after releasing firmware file part 1.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 09:16:10 -02:00
Russell King 2ff56fadd9 [media] rc: allow rc modules to be loaded if rc-main is not a module
rc-main mistakenly uses #ifdef MODULE to determine whether it should
load the rc keymap modules.  This symbol is only defined if rc-main
is being built as a module itself, and bears no relation to whether
the rc keymaps are modules.

Fix this to use CONFIG_MODULES instead.

Fixes: 631493ecac ("[media] rc-core: merge rc-map.c into rc-main.c")

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 08:41:06 -02:00
Laura Abbott d2cc2f0b35 [media] si2157: return -EINVAL if firmware blob is too big
A previous patch added a check if the firmware is too big, but it didn't
set the return error code with the right value.

[mchehab@osg.samsung.com: I ended by applying a v1 of Laura's patch, without
 the proper return code. This patch contains the difference between v2 and v1 of
 the Laura's "si2157: Bounds check firmware" patch]
Cc: stable@kernel.org
Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
Reviewed-by: Olli Salonen <olli.salonen@iki.fi>
Tested-by: Olli Salonen <olli.salonen@iki.fi>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 08:39:52 -02:00
Insu Yun 997f69fb4a [media] mxl111sf: missing return values validation
Return values of mxl111sf_enable_usb_output and mxl1x1sf_top_master_ctrl
are not validated.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
Reviewed-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 08:15:02 -02:00
Geert Uytterhoeven 22bc862568 [media] rcar_vin: Remove obsolete platform data support
Since commit 3d7608e4c1 ("ARM: shmobile: bockw: remove legacy
board file and config"), Renesas R-Car SoCs are only supported in
generic DT-only ARM multi-platform builds.  The driver doesn't need to
use platform data anymore, hence remove platform data configuration.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 08:11:22 -02:00
Mauro Carvalho Chehab a71daaa10e [media] move media platform data to linux/platform_data/media
Now that media has its own subdirectory inside platform_data,
let's move the headers that are already there to such subdir.

After moving those files, the references were adjusted using this
script:

    MAIN_DIR="linux/platform_data/"
    PREV_DIR="linux/platform_data/"
    DIRS="media/"

    echo "Checking affected files" >&2
    for i in $DIRS; do
	for j in $(find include/$MAIN_DIR/$i -type f -name '*.h'); do
		 n=`basename $j`
		git grep -l $n
	done
    done|sort|uniq >files && (
	echo "Handling files..." >&2;
	echo "for i in \$(cat files|grep -v Documentation); do cat \$i | \\";
	(
		cd include/$MAIN_DIR;
		for j in $DIRS; do
			for i in $(ls $j); do
				echo "perl -ne 's,(include [\\\"\\<])$PREV_DIR($i)([\\\"\\>]),\1$MAIN_DIR$j\2\3,; print \$_' |\\";
			done;
		done;
		echo "cat > a && mv a \$i; done";
	);
	echo "Handling documentation..." >&2;
	echo "for i in MAINTAINERS \$(cat files); do cat \$i | \\";
	(
		cd include/$MAIN_DIR;
		for j in $DIRS; do
			for i in $(ls $j); do
				echo "  perl -ne 's,include/$PREV_DIR($i)\b,include/$MAIN_DIR$j\1,; print \$_' |\\";
			done;
		done;
		echo "cat > a && mv a \$i; done"
	);
    ) >script && . ./script

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Mark Brown <broonie@kernel.org>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 08:09:38 -02:00
Mikhail Ulyanov 886aa71bd4 [media] V4L2: platform: rcar_jpu: switch off clock on release later
Give JPU peripheral chance to finish current job.
Don't switch off clock until context release.

Signed-off-by: Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 08:04:28 -02:00
Mikhail Ulyanov 69ca0333e2 [media] V4L2: platform: rcar_jpu: remove redundant code
Remove redundant code. Following code line do what we want.

[mchehab@osg.samsung.com: fix conflict with VB2 split patches that renamed some structs]
Signed-off-by: Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 08:03:47 -02:00
Eric Nelson 3fb136f339 [media] rc: gpio-ir-recv: add timeout on idle
Many decoders require a trailing space (period without IR illumination)
to be delivered before completing a decode.

Since the gpio-ir-recv driver only delivers events on gpio transitions,
a single IR symbol (caused by a quick touch on an IR remote) will not
be properly decoded without the use of a timer to flush the tail end
state of the IR receiver.

This patch initializes and uses a timer and the timeout field of rcdev
to complete the stream and allow decode.

The timeout can be overridden through the use of the LIRC_SET_REC_TIMEOUT
ioctl.

Signed-off-by: Eric Nelson <eric@nelint.com>
Acked-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 07:46:33 -02:00
Sudeep Holla a2d1e1ed18 [media] media: st-rc: remove misuse of IRQF_NO_SUSPEND flag
The device is set as wakeup capable using proper wakeup API but the
driver misuses IRQF_NO_SUSPEND to set the interrupt as wakeup source
which is incorrect.

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with
enable_irq_wake instead.

Cc: Srinivas Kandagatla <srinivas.kandagatla@gmail.com>
Cc: Maxime Coquelin <maxime.coquelin@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: kernel@stlinux.com
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-19 06:46:05 -02:00
Linus Walleij 58383c7842 gpio: change member .dev to .parent
The name .dev in a struct is normally reserved for a struct device
that is let us say a superclass to the thing described by the struct.
struct gpio_chip stands out by confusingly using a struct device *dev
to point to the parent device (such as a platform_device) that
represents the hardware. As we want to give gpio_chip:s real devices,
this is not working. We need to rename this member to parent.

This was done by two coccinelle scripts, I guess it is possible to
combine them into one, but I don't know such stuff. They look like
this:

@@
struct gpio_chip *var;
@@
-var->dev
+var->parent

and:

@@
struct gpio_chip var;
@@
-var.dev
+var.parent

and:

@@
struct bgpio_chip *var;
@@
-var->gc.dev
+var->gc.parent

Plus a few instances of bgpio that I couldn't figure out how
to teach Coccinelle to rewrite.

This patch hits all over the place, but I *strongly* prefer this
solution to any piecemal approaches that just exercise patch
mechanics all over the place. It mainly hits drivers/gpio and
drivers/pinctrl which is my own backyard anyway.

Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
Cc: Rafał Miłecki <zajec5@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Alek Du <alek.du@intel.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2015-11-19 09:24:35 +01:00
Mauro Carvalho Chehab 203e942d20 [media] s5c73m3-spi: fix compilation breakage when compiled as Module
commit f934a94bb5 ('s5c73m3: Export OF
module alias information') broke compilation when compiled as module:

In file included from drivers/media/i2c/s5c73m3/s5c73m3-spi.c:22:0:
drivers/media/i2c/s5c73m3/s5c73m3-spi.c:40:40: error: expected ')' before ';' token
 MODULE_DEVICE_TABLE(of, s5c73m3_spi_ids;);
                                        ^

Fix it by removing the extra ';'

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-18 16:49:18 -02:00
Peter Griffin 0014eb755e [media] c8sectpfe: Update binding to reset-gpios
reset-gpios is more clear than rst-gpio.

This change has been done as one atomic commit but it
does breaks compatability with older dtbs.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-18 13:32:58 -02:00
Malcolm Priestley c9d57de610 [media] media: dvb-core: Don't force CAN_INVERSION_AUTO in oneshot mode
When in FE_TUNE_MODE_ONESHOT the frontend must report
the actual capabilities so user can take appropriate
action.

With frontends that can't do auto inversion this is done
by dvb-core automatically so CAN_INVERSION_AUTO is valid.

However, when in FE_TUNE_MODE_ONESHOT this is not true.

So only set FE_CAN_INVERSION_AUTO in modes other than
FE_TUNE_MODE_ONESHOT

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-18 13:27:03 -02:00
Javier Martinez Canillas f934a94bb5 [media] s5c73m3: Export OF module alias information
The SPI core always reports the MODALIAS uevent as "spi:<modalias>"
regardless of the mechanism that was used to register the device
(i.e: OF or board code) and the table that is used later to match
the driver with the device (i.e: SPI id table or OF match table).

So drivers needs to export the SPI id table and this be built into
the module or udev won't have the necessary information to autoload
the needed driver module when the device is added.

But this means that OF-only drivers needs to have both OF and SPI id
tables that have to be kept in sync and also the dev node compatible
manufacturer prefix is stripped when reporting the MODALIAS. Which can
lead to issues if two vendors use the same SPI device name for example.

To avoid the above, the SPI core behavior may be changed in the future
to not require an SPI device table for OF-only drivers and report the
OF module alias. So, it's better to also export the OF table even when
is unused now to prevent breaking module loading when the core changes.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-18 13:24:14 -02:00
Nicholas Mc Guire 4bdbcb3197 [media] ddbridge: fix wait_event_timeout return handling
API conformance testing for completions with coccinelle spatches are being
used to locate API usage inconsistencies:
./drivers/media/pci/ddbridge/ddbridge-core.c:89
        incorrect check for negative return

Return type of wait_event_timeout is signed long not int and the
return type is >=0 always thus the negative check is unnecessary..
As stat is used here exclusively its type is simply changed and the
negative return check dropped.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-18 12:21:29 -02:00
Julia Lawall 217bdb0741 [media] i2c: constify v4l2_ctrl_ops structures
These v4l2_ctrl_ops structures are never modified, like all the other
v4l2_ctrl_ops structures, so declare them as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 15:41:33 -02:00
Josh Wu 05645a46a1 [media] atmel-isi: support RGB565 output when sensor output YUV formats
This patch enable Atmel ISI preview path to convert the YUV to RGB format.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
[g.liakhovetski@gmx.de: removed superfluous parentheses]
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 15:33:17 -02:00
Josh Wu 7393de60a2 [media] atmel-isi: setup YCC_SWAP correctly when using preview path
The preview path only can convert UYVY format to RGB data.

To make preview path work correctly, we need to set up YCC_SWAP
according to sensor output and convert them to UYVY.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 15:31:47 -02:00
Josh Wu bd70f260cb [media] atmel-isi: add code to setup correct resolution for preview path
Not like codec path, preview path can do downsampling, so we should setup
a extra preview width, height for it.

This patch add preview resolution setup without down sampling. So currently
preview path will output same size as sensor output size.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 15:29:39 -02:00
Josh Wu 0fb725750b [media] atmel-isi: prepare for the support of preview path
Atmel ISI support a preview path which can output RGB data.

So this patch introduces a bool variable to choose which path is
enabled currently. And also we need setup corresponding path registers.

By default the preview path is disabled. We only use Codec path.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 15:29:19 -02:00
Josh Wu ba0422bf56 [media] atmel-isi: correct yuv swap according to different sensor outputs
we need to configure the YCC_SWAP bits in ISI_CFG2 according to current
sensor output and Atmel ISI output format.

Current there are two cases Atmel ISI supported:
  1. Atmel ISI outputs YUYV format.
     This case we need to setup YCC_SWAP according to sensor output
     format.
  2. Atmel ISI output a pass-through formats, which means no swap.
     Just setup YCC_SWAP as default with no swap.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 15:28:52 -02:00
Josh Wu dc51b7d015 [media] v4l2-clk: v4l2_clk_get() also need to find the of_fullname clock
The soc-camera host will be probed and register a v4l2_clk, but if at
that moment, the i2c device is not available, then the registered
v4l2_clk name is an OF string not a I2C string.

So when i2c sensor probes and calls v4l2_clk_get(), it only searches a
clock with I2C string, like "1-0030".

This patch will search the clock with OF string name if no clock with
I2C string name could be found.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 15:19:52 -02:00
Josh Wu 3d83078a08 [media] v4l2-clk: add new definition: V4L2_CLK_NAME_SIZE
Make all v4l2-clk's clock name use V4L2_CLK_NAME_SIZE definition.

In future, if the string is increased we just need to change the
V4L2_CLK_NAME_SIZE once.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 15:19:11 -02:00
Josh Wu ac2841f3b8 [media] v4l2-clk: add new macro for v4l2_clk_name_of()
This macro is used to generate an OF string for a v4l2 clock.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 15:18:19 -02:00
Josh Wu af4d834727 [media] soc_camera: get the clock name by using macro: v4l2_clk_name_i2c()
Since v4l2_clk_name_i2c() is defined, reuse it.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 15:17:57 -02:00
Prashant Laddha a41f9b419c [media] vivid: add support for reduced frame rate in video capture
With this patch, vivid capture thread can now generate a video with
frame rate reduced by a factor of 1000 / 1001. This option can be
selected using a control Reduced Framerate from gui.

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-11-17 15:06:22 -02:00
Prashant Laddha c79aa6aead [media] vivid-capture: add control for reduced frame rate
A boolean control Reduced Framerate is added to vivid controls for
controlling the reduced fps option for vivid capture from gui.

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-11-17 15:06:00 -02:00
Prashant Laddha b883ba75e9 [media] vivid: add support for reduced fps in video out
If reduced fps flag is set then check if other necessary conditions
are true for the given bt timing. If yes, then reduce the frame rate.
For vivid transmitter, timeperframe_vid_out controls the frame rate.
Adjusting the timeperframe_vid_out by scaling down pixel clock by
factor of 1000 / 1001.

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-11-17 15:05:40 -02:00
Prashant Laddha 8d7322f4f7 [media] v4l2-dv-timings: add condition checks for reduced fps
Added a helper function to check necessary conditions required for
reduced fps. The reduced fps is supported for CVT and CEA861 timings.
CVT supports reduced fps only if reduced blanking v2 (indicated by
vsync = 8) is true. Whereas CEA861 supports reduced fps if
V4L2_DV_FL_CAN_REDUCE_FPS flag is true.

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-11-17 15:05:14 -02:00
Tommi Franttila 0d51ebd3f4 [media] v4l2-device: Don't unregister ACPI/Device Tree based devices
When a V4L2 sub-device backed by a DT or ACPI based device was removed,
the device was unregistered as well which certainly was not intentional,
as the client device would not be re-created by simply reinstating the
V4L2 sub-device (indeed the device would have to be there first!).

Skip unregistering the device in case it has non-NULL of_node or fwnode.

Signed-off-by: Tommi Franttila <tommi.franttila@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 15:04:12 -02:00
Ulrich Hecht 16dfe72fd8 [media] media: adv7180: increase delay after reset to 5ms
Initialization of the ADV7180 chip fails on the Renesas R8A7790-based
Lager board about 50% of the time.  This patch resolves the issue by
increasing the minimum delay after reset from 2 ms to 5 ms, following the
recommendation in the ADV7180 datasheet:

"Executing a software reset takes approximately 2 ms. However, it is
recommended to wait 5 ms before any further I2C writes are performed."

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:56:59 -02:00
Oliver Neukum 588afcc1c0 [media] usbvision fix overflow of interfaces array
This fixes the crash reported in:
http://seclists.org/bugtraq/2015/Oct/35
The interface number needs a sanity check.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Cc: Vladis Dronov <vdronov@redhat.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:56:31 -02:00
Arnd Bergmann 3ff863b87e [media] sh-vou: clarify videobuf2 dependency
The sh-vou driver has been converted from videobuf to videobuf2, but
the Kconfig file still lists VIDEOBUF_DMA_CONTIG as a dependency.
Consequently we can build the driver without VIDEOBUF2_DMA_CONTIG
and get a link error:

drivers/built-in.o: In function `sh_vou_probe':
vf610-ocotp.c:(.text+0x2dbf5c): undefined reference to `vb2_dma_contig_init_ctx'
vf610-ocotp.c:(.text+0x2dc0b4): undefined reference to `vb2_dma_contig_cleanup_ctx'
vf610-ocotp.c:(.text+0x2dc144): undefined reference to `vb2_dma_contig_memops'
drivers/built-in.o: In function `sh_vou_remove':
vf610-ocotp.c:(.text+0x2dc190): undefined reference to `vb2_dma_contig_cleanup_ctx'

This changes the dependency to VIDEOBUF2_DMA_CONTIG instead.

Fixes: 57af3ad59d ("[media] sh-vou: convert to vb2")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:55:26 -02:00
Kosuke Tatsukawa 5063452ecb [media] media: fix waitqueue_active without memory barrier in cpia2 driver
cpia2_usb_disconnect() seems to be missing a memory barrier which might
cause the waker to not notice the waiter and miss sending a wake_up as
in the following figure.

	cpia2_usb_disconnect			sync
------------------------------------------------------------------------
					mutex_unlock(&cam->v4l2_lock);
if (waitqueue_active(&cam->wq_stream))
/* The CPU might reorder the test for
   the waitqueue up here, before
   prior writes complete */
					/* wait_event_interruptible */
					 /* __wait_event_interruptible */
					  /* ___wait_event */
					  long __int = prepare_to_wait_event(
					    &wq, &__wait, state);
					  if (!cam->streaming ||
					    frame->status == FRAME_READY)
cam->curbuff->status = FRAME_READY;
cam->curbuff->length = 0;
					  schedule()
------------------------------------------------------------------------

The attached patch removes the call to waitqueue_active() leaving just
wake_up() behind.  This fixes the problem because the call to
spin_lock_irqsave() in wake_up() will be an ACQUIRE operation.

I found this issue when I was looking through the linux source code
for places calling waitqueue_active() before wake_up*(), but without
preceding memory barriers, after sending a patch to fix a similar
issue in drivers/tty/n_tty.c  (Details about the original issue can be
found here: https://lkml.org/lkml/2015/9/28/849).

Signed-off-by: Kosuke Tatsukawa <tatsu@ab.jp.nec.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:55:06 -02:00
Antonio Ospite dcc7fdbec5 [media] gspca: ov534/topro: prevent a division by 0
v4l2-compliance sends a zeroed struct v4l2_streamparm in
v4l2-test-formats.cpp::testParmType(), and this results in a division by
0 in some gspca subdrivers:

  divide error: 0000 [#1] SMP
  Modules linked in: gspca_ov534 gspca_main ...
  CPU: 0 PID: 17201 Comm: v4l2-compliance Not tainted 4.3.0-rc2-ao2 #1
  Hardware name: System manufacturer System Product Name/M2N-E SLI, BIOS
    ASUS M2N-E SLI ACPI BIOS Revision 1301 09/16/2010
  task: ffff8800818306c0 ti: ffff880095c4c000 task.ti: ffff880095c4c000
  RIP: 0010:[<ffffffffa079bd62>]  [<ffffffffa079bd62>] sd_set_streamparm+0x12/0x60 [gspca_ov534]
  RSP: 0018:ffff880095c4fce8  EFLAGS: 00010296
  RAX: 0000000000000000 RBX: ffff8800c9522000 RCX: ffffffffa077a140
  RDX: 0000000000000000 RSI: ffff880095e0c100 RDI: ffff8800c9522000
  RBP: ffff880095e0c100 R08: ffffffffa077a100 R09: 00000000000000cc
  R10: ffff880067ec7740 R11: 0000000000000016 R12: ffffffffa07bb400
  R13: 0000000000000000 R14: ffff880081b6a800 R15: 0000000000000000
  FS:  00007fda0de78740(0000) GS:ffff88012fc00000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 00000000014630f8 CR3: 00000000cf349000 CR4: 00000000000006f0
  Stack:
   ffffffffa07a6431 ffff8800c9522000 ffffffffa077656e 00000000c0cc5616
   ffff8800c9522000 ffffffffa07a5e20 ffff880095e0c100 0000000000000000
   ffff880067ec7740 ffffffffa077a140 ffff880067ec7740 0000000000000016
  Call Trace:
   [<ffffffffa07a6431>] ? v4l_s_parm+0x21/0x50 [videodev]
   [<ffffffffa077656e>] ? vidioc_s_parm+0x4e/0x60 [gspca_main]
   [<ffffffffa07a5e20>] ? __video_do_ioctl+0x280/0x2f0 [videodev]
   [<ffffffffa07a5ba0>] ? video_ioctl2+0x20/0x20 [videodev]
   [<ffffffffa07a59b9>] ? video_usercopy+0x319/0x4e0 [videodev]
   [<ffffffff81182dc1>] ? page_add_new_anon_rmap+0x71/0xa0
   [<ffffffff811afb92>] ? mem_cgroup_commit_charge+0x52/0x90
   [<ffffffff81179b18>] ? handle_mm_fault+0xc18/0x1680
   [<ffffffffa07a15cc>] ? v4l2_ioctl+0xac/0xd0 [videodev]
   [<ffffffff811c846f>] ? do_vfs_ioctl+0x28f/0x480
   [<ffffffff811c86d4>] ? SyS_ioctl+0x74/0x80
   [<ffffffff8154a8b6>] ? entry_SYSCALL_64_fastpath+0x16/0x75
  Code: c7 93 d9 79 a0 5b 5d e9 f1 f3 9a e0 0f 1f 00 66 2e 0f 1f 84 00
    00 00 00 00 66 66 66 66 90 53 31 d2 48 89 fb 48 83 ec 08 8b 46 10 <f7>
    76 0c 80 bf ac 0c 00 00 00 88 87 4e 0e 00 00 74 09 80 bf 4f
  RIP  [<ffffffffa079bd62>] sd_set_streamparm+0x12/0x60 [gspca_ov534]
   RSP <ffff880095c4fce8>
  ---[ end trace 279710c2c6c72080 ]---

Following what the doc says about a zeroed timeperframe (see
http://www.linuxtv.org/downloads/v4l-dvb-apis/vidioc-g-parm.html):

  ...
  To reset manually applications can just set this field to zero.

fix the issue by resetting the frame rate to a default value in case of
an unusable timeperframe.

The fix is done in the subdrivers instead of gspca.c because only the
subdrivers have notion of a default frame rate to reset the camera to.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Cc: stable@vger.kernel.org
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:54:25 -02:00
Terry Heo ce3556bde3 [media] cx231xx: fix bulk transfer mode
The current cx231xx driver doesn't work with bulk transfer mode.
This patch makes it possible to use bulk transfer mode.

Signed-off-by: Terry Heo <terryheo@google.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:53:41 -02:00
Julia Lawall 18a8560cbd [media] radio-shark2: constify radio_tea5777_ops structures
The radio_tea5777_ops structure is never modified, so declare it as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:52:15 -02:00
Julia Lawall e88a3f8121 [media] media: videobuf2: fix compare_const_fl.cocci warnings
Move constants to the right of binary operators.

Generated by: scripts/coccinelle/misc/compare_const_fl.cocci

CC: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:48:48 -02:00
Ricardo Ribalda 082afb7c4e [media] media/usb/pvrusb2: Support for V4L2_CTRL_WHICH_DEF_VAL
This driver does not use the control infrastructure.
Add support for the new field which on structure
 v4l2_ext_controls

Acked-by: Mike Isely <isely@pobox.com>
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:46:44 -02:00
Ricardo Ribalda 91739838a5 [media] usb/uvc: Support for V4L2_CTRL_WHICH_DEF_VAL
This driver does not use the control infrastructure.
Add support for the new field which on structure
 v4l2_ext_controls

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:46:21 -02:00
Ricardo Ribalda 953eae5d8d [media] media/v4l2-core: struct struct v4l2_ext_controls param which
Support for new field which on v4l2_ext_controls, used to get the
default value of one or more controls.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:44:49 -02:00
Ricardo Ribalda 0f8017bebf [media] media/core: Replace ctrl_class with which
Replace the obsolete field ctrl_class with "which".

Make sure it not used in future modules by commenting out the field with
ifndef __KERNEL_ .

The field cannot be simply removed because that would be change on the
kenel API to the userspace (and we don't like that).

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:44:03 -02:00
Hans Verkuil dc5e02050b [media] adv7511: fix incorrect bit offset
The quantization bits are in bits 7-6, not 7-4, so shift by 6 instead of 4.

This bug is caused by a typo in the adv7511 datasheet.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:39:54 -02:00
Mats Randgaard 74c9c0febb [media] v4l2-dv-timings: Compare horizontal blanking
hsync and hbackporch must also be compared

Signed-off-by: Mats Randgaard <matrandg@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:39:34 -02:00
Ricardo Ribalda 95ad7ff389 [media] v4l2-core/v4l2-ctrls: Filter NOOP CH_RANGE events
If modify_range is called but no range is changed, do not send the
CH_RANGE event.

Reported-by: Dimitrios Katsaros <patcherwork@gmail.com>
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:39:10 -02:00
Dan Carpenter 0dac45f0e5 [media] av7110: potential divide by zero
"len" comes from dvb_video_ioctl() and there is a possibility that it is
zero.  We do a divide by len later in the function so that's not ok.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:38:18 -02:00
Dan Carpenter 75d63a40a5 [media] av7110: don't allow negative volumes
The issue here is that we there is a static checker warning because we
have a user controlled volume setting and we cap the upper bound but we
allow negative numbers.  Negative volumes don't make sense, so let's
make these variables unsigned.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:36:39 -02:00
Hans Verkuil 4623e59674 [media] vb2: fix a regression in poll() behavior for output,streams
In the 3.17 kernel the poll() behavior changed for output streams:
as long as not all buffers were queued up poll() would return that
userspace can write. This is fine for the write() call, but when
using stream I/O this changed the behavior since the expectation
was that it would wait for buffers to become available for dequeuing.

This patch only enables the check whether you can queue buffers
for file I/O only, and skips it for stream I/O.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: <stable@vger.kernel.org>      # for v3.17 and up
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:35:39 -02:00
Hans Verkuil f6de9f6085 [media] vivid: fix compliance error
If vivid is loaded with the no_error_inj=1 option, then v4l2-compliance will
fail for the video and vbi output nodes because the vivid control class has no
controls.

Don't add the control class for video and vbi output if no_error_inj is true.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:34:23 -02:00
Hans Verkuil ba463988a0 [media] go7007: fix broken test
The wrong flags field was tested for the GO7007_BOARD_HAS_AUDIO flag: that
flag is in board->main_info.flags, not in board->flags.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:33:41 -02:00
Mauro Carvalho Chehab eb4b0ec75e [media] include/media: move platform_data to linux/platform_data/media
Let's not mix platform_data headers with the core headers. Instead, let's
create a subdir at linux/platform_data and move the headers to that
common place, adding it to MAINTAINERS.

The headers were moved with:
	mkdir include/linux/platform_data/media/; git mv include/media/gpio-ir-recv.h include/media/ir-rx51.h include/media/mmp-camera.h include/media/omap1_camera.h include/media/omap4iss.h include/media/s5p_hdmi.h include/media/si4713.h include/media/sii9234.h include/media/smiapp.h include/media/soc_camera.h include/media/soc_camera_platform.h include/media/timb_radio.h include/media/timb_video.h include/linux/platform_data/media/

And the references fixed with this script:
    MAIN_DIR="linux/platform_data/"
    PREV_DIR="media/"
    DIRS="media/"

    echo "Checking affected files" >&2
    for i in $DIRS; do
	for j in $(find include/$MAIN_DIR/$i -type f -name '*.h'); do
		 n=`basename $j`
		git grep -l $n
	done
    done|sort|uniq >files && (
	echo "Handling files..." >&2;
	echo "for i in \$(cat files|grep -v Documentation); do cat \$i | \\";
	(
		cd include/$MAIN_DIR;
		for j in $DIRS; do
			for i in $(ls $j); do
				echo "perl -ne 's,(include [\\\"\\<])$PREV_DIR($i)([\\\"\\>]),\1$MAIN_DIR$j\2\3,; print \$_' |\\";
			done;
		done;
		echo "cat > a && mv a \$i; done";
	);
	echo "Handling documentation..." >&2;
	echo "for i in MAINTAINERS \$(cat files); do cat \$i | \\";
	(
		cd include/$MAIN_DIR;
		for j in $DIRS; do
			for i in $(ls $j); do
				echo "  perl -ne 's,include/$PREV_DIR($i)\b,include/$MAIN_DIR$j\1,; print \$_' |\\";
			done;
		done;
		echo "cat > a && mv a \$i; done"
	);
    ) >script && . ./script

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
2015-11-17 06:58:42 -02:00
Mauro Carvalho Chehab d647f0b70c [media] include/media: move driver interface headers to a separate dir
Let's not mix headers used by the core with those headers that
are needed by some driver-specific interface header.

The headers used on drivers were manually moved using:
    mkdir include/media/drv-intf/
    git mv include/media/cx2341x.h include/media/cx25840.h \
	include/media/exynos-fimc.h include/media/msp3400.h \
	include/media/s3c_camif.h include/media/saa7146.h \
	include/media/saa7146_vv.h  include/media/sh_mobile_ceu.h \
	include/media/sh_mobile_csi2.h include/media/sh_vou.h \
	include/media/si476x.h include/media/soc_mediabus.h \
	include/media/tea575x.h include/media/drv-intf/

And the references for those headers were corrected using:

    MAIN_DIR="media/"
    PREV_DIR="media/"
    DIRS="drv-intf/"

    echo "Checking affected files" >&2
    for i in $DIRS; do
	for j in $(find include/$MAIN_DIR/$i -type f -name '*.h'); do
		 n=`basename $j`
		git grep -l $n
	done
    done|sort|uniq >files && (
	echo "Handling files..." >&2;
	echo "for i in \$(cat files|grep -v Documentation); do cat \$i | \\";
	(
		cd include/$MAIN_DIR;
		for j in $DIRS; do
			for i in $(ls $j); do
				echo "perl -ne 's,(include [\\\"\\<])$PREV_DIR($i)([\\\"\\>]),\1$MAIN_DIR$j\2\3,; print \$_' |\\";
			done;
		done;
		echo "cat > a && mv a \$i; done";
	);
	echo "Handling documentation..." >&2;
	echo "for i in MAINTAINERS \$(cat files); do cat \$i | \\";
	(
		cd include/$MAIN_DIR;
		for j in $DIRS; do
			for i in $(ls $j); do
				echo "  perl -ne 's,include/$PREV_DIR($i)\b,include/$MAIN_DIR$j\1,; print \$_' |\\";
			done;
		done;
		echo "cat > a && mv a \$i; done"
	);
    ) >script && . ./script

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
2015-11-17 06:57:29 -02:00
Mauro Carvalho Chehab b5dcee225c [media] include/media: split I2C headers from V4L2 core
Currently, include/media is messy, as it contains both the V4L2 core
headers and some driver-specific headers on the same place. That makes
harder to identify what core headers should be documented and what
headers belong to I2C drivers that are included only by bridge/main
drivers that would require the functions provided by them.

Let's move those i2c specific files to its own subdirectory.

The files to move were produced via the following script:
	mkdir include/media/i2c
	(cd include/media; for i in *.h; do n=`echo $i|sed s/.h$/.c/`; if [ -e ../../drivers/media/i2c/$n ]; then echo $i; git mv $i i2c/; fi; done)
	(cd include/media; for i in *.h; do n=`echo $i|sed s/.h$/.c/`; if [ -e ../../drivers/media/*/i2c/$n ]; then echo $i; git mv $i i2c/; fi; done)
	for i in include/media/*.h; do n=`basename $i`;  (for j in $(git grep -l $n); do dirname $j; done)|sort|uniq|grep -ve '^.$' > list; num=$(wc -l list|cut -d' ' -f1); if [ $num == 1 ]; then if [ "`grep i2c list`" != "" ]; then git mv $i include/media/i2c; fi; fi; done

And the references corrected via this script:
    MAIN_DIR="media/"
    PREV_DIR="media/"
    DIRS="i2c/"

    echo "Checking affected files" >&2
    for i in $DIRS; do
	for j in $(find include/$MAIN_DIR/$i -type f -name '*.h'); do
		 n=`basename $j`
		git grep -l $n
	done
    done|sort|uniq >files && (
	echo "Handling files..." >&2;
	echo "for i in \$(cat files|grep -v Documentation); do cat \$i | \\";
	(
		cd include/$MAIN_DIR;
		for j in $DIRS; do
			for i in $(ls $j); do
				echo "perl -ne 's,(include [\\\"\\<])$PREV_DIR($i)([\\\"\\>]),\1$MAIN_DIR$j\2\3,; print \$_' |\\";
			done;
		done;
		echo "cat > a && mv a \$i; done";
	);
	echo "Handling documentation..." >&2;
	echo "for i in MAINTAINERS \$(cat files); do cat \$i | \\";
	(
		cd include/$MAIN_DIR;
		for j in $DIRS; do
			for i in $(ls $j); do
				echo "  perl -ne 's,include/$PREV_DIR($i)\b,include/$MAIN_DIR$j\1,; print \$_' |\\";
			done;
		done;
		echo "cat > a && mv a \$i; done"
	);
    ) >script && . ./script

Merged Sakari Ailus patch that moves smiapp.h to include/media/i2c.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
2015-11-17 06:57:11 -02:00
Mauro Carvalho Chehab bef0e549d1 [media] dvb_frontend.h: improve documentation for struct dvb_tuner_ops
Improve the comments at the header, removing kernel-doc
tag from where it doesn't belong, grouping the legacy tuner
functions, and improving the text.

No functional changes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 06:46:42 -02:00
Mauro Carvalho Chehab 45346e0e83 [media] dvb_frontend: get rid of set_state ops & related data
The get_state()/set_state and the corresponding data types
(struct tuner_state and enum tuner_param) are old DVB interfaces
that came from the DVBv3 time.

Nowadays, set_params() provide a better way to set the tuner
and demod parameters. So, no need to keep those legacy stuff,
as all drivers that were using it got converted.

With this patch, all kABI elements at dvb_frontend.h are now
documented.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 06:46:02 -02:00
Mauro Carvalho Chehab 65f0f686de [media] stb6100: get rid of get_state()/set_state()
It is tricky to get rid of those ops here, as the stv0299 driver
wants to set frequency in separate from setting the bandwidth.

So, we use a small trick: we temporarely fill the cache with
0 for either frequency or bandwidth and add some logic at
set_params to only change the property(ies) that aren't zero.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 06:45:05 -02:00
Mauro Carvalho Chehab b2d3afcfbd [media] tda6655: get rid of get_state()/set_state()
Those ops aren't used by any driver, with is weird. I suspect
that mantis_vb3030 driver were not working properly...

Anyway, now that the driver uses the set_parms, the DVB
frontend core should do the right thing.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 06:44:31 -02:00
Mauro Carvalho Chehab e417668d40 [media] tda8261: don't use set_state/get_state callbacks
Those callbacks are meant to be used only on some very specific
cases. There's absolutely no need to do that at tda8261, as
the only parameter that it allows to be set/get is the frequency.

So, use the standard get_params() and get_frequency() kABI
ops.

There's no need to touch at any bridge driver, as all interactions
are done via the macros at tda8261_cfg.h.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 06:43:59 -02:00
Mauro Carvalho Chehab 8fdc25bf61 [media] tda666x: add support for set_parms() and get_frequency()
Those two callbacks are the ones that should be used by normal
DVB frontend drivers.

Add support for them.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 06:43:15 -02:00
Mauro Carvalho Chehab 8e6c4be3f8 [media] tda665x: split set_frequency from set_state
On tda665x, set_state only sets frequency. As the kABI for set_state
is meant to be used only on special cases, split the function
into two, in order to allow it to be latter used by a DVBv5
cache params logic.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 06:42:32 -02:00
Mauro Carvalho Chehab cffdbfe7cf [media] stb6100: get rid of tuner_state at struct stb6100_state
The stb6100 driver has a struct tuner_state on its state
struct, that it is used only to store the bandwidth. Even so,
this struct is not really used, as every time the bandwidth
is get or set, it goes through the hardware.

So, get rid of that.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 06:41:53 -02:00
Mauro Carvalho Chehab 2184e2530c [media] dvb_frontend.h: get rid of unused tuner params/states
There are several tuner_param values that aren't by any driver or core:
	DVBFE_TUNER_TUNERSTEP
	DVBFE_TUNER_IFFREQ
	DVBFE_TUNER_REFCLOCK
	DVBFE_TUNER_IQSENSE
	DVBFE_TUNER_DUMMY

Several of those correspond to the values at the tuner_state
struct with is also only initialized by not used anyware:
	u32 tunerstep;
	u32 ifreq;
	u32 refclock;

It doesn't make sense to keep anything at the kABI that it is
not used. So, get rid of them.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 06:41:18 -02:00
Mauro Carvalho Chehab 41c0b78e5e [media] dvb_frontend.h: Document suspend/resume functions
Those functions should be implemented on all drivers. So, document
them.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 06:40:54 -02:00
Mauro Carvalho Chehab 3663b31b69 [media] dvb_frontend: resume tone and voltage
As SEC tone and voltage could have changed during
suspend(), restore them to their previous values at
resume().

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 06:40:31 -02:00
Mauro Carvalho Chehab 03946b2d66 [media] demux.h: Some documentation fixups for the header
The DocBook description of this header has two issues:
- It calls the Kernel ABI as API, instead of kABI;
- It mentions that the DVB frontend kABI is not described
  within the document. As this will actually generate a
  single DocBook, this is actually not true, now that
  the documentation for the frontend was added.

So, fix both issues.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 06:39:00 -02:00
Mauro Carvalho Chehab 02f028cfd9 [media] dvb_frontend.h: Add a description for the header
This header file provides the kABI functions used by the
Digital TV Frontend core support. Add a description for
this kABI, to add at the device_drivers Kernel DocBook.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 06:38:33 -02:00
Mauro Carvalho Chehab 66f4b3cb5c [media] dvb_frontend: document the most used functions
Documents the most used functions at the Digital TV
kABI: dvb_frontend_register(), dvb_frontend_unregister()
and dvb_frontend_detach().

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 06:38:05 -02:00
Mauro Carvalho Chehab 75f400b0e3 [media] Document the obscure dvb_frontend_reinitialise()
The dvb_frontend_reinitialise() function is a special case
used by just one frontend. Document it, for completeness.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 06:37:39 -02:00
Mauro Carvalho Chehab 4deea4cb47 [media] dvb: document dvb_frontend_sleep_until()
This function is used mainly at the DVB core, in order to provide
emulation for a legacy ioctl. The only current exception is
the stv0299 driver, with takes more than 8ms to switch voltage,
breaking the emulation for FE_DISHNETWORK_SEND_LEGACY_CMD.

Document that.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 06:37:16 -02:00
Mauro Carvalho Chehab 6747b39441 [media] device-drivers.tmpl: better organize DVB function calls
Classify the functions at the DVB core per API. That makes easier
to understand how they're related to the userspace API.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-16 07:40:04 -02:00
Mauro Carvalho Chehab 7b6e55b970 [media] demux.h: move documentation overview from device-drivers.tmpl
It is better to keep the documentation overview at the header file,
as this makes easier for developers to remember to fix when needed.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-16 07:39:11 -02:00
Mauro Carvalho Chehab d55ebd07b6 [media] ivtv: avoid going past input/audio array
As reported by smatch:
	drivers/media/pci/ivtv/ivtv-driver.c:832 ivtv_init_struct2() error: buffer overflow 'itv->card->video_inputs' 6 <= 6

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-16 07:38:04 -02:00
Mauro Carvalho Chehab 823873481b [media] Revert "[media] ivtv: avoid going past input/audio array"
This patch broke ivtv logic, as reported at
 https://bugzilla.redhat.com/show_bug.cgi?id=1278942

This reverts commit 09290cc885.

Cc: stable@vger.kernel.org # for v4.1 and upper
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-16 07:37:45 -02:00
Christoph Hellwig e806f75d52 netup_unidvb: use pci_set_dma_mask insted of pci_dma_supported
This ensures the dma mask that is supported by the driver is recorded
in the device structure.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Sergey Kozlov <serjk@netup.ru>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-11-10 16:32:11 -08:00
Christoph Hellwig 4571e4a2fc cx23885: use pci_set_dma_mask insted of pci_dma_supported
This ensures the dma mask that is supported by the driver is recorded
in the device structure.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Pawel Osciak <pawel@osciak.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-11-10 16:32:11 -08:00
Christoph Hellwig 251c5912d9 cx25821: use pci_set_dma_mask insted of pci_dma_supported
This ensures the dma mask that is supported by the driver is recorded
in the device structure.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-11-10 16:32:11 -08:00
Christoph Hellwig 111be8b28d cx88: use pci_set_dma_mask insted of pci_dma_supported
This ensures the dma mask that is supported by the driver is recorded
in the device structure.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-11-10 16:32:11 -08:00
Christoph Hellwig f546e121b5 saa7134: use pci_set_dma_mask insted of pci_dma_supported
This ensures the dma mask that is supported by the driver is recorded
in the device structure.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Pawel Osciak <pawel@osciak.com>
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-11-10 16:32:11 -08:00
Christoph Hellwig 45fa9c039a saa7164: use pci_set_dma_mask insted of pci_dma_supported
This ensures the dma mask that is supported by the driver is recorded
in the device structure.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-11-10 16:32:11 -08:00
Christoph Hellwig bad007bca7 tw68-core: use pci_set_dma_mask insted of pci_dma_supported
This ensures the dma mask that is supported by the driver is recorded
in the device structure.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Pawel Osciak <pawel@osciak.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-11-10 16:32:11 -08:00
Andrew Morton 79211c8ed1 remove abs64()
Switch everything to the new and more capable implementation of abs().
Mainly to give the new abs() a bit of a workout.

Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-11-09 15:11:24 -08:00
Mel Gorman d0164adc89 mm, page_alloc: distinguish between being unable to sleep, unwilling to sleep and avoiding waking kswapd
__GFP_WAIT has been used to identify atomic context in callers that hold
spinlocks or are in interrupts.  They are expected to be high priority and
have access one of two watermarks lower than "min" which can be referred
to as the "atomic reserve".  __GFP_HIGH users get access to the first
lower watermark and can be called the "high priority reserve".

Over time, callers had a requirement to not block when fallback options
were available.  Some have abused __GFP_WAIT leading to a situation where
an optimisitic allocation with a fallback option can access atomic
reserves.

This patch uses __GFP_ATOMIC to identify callers that are truely atomic,
cannot sleep and have no alternative.  High priority users continue to use
__GFP_HIGH.  __GFP_DIRECT_RECLAIM identifies callers that can sleep and
are willing to enter direct reclaim.  __GFP_KSWAPD_RECLAIM to identify
callers that want to wake kswapd for background reclaim.  __GFP_WAIT is
redefined as a caller that is willing to enter direct reclaim and wake
kswapd for background reclaim.

This patch then converts a number of sites

o __GFP_ATOMIC is used by callers that are high priority and have memory
  pools for those requests. GFP_ATOMIC uses this flag.

o Callers that have a limited mempool to guarantee forward progress clear
  __GFP_DIRECT_RECLAIM but keep __GFP_KSWAPD_RECLAIM. bio allocations fall
  into this category where kswapd will still be woken but atomic reserves
  are not used as there is a one-entry mempool to guarantee progress.

o Callers that are checking if they are non-blocking should use the
  helper gfpflags_allow_blocking() where possible. This is because
  checking for __GFP_WAIT as was done historically now can trigger false
  positives. Some exceptions like dm-crypt.c exist where the code intent
  is clearer if __GFP_DIRECT_RECLAIM is used instead of the helper due to
  flag manipulations.

o Callers that built their own GFP flags instead of starting with GFP_KERNEL
  and friends now also need to specify __GFP_KSWAPD_RECLAIM.

The first key hazard to watch out for is callers that removed __GFP_WAIT
and was depending on access to atomic reserves for inconspicuous reasons.
In some cases it may be appropriate for them to use __GFP_HIGH.

The second key hazard is callers that assembled their own combination of
GFP flags instead of starting with something like GFP_KERNEL.  They may
now wish to specify __GFP_KSWAPD_RECLAIM.  It's almost certainly harmless
if it's missed in most cases as other activity will wake kswapd.

Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Christoph Lameter <cl@linux.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Vitaly Wool <vitalywool@gmail.com>
Cc: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-11-06 17:50:42 -08:00
Linus Torvalds 75f5db39ff spi: Updates for v4.4
Quite a lot of activity in SPI this cycle, almost all of it in drivers
 with a few minor improvements and tweaks in the core.
 
  - Updates to pxa2xx to support Intel Broxton and multiple chip selects.
  - Support for big endian in the bcm63xx driver.
  - Multiple slave support for the mt8173
  - New driver for the auxiliary SPI controller in bcm2835 SoCs.
  - Support for Layerscale SoCs in the Freescale DSPI driver.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJWOehzAAoJECTWi3JdVIfQTPYH+wYMDG8gAIw2s0AJ4DvVe4qZ
 sOAm1UgUJZxssrEA6BNqbfM0dfRo+oQJKmRd0Dc5n7LEMsYHdI/5yKHk8PCS6ZzD
 iQyQCzbd0thDAqwuPaMP62cyPDHwyJX22VGTsgVnj6AZqAQ+9+g4SPKhFnm1Mlm4
 hmDi6fdSrsqo8k8gkpVN8RFOfVsjAV1dLtAauQRWDHrqMxXURSrKG76eqAqUa5bn
 BLPXBoj5PA0DMLPO2j+ADZwWN723LrI2mSSlc+ThjEX/OIt2OhAoiOTV5RPqaafy
 TIsCkh68q/gYAsL5HtvvmgZByl41FLYiO0Z+rXmWUyMMbnvhZTLws9S2BNpBLuk=
 =DgXG
 -----END PGP SIGNATURE-----

Merge tag 'spi-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi updates from Mark Brown:
 "Quite a lot of activity in SPI this cycle, almost all of it in drivers
  with a few minor improvements and tweaks in the core.

   - Updates to pxa2xx to support Intel Broxton and multiple chip selects.
   - Support for big endian in the bcm63xx driver.
   - Multiple slave support for the mt8173
   - New driver for the auxiliary SPI controller in bcm2835 SoCs.
   - Support for Layerscale SoCs in the Freescale DSPI driver"

* tag 'spi-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (87 commits)
  spi: pxa2xx: Rework self-initiated platform data creation for non-ACPI
  spi: pxa2xx: Add support for Intel Broxton
  spi: pxa2xx: Detect number of enabled Intel LPSS SPI chip select signals
  spi: pxa2xx: Add output control for multiple Intel LPSS chip selects
  spi: pxa2xx: Use LPSS prefix for defines that are Intel LPSS specific
  spi: Add DSPI support for layerscape family
  spi: ti-qspi: improve ->remove() callback
  spi/spi-xilinx: Fix race condition on last word read
  spi: Drop owner assignment from spi_drivers
  spi: Add THIS_MODULE to spi_driver in SPI core
  spi: Setup the master controller driver before setting the chipselect
  spi: dw: replace magic constant by DW_SPI_DR
  spi: mediatek: mt8173 spi multiple devices support
  spi: mediatek: handle controller_data in mtk_spi_setup
  spi: mediatek: remove mtk_spi_config
  spi: mediatek: Update document devicetree bindings to support multiple devices
  spi: fix kernel-doc warnings about missing return desc in spi.c
  spi: fix kernel-doc warnings about missing return desc in spi.h
  spi: pxa2xx: Align a few defines
  spi: pxa2xx: Save other reg_cs_ctrl bits when configuring chip select
  ...
2015-11-05 13:15:12 -08:00
Linus Torvalds b037865754 media updates for v4.4-rc1
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWOJZoAAoJEAhfPr2O5OEVmjYP/0RnfVjvRDtx0RxHDmvsowlt
 sHyrm5C7VME06b4J3O9qpC7PbMCAalvSkYp+bbxF+b//9EfwjvRER+NR8ebgn1Mw
 1NQKMtCusWRf4RzI+9osB3pFYgg/cYG2nKl0QVCXHL6xZszEQ9dBrFHEEHfVe8db
 JU1fGuF6TQNJdYgsVNMN9rStRB0vj3urfehLjB+E138VzDAnzPNA7I7Z4xsWWJw3
 V+J7CWLN1xW9IT59LXtRjbD/aCF9KrAmGigS0nCtDz7XVRPh+ZoXQLD073uLP2L3
 uYxOmadvc5+5iVwUP4zSsJ6+vw9kLr6Q30sNtLP7V+VkCSlCQNTOePLavB5T8qVY
 M2qALvwWjujtoSEjZHr7TqrlEpio98OSy1dNJ8GmuOb3UUAKocNN8sGG8h2nR/BR
 wv2OL/XPNcyB2LV6HeHZz9JiXB+rTbyXEN8CP2cD8ruGhNM5haak3d2l4FYszRXr
 /a/5JlYAcNrJii6PAXHyBtm6l0C4GPiAk3HQhII2fTErRr8fpln/G5AfaKjun5H8
 1Rbxx5JP+5qSHozmz2hNb4w92qqtPugj7qqu7sHCbwKLhh2Aspwo12GkN9acOIsI
 Kn1U/DWMRrkyptJAxBihsrEX3BXeQdNOPydKfMYEM7qE8EfTDM0uaIFQ+KVWCmNA
 Qh2TXAp6CZiuBvaqKzyl
 =sR0p
 -----END PGP SIGNATURE-----

Merge tag 'media/v4.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull media updates from Mauro Carvalho Chehab:
 "Media updates, including:

   - Lots of improvements at the kABI documentation
   - Split of Videobuf2 into a common part and a V4L2 specific one
   - Split of the VB2 tracing events into a separate header file
   - s5p-mfc got support for Exynos 5433
   - v4l2 fixes for 64-bits alignment when running 32 bits userspace
     on ARM
   - Added support for SDR radio transmitter at core, vivid and hackrf
     drivers
   - Some y2038 fixups
   - Some improvements at V4L2 colorspace support
   - saa7164 converted to use the V4L2 core control framework
   - several new boards additions, cleanups and fixups

  PS: There are two patches for scripts/kernel-doc that are needed by
  the documentation patches on Media.  Jon is OK on merging those via
  my tree"

* tag 'media/v4.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (146 commits)
  [media] c8sectpfe: Remove select on CONFIG_FW_LOADER_USER_HELPER_FALLBACK
  [media] DocBook media: update copyright/version numbers
  [media] ivtv: Convert to get_user_pages_unlocked()
  [media] media/v4l2-ctrls: fix setting autocluster to manual with VIDIOC_S_CTRL
  [media] DocBook media: Fix a typo in encoder cmd
  [media] DocBook: add SDR specific info to G_MODULATOR / S_MODULATOR
  [media] DocBook: add SDR specific info to G_TUNER / S_TUNER
  [media] hackrf: do not set human readable name for formats
  [media] hackrf: add support for transmitter
  [media] hackrf: switch to single function which configures everything
  [media] hackrf: add control for RF amplifier
  [media] DocBook: add modulator type field
  [media] v4l: add type field to v4l2_modulator struct
  [media] DocBook: document SDR transmitter
  [media] v4l2: add support for SDR transmitter
  [media] DocBook: document tuner RF gain control
  [media] v4l2: add RF gain control
  [media] v4l2: rename V4L2_TUNER_ADC to V4L2_TUNER_SDR
  [media] media/vivid-osd: fix info leak in ioctl
  [media] media: videobuf2: Move v4l2-specific stuff to videobuf2-v4l2
  ...
2015-11-05 12:05:15 -08:00
Mark Brown 4c84518523 Merge remote-tracking branches 'spi/topic/omap-100k', 'spi/topic/omap-uwire', 'spi/topic/owner', 'spi/topic/pxa' and 'spi/topic/pxa2xx' into spi-next 2015-11-04 11:02:12 +00:00
Andrew F. Davis 3821a065f5 spi: Drop owner assignment from spi_drivers
An spi_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-28 10:30:17 +09:00
Antti Palosaari 56ea37da3b [media] m88ds3103: use own reg update_bits() implementation
Device stopped to tuning some channels after regmap conversion.
Reason is that regmap_update_bits() works a bit differently for
partially volatile registers than old homemade routine. Return
back to old routine in order to fix issue.

Fixes: 478932b160

Cc: <stable@kernel.org> # 4.2+
Reported-by: Mark Clarkstone <hello@markclarkstone.co.uk>
Tested-by: Mark Clarkstone <hello@markclarkstone.co.uk>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-22 15:48:28 -02:00
Antti Palosaari d18ca5b7ce [media] rtl28xxu: fix control message flaws
Add lock to prevent concurrent access for control message as control
message function uses shared buffer. Without the lock there may be
remote control polling which messes the buffer causing IO errors.
Increase buffer size and add check for maximum supported message
length.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=103391
Fixes: c56222a6b2 ("[media] rtl28xxu: move usb buffers to state")

Cc: <stable@vger.kernel.org> # 4.0+
Signed-off-by: Antti Palosaari <crope@iki.fi>
2015-10-22 15:48:27 -02:00
Jacek Anaszewski 17f3882203 [media] v4l2-flash-led-class: Add missing VIDEO_V4L2 Kconfig dependency
Fixes the following randconfig problem:

drivers/built-in.o: In function `v4l2_flash_release':
(.text+0x12204f): undefined reference to `v4l2_async_unregister_subdev'
drivers/built-in.o: In function `v4l2_flash_release':
(.text+0x122057): undefined reference to `v4l2_ctrl_handler_free'
drivers/built-in.o: In function `v4l2_flash_close':
v4l2-flash-led-class.c:(.text+0x12208f): undefined reference to `v4l2_fh_is_singular'
v4l2-flash-led-class.c:(.text+0x1220c8): undefined reference to `__v4l2_ctrl_s_ctrl'
drivers/built-in.o: In function `v4l2_flash_open':
v4l2-flash-led-class.c:(.text+0x12227f): undefined reference to `v4l2_fh_is_singular'
drivers/built-in.o: In function `v4l2_flash_init_controls':
v4l2-flash-led-class.c:(.text+0x12274e): undefined reference to `v4l2_ctrl_handler_init_class'
v4l2-flash-led-class.c:(.text+0x122797): undefined reference to `v4l2_ctrl_new_std_menu'
v4l2-flash-led-class.c:(.text+0x1227e0): undefined reference to `v4l2_ctrl_new_std'
v4l2-flash-led-class.c:(.text+0x122826): undefined reference to `v4l2_ctrl_handler_setup'
v4l2-flash-led-class.c:(.text+0x122839): undefined reference to `v4l2_ctrl_handler_free'
drivers/built-in.o: In function `v4l2_flash_init':
(.text+0x1228e2): undefined reference to `v4l2_subdev_init'
drivers/built-in.o: In function `v4l2_flash_init':
(.text+0x12293b): undefined reference to `v4l2_async_register_subdev'
drivers/built-in.o: In function `v4l2_flash_init':
(.text+0x122949): undefined reference to `v4l2_ctrl_handler_free'
drivers/built-in.o:(.rodata+0x20ef8): undefined reference to `v4l2_subdev_queryctrl'
drivers/built-in.o:(.rodata+0x20f10): undefined reference to `v4l2_subdev_querymenu'

Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Cc: Sakari Ailus <sakari.ailus@iki.fi>
Cc: Hans Verkuil <hans.verkuil@cisco.com>
2015-10-22 15:48:27 -02:00
Abylay Ospan 9d2b064c0a [media] netup_unidvb: fix potential crash when spi is NULL
Signed-off-by: Abylay Ospan <aospan@netup.ru>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-22 15:48:26 -02:00
Laura Abbott 47810b4341 [media] si2168: Bounds check firmware
When reading the firmware and sending commands, the length must
be bounds checked to avoid overrunning the size of the command
buffer and smashing the stack if the firmware is not in the expected
format:

si2168 11-0064: found a 'Silicon Labs Si2168-B40'
si2168 11-0064: downloading firmware from file 'dvb-demod-si2168-b40-01.fw'
si2168 11-0064: firmware download failed -95
Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ffffffffa085708f

Add the proper check.

Cc: stable@kernel.org
Reported-by: Stuart Auchterlonie <sauchter@redhat.com>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-22 15:48:25 -02:00
Laura Abbott a828d72df2 [media] si2157: Bounds check firmware
When reading the firmware and sending commands, the length
must be bounds checked to avoid overrunning the size of the command
buffer and smashing the stack if the firmware is not in the
expected format. Add the proper check.

Cc: stable@kernel.org
Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-22 15:48:25 -02:00
Sudeep Holla 54bec3970c [media] ir-hix5hd2: drop the use of IRQF_NO_SUSPEND
This driver doesn't claim the IR transmitter to be wakeup source. It
even disables the clock and the IR during suspend-resume cycle.

This patch removes yet another misuse of IRQF_NO_SUSPEND.

Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Guoxiong Yan <yanguoxiong@huawei.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Acked-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-22 15:48:24 -02:00
Sudip Mukherjee 51a3ac5f4d [media] c8sectpfe: fix return of garbage
The variable err was never initialized, that means we had been checking
a garbage value in the for loop. Moreover if the segment is not outside
the firmware file then also we have been returning the garbage.
Initialize it to 0 so that on success we return the value and no need to
check in the for loop also as it is initially 0 and whenever that value
changes we have done a break from the loop.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-22 15:48:24 -02:00
Colin Ian King bf447221a8 [media] c8sectpfe: fix ininitialized error return on firmware load failure
static analysis with cppcheck detected the following error:

[drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c:1210]:
  (error) Uninitialized variable: ret

ret is never initialised, so garbage is being returned. Instead
return the error return from the call of request_firmware_nowait

Signed-off-by: Colin Ian King <colin.king@canonical.com>
2015-10-22 15:48:23 -02:00
Javier Martinez Canillas a9c4e5cfeb [media] lnbh25: Fix lnbh25_attach() function return type
If CONFIG_DVB_LNBH25 is disabled, a stub static inline function is
defined that just prints a warning about the driver being disabled
but the function return type was wrong which caused a build error.

Fixes: e025273b86 ("[media] lnbh25: LNBH25 SEC controller driver")

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
2015-10-22 15:48:22 -02:00
Javier Martinez Canillas ebdd4b7e6a [media] horus3a: Fix horus3a_attach() function parameters
If CONFIG_DVB_HORUS3A is disabled a stub static inline function is
defined that just prints a warning about the driver being disabled
but the function parameters were wrong which caused a build error.

Fixes: a5d32b3582 ("[media] horus3a: Sony Horus3A DVB-S/S2 tuner driver")

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
2015-10-22 15:48:22 -02:00
Takashi Iwai 79f5b6ae96 [media] c8sectpfe: Remove select on CONFIG_FW_LOADER_USER_HELPER_FALLBACK
c8sectpfe driver selects CONFIG_FW_LOADER_USER_HELPER_FALLBACK by some
reason, but this option is known to be harmful, leading to minutes of
stalls at boot time.  The option was intended for only compatibility
for an old exotic system that mandates the udev interaction, and not a
thing a driver selects by itself.  Let's remove it.

Fixes: 850a3f7d59 ('[media] c8sectpfe: Add Kconfig and Makefile for the driver')

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-20 16:02:41 -02:00
Jan Kara 520e82d44b [media] ivtv: Convert to get_user_pages_unlocked()
Convert ivtv_yuv_prep_user_dma() to use get_user_pages_unlocked() so
that we don't unnecessarily leak knowledge about mm locking into drivers
code.

CC: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 15:59:01 -02:00
Antonio Ospite 759b26a1d9 [media] media/v4l2-ctrls: fix setting autocluster to manual with VIDIOC_S_CTRL
Since commit 5d0360a4f0 it's not possible
anymore to set auto clusters from auto to manual using VIDIOC_S_CTRL.

For example, setting autogain to manual with gspca/ov534 driver and this
sequence of commands does not work:

  v4l2-ctl --set-ctrl=gain_automatic=1
  v4l2-ctl --list-ctrls | grep gain_automatic
  # The following does not work
  v4l2-ctl --set-ctrl=gain_automatic=0
  v4l2-ctl --list-ctrls | grep gain_automatic

Changing the value using VIDIOC_S_EXT_CTRLS (like qv4l2 does) works
fine.

The apparent cause by looking at the changes in 5d0360a and comparing
with the code path for VIDIOC_S_EXT_CTRLS seems to be that the code in
v4l2-ctrls.c::set_ctrl() is not calling user_to_new() anymore after
calling update_from_auto_cluster(master).

However the root cause of the problem is that calling
update_from_auto_cluster(master) overrides also the _master_ control
state calling cur_to_new() while it was supposed to only update the
volatile controls.

Calling user_to_new() after update_from_auto_cluster(master) was just
masking the original bug by restoring the correct new value of the
master control before making the changes permanent.

Fix the original bug by making update_from_auto_cluster() not override
the new master control value.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Cc: <stable@vger.kernel.org>      # for v3.17 and up
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 15:58:29 -02:00
Antti Palosaari 36c6326c5c [media] hackrf: do not set human readable name for formats
Format names are set by core nowadays. Remove name from driver.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 15:55:28 -02:00
Antti Palosaari 8bc4a9ed85 [media] hackrf: add support for transmitter
HackRF SDR device has both receiver and transmitter. There is limitation
that receiver and transmitter cannot be used at the same time
(half-duplex operation). That patch implements transmitter support to
existing receiver only driver.

Signed-off-by: Antti Palosaari <crope@iki.fi>
[hans.verkuil@cisco.com: fix krobot unused variable warning]
[hans.verkuil@cisco.com: add back s_modulator from PATCHv4]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 15:55:03 -02:00
Antti Palosaari eec20f0654 [media] hackrf: switch to single function which configures everything
Implement single funtion, hackrf_set_params(), which handles all
needed settings. Controls and other IOCTLs are just wrappers to that
function. That way we can get easily better control what we could do
on different device states - sleeping, receiving, transmitting.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 15:53:49 -02:00
Antti Palosaari b3ae29667e [media] hackrf: add control for RF amplifier
There is Avago MGA-81563 amplifier just right after antenna connector.
It could be turned on/off and its gain is around 12dB.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 15:52:26 -02:00
Antti Palosaari 4124a3c4ab [media] v4l: add type field to v4l2_modulator struct
Add type field to that struct like it counterpart v4l2_tuner
already has. We need type field to distinguish different tuner
types from each others for transmitter too.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 15:42:47 -02:00
Antti Palosaari 9effc72fd7 [media] v4l2: add support for SDR transmitter
New IOCTL ops:
vidioc_enum_fmt_sdr_out
vidioc_g_fmt_sdr_out
vidioc_s_fmt_sdr_out
vidioc_try_fmt_sdr_out

New vb2 buffertype:
V4L2_BUF_TYPE_SDR_OUTPUT

New v4l2 capability:
V4L2_CAP_SDR_OUTPUT

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 15:40:50 -02:00
Antti Palosaari 41018cb84a [media] v4l2: add RF gain control
Add new RF tuner gain control named RF Gain. That is aimed for first
amplifier chip right after antenna connector.
There is existing LNA Gain control, which is quite same, but it is
aimed for cases amplifier is integrated to tuner chip. Some designs
have both, as almost all recent tuner silicons has integrated LNA/RF
amplifier in any case.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 15:37:56 -02:00
Antti Palosaari f3c3ecec97 [media] v4l2: rename V4L2_TUNER_ADC to V4L2_TUNER_SDR
SDR receiver has ADC (Analog-to-Digital Converter) and SDR transmitter
has DAC (Digital-to-Analog Converter). Originally I though it could
be good idea to have own type for receiver and transmitter, but now I
feel one common type for SDR is enough. So lets rename it.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Acked-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
[hans.verkuil@cisco.com: this was added in 4.4, so update 4.2 to 4.4]

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 15:35:48 -02:00
Salva Peiró eda98796af [media] media/vivid-osd: fix info leak in ioctl
The vivid_fb_ioctl() code fails to initialize the 16 _reserved bytes of
struct fb_vblank after the ->hcount member. Add an explicit
memset(0) before filling the structure to avoid the info leak.

Signed-off-by: Salva Peiró <speirofr@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 15:34:29 -02:00
Junghak Sung 3c5be988e0 [media] media: videobuf2: Move v4l2-specific stuff to videobuf2-v4l2
Move v4l2-specific stuff from videobu2-core to videobuf2-v4l2
without doing any functional changes.

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 15:14:28 -02:00
Junghak Sung b0e0e1f83d [media] media: videobuf2: Prepare to divide videobuf2
Prepare to divide videobuf2
- Separate vb2 trace events from v4l2 trace event.
- Make wrapper functions that will move to v4l2-side.
- Make vb2_core_* functions that will remain in core-side.
- Add a callback function table for buffer operation which makes vb2-core
  to be able to invoke a v4l2-side functions.
- Rename internal functions as vb2_*.

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 15:12:45 -02:00
Junghak Sung bed04f9342 [media] media: videobuf2: Replace v4l2-specific data with vb2 data
Simple changes that replace v4l2-specific data with vb2 data
in videobuf2-core.

enum v4l2_buf_type --> int
enum v4l2_memory --> enum vb2_memory
VIDEO_MAX_FRAME --> VB2_MAX_FRAME
VIDEO_MAX_PLANES --> VB2_MAX_PLANES
struct v4l2_fh *owner --> void *owner
V4L2_TYPE_IS_MULTIPLANAR() --> is_multiplanar
V4L2_TYPE_IS_OUTPUT() --> is_output

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 14:49:39 -02:00
Junghak Sung 33119e80c3 [media] media: videobuf2: Change queue_setup argument
Replace struct v4l2_format * with void * to make queue_setup()
for common use.
And then, modify all device drivers related with this change.

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
[hans.verkuil@cisco.com: fix missing const in fimc-lite.c]

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 14:48:39 -02:00
Andrzej Hajda 4d0b0ed636 [media] s5p-mfc: use MFC_BUF_FLAG_EOS to identify last buffers in decoder capture queue
MFC driver never delivered EOS event to apps feeding constantly its capture
buffer with fresh buffers. The patch fixes it by marking last buffers
returned by MFC with MFC_BUF_FLAG_EOS flag and firing EOS event on
de-queuing such buffers.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 14:40:16 -02:00
Andrzej Hajda 96c57776cd [media] s5p-mfc: end-of-stream handling for newer encoders
MFC encoder supports end-of-stream handling for encoder
in version 5 of hardware. This patch adds it also for newer version.
It was successfully tested on MFC-v8.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 14:39:45 -02:00
Ingi Kim f6375eafeb [media] s5p-mfc: fix spelling errors
This patch fixes spelling errors in mfc encoder.
inavild -> invaild

Signed-off-by: Ingi Kim <ingi2.kim@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 14:37:54 -02:00
Tiffany Lin 418dae2276 [media] media: vb2 dma-sg: Fully cache synchronise buffers in prepare and finish
In videobuf2 dma-sg memory types the prepare and finish ops, instead
of passing the number of entries in the original scatterlist as the
"nents" parameter to dma_sync_sg_for_device() and dma_sync_sg_for_cpu(),
the value returned by dma_map_sg() was used. Albeit this has been
suggested in comments of some implementations (which have since been
corrected), this is wrong.

Fixes: d790b7eda9 ("vb2-dma-sg: move dma_(un)map_sg here")

Cc: stable@vger.kernel.org # for v3.19 and up
Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 14:36:24 -02:00
Tiffany Lin d9a985883f [media] media: vb2 dma-contig: Fully cache synchronise buffers in prepare and finish
In videobuf2 dma-contig memory type the prepare and finish ops, instead of
passing the number of entries in the original scatterlist as the "nents"
parameter to dma_sync_sg_for_device() and dma_sync_sg_for_cpu(), the value
returned by dma_map_sg() was used. Albeit this has been suggested in
comments of some implementations (which have since been corrected), this
is wrong.

Fixes: 199d101efd ("v4l: vb2-dma-contig: add prepare/finish to dma-contig allocator")

Cc: stable@vger.kernel.org # for v3.8 and up
Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 14:35:52 -02:00
Javier Martinez Canillas f06d89028b [media] smiapp: Export OF module alias information
The I2C core always reports the MODALIAS uevent as "i2c:<client name"
regardless if the driver was matched using the I2C id_table or the
of_match_table. So technically there's no need for a driver to export
the OF table since currently it's not used.

In fact, the I2C device ID table is mandatory for I2C drivers since
a i2c_device_id is passed to the driver's probe function even if the
I2C core used the OF table to match the driver.

And since the I2C core uses different tables, OF-only drivers needs to
have duplicated data that has to be kept in sync and also the dev node
compatible manufacturer prefix is stripped when reporting the MODALIAS.

To avoid the above, the I2C core behavior may be changed in the future
to not require an I2C device table for OF-only drivers and report the
OF module alias. So, it's better to also export the OF table to prevent
breaking module autoloading if that happens.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 14:32:05 -02:00
Mauro Carvalho Chehab 9be91db2ef [media] demux.h: Convert MPEG-TS demux caps to an enum
While we can't document #defines, documenting enums are
well supported by kernel-doc. So, convert the bitmap defines
into an enum.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-10 10:29:08 -03:00
Mauro Carvalho Chehab 0e6f2d1533 [media] demux.h: Convert TS filter type into enum
The usage of #define at the kABI is fine, but it doesn't
allow adding a proper description. As those defines deserve
a proper documentation, let's convert them into an enum and
document them at device-drivers DocBook.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-10 10:29:07 -03:00
Mauro Carvalho Chehab 4be45fb467 [media] DocBook: document typedef dmx_section_cb at demux.h
The dvb/kdapi.tmpl has already an extensive documentation about
this callback. Now that we've added function typedefs at kernel-doc,
add such documentation at demux.h, for it to appear at device-drivers
DocBook.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-10 10:29:07 -03:00
Mauro Carvalho Chehab 0cf35e8420 [media] DocBook: document typedef dmx_ts_cb at demux.h
The dvb/kdapi.tmpl has already an extensive documentation about
this callback. Now that we've added function typedefs at kernel-doc,
add such documentation at demux.h, for it to appear at device-drivers
DocBook.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-10 10:29:06 -03:00
Mauro Carvalho Chehab abfc97f722 [media] demux.h: make checkpatch.ph happy
There are lots of CodingStyle violations here. Now that we're
touching a log on this header files, adding the documentation
here, make sure that this will follow the Kernel CodingStyle.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-10 10:29:04 -03:00
Mauro Carvalho Chehab 548e5ae0bd [media] DocBook: document the other structs/enums of demux.h
Document the following data types:
	struct dmx_ts_feed
	struct dmx_section_filter
	struct dmx_section_feed
	enum dmx_frontend_source
	struct dmx_frontend

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-10 10:29:04 -03:00
Mauro Carvalho Chehab 0693bdf754 [media] dvb: Remove unused frontend sources at demux.h and sync doc
The DVB core has a provision for other frontend sources, but no
drivers use it. The kdapi.xml contains provision for some other
frontend source types, but it is not in sync with the code.

So, remove the unused types and sync both files.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-07 15:57:58 -03:00
Mauro Carvalho Chehab 2f684b239c [media] dvb: get rid of enum dmx_success
This enum is not actually used anymore. The only value used from
the enum is DMX_OK, passed as a parameter on two callbacks.

Yet, this value is not used anywhere. So, just remove it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-06 19:53:02 -03:00
Mauro Carvalho Chehab 4bc645df7d [media] DocBook: finish documenting struct dmx_demux
There are two callbacks still not documented:
	.//drivers/media/dvb-core/demux.h:422: warning: No description found for parameter 'get_pes_pids'
	.//drivers/media/dvb-core/demux.h:422: warning: No description found for parameter 'get_stc'

The purpose of first one is clear. The second one is used only
on the obsolete av7110 driver, and its purpose is not clear,
as it just returns a 64-bit word from the firmware to userspace.

Let's document get_pes_pids and mark get_stc as private, adding
a comment to not use it, while this is not documented.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-06 18:53:10 -03:00
Mauro Carvalho Chehab 1e92bbe08a [media] dvb: don't keep support for undocumented features
There are two DVB demux callbacks and ioctls that aren't documented
and aren't used at all by the DVB core or by any DVB driver upstream.

Let's comment out the code for those two ioctls and remove on some
future version.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-06 18:49:37 -03:00
Mauro Carvalho Chehab 28cff82ce2 [media] DocBook: update documented fields at struct dmx_demux
There are a few inconsistencies between the old documentation
that got imported into the header and the current status.

Update them, and use the proper doc-nano nomenclature for
struct artuments "@", instead of foo().

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-06 18:40:02 -03:00
Mauro Carvalho Chehab 95abfdb942 [media] DocBook: Move struct dmx_demux kABI doc to demux.h
The DocBook/media/dvb/kdapi.xml contains the description of
the kABI for DVB. The problem is that, by being maintained
on a separate file and not being updated for years, it got
outdated. So, for example, some callback parameters were
changed, but the DocBook were still using the old stuff.

As a first step to fix it, let's move the documentation of
struct dmx_demux into demux.h and fix the parameters used
there.

For now, don't document any other field nor touch the
descriptions that got moved, letting this job to other
patches. That makes easier to review the patch.

PS.: Please notice that an additional patch will be needed
in order to fix the return values (some uses non-existent
return codes) and to the functions and callbacks mentioned at
the descriptions.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-06 18:40:02 -03:00
Mauro Carvalho Chehab bdbbf13e04 [media] dvb_ca_en50221.h: Make checkpatch.pl happy
There are several CodingStyle violations at the DVB code. While
we won't be fixing them as a hole, let's fix at least the
headers, as we're touching on them already in order to properly
document them.

No functional changes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-06 18:40:01 -03:00
Mauro Carvalho Chehab d7061f836f [media] DocBook: document struct dvb_ca_en50221
This struct is already documented at the header file, but it is
not using Kernel doc-nano format. Convert to it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-06 18:40:01 -03:00
Rasmus Villemoes f4f24d1fd0 [media] drxd: use kzalloc in drxd_attach()
This saves a little .text and removes the sizeof(...) style
inconsistency. Use sizeof(*state) in accordance with CodingStyle.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-03 11:44:32 -03:00
Fengguang Wu edf8875f21 [media] i2c: fix platform_no_drv_owner.cocci warnings
drivers/media/i2c/ml86v7667.c:430:3-8: No need to set .owner here. The core will do it.

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

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

CC: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-03 11:39:48 -03:00
Ezequiel Garcia 6903acde49 [media] vivid: Add an option to configure the maximum number of devices
The vivid driver currently has a hard-coded limit of 64 devices,
however there's nothing that prevents the creation of even more devices.
This commit adds a new driver option (which defaults to 64) to
allow this maximum number to be configurable.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-03 11:36:24 -03:00
Ezequiel Garcia a5d42b8c3b [media] vivid: Fix iteration in driver removal path
When the diver is removed and all the resources are deallocated,
we should be iterating through the created devices only.

Currently, the iteration ends when vivid_devs[i] is NULL. Since
the array contains VIVID_MAX_DEVS elements, it will oops if
n_devs=VIVID_MAX_DEVS because in that case, no element is NULL.

Fixes: c88a96b023 ('[media] vivid: add core driver code')

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-03 11:35:44 -03:00
Andrzej Hajda d2d04834d9 [media] media: am437x-vpfe: fix handling platform_get_irq result
The function can return negative value.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-03 11:34:52 -03:00
Andrzej Hajda e54560d963 [media] cx231xx: fix handling cx231xx_read_i2c_data result
The function can return negative value.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-03 11:32:32 -03:00
Erik Andresen 2788052a8a [media] Add Terratec H7 Revision 4 to DVBSky driver
Adds Terratec H7 Rev. 4 with USB id 0ccd:10a5 to DVBSky driver.

Signed-off-by: Erik Andresen <erik@vontaene.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-03 11:08:12 -03:00
Geert Uytterhoeven f84456466c [media] VIDEO_RENESAS_JPU should depend on HAS_DMA
If NO_DMA=y:

    warning: (VIDEO_STI_BDISP && VIDEO_RENESAS_JPU && VIDEO_DM365_VPFE && 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_RENESAS_JPU selects VIDEOBUF2_DMA_CONTIG, which bypasses its
dependency on HAS_DMA.  Make VIDEO_RENESAS_JPU depend on HAS_DMA to fix
this.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-03 10:01:48 -03:00
Graham Eccleston 702c287082 [media] Compro U650F support
Added Compro U650F to the rtl28xxu devices.

Signed-off-by: Graham Eccleston <grahameccleston_@hotmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-03 09:36:55 -03:00
Mauro Carvalho Chehab 996347612d [media] rcar_jpu: Fix namespace for two __be16 vars
Fixes those sparse warnings:
	drivers/media/platform/rcar_jpu.c:1150:51: warning: incorrect type in assignment (different base types)
	drivers/media/platform/rcar_jpu.c:1150:51:    expected unsigned short [unsigned] [short] [usertype] <noident>
	drivers/media/platform/rcar_jpu.c:1150:51:    got restricted __be16 [usertype] <noident>
	drivers/media/platform/rcar_jpu.c:1152:50: warning: incorrect type in assignment (different base types)
	drivers/media/platform/rcar_jpu.c:1152:50:    expected unsigned short [unsigned] [short] [usertype] <noident>
	drivers/media/platform/rcar_jpu.c:1152:50:    got restricted __be16 [usertype] <noident>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 19:10:55 -03:00
Mauro Carvalho Chehab 5347f97c65 [media] c8sectpfe: fix namespace on memcpy/memset
Solves those sparse warnings:

drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c:1087:9: warning: incorrect type in argument 1 (different address spaces)
drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c:1087:9:    expected void *<noident>
drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c:1087:9:    got void [noderef] <asn:2>*<noident>
drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c:1090:9: warning: incorrect type in argument 1 (different address spaces)
drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c:1090:9:    expected void *<noident>
drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c:1090:9:    got void [noderef] <asn:2>*

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 19:07:32 -03:00
Mauro Carvalho Chehab de2ce8fd84 [media] mipi-csis: make sparse happy
Fix the namespace issue that causes this warning:

drivers/media/platform/exynos4-is/mipi-csis.c:709:17: warning: incorrect type in argument 2 (different address spaces)
drivers/media/platform/exynos4-is/mipi-csis.c:709:17:    expected void const *<noident>
drivers/media/platform/exynos4-is/mipi-csis.c:709:17:    got void [noderef] <asn:2>*

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 19:05:46 -03:00
Mauro Carvalho Chehab 340ccedb76 [media] netup_unidvb_ci: Fix dereference of noderef expression
Fix those sparse warnings:
	drivers/media/pci/netup_unidvb/netup_unidvb_ci.c:150:40: warning: dereference of noderef expression
	drivers/media/pci/netup_unidvb/netup_unidvb_ci.c:165:31: warning: dereference of noderef expression
	drivers/media/pci/netup_unidvb/netup_unidvb_ci.c:174:36: warning: dereference of noderef expression
	drivers/media/pci/netup_unidvb/netup_unidvb_ci.c:189:27: warning: dereference of noderef expression

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 19:02:45 -03:00
Mauro Carvalho Chehab d91b1d912e [media] netup_unidvb: remove most of the sparse warnings
There is a mess at the namespace on netup_unidvb:

drivers/media/pci/netup_unidvb/netup_unidvb_core.c:192:41: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:192:41:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:192:41:    got restricted __le32 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:194:26: warning: cast removes address space of expression
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:194:26: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:194:26:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:194:26:    got unsigned short [usertype] *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:196:41: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:196:41:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:196:41:    got restricted __le32 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:198:26: warning: cast removes address space of expression
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:198:26: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:198:26:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:198:26:    got unsigned short [usertype] *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:210:37: warning: incorrect type in argument 1 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:210:37:    expected void const volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:210:37:    got restricted __le32 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:211:32: warning: incorrect type in argument 1 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:211:32:    expected void const volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:211:32:    got restricted __le32 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:213:33: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:213:33:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:213:33:    got restricted __le32 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:528:49: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:528:49:    expected void const volatile [noderef] <asn:2>*src
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:528:49:    got unsigned char [usertype] *
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:541:49: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:541:49:    expected void const volatile [noderef] <asn:2>*src
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:541:49:    got unsigned char [usertype] *
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:647:22: warning: incorrect type in argument 1 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:647:22:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:647:22:    got unsigned char [usertype] *addr_virt
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:650:22: warning: cast removes address space of expression
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:654:59: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:654:59:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:654:59:    got restricted __le32 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:655:56: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:655:56:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:655:56:    got restricted __le32 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:656:23: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:656:23:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:656:23:    got restricted __le32 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:658:31: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:658:31:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:658:31:    got restricted __le32 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:660:33: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:660:33:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_core.c:660:33:    got restricted __le32 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:81:25: warning: incorrect type in argument 1 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:81:25:    expected void const volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:81:25:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:82:38: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:82:38:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:82:38:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:104:33: warning: incorrect type in argument 1 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:104:33:    expected void const volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:104:33:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:105:47: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:105:47:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:105:47:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:112:33: warning: incorrect type in argument 1 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:112:33:    expected void const volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:112:33:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:113:47: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:113:47:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:113:47:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:132:36: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:132:36:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:132:36:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:133:32: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:133:32:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:133:32:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:134:32: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:134:32:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:134:32:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:135:32: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:135:32:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:135:32:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:136:27: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:136:27:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:136:27:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:137:27: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:137:27:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:137:27:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:144:28: warning: incorrect type in argument 1 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:144:28:    expected void const volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:144:28:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:150:34: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:150:34:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:150:34:    got unsigned char *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:157:34: warning: incorrect type in argument 1 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:157:34:    expected void const volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:157:34:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:158:29: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:158:29:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:158:29:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:165:35: warning: incorrect type in argument 1 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:165:35:    expected void const volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:165:35:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:170:34: warning: incorrect type in argument 1 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:170:34:    expected void const volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:170:34:    got unsigned char *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:181:34: warning: incorrect type in argument 1 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:181:34:    expected void const volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:181:34:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:182:29: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:182:29:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:182:29:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:189:29: warning: incorrect type in argument 1 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:189:29:    expected void const volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:189:29:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:191:37: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:191:37:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:191:37:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:192:35: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:192:35:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:192:35:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:194:21: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:194:21:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:194:21:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:195:9: warning: incorrect type in argument 1 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:195:9:    expected void const volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:195:9:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:195:9: warning: incorrect type in argument 1 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:195:9:    expected void const volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:195:9:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:195:9: warning: incorrect type in argument 1 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:195:9:    expected void const volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:195:9:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:205:47: warning: incorrect type in argument 1 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:205:47:    expected void const volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:205:47:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:206:29: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:206:29:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:206:29:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:272:53: warning: incorrect type in argument 1 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:272:53:    expected void const volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:272:53:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:274:53: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:274:53:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:274:53:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_i2c.c:323:22: warning: cast removes address space of expression
drivers/media/pci/netup_unidvb/netup_unidvb_ci.c:229:38: warning: cast removes address space of expression
drivers/media/pci/netup_unidvb/netup_unidvb_ci.c:229:38: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_ci.c:229:38:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_ci.c:229:38:    got unsigned short [usertype] *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:89:25: warning: incorrect type in argument 1 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:89:25:    expected void const volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:89:25:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:96:46: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:96:46:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:96:46:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:97:25: warning: incorrect type in argument 1 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:97:25:    expected void const volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:97:25:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:98:49: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:98:49:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:98:49:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:116:44: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:116:44:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:116:44:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:117:23: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:117:23:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:117:23:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:132:48: warning: incorrect type in argument 1 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:132:48:    expected void volatile [noderef] <asn:2>*dst
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:132:48:    got unsigned char *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:136:46: warning: incorrect type in argument 1 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:136:46:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:136:46:    got unsigned char *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:144:37: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:144:37:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:144:37:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:145:25: warning: incorrect type in argument 1 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:145:25:    expected void const volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:145:25:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:154:52: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:154:52:    expected void const volatile [noderef] <asn:2>*src
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:154:52:    got unsigned char *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:205:23: warning: cast removes address space of expression
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:206:24: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:206:24:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:206:24:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:243:25: warning: incorrect type in argument 1 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:243:25:    expected void const volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:243:25:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:244:46: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:244:46:    expected void volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:244:46:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:245:25: warning: incorrect type in argument 1 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:245:25:    expected void const volatile [noderef] <asn:2>*addr
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:245:25:    got restricted __le16 *<noident>
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:246:49: warning: incorrect type in argument 2 (different address spaces)
drivers/media/pci/netup_unidvb/netup_unidvb_spi.c:246:49:    expected void volatile [noderef] <asn:2>*addr

Fix the above sparse warnings.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 18:57:35 -03:00
Mauro Carvalho Chehab c84a71c85b [media] s5c73m3: fix a sparse warning
drivers/media/i2c/s5c73m3/s5c73m3-core.c:170:39: warning: incorrect type in argument 1 (different base types)
drivers/media/i2c/s5c73m3/s5c73m3-core.c:170:39:    expected restricted __be16 const [usertype] *p
drivers/media/i2c/s5c73m3/s5c73m3-core.c:170:39:    got unsigned short [usertype] *<noident>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 18:12:39 -03:00
Mauro Carvalho Chehab ef69ee1bc2 [media] media-entity.c: get rid of var length arrays
Fix those sparse warnings:
	drivers/media/media-entity.c:238:17: warning: Variable length array is used.
	drivers/media/media-entity.c:239:17: warning: Variable length array is used.

That allows sparse and other code check tools to verify if the
function is using more stack than allowed.

It also solves a bad Kernel pratice of using var length arrays
at the stack.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 18:10:05 -03:00
Mauro Carvalho Chehab ca739eb086 Revert "[media] rcar_vin: call g_std() instead of querystd()"
As pointed by Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
this patch depends on two adv7180 patches that got rejected.

This reverts commit f00ae754c5.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 15:49:17 -03:00
Mauro Carvalho Chehab 5a11cb1cd4 [media] dvbdev: Remove two cut-and-paste errors
Those two came from dvb_register_adapter cut-and-paste:

	.//drivers/media/dvb-core/dvbdev.h:199: warning: Excess function parameter 'device' description in 'dvb_register_device'
	.//drivers/media/dvb-core/dvbdev.h:199: warning: Excess function parameter 'adapter_nums' description in 'dvb_register_device'

Remove them.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 09:18:09 -03:00
Mauro Carvalho Chehab b0dcc5f612 [media] s5p-jpeg: remove unused var
changeset 6c96dbbc2a added a new function that seems to be
a modified version of an existing function. That's ok, but
it was adding a "word" var from the previous code that it is
not used on the new function. So, remove this left-over.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 09:10:06 -03:00
Junghak Sung 2d7007153f [media] media: videobuf2: Restructure vb2_buffer
Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer.

Add new member variables - bytesused, length, offset, userptr, fd,
data_offset - to struct vb2_plane in order to cover all information
of v4l2_plane.
struct vb2_plane {
        <snip>
        unsigned int            bytesused;
        unsigned int            length;
        union {
                unsigned int    offset;
                unsigned long   userptr;
                int             fd;
        } m;
        unsigned int            data_offset;
}

Replace v4l2_buf with new member variables - index, type, memory - which
are common fields for buffer management.
struct vb2_buffer {
        <snip>
        unsigned int            index;
        unsigned int            type;
        unsigned int            memory;
        unsigned int            num_planes;
        struct vb2_plane        planes[VIDEO_MAX_PLANES];
        <snip>
};

v4l2 specific fields - flags, field, timestamp, timecode,
sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c
struct vb2_v4l2_buffer {
        struct vb2_buffer       vb2_buf;

        __u32                   flags;
        __u32                   field;
        struct timeval          timestamp;
        struct v4l2_timecode    timecode;
        __u32                   sequence;
};

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 09:04:43 -03:00
Junghak Sung c139990e84 [media] media: videobuf2: Replace videobuf2-core with videobuf2-v4l2
Make videobuf2-v4l2 as a wrapper of videobuf2-core for v4l2-use.
And replace videobuf2-core.h with videobuf2-v4l2.h.
This renaming change should be accompanied by the modifications
of all device drivers that include videobuf2-core.h.
It can be done with just running this shell script.

replace()
{
str1=$1
str2=$2
dir=$3
for file in $(find $dir -name *.h -o -name *.c -o -name Makefile)
do
    echo $file
    sed "s/$str1/$str2/g" $file > $file.out
    mv $file.out $file
done
}

replace "videobuf2-core" "videobuf2-v4l2" "include/media/"
replace "videobuf2-core" "videobuf2-v4l2" "drivers/media/"
replace "videobuf2-core" "videobuf2-v4l2" "drivers/usb/gadget/"
replace "videobuf2-core" "videobuf2-v4l2" "drivers/staging/media/"

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:48:18 -03:00
Benoit Parrot a807773405 [media] media: v4l2-ctrls: Fix 64bit support in get_ctrl()
When trying to use v4l2_ctrl_g_ctrl_int64() to retrieve a
V4L2_CTRL_TYPE_INTEGER64 type value the internal helper function
get_ctrl() would prematurely exit because for this control type
the 'is_int' flag is not set. This would result in v4l2_ctrl_g_ctrl_int64
always returning 0.

Also v4l2_ctrl_g_ctrl_int64() is reading and returning the 32bit value
member instead of the 64bit version, so fixing that as well.

This patch extends the condition check to allow the V4L2_CTRL_TYPE_INTEGER64
type to continue processing instead of exiting.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: <stable@vger.kernel.org>      # for v3.17 and up
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:43:41 -03:00
Luis de Bethencourt d275d93590 [media] cx25821, cx88, tm6000: use SNDRV_DEFAULT_ENABLE_PNP
Instead of manually initializing the bool array enable, use the
SNDRV_DEFAULT_ENABLE_PNP macro. As most drivers do.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:42:52 -03:00
Hans Verkuil fc88dd16a0 [media] cobalt: fix Kconfig dependency
The cobalt driver should depend on VIDEO_V4L2_SUBDEV_API.

This fixes this kbuild error:

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   99bc7215bc
commit: 85756a069c [media] cobalt: add new driver
config: x86_64-randconfig-s0-09201514 (attached as .config)
reproduce:
  git checkout 85756a069c
  # save the attached .config to linux build tree
  make ARCH=x86_64

All error/warnings (new ones prefixed by >>):

   drivers/media/i2c/adv7604.c: In function 'adv76xx_get_format':
>> drivers/media/i2c/adv7604.c:1853:9: error: implicit declaration of function 'v4l2_subdev_get_try_format' [-Werror=implicit-function-declaration]
      fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad);
            ^
   drivers/media/i2c/adv7604.c:1853:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
      fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad);
          ^
   drivers/media/i2c/adv7604.c: In function 'adv76xx_set_format':
   drivers/media/i2c/adv7604.c:1882:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
      fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad);
          ^
   cc1: some warnings being treated as errors

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:42:32 -03:00
Javier Martinez Canillas c7d97499cc [media] tvp5150: add support for asynchronous probing
Allow the subdevice to be probed asynchronously.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:42:00 -03:00
Joe Perches f5b5fbd387 [media] s5p-mfc: Correct misuse of %0x<decimal>
Correct misuse of 0x%d in logging message.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:41:29 -03:00
Andrzej Pietrasiewicz 6c96dbbc2a [media] s5p-jpeg: add support for 5433
JPEG IP found in Exynos5433 is similar to what is in Exynos4, but
there are some subtle differences which this patch takes into account.

The most important difference is in what is processed by the JPEG IP and
what has to be provided to it. In case of 5433 the IP does not parse
Huffman and quantisation tables, so this has to be performed with the CPU
and the majority of the code in this patch does that.

A small but important difference is in what address is passed to the JPEG
IP. In case of 5433 it is the SOS (start of scan) position, which is
natural, because the headers must be parsed elsewhere.

There is also a difference in how the hardware is put to work in
device_run.

Data structures are extended as appropriate to accommodate the above
changes.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Reviewed-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:40:04 -03:00
Marek Szyprowski b95a24d6b1 [media] s5p-jpeg: generalize clocks handling
Allow jpeg codec variants declare clocks they need.
Before this patch is applied jpeg-core gets jpeg->sclk
"speculatively": if it is not there, we assume no problem.

This patch eliminates this by explicitly declaring
what clocks are needed for each variant.

This is a preparation for adding Exynos 5433 variant support, which
needs 4 clocks of names not compatible with any previous version of
jpeg hw module.

[Rebase and commit message]

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Reviewed-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:35:08 -03:00
Javier Martinez Canillas 5bcc0dd790 [media] go7007: Fix returned errno code in gen_mjpeghdr_to_package()
The driver is using -1 instead of the -ENOMEM defined macro to specify
that a buffer allocation failed. Since the error number is propagated,
the caller will get a -EPERM which is the wrong error condition.

Also, the smatch tool complains with the following warning:

gen_mjpeghdr_to_package() warn: returning -1 instead of -ENOMEM is sloppy

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:32:52 -03:00
Javier Martinez Canillas 5aa2ccfc37 [media] s5c73m3: Export OF module alias information
The SPI core always reports the MODALIAS uevent as "spi:<modalias>"
regardless of the mechanism that was used to register the device
(i.e: OF or board code) and the table that is used later to match
the driver with the device (i.e: SPI id table or OF match table).

So drivers needs to export the SPI id table and this be built into
the module or udev won't have the necessary information to autoload
the needed driver module when the device is added.

But this means that OF-only drivers needs to have both OF and SPI id
tables that have to be kept in sync and also the dev node compatible
manufacturer prefix is stripped when reporting the MODALIAS. Which can
lead to issues if two vendors use the same SPI device name for example.

To avoid the above, the SPI core behavior may be changed in the future
to not require an SPI device table for OF-only drivers and report the
OF module alias. So, it's better to also export the OF table even when
is unused now to prevent breaking module loading when the core changes.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:32:20 -03:00
Hans Verkuil 35204e2e84 [media] v4l2-ctrls: arrays are also considered compound controls
Array controls weren't skipped when only V4L2_CTRL_FLAG_NEXT_CTRL was
provided (so no V4L2_CTRL_FLAG_NEXT_COMPOUND was set). This is wrong
since arrays are also considered compound controls (i.e. with more than
one value), and applications that do not know about arrays will not
be able to handle such controls.

Fix the test to include arrays.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Cc: <stable@vger.kernel.org>      # for v3.17 and up
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:30:25 -03:00
Arnd Bergmann 5ba0e2c3ad [media] use v4l2_get_timestamp where possible
This is a preparation for a change to the type of v4l2 timestamps.
v4l2_get_timestamp() is a helper function that reads the monotonic
time and stores it into a 'struct timeval'. Multiple drivers implement
the same thing themselves for historic reasons.

Changing them all to use v4l2_get_timestamp() is more consistent
and reduces the amount of code duplication, and most importantly
simplifies the following changes.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
[hans.verkuil@cisco.com: dropped the v4l2-dev.c patch that didn't belong here]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:29:23 -03:00
Arnd Bergmann 2ef3b6fe9e [media] exynos4-is: use monotonic timestamps as advertized
The exynos4 fimc capture driver claims to use monotonic
timestamps but calls ktime_get_real_ts(). This is both
an incorrect API use, and a bad idea because of the y2038
problem and the fact that the wall clock time is not reliable
for timestamps across suspend or settimeofday().

This changes the driver to use the normal v4l2_get_timestamp()
function like all other drivers.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:27:59 -03:00
Sergei Shtylyov 280e87b2e6 [media] ml86v7667: implement g_std() method
The driver was written with the 'soc_camera' use in mind, however the g_std()
video method was forgotten. Implement it at last...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:27:22 -03:00
Hans Verkuil 225b783b38 [media] saa7164: video and vbi ports share the same input/tuner/std
The vbi port should pass any tuner/input/standard information on
to the video port since in the input and tuner are shared between
the two.

There is no reason to duplicate this code, just pass the ioctls on
to the video encoder port.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:26:53 -03:00
Hans Verkuil 6b99612606 [media] saa7164: fix input and tuner compliance problems
- the frequency range was never set
- there was no initial frequency
- missing index/tuner checks
- inconsistent standard reporting
- removed unnecessary tuner type checks (the core handles that)
- clamp frequency to the valid frequency range as per the V4L2 spec

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:25:53 -03:00
Hans Verkuil 4e203f7fdd [media] saa7164: remove unused videobuf references
This driver includes videobuf headers and selects VIDEOBUF_DVB, but
videobuf isn't used at all.

Remove this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:25:06 -03:00
Hans Verkuil 031d229772 [media] saa7164: fix format ioctls
Fix various v4l2-compliance issues in the formatting ioctls:

- the vbi device implemented video format ioctls which make no senses
  for a vbi device, remove them.
- remove the unused ts_packet_size and ts_packet_count fields.
- fill in colorspace and field.
- fill in sizeimage with a default value.
- for the video node the get, set and try format functions all do the
  same thing, so combine into a single function.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:24:40 -03:00
Hans Verkuil 245b5ae95f [media] saa7164: add support for control events
Now that saa7164 uses v4l2_fh and that poll() has been fixed, it is
trivial to add support for control events.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:23:29 -03:00
Hans Verkuil 45053edc05 [media] saa7164: fix poll bugs
- poll doesn't return negative values, so you can't return -EINVAL.
  Instead return POLLERR.
- poll can't be called if !video_is_registered(), so this test can
  be dropped.
- poll can never do a blocking wait, so remove that check.
- poll shouldn't attempt to start streaming if the caller isn't interested
  in read events.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:22:41 -03:00
Hans Verkuil d6d3fe2fe1 [media] saa7164: add v4l2_fh support
Control events require the use of struct v4l2_fh. Add this to saa7164.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:13:58 -03:00
Hans Verkuil 1a708ea013 [media] saa7164: convert to the control framework
Convert this driver to the control framework. Note that the VBI device
nodes have no controls as there is nothing to control.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:13:26 -03:00
Ricardo Ribalda 28c5029275 [media] media/v4l2-compat-ioctl32: Simple stylechecks
The next patches on the series need this modifications to pass clean
checkpath.pl.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 07:51:43 -03:00
Hans Verkuil b96c544f44 [media] vivid: add 10 and 12 bit Bayer formats
Add support for 10 and 12 bit Bayer formats to the test pattern generator
and the vivid driver.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 07:49:45 -03:00
Hans Verkuil d5beb67bc7 [media] v4l2-compat-ioctl32: add missing SDR support
Add the missing support for v4l2_sdr_format (V4L2_BUF_TYPE_SDR_CAPTURE).

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 07:48:35 -03:00
Hans Verkuil d006a9791d [media] vim2m: small cleanup: use assignment instead of memcpy
Use a type-safe assignment instead of memcpy. And it is easier to read as well.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 07:47:33 -03:00
Hans Verkuil c732e647ba [media] vivid: add support for SMPTE 2084 transfer function
Support the new SMPTE 2084 transfer function in the vivid test driver.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-30 19:49:41 -03:00
Hans Verkuil b258480aa7 [media] vivid-tpg: add support for SMPTE 2084 transfer function
Support the new SMPTE 2084 transfer function in the test pattern generator.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-30 19:49:16 -03:00
Hans Verkuil 1d78053549 [media] vivid: add support for the DCI-P3 colorspace
Support this new colorspace in vivid.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-30 19:47:17 -03:00
Hans Verkuil b592b52e2b [media] vivid-tpg: support the DCI-P3 colorspace
Add support to the test pattern generator for the DCI-P3 colorspace.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-30 19:46:39 -03:00
Hans Verkuil 2e94c19c07 [media] vivid: use Bradford method when converting Rec. 709 to NTSC 1953
The V4L2_COLORSPACE_470_SYSTEM_M (aka NTSC 1953) colorspace has a different
whitepoint (C) compared to Rec. 709 (D65). The Bradford method is the
recommended method to compensate for that when converting a Rec. 709 color
to an NTSC 1953 color.

See http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html for more
details on the Bradford method.

This patch updates the Rec. 709 to NTSC 1953 matrix so that it includes the
chromatic adaptation as calculated by the Bradford method, and it recalculates
the tpg_csc_colors table accordingly.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-30 19:41:06 -03:00
Hans Verkuil ff1447267b [media] vivid: use ARRAY_SIZE to calculate max control value
The max value of various menu controls is hardcoded, and it is easy to forget
to update it after adding a new menu item.

So use ARRAY_SIZE instead to calculate this value.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-30 19:39:04 -03:00
Hans Verkuil 9ec32cc703 [media] v4l2-compat-ioctl32: replace pr_warn by pr_debug
Every time compat32 encounters an unknown ioctl it will call pr_warn.
However, that's very irritating since it is perfectly normal that this
happens. For example, applications often try to call an ioctl to see if
it exists, and if that's used with an older kernel where compat32 doesn't
support that ioctl yet, then it starts spamming the kernel log.

So replace pr_warn by pr_debug.

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-09-25 17:44:14 -03:00
Josh Wu ac4033e02a [media] atmel-isi: parse the DT parameters for vsync/hsync/pixclock polarity
This patch will get the DT parameters of vsync/hsync/pixclock polarity, and
pass to driver.

Also add a debug information for test purpose.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-25 17:42:12 -03:00
Laurent Pinchart d32dd315ff [media] v4l: atmel-isi: Remove unused platform data fields
The emb_crc_sync, mck_hz, asd and asd_sizes platform data fields are
unused, remove them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-25 17:41:23 -03:00
Laurent Pinchart 40a78f36fc [media] v4l: atmel-isi: Remove support for platform data
All in-tree users have migrated to DT, remove support for platform data.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[josh.wu@atmel.com: squash the commit to remove the unused variable: dev]
Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-25 17:37:07 -03:00
Laurent Pinchart 375123976f [media] v4l: atmel-isi: Simplify error handling during DT parsing
Put the endpoint DT node earlier to avoid the need for goto statements
to a cleanup code block in case of errors.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-25 17:36:32 -03:00
Josh Wu 9626d03e8d [media] atmel-isi: add sanity check for supported formats in try/set_fmt()
After adding the format check in try_fmt()/set_fmt(), we don't need any
format check in configure_geometry(). So make configure_geometry() as
void type.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-25 17:36:09 -03:00
Josh Wu f653da3457 [media] atmel-isi: move configure_geometry() to start_streaming()
As in set_fmt() function we only need to know which format is been set,
we don't need to access the ISI hardware in this moment.

So move the configure_geometry(), which access the ISI hardware, to
start_streaming() will make code more consistent and simpler.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-25 17:35:47 -03:00
Josh Wu ad5f9d1968 [media] atmel-isi: setup the ISI_CFG2 register directly
In the function configure_geometry(), we will setup the ISI CFG2
according to the sensor output format.

It make no sense to just read back the CFG2 register and just set part
of it.

So just set up this register directly makes things simpler.
Currently only support YUV format from camera sensor.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-25 17:35:15 -03:00
Josh Wu d67b48824f [media] atmel-isi: increase timeout to disable/enable isi
If ISI is working on a 1024x768 or higher resolution, it needs longer
time to disable ISI. So this patch will increase timeout to 500ms.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-25 17:34:03 -03:00
Geert Uytterhoeven 18baba6458 [media] atmel-isi: Protect PM-only functions to kill warning
If CONFIG_PM=n:

    drivers/media/platform/soc_camera/atmel-isi.c:1044: warning: 'atmel_isi_runtime_suspend' defined but not used
    drivers/media/platform/soc_camera/atmel-isi.c:1054: warning: 'atmel_isi_runtime_resume' defined but not used

Protect the unused functions by #ifdef CONFIG_PM to fix this.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-25 17:33:21 -03:00
Sergei Shtylyov f00ae754c5 [media] rcar_vin: call g_std() instead of querystd()
Hans Verkuil says: "The only place querystd can be called  is in the QUERYSTD
ioctl, all other ioctls should use the last set standard." So call the g_std()
subdevice method instead of querystd() in the driver's set_fmt() method.

Reported-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-25 17:32:42 -03:00
Sergei Shtylyov 936ad8900c [media] rcar_vin: propagate querystd() error upstream
rcar_vin_set_fmt() defaults to  PAL when the subdevice's querystd() method call
fails (e.g. due to I2C error).  This doesn't work very well when a camera being
used  outputs NTSC which has different order of fields and resolution.  Let  us
stop  pretending and return the actual error except  when the querystd() method
is not implemented,  in which case  we'll have  to set the 'field' variable  to
V4L2_FIELD_NONE.

Note that doing this would prevent video capture on at least Renesas Henninger/
Porter boards where I2C seems particularly buggy.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-25 17:29:24 -03:00
Geert Uytterhoeven db33386ae3 [media] rcar_vin: Remove obsolete r8a779x-vin platform_device_id entries
Since commit a483dcbfa2 ("ARM: shmobile: lager: Remove legacy
board support"), R-Car Gen2 SoCs are only supported in generic DT-only
ARM multi-platform builds.  The driver doesn't need to match platform
devices by name anymore, hence remove the corresponding
platform_device_id entry.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-25 17:26:57 -03:00
Josh Wu 3dcb8043fb [media] soc-camera: increase the length of clk_name on soc_of_bind()
Since in soc_of_bind() it may use the of node's full name as the clk_name,
and this full name may be longer than 32 characters, take at91 i2c sensor
as an example, length is 34 bytes:
   /ahb/apb/i2c@f8028000/camera@0x30

So this patch increase the clk_name[] array size to 64. It seems big
enough so far.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-25 17:26:27 -03:00
Laurent Pinchart 5d0fd3c806 [media] uvcvideo: Disable hardware timestamps by default
The hardware timestamping implementation has been reported as not
working correctly on at least the Logitech C920. Until this can be
fixed, disable it by default.

Reported-by: Peter Rabbitson <rabbit@rabbit.us>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-25 17:23:26 -03:00
Antti Palosaari 60f6873544 [media] vivid: sdr cap: few enhancements
* Constify struct

* Fix comments

* Fix alignment

* Use modulus to transfer phase angles

* Correct float [-1.0, +1.0] to s8 [-128, 127] conversion

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-25 17:22:00 -03:00
Antti Palosaari f335c3f229 [media] vivid: SDR cap: add control for FM deviation
Add user control to adjust generated FM deviation.
Default it to 75kHz like public FM radio broadcast.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-25 17:21:13 -03:00
Andrzej Hajda 655e9780ab [media] v4l2-compat-ioctl32: fix alignment for ARM64
Alignment/padding rules on AMD64 and ARM64 differs. To allow properly match
compatible ioctls on ARM64 kernels without breaking AMD64 some fields
should be aligned using compat_s64 type and in one case struct should be
unpacked.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Cc: <stable@vger.kernel.org>      # for v3.10 and up
[hans.verkuil@cisco.com: use compat_u64 instead of compat_s64 in v4l2_input32]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-25 17:20:25 -03:00
Darek Zielski 63ab664ceb [media] saa7134: add Leadtek Winfast TV2100 FM card support
Add Leadtek Winfast TV2100 FM card to saa7134 driver. It is a card bearing
SAA7130HL chip.

Signed-off-by: Darek Zielski <dz1125tor@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-25 17:19:17 -03:00
Alexander Kuleshov 67dcfebdf9 [media] media/pci/cobalt: Use %*ph to print small buffers
printk() supports %*ph format specifier for printing a small buffers,
let's use it intead of %02x %02x...

Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-25 17:18:47 -03:00
Zahari Doychev f1a81afc98 [media] m2m: fix bad unlock balance
This patch removes unnecessary mutex queue unlock/lock sequence causing bad
unlock balance in v4l2_m2m_poll when the last buffer on the destination
queue has been dequeued and adds spin lock protection for the done list
list_empty calls.

[  144.990873] =====================================
[  144.995584] [ BUG: bad unlock balance detected! ]
[  145.000301] 4.1.0-00137-ga105070 #98 Tainted: G        W
[  145.006140] -------------------------------------
[  145.010851] demux:sink/487 is trying to release lock (&dev->dev_mutex) at:
[  145.017785] [<808cc578>] mutex_unlock+0x18/0x1c
[  145.022322] but there are no more locks to release!
[  145.027205]
[  145.027205] other info that might help us debug this:
[  145.033741] no locks held by demux:sink/487.
[  145.038015]
[  145.038015] stack backtrace:
[  145.042385] CPU: 2 PID: 487 Comm: demux:sink Tainted: G        W       4.1.0-00137-ga105070 #98
[  145.051089] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[  145.057622] Backtrace:
[  145.060102] [<80014a4c>] (dump_backtrace) from [<80014cc4>] (show_stack+0x20/0x24)
[  145.067679]  r6:80cedf78 r5:00000000 r4:00000000 r3:00000000
[  145.073421] [<80014ca4>] (show_stack) from [<808c61e0>] (dump_stack+0x8c/0xa4)
[  145.080661] [<808c6154>] (dump_stack) from [<80072b64>] (print_unlock_imbalance_bug+0xb8/0xe8)
[  145.089277]  r6:808cc578 r5:ac6cd050 r4:ac38e400 r3:00000001
[  145.095020] [<80072aac>] (print_unlock_imbalance_bug) from [<80077db4>] (lock_release+0x1a4/0x250)
[  145.103983]  r6:808cc578 r5:ac6cd050 r4:ac38e400 r3:00000000
[  145.109728] [<80077c10>] (lock_release) from [<808cc470>] (__mutex_unlock_slowpath+0xc4/0x1b4)
[  145.118344]  r9:acb27a41 r8:00000000 r7:81553814 r6:808cc578 r5:60030013 r4:ac6cd01c
[  145.126190] [<808cc3ac>] (__mutex_unlock_slowpath) from [<808cc578>] (mutex_unlock+0x18/0x1c)
[  145.134720]  r7:00000000 r6:aced7cd4 r5:00000041 r4:acb87800
[  145.140468] [<808cc560>] (mutex_unlock) from [<805a98b8>] (v4l2_m2m_fop_poll+0x5c/0x64)
[  145.148494] [<805a985c>] (v4l2_m2m_fop_poll) from [<805955a0>] (v4l2_poll+0x6c/0xa0)
[  145.156243]  r6:aced7bec r5:00000000 r4:ac6cc380 r3:805a985c
[  145.161991] [<80595534>] (v4l2_poll) from [<80156edc>] (do_sys_poll+0x230/0x4c0)
[  145.169391]  r5:00000000 r4:aced7be4
[  145.173013] [<80156cac>] (do_sys_poll) from [<801574a8>] (SyS_ppoll+0x1d4/0x1fc)
[  145.180414]  r10:00000000 r9:aced6000 r8:00000000 r7:00000000 r6:75c04538 r5:00000002
[  145.188338]  r4:00000000
[  145.190906] [<801572d4>] (SyS_ppoll) from [<800108c0>] (ret_fast_syscall+0x0/0x54)
[  145.198481]  r8:80010aa4 r7:00000150 r6:75c04538 r5:00000002 r4:00000008

Signed-off-by: Zahari Doychev <zahari.doychev@linux.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-25 17:18:27 -03:00
Nicolas Sugino 27315059e2 [media] ivtv-alsa: Add index to specify device number
When using multiple capture cards, it might be necessary to identify a
specific device with an ALSA one. If not, the order of the ALSA devices
might have no relation to the id of the radio or video device.

Signed-off-by: Nicolas Sugino <nsugino@3way.com.ar>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-25 17:17:08 -03:00
Linus Torvalds 06a660ada2 media updates for v4.3-rc1
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJV8WvjAAoJEAhfPr2O5OEV5wIP/AjmqOau99ms4FvOQ932sO57
 kKDM4CYeTBkYY2Xz2eGStgxhcEj538JTf6SXdrceEEYJHb/GNCb2iBM1TnB4YciF
 rqhFv+n3R8h4Yn5KmhEhYzEfO7HUoyHPrOhcmTLzDoTO5wyrhAlPZxDWHohmfU84
 uQ8WyGPYLxwm8hdZ+/NkB8PXsGbWN65EoKzN6tt2kA6HUP52UxE0Cw7Qu7Iu5zmO
 y/x03mMbjhCBFFE41EeM76J+xKBhuaS4cyf8g08DJy5Zpf6ic8bKFmVg1tAFOZRD
 mCETLrUlPYhglHqOoVS25bCI5kCw9xTAyjPZdQnwCTwgHl5gG3E4oJYKASrmZlps
 igMSmLJEpQilsLy1Ze+K+Ci8EILmZzwbi21X0sbjq74Jd+tJZ+C8ZuWHVmPEF9j7
 iHtZNIRzkzufNBJZn3DsmlGBb/Xc/UqfZVnJAB9gu3Ktav6dmtEIHrGRPpL19iYH
 WtJWLt/Bpyb318K+fnxL8SzUqUxZJ4+8DrMtlgTqHmIRwVQ4CczyeWi0utQmBXEF
 CaNp00S2V9N1hn8OIc+gaf7LTYJn0LkHFsskoiUZ5aZQd9ai0ql0IT1xLe0r8lMi
 +ieB0Vp4wJtaodWIXOPeFugDqQXIb0Mh2M8J9FIJ116FLIai6btzO2iyVCtlR9Bg
 1uPztCfJ/nusPPHnE26R
 =TEFw
 -----END PGP SIGNATURE-----

Merge tag 'media/v4.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull media updates from Mauro Carvalho Chehab:
 "A series of patches that move part of the code used to allocate memory
  from the media subsystem to the mm subsystem"

[ The mm parts have been acked by VM people, and the series was
  apparently in -mm for a while   - Linus ]

* tag 'media/v4.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
  [media] drm/exynos: Convert g2d_userptr_get_dma_addr() to use get_vaddr_frames()
  [media] media: vb2: Remove unused functions
  [media] media: vb2: Convert vb2_dc_get_userptr() to use frame vector
  [media] media: vb2: Convert vb2_vmalloc_get_userptr() to use frame vector
  [media] media: vb2: Convert vb2_dma_sg_get_userptr() to use frame vector
  [media] vb2: Provide helpers for mapping virtual addresses
  [media] media: omap_vout: Convert omap_vout_uservirt_to_phys() to use get_vaddr_pfns()
  [media] mm: Provide new get_vaddr_frames() helper
  [media] vb2: Push mmap_sem down to memops
2015-09-11 16:42:39 -07:00
Kirill A. Shutemov 7cbea8dc01 mm: mark most vm_operations_struct const
With two exceptions (drm/qxl and drm/radeon) all vm_operations_struct
structs should be constant.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-09-10 13:29:01 -07:00
Linus Torvalds 9cfcc658da media updates for v4.3-rc1
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJV6ifEAAoJEAhfPr2O5OEVn5kP/i2jM1tWcmV/ZEBKGAN0jpRk
 5Y/Q+rnXvOpIJSQC3dEkweoBymVMclSgSB/wFSWCZtp5MaB8KrH4/2uc3UvolF91
 7bqXt+fCUacMbDQyaabMCR83mz9tdOJLd5sf0ABqBgXGfwh5uXmBPaYBzmcYvKcW
 4D89MFUpaFDPARTs9rdpVyr0aPRU4GcN0R3snRO9Ly+cQnyV/RxPf9NqCgnI+yPq
 +NvA9ScUBcBt62piSIGR4egcAR8boxYC+0r57340S21/JVMvsHQ3ok9b1aT8/rtd
 Yl24FkcKrRV0ShN5S1RmW5DLH/HRGabuMjkiEz9xq52FGD2sQQda0At58dWivsa4
 XYdxS9UUfb9Z+qyeMdmCl1MUFRrV2G4H6VItP+GKyT3UZLEDcLl6hBg3SkyWxWB4
 CSO5WuRThiIB86OVcIaREftzqDy5HdvH3ZKRD7QrW0DItGVjQwV5j6gvwqO9OEXs
 99BnSohyKwUBonumE2ZtFGGhIwIomllrMSqg991bPH9+13bg/rPxUqntkPrVap/9
 cV3qKO8ZFrz5UInBnR1U83l60ZK7rV4G6AVMSMKpM9XVK9TDKryAUN9Mhj5XWRH8
 hbma89TQVdhdrITtt27uzj8F622cvZvxd1BqDBR8DjKVvtv/E2GPzJrAj7GHe3/o
 NgzP5fF6X2Si32GNb7J8
 =cIed
 -----END PGP SIGNATURE-----

Merge tag 'media/v4.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull media updates from Mauro Carvalho Chehab:
 - new DVB frontend drivers: ascot2e, cxd2841er, horus3a, lnbh25
 - new HDMI capture driver: tc358743
 - new driver for NetUP DVB new boards (netup_unidvb)
 - IR support for DVBSky cards (smipcie-ir)
 - Coda driver has gain macroblock tiling support
 - Renesas R-Car gains JPEG codec driver
 - new DVB platform driver for STi boards: c8sectpfe
 - added documentation for the media core kABI to device-drivers DocBook
 - lots of driver fixups, cleanups and improvements

* tag 'media/v4.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (297 commits)
  [media] c8sectpfe: Remove select on undefined LIBELF_32
  [media] i2c: fix platform_no_drv_owner.cocci warnings
  [media] cx231xx: Use wake_up_interruptible() instead of wake_up_interruptible_nr()
  [media] tc358743: only queue subdev notifications if devnode is set
  [media] tc358743: add missing Kconfig dependency/select
  [media] c8sectpfe: Use %pad to print 'dma_addr_t'
  [media] DocBook media: Fix typo "the the" in xml files
  [media] tc358743: make reset gpio optional
  [media] tc358743: set direction of reset gpio using devm_gpiod_get
  [media] dvbdev: document most of the functions/data structs
  [media] dvb_frontend.h: document the struct dvb_frontend
  [media] dvb-frontend.h: document struct dtv_frontend_properties
  [media] dvb-frontend.h: document struct dvb_frontend_ops
  [media] dvb: Use DVBFE_ALGO_HW where applicable
  [media] dvb_frontend.h: document struct analog_demod_ops
  [media] dvb_frontend.h: Document struct dvb_tuner_ops
  [media] Docbook: Document struct analog_parameters
  [media] dvb_frontend.h: get rid of dvbfe_modcod
  [media] add documentation for struct dvb_tuner_info
  [media] dvb_frontend: document dvb_frontend_tune_settings
  ...
2015-09-05 18:21:14 -07:00
Vladimir Zapolskiy 7385817359 genalloc: add name arg to gen_pool_get() and devm_gen_pool_create()
This change modifies gen_pool_get() and devm_gen_pool_create() client
interfaces adding one more argument "name" of a gen_pool object.

Due to implementation gen_pool_get() is capable to retrieve only one
gen_pool associated with a device even if multiple gen_pools are created,
fortunately right at the moment it is sufficient for the clients, hence
provide NULL as a valid argument on both producer devm_gen_pool_create()
and consumer gen_pool_get() sides.

Because only one created gen_pool per device is addressable, explicitly
add a restriction to devm_gen_pool_create() to create only one gen_pool
per device, this implies two possible error codes returned by the
function, account it on client side (only misc/sram).  This completes
client side changes related to genalloc updates.

[akpm@linux-foundation.org: gen_pool_get() cleanup]
Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-09-04 16:54:41 -07:00
Linus Torvalds 8d2faea672 This is the bulk of GPIO changes for the v4.3 kernel cycle:
Core changes:
 
 - Root out the wrapper devm_gpiod_get() and gpiod_get() etc
   versions of the descriptor calls that did not use the flags
   argument on the end. This was around for too long and eventually
   Uwe Kleine-König took the time to clean it out and the last
   users are removed along with the macros in this tag. In several
   cases the use of flags simplifies the code. For this reason we
   have (ACKed) patches hitting in DRM, IIO, media, NFC, USB+PHY
   up until we hammer in the nail with removing the macros.
 
 - Add a fat document describing how much ready-made GPIO stuff
   we have i the kernel to discourage people from reinventing
   a square wheel in userspace, as so often happens.
 
 - Create a separate lockdep class for each instance of a GPIO
   IRQ chip instead of using one class for all chips, as the current
   code will not work with systems with several GPIO chips doing
   lockdep debugging.
 
 - Protect against driver unloading also when a GPIO line is only
   used as IRQ for the GPIOLIB_IRQCHIP helpers.
 
 - If the GPIO chip has no designated owner, assign the parent
   device driver owner as owner.
 
 - Consolidation of chained IRQ handler install/remove replacing
   all call sites where irq_set_handler_data() and
   irq_set_chained_handler() were done in succession with a
   combined call to irq_set_chained_handler_and_data(). This
   series was created by Thomas Gleixner after the problem was
   observed by Russell King.
 
 - Tglx also made another series of patches switching
   __irq_set_handler_locked() for irq_set_handler_locked() which
   is way cleaner.
 
 - Tglx and Jiang Liu wrote a good bunch of patches to make use of
   irq_desc_get_xxx() accessors and avoid looking up irq_descs
   from IRQ numbers. The goal is to get rid of the irq number
   from the handlers in the IRQ flow which is nice.
 
 - Rob Herring killed off the set_irq_flags() for all GPIO
   drivers. This was an ARM specific function that is replaced
   with the generic irq_modify_status() where special flags
   are actually needed.
 
 - When an OF node has a pin range for its GPIOs, return
   -EPROBE_DEFER if the pin controller isn't available.
   Pretty logical, yet needed to be fixed.
 
 - If a driver using GPIOLIB_IRQCHIP has its own
   irq_*_resources call back, then call these instead of the
   defaults provided by the GPIOLIB.
 
 - Fix an undocumented ABI hole: named GPIOs were not
   properly documented.
 
 Driver improvements:
 
 - Add get_direction() support to the generic GPIO driver, it's
   strange that we didn't have that before.
 
 - Make it possible to have input-only GPIO chips using the
   generic GPIO driver.
 
 - Clean out platform data support from the Emma Mobile (EM)
   driver
 
 - Finegrained runtime PM support for the RCAR driver.
 
 - Support r8a7795 (R-car H3) in the RCAR driver.
 
 - Support interrupts on GPIOs 16 thru 31 in the DaVinci driver.
 
 - Some consolidation and new support in the MPC8xxx driver,
   we now support MPC5125.
 
 - Preempt-RT-friendly patches: the OMAP, MPC8xxx, drivers uses raw
   spinlocks making it work better with the realime patches.
 
 - Interrupt support for the EXTRAXFS GPIO driver.
 
 - Make the ETRAXFS GPIO driver support also ARTPEC-3.
 
 - Interrupt and wakeup support for the BRCMSTB driver, also for
   wakeup from S5 cold boot.
 
 - Mask MXC IRQs during suspend.
 
 - Improve OMAP2 GPIO set_debounce() to work according to spec.
 
 - The VF610 driver handles IRQs properly.
 
 New drivers:
 
 - ZTE ZX GPIO driver.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJV52lvAAoJEEEQszewGV1zOVcP/2ZgkfRgl119LZnWShfrEJWq
 UXaNzSaPNgvDzvGaqqi62SZQuhrdIWRKfMPtAuMGbEn5aJx0JC5UAOYjjfkKBqpO
 toqc1w2DScc0JTorY8qgczIBDO1A3ZBAcIvXXpOduy/JaKPoQteRN8WYTynPw48/
 0+97ZODwhyOkfeqmvUClkc9gW4XT68dudb0Lv1nQjsZmd1dHF2PZlwH3aL9sV68j
 GJAqf09xNqZaWWQBhs+J3ptsYjaJfYjo9NOOUf0Y/UgqXO3vB+2S4EmRATaRHS2F
 aHdj03sNZCNSDEa35WwetbLRGxPzSWmfxmBzQQ1baGdcJICn7Yv58EklPKRvwtMo
 ZpUsgiOV4OUIEClPJohs4xbl2HRsOYB3VbcihkXjVAxS6i2/jgA3Tn8ATvUSZ8wq
 TX8D6BfciigRCkT2G+B0TQBmcX1IQsMd1DBUNfw7Dk1TK/vxH4UYWbke422RjKGz
 ORJ+0DfShMCdYjrCVlt7UbFcqE3L5CnrztLQ3oFt0om2JsSWztV9V579G+Dqo9CI
 fE4G3xlsF33UCvXcmnOp6PuU+ZYBodLggkmK4REy2D3LCOnkcKq0U8Fj5RssApZ9
 FdqVYck555ZpcBiN8ihB97WsmU+0XhBjblCbgzr6GxUw8EJ4x8H9nlraA6bluFoP
 9c2qgPxjCq/VWA/F0YOU
 =iQ2P
 -----END PGP SIGNATURE-----

Merge tag 'gpio-v4.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio

Pull GPIO updates from Linus Walleij:
 "This is the bulk of GPIO changes for the v4.3 kernel cycle.

  There is quite a lot going on in the GPIO subsystem this merge window,
  so the main matter is decribed below.

  The hits in other subsystems when making the GPIO flags optional are
  all ACKed by their respective subsystem maintainers.

  Core changes:

   - Root out the wrapper devm_gpiod_get() and gpiod_get() etc versions
     of the descriptor calls that did not use the flags argument on the
     end.  This was around for too long and eventually Uwe Kleine-König
     took the time to clean it out and the last users are removed along
     with the macros in this tag.  In several cases the use of flags
     simplifies the code.  For this reason we have (ACKed) patches
     hitting in DRM, IIO, media, NFC, USB+PHY up until we hammer in the
     nail with removing the macros.

   - Add a fat document describing how much ready-made GPIO stuff we
     have i the kernel to discourage people from reinventing a square
     wheel in userspace, as so often happens.

   - Create a separate lockdep class for each instance of a GPIO IRQ
     chip instead of using one class for all chips, as the current code
     will not work with systems with several GPIO chips doing lockdep
     debugging.

   - Protect against driver unloading also when a GPIO line is only used
     as IRQ for the GPIOLIB_IRQCHIP helpers.

   - If the GPIO chip has no designated owner, assign the parent device
     driver owner as owner.

   - Consolidation of chained IRQ handler install/remove replacing all
     call sites where irq_set_handler_data() and
     irq_set_chained_handler() were done in succession with a combined
     call to irq_set_chained_handler_and_data().

     This series was created by Thomas Gleixner after the problem was
     observed by Russell King.

   - Tglx also made another series of patches switching
     __irq_set_handler_locked() for irq_set_handler_locked() which is
     way cleaner.

   - Tglx and Jiang Liu wrote a good bunch of patches to make use of
     irq_desc_get_xxx() accessors and avoid looking up irq_descs from
     IRQ numbers.  The goal is to get rid of the irq number from the
     handlers in the IRQ flow which is nice.

   - Rob Herring killed off the set_irq_flags() for all GPIO drivers.
     This was an ARM specific function that is replaced with the generic
     irq_modify_status() where special flags are actually needed.

   - When an OF node has a pin range for its GPIOs, return -EPROBE_DEFER
     if the pin controller isn't available.  Pretty logical, yet needed
     to be fixed.

   - If a driver using GPIOLIB_IRQCHIP has its own irq_*_resources call
     back, then call these instead of the defaults provided by the
     GPIOLIB.

   - Fix an undocumented ABI hole: named GPIOs were not properly
     documented.

  Driver improvements:

   - Add get_direction() support to the generic GPIO driver, it's
     strange that we didn't have that before.

   - Make it possible to have input-only GPIO chips using the generic
     GPIO driver.

   - Clean out platform data support from the Emma Mobile (EM) driver

   - Finegrained runtime PM support for the RCAR driver.

   - Support r8a7795 (R-car H3) in the RCAR driver.

   - Support interrupts on GPIOs 16 thru 31 in the DaVinci driver.

   - Some consolidation and new support in the MPC8xxx driver, we now
     support MPC5125.

   - Preempt-RT-friendly patches: the OMAP, MPC8xxx, drivers uses raw
     spinlocks making it work better with the realime patches.

   - Interrupt support for the EXTRAXFS GPIO driver.

   - Make the ETRAXFS GPIO driver support also ARTPEC-3.

   - Interrupt and wakeup support for the BRCMSTB driver, also for
     wakeup from S5 cold boot.

   - Mask MXC IRQs during suspend.

   - Improve OMAP2 GPIO set_debounce() to work according to spec.

   - The VF610 driver handles IRQs properly.

  New drivers:

   - ZTE ZX GPIO driver"

* tag 'gpio-v4.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (87 commits)
  Revert "gpio: extraxfs: fix returnvar.cocci warnings"
  gpio: tc3589x: use static container helper
  gpio: xlp: fix error return code
  gpio: vf610: handle level IRQ's properly
  gpio: max732x: Fix error handling in probe()
  gpio: omap: fix clk_prepare/unprepare usage
  gpio: omap: protect regs access in omap_gpio_irq_handler
  gpio: omap: fix omap2_set_gpio_debounce
  gpio: omap: switch to use platform_get_irq
  gpio: omap: remove wrong irq_domain_remove usage in probe
  gpiolib: add description for gpio irqchip fields in struct gpio_chip
  gpio: extraxfs: fix returnvar.cocci warnings
  gpiolib: irqchip: use different lockdep class for each gpio irqchip
  gpio/grgpio: fix deadlock in grgpio_irq_unmap()
  Documentation: gpio: consumer: describe active low property
  gpio: mxc: fix section mismatch warning
  gpio/mxc: mask gpio interrupts in suspend
  gpio: omap: Fix missing raw locks conversion
  gpio: brcmstb: support wakeup from S5 cold boot
  gpio: brcmstb: Add interrupt and wakeup source support
  ...
2015-09-04 10:07:45 -07:00
Peter Griffin 50ef28a6ac [media] c8sectpfe: Remove select on undefined LIBELF_32
LIBELF_32 is not defined in Kconfig, and is left over legacy
which is not required in the upstream driver, so remove it.

Suggested-by: Valentin Rothberg <valentinrothberg@gmail.com>

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-03 14:10:06 -03:00
Fengguang Wu cfd34ed8de [media] i2c: fix platform_no_drv_owner.cocci warnings
drivers/media/i2c/tc358743.c:1960:3-8: No need to set .owner here. The core will do it.

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

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

CC: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-03 13:56:14 -03:00
Steven Rostedt 543409a247 [media] cx231xx: Use wake_up_interruptible() instead of wake_up_interruptible_nr()
While looking at use cases of the wake queues in order to add support
for simple wait queues, I noticed that there was only a single user of
wake_up_interruptible_nr(), and that use was doing a single task wake
up. Have that user use the proper wake_up_interruptible() instead, and
perhaps we can even remove the function wake_up_interruptible_nr().

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-03 13:50:52 -03:00
Philipp Zabel abeaca0ff5 [media] tc358743: only queue subdev notifications if devnode is set
Hardware interrupts are enabled in the probe function, before the subdev
is registered to its v4l2_device. Until v4l2_device_register_subdev_node
is called, sd->devnode is NULL and v4l2_subdev_notify_event must not be
called.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-03 13:48:06 -03:00
Hans Verkuil 22dbe35a3a [media] tc358743: add missing Kconfig dependency/select
As reported by Randy:
> when CONFIG_MEDIA_CONTROLLER is not enabled:
>
> ../drivers/media/i2c/tc358743.c: In function 'tc358743_probe':
> ../drivers/media/i2c/tc358743.c:1890:29: error: 'struct v4l2_subdev' has no member named 'entity'
>   err = media_entity_init(&sd->entity, 1, &state->pad, 0);
>                              ^
> ../drivers/media/i2c/tc358743.c:1940:26: error: 'struct v4l2_subdev' has no member named 'entity'
>   media_entity_cleanup(&sd->entity);
>                           ^
> ../drivers/media/i2c/tc358743.c: In function 'tc358743_remove':
> ../drivers/media/i2c/tc358743.c:1955:26: error: 'struct v4l2_subdev' has no member named 'entity'
>   media_entity_cleanup(&sd->entity);
>                           ^

This driver depends on VIDEO_V4L2_SUBDEV_API and needs to select HDMI.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-03 13:47:07 -03:00
Fabio Estevam 62e5f051c1 [media] c8sectpfe: Use %pad to print 'dma_addr_t'
Use %pad to print 'dma_addr_t' in order to fix the following
build warning:

drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c:588:2: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'dma_addr_t' [-Wformat=]

Reported-by: Olof's autobuilder <build@lixom.net>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-03 13:44:29 -03:00
Uwe Kleine-König 1e137d92c0 [media] tc358743: make reset gpio optional
Commit 2561482468 ("[media] tc358743: support probe from device tree")
specified in the device tree binding documentation that the reset gpio
is optional. Make the implementation match accordingly.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-03 13:18:23 -03:00
Uwe Kleine-König 06d3f2e020 [media] tc358743: set direction of reset gpio using devm_gpiod_get
Commit 2561482468 ("[media] tc358743: support probe from device tree")
failed to explicitly set the direction of the reset gpio. Use the
optional flag of devm_gpiod_get to make up leeway.

This is also necessary because the flag parameter will become mandatory
soon.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-03 13:18:05 -03:00
Linus Torvalds 089b669506 Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
Pull trivial tree updates from Jiri Kosina:
 "The usual stuff from trivial tree for 4.3 (kerneldoc updates, printk()
  fixes, Documentation and MAINTAINERS updates)"

* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (28 commits)
  MAINTAINERS: update my e-mail address
  mod_devicetable: add space before */
  scsi: a100u2w: trivial typo in printk
  i2c: Fix typo in i2c-bfin-twi.c
  treewide: fix typos in comment blocks
  Doc: fix trivial typo in SubmittingPatches
  proportions: Spelling s/consitent/consistent/
  dm: Spelling s/consitent/consistent/
  aic7xxx: Fix typo in error message
  pcmcia: Fix typo in locking documentation
  scsi/arcmsr: Fix typos in error log
  drm/nouveau/gr: Fix typo in nv10.c
  [SCSI] Fix printk typos in drivers/scsi
  staging: comedi: Grammar s/Enable support a/Enable support for a/
  Btrfs: Spelling s/consitent/consistent/
  README: GTK+ is a acronym
  ASoC: omap: Fix typo in config option description
  mm: tlb.c: Fix error message
  ntfs: super.c: Fix error log
  fix typo in Documentation/SubmittingPatches
  ...
2015-09-01 18:46:42 -07:00
Mauro Carvalho Chehab d071c833a0 [media] dvbdev: document most of the functions/data structs
Document the most relevant functions and data structs for
developers that are working with the DVB subsystem.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
2015-08-22 19:39:38 -03:00
Mauro Carvalho Chehab 35848bf0aa [media] dvb_frontend.h: document the struct dvb_frontend
That struct is used on every DVB Front End driver, as it
contains what's needed to register/use a frontend at the
Kernel.

Document it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
2015-08-22 14:52:59 -03:00
Mauro Carvalho Chehab a3cccb2411 [media] dvb-frontend.h: document struct dtv_frontend_properties
Most of the parameters here are already well defined at
the userspace documentation. Yet, it is good to add some
documentation, for the developers to be sure that they
are the same as the ones at userspace API.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
2015-08-22 14:52:59 -03:00
Mauro Carvalho Chehab 0cfcc493a5 [media] dvb-frontend.h: document struct dvb_frontend_ops
This is one of the most important functions of the DVB
frontend, containing the logic needed to set the parameters
at the demux and to send commands via SEC.

Document it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
2015-08-22 14:52:58 -03:00
Mauro Carvalho Chehab 27460adc07 [media] dvb: Use DVBFE_ALGO_HW where applicable
The dvb_frontend.c core defines a FE_ALGO_HW symbol that it is
never used. Also, both cx24123 returns 1 to get_algo() callback
instead of using DVBFE_ALGO_HW.

Probably, those are some left overs from some code cleanup.

Let's stop returning magic numbers and use the proper macro
value.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
2015-08-22 14:52:58 -03:00
Mauro Carvalho Chehab 0bf6cd7bc5 [media] dvb_frontend.h: document struct analog_demod_ops
Add documentation for struct analog_demod_info and
struct analog_demod_ops.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
2015-08-22 14:52:57 -03:00
Mauro Carvalho Chehab 465291a0eb [media] dvb_frontend.h: Document struct dvb_tuner_ops
The struct dvb_tuner_ops contains lots of callbacks used
by tuners. Document them.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
2015-08-22 14:52:56 -03:00
Mauro Carvalho Chehab 1a77763428 [media] Docbook: Document struct analog_parameters
That struct inside dvb-frontend.h stores some parameters
from V4L2 API (videodev2.h), in order to be used by the
hybrid analog/digital TV tuners.

Document it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
2015-08-22 14:52:56 -03:00
Mauro Carvalho Chehab 0c68b1ce85 [media] dvb_frontend.h: get rid of dvbfe_modcod
This enum is not used anymore, as drivers use the
modulation definitions from the public API. It is probably
a left over from some DVB core cleanup.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
2015-08-22 14:52:55 -03:00
Mauro Carvalho Chehab 8bcbc2f32e [media] add documentation for struct dvb_tuner_info
Despite being used everywhere at DVB frontends, the
struct dvb_tuner_info were never documented.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
2015-08-22 14:52:55 -03:00
Mauro Carvalho Chehab b9de1726b5 [media] dvb_frontend: document dvb_frontend_tune_settings
Add Documentation for dvb_frontend_tune_settings struct.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
2015-08-22 09:47:04 -03:00
Mauro Carvalho Chehab 2a86e373e0 [media] DocBook: add dvb_ringbuffer.h to documentation
There are already some comments at dvb_ringbuffer.h that are ready
for DocBook, although not properly formatted.

Convert them, fix some issues and add this file to
the device-drivers DocBook.

While here, put multi-line comments on the right format.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
2015-08-22 09:05:45 -03:00
Mauro Carvalho Chehab e08bb6f79f [media] DocBook: add dvb_math.h to documentation
There are already some comments at dvb_math.h that are ready
for DocBook, although not properly formatted.

Convert them, fix some issues and add this file to
the device-drivers DocBook.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
2015-08-22 09:05:40 -03:00
Mauro Carvalho Chehab 4f1c1868e8 [media] DocBook: add dvb_frontend.h to documentation
There are already some comments at dvb_frontend.h that are ready
for DocBook, although not properly formatted.

Convert them, and add this file to the device-drivers DocBook.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
2015-08-22 09:05:34 -03:00
Mauro Carvalho Chehab fbefb1a87c [media] DocBook: add dvb_ca_en50221.h to documentation
There are already some tags at dvb_ca_en50221.h, but using a
different format. Convert them, fix a few entries and add
to the device-drivers DocBook.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
2015-08-22 07:09:29 -03:00
Mauro Carvalho Chehab dc2c8bd3c9 [media] DocBook/device-drivers: Add drivers/media core stuff
There are lots of docbook marks at the media subsystem, but
those aren't used.

Add the core headers/code in order to start generating docs.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
2015-08-22 04:35:55 -03:00
Linus Torvalds 00f7641046 media fixes for v4.2-rc8
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJV11W4AAoJEAhfPr2O5OEVa1MQAIK/eQiD+HSq3ooyIrv0ZR3k
 vXn4zPYVM4CrV6pdLKti/tb2y+QQVLDBY2kSyKquJySGD+5Pg94vQr2EQ3tVx/+H
 6BK69lLUIzjqjf9SATJcgNpDW51vh3GfkSv9nmsQ1VMY8FQxX64AXPgOF2QMrlmI
 YKDVqNY43h/0uctXBiC1epfK139vogKE9P5eHW3QyqGK87ebeyB/yTQC/qF3n77e
 GO3Q8wshPWzuQUSaqinHo7bzVi+kFF6vhvDgVuLo+J6KFKEqC375GN3+Gpe+elcd
 wbaT9r498GRR7hOHKW0w0IrFEKLRzJuj4N1QGX9v338qB3zumVey7dcQzGXGQMdV
 tv56BkbJBq9s+HngZ2vjQEWdM5BSe4FGbSY8TlCtevkA+uIMj1SBaLv4rw5DfTkD
 lA5ijux1xVjqORVxo7yIbJal1nP2FPvzKRRsKn5C/2OHFgt6SX8bTjuiC4JrsfIM
 P6GIM5P7aLth7NX/xr1B9K5GLucJ38KGw1/D9wYeZpXm1Ba1T4KjWzkq9pW5u/Z6
 xa3phHvTvxf7IcoQFEa//D27TmfctvqIxACoW8bOO1sJqX+e0dn29kfP1FmfFmCi
 zqWkSBBCnDBD16+zOozxjQFsuOTKqkjcCbxfkxxR4NjGcwF2Px+3uJY+JazK3QQq
 gCYbyN2rYAQ7hxCRPbP4
 =TqKo
 -----END PGP SIGNATURE-----

Merge tag 'media/v4.2-3' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull media fixes from Mauro Carvalho Chehab:

 - a regression fix at the videobuf2 core driver

 - fix error handling at mantis probing code

 - revert the IR encode patches, as the API is not mature enough.
   So, better to postpone the changes to a latter Kernel

 - fix Kconfig breakages on some randconfig scenarios.

* tag 'media/v4.2-3' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
  [media] mantis: Fix error handling in mantis_dma_init()
  Revert "[media] rc: rc-ir-raw: Add scancode encoder callback"
  Revert "[media] rc: rc-ir-raw: Add Manchester encoder (phase encoder) helper"
  Revert "[media] rc: ir-rc5-decoder: Add encode capability"
  Revert "[media] rc: ir-rc6-decoder: Add encode capability"
  Revert "[media] rc: rc-core: Add support for encode_wakeup drivers"
  Revert "[media] rc: rc-loopback: Add loopback of filter scancodes"
  Revert "[media] rc: nuvoton-cir: Add support for writing wakeup samples via sysfs filter callback"
  [media] vb2: Fix compilation breakage when !CONFIG_BUG
  [media] vb2: Only requeue buffers immediately once streaming is started
  [media] media/pci/cobalt: fix Kconfig and build when SND is not enabled
  [media] media/dvb: fix ts2020.c Kconfig and build
2015-08-21 11:03:06 -07:00
Fabio Estevam 02387b5f25 [media] mantis: Fix error handling in mantis_dma_init()
Current code assigns 0 to variable 'err', which makes mantis_dma_init()
to return success even if mantis_alloc_buffers() fails.

Fix it by checking the return value from mantis_alloc_buffers() and
propagating it in the case of error.

Reported-by: RUC_Soft_Sec <zy900702@163.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-19 07:04:55 -03:00
David Härdeman 72c5b7b24f Revert "[media] rc: rc-ir-raw: Add scancode encoder callback"
This reverts commit 9869da5bac.

The current code is not mature enough, the API should allow a single
protocol to be specified. Also, the current code contains heuristics
that will depend on module load order.

Signed-off-by: David Härdeman <david@hardeman.nu>
Acked-by: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-19 07:04:49 -03:00
David Härdeman 86f216640e Revert "[media] rc: rc-ir-raw: Add Manchester encoder (phase encoder) helper"
This reverts commit 1d971d927e.

The current code is not mature enough, the API should allow a single
protocol to be specified. Also, the current code contains heuristics
that will depend on module load order.

Signed-off-by: David Härdeman <david@hardeman.nu>
Acked-by: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-19 07:03:15 -03:00
David Härdeman e49b361d4f Revert "[media] rc: ir-rc5-decoder: Add encode capability"
This reverts commit a0466f15b4.

The current code is not mature enough, the API should allow a single
protocol to be specified. Also, the current code contains heuristics
that will depend on module load order.

Signed-off-by: David Härdeman <david@hardeman.nu>
Acked-by: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-19 07:03:09 -03:00
David Härdeman 70e7112e7d Revert "[media] rc: ir-rc6-decoder: Add encode capability"
This reverts commit cf257e288a.

The current code is not mature enough, the API should allow a single
protocol to be specified. Also, the current code contains heuristics
that will depend on module load order.

Signed-off-by: David Härdeman <david@hardeman.nu>
Acked-by: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-19 07:03:04 -03:00
David Härdeman 3a03b86fdc Revert "[media] rc: rc-core: Add support for encode_wakeup drivers"
This reverts commit 0d830b2d12.

The current code is not mature enough, the API should allow a single
protocol to be specified. Also, the current code contains heuristics
that will depend on module load order.

Signed-off-by: David Härdeman <david@hardeman.nu>
Acked-by: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-19 07:03:00 -03:00
David Härdeman 8abfebdb00 Revert "[media] rc: rc-loopback: Add loopback of filter scancodes"
This reverts commit 2e4ebde269.

The current code is not mature enough, the API should allow a single
protocol to be specified. Also, the current code contains heuristics
that will depend on module load order.

Signed-off-by: David Härdeman <david@hardeman.nu>
Acked-by: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-19 07:02:53 -03:00
David Härdeman 23f28f2adc Revert "[media] rc: nuvoton-cir: Add support for writing wakeup samples via sysfs filter callback"
This reverts commit da7ee60b03.

The current code is not mature enough, the API should allow a single
protocol to be specified. Also, the current code contains heuristics
that will depend on module load order.

Signed-off-by: David Härdeman <david@hardeman.nu>
Acked-by: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-19 07:02:33 -03:00
Hans Verkuil 38e6a417f6 [media] horus3a: fix compiler warning
Shut up this compiler warning that I get during the daily build:

horus3a.c: In function 'horus3a_set_params':
horus3a.c:308:24: warning: 'rolloff' may be used uninitialized in this function [-Wmaybe-uninitialized]
     symbol_rate * (100 + rolloff), 200000) + 5;
                        ^

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-16 13:30:25 -03:00
Abhilash Jindal 82fde1a98e [media] bt8xxx: Use monotonic time
Wall time obtained from do_gettimeofday is susceptible to sudden jumps due to
user setting the time or due to NTP.

Monotonic time is constantly increasing time better suited for comparing two
timestamps.

Signed-off-by: Abhilash Jindal <klock.android@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-16 13:29:59 -03:00
Abhilash Jindal e4d45dd81e [media] zoran: Use monotonic time
Wall time obtained from do_gettimeofday is susceptible to sudden jumps due to
user setting the time or due to NTP.

Monotonic time is constantly increasing time better suited for comparing two
timestamps.

Signed-off-by: Abhilash Jindal <klock.android@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-16 13:29:31 -03:00
Mike Looijmans 8f7a5f462a [media] i2c/adv7511: Fix license, set to GPL v2
Header claims GPL v2, so make the MODULE_LICENSE reflect that properly.

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-16 13:29:08 -03:00
Rob Taylor 4284118058 [media] media: rcar_vin: Reject videobufs that are too small for current format
In videobuf_setup reject buffers that are too small for the configured
format. Fixes v4l2-compliance issue.

Signed-off-by: Rob Taylor <rob.taylor@codethink.co.uk>
Reviewed-by: William Towle <william.towle@codethink.co.uk>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-16 13:28:24 -03:00
Rob Taylor 734f3f2385 [media] media: rcar_vin: fill in bus_info field
Adapt rcar_vin_querycap() so that cap->bus_info is populated with
something meaningful/unique.

Signed-off-by: Rob Taylor <rob.taylor@codethink.co.uk>
Signed-off-by: William Towle <william.towle@codethink.co.uk>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-16 13:28:06 -03:00
William Towle 920a1bf30a [media] media: soc_camera: rcar_vin: Add BT.709 24-bit RGB888 input support
This adds V4L2_MBUS_FMT_RGB888_1X24 input format support
which is used by the ADV7612 chip.

Modified to use MEDIA_BUS_FMT_* constants

Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Signed-off-by: William Towle <william.towle@codethink.co.uk>
Reviewed-by: Rob Taylor <rob.taylor@codethink.co.uk>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-16 13:27:14 -03:00
Ezequiel Garcia ab149b88eb [media] tw68: Move PCI vendor and device IDs to pci_ids.h
This commits moves the Intersil/Techwell PCI vendor ID, and
the device IDs for the TW68 PCI video capture cards.

This will allow to support future Intersil/Techwell devices
without duplicating the IDs.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-16 13:26:01 -03:00
Sakari Ailus 823ea2a639 [media] media: Correctly notify about the failed pipeline validation
On the place of the source entity name, the sink entity name was printed.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-16 13:20:15 -03:00
Laurent Pinchart 78c66fbcec [media] v4l: omap3isp: Drop platform data support
Platforms using the OMAP3 ISP have all switched to DT, drop platform
data support.

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-08-16 13:18:06 -03:00
Jan Kara 6690c8c78c [media] media: vb2: Remove unused functions
Conversion to the use of pinned pfns made some functions unused. Remove
them. Also there's no need to lock mmap_sem in __buf_prepare() anymore.

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-16 13:15:21 -03:00
Jan Kara fb639eb391 [media] media: vb2: Convert vb2_dc_get_userptr() to use frame vector
Convert vb2_dc_get_userptr() to use frame vector infrastructure. When we
are doing that there's no need to allocate page array and some code can
be simplified.

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-16 13:13:46 -03:00
Jan Kara 5a9e4dec39 [media] media: vb2: Convert vb2_vmalloc_get_userptr() to use frame vector
Convert vb2_vmalloc_get_userptr() to use frame vector infrastructure.
When we are doing that there's no need to allocate page array and some
code can be simplified.

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-16 13:13:06 -03:00
Jan Kara 3336c24f25 [media] media: vb2: Convert vb2_dma_sg_get_userptr() to use frame vector
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-16 13:12:12 -03:00
Jan Kara 21fb0cb7ec [media] vb2: Provide helpers for mapping virtual addresses
Provide simple helper functions to map virtual address range into an
array of pfns / pages.

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-16 13:10:42 -03:00
Jan Kara 8a677b6edd [media] media: omap_vout: Convert omap_vout_uservirt_to_phys() to use get_vaddr_pfns()
Convert omap_vout_uservirt_to_phys() to use get_vaddr_pfns() instead of
hand made mapping of virtual address to physical address. Also the
function leaked page reference from get_user_pages() so fix that by
properly release the reference when omap_vout_buffer_release() is
called.

Signed-off-by: Jan Kara <jack@suse.cz>
[hans.verkuil@cisco.com: remove unused variable]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-16 13:04:54 -03:00
Jan Kara 0f6e2825ce [media] vb2: Push mmap_sem down to memops
Currently vb2 core acquires mmap_sem just around call to
__qbuf_userptr(). However since commit f035eb4e97 (videobuf2: fix
lockdep warning) it isn't necessary to acquire it so early as we no
longer have to drop queue mutex before acquiring mmap_sem. So push
acquisition of mmap_sem down into .get_userptr memop so that the
semaphore is acquired for a shorter time and it is clearer what it is
needed for.

Note that we also need mmap_sem in .put_userptr memop since that ends up
calling vb2_put_vma() which calls vma->vm_ops->close() which should be
called with mmap_sem held. However we didn't hold mmap_sem in some code
paths anyway (e.g. when called via vb2_ioctl_reqbufs() ->
__vb2_queue_free() -> vb2_dma_sg_put_userptr()) and getting mmap_sem in
put_userptr() introduces a lock inversion with queue->mmap_lock in the
above mentioned call path.

Luckily this whole locking mess will get resolved once we convert
videobuf2 core to the new mm helper which avoids the need for mmap_sem
in .put_userptr memop altogether.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-16 13:01:10 -03:00
Mauro Carvalho Chehab 27c039750c [media] sr030pc30: don't read a new pointer
sr030pc30_get_fmt() can only succeed if both info->curr_win and
info->curr_fmt are not NULL.

If one of those vars are null, the curent code would call:
	ret = sr030pc30_set_params(sd);

If the curr_win is null, it will return -EINVAL, as it would be
expected. However, if curr_fmt is NULL, the function won't
set it.

The code will then try to read from it:

        mf->code        = info->curr_fmt->code;
        mf->colorspace  = info->curr_fmt->colorspace;

with obviouly won't work.

This got reported by smatch:
	drivers/media/i2c/sr030pc30.c:505 sr030pc30_get_fmt() error: we previously assumed 'info->curr_win' could be null (see line 499)
	drivers/media/i2c/sr030pc30.c:507 sr030pc30_get_fmt() error: we previously assumed 'info->curr_fmt' could be null (see line 499)

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-16 12:58:31 -03:00
Mauro Carvalho Chehab ab9a953b9f [media] ov2659: get rid of unused values
Why to store the chosed values for prediv, postdiv and mult if
those won't be used?

drivers/media/i2c/ov2659.c: In function 'ov2659_pll_calc_params':
drivers/media/i2c/ov2659.c:912:35: warning: variable 's_mult' set but not used [-Wunused-but-set-variable]
  u32 s_prediv = 1, s_postdiv = 1, s_mult = 1;
                                   ^
drivers/media/i2c/ov2659.c:912:20: warning: variable 's_postdiv' set but not used [-Wunused-but-set-variable]
  u32 s_prediv = 1, s_postdiv = 1, s_mult = 1;
                    ^
drivers/media/i2c/ov2659.c:912:6: warning: variable 's_prediv' set but not used [-Wunused-but-set-variable]
  u32 s_prediv = 1, s_postdiv = 1, s_mult = 1;
      ^

This is likely some leftover from some past change.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-16 12:55:50 -03:00
Mauro Carvalho Chehab 1297651655 [media] ov9650: remove an extra space
drivers/media/i2c/ov9650.c:1439 ov965x_detect_sensor() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-16 12:55:28 -03:00
Mauro Carvalho Chehab 1d88f831d2 [media] tc358743: don't use variable length array for I2C writes
drivers/media/i2c/tc358743.c:148:19: warning: Variable length array is used.

As the maximum size is 1026, we can't use dynamic var, as it
would otherwise spend 1056 bytes of the stack at i2c_wr() function.

So, allocate a buffer with the allowed maximum size together with
the state var.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Mats Randgaard <matrandg@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-16 12:55:07 -03:00
Linus Walleij 5f6f02cd49 Linux 4.2-rc4
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJVtTRqAAoJEHm+PkMAQRiGN+wH/1mPJBCvt7DqvV90+/QKPEA6
 KXWtiy+oDavOv1vPcwL4gdYmMqXd2fSv82Zv5+E5ABFHXSyZvG5eCZvQLPz0V73f
 ldrSgTYVfbYb0W+TnaC1gr8aMS38i4F/eXCoPZMtO8WyUn7xhJZS9Y3U8Ff4/gp3
 to+4TaHhsnv2R79UyoR4elObo2n6aMkBSertjndbYoEQ4Zgr5iIoxbMDi4raeghP
 BLB6Mh50tqNMxE5OL/ERj1oHmJK9TIy2sNmOhP/1xp7XGK/KZm8Z+CIglaf1gOcM
 IM8pEgwDIlxp78MERn/PB/+xDkgUw0W9OqKPcUxiIt+M7TNRQ9UTb4Tn1SR2/cE=
 =fHSS
 -----END PGP SIGNATURE-----

Merge tag 'v4.2-rc4' into devel

Linux 4.2-rc4
2015-08-13 14:42:55 +02:00
Mauro Carvalho Chehab ca05189716 [media] c8sectpfe: use a new Kconfig menu for DVB platform drivers
While this is the first DVB platform drivers, let's keep the
Kconfig options well organized, adding it on its own DVB menu.

Of course, it should depend on MEDIA_DIGITAL_TV_SUPPORT, as
this enables all DVB-related menus.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 19:28:23 -03:00
Mauro Carvalho Chehab 7d0ddc91c8 [media] tda10071: use div_s64() when dividing a s64 integer
Otherwise, it will break on 32 bits archs.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 19:19:30 -03:00
Mauro Carvalho Chehab 53cc7c9043 [media] c8sectpfe: fix pinctrl dependencies
compiling on some archs fail with:

drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c:540:8: error: implicit declaration of function ‘pinctrl_select_state’ [-Werror=implicit-function-declaration]
  ret = pinctrl_select_state(fei->pinctrl, tsin->pstate);

That's due the need of including pinctrl.h header and because
CONFIG_PINCTRL needs to be true.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 19:19:08 -03:00
Zahari Doychev 5473387b93 [media] coda: drop zero payload bitstream buffers
The buffers with zero payload are now dumped in coda_fill_bitstream and not
passed to coda_bitstream_queue. This avoids unnecessary fifo addition and
buffer sequence counter increment.

Signed-off-by: Zahari Doychev <zahari.doychev@linux.com>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 17:58:25 -03:00
Javier Martinez Canillas ed8d1cf07c [media] Export I2C module alias information in missing drivers
The I2C core always reports the MODALIAS uevent as "i2c:<client name"
regardless if the driver was matched using the I2C id_table or the
of_match_table. So the driver needs to export the I2C table and this
be built into the module or udev won't have the necessary information
to auto load the correct module when the device is added.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 17:51:28 -03:00
Mauro Carvalho Chehab 7612cf97ec [media] c8sectpfe: don't go past channel_data array
As reported by smatch:
	drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c:365 find_channel() error: buffer overflow 'fei->channel_data' 8 <= 63

It seems that a cut-and-paste type of error occurred here:
the channel_data array size is C8SECTPFE_MAX_TSIN_CHAN, and not
C8SECTPFE_MAXCHANNEL.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 16:16:55 -03:00
Mauro Carvalho Chehab 409e9eff72 [media] c8sectpfe: Allow compiling it with COMPILE_TEST
While it won't work, it is good to allow it to build with
COMPILE_TEST, as we can check if other patches would break
compilation for this driver.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 16:16:50 -03:00
Peter Griffin 850a3f7d59 [media] c8sectpfe: Add Kconfig and Makefile for the driver
This patch adds the Kconfig and Makefile for the c8sectpfe driver
so it will be built. It also selects additional demodulator and tuners
which are required by the supported NIM cards.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 16:08:29 -03:00
Peter Griffin 03ad477615 [media] c8sectpfe: Add c8sectpfe debugfs support
Some basic debugfs support to dump the IP registers. Further
statistics could easily be added in the future for example for
each enabled tsin channel we could expose number of corrupt packets
received etc.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 16:07:22 -03:00
Peter Griffin e77a0cbe6c [media] c8sectpfe: Add support for various ST NIM cards
This patch adds support for the following 2 NIM cards: -
1) B2100A (2x stv0367 demods & 2x NXP tda18212 tuners)
2) STV0903-6110NIM (stv0903 demod + 6110 tuner, lnb24)

A NIM card is a cold plugable expansion card which usually
features a demodulator / tuner combination.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 16:06:49 -03:00
Peter Griffin b5e208a684 [media] c8sectpfe: Add LDVB helper functions
These functions are used by the core code for creating the LDVB
devices and adapter.

Addtionally some older SoC's (and potentially newer ones) have different
frontend HW which would allow those devices to be easily supported
in the future by keeping the code specific to the IP separate from the
more generic code.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 16:05:53 -03:00
Peter Griffin c5f5d0f997 [media] c8sectpfe: STiH407/10 Linux DVB demux support
This patch adds support for the c8sectpfe input HW found on
STiH407/410 SoC's.

It currently supports the TS input block, memdma engine
and hw PID filtering blocks of the C8SECTPFE subsystem.

The driver creates one LinuxDVB adapter, and a
demux/dvr/frontend set of devices for each tsin channel
which is specificed in the DT. It has been tested with
multiple tsin channels tuned, locked, and grabbing TS
simultaneously.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 16:04:59 -03:00
Joe Perches 548146fbbc [media] dvb-pll: Convert struct dvb_pll_desc uses to const
Convert the struct dvb_pll_desc uses to const and
change the "entries" fixed array size from 12 to []

It saves a couple KB overall and remove ~5KB of data.

$ size drivers/media/dvb-frontends/dvb-pll.o*
   text        data     bss     dec     hex filename
   8520        1552    2120   12192    2fa0 drivers/media/dvb-frontends/dvb-pll.o.new
   5624        6363    2120   14107    371b drivers/media/dvb-frontends/dvb-pll.o.old

[PG] Patch taken from https://lkml.org/lkml/2015/6/24/721 with
commit message updated.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Reviewed-by: Michael Ira Krufky <m.krufky@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 15:56:27 -03:00
Peter Griffin 6930f6696e [media] stv0367: Add support for 16Mhz reference clock
The B2100A dvb NIM card from ST has 2x stv0367 demodulators
and 2x TDA18212 silicon tuners, with a 16Mhz crystal. To
get this working properly with the upstream driver we need
to add support for the 16Mhz reference clock.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 15:55:52 -03:00
Peter Griffin 86a10283e2 [media] stv0367: Refine i2c error trace to include i2c address
When using stv0367 demodulator with STi STB platforms,
we can have easily have four or more stv0367 demods running
in the system at one time.

As typically the b2120 reference design ships with a b2004a daughter
board, which can accept two dvb NIM cards, and each b2100A NIM
has 2x stv0367 demods and 2x NXPs tuner on it.

In such circumstances it is useful to print the i2c address
on error messages to know which one is failing due to I2C issues.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 15:55:30 -03:00
Mauro Carvalho Chehab 8853780ec1 [media] ascot2e: don't use variable length arrays
The Linux stack is short; we need to be able to count the number
of bytes used at stack on each function. So, we don't like to
use variable-length arrays, as complained by smatch:
        drivers/media/dvb-frontends/horus3a.c:57:19: warning: Variable length array is used.

The max usecase of the driver seems to be 10 bytes + 1 for the
register.

So, let's be safe and allocate 11 bytes for the write buffer.
This should be enough to cover all cases. If not, let's print
an error message.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 15:41:27 -03:00
Mauro Carvalho Chehab 4aabd91625 [media] horus3a: don't use variable length arrays
The Linux stack is short; we need to be able to count the number
of bytes used at stack on each function. So, we don't like to
use variable-length arrays, as complained by smatch:
	drivers/media/dvb-frontends/horus3a.c:57:19: warning: Variable length array is used.

The max usecase of the driver seems to be 5 bytes + 1 for the
register.

So, let's be safe and allocate 6 bytes for the write buffer.
This should be enough to cover all cases. If not, let's print
an error message.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 15:41:23 -03:00
Mauro Carvalho Chehab d13a7b674a [media] cxd2841er: don't use variable length arrays
The Linux stack is short; we need to be able to count the number
of bytes used at stack on each function. So, we don't like to
use variable-length arrays, as complained by smatch:

	drivers/media/dvb-frontends/cxd2841er.c:205:19: warning: Variable length array is used.

The max usecase of the driver seems to be 15 bytes + 1 for the
register.

So, let's be safe and allocate 17 bytes for the write buffer.
This should be enough to cover all cases. If not, let's print
an error message.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 15:37:10 -03:00
Kozlov Sergey 52b1eaf4c5 [media] netup_unidvb: NetUP Universal DVB-S/S2/T/T2/C PCI-E card driver
Add NetUP Dual Universal CI PCIe board driver.
The board has
    - two CI slots
    - two I2C adapters
    - SPI master bus for accessing flash memory containing
      FPGA firmware

No changes required.

Signed-off-by: Kozlov Sergey <serjk@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 15:16:40 -03:00
Mauro Carvalho Chehab c8946c8d5a [media] cxd2841er: declare static functions as such
drivers/media/dvb-frontends/cxd2841er.c:992:5: warning: no previous prototype for 'cxd2841er_get_carrier_offset_t2' [-Wmissing-prototypes]
 int cxd2841er_get_carrier_offset_t2(
     ^
drivers/media/dvb-frontends/cxd2841er.c:1032:5: warning: no previous prototype for 'cxd2841er_get_carrier_offset_c' [-Wmissing-prototypes]
 int cxd2841er_get_carrier_offset_c(
     ^
drivers/media/dvb-frontends/cxd2841er.c:1360:5: warning: no previous prototype for 'cxd2841er_read_snr_t2' [-Wmissing-prototypes]
 int cxd2841er_read_snr_t2(struct cxd2841er_priv *priv, u32 *snr)
     ^

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 15:08:47 -03:00
Kozlov Sergey a6dc60ff12 [media] cxd2841er: Sony CXD2841ER DVB-S/S2/T/T2/C demodulator driver
Add DVB-C/T/T2/S/S2 demodulator frontend driver Sony CXD2841ER chip.

Signed-off-by: Kozlov Sergey <serjk@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 15:06:51 -03:00
Kozlov Sergey e025273b86 [media] lnbh25: LNBH25 SEC controller driver
Add DVB SEC frontend driver for STM LNBH25PQR chip.

[mchehab@osg.samsung.com: fix merge conflict:
 fe_sec_voltage_t should not be used in kernelspace anymore.
 instead, it should use enum fe_sec_voltage]
Signed-off-by: Kozlov Sergey <serjk@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 14:59:05 -03:00
Kozlov Sergey dacf9ce80b [media] ascot2e: Sony Ascot2e DVB-C/T/T2 tuner driver
Add DVB-T/T2/C frontend driver for Sony Ascot2e (CXD2861ER) chip.

Signed-off-by: Kozlov Sergey <serjk@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 14:54:17 -03:00
Kozlov Sergey a5d32b3582 [media] horus3a: Sony Horus3A DVB-S/S2 tuner driver
Add DVB-S/S2 frontend driver for Sony Horus3A (CXD2832AER) chip

Signed-off-by: Kozlov Sergey <serjk@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 14:51:57 -03:00
Christian Löpke 3139f43f8e [media] Technisat SkyStar USB HD,(DVB-S/S2) too much URBs for arm devices
Using 8 URBs results in a consecutive buffer allocation of too much
memory for some arm devices.
As we use isochronuous transfers the number of URBs can be reduced
without risking data-loss.

Signed-off-by: Christian Loepke <loepke@edfritsch.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 14:43:23 -03:00
David Härdeman dd6ff6a05b [media] rc-core: improve the lirc protocol reporting
Commit 275ddb40bc removed the lirc
"protocol" but kept backwards compatibility by always listing
the protocol as present and enabled. This patch further improves
the logic by only listing the protocol if the lirc module is loaded
(or if lirc is builtin).

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 13:18:13 -03:00
Krzysztof Kozlowski ebf8dce56a [media] Drop owner assignment from i2c_driver
i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 13:01:57 -03:00
Krzysztof Kozlowski 8972943c0e [media] tuners: Drop owner assignment from i2c_driver
i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 13:01:32 -03:00
Krzysztof Kozlowski f77658bda9 [media] radio: Drop owner assignment from i2c_driver
i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 13:01:08 -03:00
Krzysztof Kozlowski dfadaccabf [media] i2c: Drop owner assignment from i2c_driver
i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 13:00:15 -03:00
Krzysztof Kozlowski f078818770 [media] dvb-frontends: Drop owner assignment from platform_driver
platform_driver does not need to set an owner because
platform_driver_register() will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 12:59:38 -03:00
Krzysztof Kozlowski 04d8be053f [media] dvb-frontends: Drop owner assignment from i2c_driver
i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 12:58:20 -03:00
Vaishali Thakkar 38dcdca387 [media] pctv452e: Replace memset with eth_zero_addr
Use eth_zero_addr to assign the zero address to the given address
array instead of memset when second argument is address of zero.
Note that the 6 in the third argument of memset appears to represent
an ethernet address size (ETH_ALEN).

The Coccinelle semantic patch that makes this change is as follows:

// <smpl>
@eth_zero_addr@
expression e;
@@

-memset(e,0x00,6);
+eth_zero_addr(e);
// </smpl>

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 12:57:01 -03:00
Geert Uytterhoeven 8278780e3d [media] tuners: Make all TV tuners visible if COMPILE_TEST=y
Make the TV tuners menu visible when compile-testing, to allow
selecting additional drivers on top of the drivers that are already
automatically selected if MEDIA_SUBDRV_AUTOSELECT is enabled.

Without this, many drivers stay disabled during e.g. allmodconfig.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 12:56:40 -03:00
Vaishali Thakkar fa9163b570 [media] ttpci: Replace memset with eth_zero_addr
Use eth_zero_addr to assign the zero address to the given address
array instead of memset when second argument is address of zero.
Note that the 6 in the third argument of memset appears to represent
an ethernet address size (ETH_ALEN).

The Coccinelle semantic patch that makes this change is as follows:

// <smpl>
@eth_zero_addr@
expression e;
@@

-memset(e,0x00,6);
+eth_zero_addr(e);
// </smpl>

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 12:50:56 -03:00
Maninder Singh a73df85892 [media] usb/airspy: removing unneeded goto
This patch removes unneded goto,
reported by coccinelle.

Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Reviewed-by: Akhilesh Kumar <akhilesh.k@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 12:50:18 -03:00
Geert Uytterhoeven 5cc596c66f [media] i2c: Make all i2c devices visible if COMPILE_TEST=y
Make the i2c devices menu visible when compile-testing, to allow
selecting additional drivers on top of the drivers that are already
automatically selected if MEDIA_SUBDRV_AUTOSELECT is enabled.

Without this, many drivers stay disabled during e.g. allmodconfig.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 11:38:21 -03:00
Geert Uytterhoeven 6df34051d8 [media] dvb-frontends: Make all DVB Frontends visible if COMPILE_TEST=y
Make the DVB Frontends menu visible when compile-testing, to allow
selecting additional drivers on top of the drivers that are already
automatically selected if MEDIA_SUBDRV_AUTOSELECT is enabled.

Without this, many drivers stay disabled during e.g. allmodconfig.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 11:11:46 -03:00
Luis R. Rodriguez 1e3f2987f3 [media] x86/mm/pat, drivers/media/ivtv: move pat warn and replace WARN() with pr_warn()
On built-in kernels this warning will always splat as this is part
of the module init. Fix that by shifting the PAT requirement check
out under the code that does the "quasi-probe" for the device. This
device driver relies on an existing driver to find its own devices,
it looks for that device driver and its own found devices, then
uses driver_for_each_device() to try to see if it can probe each of
those devices as a frambuffer device with ivtvfb_init_card(). We
tuck the PAT requiremenet check then on the ivtvfb_init_card()
call making the check at least require an ivtv device present
before complaining.

Reported-by: Fengguang Wu <fengguang.wu@intel.com> [0-day test robot]
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 11:10:25 -03:00
Antonio Borneo 7ac5f8315e [media] s5c73m3: Remove redundant spi driver bus initialization
In ancient times it was necessary to manually initialize the bus
field of an spi_driver to spi_bus_type. These days this is done in
spi_register_driver(), so we can drop the manual assignment.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 11:10:24 -03:00
Krzysztof Hałasa e8e9055594 [media] pci/Kconfig: don't use MEDIA_ANALOG_TV_SUPPORT for grabber cards
I noticed certain cards are currently under MEDIA_ANALOG_TV_SUPPORT
but it seems they are frame grabbers (with CVBS, Svideo etc. inputs)
rather than TV receivers (with analog TV tuners).

MEDIA_CAMERA_SUPPORT maybe isn't the best name (only "meye" driver seems
to drive a real camera in a laptop) but it at least doesn't select the
TUNERs.

Perhaps the following patch would make sense.

Signed-off-by: Krzysztof Ha?asa <khalasa@piap.pl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 11:09:54 -03:00
Mauro Carvalho Chehab b0c49e2acc [media] mantis: remove an uneeded goto
Gotos makes a little harder to check the code. In this
particular case, the goto is doing nothing but jumping into
a return.

Instead, just replace the goto by the return, making it
simpler.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 10:35:11 -03:00
Fabio Estevam 919db5c319 [media] mantis: Fix error handling in mantis_dma_init()
Current code assigns 0 to variable 'err', which makes mantis_dma_init()
to return success even if mantis_alloc_buffers() fails.

Fix it by checking the return value from mantis_alloc_buffers() and
propagating it in the case of error.

Reported-by: RUC_Soft_Sec <zy900702@163.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 10:28:41 -03:00
Hans Verkuil 8e8a6b23f1 [media] mt9v032: fix uninitialized variable warning
drivers/media/i2c/mt9v032.c: In function ‘mt9v032_probe’:
  CC [M]  drivers/media/i2c/s5k4ecgx.o
drivers/media/i2c/mt9v032.c:996:20: warning: ‘pdata’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  if (pdata && pdata->link_freqs) {
                    ^

It can indeed be uninitialized in one corner case. Initialize to NULL.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 10:27:18 -03:00
Philipp Zabel 9deb6ad661 [media] v4l2: move tracepoint generation into separate file
To compile videobuf2-core as a module, the vb2_* tracepoints must be
exported from the videodev module. Instead of exporting vb2 tracepoint
symbols from v4l2-ioctl.c, move the tracepoint generation into a separate
file. This patch fixes the following build error in the modpost stage,
introduced by 2091f5181c ("[media] videobuf2: add trace events"):

    ERROR: "__tracepoint_vb2_buf_done" undefined!
    ERROR: "__tracepoint_vb2_dqbuf" undefined!
    ERROR: "__tracepoint_vb2_qbuf" undefined!
    ERROR: "__tracepoint_vb2_buf_queue" undefined!

Suggested-by: Steven Rostedt <rostedt@goodmis.org>

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 10:26:33 -03:00
Prashant Laddha b1304f9bdc [media] vivid: support cvt, gtf timings for video out
The generation of cvt, gtf timings is already supported by v4l2-ctl.
This patch adds support for setting cvt,gtf timings for video out.
While enabling cvt,gtf in vivid capture, the vivid video out was
missed out. Adding it now.

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-08-11 10:25:36 -03:00
William Towle 7111cddd51 [media] media: adv7604: reduce support to first (digital) input
Using adv7611_read_cable_det() for ADV7612 means that full
support for '.max_port = ADV7604_PAD_HDMI_PORT_B,' isn't available
due to the need for multiple port reads to determine cable detection,
and an agreed mechanism for communicating the separate statuses.

This patch replaces adv7611_read_cable_det() with a functionally
identical copy, commented appropriately.

Earlier submissions [leading to commit 8331d30b] also set .cp_csc,
which is used in a cp_read() call within adv76xx_log_status().

Signed-off-by: William Towle <william.towle@codethink.co.uk>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 09:54:50 -03:00
William Towle c1362384a8 [media] media: adv7604: fix probe of ADV7611/7612
Prior to commit f862f57d ("[media] media: i2c: ADV7604: Migrate to
regmap"), the local variable 'val' contained the combined register
reads used in the chipset version ID test. Restore this expectation
so that the comparison works as it used to.

Signed-off-by: William Towle <william.towle@codethink.co.uk>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 09:54:00 -03:00
Hans Verkuil 16225ea7fa [media] soc_camera: always release queue for queue owner
Always release the queue if the owner closes its filehandle and not when
it is the last open filehandle.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 09:53:33 -03:00
Hans Verkuil 2d703835b0 [media] soc_camera: pass on streamoff error
If streamoff returned an error, then pass that on to the caller.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 09:53:11 -03:00
Hans Verkuil 9f317de424 [media] soc_camera: compliance fixes
- REQBUFS(0) will stop streaming, free buffers and release the file ownership.
- Return ENOTTY for create_bufs for a vb1 driver
- Return EBUSY if there is a different streaming owner and set the new owner on
  success.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 09:52:46 -03:00
Hans Verkuil eb01b1bca9 [media] soc_camera: fix expbuf support
- For vb1 drivers just return -ENOTTY.
- For vb2 drivers allow vb2_expbuf without there being a stream owner:
  the vb2_expbuf function will return the correct error message in that case.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 09:52:16 -03:00
Hans Verkuil d53c0f7275 [media] soc_camera: fix enum_input
Fill in the std field from the video_device tvnorms field.

This fixes a v4l2-compliance failure.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Rob Taylor <rob.taylor@codethink.co.uk>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 09:51:17 -03:00
Hans Verkuil fd41c1af4e [media] sh_mobile_ceu_camera: set field to FIELD_NONE
Make sure that 'field' isn't FIELD_ANY when the driver is
first loaded. Fixes a v4l2-compliance failure.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 09:50:57 -03:00
Hans Verkuil 31d38d33d7 [media] sh_mobile_ceu_camera: fix querycap
Fill in the bus_info and driver fields. Found by v4l2-compliance.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 09:50:41 -03:00
Hans Verkuil d9db01fbab [media] mt9t112: JPEG -> SRGB
The JPEG colorspace should only be used for JPEG encoded images. This is
just a regular sRGB sensor.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 09:50:22 -03:00
Hans Verkuil 517ef25521 [media] ak881x: simplify standard checks
Simplify confusing conditions. This also swaps the checks for NTSC and PAL:
to be consistent with other drivers check for NTSC first. So if the user
sets both NTSC and PAL bits, then NTSC wins.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 09:50:01 -03:00
Hans Verkuil 1f3375e0b2 [media] tw9910: init priv->scale and update standard
When the standard changes the VACTIVE and VDELAY values need to be updated.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 09:49:30 -03:00
Hans Verkuil 9212e1d872 [media] tw9910: don't use COLORSPACE_JPEG
This is an SDTV video receiver, so the colorspace should be SMPTE170M.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 09:48:53 -03:00
Hans Verkuil 073b795efb [media] sh-veu: initialize timestamp_flags and copy timestamp info
This field wasn't set, causing WARN_ON's from the vb2 core.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 09:41:43 -03:00
Antti Palosaari 267897a470 [media] tda10071: implement DVBv5 statistics
Implement DVBv5 CNR, signal strength, BER and block errors.

Wrap legacy DVBv3 statistics to DVBv5 internally.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 07:34:58 -03:00
Antti Palosaari 4c4acb7a7e [media] tda10071: do not get_frontend() when not ready
This is a bit hack, but returning error when driver is not tuned yet
causes DVBv5 zap stop polling DVBv5 statistics. Thus return 0 even
callback is called during invalid device state.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 07:33:32 -03:00
Antti Palosaari e14432a5b7 [media] tda10071: protect firmware command exec with mutex
There should be clearly some lock in order to make sure firmware
command in execution is not disturbed by another command. It has
worked as callbacks are serialized somehow pretty well and command
execution happens usually without any delays.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 07:32:58 -03:00
Antti Palosaari 54ab48ed5d [media] tda10071: convert to regmap I2C API
Use regmap API for I2C operations.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 07:12:50 -03:00
Antti Palosaari fca3e00760 [media] tda10071: rename device state struct to dev
Rename device state struct from 'priv' to 'dev'.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 07:11:16 -03:00
Antti Palosaari 59ca2ce1d5 [media] tda10071: remove legacy media attach
All users are now using I2C binding and old attach could be removed.
Use I2C client for proper logging at the same.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 07:10:53 -03:00
Antti Palosaari 3250a550c4 [media] a8293: coding style issues
Remove FSF address from license. Indent parameter correctly.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 07:10:04 -03:00
Antti Palosaari 4bef67e311 [media] a8293: improve LNB register programming logic
On power-on LNB power supply voltage is disabled, due to that no
need to disable it during probe. Tone is supply is hard-coded as
external tone coming from the demodulator. Program both voltage
and tone on set_voltage(). Use register cache to prevent unneeded
programming.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 07:09:42 -03:00
Antti Palosaari 2c509b866b [media] a8293: use i2c_master_send / i2c_master_recv for I2C I/O
As driver is now proper I2C client driver, we could use correct
functions for I2C I/O. Also rename state from priv to dev. Fix
logging too.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 07:09:13 -03:00
Antti Palosaari 55881b4fb5 [media] a8293: remove legacy media attach
Remove legacy media attach as all users are on I2C bindings now.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 07:08:32 -03:00
Antti Palosaari d029419dc6 [media] em28xx: remove unused a8293 SEC config
Devices that were using a8293 SEC are converted to I2C platform data
thus that old config structure is left unused.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 07:08:01 -03:00
Hans Verkuil 8d59604547 [media] bt819/saa7110/vpx3220: remove legacy control ops
The zoran driver has now been converted to the control framework
which means that these three subdevice drivers no longer need to
support the legacy core control ops since the last bridge driver
that needed that has now been converted.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 07:01:32 -03:00
Hans Verkuil e56c597b02 [media] zoran: convert to the control framework and to v4l2_fh
Switch this driver to the control framework and to v4l2_fh for
handling control events.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 07:01:05 -03:00
Hans Verkuil 7b962d43ef [media] zoran: use standard core lock
Use the standard core lock to take care of serializing ioctl calls and
to serialize file operations.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 07:00:39 -03:00
Hans Verkuil 8148802f18 [media] zoran: remove unused read/write functions
The zoran_read/write functions always return an error. Just remove them.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:59:58 -03:00
Hans Verkuil 160d75724a [media] zoran: remove unnecessary memset
There is no need to zero the v4l2_capability struct, the v4l2 core has done
that already.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:59:28 -03:00
Hans Verkuil 0a6b9b04db [media] fsl-viu: drop format names
The names of the pixelformats is set by the core. So there no longer
is any need for drivers to fill it in.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:59:09 -03:00
Hans Verkuil 9acc809328 [media] fsl-viu: small fixes
- Fix an off-by-one index check in vidioc_enum_fmt()
- Fill in the pix.sizeimage field in vidioc_try_fmt_cap()
- Fix an off-by-one index check in vidioc_s_input()

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:58:41 -03:00
Hans Verkuil 7fe0b3d7c7 [media] fsl-viu: add control event support
Convert the driver to use v4l2_fh in order to support control events.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:58:06 -03:00
Hans Verkuil e299bc99bf [media] fsl-viu: fill in colorspace, always set field to interlaced
- fill in the missing colorspace value.
- don't reject incorrect field values, always replace with a valid value.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:57:21 -03:00
Hans Verkuil 282b3fb831 [media] fsl-viu: fill in bus_info in vidioc_querycap
The bus_info field was never filled.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:56:29 -03:00
Hans Verkuil 1fea3d6069 [media] fsl-viu: convert to the control framework
Interestingly enough, the existing control handling code basically did
nothing. At least the new code will inherit the controls from the
saa7115 driver.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:56:11 -03:00
Hans Verkuil df3cfa6d92 [media] usbvision: move init code to probe()
These things are only initialized if you start streaming video, but
they are also used in the disconnect function. So just init them
always during probe time.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:55:26 -03:00
Hans Verkuil 94384014f6 [media] usbvision: fix standards for S-Video/Composite inputs
The standards supported by S-Video and Composite inputs are not
limited by PAL, so make it more generic.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:55:00 -03:00
Hans Verkuil 8926e84534 [media] usbvision: fix DMA from stack warnings
In various places the stack was used to provide buffers for USB data, but
this should be allocated memory.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:54:22 -03:00
Hans Verkuil e2c84ccb0f [media] usbvision: fix locking error
If remove_pending is non-zero, then the v4l2_lock is never unlocked.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:53:21 -03:00
Hans Verkuil 4eeda6faae [media] usbvision: set field and colorspace
Set the colorspace and field in vidioc_try_fmt_vid_cap().

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:53:01 -03:00
Hans Verkuil 64d416ec96 [media] usbvision: frequency fixes
- setup initial radio and tv frequencies.
- set/get the correct frequency (radio vs tv).
- disable tuner/freq ioctls if there is no tuner.
- fix some tuner index checks.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:52:31 -03:00
Hans Verkuil cbe12cc66e [media] usbvision: the radio device node has wrong caps
The radio device node had the same caps as the video node. Fix this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:51:00 -03:00
Hans Verkuil 601ecab34b [media] usbvision: remove g/s_audio and for radio remove enum/g/s_input
The g/s_audio ioctls didn't do anything, so remove them all for both
video and radio nodes and remove V4L2_CAP_AUDIO.

The enum/g/s_input ioctls are invalid for radio nodes, so remove them
from the radio ioctl_ops.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:50:39 -03:00
Hans Verkuil 2b43665ffb [media] usbvision: return valid error in usbvision_register_video()
Don't return -1, return a proper error code.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:50:08 -03:00
Hans Verkuil fd95870d1b [media] usbvision: convert to the control framework
Convert this driver to the control framework and struct v4l2_fh
(needed for handling control events).

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:49:49 -03:00
Hans Verkuil 62e259493d [media] usbvision: remove power_on_at_open and timed power off
This causes lots of problems and is *very* slow as well.

One of the main problems is that this prohibits the use of the control
framework since subdevs will be unloaded on power off which is not allowed
as long as they are used by a usb device.

Apparently the reason for doing this is to turn off a noisy tuner. My hardware
has no problem with that, and I wonder whether the hardware with that noisy
tuner wasn't just functioning improperly as I have never heard of noisy tuners.

Contact me if you have one of those devices and I can take a look whether the
tuner can't be powered off if necessary by letting the tuner subdevice go
into standby mode. Unloading the tuner module is just evil and is not the
right approach.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:49:17 -03:00
Mikhail Ulyanov 2c42cdbaec [media] V4L2: platform: Add Renesas R-Car JPEG codec driver
Here's the driver for the Renesas R-Car JPEG processing unit.

The driver is implemented within the V4L2 framework as a memory-to-memory
device.  It presents two video nodes to userspace, one for the encoding part,
and one for the decoding part.

It was found that the only working mode for encoding is no markers output, so we
generate markers with software. In the current version of driver we also use
software JPEG header parsing because with hardware parsing performance is lower
than desired.

>From a userspace point of view the process is typical (S_FMT, REQBUF,
optionally QUERYBUF, QBUF, STREAMON, DQBUF) for both the source and destination
queues. STREAMON can return -EINVAL in case of mismatch of output and capture
queues format. Also during decoding driver can return buffers if queued
buffer with JPEG image contains image with inappropriate subsampling (e.g.
4:2:0 in JPEG and 4:2:2 in capture).  If JPEG image and queue format dimensions
differ driver will return buffer on QBUF with VB2_BUF_STATE_ERROR flag.

During encoding the available formats are: V4L2_PIX_FMT_NV12M,
V4L2_PIX_FMT_NV12, V4L2_PIX_FMT_NV16, V4L2_PIX_FMT_NV16M for source and
V4L2_PIX_FMT_JPEG for destination.

During decoding the available formats are: V4L2_PIX_FMT_JPEG for source and
V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_NV16M, V4L2_PIX_FMT_NV12, V4L2_PIX_FMT_NV16
for destination.

Performance of current version:
1280x800 NV12 image encoding/decoding
	decoding ~122 FPS
	encoding ~191 FPS

Signed-off-by: Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:44:43 -03:00
Laura Abbott 6d7570c42b [media] v4l2-ioctl: Give more information when device_caps are missing
Currently, the warning for missing device_caps gives a backtrace like so:

[<ffffffff8175c199>] dump_stack+0x45/0x57
[<ffffffff8109ad5a>] warn_slowpath_common+0x8a/0xc0
[<ffffffff8109ae8a>] warn_slowpath_null+0x1a/0x20
[<ffffffffa0237453>] v4l_querycap+0x43/0x80 [videodev]
[<ffffffffa0237734>] __video_do_ioctl+0x2a4/0x320 [videodev]
[<ffffffff812207e5>] ? do_last+0x195/0x1210
[<ffffffffa023a11e>] video_usercopy+0x22e/0x5b0 [videodev]
[<ffffffffa0237490>] ? v4l_querycap+0x80/0x80 [videodev]
[<ffffffffa023a4b5>] video_ioctl2+0x15/0x20 [videodev]
[<ffffffffa0233733>] v4l2_ioctl+0x113/0x150 [videodev]
[<ffffffff81225798>] do_vfs_ioctl+0x2f8/0x4f0
[<ffffffff8113b2d4>] ? __audit_syscall_entry+0xb4/0x110
[<ffffffff81022d7c>] ? do_audit_syscall_entry+0x6c/0x70
[<ffffffff81225a11>] SyS_ioctl+0x81/0xa0
[<ffffffff8113b526>] ? __audit_syscall_exit+0x1f6/0x2a0
[<ffffffff81763549>] system_call_fastpath+0x12/0x17

This indicates that device_caps are missing but doesn't give
much of a clue which driver is actually at fault. Improve
the warning output by showing the capabilities and the
responsible driver.

Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:38:24 -03:00
Hans Verkuil b0527115af [media] tc358743: remove unused variable
The bt pointer was never used, remove it.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:37:47 -03:00
Hans Verkuil e752577ed7 [media] v4l2-mem2mem: drop lock in v4l2_m2m_fop_mmap
The v4l2_m2m_fop_mmap function takes the core mutex, but this will result in a potential
circular locking dependency:

[  262.517164] ======================================================
[  262.517166] [ INFO: possible circular locking dependency detected ]
[  262.517169] 4.2.0-rc2-koryphon #844 Not tainted
[  262.517171] -------------------------------------------------------
[  262.517173] v4l2-compliance/1379 is trying to acquire lock:
[  262.517175]  (&dev->dev_mutex){+.+.+.}, at: [<ffffffffa000ddab>] v4l2_m2m_fop_mmap+0x2b/0x90 [v4l2_mem2mem]
[  262.517187]
               but task is already holding lock:
[  262.517189]  (&mm->mmap_sem){++++++}, at: [<ffffffff81159309>] vm_mmap_pgoff+0x69/0xc0
[  262.517199]
               which lock already depends on the new lock.

[  262.517202]
               the existing dependency chain (in reverse order) is:
[  262.517204]
               -> #1 (&mm->mmap_sem){++++++}:
[  262.517209]        [<ffffffff810d0e6b>] __lock_acquire+0x62b/0xe80
[  262.517215]        [<ffffffff810d2095>] lock_acquire+0x65/0x90
[  262.517218]        [<ffffffff811612e5>] __might_fault+0x75/0xa0
[  262.517222]        [<ffffffffa06dead9>] video_usercopy+0x3e9/0x4e0 [videodev]
[  262.517231]        [<ffffffffa06debe0>] video_ioctl2+0x10/0x20 [videodev]
[  262.517238]        [<ffffffffa06d8663>] v4l2_ioctl+0xc3/0xe0 [videodev]
[  262.517243]        [<ffffffff811a8cac>] do_vfs_ioctl+0x2fc/0x550
[  262.517248]        [<ffffffff811a8f74>] SyS_ioctl+0x74/0x80
[  262.517252]        [<ffffffff81a4d2ee>] entry_SYSCALL_64_fastpath+0x12/0x76
[  262.517258]
               -> #0 (&dev->dev_mutex){+.+.+.}:
[  262.517262]        [<ffffffff810cf464>] validate_chain.isra.38+0xd04/0x1170
[  262.517266]        [<ffffffff810d0e6b>] __lock_acquire+0x62b/0xe80
[  262.517270]        [<ffffffff810d2095>] lock_acquire+0x65/0x90
[  262.517273]        [<ffffffff81a48e3c>] mutex_lock_interruptible_nested+0x6c/0x4b0
[  262.517279]        [<ffffffffa000ddab>] v4l2_m2m_fop_mmap+0x2b/0x90 [v4l2_mem2mem]
[  262.517284]        [<ffffffffa06d80ff>] v4l2_mmap+0x4f/0x90 [videodev]
[  262.517288]        [<ffffffff8116b06c>] mmap_region+0x38c/0x5b0
[  262.517293]        [<ffffffff8116b585>] do_mmap_pgoff+0x2f5/0x3e0
[  262.517297]        [<ffffffff8115932a>] vm_mmap_pgoff+0x8a/0xc0
[  262.517300]        [<ffffffff81169bab>] SyS_mmap_pgoff+0x1cb/0x270
[  262.517304]        [<ffffffff8100876d>] SyS_mmap+0x1d/0x20
[  262.517309]        [<ffffffff81a4d2ee>] entry_SYSCALL_64_fastpath+0x12/0x76
[  262.517313]
               other info that might help us debug this:

[  262.517315]  Possible unsafe locking scenario:

[  262.517318]        CPU0                    CPU1
[  262.517319]        ----                    ----
[  262.517321]   lock(&mm->mmap_sem);
[  262.517324]                                lock(&dev->dev_mutex);
[  262.517327]                                lock(&mm->mmap_sem);
[  262.517329]   lock(&dev->dev_mutex);
[  262.517332]
                *** DEADLOCK ***

Since vb2_fop_mmap doesn't take the lock, neither should v4l2_m2m_fop_mmap.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:37:23 -03:00
Andrzej Pietrasiewicz 7a1d4e7c06 [media] s5p-jpeg: Eliminate double kfree()
video_unregister_device() calls device_unregister(), which calls
put_device(), which calls kobject_put(), and if this is the last reference
then kobject_release() is called, which calls kobject_cleanup(), which
calls ktype's release method which happens to be device_release() in this
case, which calls dev->release(), which happens to be
v4l2_device_release() in this case, which calls vdev->release(), which
happens to be video_device_release(). But video_device_release() is
called explicitly both in error recovery path of s5p_jpeg_probe() and
in s5p_jpeg_remove(). The pointers in question are not nullified between
the two calls, so this is harmful.

This patch fixes the driver so that video_device_release() is not called
twice for the same object.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:26:14 -03:00
Marek Szyprowski 1af2198547 [media] s5p-mfc: add additional check for incorrect memory configuration
MFC hardware is known to trash random memory if one tries to use a
buffer which has lower DMA addresses than the configured DMA base
address. This patch adds a check for this case and proper error
handling.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Kamil Debski <kamil@wypas.org>
[s.nawrocki@samsung.com: fixed typo (addres -> address]
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:25:50 -03:00
Marek Szyprowski 490a977a10 [media] s5p-mfc: add return value check in mfc_sys_init_cmd
alloc_dev_context_buffer method might fail, so add proper
return value check.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Kamil Debski <kamil@wypas.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:24:32 -03:00
Seung-Woo Kim d44da04682 [media] s5p-mfc: fix state check from encoder queue_setup
MFCINST_GOT_INST state is set to encoder context with set_format
only for capture buffer. In queue_setup of encoder called during
reqbufs, it is checked MFCINST_GOT_INST state for both capture
and output buffer. So this patch fixes encoder to check
MFCINST_GOT_INST state only for capture buffer from queue_setup.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:24:08 -03:00
Nicholas Mc Guire 4f50efadcb [media] s5p-tv: fix wait_event_timeout return handling
event API conformance testing with coccinelle spatches are being
used to locate API usage inconsistencies this triggert with:
./drivers/media/platform/s5p-tv/mixer_reg.c:364
        incorrect check for negative return

Return type of wait_event_timeout is signed long not int and the
return type is >=0 always thus the negative check is unnecessary.
An appropriately named variable of type long is inserted and the
call fixed up aswell as the negative return check dropped.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:23:35 -03:00
Krzysztof Kozlowski 264d1cf86c [media] s5p-tv: Drop owner assignment from i2c_driver
i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:23:09 -03:00
Laurent Pinchart 2fa3dc4ea7 [media] vb2: Fix compilation breakage when !CONFIG_BUG
Commit 77a3c6fd90 ("[media] vb2: Don't WARN when v4l2_buffer.bytesused
is 0 for multiplanar buffers") uses the __WARN() macro which isn't
defined when CONFIG_BUG isn't set. This introduces a compilation
breakage. Fix it by using WARN_ON() instead.

The commit was also broken in that it merged v1 of the patch while a new
v2 version had been submitted, reviewed and acked. Fix it by
incorporating the changes from v1 to v2.

Fixes: 77a3c6fd90 ("[media] vb2: Don't WARN when v4l2_buffer.bytesused is 0 for multiplanar buffers")

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-10 08:08:11 -03:00
Masahiro Yamada e1c05067c3 treewide: fix typos in comment blocks
Looks like the word "contiguous" is often mistyped.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2015-08-07 14:46:24 +02:00
Laurent Pinchart 60acc4ebe7 treewide: Fix typo compatability -> compatibility
Even though 'compatability' has a dedicated entry in the Wiktionary,
it's listed as 'Mispelling of compatibility'. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: David S. Miller <davem@davemloft.net>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> for the atomic_helper.c
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2015-08-07 14:01:39 +02:00
Masanari Iida 971bd8fa36 treewide: Fix typo in printk
This patch fix spelling typo inv various part of sources.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2015-08-07 13:58:05 +02:00
Vaishali Thakkar 4dc102b2f5 [media] dvb_core: Replace memset with eth_zero_addr
Use eth_zero_addr to assign the zero address to the given address
array instead of memset when second argument is address of zero.

The Coccinelle semantic patch that makes this change is as follows:

// <smpl>
@eth_zero_addr@
expression e;
@@

-memset(e,0x00,ETH_ALEN);
+eth_zero_addr(e);
// </smpl>

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-22 13:32:21 -03:00
Hans Verkuil 17a705e4a9 [media] sh-veu: don't use COLORSPACE_JPEG
COLORSPACE_JPEG should only be used for JPEGs. Use SMPTE170M instead,
which is how YCbCr images are usually encoded.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-22 13:24:22 -03:00
Joe Perches dd70b27eec [media] media: ttpci: Use vsprintf %pM extension
Format mac addresses with the normal kernel extension.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-22 13:22:29 -03:00
Philipp Zabel 1140f919f8 [media] tc358743: allow event subscription
This is useful to subscribe to HDMI hotplug events via the
V4L2_CID_DV_RX_POWER_PRESENT control.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-22 11:27:38 -03:00
Philipp Zabel d747b806ab [media] tc358743: add direct interrupt handling
When probed from device tree, the i2c client driver can handle the interrupt
on its own.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-22 11:26:59 -03:00
Philipp Zabel 2561482468 [media] tc358743: support probe from device tree
Add support for probing the TC358743 subdevice from device tree.
The reference clock must be supplied using the common clock bindings.
MIPI CSI-2 specific properties are parsed from the OF graph endpoint
node and support for a non-continuous MIPI CSI-2 clock is added.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-22 11:26:32 -03:00
Philipp Zabel 8ec23da735 [media] tc358743: enable v4l2 subdevice devnode
Add V4L2_SUBDEV_FL_HAS_DEVNODE to subdev flags, in order to
enable a subdev device node.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-22 11:14:13 -03:00
Philipp Zabel 4c5211a100 [media] tc358743: register v4l2 asynchronous subdevice
Add support for registering the sensor subdevice using the v4l2-async API.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-22 11:12:57 -03:00
Hans Verkuil 55b858b4e5 [media] cobalt: allow fewer than 8 PCIe lanes
Currently the cobalt driver refuses to load if fewer than 8 PCIe lanes
are assigned. This patch changes this and just issues a warning. The
only time it will refuse to load is if the number of assigned lanes is less
than what the PCIe host is capable of since this suggests that the card
isn't seated correctly in the slot.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-22 11:04:57 -03:00
Hans Verkuil 810c168c23 [media] cobalt: accept unchanged timings when vb2_is_busy()
When vb2_is_busy() it should still be possible to call S_DV_TIMINGS
provided the new timings are the same as the current timings.

For input 1 (test generator) the size is always 1080p, so just return
that.

Fixes a v4l2-compliance issue.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-22 11:04:25 -03:00
Benoit Parrot c99235fa3e [media] media: am437x-vpfe: Fix a race condition during release
There was a race condition where during cleanup/release operation
on-going streaming would cause a kernel panic because the hardware
module was disabled prematurely with IRQ still pending.

Fixes: 417d2e507e ("[media] media: platform: add VPFE capture driver support for AM437X")

Cc: <stable@vger.kernel.org> # v4.0+
Signed-off-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-07-22 11:03:54 -03:00
Luis R. Rodriguez f5530d5af8 x86/mm/pat, drivers/media/ivtv: Move the PAT warning and replace WARN() with pr_warn()
On built-in kernels this warning will always splat, even if no ivtvfb
hardware is present, as this is part of the module init:

	if (WARN(pat_enabled(),
		 "ivtvfb needs PAT disabled, boot with nopat kernel parameter\n")) {

Fix that by shifting the PAT requirement check out under the code
that does the "quasi-probe" for the device.

This device driver relies on an existing driver to find its own devices,
it looks for that device driver and its own found devices, then uses
driver_for_each_device() to try to see if it can probe each of those
devices as a frambuffer device with ivtvfb_init_card().

We tuck the PAT requiremenet check then on the ivtvfb_init_card() call
making the check at least require an ivtv device present before
complaining.

Reported-by: Fengguang Wu <fengguang.wu@intel.com> [0-day test robot]
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: andy@silverblocksystems.net
Cc: benh@kernel.crashing.org
Cc: bp@suse.de
Cc: dan.j.williams@intel.com
Cc: dledford@redhat.com
Cc: jkosina@suse.cz
Cc: julia.lawall@lip6.fr
Cc: luto@amacapital.net
Cc: mchehab@osg.samsung.com
Link: http://lkml.kernel.org/r/1437167245-28273-3-git-send-email-mcgrof@do-not-panic.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-07-21 09:42:54 +02:00
Philipp Zabel 2091f5181c [media] videobuf2: add trace events
Add videobuf2 specific vb2_qbuf and vb2_dqbuf trace events that mirror the
v4l2_qbuf and v4l2_dqbuf trace events, only they include additional
information about queue fill state and are emitted right before the buffer
is enqueued in the driver or userspace is woken up. This allows to make
sense of the timeline of trace events in combination with others that might
be triggered by __enqueue_in_driver.

Also two new trace events vb2_buf_queue and vb2_buf_done are added,
allowing to trace the handover between videobuf2 framework and driver.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-17 12:04:12 -03:00
Philipp Zabel c13a5ccf5d [media] v4l2-mem2mem: set the queue owner field just as vb2_ioctl_reqbufs does
The queue owner will be used by videobuf2 trace events to determine and
record the device minor number. It is set in v4l2_m2m_reqbufs instead of
v4l2_m2m_ioctl_reqbufs because several drivers implement their own
vidioc_reqbufs handlers that still call v4l2_m2m_reqbufs directly.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-17 12:00:02 -03:00
Philipp Zabel 6727d4fce9 [media] coda: make NV12 format default
The chroma interleaved NV12 format has higher memory bandwidth efficiency
because the chroma planes can be read/written with longer burst lengths.
Use NV12 as default format if available and consistently sort it first.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-17 11:29:39 -03:00
Philipp Zabel a269e53b1a [media] coda: add macroblock tiling support
Storing internal frames in macroblock tiled order improves memory
access patterns by allowing increased burst sizes when transferring
the uncompressed macroblocks to or from main memory.
The translation logic only supports a single chroma base address,
so this is only supported for the chroma interleaved NV12 format.

Since the rotator used to copy the decoder output into the v4l2
capture buffers does not seem to support the tiled format correctly,
only enable it in the encoder for now.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-17 11:28:59 -03:00
Philipp Zabel 4e447ff199 [media] coda: move cache setup into coda9_set_frame_cache, also use it in start_encoding
The frame cache should be set up correctly to encode NV12 source frames.
This was not done before, so move the cache setup out of start_decoding
into its own function and call it from both start_encoding and
start_decoding.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-17 11:27:17 -03:00
Philipp Zabel cde29ef313 [media] coda: Use S_PARM to set nominal framerate for h.264 encoder
The encoder needs to know the nominal framerate for the constant bitrate
control mechanism to work. Currently the only way to set the framerate is
by using VIDIOC_S_PARM on the output queue.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-17 11:26:43 -03:00
Philipp Zabel da2b3b3e11 [media] coda: implement VBV delay and buffer size controls
The encoder allows to specify the VBV model reference decoder's initial
delay and buffer size. Export the corresponding V4L2 controls.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-17 11:24:05 -03:00
Philipp Zabel 68aa7ee15c [media] coda: reset CODA960 hardware after sequence end
On i.MX6, sometimes after decoding a stream, encoding will produce macroblock
errors caused by missing 8-byte sequences in the output stream. Until the cause
for this is found, reset the hardware after sequence end, which seems to help.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-17 11:23:01 -03:00
Philipp Zabel 47f3fa63ee [media] coda: rework meta counting and add separate lock
Keep count of number of buffer meta structures in the list and use
a separate spinlock for operations on this counted list instead
of reusing the bitstream mutex in some places and none at all in
others.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-17 11:19:32 -03:00
Philipp Zabel 2cf251c0c3 [media] coda: reuse src_bufs in coda_job_ready
The v4l2_m2m_num_src_bufs_ready() function is called in multiple places
in coda_cob_ready, and there already is a variable src_bufs that is
assigned to its result. Move it to the beginning and use it everywhere.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-17 11:17:58 -03:00
Philipp Zabel f0710815a0 [media] coda: use event class to deduplicate v4l2 trace events
Trace events with exactly the same parameters and trace output, such as
coda_enc_pic_run and coda_enc_pic_done, are supposed to use the
DECLARE_EVENT_CLASS and DEFINE_EVENT macros instead of duplicated
TRACE_EVENT macro calls.
This patch changes the order of parameters to coda_dec_rot_done and adds
a timestamp so it can share an event class with coda_bit_queue.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-17 11:16:47 -03:00
Philipp Zabel 8076c7e3f6 [media] coda: drop custom list of pixel format descriptions
Since commit ba3002045f ("[media] v4l2-ioctl: fill in the description
for VIDIOC_ENUM_FMT"), all pixel formats are assigned their description
in a central place. We can now drop the custom list.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-17 11:16:02 -03:00