cascardo/linux.git
8 years ago[media] v4l2-rect.h: new header with struct v4l2_rect helper functions
Hans Verkuil [Sun, 3 Apr 2016 19:42:42 +0000 (16:42 -0300)]
[media] v4l2-rect.h: new header with struct v4l2_rect helper functions

This makes it easier to share this code with any driver that needs to
manipulate the v4l2_rect datastructure.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.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>
8 years ago[media] ivtv/cx18: use the new mask variants of the v4l2_device_call_* defines
Hans Verkuil [Sun, 3 Apr 2016 20:44:17 +0000 (17:44 -0300)]
[media] ivtv/cx18: use the new mask variants of the v4l2_device_call_* defines

Instead of rolling our own define, just use the new mask defines.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l2-device.h: add v4l2_device_mask_ variants
Hans Verkuil [Sun, 3 Apr 2016 20:44:16 +0000 (17:44 -0300)]
[media] v4l2-device.h: add v4l2_device_mask_ variants

The v4l2_device_call_* defines filter subdevs based on the grp_id value.
But some drivers use a bitmask, so instead of filtering by grp_id == value,
you want to filter by grp_id & value.

Make variants of these defines to do this.

The 'has_op' define has been extended to have a grp_id argument as well, and
a mask variant has been added.

This extra argument required a change to go7007.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] adv7180: Add g_tvnorms operation
Niklas Söderlund [Sat, 2 Apr 2016 17:42:20 +0000 (14:42 -0300)]
[media] adv7180: Add g_tvnorms operation

The ADV7180 supports NTSC, PAL and SECAM.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] adv7180: Add cropcap operation
Niklas Söderlund [Sat, 2 Apr 2016 17:42:19 +0000 (14:42 -0300)]
[media] adv7180: Add cropcap operation

Add support to get the pixel aspect ratio depending on the current
standard (50 vs 60 Hz).

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] adv7180: Add g_std operation
Niklas Söderlund [Sat, 2 Apr 2016 17:42:18 +0000 (14:42 -0300)]
[media] adv7180: Add g_std operation

Add support to get the standard to the adv7180 driver.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] Staging: media: bcm2048: defined region_configs[] array as const array
Claudiu Beznea [Sun, 27 Mar 2016 21:15:14 +0000 (18:15 -0300)]
[media] Staging: media: bcm2048: defined region_configs[] array as const array

This patch defines region_configs[] array as const array since it
is not changed anywhere in code.

Signed-off-by: Claudiu Beznea <claudiu.beznea@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] vidioc-dv-timings-cap.xml: explicitly state that pad and reserved should...
Hans Verkuil [Tue, 22 Mar 2016 10:30:29 +0000 (07:30 -0300)]
[media] vidioc-dv-timings-cap.xml: explicitly state that pad and reserved should be zeroed

The DV_TIMINGS_CAP documentation didn't state clearly that the pad and
reserved fields should be zeroed by the application. For subdev pad can
be other values as well.

It also mistakenly said that only drivers would have to zero the reserved
field, that's not correct.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] vidioc-enum-dv-timings.xml: explicitly state that pad and reserved should...
Hans Verkuil [Tue, 22 Mar 2016 10:30:28 +0000 (07:30 -0300)]
[media] vidioc-enum-dv-timings.xml: explicitly state that pad and reserved should be zeroed

The ENUM_DV_TIMINGS documentation did not clearly state that the pad and reserved
fields should be zeroed (pad only when used with a video device node).

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] vidioc-g-edid.xml: be explicit about zeroing the reserved array
Hans Verkuil [Tue, 22 Mar 2016 10:30:27 +0000 (07:30 -0300)]
[media] vidioc-g-edid.xml: be explicit about zeroing the reserved array

The G/S_EDID documentation did not explicitly state that the reserved array
should be zeroed by the application.

Also add the missing VIDIOC_SUBDEV_G/S_EDID ioctl names to the header.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] tc358743: zero the reserved array
Hans Verkuil [Tue, 22 Mar 2016 09:59:02 +0000 (06:59 -0300)]
[media] tc358743: zero the reserved array

v4l2-compliance complained about this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] dib0090: fix smatch error
Hans Verkuil [Fri, 15 Apr 2016 15:35:33 +0000 (12:35 -0300)]
[media] dib0090: fix smatch error

Fix this smatch error:

dib0090.c:1124 dib0090_pwm_gain_reset() error: we previously assumed 'state->rf_ramp' could be null (see line 1086)

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] pvrusb2: fix smatch errors
Hans Verkuil [Fri, 15 Apr 2016 15:35:32 +0000 (12:35 -0300)]
[media] pvrusb2: fix smatch errors

These are false positives, but still easy to fix.

pvrusb2-hdw.c:3676 pvr2_send_request_ex() error: we previously assumed 'write_data' could be null (see line 3648)
pvrusb2-hdw.c:3829 pvr2_send_request_ex() error: we previously assumed 'read_data' could be null (see line 3649)

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] vivid: fix smatch errors
Hans Verkuil [Fri, 15 Apr 2016 15:35:31 +0000 (12:35 -0300)]
[media] vivid: fix smatch errors

The smatch utility got really confused about the grp % 22 code. Rewrote
it so it now understands that there really isn't a buffer overwrite.

vivid-rds-gen.c:82 vivid_rds_generate() error: buffer overflow 'rds->psname' 9 <= 43
vivid-rds-gen.c:83 vivid_rds_generate() error: buffer overflow 'rds->psname' 9 <= 42
vivid-rds-gen.c:89 vivid_rds_generate() error: buffer overflow 'rds->radiotext' 65 <= 84
vivid-rds-gen.c:90 vivid_rds_generate() error: buffer overflow 'rds->radiotext' 65 <= 85
vivid-rds-gen.c:92 vivid_rds_generate() error: buffer overflow 'rds->radiotext' 65 <= 86
vivid-rds-gen.c:93 vivid_rds_generate() error: buffer overflow 'rds->radiotext' 65 <= 87

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] tw686x: Specify that the DMA is 32 bits
Ezequiel Garcia [Fri, 1 Apr 2016 22:38:21 +0000 (19:38 -0300)]
[media] tw686x: Specify that the DMA is 32 bits

