profile/common/kernel-common.git
9 years agoASoC: rsnd: care audio local bus data format consistency
Kuninori Morimoto [Thu, 31 Jul 2014 06:52:26 +0000 (23:52 -0700)]
ASoC: rsnd: care audio local bus data format consistency

R-Car sound uses Audio Local Bus which uses Lch/Rch format.
This bus is used if driver uses BUSIF.
But sound data is written as Rch/Lch format in register.
This means Rch <-> Lch will be inverted.
SSIU :: BUSIF_DALIGN is used to controlling data format.

Reported-by: Jun Watanabe <jun.watanabe.ue@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 1cc7195929501b96fccce42646f1ad0ffe2598a6)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: care detail of SRC_BSDSR
Kuninori Morimoto [Thu, 31 Jul 2014 06:52:04 +0000 (23:52 -0700)]
ASoC: rsnd: care detail of SRC_BSDSR

Driver should care more detail of SRC_BSDSR settings.
The sound includes noise without this patch
if it used SRC.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 054cd7f4b986a941b56372b743602f7df6569c98)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: use regmap_mmio instead of original regmap bus
Kuninori Morimoto [Tue, 29 Jul 2014 07:37:31 +0000 (00:37 -0700)]
ASoC: rsnd: use regmap_mmio instead of original regmap bus

Current rsnd driver is using regmap and regmap_field.
It used original regmap bus which is
single regmap instance for multi register mapping.
This patch modifies it to use regmap_mmio bus,
and tidyuped probe method

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit b8c637864a6904a9ba8e0df556d5bdf9f26b2c54)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: fixup dai remove callback operation
Kuninori Morimoto [Thu, 24 Jul 2014 08:51:31 +0000 (01:51 -0700)]
ASoC: rsnd: fixup dai remove callback operation

rsnd driver is using SSI/SRC/DVC which are
using "mod" base operation.
These "mod" are supporting "probe" and "remove" callbacks.

Current rsnd_probe should call "remove" if "probe" was failed,
since "probe" might be having DMAEngine handle.
Some mod's "remove" callback might be called without calling
"probe", but it is no problem. because "remove" do nothing
in such case.

So, all mod's "remove" should be called when error case
of rsnd_probe() and rsnd_remove().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit d62a3dcd4d75b1713d12697afdbffaf9a9da8f43)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: add missing src/dst_addr_width for DMAEngine
Kuninori Morimoto [Thu, 17 Jul 2014 06:18:44 +0000 (23:18 -0700)]
ASoC: rsnd: add missing src/dst_addr_width for DMAEngine

Renesas new DMAEngine driver requests src/dst_addr_width

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 2bf865ba30405056e7922b960a1687bb4d5a4999)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: add DT support to DVC
Kuninori Morimoto [Mon, 23 Jun 2014 00:59:28 +0000 (17:59 -0700)]
ASoC: rsnd: add DT support to DVC

Now, DVC can use DT

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 34cb6123f90d264d63bdcd3ee0df0d2cb4b36aab)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: DMA start address is properly used for each DMAC
Kuninori Morimoto [Mon, 23 Jun 2014 00:59:02 +0000 (17:59 -0700)]
ASoC: rsnd: DMA start address is properly used for each DMAC

R-Car sound uses Audio DMAC and Audio DMAC peri peri.
Audio DMAC peri peri transfers data inside circuit.

DMA transfer needs source / destination address,
and destination address can be set via dmaengine_slave_config().
The source address can be set when starting DMAEngine.
Because Audio DMAC peri peri always ignores its value,
current driver always used same source address for
Audio DMAC / Audio DMAC peri peri
(Audio DMAC peri peri source / destination address
is always fixed value)
But, This is not good match for DT booting.
This patch properly uses DMA start address
for Audio DMAC / Audio DMAC peri peri.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 340371005d399b595f4044fc5e336f4a66ead101)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: DMA cleanup for flexible SSI/SRC selection
Kuninori Morimoto [Mon, 23 Jun 2014 00:58:26 +0000 (17:58 -0700)]
ASoC: rsnd: DMA cleanup for flexible SSI/SRC selection

Current R-Car sound SSI/SRC/DVC selection has feature limit.
(It is assuming that SSI/SRC are using same index number)

So that enabling SSI/SRC flexible selection,
this patch modifies DMA settings.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 37523034851d6a4b1dc951e24bf2f11bc28fe58d)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: enable DVC when capture
Kuninori Morimoto [Mon, 23 Jun 2014 00:57:04 +0000 (17:57 -0700)]
ASoC: rsnd: enable DVC when capture

Current DVC can be enabled only when playback,
but, this came from misunderstanding.
It is not correct.

DVC <-> DMA relationship is...

Playback: MEM -> DMAC  -> SRC -> DVC -> DMACp -> SSI
Capture:  SSI -> DMACp -> SRC -> DVC -> DMAC  -> MEM

DVC can be used for both Playback/Capture

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 65f459923b7926f6a7f156970d83360bd80cb169)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: use dmaengine_prep_dma_cyclic() instead of original method
Kuninori Morimoto [Mon, 23 Jun 2014 00:56:41 +0000 (17:56 -0700)]
ASoC: rsnd: use dmaengine_prep_dma_cyclic() instead of original method

Current R-Car sound driver is using DMAEngine directly,
but, ASoC is requesting to use common DMA transfer method,
like snd_dmaengine_pcm_trigger() or dmaengine_pcm_ops.
It is difficult to switch at this point, since Renesas
driver is also supporting PIO transfer.
This patch uses dmaengine_prep_dma_cyclic() instead
of dmaengine_prep_slave_single().
It is used in requested method,
and is good first step to switch over.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit ccd01559ead29b59918458e9b412ff18b88fc6cf)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: SSI + DMA can select BUSIF
Kuninori Morimoto [Mon, 23 Jun 2014 00:56:23 +0000 (17:56 -0700)]
ASoC: rsnd: SSI + DMA can select BUSIF

Sound data needs to be sent to R-Car sound SSI when playback.
But, there are 2 interfaces for it.
1st is SSITDR/SSIRDR which are mapped on SSI.
2nd is SSIn_BUSIF which are mapped on SSIU.

2nd SSIn_BUSIF is used when DMA transfer,
and it is always used if sound data came from via SRC.
But, we can use it when SSI+DMA case too.
(Current driver is assuming 1st SSITDR/SSIRDR for it)

2nd SSIn_BUSIF can be used as FIFO.
This is very helpful/useful for SSI+DMA.

But DMA address / DMA ID are not same between 1st/2nd cases.
This patch care about these settings.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit d9288d0ba12de1b5efb830b9128e4cc6877318fc)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rcar: Fix dma direction type
Lars-Peter Clausen [Thu, 19 Jun 2014 07:40:30 +0000 (09:40 +0200)]
ASoC: rcar: Fix dma direction type

dmaengine_prep_slave_single() expects a enum dma_transfer_direction and not a
enum dma_data_direction. Since the integer representations of both DMA_TO_DEVICE
and DMA_MEM_TO_DEV aswell as DMA_FROM_DEVICE and DMA_DEV_TO_MEM have the same
value the code worked fine even though it was using the wrong type.

