gst will depend on the try_fmt api
if driver don't report the correct color space in try_fmt
gst may return fail
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
If 'pm_runtime_get_sync()' fail, need to reset device power usage_count
to '0'. Otherwise, the usage_count always bigger than '0' and not do
'runtime_suspend()' actually.
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
For more readable, use a handler table to insert scode for
each format.
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
1. the mu won't be really power off,
so we need restore the mu but not initialize it
2. the vpu is shared with vpu windsor,
so we don't do vpu reset when remove module.
Signed-off-by: Ming Qian <ming.qian@nxp.com>
delay the creation of video device node in order to avoid inmod failure
in probe function, if create video node in a early stage,
the video node may be created before initialize the vpu dev,
and in such case, open video node,
the mu mailbox may be not requested,
then it will led to download firmware fail.
so create the video device node at the end of the probe function.
Signed-off-by: Ming Qian <ming.qian@nxp.com>
When firmware exception, send error event instead of eos event,
avoid doubt or might send eos event twice(exception + parsed eos data).
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
There are two dcp buffer case:
1. for some small resolution, the calcuated buffer size is too small.
2. after decode h264, the dcp info will be reported by the second seq hdr,
driver need calcuate the correct dcp buffer size using the second seq hdr.
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
kfifo memory size must roundup to power-of-two if it is
allocated by driver. Because kfifo elements size will
roundup to power-of-two in kfifo_init(), must guarantee
allocated memory is enough.
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
Need to call mailbox's request/free channel according to runtime PM.
Ohterwise MUs power always 'on' during runtime suspend.
Remove requesting mu from probe, it will be requested through
pm_runtime_resume indirectly, so there is no need call it
directly.
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
firmware have supplied the detailed formula to
calcuate the actually dcp buffer size.
so we can allocate dcp buffer according the resolution
Signed-off-by: Ming Qian <ming.qian@nxp.com>
As eos event, when receive res change event from FW,
don't send it to framework until dst done_list is empty.
Avoid to framework ignore a few decoded frames.
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
only cpu will access the v4l2 buffer of output stream,
so there is no need for allocate dma for it
use virtual memory can decreate the usage of dma,
and won't bring side effort
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Suggest to use vmalloc for fifo entity.
Then use kfifo_init to init the fifo structure.
Then we do not have to require contiguous memory from buddy,
especially in a high pressure of memory resource.
Signed-off-by: Ming Qian <ming.qian@nxp.com>
If allocate mbi buffer and free mbi buffer is out of sync.
The buffer status may be incorrect, and led to unpredictable result
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Acked-by: Shijie Qin <shijie.qin@nxp.com>
Upstream removed 32bit timespec to deal with y2038 issue.
Update MXC drivers to deal with the change.
Signed-off-by: Li Yang <leoyang.li@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
If the resolution is too bit to support,
driver should report an error event,
so application can do the cancel flow
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Acked-by: Shijie Qin <shijie.qin@nxp.com>
1. make sure mu interrupt in the fifo has been handled.
2. make sure event in the fifo has been handled.
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Acked-by: Shijie Qin <shijie.qin@nxp.com>
don't alloc dma in the message handler.
because it may block the event
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Acked-by: Shijie Qin <shijie.qin@nxp.com>
don't clear the pic end flag as it should be cleared by firmware.
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Acked-by: Shijie Qin <shijie.qin@nxp.com>
don't lock around cancel_work_sync, otherwise may cause dead lock.
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Acked-by: Shijie Qin <shijie.qin@nxp.com>
make the fw_flow_mutex a local mutex instead of a global mutex.
the global may cause dead lock when there are one instance
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Acked-by: Shijie Qin <shijie.qin@nxp.com>
When add buffer to queue which status should be active.
When firmware release one buffer, could re-add it to queue if
its status is active.
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Acked-by: ming_qian <ming.qian@nxp.com>
Add 'FRAME_SKIP' status to record 'MEDIA_PLAYER_SKIPPED_FRAME_ID'
frame. Instead of use 'FRAME_READY' that will lead to this buffer
no chance to re-add to available buffer queue.
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
msg hasn't process in time
firmware write event message to message buffer, and trigger an interrupt,
driver will read the message and store it into a fifo. and call queue_work.
If the work is scheduling but have exited the while loop,
it may cause the event won't be processed until another event received.
So in some case, the stream may hang
as the next event is depends on the driver process the current event.
vpu_windsor may have the same issue.
Signed-off-by: Ming Qian <ming.qian@nxp.com>
In low-latency mode, donot need set end_flag if scode type is
BUFFLUSH_PADDING_TYPE. Otherwise, firmware will ignore frame
threshold then may affect another instance performance.
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
Acked-by: ming_qian <ming.qian@nxp.com>
export frame threshold of frame mode,
and then we can modify the threshold without update firmware.
It can be used for debug
Signed-off-by: ming_qian <ming.qian@nxp.com>
Acked-by: <shijie.qin@nxp.com>
we should reinit the completion before send command
who may trigger the completion,
otherwise it may be reinit after complete in certain timing,
then led to timeout
use private workqueue instead of public workqueue
Signed-off-by: ming_qian <ming.qian@nxp.com>
Acked-by: Shijie Qin <shijie.qin@nxp.com>
- If frame ID is MEDIA_PLAYER_SKIPPED_FRAME_ID, need skip this frame,
also need skip its tsm at the same time.
- Fixed coverity issue: CID 6344236 (#2 of 2): Buffer not null
terminated (BUFFER_SIZE_WARNING).
- Remove two deaded code about ctx pointer check.
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Acked-by: ming_qian <ming.qian@nxp.com>
if the eos flag is not clear after output streamoff,
it may cause firmware hang with multi instances
Signed-off-by: ming_qian <ming.qian@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
VPU decoder driver create some debug fs,
but don't set the release function,
in open function, it will alloc some memory,
it should be freed when release function is called.
otherwise, memory will be leaked.
Signed-off-by: ming_qian <ming.qian@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
the csr register 'CM0Px_CPUWAIT' will be cleared to '1' after
reset(poweroff then poweron), hence we could check is vpu poweroff
when suspend according to this value.
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
Acked-by: Zhou Peng <eagle.zhou@nxp.com>
If close is called without calling streamoff,
the status of decode is enable,
some buffer status may be wrong.
disable before release it will avoid such error.
Signed-off-by: ming_qian <ming.qian@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
Acked-by: Zhou Peng <eagle.zhou@nxp.com>
Add a missing semicolon. This missing semicolon is not breaking the
build in defconfig since the next MODULE_DEVICE_TABLE() expand to an
empty string, so the next semicolon is used. When this macro expands
to a non-empty string, the build breaks. This was found by a
"make allmodconfig" build.
Signed-off-by: Julien Olivain <julien.olivain@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
Acked-by: Zhou Peng <eagle.zhou@nxp.com>
- Enable mailbox for vpu decoder
The mailbox of mu_m0 is used by imx8qxp and imx8qm
- Unify code between 4.19 and 5.x
Update code from 4.19
Separate sc and mu contents to vpu_mu.h/vpu_mu.c
Separate pm_domain contents to vpu_pm.h/vpu_pm.c
Add kfifo for better hold received mu message
Sync v4l2 change
Use ktime_get_real_ts64() replace do_gettimeofday()
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Due to below commit:
7e98b7b542 ("media: v4l2: Get rid of ->vidioc_enum_fmt_vid_{cap, out}_mplane")
We met the following build error:
../drivers/mxc/vpu_malone/vpu_b0.c:1721:2: error: unknown field ‘vidioc_enum_fmt_vid_cap_mplane’ specified in initializer
.vidioc_enum_fmt_vid_cap_mplane = v4l2_ioctl_enum_fmt_vid_cap_mplane,
^
../drivers/mxc/vpu_malone/vpu_b0.c:1722:2: error: unknown field ‘vidioc_enum_fmt_vid_out_mplane’ specified in initializer
.vidioc_enum_fmt_vid_out_mplane = v4l2_ioctl_enum_fmt_vid_out_mplane,
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Fix build error for kernel 5.x:
- power domain adjustment
use dev_pm_domain_attach_by_name()/device_link_add
- remove sc fw api
comment fuse related function
- definition of vb2_qbuf() changed
set 'media_device' for vb2_qbuf()
- 'vidioc_g_crop' removed
comment function 'v4l2_ioctl_g_crop'
Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
../drivers/mxc/vpu_malone/vpu_b0.c: In function ‘v4l2_ioctl_qbuf’:
../drivers/mxc/vpu_malone/vpu_b0.c:920:8: warning: passing argument 2 of ‘vb2_qbuf’ from incompatible pointer type
ret = vb2_qbuf(&q_data->vb2_q, buf);
^
In file included from ../include/media/v4l2-mem2mem.h:20:0,
from ../drivers/mxc/vpu_malone/vpu_b0.c:47:
../include/media/videobuf2-v4l2.h:144:5: note: expected ‘struct media_device *’ but argument is of type ‘struct v4l2_buffer *’
int vb2_qbuf(struct vb2_queue *q, struct media_device *mdev,
^
../drivers/mxc/vpu_malone/vpu_b0.c:920:8: error: too few arguments to function ‘vb2_qbuf’
ret = vb2_qbuf(&q_data->vb2_q, buf);
^
In file included from ../include/media/v4l2-mem2mem.h:20:0,
from ../drivers/mxc/vpu_malone/vpu_b0.c:47:
../include/media/videobuf2-v4l2.h:144:5: note: declared here
int vb2_qbuf(struct vb2_queue *q, struct media_device *mdev,
^
../drivers/mxc/vpu_malone/vpu_b0.c: At top level:
../drivers/mxc/vpu_malone/vpu_b0.c:1150:2: error: unknown field ‘vidioc_g_crop’ specified in initializer
.vidioc_g_crop = v4l2_ioctl_g_crop,
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>