Set vb2_queue.gfp_flags to GFP_DMA32. Otherwise it will start to
create bounce buffers which is something you want to avoid since
those are in limited supply.

Without this patch, DMA scatter-gather may not work because
machines can ran out of buffers easily.

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>
8 years ago[media] tw686x-kh: rename three functions to prevent clash with tw686x driver
Hans Verkuil [Mon, 21 Mar 2016 15:10:12 +0000 (12:10 -0300)]
[media] tw686x-kh: rename three functions to prevent clash with tw686x driver

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] tw686x: add missing statics
Hans Verkuil [Mon, 21 Mar 2016 15:09:59 +0000 (12:09 -0300)]
[media] tw686x: add missing statics

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] tw686x-kh: add audio support to the TODO list
Hans Verkuil [Mon, 21 Mar 2016 11:17:14 +0000 (08:17 -0300)]
[media] tw686x-kh: add audio support to the TODO list

The mainline tw686x driver also supports audio, that's missing here
as well.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] tw686x-kh: specify that the DMA is 32 bits
Hans Verkuil [Mon, 21 Mar 2016 11:07:44 +0000 (08:07 -0300)]
[media] tw686x-kh: specify that the DMA is 32 bits

Set vb2_queue.gfp_flags to GFP_DMA32. Otherwise it will start to
create bounce buffers which is something you want to avoid since
those are in limited supply.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] tw686x-kh: use the cached value
Mauro Carvalho Chehab [Wed, 20 Apr 2016 16:39:20 +0000 (13:39 -0300)]
[media] tw686x-kh: use the cached value

the dma_requests field is cached, but cache is not used:

drivers/staging/media/tw686x-kh/tw686x-kh-video.c: In function 'tw686x_video_irq':
drivers/staging/media/tw686x-kh/tw686x-kh-video.c:622:6: warning: variable 'requests' set but not used [-Wunused-but-set-variable]
  u32 requests;
      ^

Use the cache instead, as it seems reading it needs to be done
with spin lock taken.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: Support Intersil/Techwell TW686x-based video capture cards
Ezequiel Garcia [Wed, 2 Mar 2016 14:30:16 +0000 (11:30 -0300)]
[media] media: Support Intersil/Techwell TW686x-based video capture cards

This commit introduces the support for the Techwell TW686x video
capture IC. This hardware supports a few DMA modes, including
scatter-gather and frame (contiguous).

This commit makes little use of the DMA engine and instead has
a memcpy based implementation. DMA frame and scatter-gather modes
support may be added in the future.

Currently supported chips:
- TW6864 (4 video channels),
- TW6865 (4 video channels, not tested, second generation chip),
- TW6868 (8 video channels but only 4 first channels using
           built-in video decoder are supported, not tested),
- TW6869 (8 video channels, second generation chip).

[mchehab@osg.samsung.com: make checkpatch happy by using "unsigned int"
  instead  of just "unsigned"]
Cc: Krzysztof Halasa <khalasa@piap.pl>
Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] TW686x frame grabber driver
Krzysztof Hałasa [Fri, 11 Mar 2016 12:23:16 +0000 (09:23 -0300)]
[media] TW686x frame grabber driver

A driver for Intersil/Techwell TW686x-based PCIe frame grabbers.

[hans.verkuil@cisco.com: renamed staging tw686x to tw686x-kh to prevent naming conflicts]
[hans.verkuil@cisco.com: don't build tw686x-kh if tw686x is already selected to prevent conflicts]
[mchehab@osg.samsung.com: use "unsigned int" instead of just "unsigned"  and add some whitespaces to make checkpatch happier]
Signed-off-by: Krzysztof Halasa <khalasa@piap.pl>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: Improve documentation for link_setup/link_modify
Mauro Carvalho Chehab [Wed, 6 Apr 2016 13:55:25 +0000 (10:55 -0300)]
[media] media: Improve documentation for link_setup/link_modify

Those callbacks are called with the media_device.graph_mutex held.

Add a note about that, as the code called by those notifiers should
not be touching in the mutex.

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-device: get rid of the spinlock
Mauro Carvalho Chehab [Wed, 6 Apr 2016 13:55:24 +0000 (10:55 -0300)]
[media] media-device: get rid of the spinlock

Right now, the lock schema for media_device struct is messy,
since sometimes, it is protected via a spin lock, while, for
media graph traversal, it is protected by a mutex.

Solve this conflict by always using a mutex.

As a side effect, this prevents a bug when the media notifiers
is called at atomic context, while running the notifier callback:

 BUG: sleeping function called from invalid context at mm/slub.c:1289
 in_atomic(): 1, irqs_disabled(): 0, pid: 3479, name: modprobe
 4 locks held by modprobe/3479:
 #0:  (&dev->mutex){......}, at: [<ffffffff81ce8933>] __driver_attach+0xa3/0x160
 #1:  (&dev->mutex){......}, at: [<ffffffff81ce8941>] __driver_attach+0xb1/0x160
 #2:  (register_mutex#5){+.+.+.}, at: [<ffffffffa10596c7>] usb_audio_probe+0x257/0x1c90 [snd_usb_audio]
 #3:  (&(&mdev->lock)->rlock){+.+.+.}, at: [<ffffffffa0e6051b>] media_device_register_entity+0x1cb/0x700 [media]
 CPU: 2 PID: 3479 Comm: modprobe Not tainted 4.5.0-rc3+ #49
 Hardware name:                  /NUC5i7RYB, BIOS RYBDWi35.86A.0350.2015.0812.1722 08/12/2015
 0000000000000000 ffff8803b3f6f288 ffffffff81933901 ffff8803c4bae000
 ffff8803c4bae5c8 ffff8803b3f6f2b0 ffffffff811c6af5 ffff8803c4bae000
 ffffffff8285d7f6 0000000000000509 ffff8803b3f6f2f0 ffffffff811c6ce5
 Call Trace:
 [<ffffffff81933901>] dump_stack+0x85/0xc4
 [<ffffffff811c6af5>] ___might_sleep+0x245/0x3a0
 [<ffffffff811c6ce5>] __might_sleep+0x95/0x1a0
 [<ffffffff8155aade>] kmem_cache_alloc_trace+0x20e/0x300
 [<ffffffffa0e66e3d>] ? media_add_link+0x4d/0x140 [media]
 [<ffffffffa0e66e3d>] media_add_link+0x4d/0x140 [media]
 [<ffffffffa0e69931>] media_create_pad_link+0xa1/0x600 [media]
 [<ffffffffa0fe11b3>] au0828_media_graph_notify+0x173/0x360 [au0828]
 [<ffffffffa0e68a6a>] ? media_gobj_create+0x1ba/0x480 [media]
 [<ffffffffa0e606fb>] media_device_register_entity+0x3ab/0x700 [media]

Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] m88ds3103: fix undefined division
Peter Rosin [Wed, 16 Mar 2016 12:14:13 +0000 (09:14 -0300)]
[media] m88ds3103: fix undefined division