Fixes the following warning from sparse:
sound/soc/sh/rcar/core.c:227:49: warning: mixing different enum types
sound/soc/sh/rcar/core.c:227:49:     int enum dma_data_direction  versus
sound/soc/sh/rcar/core.c:227:49:     int enum dma_transfer_direction

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit cd7bcc6000165f6215d15e2e32b58a646e5de5ec)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: fixup loop exit timing of dma name search
Kuninori Morimoto [Wed, 18 Jun 2014 08:55:09 +0000 (17:55 +0900)]
ASoC: rsnd: fixup loop exit timing of dma name search

Current dma name search loop didn't care about SSI index
This patch fixes it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit c08c3b088053cec1465051258844e7934d3e3e37)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoASoC: rsnd: fixup rsnd_gen_dma_addr() for Gen1
Kuninori Morimoto [Wed, 18 Jun 2014 08:54:43 +0000 (17:54 +0900)]
ASoC: rsnd: fixup rsnd_gen_dma_addr() for Gen1

ad32d0c7b0e993433df152ae747652647eb65a27
(ASoC: rsnd: add rsnd_gen_dma_addr() for DMAC addr)
added rsnd_gen_dma_addr() to calculate DMA addr,
but, it is necessary only for Gen2.
This patch ignores Gen1 case.
Kernel will be panic without this patch.
Special thanks to Simon

Reported-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 64eae986fc1e3a281b00f04b7c9c00b145ec8a57)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: uds: Fix scaling of alpha layer
Laurent Pinchart [Sat, 31 May 2014 00:45:48 +0000 (21:45 -0300)]
v4l: vsp1: uds: Fix scaling of alpha layer

Pixel color components can be scaled using either bilinear interpolation
or a multitap filter. The multitap filter provides better results, but
can't be selected when the alpha layer need to be scaled down by more
than 1/2.

Disable alpha scaling when the input has a fixed alpha value, and
program the UDS to output a fixed alpha value in that case. This ensures
the multitap filter will be used whenever possible.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit bdc2df62ae38bbab044078f4d25a7a3d9e2379c9)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: bru: Make the background color configurable
Laurent Pinchart [Wed, 28 May 2014 01:46:30 +0000 (22:46 -0300)]
v4l: vsp1: bru: Make the background color configurable

Expose the background color to userspace through the V4L2_CID_BG_COLOR
control.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit a16e2794592b733d47f372f0cadcd9ff0f349ca9)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: bru: Support non-premultiplied colors at the BRU output
Laurent Pinchart [Tue, 27 May 2014 23:35:36 +0000 (20:35 -0300)]
v4l: vsp1: bru: Support non-premultiplied colors at the BRU output

The BRU outputs premultiplied colors, enable color data normalization
when the format configured at the output of the pipeline isn't
premultiplied.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 9aca813e1401dcafe1c0a9d3b03795e254571504)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: bru: Support premultiplied alpha at the BRU inputs
Laurent Pinchart [Tue, 27 May 2014 23:35:36 +0000 (20:35 -0300)]
v4l: vsp1: bru: Support premultiplied alpha at the BRU inputs

Adjust the BRU blending formula to avoid the multiplication by alpha
when the corresponding input format is premultiplied. As this requires
access to the RPFs connected to the BRU inputs from the BRU module,
store pointers to the RPFs in the BRU structure when validating the
pipeline.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 6418b4d6e1f1d70199a93eeeed948be2229b9c1a)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: Add V4L2_CID_ALPHA_COMPONENT control support
Laurent Pinchart [Wed, 21 May 2014 22:00:05 +0000 (19:00 -0300)]
v4l: vsp1: Add V4L2_CID_ALPHA_COMPONENT control support

The control is used to configure the fixed alpha channel value, when
reading from memory in the RPF or writing to memory in the WPF.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 7578c204620c8e25ec6e4849cd12098f831a14d0)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: Add alpha channel support to the memory ports
Laurent Pinchart [Mon, 26 May 2014 23:12:53 +0000 (20:12 -0300)]
v4l: vsp1: Add alpha channel support to the memory ports

Support ARGB formats on the RPF side by reading the alpha component from
memory and on the WPF side by writing it to memory.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 7a52b6dea8e9559428149fbed0cddd587004006e)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: Switch to XRGB formats
Laurent Pinchart [Mon, 26 May 2014 22:57:21 +0000 (19:57 -0300)]
v4l: vsp1: Switch to XRGB formats

The driver ignores the alpha component on output video nodes and
hardcodes the alpha component to 0 on capture video nodes. Make this
explicit by exposing XRGB formats.

Compatibility with existing userspace applications is handled by
selecting the XRGB format corresponding to the requested old RGB format.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 56bfef3e72cf4a98d0e8f56129673146733c1366)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: wpf: Clear RPF to WPF association at stream off time
Laurent Pinchart [Wed, 28 May 2014 16:10:33 +0000 (13:10 -0300)]
v4l: vsp1: wpf: Clear RPF to WPF association at stream off time

The VSP1 stores the video pipelines' input (RPF) to output (WPF)
mappings in a WPF register. An RPF must never be associated with
multiple WPFs, even if all of those WPFs but one are unused, otherwise
the hardware won't function properly.

The driver doesn't ensure this correctly as it never clears the
mappings. An RPF used with one WPF and later with a different WPF will
lead to malfunction, as it will be associated with two WPFs. Clear the
mappings at stream off time to fix this.

Reported-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit d6c71e8ceb9fe79aaf9c2f73af5cb2ef93526b0d)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: wpf: Simplify cast to pipeline structure
Laurent Pinchart [Tue, 27 May 2014 23:35:36 +0000 (20:35 -0300)]
v4l: vsp1: wpf: Simplify cast to pipeline structure

Use the subdev pointer directly to_vsp1_pipeline() macro instead of
casting from the subdev to the wpf object and back to the subdev.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 5aeb01adbea81e858318072097d98fc44578c7be)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: sru: Make the intensity controllable during streaming
Laurent Pinchart [Sat, 31 May 2014 23:30:11 +0000 (20:30 -0300)]
v4l: vsp1: sru: Make the intensity controllable during streaming

The control value is currently stored in the SRU structure by the
control set handler and written to the hardware at stream on time,
making control set during streaming ineffective. Fix it by writing to
the registers from within the control set handler.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 58f896d859ce555dd3684f439f8a65bfda437533)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: sru: Fix the intensity control default value
Laurent Pinchart [Wed, 21 May 2014 22:00:05 +0000 (19:00 -0300)]
v4l: vsp1: sru: Fix the intensity control default value

The default value isn't set and defaults to 0, which isn't in the 1-6
min-max range. Fix it by setting the default value to 1.

This shoud have been caught when checking the control handler error
field at initialization time, but the check was missing. Add it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit a1606102dafe6942905e97a88ceea9a60e1a2c7d)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: Setup control handler automatically at stream on time
Laurent Pinchart [Sat, 31 May 2014 13:40:51 +0000 (10:40 -0300)]
v4l: vsp1: Setup control handler automatically at stream on time

