media: xilinx: Reordered mutexes initialization

Restored earlier mutexes initialization
sequence and instead fix error handling for
media_entity_init.

Signed-off-by: Radhey Shyam Pandey <radheys@xilinx.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
char: xilinx_hwicap: missing error code if ioremap() fails

Return -ENOMEM instead of success if ioremap() fails.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
vdma: xilinx: Change copyright to 2014

Updated copyright to reflect current year in all the
applicable files

Signed-off-by: Srikanth Thokala <sthokal@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
vdma: xilinx: Added version to the compatible string

This patch adds version to the compatible string in
both driver and test client.

Signed-off-by: Srikanth Thokala <sthokal@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
vdma: xilinx: Modified loop logic

Use do-while{} instead of while{} and avoid incrementing the
loop count by 1, initially.

Signed-off-by: Srikanth Thokala <sthokal@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
vdma: xilinx: Organize constant definitions

This patch organizes constant definitions by:
- Use BIT() and GENMASK() macros whereever possible
- Remove unused constants
- Proper indentation
- Fix some typos in comments

Signed-off-by: Srikanth Thokala <sthokal@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
vdma: xilinx: Use 'Return:' syntax in function comments

Use 'Return:' syntax in function comments.

Signed-off-by: Srikanth Thokala <sthokal@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
vdma: xilinx: Simplify *_xlate function by using dma_get_slave_channel()

The DMA framework has changed to simplify _xlate() function.
This patch adapts this change by using dma_get_slave_channel()

Signed-off-by: Srikanth Thokala <sthokal@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
vdma: xilinx: Remove 'private' member and device_id logic

As per the latest DMA framework, a separate client device
node entry has to be created which makes the logic with
'private' and 'device_id' logic redundant. This patch
removes this logic.

Signed-off-by: Srikanth Thokala <sthokal@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
vdma: xilinx: Functions 'is_running' and 'is_idle' should return bool type

The functions _is_running() and _is_idle() will return either 1/0.
So, this patch changes the return type of both functions to be 'bool'.

Signed-off-by: Srikanth Thokala <sthokal@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
vdma: xilinx: Simplify cookie implementation

This patch simplifies the cookie implementation using the
calls provided by framework.

Signed-off-by: Srikanth Thokala <sthokal@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
vdma: xilinx: Use dma_slave_config generic API

This patch creates a separate function for the IP specific
configuration instead of embedding the driver specific configuration
into generic structure 'dma_slave_config'.

This patch also forces a change in dma test client.

Signed-off-by: Srikanth Thokala <sthokal@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
vdma: xilinx: Use request_irq instead of devm_request_irq

devres resources will only be freed after the remove() function call.
So, here there will be a possible race condition where 'chan'
will be freed before the interrupt handler has been released and
the interrupt handler can access already freed memory.  This patch
fix this race condition.

Signed-off-by: Srikanth Thokala <sthokal@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
vdma: xilinx: Minor fixes

This patch does the following,
- Fix typos
- Organize macros
- Moved the print statement in the probe() to the end indicating
  probe is successful.
- Combined variable declaration and initialization in remove().
- num-fstores DT property is read as u32, so change the local
  variable to u32 to avoid compilation warning.
- Use multi-line comments wherever applicable.
- Remove extra braces.

Signed-off-by: Srikanth Thokala <sthokal@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
vdma: xilinx: Organize tasklet function calls

Tasklet initialization and freeing is not required everytime
a channel is requested or released.  So, moved these function
calls to probe/remove().

Signed-off-by: Srikanth Thokala <sthokal@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
vdma: xilinx: Simplified data width parsing logic

This patch simplify the data width DT property parsing
logic.

Signed-off-by: Srikanth Thokala <sthokal@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
vdma: xilinx: Error out if flush_fsync DT property is not present

flush_fsync is a required DT property, so return the function
with an error when the entry is not found in the DT.

Signed-off-by: Srikanth Thokala <sthokal@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
vdma: xilinx: alloc_chan_resources normally should return 0

Modified the return type of alloc_chan_resources to return 0
and removed vague comment.

Signed-off-by: Srikanth Thokala <sthokal@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
vdma: xilinx: Modified slave_sg functionality to use interleaved_dma

Two-dimensional DMA engine should use interleaved_dma API rather
than slave_sg, which is meant for 1-D transfers.  This patch modifies
this functionality.

Signed-off-by: Srikanth Thokala <sthokal@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
vdma: xilinx: Remove redundant code in start_transfer

The code for checking any errors on the channel is redundant,
as it is being checked at the beginning.  So, this patch
removes this redundant code.

Signed-off-by: Srikanth Thokala <sthokal@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>