s32tmp in the below code may be negative, and dev->mclk_khz is an
unsigned type.

s32tmp = 0x10000 * (tuner_frequency - c->frequency);
s32tmp = DIV_ROUND_CLOSEST(s32tmp, dev->mclk_khz);

This is undefined, as DIV_ROUND_CLOSEST is undefined for negative
dividends when the divisor is of unsigned type.

So, change mclk_khz to be signed (s32).

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: platform: rcar_jpu, vsp1: Use ARCH_RENESAS
Simon Horman [Fri, 25 Mar 2016 01:46:45 +0000 (22:46 -0300)]
[media] media: platform: rcar_jpu, vsp1: Use ARCH_RENESAS

Make use of ARCH_RENESAS in place of ARCH_SHMOBILE.

This is part of an ongoing process to migrate from ARCH_SHMOBILE to
ARCH_RENESAS the motivation for which being that RENESAS seems to be a more
appropriate name than SHMOBILE for the majority of Renesas ARM based SoCs.

Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Update WPF and LIF maximum sizes for Gen3
Laurent Pinchart [Fri, 25 Mar 2016 09:51:06 +0000 (06:51 -0300)]
[media] v4l: vsp1: Update WPF and LIF maximum sizes for Gen3

The maximum image size supported by the WPF is 2048x2048 on Gen2 and
8190x8190 on Gen3. Update the code accordingly, and fix the maximum LIF
size for both Gen2 and Gen3.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Fix V4L2_PIX_FMT_XRGB444 format definition
Laurent Pinchart [Fri, 25 Mar 2016 08:50:02 +0000 (05:50 -0300)]
[media] v4l: vsp1: Fix V4L2_PIX_FMT_XRGB444 format definition

The format is erroneously defined with an alpha channel. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Add global alpha support for DRM pipeline
Laurent Pinchart [Thu, 24 Mar 2016 08:15:59 +0000 (05:15 -0300)]
[media] v4l: vsp1: Add global alpha support for DRM pipeline

Make the global alpha multiplier of DRM planes configurable. All the
necessary infrastructure is there, we just need to store the alpha value
passed through the DRM API.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Add Z-order support for DRM pipeline
Laurent Pinchart [Thu, 24 Mar 2016 08:15:59 +0000 (05:15 -0300)]
[media] v4l: vsp1: Add Z-order support for DRM pipeline

Make the Z-order of planes configurable by assigning RPFs to BRU inputs
dynamically based on the Z-order position.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Add support for the RPF alpha multiplier on Gen3
Laurent Pinchart [Tue, 22 Mar 2016 14:10:27 +0000 (11:10 -0300)]
[media] v4l: vsp1: Add support for the RPF alpha multiplier on Gen3

The Gen3 RPF includes an alpha multiplier that can both multiply the
alpha channel by a fixed global alpha value, and multiply the pixel
components to convert the input to premultiplied alpha.

As alpha premultiplication is available in the BRU for both Gen2 and
Gen3 we handle it there and use the Gen3 alpha multiplier for global
alpha multiplication only. This prevents conversion to premultiplied
alpha if no BRU is present in the pipeline, that use case will be
implemented later if needed.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: lut: Use display list fragments to fill LUT
Laurent Pinchart [Thu, 3 Mar 2016 17:17:11 +0000 (14:17 -0300)]
[media] v4l: vsp1: lut: Use display list fragments to fill LUT

Synchronize the userspace LUT setup with the pipeline operation by using
a display list fragment to store LUT data.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: dl: Add support for multi-body display lists
Laurent Pinchart [Thu, 3 Mar 2016 16:36:34 +0000 (13:36 -0300)]
[media] v4l: vsp1: dl: Add support for multi-body display lists

Display lists support up to 8 bodies but we currently use a single one.
To support preparing display lists for large look-up tables, add support
for multi-body display lists.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: dl: Fix race conditions
Laurent Pinchart [Thu, 3 Mar 2016 12:26:47 +0000 (09:26 -0300)]
[media] v4l: vsp1: dl: Fix race conditions

The vsp1_dl_list_put() function expects to be called with the display
list manager lock held. This assumption is correct for calls from within
the vsp1_dl.c file, but not for the external calls. Fix it by taking the
lock inside the function and providing an unlocked version for the
internal callers.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: dl: Make reg_count field unsigned
Laurent Pinchart [Thu, 3 Mar 2016 12:25:47 +0000 (09:25 -0300)]
[media] v4l: vsp1: dl: Make reg_count field unsigned