When setting a control directly on a subdev node the VSP1 driver doesn't
guarantee that the device is powered on. This leads to crashes when the
control handlers writes to hardware registers. One easy way to fix this
is to ensure that the device gets powered on when a subdev node is
opened. However, this consumes power unnecessarily, as there's no need
to power the device on when setting formats on the pipeline.
Furthermore, control handler setup at entity init time suffers from the
same problem as the device isn't powered on easier.

Fix this by extend the entity base object to setup the control handler
automatically when starting the stream. Entities must then skip writing
to registers in the set control handler when not streaming, which can be
tested with the new vsp1_entity_is_streaming() helper function.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 960de2cff49a4e5f45e6a60175f4298cc34dc526)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: Propagate vsp1_device_get errors to the callers
Laurent Pinchart [Sat, 31 May 2014 11:50:32 +0000 (08:50 -0300)]
v4l: vsp1: Propagate vsp1_device_get errors to the callers

Modify the vsp1_device_get() function to return an error code instead of
a pointer to the VSP1 device, and use the return value in the callers.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 4c16d6a079a4c9a64d664cc9c30ebae5f0bd0c64)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: Cleanup video nodes at removal time
Laurent Pinchart [Wed, 28 May 2014 15:49:13 +0000 (12:49 -0300)]
v4l: vsp1: Cleanup video nodes at removal time

Video nodes created and initialized in the RPF and WPF init code paths
are never unregistered, and the related resources (videobuf alloc
context and media entity) never released.

Fix this by storing a pointer to the vsp1_video object in vsp1_entity
and calling vsp1_video_cleanup() from vsp1_entity_destroy(). This also
allows simplifying the init error code paths.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 1499be67a545fb6f41acb5614b8e4732147cec50)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: Fix typos
Laurent Pinchart [Tue, 27 May 2014 15:59:39 +0000 (12:59 -0300)]
v4l: vsp1: Fix typos

Several macros were mistakenly prefixed with VPS1 instead of VSP1. Fix
them.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 7005a81705d032887b9f4f808e6dce8e57b8980a)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: Fix pipeline stop timeout
Laurent Pinchart [Mon, 23 Jun 2014 20:15:02 +0000 (17:15 -0300)]
v4l: vsp1: Fix pipeline stop timeout

If the pipeline was already stopped when stopping the stream, no
frame end interrupt will be generated and the driver will time out
waiting for the pipeline to stop.

Fix this by setting the pipeline state to STOPPED when the pipeline is
idle waiting for frames to process, and to STOPPING at stream stop time
only when the pipeline is currently RUNNING.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 9b3e6e2abd7568f9458e927fc4e5eca1b3cde521)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: Release buffers at stream stop
Laurent Pinchart [Mon, 23 Jun 2014 19:57:22 +0000 (16:57 -0300)]
v4l: vsp1: Release buffers at stream stop

videobuf2 expects no buffer to be owned by the driver when the
stop_stream queue operation returns. As the vsp1 driver fails to do so,
a warning is generated at stream top time.

Fix this by releasing all buffers queued on the IRQ queue in the
stop_stream operation handler and marking them as erroneous.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 9df04e9d9ac6982d16a8a042c8274410ed29fb0e)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vsp1: Fix routing cleanup when stopping the stream
Laurent Pinchart [Mon, 23 Jun 2014 21:40:49 +0000 (18:40 -0300)]
v4l: vsp1: Fix routing cleanup when stopping the stream

Commit d9b45ed3d8b75e8cf38c8cd1563c29217eecba27 ("v4l: vsp1: Support
multi-input entities") reworked pipeline routing configuration and
introduced a bug by writing to the entities routing registers without
first checking whether the entity had a routing register. This results
in overwriting the value at offset 0 of the device register space when
stopping the stream.

Fix this by skipping routing register write for entities without a
routing register.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit aaa48cbb098e13cf9c22066b8c65958a7243fb95)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agorcar_vin: add devicetree support
Ben Dooks [Sat, 5 Jul 2014 22:26:22 +0000 (19:26 -0300)]
rcar_vin: add devicetree support

Add support for devicetree probe for the rcar-vin
driver.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
[g.liakhovetski@gmx.de fix a typo, sort headers alphabetically]
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 47c71bd61b772cd72159dff4aae43734257a485a)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agorcar_vin: copy flags from pdata
Ben Dooks [Mon, 14 Apr 2014 10:36:40 +0000 (07:36 -0300)]
rcar_vin: copy flags from pdata

The platform data is a single word, so simply copy
it into the device's private data structure than
keeping a copy of the pointer.

This will make changing to device-tree binding
easier as it is one allocation instead of two.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 25dfa02ce21981ef08d375be987862f96676d8ab)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoof: move graph helpers from drivers/media/v4l2-core to drivers/of
Philipp Zabel [Mon, 10 Feb 2014 21:01:48 +0000 (22:01 +0100)]
of: move graph helpers from drivers/media/v4l2-core to drivers/of

This patch moves the parsing helpers used to parse connected graphs
in the device tree, like the video interface bindings documented in
Documentation/devicetree/bindings/media/video-interfaces.txt, from
drivers/media/v4l2-core/v4l2-of.c into drivers/of/base.c.

This allows to reuse the same parser code from outside the V4L2
framework, most importantly from display drivers.
The functions v4l2_of_get_next_endpoint, v4l2_of_get_remote_port,
and v4l2_of_get_remote_port_parent are moved. They are renamed to
of_graph_get_next_endpoint, of_graph_get_remote_port, and
of_graph_get_remote_port_parent, respectively.
Since there are not that many current users yet, switch all of
them to the new functions right away.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
(cherry picked from commit fd9fdb78a9bf85b94fb2190c82ff280c8f8375cc)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoi2c: i2c-rcar: Drop class based scanning to improve bootup time
Wolfram Sang [Thu, 10 Jul 2014 11:46:31 +0000 (13:46 +0200)]
i2c: i2c-rcar: Drop class based scanning to improve bootup time

This driver has been flagged to drop class based instantiation. The removal
improves boot-up time and is unneeded for embedded controllers. Users have been
warned to switch for some time now, so we can actually do the removal. Keep the
DEPRECATED flag, so the core can inform users that the behaviour finally
changed now. After another transition period, this flag can go, too.
While we are here, remove the indentation for the array setup because
such things always break after some time.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
(cherry picked from commit 929e3aba5114235388793443cbc05882904577b9)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoPCI: rcar: Fix GPL v2 license string typo
Bjorn Helgaas [Tue, 15 Jul 2014 21:06:12 +0000 (15:06 -0600)]
PCI: rcar: Fix GPL v2 license string typo

Per license_is_gpl_compatible(), the MODULE_LICENSE() string for GPL v2 is
"GPL v2", not "GPLv2".  Use "GPL v2" so this module doesn't taint the
kernel.

Based-on-work-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
(cherry picked from commit 68947eb17503ce2009c603d0d0bb9feb139fb8b8)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrm/rcar-du: Fix maximum frame buffer pitch computation
Laurent Pinchart [Mon, 28 Jul 2014 18:18:36 +0000 (20:18 +0200)]
drm/rcar-du: Fix maximum frame buffer pitch computation

