v4l2pim: increase V4L2PIM_VID_LIMIT_MAX to 128

Certain users of this pim require its stream_mem parameter to be
at least 128.

Signed-off-by: Martin Carroll <martin.carroll@alcatel-lucent.com>
v4l2pim: log comment if parameter is too high

Signed-off-by: Martin Carroll <martin.carroll@alcatel-lucent.com>
pimmgr: change pconids to low sequential integers

Previously, pconids were a large unsigned integer created by
combining pimids and and local_pconids with a bitshift sequence.

This resulted in large, opaque integers near 2^31. It has since
been decided that small, sequential numbers similar to file
descriptors would be a better choice.

With this patch, pconids are now simply the offset into a list
of mappings (pconid -> pimid/local_pconid).

This patch changes the pconid type from uint32_t to int, creates
a the lookup table and helper functions, and cleans up some
variations in the names of pconid/pimid/local_pconid variables.

This patch also changes the pimmgr ioctl error scheme to be
more consistent with the errno standard and adds an additional
error code (out of pconids).

Signed-off-by: William Katsak <william.katsak@alcatel-lucent.com>
v4l2pim: support new small integer pconids

Implement the changes required to support the small integer pconids.

Signed-off-by: William Katsak <william.katsak@alcatel-lucent.com>
udlpim: support new small integer pconids

Implement the changes required to support the small integer pconids.

Signed-off-by: William Katsak <william.katsak@alcatel-lucent.com>
pimmgr: change pcon->pim link in sysfs to "pim"

Change the sysfs symlink from pcon->pim to be named simply "pim"
instead of the name of the pim.

Signed-off-by: William Katsak <william.katsak@alcatel-lucent.com>
pimmgr: add sysfs property for pim name

Add a sysfs property for pim name to the pim directory.

Signed-off-by: William Katsak <william.katsak@alcatel-lucent.com>
pimmgr: eliminate custom ioctl error codes

Use standard error numbers instead.

Signed-off-by: William Katsak <william.katsak@alcatel-lucent.com>
pimmgr: add pim id to sysfs

Add a sysfs file to expose the pim id.

Signed-off-by: William Katsak <william.katsak@alcatel-lucent.com>
pimmgr: change localid to local_pconid in sysfs

Change the pcon sysfs property localid to local_pconid to make it
consistent with the terminology used in the code. Also modify this
property to only contain the local_pconid itself rather than a
combination of the pim name and local_pconid.

Signed-off-by: William Katsak <william.katsak@alcatel-lucent.com>
pimmgr: change the instantiate ioctl interface

Require the pim to be identified by an integer pimid (rather than the
previously used string identifier) for an instantiate request.

Signed-off-by: William Katsak <william.katsak@alcatel-lucent.com>
udlpim: allocate pbd dynamically

Rather than having a static entry for push buffer
descriptor in the info structure and wiping it out
with zeros when we don't need it, we allocate it
dynamically in alloc_pb function and free in free_pb
function.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
vcrtcm: validate pb descriptors before dereferencing

Buffer descriptor may not be valid when entering
vcrtcm_p_push function (e.g., mouse cursor that does not
exist). So before dereferencing them, make sure they
really exist.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
v4l2pim: allocate pbd dynamically

Rather than having a static entry for push buffer
descriptor in the info structure and wiping it out
with zeros when we don't need it, we allocate it
dynamically in alloc_pb function and free in free_pb
function.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
vcrtcm: add common functions to allocate and free PBDs

There is a lot of repeated code in PIMs that has to do with
allocation and freeing of push buffers. Factor it out into
VCRTCM module.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
udlpim: properly initialize mapped push buffer

pb_fb[] and pb_cursor[] fields are pointers, so initialize
them to NULL, not to (integer) zero.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
uldpim: use common functions to allocate and free pbd

When freeing and allocating push buffers UDLPIM must do the
common work (implemented in common VCRTCM utility function) and
map the pages that constitute the push buffer into the CPU address
space.

This patch eliminates custom-made alloc_pb and free_pb functions
and reworks realloc_pb. This function now unmaps the buffer,
calls common VCRTCM realloc and maps back (potentially new) buffer.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
udlpim: remove unused definition

UDLPIM_PB_ALLOC_STRING is no longer in use, so whack it.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
v4l2pim: properly initialize mapped push buffer

pb_fb[] and pb_cursor[] fields are pointers, so initialize
them to NULL, not to (integer) zero.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
v4l2pim: use common functions for alloc_pb and free_pb

When allocating the push buffer, v4l2pim needs to allocate
pages and descriptors and then map the pages into CPU's address
space followed by creating the shadow buffer (if necessary).

For the first step (descriptor and pages allocation), we now
use common functions in VCRTCM module.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>