The field takes positive values only, make it unsigned.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Fix LUT format setting
Laurent Pinchart [Mon, 16 Nov 2015 04:07:58 +0000 (02:07 -0200)]
[media] v4l: vsp1: Fix LUT format setting

The LUT set format handler overrides the requested format by mistake.
Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Factorize frame size enumeration code
Laurent Pinchart [Wed, 24 Feb 2016 23:25:42 +0000 (20:25 -0300)]
[media] v4l: vsp1: Factorize frame size enumeration code

Most of the entities can't perform scaling and implement the same frame
size enumeration function. Factorize the code into a single
implementation.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years agoRevert "[media] v4l2-ioctl: simplify code"
Mauro Carvalho Chehab [Wed, 13 Apr 2016 22:08:55 +0000 (19:08 -0300)]
Revert "[media] v4l2-ioctl: simplify code"

There are some issues rised on this patch during patch review.
I ended by merging this one by mistake. So, let's revert it.

This reverts commit 54ace1cfd4358fd11112f17cc711eea234d5ab9e.

Cc: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Factorize media bus codes enumeration code
Laurent Pinchart [Wed, 24 Feb 2016 23:25:42 +0000 (20:25 -0300)]
[media] v4l: vsp1: Factorize media bus codes enumeration code

Most of the entities can't perform format conversion and implement the
same media bus enumeration function. Factorize the code into a single
implementation.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Factorize get pad format code
Laurent Pinchart [Thu, 25 Feb 2016 00:10:13 +0000 (21:10 -0300)]
[media] v4l: vsp1: Factorize get pad format code

All entities implement the same get pad format handler, factorize it
into a common function.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: RPF entities can't be target nodes
Laurent Pinchart [Wed, 24 Feb 2016 21:40:12 +0000 (18:40 -0300)]
[media] v4l: vsp1: RPF entities can't be target nodes

The RPF entities are located at the very beginning of pipelines, they
can't be target nodes in the Data Path Router matrix. Remove their input
ID from the routing table.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Allocate pipelines on demand
Laurent Pinchart [Sun, 17 Jan 2016 21:53:56 +0000 (19:53 -0200)]
[media] v4l: vsp1: Allocate pipelines on demand

Instead of embedding pipelines in the vsp1_video objects allocate them
on demand when they are needed. This fixes the streamon race condition
where pipelines objects from different video nodes could be used for the
same pipeline.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: video: Reorder functions
Laurent Pinchart [Sun, 17 Jan 2016 21:55:18 +0000 (19:55 -0200)]
[media] v4l: vsp1: video: Reorder functions

Move the pipeline initialization and cleanup functions to prepare for
the next commit. No functional code change is performed here.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Store pipeline pointer in rwpf
Laurent Pinchart [Tue, 19 Jan 2016 21:16:36 +0000 (19:16 -0200)]
[media] v4l: vsp1: Store pipeline pointer in rwpf

This prepares for dynamic pipeline allocation by providing a field that
can be used to store the pipeline pointer atomically under driver
control.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Pass pipe pointer to entity configure functions
Laurent Pinchart [Thu, 14 Jan 2016 16:17:32 +0000 (14:17 -0200)]
[media] v4l: vsp1: Pass pipe pointer to entity configure functions

Pass the pipe explicitly instead of retrieving it through media
entities. This decouples device state stored in the pipeline from the
active state stored in entities, preparing for dynamic pipeline
creation.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Rename pipeline validate functions to pipeline build
Laurent Pinchart [Tue, 19 Jan 2016 21:42:56 +0000 (19:42 -0200)]
[media] v4l: vsp1: Rename pipeline validate functions to pipeline build

The primary purpose of those functions is to build the pipeline, rename
them to make this clearer.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Pass display list explicitly to configure functions
Laurent Pinchart [Sun, 22 Nov 2015 22:29:25 +0000 (20:29 -0200)]
[media] v4l: vsp1: Pass display list explicitly to configure functions

Modules write register values to the active display list pointed to by
the pipeline. In order to support preparing display lists ahead of time,
pass them explicitly to all configuration functions.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Use __vsp1_video_try_format to initialize format at init time
Laurent Pinchart [Sun, 22 Nov 2015 16:08:18 +0000 (14:08 -0200)]
[media] v4l: vsp1: Use __vsp1_video_try_format to initialize format at init time

Reuse the runtime logic to initialize the default format instead of
open-coding it. This ensures coherency between intialization and
runtime.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Merge RPF and WPF pad ops structures
Laurent Pinchart [Sun, 22 Nov 2015 15:37:45 +0000 (13:37 -0200)]
[media] v4l: vsp1: Merge RPF and WPF pad ops structures

The two structures are identical, merge them and move the result to
vsp1_rwpf.c. All rwpf pad operations can now be declared static.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Create a new configure operation to setup modules
Laurent Pinchart [Tue, 17 Nov 2015 15:10:26 +0000 (13:10 -0200)]
[media] v4l: vsp1: Create a new configure operation to setup modules

The subdev s_stream operation is abused as a generic way to setup
modules at every frame. Move the code out to a new VSP1 entity configure
operation.

Most modules now have an empty s_stream operation that can be removed.
The only exception is the WPF module that needs to perform hardware
configuration when stopping the stream. The code can be simplified
accordingly as we know that that operation never fails.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Store active selection rectangles in a pad config structure
Laurent Pinchart [Sun, 15 Nov 2015 21:14:22 +0000 (19:14 -0200)]
[media] v4l: vsp1: Store active selection rectangles in a pad config structure

Use the pad config structure part of the vsp1_entity to store all active
pad selection rectangles. This generalizes the code to operate on pad
config structures.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Store active formats in a pad config structure
Laurent Pinchart [Sun, 15 Nov 2015 21:14:22 +0000 (19:14 -0200)]
[media] v4l: vsp1: Store active formats in a pad config structure