The maximum pitch constraint for the hardware is expressed in pixels.
Convert it to bytes to validate frame buffer creation, as frame buffer
pitches are expressed in bytes.

Reported-by: Phil Edworthy <phil.edworthy@renesas.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 8bed5cc765ffdd61b59f8405d38b377f5a7f0920)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodrm: rcar-du: fix warnings
Russell King [Sun, 13 Jul 2014 11:18:58 +0000 (12:18 +0100)]
drm: rcar-du: fix warnings

drivers/gpu/drm/rcar-du/rcar_du_drv.c:190:5: warning: "CONFIG_PM_SLEEP" is not defined [-Wundef]

Always use #ifdef with CONFIG symbols, never just bare #if

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 396d7a24a9b3ddbce3335c57a234227eb7762d14)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agothermal: rcar: Document SoC-specific bindings
Geert Uytterhoeven [Wed, 9 Jul 2014 12:23:35 +0000 (14:23 +0200)]
thermal: rcar: Document SoC-specific bindings

The documentation only mentioned the generic fallback compatible property.
Add the missing SoC-specific compatible properties, some of which are
already in use.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <eduardo.valentin@ti.com>
Cc: linux-pm@vger.kernel.org
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
(cherry picked from commit fa313103c953fd832b7c4e431c74be55c20b1ce1)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: rspi: Fix leaking of unused DMA descriptors
Geert Uytterhoeven [Wed, 6 Aug 2014 12:58:58 +0000 (14:58 +0200)]
spi: rspi: Fix leaking of unused DMA descriptors

If dmaengine_prep_slave_sg() or dmaengine_submit() fail, we may leak
unused DMA descriptors.

As per Documentation/dmaengine.txt, once a DMA descriptor has been
obtained, it must be submitted. Hence:
  - First prepare and submit all DMA descriptors,
  - Prepare the SPI controller for DMA,
  - Start DMA by calling dma_async_issue_pending(),
  - Make sure to call dmaengine_terminate_all() on all descriptors that
    haven't completed.

Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 3819bc8752367eae0d72fa1c473dc88ea45631a7)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: rspi: Handle dmaengine_prep_slave_sg() failures gracefully
Geert Uytterhoeven [Wed, 9 Jul 2014 10:26:22 +0000 (12:26 +0200)]
spi: rspi: Handle dmaengine_prep_slave_sg() failures gracefully

As typically a shmobile SoC has less DMA channels than devices that can use
DMA, we may want to prioritize access to the DMA channels in the future.
This means that dmaengine_prep_slave_sg() may start failing arbitrarily.

Handle dmaengine_prep_slave_sg() failures gracefully by falling back to
PIO.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 85912a88c1ebcad04a5cfec971771195ce8d6691)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agosh: intc: Confine SH_INTC to platforms that need it
Geert Uytterhoeven [Wed, 20 Aug 2014 13:39:22 +0000 (15:39 +0200)]
sh: intc: Confine SH_INTC to platforms that need it

Currently the sh-intc driver is compiled on all SuperH and
non-multiplatform SH-Mobile platforms, while it's only used on a limited
number of platforms:
  - SuperH: SH2(A), SH3(A), SH4(A)(L) (all but SH5)
  - ARM: sh7372, sh73a0

Drop the "default y" on SH_INTC, make all CPU platforms that use it
select it, and protect all sub-options by "if SH_INTC" to fix this.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Magnus Damm <damm+renesas@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 049d28048be595e0a10a58fe1c104b153c386633)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Conflicts:
arch/arm/mach-shmobile/Kconfig
arch/sh/Kconfig

9 years agonet: sh_eth: Add r8a7794 support
Hisashi Nakamura [Fri, 1 Aug 2014 15:03:00 +0000 (17:03 +0200)]
net: sh_eth: Add r8a7794 support

Signed-off-by: Hisashi Nakamura <hisashi.nakamura.ak@renesas.com>
[uli: added bindings documentation]
Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 0f76b9d83b2b010b63a094024b3cfd82e20af28d)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agommc: sh_mmcif: Configure DMA slave bus width
Laurent Pinchart [Tue, 15 Jul 2014 22:45:13 +0000 (00:45 +0200)]
mmc: sh_mmcif: Configure DMA slave bus width

The data register is 4 bytes wide, hardcode the DMA transfer size to
4 bytes in both directions.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit e36152aa84cf68bd7f09acffd480cd2b6aa5480d)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agommc: sh_mmcif: Fix DMA slave address configuration
Laurent Pinchart [Tue, 15 Jul 2014 22:45:12 +0000 (00:45 +0200)]
mmc: sh_mmcif: Fix DMA slave address configuration

Commit e5a233cb647d749de2f188477c9a54b94d90477f ("mmc: sh_mmcif:
Factorize DMA channel request and configuration code") incorrectly
set the destination address for both slave channels instead of setting
the source address for the receive channel. Fix that.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit d25006e7e5045e76575e9f58903efc1a860a3ff1)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agommc: tmio: Configure DMA slave bus width
Laurent Pinchart [Tue, 15 Jul 2014 22:45:14 +0000 (00:45 +0200)]
mmc: tmio: Configure DMA slave bus width

Even though some implementations support 4-bytes data register access,
the tmio driver never configures the hardware in such a way and always
performs 2-bytes accesses. Hardcode the DMA transfer size to 2 bytes.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit 39ab196243e8732ad68928be97129305b29afbbd)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: sh-msiof: Fix transmit-only DMA transfers
Geert Uytterhoeven [Thu, 7 Aug 2014 12:07:43 +0000 (14:07 +0200)]
spi: sh-msiof: Fix transmit-only DMA transfers

Fix tx/rx mixup, which broke transmit-only transfers.

Introduced by commit 4240305f7cbdc7782aa8bc40cc702775d9ac0839
("spi: sh-msiof: Fix leaking of unused DMA descriptors").

Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit cdcd565fa0925edf9b80c875fcc84a231c75bd1d)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: sh-msiof: Fix leaking of unused DMA descriptors
Geert Uytterhoeven [Wed, 6 Aug 2014 12:59:03 +0000 (14:59 +0200)]
spi: sh-msiof: Fix leaking of unused DMA descriptors

If dmaengine_prep_slave_sg() or dmaengine_submit() fail, we may leak
unused DMA descriptors.

As per Documentation/dmaengine.txt, once a DMA descriptor has been
obtained, it must be submitted. Hence:
  - First prepare and submit all DMA descriptors,
  - Prepare the SPI controller for DMA,
  - Start DMA by calling dma_async_issue_pending(),
  - Make sure to call dmaengine_terminate_all() on all descriptors that
    haven't completed.

Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 3e81b59208fa4697c6c3b6eefb92892b47f8b1e7)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: sh-msiof: Use correct device for DMA mapping with IOMMU
Geert Uytterhoeven [Fri, 11 Jul 2014 15:56:22 +0000 (17:56 +0200)]
spi: sh-msiof: Use correct device for DMA mapping with IOMMU

To function correctly in the presence of an IOMMU, the DMA buffers must be
mapped using the DMA channel's device instead of the MSIOF platform
device's device.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 5dabcf2f27ded864cf79204c4a3cca1516b66026)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: sh-msiof: Handle dmaengine_prep_slave_single() failures gracefully
Geert Uytterhoeven [Wed, 9 Jul 2014 10:26:23 +0000 (12:26 +0200)]
spi: sh-msiof: Handle dmaengine_prep_slave_single() failures gracefully

