coefficient setting.
Because the caller of pxp-v3 does not set the stride parameter,
this will cause pitch parameter to be zero and pxp can't work.
Correct the csc1 coefficient when use pxp convert YUV to RGB format.
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
There is Audio dual fifo cause that fill fifo one by one and
loop back after every minor loop:
-- fill the first 32bit width fifo
-- fill the next 32bit width fifo
-- +MLOFF signed offset after the above two FIFOs filled
-- loop back to the first step to handle the next minor loop.
Signed-off-by: Robin Gong <yibin.gong@nxp.com>
For dual fifo case, fsl-edma-v3 need add another cell. It's not friendly
for user and it's possible other cells maybe added to other use cases,
so combine two cells into one now, and for some special use cases such as
dual fifo property can directly be passed by one bit of cell3 rather than
another cell.
Signed-off-by: Robin Gong <yibin.gong@nxp.com>
It is possible for an irq triggered by channel0 to be received later,
after clks are disabled. If that happens then clearing them by writing
to SDMA_H_INTR won't work and the system will hang processing infinite
interrupts. Actually, don't need interrupt triggered on channel0 since
it's pollling to know channel0 done rather than interrupt in current
code, just clear BD setting to disable channel0 interrupt to avoid the
above case.
Reported-by: Leonard Crestez <leonard.crestez@nxp.com>
Signed-off-by: Robin Gong <yibin.gong@nxp.com>
This is obviously a bug but I don't know of a scenario where those errors
might happen.
Fixes: 7e84737c9c ("MLK-11385 dma: imx-sdma: enable clock before context restored")
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
fix below build warning with aarch64:
drivers/dma/imx-sdma.c: In function ‘sdma_prep_dma_cyclic’:
drivers/dma/imx-sdma.c:1727:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t’ [-Wformat=]
dev_dbg(sdma->dev, "entry %d: count: %d dma: %pad %s%s\n",
Signed-off-by: Robin Gong <yibin.gong@nxp.com>
1. When pxp do rotation, fetch and store engine need block mode.
2. When use pxp store engine fill function, not only need config
store engine, but also need config fetch engine, otherwise, it
will not work.
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
This patch fixes build warning that 2 variables may be used uninitialized
in the pxp_fetch_config() function in drivers/dma/pxp/pxp_dma_v3.c .
The variables in_fmt and out_fmt are passed as parameters to
pxp_fetch_shift_calc() only if shift_bypass is false. This flag cannot be
false unless changed in a code block that also assigns in_fmt and out_fmt.
Since the compiler cannot detect this flow, it shows a warning that in_fmt
and out_fmt are not initialized. Fix this by changing the code flow such
that in_fmt and out_fmt are sent as parameters in the same code block where
they are assigned.
Signed-off-by: Cristina Ciocan <cristina-mihaela.ciocan@nxp.com>
Below described in RM, otherwise, channel error status(CHa_ES)
may be triggered:
The user must clear the CHa_CSR[DONE] bit before writing the
TCDa_CSR[MAJORELINK] or TCDa_CSR[ESG] bits.
Signed-off-by: Robin Gong <yibin.gong@nxp.com>
The parameter is "is_remote", which is to use remote access for
edma, the default access is local access.
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
After soft reset, the irq register value will be zero, so we need set it to enable
all pxp interrupts.
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
Some drivers may access dma_async_tx_descriptor in callback such as
tty/serial/fsl_lpuart.c, but the description has already been freed
before callback, memory corrupt here. Move the free description
behind of callback.
Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Commit 665ced16cf ("MLK-10050 dma: imx-sdma: add support for sdma
memory copy") enforces maximum SDMA buffer descriptor length at 65532,
but doesn't update period_bytes_max or max_segment size in DMA drivers.
Thus, resulting in the following bug:
$ arecord -Dhw:0,0 -r 192000 -f S20_3LE -c 1 -d 10 audio192k20b1c.wav
imx-sdma: SDMA channel 5: maximum period size exceeded: 65534 > 65532
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
The V3 version PXP has added below new 2D features:
1. Input fetch/store blocks to accept different formats input/output.
2. Add Rotation1 block to do rotation before alpha blending.
3. Add Composite1 block to accept source from input fetch.
4. AS and PS have increased supported pixel formats.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Signed-off-by: Guoniu.Zhou <guoniu.zhou@nxp.com>
(cherry picked from commit 4daef24b19890ca65135c48fc24018f64761444f)
Based on the previously caculated adjacent list and mux
config info, the shortest path table can be derived by
distance calculation between two different 2D nodes.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit c8adf0f7089d5c5e286d7ae74c138a84bed5e280)
According to the PXP arch diagram, the V3 PXP can be
abstracted to a graph structure. There are totally
16 2D nodes in PXP and 16 2D related mux nodes:
1. Using '16x16' adjacent array to record the 2D nodes
relationship and '16' size array to record the
input and output nodes for each muxe node.
2. Construct the adjacent list to store all the 2D
nodes and also config the mux info used by each
two nodes of one edge during pxp probing stage.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit e8087406df2e04982fd90b4070ac68fafa4ad3d5)
Extract the timer initialization from pxp_probe()
to a seperate function call to make probing process
more clear.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit c8a127e506bca2e38fae02c03ceae4e6956d6ea3)
Extract the attributes creation from the pxp_probe()
to a seperate function call to make the probing process
more clear.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 85ab5476bf59a407037b43419b920b681b58b52d)
Extract the m4 related initialization code from
pxp_probe() to make the probing function more
clear.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit f1bd8146332f880b75f08eab64505070069018fb)
The PXP interrupt functions in V3 is relatively complex.
So do the interrupt initalization in a sperate function
to make the pxp_probe() more clear.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 2fa43d26f81cf0331820b41bc198adbb414c0c37)
Remove some assignments which have no real effects for
V2 and V3 PXP drivers, since using devm_kzalloc() to
make the data to be zero.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit a6d6e4d2b6b21427c529a33a7d47ddc918b19eb7)
Some RGB formats fourcc definition are not precise
according to its original meaning. So make some
changes for them.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit b0b4ad680e267bdf542d2c9a3202c0192bde9cb0)
According to the pxp high level architecture diagram,
it is better to divide the whole big pxp module into
four sub-modules:
1. 2D operation module(legacy pxp and input fetch & store).
2. Dithering module.
3. WFE_A module.
4. WFE_B module.
This division will simplify driver implementations and
management.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 5e57840b41adb195515bd652d9624feaadf3448e)
Abstract PS and OUT formats parsing jobs to seperate
functions 'pxp_parse_ps_fmt()' and 'pxp_parse_out_fmt()'
to make the code clean and easier to maintain.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 3e2cd1880fdf219c77f119fa5c9fb33e50e8654c)
Add 'need_yuv_swap' field to 'pxp_proc_data' structure to
record the yuv formats which needs byte swap.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 28ce43b27faad915e93f47b438d23f4ebfe020b5)
Use 'switch' statement to replace 'if' statement to
make logic more clear and easier to maintain.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit ca1b4393b86054a81bb40ad856af9c4f166841ea)
The multiple overlay layers are not used on pxp v2 and
v3 module, so remove this.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit c4fd8b36dbf9b53079d88d55ccfedde3a444ec29)
use pxp_soft_reset() in probe and resume function because this implementation
follows the recommended flow in the IC spec.
without soft reset, when only use wfe_a process without legacy process it's
likely to meet timeout issue since. In other words, wfe_a process need the
soft reset to work properly.
Signed-off-by: Robby Cai <robby.cai@nxp.com>
on imx7d and imx6ull/imx6sll, the collision detection logic is implemented
in PXP WFE (A on imx7d, or B on imx6ull/imx6sll) instead of the logic
implemented on EPDC on previous SoCs (like imx6sl/imx6dl). The driver need
read the LUT status and send this information to PXP WFE (A on imx7d, or B
on imx6ull/imx6sll) engine, so that PXP WFE engine can detect if there is
an active LUT assigned to the pixels affected by current update.
Without this patch, there could possibly be some false collision report due
to the out-of-sync. The patch intends to fix it.
Signed-off-by: Robby Cai <robby.cai@nxp.com>
The cause is the legacy process involves PXP AS engine accidentally to
process data, which results to one pixel at (0,0) to be changed. This
will cause an incorrect histogram calculation.
Signed-off-by: Robby Cai <robby.cai@nxp.com>
The audio driver is initialized by preparing a DMA slave channel using 0's
as parameters in sdma_prep_dma_cyclic function. This would lead to a
division by zero, since period_len is used as a divisor.
Used the code from 4.1 to fix this, where the division is made only for
non HDMI peripheral types.
Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
The function .fsl_edma_irq_init() has been called twice in .probe(), which
cause all dma controller registered failed.
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
EDMA controller will loss power on i.MX7ULP VLLS mode, then registers
are set to HW reset default value that cause EDMA cannot work after
system wake up. So the patch is to restore eDMA registers status after
system exit from VLLS mode.
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit:bc15f814383d)
Conflicts:
drivers/dma/fsl-edma.c
Some drivers may call terminate dma channel in interrupt, thus
we'd better use dma_poo_free.(Documentation/DMA-API-HOWTO.txt)
Signed-off-by: Robin Gong <yibin.gong@nxp.com>
The sdmac->chn_real_count is equal to sdmac->period_len in dma cyclic
mode that is not correct, correct it to real count in current BD transfer.
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Before, checking SDMA_H_C0PTR register to know whether sdma controller turned
off in DSM, if yes restore channel context back. Unfortunatly, this checking
is wrong, because SDMA_H_C0PTR has been initialized as non-zero value in
sdma_resume, which means channel context will never be restored back if mega/
fast off on i.mx6sx or i.mx7d. Using 'suspend_off' flag to keep this 'restore
needed' requirement.
Signed-off-by: Robin Gong <b38343@freescale.com>
(cherry picked from commit 565d4c45926a03029d7750a57f3e3f2404de7301)
(cherry picked from commit 70dbe82f8f)
Some driver may call dmaengine_terminate_all firstly, and then start next by
calling dmaengine_prep_* without dmaengine_slave_config. In this case sdma
transfer failed since no context loaded, take this case in this patch.
Signed-off-by: Robin Gong <b38343@freescale.com>
(cherry picked from commit 51ff948df5)
Old sdma can't support multi instances, because next transfer will return
error if the last transfer not done(sdmac->status == DMA_IN_PROGRESS). virt
dma is a common framework for versus dma drivers, and it's support multi
instances, driver can dynamicly alloc description and add it to list which
will be handled in the last sdma transfer done later.
Another advantage of this patch is to clean up the constrain of max bd numer:
--#define NUM_BD (int)(PAGE_SIZE / sizeof(struct sdma_buffer_descriptor))
in other words, now sdma driver can support any length data now.
Meanwhile, remove sdma_load_context() in prep_* everytime, since it can do
only once in config channel.
Signed-off-by: Robin Gong <yibin.gong@nxp.com>
When porting to 4.14 transformed upstream sdma_disable_channel_with_delay
into sdma_terminate_all_with_delay.
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
- change setting for wfe_b to support new flow
(note there's no wfe_a on i.mx6ull/i.mx6sll, while on i.mx7d wfe_a is used
for this purpose)
- the underlying design policy change as follows (similar to i.mx7d).
in previous flow, when all LUTs are used, the LUT cleanup operation
need to wait for all the LUT to finish, it will not happen util last LUT
is done. while in new flow, the cleanup operation does not need to wait
for all LUTs to finish, instead it can start when there's LUT's done.
The saved time is multiple LUT operation time.
Signed-off-by: Robby Cai <robby.cai@nxp.com>
- change from wfe_b to wfe_a, and modifiy register settings to support new flow
- the underlying design policy change as follows.
in previous flow, when all LUTs are used, the LUT cleanup operation
need to wait for all the LUT to finish, it will not happen util last LUT
is done. while in new flow, the cleanup operation does not need to wait
for all LUTs to finish, instead it can start when there's LUT's done.
The saved time is multiple LUT operation time.
Signed-off-by: Robby Cai <robby.cai@nxp.com>
- use different LUT setting and coefficient setting for different quantization
bits.
- clear CTRL0_MUX14_SEL to 0 only when use dithering algorithm, set to 1 for
not using dithering module.
- bypass PXP_OUT_AS for dithering and add DITHER_STORE_SIZE setting
Signed-off-by: Robby Cai <robby.cai@nxp.com>
In cyclic/loop mode, DMA call shouldn't touch dma cookie, since only one
time need to be submitted, otherwise, below kernel bug will be triggered:
Playing WAVE '/unit_tests/audio8k16S.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Stereo
------------[ cut here ]------------
Kernel BUG at 8043d030 [verbose debug info unavailable]
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
Modules linked in: ov5642_camera mxc_v4l2_capture ipu_bg_overlay_sdc ipu_still ipu_prp_enc ipu_csi_enc ipu_fg_overlay_sdc ov5640_camera_mipi_int ov5640_camera_int v4l2_int_device mxc_dcic
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.9.5-01681-g6dbd27b #7
Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
task: 80f06600 task.stack: 80f00000
PC is at mxc_sdma_handle_channel_normal+0xc0/0xd8
LR is at tasklet_action+0x94/0x14c
Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Mihai Serban <mihai.serban@nxp.com>
This patch fixes crackling sound reported when running autorun-asrc.sh
and it is a backport of 85f57752b3 ("dmaengine: imx-sdma - correct
the dma transfer residue calculation") from v10-rc6.
Original commit message:
From: Nandor Han <nandor.han@ge.com>
Date: Tue, 11 Oct 2016 14:13:41 +0300
Subject: [PATCH] dmaengine: imx-sdma - correct the dma transfer residue
calculation
The residue calculation was taking in consideration that dma
transaction status will be always retrieved in the dma callback
used to inform that dma transfer is complete. However this is not
the case for all subsystems that use dma. Some subsystems use a
timer to check the dma status periodically.
Therefore the calculation was updated and residue is calculated
accordingly by a) update the residue calculation taking in
consideration the last used buffer index by using *buf_ptail* variable
and b) chn_real_count (number of bytes transferred) is initialized to
zero, when dma channel is created, to avoid using an uninitialized
value in residue calculation when dma status is checked without
waiting dma complete event.
Signed-off-by: Nandor Han <nandor.han@ge.com>
Acked-by: Peter Senna Tschudin <peter.senna@collabora.com>
Tested-by: Peter Senna Tschudin <peter.senna@collabora.com>
Tested-by: Marek Vasut <marex@denx.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Calculate the rela count for the case that eDMA stop after get eeop signal.
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Using a dedicated kernel thread to dispatch all the client
requests which can support asynchronous multi-task.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
dithering test will met timeout issue on i.MX6ULL platform.
to reproduce, run ' /unit_tests/mxc_epdc_v2_fb_test.out -n 17 -d 1 -q 1'
Ginger dithering mode "Floyd-Steinberg" and quant_bit 1
imx_epdc_v2_fb 228c000.epdc: PxP operation failed due to timeout
imx_epdc_v2_fb 228c000.epdc: Unable to complete PxP update task: dithering process
imx_epdc_v2_fb 228c000.epdc: Timed out waiting for update completion
This patch corrects the setting (different from V3 on i.MX7D).
Signed-off-by: Robby Cai <robby.cai@nxp.com>
- HIST_A as collision, need set to 1 for wfb_store
- WFE-A flag0~3 changed to WFE-B flag4~7 on i.MX6ULL
This patch fixes the collision issue and some part of
updated region can not display with auto waveform mode.
Signed-off-by: Robby Cai <robby.cai@nxp.com>
on i.MX6ULL, the WFE_A is removed due to die size, but instead use WFE_B
to the task for WFE_A. We may call this version as V3P - V3 patch.
use device_id to differentiate the operations on different version.
Signed-off-by: Robby Cai <robby.cai@nxp.com>
The 'pm_runtime_get_sync()' and 'pm_runtime_put_sync_suspend()'
may be called not pairs. And this will cause the 'usage_count'
to be negative.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 10135c736dfc1b3d5c449adb78118e3642b99276)
The head list may be corrupted when two requests from
the same 'pxp_chan' are issued sequentially. So change
the issue_pending function to strictly serialized the
requests to avoid this kind of issue.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
There may be potential memory leak when the 'desc' allocation failed.
The previous allocated descriptors should be freed when the allocation
failed.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Fix two code issues, but not function break or potential bug:
--Unsigned compared against 0 (NO_EFFECT)
--Wrong size argument (SIZEOF_MISMATCH)
Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Add imx6ul device type to enable the ERR008517 workaround or not by dts.
Signed-off-by: Robin Gong <b38343@freescale.com>
(cherry picked from commit 17d6a090b7a39bfd7836a3685d20201dcb0fa25e)
The code slice in the pxp_probe() function:
"
if (!res || irq < 0) {
err = -ENODEV;
goto exit;
}
"
appears twice closely. And the second code slice will become
dead code which is never executed. So remove the second one.
Signed-off-by: Fancy Fang <chen.fang@freescale.com>
The 'sg' buffer should be allocated dynamically, since its
size is dependent on the 'sg_len' which is calculated
according to the functions required.
Signed-off-by: Fancy Fang <chen.fang@freescale.com>
(cherry picked from commit 57f08c108fc4f4721449b4b94be9820c7443978a)
The 'CONFIG_PM_RUNTIME' has been eliminated and all the users
should use 'CONFIG_PM' directly. So do this change for pxp-v2
and pxp-v3.
Signed-off-by: Fancy Fang <chen.fang@freescale.com>
No need to alloc bd for hdmi audio, and the period len of hdmi audio is
0, so add constraint for it.
And correct per_address and per_address2 for hdmi audio.
Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
After running asrc p2p, then asrc m2m can't work. It is caused by the
sdmac->flags isn't reset after running. then sdma_int_handler go to
wrong branch.
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Because load context code has been removed in prepare DMA transfer everytime.
Need restore them back once mega/fast powered off.
Signed-off-by: Robin Gong <b38343@freescale.com>
dmatest is a common dma test module for dma driver which support mem_2_mem copy
.Since SDMA driver has the mem_2_mem interface, make little code change to
support this feature rather than our internal mxc_sdma_memcopy_test test
module.
Signed-off-by: Robin Gong <b38343@freescale.com>
Currently, the dma engine driver don't support runtime pm,
and it is not necessary to support the feature since it support
slave sg and cyclic mode, and clock enable/disable during dma
chans allocate and release.
The patch remove the runtime pm dummy code.
Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit: 2c8f8e3e6a21184e6cf8b8e5ba3ec8e76794c951)
After dma init by calling .mxs_dma_init(), disable dma_io and
dma_bch clocks. When dma chans are requested by devices, clocks
are enabled in .device_alloc_chan_resources(). The patch is to
fix clock enable count mismatch issue.
Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit: 4868cf5e39a0aeb1ad12c5c1a453d233c0f472ce)
* iMX7D dma-apbh support add additional clock dependency
* Add clock for mxs-dma support dma_apbh_bch dma_apbh_io
Signed-off-by: Adrian Alonso <aalonso@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit: aea75669daac9101592de2cfbadc7aaacbc7d887)
this patch adds power management support for mxs-dma driver.
Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Allen Xu <b45815@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit 7a59828eeda36457e6e60383705a0bc5831ffbf7)
There is occasion that dma callback come late after the substream is released.
Then there will be kernel dump.
[<805866b0>] (imx_pcm_dma_complete) from [<802fad9c>] (sdma_handle_channel_loop.isra.25+0x48/0x54)
[<802fad9c>] (sdma_handle_channel_loop.isra.25) from [<802fae48>] (sdma_tasklet+0xa0/0x1d4)
[<802fae48>] (sdma_tasklet) from [<800356e0>] (tasklet_action+0x64/0xf8)
[<800356e0>] (tasklet_action) from [<80034ea0>] (__do_softirq+0x104/0x218)
[<80034ea0>] (__do_softirq) from [<80035220>] (irq_exit+0xa8/0xec)
[<80035220>] (irq_exit) from [<8000ed44>] (handle_IRQ+0x3c/0x90)
[<8000ed44>] (handle_IRQ) from [<80008578>] (gic_handle_irq+0x28/0x5c)
[<80008578>] (gic_handle_irq) from [<80012100>] (__irq_svc+0x40/0x70)
The reason is the sdma tasklet is async with audio substream release. ALSA
think when terminate dma, the dma should be stopped and no callback be called.
This patch is to add new api dma_sync_wait_tasklet(), which is called in
snd_dmaengine_pcm_close(). It will make sure the callback not be called
after this funtion. Tasklet_kill is to wait scheduled tasklet end.
Tasklet_kill can't be added to terminate dma function, because terminate dma
function may be called in interrupt, but tasklet_kill can't be called in
interrupt context.
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 9815881b6acaa72a705e1fa3c26a852fc81bfce5)
As SSI has dual fifo, add src_dualfifo and dst_dualfifo in imx_dma_data
to support dual fifo in DMA_DEV_TO_DEV.
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit cfde1308f170166a0099ca39ee8733895f9626f0)
Use SET_LATE_SYSTEM_SLEEP_PM_OPS rather than the common sleep pm ops to ensure
sdma has resumed back before all other module drivers which use sdma resume
back.
Signed-off-by: Robin Gong <b38343@freescale.com>
(cherry picked from commit a7f8725509b494c3073b1bcca63252d5c61bb80d)
Enable Mega/Fast support for i.mx7d. Need save and restore SDMA registers.
Signed-off-by: Robin Gong <b38343@freescale.com>
(cherry picked from commit 4e1ea64c5d360ebc4f8168c1fcdee314b547bd13)
The SDMA driver not consider the case of event_id0 is 0. That make uart6 rx
not working.
Signed-off-by: Robin Gong <b38343@freescale.com>
(cherry picked from commit dbcacbcb3a885d7569e9e415035b1dd06c4a117b)
(cherry picked from commit 6dfdbe41a7d6ab7e6fae5d6fb4d73435839beff3)
Current ecspi rom script didn't take care of rxfifo overflow risk. Add new
ecspi tx script to check the rxfifo status, if it is near to full(>=48 bytes),
do not copy data to txfifo which will trigger data push into rxfifo. Because
rx script may not read rxfifo in time, we have to consider it.
Signed-off-by: Robin Gong <b38343@freescale.com>
(cherry picked from commit 17f472aa698aba0af5da4566df447e23306f4289)
(cherry picked from commit 90c929d7d1a3f8e196641b5ed7a33d2ee03bd63c)
(cherry picked from commit 6d76bdcf2097e4198217edf27363cf6ba2e6542a)
cherry-pick below patch from v3.14.y:
ENGR00319473: dma: imx-sdma: support sdma restore from
mega/fast power down status
Support sdma suspend and resume interface to restore from mega/fast power down.
Signed-off-by: Robin Gong <b38343@freescale.com>
(cherry picked from commit 682fd1f47ab9cb69382fa0e8d20a830ae99c26fc)
(cherry picked from commit dd17fa18b9a0c11f8bce3b87f792775d96e461c1)
This patch is just created by so many confilict while cherry-pick
from v3.10 a6a6cf911f85a3a09f763195478d422c571b9565.
Signed-off-by: Robin Gong <b38343@freescale.com>
Leonard: Fixed minor conflicts while rebasing on 4.14
Removed sdma_prep_memcpy_sg because API removed from upstream
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
cherry-pick below patch from v3.14.y:
ENGR00329948-3: dma: imx-sdma: Add hdmi audio support
in sdma
There's a missing script for hdmi audio support in current sdma driver,
thus add it.
This HDMI script doesn't use bd to copy memory like a normal one does
but only to update the memory address for HDMI internal AHB DMA and
then trigger its procedure automatically.
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Signed-off-by: Robin Gong <b38343@freescale.com>
(cherry picked from commit dafddac916a03ae4477e2de7c1b7ad291f956f68)
ENGR00286273-1 dma: imx-sdma: allocate memory from iram
We try to allocate memory from SoC internal SRAM so that we can turn off
voltage of external DDR to save power. Surely, if we failed to get the
iram DT node or allocate memory due to no enough SRAM space, we would
allow SDMA driver to allocate memory in a traditional way.
Signed-off-by: Nicolin Chen <b42378@freescale.com>
Signed-off-by: Robin Gong <b38343@freescale.com>
(cherry picked from commit f6924fbdb90d1f01266fc018caff953457e04d34)
(cherry picked from commit 7b643e5c9119ac43b937816fd1b785d2b859b05f)
For UART, we need use old chn_real_count to know the real rx count even in
cylic dma mode, because UART driver use cyclic mode to increase performance
without any data loss.
Signed-off-by: Robin Gong <b38343@freescale.com>
(cherry picked from commit 398cee2ad110c4f183e553af0564fbdcbe8548cb)
cherry-pick below patch from v3.14.y:
ENGR00329822-01 dmaengine: imx: fix loop mode issue
Fix loop mode issue that calling dmaengine_tx_status() can get
right state.residue value.
Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Robin Gong <b38343@freescale.com>
(cherry picked from commit 37e17f10b35c34317def08704e4b4edf5aa23894)
(cherry picked from commit 00cc7021317ac6efb460eb1b9bc3bd8aa6ad73c2)
[ Upstream commit 8bbafed8dd ]
The mv_xor_v2 driver uses a tasklet, initialized during the probe()
routine. However, it forgets to cleanup the tasklet using
tasklet_kill() function during the remove() routine, which this patch
fixes. This prevents the tasklet from potentially running after the
module has been removed.
Fixes: 19a340b1a8 ("dmaengine: mv_xor_v2: new driver")
Signed-off-by: Hanna Hawa <hannah@marvell.com>
Reviewed-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Upstream commit e49756544a ]
In pl330_update() when checking if a channel has been aborted, the
channel's lock is not taken, only the overall pl330_dmac lock. But in
pl330_terminate_all() the aborted flag (req_running==-1) is set under
the channel lock and not the pl330_dmac lock.
With threaded interrupts, this leads to a potential race:
pl330_terminate_all pl330_update
------------------- ------------
lock channel
entry
lock pl330
_stop channel
unlock pl330
lock pl330
check req_running != -1
req_running = -1
_start channel
Signed-off-by: John Keeping <john@metanate.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Upstream commit e3f329c600 ]
The reported residue is already calculated in BURST unit granularity, so
advertise this capability properly to other devices in the system.
Fixes: aee4d1fac8 ("dmaengine: pl330: improve pl330_tx_status() function")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Upstream commit 48d163b1aa ]
When Linux is master of BAM, it can directly read registers to know number
of supported channels, however when its remotely controlled reading these
registers would trigger a crash if the BAM is not yet initialized or
powered up on the remote side.
This patch allows driver to read num-channels and num-ees from Device Tree
for remotely controlled BAM.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Upstream commit 3e081628d5 ]
This patch fixes an issue that a race condition happens between a client
driver and the rcar-dmac driver:
- The rcar_dmac_isr_transfer_end() is called.
- The done list appears, and desc.running is the next active list.
- rcar_dmac_chan_get_residue() is called by a client driver before
rcar_dmac_isr_channel_thread() is called.
- The rcar_dmac_chan_get_residue() will not find any descriptors.
- And, the following WARNING happens:
WARN(1, "No descriptor for cookie!");
The sh-sci driver with HSCIF (921,600bps) on R-Car H3 can cause this
situation.
So, this patch checks the done lists in rcar_dmac_chan_get_residue()
and returns zero if the done lists has the argument cookie.
Tested-by: Nguyen Viet Dung <dung.nguyen.aj@renesas.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>