Add a pad config structure field to the vsp1_entity structure and use it
to store all active pad formats. This generalizes the code to operate on
pad config structures.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Implement and use the subdev pad::init_cfg configuration
Laurent Pinchart [Sun, 15 Nov 2015 22:09:08 +0000 (20:09 -0200)]
[media] v4l: vsp1: Implement and use the subdev pad::init_cfg configuration

Turn the custom formats initialization function into a standard
pad::init_cfg handler and use it in subdevs instead of initializing
formats in the subdev open handler.

This makes the subdev open handler empty, so remove it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Add race condition FIXME comment
Laurent Pinchart [Thu, 5 Nov 2015 12:28:56 +0000 (10:28 -0200)]
[media] v4l: vsp1: Add race condition FIXME comment

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Fix BRU try compose rectangle storage
Laurent Pinchart [Sun, 15 Nov 2015 23:51:01 +0000 (21:51 -0200)]
[media] v4l: vsp1: Fix BRU try compose rectangle storage

Fix a typo that stored the try compose rectangle in the crop rectangle.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Consolidate entity ops in a struct vsp1_entity_operations
Laurent Pinchart [Tue, 17 Nov 2015 14:23:23 +0000 (12:23 -0200)]
[media] v4l: vsp1: Consolidate entity ops in a struct vsp1_entity_operations

Entities have two operations, a destroy operation stored directly in
vsp1_entity and a set_memory operation stored in a vsp1_rwpf_operations
structure. Move the two to a more generic vsp1_entity_operations
structure that will serve to implement additional operations.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Move subdev initialization code to vsp1_entity_init()
Laurent Pinchart [Sun, 15 Nov 2015 21:42:01 +0000 (19:42 -0200)]
[media] v4l: vsp1: Move subdev initialization code to vsp1_entity_init()

Don't duplicate the code in every module driver, centralize it in a
single place.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Use display lists with the userspace API
Laurent Pinchart [Sun, 1 Nov 2015 17:18:56 +0000 (15:18 -0200)]
[media] v4l: vsp1: Use display lists with the userspace API

Don't restrict display list usage to the DRM pipeline, use them
unconditionally. This prepares the driver to support the request API.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Add header display list support
Laurent Pinchart [Sun, 15 Nov 2015 00:48:27 +0000 (22:48 -0200)]
[media] v4l: vsp1: Add header display list support

Display lists can operate in header or headerless mode. The headerless
mode is only available on WPF0, to be used with the display engine. All
other WPF instances can only use display lists in header mode.

Implement support for header mode to prepare for display list usage on
WPFs other than 0.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Fix 80 characters per line violations
Laurent Pinchart [Sun, 1 Nov 2015 17:18:32 +0000 (15:18 -0200)]
[media] v4l: vsp1: Fix 80 characters per line violations

Commit f7234138f14c ("v4l2-subdev: replace v4l2_subdev_fh by
v4l2_subdev_pad_config") introduced lots of 80 characters per line
violations. Fix them.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Document calling context of vsp1_pipeline_propagate_alpha()
Laurent Pinchart [Sun, 1 Nov 2015 16:01:51 +0000 (14:01 -0200)]
[media] v4l: vsp1: Document calling context of vsp1_pipeline_propagate_alpha()

The function can only be called from a s_stream handler as it requires a
valid display list context (due to calling vsp1_uds_set_alpha() which
writes to module registers). Document the requirement.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Remove unneeded entity streaming flag
Laurent Pinchart [Sun, 1 Nov 2015 15:54:34 +0000 (13:54 -0200)]
[media] v4l: vsp1: Remove unneeded entity streaming flag

The flag is set but never read, remove it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Don't configure RPF memory buffers before calculating offsets
Laurent Pinchart [Sun, 1 Nov 2015 15:48:11 +0000 (13:48 -0200)]
[media] v4l: vsp1: Don't configure RPF memory buffers before calculating offsets

The RPF source memory pointers need to be offset to take the crop
rectangle into account. Offsets are computed in the RPF stream start,
which can happen (when using the DRM pipeline) after calling the RPF
.set_memory() operation that programs the buffer addresses.

The .set_memory() operation tries to guard against the problem by
skipping programming of the registers when the module isn't streaming.
This will however only protect the first use of an RPF in a DRM
pipeline, as in all subsequent uses the module streaming flag will be
set and the .set_memory() operation will use potentially incorrect
offsets.

Fix this by allowing the caller to decide whether to program the
hardware immediately or just cache the addresses. While at it refactor
the memory set code and create a new vsp1_rwpf_set_memory() that cache
addresses and calls the .set_memory() operation to apply them to the
hardware.

As a side effect the driver now writes all three DMA address registers
regardless of the number of planes, and initializes unused addresses to
zero.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Enable display list support for the HS[IT], LUT, SRU and UDS
Laurent Pinchart [Sun, 1 Nov 2015 14:26:14 +0000 (12:26 -0200)]
[media] v4l: vsp1: Enable display list support for the HS[IT], LUT, SRU and UDS

Those modules were left out of display list integration as they're not
used by the DRM pipeline. To prepare for display list support in non-DRM
pipelines use the module write API to set registers.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Don't setup control handler when starting streaming
Laurent Pinchart [Sun, 1 Nov 2015 14:58:29 +0000 (12:58 -0200)]
[media] v4l: vsp1: Don't setup control handler when starting streaming

The control handler set operations don't program the hardware anymore,
there's thus no need to call them when starting the stream.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: sru: Don't program intensity in control set handler
Laurent Pinchart [Sun, 1 Nov 2015 14:19:42 +0000 (12:19 -0200)]
[media] v4l: vsp1: sru: Don't program intensity in control set handler

The datasheet clearly states that all but a few registers can't be
modified when the device is running. Programming the intensity
parameters in the control set handler is thus prohibited. Program it
when starting the module instead.

This requires storing the intensity value internally as the module can
be started from the frame completion interrupt handler, and accessing
control values requires taking a mutex.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: rwpf: Don't program alpha value in control set handler
Laurent Pinchart [Sun, 1 Nov 2015 14:19:42 +0000 (12:19 -0200)]
[media] v4l: vsp1: rwpf: Don't program alpha value in control set handler

The datasheet clearly states that all but a few registers can't be
modified when the device is running. Programming the alpha value in
the control set handler is thus prohibited. Program it when starting the
module instead.

This requires storing the alpha value internally as the module can be
started from the frame completion interrupt handler, and accessing
control values requires taking a mutex.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] vsp1: make vsp1_drm_frame_end static
Mauro Carvalho Chehab [Wed, 13 Apr 2016 20:40:48 +0000 (17:40 -0300)]
[media] vsp1: make vsp1_drm_frame_end static