As typically a shmobile SoC has less DMA channels than devices that can use
DMA, we may want to prioritize access to the DMA channels in the future.
This means that dmaengine_prep_slave_single() may start failing
arbitrarily.

Handle dmaengine_prep_slave_single() failures gracefully by falling back to
PIO. This requires moving DMA-specific configuration of the MSIOF device
after the call(s) to dmaengine_prep_slave_single().

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 279d2378c9c4f05bbe41b55625b4003871026266)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: sh-msiof: Add DMA support
Geert Uytterhoeven [Mon, 30 Jun 2014 10:10:24 +0000 (12:10 +0200)]
spi: sh-msiof: Add DMA support

Add DMA support to the MSIOF driver using platform data.

As MSIOF DMA is limited to 32-bit words (requiring byte/wordswapping for
smaller wordsizes), and the group length is limited to 256 words, DMA is
performed on two fixed pages, allocated and mapped at driver initialization
time.

Performance figures (in Mbps) on r8a7791/koelsch at different SPI clock
frequencies for 1024-byte and 4096-byte transfers:

                   1024 bytes           4096 bytes
  -  3.25 MHz: PIO  2.1, DMA  2.6 | PIO  2.8, DMA  3.1
  -  6.5  MHz: PIO  3.2, DMA  4.4 | PIO  5.0, DMA  5.9
  - 13    MHz: PIO  4.2, DMA  6.6 | PIO  8.2, DMA 10.7
  - 26    MHz: PIO  5.9, DMA 10.4 | PIO 12.4, DMA 18.4

Note that DMA is only faster than PIO for transfers that exceed the FIFO
size (typically 64 words / 256 bytes).

Also note that large transfers (larger than the group length for DMA, or
larger than the FIFO size for PIO), should use cs-gpio (with the
appropriate pinmux setup), as the hardware chipselect will be deasserted in
between chunks.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit b0d0ce8b6b91a0f6f99045b6019fc4c824634fb4)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: sh-msiof: Refactor sh_msiof_transfer_one()
Geert Uytterhoeven [Fri, 20 Jun 2014 10:16:19 +0000 (12:16 +0200)]
spi: sh-msiof: Refactor sh_msiof_transfer_one()

  - Move buffer pointer and length setup to the top,
  - Make unsigned values unsigned,
  - Loop over words and increment pointers instead of recalculating them,
    which allows to kill bytes_done.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 0312d59130693adad85c2acfbc0b92a669930a41)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: sh-msiof: Improve transfer error handling
Geert Uytterhoeven [Fri, 20 Jun 2014 10:16:18 +0000 (12:16 +0200)]
spi: sh-msiof: Improve transfer error handling

  - Add a timeout when waiting for the transfer complete interrupt,
  - If sh_msiof_spi_stop() fails, there's no need to clear IER, as the
    interrupt handler has already done that,
  - Propagate transfer failures in sh_msiof_transfer_one().

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 75b82e23a4ea20a9e1a48695ff5e01761889dbb3)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: sh-msiof: Extract sh_msiof_spi_{start,stop}() helpers
Geert Uytterhoeven [Fri, 20 Jun 2014 10:16:17 +0000 (12:16 +0200)]
spi: sh-msiof: Extract sh_msiof_spi_{start,stop}() helpers

Based on an old patch by Guennadi Liakhovetski <g.liakhovetski@gmx.de>

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 76c02e71612533206cb062b875c9609bce83d23a)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: sh-msiof: Add more register documentation
Geert Uytterhoeven [Fri, 20 Jun 2014 10:16:16 +0000 (12:16 +0200)]
spi: sh-msiof: Add more register documentation

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 2e2b36872d7b45b1f88a590283b14c67931b777f)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agosh-pfc: r8a7791: fix CAN pin groups
Sergei Shtylyov [Mon, 28 Jul 2014 22:12:55 +0000 (02:12 +0400)]
sh-pfc: r8a7791: fix CAN pin groups

I had made last-minute changes before submitting the patch "sh-pfc: r8a7791:
add CAN pin groups"; now I'm seeing that they weren't complete: I had missed
update to the pin group names in pin[01]_groups[]. Drop the "_a" suffixes there.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
(cherry picked from commit 302fb1781783ded370f515e8e649b8285ee29cdc)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoserial: sh-sci: Add calculation recive margin for HSCIF
Nobuhiro Iwamatsu [Mon, 14 Jul 2014 07:10:00 +0000 (16:10 +0900)]
serial: sh-sci: Add calculation recive margin for HSCIF

When the error of the same bit rate is detected, we will need to select
the recive margin is large. Current code holds the minimum error, it does
not have to check the recive margin. This adds this calculation.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 730c4e782c039caf40b467c35f595c005e94220c)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoserial: sh-sci: Fix range check of bit-rate for HSCIF
Nobuhiro Iwamatsu [Mon, 14 Jul 2014 07:09:59 +0000 (16:09 +0900)]
serial: sh-sci: Fix range check of bit-rate for HSCIF

If bit-rate calculation result of HSCIF is expect 255 from 0,
driver does not calculate error bit. However, we need to round
the value to calculate error bit in the case of negative value.
This rounds the value of bit-rate using clamp(), and bit-rate is the
case of negative value, it enables the calculation of the error bit.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit bcb9973a6097652a12660958449301aada41de9c)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoserial: sh-sci: Updated calculation of bit error rate and bit rate
Nobuhiro Iwamatsu [Mon, 14 Jul 2014 07:09:58 +0000 (16:09 +0900)]
serial: sh-sci: Updated calculation of bit error rate and bit rate

Currently, the decimal point is discarded calculation of BRR.
Therefore, it can not calculate a value close to the correct value.
This patch fixes this problem by using DIV_ROUND_CLOSEST.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit b7d66397f4d282ddf2a2fe516fc9329c5a063459)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodmaengine: sh: Rework Kconfig and Makefile
Laurent Pinchart [Thu, 31 Jul 2014 00:34:04 +0000 (09:34 +0900)]
dmaengine: sh: Rework Kconfig and Makefile

Separate helpers and drivers in the Kconfig and Makefile to improve
readability and move the CONFIG_OF dependency from the Makefile to
Kconfig.

[pebolle@tiscali.nl: reported need to rename SHDMA_R8A73A4 instances]
Reported-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
[horms+renesas@verge.net.au: squashed rename of SHDMA_R8A73A4 instances]
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
(cherry picked from commit 9f2c2bb31258e11b1ebaf73bdf2a88f8afaa2dd2)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodmaengine: shdma: Use defines instead of hardcoded numbers
Geert Uytterhoeven [Fri, 20 Jun 2014 12:37:41 +0000 (14:37 +0200)]
dmaengine: shdma: Use defines instead of hardcoded numbers

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 0cdbee33ea42bfd5f61f824e258a1a0944dd2a27)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agodmaengine: shdma: Add more register documentation
Geert Uytterhoeven [Fri, 20 Jun 2014 12:37:38 +0000 (14:37 +0200)]
dmaengine: shdma: Add more register documentation

