To support 32bit application, we should use fixed-length types in ioctl
parameters, specifically avoid using the type long and unsigned long.
remove some unused ioctl cmd.
clear some building warning.
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
1.imx8mm-evk run CI test script 5000 loops, can not reproduce
2.imx8mm-ddr4-evk can reproduce about 200~300 loops
3.hw timeout interrupt trigger and no register can change cycle(fixed)
4.try 300MHZ h1 root clock, run 5000 loops can not reproduce
5.we don't want to sacrifice performace,wo modify driver
if hw abnormal interrupt trigger, don.t set irq_done flag
driver will enter into waitEventTimeout process and release hw later
Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
Reviewed-by: Ming Qian <ming.qian@nxp.com>
encode fail with log "en core suspend sem down error id".
some abnormal interrupts occur.
the 'core_suspend_sem' semaphore didn't do up operation but wakeup ctlrsw.
So the following enable core operation will timeout due to down operation.
just do up and wake up operation after receiving frame ready interrupt.
if abnormal interrupt received, just do nothing.
current encoding process will timeout.
at last enter into release hardware process.
Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
Reviewed-by: Ming Qian <ming.qian@nxp.com>
the semaphore is unlocked in isr in normal case,
if the interrupt is missed, and timeout is triggered,
there will be no change to unlock it
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Since kernel verision 5.16, there has a blk-ctrl driver uniformly
handle blk-ctrls, so, don't need vpu driver handle it separately,
otherwise, will lead to system hang, described as: failing to meet
the ADB handshake and/or reset sequencing requirements will generally
lead to system hangs (not necessarily at the point where the sequence
is violated).
blk-ctrl driver: commit 2684ac05a8 ("soc: imx: add i.MX8M blk-ctrl driver")
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
Rewrite mirror_regs to hw_regs only in encoding finished(irq_status & 0x04),
also need to clear 'reg_corrupt'.
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
Previously, use 'currrent->pid' indicate which instance is occupying the
core, which might has issue in below case:
Application(pid_0) create a new thread(pid_1) to do encode, thus
current->pid = pid_1. If directly 'kill -9 pid_0', will close encoder in
pid_0, hence, 'dev->pid(pid_1) != pid_0', and some dev flag will not be
cleaned, which will impact following encode.
File handle is unique for each instance, it is more reasonable and safe
to use file handle to indicate which instance is occuping encoder core.
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
In EncAsicFrameStart():
(1) set sw mirror registers through EncAsicSetRegisterValue()
(2) set hw registers through EWLWriteReg()
(3) set hw enable register to trigger HW
if suspend happen between (1) and (3), e.g. most hw registers will be
cleared before trigger HW, as a result, 'ASIC_STATUS_ERROR' will be
reported after EWLWaitHwRdy().
Add new ioctl 'HX280ENC_IOCG_EN_CORE' to trigger HW.
During suspend, if HW is reserved, backup HW registers to mirror_regs;
if in encoding, enter suspend until encode current frame finish.
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
Directly check 'regs.offset + regs.size', instead of
'(regs.offset + regs.size) / 4', that has a risk if it isn't
multiple of 4.
(coverity ID 17802820)
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
replace ioremap_nocache with ioremap
ioremap has provided non-cached semantics by default since the Linux 2.6
Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
Signed-off-by: Li Yang <leoyang.li@nxp.com>
Upstream rejected per-SOC kconfig symbols such as CONFIG_ARCH_FSL_IMX8MQ
so just use CONFIG_ARCH_MXC instead.
There is already an ARM64 check in drivers/mxc/Kconfig so this
shouldn't change anything except that we can drop CONFIG_ARCH_FSL_IMX8MQ
from linux-nxp tree.
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Acked-by: Zhou Peng <eagle.zhou@nxp.com>
compat_ptr() depends on CONFIG_COMPAT.
Make hx280enc_ioctl() conditionally compiled to avoid a build
break in case CONFIG_COMPAT is not defined.
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>