As reported by smatch:
drivers/media/platform/vsp1/vsp1_drm.c:39:6: warning: no previous prototype for 'vsp1_drm_frame_end' [-Wmissing-prototypes]
 void vsp1_drm_frame_end(struct vsp1_pipeline *pipe)

Fixes: ef9621bcd664 ("[media] v4l: vsp1: Store the display list manager in the WPF")
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: bru: Don't program background color in control set handler
Laurent Pinchart [Sun, 1 Nov 2015 14:19:42 +0000 (12:19 -0200)]
[media] v4l: vsp1: bru: Don't program background color in control set handler

The datasheet clearly states that all but a few registers can't be
modified when the device is running. Programming the background color
in the control set handler is thus prohibited. Program it when starting
the module instead.

This requires storing the background color value internally as the
module can be started from the frame completion interrupt handler, and
accessing control values requires taking a mutex.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Store the display list manager in the WPF
Laurent Pinchart [Sun, 15 Nov 2015 00:27:52 +0000 (22:27 -0200)]
[media] v4l: vsp1: Store the display list manager in the WPF

Each WPF can process display lists independently, move the manager to
the WPF to reflect that and prepare for display list support for non-DRM
pipelines.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Split display list manager from display list
Laurent Pinchart [Sun, 8 Nov 2015 22:06:57 +0000 (20:06 -0200)]
[media] v4l: vsp1: Split display list manager from display list

This clarifies the API and prepares display list support for being used
to implement the request API.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Simplify frame end processing
Laurent Pinchart [Sat, 14 Nov 2015 18:33:40 +0000 (16:33 -0200)]
[media] v4l: vsp1: Simplify frame end processing

The DRM pipeline, as it runs in automatic restart mode, never sees the
pipeline state set to VSP1_PIPELINE_STOPPING or VSP1_PIPELINE_STOPPED
when running the frame end interrupt handler. We can thus skip the
checks various checks in the handler and return immediately.

Similarly the DRM frame end handler calls vsp1_pipeline_run()
unnecessarily, as the state there is never VSP1_PIPELINE_STOPPED. Remove
the function call and the frame end handler is it's now empty.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Always setup the display list
Laurent Pinchart [Sun, 1 Nov 2015 12:53:22 +0000 (10:53 -0200)]
[media] v4l: vsp1: Always setup the display list

Make sure display list usage is correctly disabled by always setting up
the corresponding registers, including when the display list feature
isn't used.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Use pipeline display list to decide how to write to modules
Laurent Pinchart [Sun, 1 Nov 2015 12:46:25 +0000 (10:46 -0200)]
[media] v4l: vsp1: Use pipeline display list to decide how to write to modules

This allows getting rid of the vsp1_device::use_dl field.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: VSPD instances have no LUT on Gen3
Laurent Pinchart [Thu, 11 Feb 2016 21:32:00 +0000 (19:32 -0200)]
[media] v4l: vsp1: VSPD instances have no LUT on Gen3

Remove the HAS_LUT flag in the corresponding device information entry.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: video: Fix coding style
Laurent Pinchart [Mon, 29 Feb 2016 02:28:38 +0000 (23:28 -0300)]
[media] v4l: vsp1: video: Fix coding style