Also add a few definitions that were missing.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 6b32fafee2bb5fcf0b3d3d04a9762d3a0212089e)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agousb: renesas_usbhs: add R-Car Gen. 2 init and power control
Ulrich Hecht [Thu, 10 Jul 2014 07:53:59 +0000 (09:53 +0200)]
usb: renesas_usbhs: add R-Car Gen. 2 init and power control

In preparation for DT conversion to reduce reliance on platform device
callbacks.

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit 8ecef00fe1f33658ee36e902dba6850b51312073)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agousb: renesas_usbhs: gadget: fix re-enabling pipe without re-connecting
Yoshihiro Shimoda [Wed, 9 Jul 2014 11:30:13 +0000 (20:30 +0900)]
usb: renesas_usbhs: gadget: fix re-enabling pipe without re-connecting

This patch fixes an issue that the renesas_usbhs driver in gadget mode
cannot work correctly even if I disabled DMAC of the driver when I used
the g_zero driver and the testusb tool.

When a usb cable is re-connected, the renesas_usbhs driver calls the
usbhsp_flags_init() (via usbhs_hotplug() --> usbhs_mod_call(start) -->
usbhsg_try_start() --> usbhs_pipe_init()). However, the driver doesn't
call the usbhsp_flags_init() when usbhsg_ep_disable() is called.
So, if a gadget driver calls usb_ep_enable() and usb_ep_disable() again
and again, the renesas_usbhs driver will output the following log:

  renesas_usbhs renesas_usbhs: can't get pipe (BULK)
  renesas_usbhs renesas_usbhs: wrong recip request

Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit dfb87b8bfe09f933abaf387693992089f6f9053e)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agousb: renesas_usbhs: fix usbhs_pipe_malloc() to re-enable a pipe.
Yoshihiro Shimoda [Wed, 9 Jul 2014 11:30:03 +0000 (20:30 +0900)]
usb: renesas_usbhs: fix usbhs_pipe_malloc() to re-enable a pipe.

This patch fixes an issue that the driver cannot push a new data when
a pipe is re-enabled after the pipe is queued.

Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit 6a0541599f54b556442d6130e4f9faaad91bf3a2)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agogpio: rcar: clamp returned value to [0,1]
Jürg Billeter [Tue, 24 Jun 2014 02:19:50 +0000 (04:19 +0200)]
gpio: rcar: clamp returned value to [0,1]

While it will be clamped to bool by gpiolib, let's make this sane
in the driver as well.

Signed-off-by: Jürg Billeter <j@bitron.ch>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
(cherry picked from commit 7cb5409b10d9f8316ca2539591acb6a5f7fd4139)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_tmu: Add DT support
Laurent Pinchart [Fri, 11 Apr 2014 14:23:40 +0000 (16:23 +0200)]
clocksource: sh_tmu: Add DT support

Document DT bindings and parse them in the TMU driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 3e29b5543f9250bb358169cff0594f58284ece74)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_tmu: Replace global spinlock with a per-device spinlock
Laurent Pinchart [Mon, 17 Feb 2014 15:49:05 +0000 (16:49 +0100)]
clocksource: sh_tmu: Replace global spinlock with a per-device spinlock

The global spinlock is used to protect the shared start/stop register.
Now that all TMU channels are handled by a single device instance, use a
per-device spinlock.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 2b027f1f0f887097b4140a71b5c1e878da1e2fd9)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_tmu: Drop support for legacy platform data
Laurent Pinchart [Tue, 28 Jan 2014 14:52:46 +0000 (15:52 +0100)]
clocksource: sh_tmu: Drop support for legacy platform data

Now that all platforms have switched to the new-style platform data,
drop support for the legacy version.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 681b9e852cf2d48ebd63954028814c7cece71945)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_mtu2: Add DT support
Laurent Pinchart [Tue, 4 Mar 2014 17:28:26 +0000 (18:28 +0100)]
clocksource: sh_mtu2: Add DT support

Document DT bindings and parse them in the MTU2 driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Wolfram Sang <wsa@sang-engineering.com>
(cherry picked from commit cca8d0596c4c7acb371ea1bc5eee9b404b30516a)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_mtu2: Replace global spinlock with a per-device spinlock
Laurent Pinchart [Tue, 4 Mar 2014 14:25:56 +0000 (15:25 +0100)]
clocksource: sh_mtu2: Replace global spinlock with a per-device spinlock

The global spinlock is used to protect the shared start/stop register.
Now that all MTU2 channels are handled by a single device instance, use
a per-device spinlock.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Wolfram Sang <wsa@sang-engineering.com>
(cherry picked from commit 8b2463d8cae2dda0c98ab5a15f25a0350a0e998d)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_mtu2: Drop support for legacy platform data
Laurent Pinchart [Tue, 4 Mar 2014 17:13:57 +0000 (18:13 +0100)]
clocksource: sh_mtu2: Drop support for legacy platform data

Now that all platforms have switched to the new-style platform data,
drop support for the legacy version.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Wolfram Sang <wsa@sang-engineering.com>
(cherry picked from commit 1a5da0e43be0c07462e445549dbdd4a1731a3e11)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_cmt: Add DT support
Laurent Pinchart [Wed, 12 Feb 2014 16:12:40 +0000 (17:12 +0100)]
clocksource: sh_cmt: Add DT support

Document DT bindings and parse them in the CMT driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 1768aa2f4c1248051013282c6cf63b368016cb53)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: shmobile: Remove unused sh_timer_config members
Laurent Pinchart [Tue, 4 Mar 2014 17:50:53 +0000 (18:50 +0100)]
clocksource: shmobile: Remove unused sh_timer_config members

The name, channel_offset, timer_bit, clockevent_rating and
clocksource_rating members are unused. Remove them.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 628627bfd943c077c65489acd8b23c7bb14eb0e2)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_cmt: Replace global spinlock with a per-device spinlock
Laurent Pinchart [Mon, 17 Feb 2014 15:49:05 +0000 (16:49 +0100)]
clocksource: sh_cmt: Replace global spinlock with a per-device spinlock

The global spinlock is used to protect the shared start/stop register.
Now that all CMT channels are handled by a single device instance, use a
per-device spinlock.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit de599c8843ebbdfc29a119c94af481b1de76700e)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoclocksource: sh_cmt: Drop support for legacy platform data
Laurent Pinchart [Tue, 28 Jan 2014 14:52:46 +0000 (15:52 +0100)]
clocksource: sh_cmt: Drop support for legacy platform data

Now that all platforms have switched to the new-style platform data,
drop support for the legacy version.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 31e912f598371bcfdffc990289029e1110f8b3f9)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agosh: Switch to new style MTU2 device
Laurent Pinchart [Wed, 23 Apr 2014 11:15:21 +0000 (13:15 +0200)]
sh: Switch to new style MTU2 device

