dmaengine_terminate_all is deprecated, let's use
dmaengine_terminate_async for interrupt handling.
Change-Id: I8c06ef2147c0583d28eeed5b623920199efa9810
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
(cherry picked from git.kernel.org next/linux-next.git master
commit 557b7ea34b)
We should check return value of dmaengine_prep_slave_sg, otherwise
we take risk of null pointer.
Change-Id: I2cc468563d630169f314e353d835ad33091c0d3c
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
(cherry picked from git.kernel.org next/linux-next.git master
commit ea98491133)
The DMAengine API has a long standing race condition that is inherent to
the API itself. Calling dmaengine_terminate_all() is supposed to stop and
abort any pending or active transfers that have previously been submitted.
Unfortunately it is possible that this operation races against a currently
running (or with some drivers also scheduled) completion callback.
Since the API allows dmaengine_terminate_all() to be called from atomic
context as well as from within a completion callback it is not possible to
synchronize to the execution of the completion callback from within
dmaengine_terminate_all() itself.
This means that a user of the DMAengine API does not know when it is safe
to free resources used in the completion callback, which can result in a
use-after-free race condition.
This patch addresses the issue by introducing an explicit synchronization
primitive to the DMAengine API called dmaengine_synchronize().
The existing dmaengine_terminate_all() is deprecated in favor of
dmaengine_terminate_sync() and dmaengine_terminate_async(). The former
aborts all pending and active transfers and synchronizes to the current
context, meaning it will wait until all running completion callbacks have
finished. This means it is only possible to call this function from
non-atomic context. The later function does not synchronize, but can still
be used in atomic context or from within a complete callback. It has to be
followed up by dmaengine_synchronize() before a client can free the
resources used in a completion callback.
In addition to this the semantics of the device_terminate_all() callback
are slightly relaxed by this patch. It is now OK for a driver to only
schedule the termination of the active transfer, but does not necessarily
have to wait until the DMA controller has completely stopped. The driver
must ensure though that the controller has stopped and no longer accesses
any memory when the device_synchronize() callback returns.
This was in part done since most drivers do not pay attention to this
anyway at the moment and to emphasize that this needs to be done when the
device_synchronize() callback is implemented. But it also helps with
implementing support for devices where stopping the controller can require
operations that may sleep.
Change-Id: Ica0822ecbe803ec9605787e30751dfb098bdbe80
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
(cherry picked from git.kernel.org next/linux-next.git master
commit b36f09c3c4)
16-bit transfers must be in big endian mode on wire.
Change-Id: I21e660de04867871132e4d5b0f2d943a30167aeb
Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
(cherry picked from git.kernel.org next/linux-next.git master
commit 0277e01aeb)
xfer_completion isn't been used anywhere, so it can be
removed.
Change-Id: I5a653609c8afaa83665ebc050274d3c9dcf59777
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
(cherry picked from git.kernel.org next/linux-next.git master
commit 23366a02bf)
Add missing spi_master_put for rockchip_spi_remove since
it calls spi_master_get already.
Change-Id: If76b124b5122d8ca4c65014831afdf1f4893a7cc
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
(cherry picked from git.kernel.org next/linux-next.git master
commit 844c9f476a)
Before registering master, driver enables runtime pm.
This patch pm_runtime_disable in err case while probing
driver to balance pm reference count.
Change-Id: I63688e1b07b0b157a663f67e50ac74c5273ce353
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
(cherry picked from git.kernel.org next/linux-next.git master
commit b8659adda9)
Add a shutdown opertion to prevent a system halt when
reboot executing.
Before this revision, driver will try to trigger hw after
power domain disable during reboot procedure, and cause a
system halt.
Change-Id: I57236c20cb96946a18d78396955f6fd59ee93a59
Signed-off-by: Alpha Lin <alpha.lin@rock-chips.com>
make sure the clk is enabled when read/write qos regs.
Change-Id: Ia88453504bcfd612a86537c4b12d3fd5b53f3d76
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
As gpu power on and off frequently, and the interval time is smaller
than the polling time of devfreq, add power-off-delay function to
ensure devfreq work fine.
Change-Id: Iba2405c9ead91a437233f1fedf2f3555703aa9e1
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
just to compatiable with android sdk, anyway, change it.
Change-Id: I60341c5a8a9050172c6abaca396957442f42434e
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
this patch disable spdif sound in rk3399-evb.dtsi, and enable on
product dts side as required.
Change-Id: Icf61f13aeafdfae4c7a52603ce23cf2c04c27ab4
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
There are too many NOC clocks and all of them are critical clocks.
This approach is unnecessary, we only remove them and keep them
always enable, and caused by increased power consumption is only
<=3ma.
Change-Id: I6968dd9fe5632853fade831260d0cbeeb9f8fda3
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
To simplify the description of the clock for RK3399, we don't need to
add many GRF gates clock nodes and keep them always enable,
In this case, we can avoid some of the operations GRF registers exception
problems, and caused by increased power consumption is only <=1ma.
Change-Id: Ifee9df2d5f869607191c5fb1165ec3e36e7bef9d
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Rk3399 support single and burst mode, and flushp instruction.
But burst mode improve transfer efficiency.
Please refer to:
Commit 8e770f371c
"dmaengine: pl330: add burst mode according to dts config"
Change-Id: I2eb36723697cf548dc75aca0e5a276a86cd2419d
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
Rk3366 support single and burst mode, and flushp instruction.
But burst mode improve transfer efficiency.
Please refer to:
Commit 8e770f371c
"dmaengine: pl330: add burst mode according to dts config"
Change-Id: I5e3fef4684f324dda015c0afd73535c062952fc1
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
Because rk3368 pl330 dma controller doesn't support single
mode, so it is necessary to set peripherals-req-type-burst.
Please refer to:
Commit 8e770f371c
"dmaengine: pl330: add burst mode according to dts config"
Change-Id: I44de28cca0085bc3d8f25a5913dbb527c36d8f83
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
Because rk3288 pl330 dma controller doesn't support single
mode, so it is necessary to set peripherals-req-type-burst.
Please refer to:
Commit 8e770f371c
"dmaengine: pl330: add burst mode according to dts config"
Change-Id: Ic972880807e858334a1df8fa3f9bb567a8078ff9
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
Pl330 integrated in rk3368 platform doesn't support
DMAFLUSHP function. So we add arm,pl330-broken-no-flushp quirk
for it.
Change-Id: Ia7f4bb6ffa1fba01dac5ac2257499dbbc9887da6
Signed-off-by: Caesar Wang <wxt@rock-chips.com>