Commit 54b5a749b4f3 ("[media] v4l: vsp1: Use media entity enumeration
interface") wasn't aligned with the driver coding style. Fix it by
renaming the rval variable to ret.

Furthermore shorten lines by accessing the media_device instance in a
more straightforward fashion.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: drm: Include correct header file
Laurent Pinchart [Sat, 20 Feb 2016 01:13:45 +0000 (23:13 -0200)]
[media] v4l: vsp1: drm: Include correct header file

The VSP1 DRM API is declared in <media/vsp1.h>, not <linux/vsp1.h>. Fix
it. This also reverts commit 18922936dc28 ("[media] vsp1_drm.h: add
missing prototypes") that added the same declarations in a different
header file.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Fix vsp1_du_atomic_(begin|flush) declarations
Laurent Pinchart [Sat, 20 Feb 2016 01:12:26 +0000 (23:12 -0200)]
[media] v4l: vsp1: Fix vsp1_du_atomic_(begin|flush) declarations

The functions are void, make the declaration match the definition.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: subdev: Add pad config allocator and init
Laurent Pinchart [Fri, 24 Apr 2015 23:06:31 +0000 (20:06 -0300)]
[media] v4l: subdev: Add pad config allocator and init

Add a new subdev operation to initialize a subdev pad config array, and
a helper function to allocate and initialize the array. This can be used
by bridge drivers to implement try format based on subdev pad
operations.

Signed-off-by: Laurent Pinchart <laurent.pinchart@linaro.org>
Acked-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: Rename is_media_entity_v4l2_io to is_media_entity_v4l2_video_device
Laurent Pinchart [Mon, 29 Feb 2016 11:45:45 +0000 (08:45 -0300)]
[media] media: Rename is_media_entity_v4l2_io to is_media_entity_v4l2_video_device

All users of is_media_entity_v4l2_io() (the exynos4-is, omap3isp,
davince_vpfe and omap4iss drivers and the v4l2-mc power management code)
use the function to check whether entities are video_device instances,
either to ensure they can cast the entity to a struct video_device, or
to count the number of video nodes users.

The purpose of the function is thus to identify whether the media entity
instance is an instance of the video_device object, not to check whether
it can perform I/O. Rename it accordingly, we will introduce a more
specific is_media_entity_v4l2_io() check when needed.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-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>
8 years ago[media] media: Add obj_type field to struct media_entity
Laurent Pinchart [Mon, 29 Feb 2016 11:45:44 +0000 (08:45 -0300)]
[media] media: Add obj_type field to struct media_entity

Code that processes media entities can require knowledge of the
structure type that embeds a particular media entity instance in order
to cast the entity to the proper object type. This needs is shown by the
presence of the is_media_entity_v4l2_io and is_media_entity_v4l2_subdev
functions.

The implementation of those two functions relies on the entity function
field, which is both a wrong and an inefficient design, without even
mentioning the maintenance issue involved in updating the functions
every time a new entity function is added. Fix this by adding add an
obj_type field to the media entity structure to carry the information.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-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>
8 years ago[media] soc_camera: rcar_vin: add device tree support for r8a7792
Simon Horman [Tue, 15 Mar 2016 00:40:27 +0000 (21:40 -0300)]
[media] soc_camera: rcar_vin: add device tree support for r8a7792

Simply document new compatibility string.
As a previous patch adds a generic R-Car Gen2 compatibility string
there appears to be no need for a driver updates.

By documenting this compat string it may be used in DTSs shipped, for
example as part of ROMs. It must be used in conjunction with the Gen2
fallback compat string. At this time there are no known differences between
the r8a7792 IP block and that implemented by the driver for the Gen2
fallback compat string. Thus there is no need to update the driver as the
use of the Gen2 fallback compat string will activate the correct code in
the current driver while leaving the option for r8a7792-specific driver
code to be activated in an updated driver should the need arise.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] soc_camera: rcar_vin: add R-Car Gen 2 and 3 fallback compatibility strings
Yoshihiro Kaneko [Tue, 15 Mar 2016 00:40:26 +0000 (21:40 -0300)]
[media] soc_camera: rcar_vin: add R-Car Gen 2 and 3 fallback compatibility strings

Add fallback compatibility string for R-Car Gen 1 and 2.

In the case of Renesas R-Car hardware we know that there are generations of
SoCs, e.g. Gen 2 and 3. But beyond that it's unclear what the relationship
between IP blocks might be. For example, I believe that r8a7790 is older
than r8a7791 but that doesn't imply that the latter is a descendant of the
former or vice versa.

We can, however, by examining the documentation and behaviour of the
hardware at run-time observe that the current driver implementation appears
to be compatible with the IP blocks on SoCs within a given generation.

For the above reasons and convenience when enabling new SoCs a
per-generation fallback compatibility string scheme being adopted for
drivers for Renesas SoCs.

Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] sh_mobile_ceu_camera: Remove dependency on SUPERH
Simon Horman [Tue, 8 Mar 2016 01:03:58 +0000 (22:03 -0300)]
[media] sh_mobile_ceu_camera: Remove dependency on SUPERH

A dependency on ARCH_SHMOBILE seems to be the best option for
sh_mobile_ceu_camera:

* For Super H based SoCs: sh_mobile_ceu is used on SH_AP325RXA, SH_ECOVEC,
  SH_KFR2R09, SH_MIGOR, and SH_7724_SOLUTION_ENGINE which depend on
  CPU_SUBTYPE_SH7722, CPU_SUBTYPE_SH7723, or CPU_SUBTYPE_SH7724 which all
  select ARCH_SHMOBILE.

* For ARM Based SoCs: Since the removal of legacy (non-multiplatform)
  support this driver has not been used by any Renesas ARM based SoCs.
  The Renesas ARM based SoCs currently select ARCH_SHMOBILE, however,
  it is planned that this will no longer be the case.

This is part of an ongoing process to migrate from ARCH_SHMOBILE to
ARCH_RENESAS the motivation for which being that RENESAS seems to be a more
appropriate name than SHMOBILE for the majority of Renesas ARM based SoCs.

Thanks to Geert Uytterhoeven for analysis and portions of the
change log text.

Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] rcar_vin: Use ARCH_RENESAS
Simon Horman [Tue, 8 Mar 2016 01:03:55 +0000 (22:03 -0300)]
[media] rcar_vin: Use ARCH_RENESAS

Make use of ARCH_RENESAS in place of ARCH_SHMOBILE.

This is part of an ongoing process to migrate from ARCH_SHMOBILE to
ARCH_RENESAS the motivation for which being that RENESAS seems to be a more
appropriate name than SHMOBILE for the majority of Renesas ARM based SoCs.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] au0828: remove unused macro
Guennadi Liakhovetski [Wed, 6 Apr 2016 03:26:56 +0000 (00:26 -0300)]
[media] au0828: remove unused macro

An V4L2_CID_PRIVATE_SHARPNESS macro is defined in the au0828 driver, but
never used. Remove it.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] m5mols: potential uninitialized variable
Dan Carpenter [Tue, 15 Mar 2016 07:07:10 +0000 (04:07 -0300)]
[media] m5mols: potential uninitialized variable

Smatch complains that there are some paths where "status" isn't
initialized.  The code does assume that m5mols_read_u8() can fail so it
seems as if Smatch is correct.

Let's initialize it to REG_ISO_AUTO which is zero.

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>
8 years ago[media] cx23885: uninitialized variable in cx23885_av_work_handler()
Dan Carpenter [Tue, 15 Mar 2016 07:05:20 +0000 (04:05 -0300)]
[media] cx23885: uninitialized variable in cx23885_av_work_handler()

The "handled" variable could be uninitialized if the
interrupt_service_routine() call back hasn't been implimented or if it
has been implemented but doesn't initialize "handled" to zero at the
start.  For example, adv76xx_isr() only sets "handled" to true.