The MTU2 (Multi-Function Timer Pulse Unit 2) driver implements a new
style of platform data that handles the timer as a single device with
multiple channel. Switch from the old-style platform data to the
new-style platform data.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Wolfram Sang <wsa@sang-engineering.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 5204601c0877b3ffc90e417bf30fccc9bdf47962)
Signed-off-by: Simon Horman <horms@verge.net.au>
9 years agosh: Switch to new style TMU device
Laurent Pinchart [Wed, 23 Apr 2014 11:15:15 +0000 (13:15 +0200)]
sh: Switch to new style TMU device

The TMU (Timer Unit) driver implements a new style of platform data that
handles the timer as a single device with multiple channel. Switch from
the old-style platform data to the new-style platform data.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 1399c195ef5009bf44a41649da4718f6e67c0bff)
Signed-off-by: Simon Horman <horms@verge.net.au>
9 years agosh: Switch to new style CMT device
Laurent Pinchart [Wed, 23 Apr 2014 11:15:08 +0000 (13:15 +0200)]
sh: Switch to new style CMT device

The CMT (Compare Match Timer) driver implements a new style of platform
data that handles the timer as a single device with multiple channel.
Switch from the old-style platform data to the new-style platform data.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 9b17e48cd4df4e129976c37660cf9ec644c66059)
Signed-off-by: Simon Horman <horms@verge.net.au>
9 years agosh-pfc: sh73a0: Introduce the use of devm_regulator_register
Himangi Saraogi [Mon, 7 Jul 2014 16:09:16 +0000 (21:39 +0530)]
sh-pfc: sh73a0: Introduce the use of devm_regulator_register

This patch moves data allocated using regulator_register to
devm_regulator_register and does away the calls to regulator_unregister.
The sh73a0_pinmux_soc_exit function is no longer needed and is removed.

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
(cherry picked from commit 01a7d13a8cfa6424a9568f3c7e925ace57cd3fc8)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agosh-pfc: Add renesas,pfc-r8a7791 to binding documentation
Geert Uytterhoeven [Wed, 9 Jul 2014 12:23:36 +0000 (14:23 +0200)]
sh-pfc: Add renesas,pfc-r8a7791 to binding documentation

The driver already supports the r8a7791 SoC, and "renesas,pfc-r8a7791"
is already in use.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
(cherry picked from commit 590b4ceab95761c45dfc5d9afbbc6810c1fd64a7)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agosh-pfc: r8a7791: add CAN pin groups
Sergei Shtylyov [Tue, 1 Jul 2014 20:58:16 +0000 (00:58 +0400)]
sh-pfc: r8a7791: add CAN pin groups

Add CAN0/1 data/clock pin groups to R8A7791 PFC driver.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
(cherry picked from commit b067580f07b0ae5c323a1d5cd0caa629050406e3)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agommc: tmio-mmc: Add renesas, sdhi-r8a7791 to binding documentation
Geert Uytterhoeven [Wed, 9 Jul 2014 12:23:34 +0000 (14:23 +0200)]
mmc: tmio-mmc: Add renesas, sdhi-r8a7791 to binding documentation

The driver already supports the r8a7791 SoC, and "renesas,sdhi-r8a7791"
is already in use.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Ian Molton <ian.molton@codethink.co.uk>
Cc: Chris Ball <chris@printf.net>
Cc: linux-mmc@vger.kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit bf7978483c0c119e0d650710ee713f0ed95939ca)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agosh_eth: remove checks around dev_kfree_skb() calls
Sergei Shtylyov [Sat, 28 Jun 2014 00:10:00 +0000 (04:10 +0400)]
sh_eth: remove checks around dev_kfree_skb() calls

Since consume_skb() (and hence dev_kfree_skb() macro) checks the passed pointer
for NULL, there's no need to check for NULL before invoking dev_kfree_skb().

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 179d80aff82bf8dff9db30589fe5a2297c454d35)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: rspi: Pass spi_master pointer to rspi_release_dma()
Geert Uytterhoeven [Fri, 6 Jun 2014 11:38:43 +0000 (13:38 +0200)]
spi: rspi: Pass spi_master pointer to rspi_release_dma()

rspi_release_dma() doesn't need access to any fields in the driver private
data, except for the pointer to the SPI master object. Hence just pass the
needed pointer.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit afcc98dec91b7754e754670bdec0290aa07c3565)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agospi: rspi: Remove unused variable in rspi_rz_transfer_one()
Geert Uytterhoeven [Fri, 6 Jun 2014 11:38:42 +0000 (13:38 +0200)]
spi: rspi: Remove unused variable in rspi_rz_transfer_one()

Introduced by commit 8b983e90ea1a3dd82070f96c062ad521a06b7cc0 ("spi: rspi:
Extract rspi_common_transfer()"), which removed its users.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 95029a00886f0c8d79e700cb8983b881c75af0f1)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoPCI: rcar: Remove rcar_pcie_setup_window() resource argument
Phil Edworthy [Mon, 30 Jun 2014 08:37:01 +0000 (09:37 +0100)]
PCI: rcar: Remove rcar_pcie_setup_window() resource argument

rcar_pcie_setup_window() took both the window number and the resource,
which was redundant because we can look up the resource from the window
number.

Remove the "res" argument.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 0549252a1da98c5c39610e1700a9a1755acd0a70)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoPCI: rcar: Cleanup style and formatting
Phil Edworthy [Mon, 30 Jun 2014 07:54:23 +0000 (08:54 +0100)]
PCI: rcar: Cleanup style and formatting

This patch just makes symbol and function name changes to avoid potential
conflicts, along with minor formatting changes.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit b77188495de64abb5393cb96ac5ec518cf386310)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoPCI: rcar: Use correct initial HW settings
Phil Edworthy [Mon, 30 Jun 2014 07:54:22 +0000 (08:54 +0100)]
PCI: rcar: Use correct initial HW settings

Although the R-Car PCIe driver works as it is, there are a number of
incorrect settings that this patch corrects. It corrects:
 - enabling the PCI Express Extended Cap ID.
 - setting Data Link Layer Link Active Reporting Capable.
 - terminating list of capabilities.

It also removes enabling the MAC data scrambling as this is the default HW
setting, and removes incorrect code to enable slave bus mastering as this
is done by the PCI core.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 2c3fd4c935880d756cb57f4bcdb35bb4b8348ec8)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agoPCI: rcar: Remove redundant config accessor register number checks
Sergei Shtylyov [Fri, 27 Jun 2014 14:59:13 +0000 (18:59 +0400)]
PCI: rcar: Remove redundant config accessor register number checks

The PCI core will have already checked the configuration register address
before calling the {read|write}() methods; so don't check it again in these
methods.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Phil Edworthy <phil.edworthy@renesas.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 8eb12c3b420fb5243ce9b4a8878f3b88a3c91e33)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: vb2: Fix stream start and buffer completion race
Laurent Pinchart [Mon, 23 Jun 2014 21:00:22 +0000 (23:00 +0200)]
v4l: vb2: Fix stream start and buffer completion race

videobuf2 stores the driver streaming state internally in the queue in
the start_streaming_called variable. The state is set right after the
driver start_stream operation returns, and checked in the
vb2_buffer_done() function, typically called from the frame completion
interrupt handler. A race condition exists if the hardware finishes
processing the first frame before the start_stream operation returns.