Fixes: 44b153ca639f ('[media] m5mols: Add ISO sensitivity controls')

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>
8 years ago[media] am437x-vpfe: fix an uninitialized variable bug
Dan Carpenter [Tue, 15 Mar 2016 07:04:12 +0000 (04:04 -0300)]
[media] am437x-vpfe: fix an uninitialized variable bug

If we are doing V4L2_FIELD_NONE then "ret" is used uninitialized.

Fixes: 417d2e507edc ('[media] media: platform: add VPFE capture driver support for AM437X')

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] am437x-vfpe: fix typo in vpfe_get_app_input_index
Arnd Bergmann [Mon, 14 Mar 2016 22:40:08 +0000 (19:40 -0300)]
[media] am437x-vfpe: fix typo in vpfe_get_app_input_index

gcc-6 points out an obviously silly comparison in vpfe_get_app_input_index():

drivers/media/platform/am437x/am437x-vpfe.c: In function 'vpfe_get_app_input_index':
drivers/media/platform/am437x/am437x-vpfe.c:1709:27: warning: self-comparison always evaluats to true [-Wtautological-compare]
       client->adapter->nr == client->adapter->nr) {
                           ^~

This was introduced in a slighly incorrect conversion, and it's
clear that the comparison was meant to compare the iterator
to the current subdev instead, as we do in the line above.

Fixes: d37232390fd4 ("[media] media: am437x-vpfe: match the OF node/i2c addr instead of name")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] cobalt: add MTD dependency
Arnd Bergmann [Mon, 14 Mar 2016 22:40:07 +0000 (19:40 -0300)]
[media] cobalt: add MTD dependency

The cobalt driver fails to link when it is built-in and MTD is disabled or a
loadable module:

drivers/media/built-in.o: In function `cobalt_flash_probe':
:(.text+0xb8b46): undefined reference to `mtd_device_parse_register'
:(.text+0xb8b88): undefined reference to `do_map_probe'
drivers/media/built-in.o: In function `cobalt_flash_remove':
:(.text+0xb8bb4): undefined reference to `mtd_device_unregister'
:(.text+0xb8bbe): undefined reference to `map_destroy'

This adds a Kconfig dependency to ensure we can call the API.

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>
8 years ago[media] media: v4l2-compat-ioctl32: fix missing reserved field copy in put_v4l2_create32
Tiffany Lin [Mon, 14 Mar 2016 11:16:14 +0000 (08:16 -0300)]
[media] media: v4l2-compat-ioctl32: fix missing reserved field copy in put_v4l2_create32

In v4l2-compliance utility, test VIDIOC_CREATE_BUFS will check whether reserved
filed of v4l2_create_buffers filled with zero
Reserved field is filled with zero in v4l_create_bufs.
This patch copy reserved field of v4l2_create_buffer from kernel space to user
space

Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: <stable@vger.kernel.org> # for v3.19 and up
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] dw2102: fix unreleased firmware
Sudip Mukherjee [Mon, 7 Mar 2016 10:26:55 +0000 (07:26 -0300)]
[media] dw2102: fix unreleased firmware

On the particular case when the product id is 0x2101 we have requested
for a firmware but after processing it we missed releasing it.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] cx231xx: return proper error codes at cx231xx-417.c
Mauro Carvalho Chehab [Wed, 13 Apr 2016 20:02:20 +0000 (17:02 -0300)]
[media] cx231xx: return proper error codes at cx231xx-417.c

Instead of returning -1, return valid error codes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] cx231xx: fix memory leak
Sudip Mukherjee [Mon, 7 Mar 2016 10:22:23 +0000 (07:22 -0300)]
[media] cx231xx: fix memory leak

When we returned on error we missed freeing p_current_fw and p_buffer.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l2-ioctl: simplify code
Hans Verkuil [Mon, 29 Feb 2016 10:16:39 +0000 (07:16 -0300)]
[media] v4l2-ioctl: simplify code

Instead of a big if at the beginning, just check if g_selection == NULL
and call the cropcap op immediately and return the result.

No functional changes in this patch.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] vivid: set device_caps in video_device
Hans Verkuil [Tue, 1 Mar 2016 14:57:25 +0000 (11:57 -0300)]
[media] vivid: set device_caps in video_device

This simplifies the querycap function.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l2-pci-skeleton.c: fill in device_caps in video_device
Hans Verkuil [Tue, 1 Mar 2016 14:57:24 +0000 (11:57 -0300)]
[media] v4l2-pci-skeleton.c: fill in device_caps in video_device

With the new core support for the caps the driver no longer needs
to set device_caps and capabilities in the querycap call.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l2: add device_caps to struct video_device
Hans Verkuil [Tue, 1 Mar 2016 14:57:23 +0000 (11:57 -0300)]
[media] v4l2: add device_caps to struct video_device

Instead of letting drivers fill in device_caps at querycap time,
let them fill it in when the video device is registered.

This has the advantage that in the future the v4l2 core can access
the video device's capabilities and take decisions based on that.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] exynos-gsc: remove an always false condition
Mauro Carvalho Chehab [Wed, 13 Apr 2016 19:29:31 +0000 (16:29 -0300)]
[media] exynos-gsc: remove an always false condition

As reported by smatch:
drivers/media/platform/exynos-gsc/gsc-core.c:1073 gsc_probe() warn: impossible condition '(gsc->id < 0) => (0-65535 < 0)'
drivers/media/platform/exynos-gsc/gsc-core.c: In function 'gsc_probe':
drivers/media/platform/exynos-gsc/gsc-core.c:1073:51: warning: comparison is always false due to limited range of data type [-Wtype-limits]
  if (gsc->id >= drv_data->num_entities || gsc->id < 0) {
                                                   ^

gsc->id is an u16, so it can never be a negative number. So,
remove the always false condition.

Fixes: c1ac057173ba "[media] exynos-gsc: remove non-device-tree init code"
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>