Fix this by setting start_streaming_called to 1 before calling the
start_stream operation, and resetting it to 0 if the operation fails.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit 752bfe5395aa0609def7292c97a37c314ace5837)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Conflicts:
drivers/media/v4l2-core/videobuf2-core.c

9 years agov4l: Add premultiplied alpha flag for pixel formats
Laurent Pinchart [Tue, 27 May 2014 13:12:43 +0000 (15:12 +0200)]
v4l: Add premultiplied alpha flag for pixel formats

When set, the new V4L2_PIX_FMT_FLAG_PREMUL_ALPHA flag indicates that the
pixel values are premultiplied by the alpha channel value.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit e6619dfbf287a75082ec04bc2a8d2df6e3a16299)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Conflicts:
Documentation/DocBook/media/v4l/v4l2.xml

9 years agov4l: Support extending the v4l2_pix_format structure
Laurent Pinchart [Tue, 27 May 2014 12:41:05 +0000 (14:41 +0200)]
v4l: Support extending the v4l2_pix_format structure

The v4l2_pix_format structure has no reserved field. It is embedded in
the v4l2_framebuffer structure which has no reserved fields either, and
in the v4l2_format structure which has reserved fields that were not
previously required to be zeroed out by applications.

To allow extending v4l2_pix_format, inline it in the v4l2_framebuffer
structure, and use the priv field as a magic value to indicate that the
application has set all v4l2_pix_format extended fields and zeroed all
reserved fields following the v4l2_pix_format field in the v4l2_format
structure.

The availability of this API extension is reported to userspace through
the new V4L2_CAP_EXT_PIX_FORMAT capability flag. Just checking that the
priv field is still set to the magic value at [GS]_FMT return wouldn't
be enough, as older kernels don't zero the priv field on return.

To simplify the internal API towards drivers zero the extended fields
and set the priv field to the magic value for applications not aware of
the extensions.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit af7553db487e1dbcd069d1bb9426fc8c591ea1f4)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Conflicts:
Documentation/DocBook/media/v4l/v4l2.xml
Documentation/DocBook/media/v4l/vidioc-querycap.xml
drivers/media/platform/davinci/vpif_display.c
drivers/media/platform/mem2mem_testdev.c
include/uapi/linux/videodev2.h

9 years agoDocBook: media: Document ALPHA_COMPONENT control usage on output devices
Laurent Pinchart [Wed, 21 May 2014 22:16:01 +0000 (00:16 +0200)]
DocBook: media: Document ALPHA_COMPONENT control usage on output devices

Extend the V4L2_CID_ALPHA_COMPONENT control for use on output devices,
to set the alpha component value when the output format doesn't have an
alpha channel.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit e632d2f4e25c574a29b269f9f4b0cef2995e402d)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agov4l: Add ARGB and XRGB pixel formats
Laurent Pinchart [Thu, 22 May 2014 01:07:55 +0000 (03:07 +0200)]
v4l: Add ARGB and XRGB pixel formats

The existing RGB pixel formats are ill-defined in respect to their alpha
bits and their meaning is driver dependent. Create new standard ARGB and
XRGB variants with clearly defined meanings and make the existing
variants deprecated.

The new pixel formats 4CC values have been selected to match the DRM
4CCs for the same in-memory formats.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
(cherry picked from commit 3ddcdb02a95582bf472a89c934bca6e56f07a2db)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Conflicts:
Documentation/DocBook/media/v4l/pixfmt-packed-rgb.xml

9 years agovb2: only call start_streaming if sufficient buffers are queued
Hans Verkuil [Mon, 24 Feb 2014 16:51:03 +0000 (13:51 -0300)]
vb2: only call start_streaming if sufficient buffers are queued

In commit 02f142ecd24aaf891324ffba8527284c1731b561 support was added to
start_streaming to return -ENOBUFS if insufficient buffers were queued
for the DMA engine to start. The vb2 core would attempt calling
start_streaming again if another buffer would be queued up.

Later analysis uncovered problems with the queue management if start_streaming
would return an error: the buffers are enqueued to the driver before the
start_streaming op is called, so after an error they are never returned to
the vb2 core. The solution for this is to let the driver return them to
the vb2 core in case of an error while starting the DMA engine. However,
in the case of -ENOBUFS that would be weird: it is not a real error, it
just says that more buffers are needed. Requiring start_streaming to give
them back only to have them requeued again the next time the application
calls QBUF is inefficient.

This patch changes this mechanism: it adds a 'min_buffers_needed' field
to vb2_queue that drivers can set with the minimum number of buffers
required to start the DMA engine. The start_streaming op is only called
if enough buffers are queued. The -ENOBUFS handling has been dropped in
favor of this new method.

Drivers are expected to return buffers back to vb2 core with state QUEUED
if start_streaming would return an error. The vb2 core checks for this
and produces a warning if that didn't happen and it will forcefully
reclaim such buffers to ensure that the internal vb2 core state remains
consistent and all buffer-related resources have been correctly freed
and all op calls have been balanced.

__reqbufs() has been updated to check that at least min_buffers_needed
buffers could be allocated. If fewer buffers were allocated then __reqbufs
will free what was allocated and return -ENOMEM. Based on a suggestion from
Pawel Osciak.

__create_bufs() doesn't do that check, since the use of __create_bufs
assumes some advance scenario where the user might want more control.
Instead streamon will check if enough buffers were allocated to prevent
streaming with fewer than the minimum required number of buffers.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit b3379c6201bb3555298cdbf0aa004af260f2a6a4)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Conflicts:
drivers/media/platform/davinci/vpbe_display.c
drivers/media/platform/davinci/vpif_capture.c
drivers/media/platform/davinci/vpif_display.c
drivers/media/v4l2-core/videobuf2-core.c

9 years agovb2: rename queued_count to owned_by_drv_count
Hans Verkuil [Thu, 6 Feb 2014 08:46:11 +0000 (05:46 -0300)]
vb2: rename queued_count to owned_by_drv_count

'queued_count' is a bit vague since it is not clear to which queue it
refers to: the vb2 internal list of buffers or the driver-owned list
of buffers.

Rename to make it explicit.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 6ea3b980f058d9dbc79ba88c652d581fa2d00792)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Conflicts:
drivers/media/v4l2-core/videobuf2-core.c

9 years agovb2: Check if there are buffers before streamon
Ricardo Ribalda Delgado [Wed, 8 Jan 2014 08:01:33 +0000 (05:01 -0300)]
vb2: Check if there are buffers before streamon

This patch adds a test preventing streamon() if there is no buffer
ready.

Without this patch, a user could call streamon() before
preparing any buffer. This leads to a situation where if he calls
close() before calling streamoff() the device is kept streaming.

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 <m.chehab@samsung.com>
(cherry picked from commit 249f5a58bc844506fef2e9d5d55a88fbc708c5fa)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
9 years agopinctrl: sh-pfc: r8a7791: Add HSCIF pin support
Nobuhiro Iwamatsu [Tue, 10 Jun 2014 02:37:15 +0000 (11:37 +0900)]
pinctrl: sh-pfc: r8a7791: Add HSCIF pin support

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
(cherry picked from commit 92b14d56d3edf68eff258bc69a62e295dbfb4780)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>