1
0
Fork 0
Commit Graph

34 Commits (31b92c7ddf6ed7458f993924801907c1fd05993c)

Author SHA1 Message Date
Shijie Qin 31b92c7ddf LF-2111: mxc: vpu_windsor: Avoid hide parameter
Fix declaration hides parameter 'attr'.
(coverity ID 5572378)

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
2020-08-13 17:20:32 +08:00
Ming Qian f36e9e62bd MLK-24477-2:[8QM_MEK/8QXP_MEK]mxc:vpu_windsor: enable color description in vui
1. enable color description in vui when encoding.
2. improve the get/set color description api

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
2020-08-12 16:02:07 +08:00
Shijie Qin 24a0a82d97 MLK-24404-2 mxc: vpu_windsor: correct device power usage_count
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>
2020-07-15 19:18:59 +08:00
Ming Qian a491cf9985 LF-1681: [8QM_MEK/8QXP_MEK]mxc:vpu_windsor: delete redundant data before start code
there may be some redundant data before the encoded frame,
generally it won't bring any problem.
but on android, the redundant data may affect the mux,
can cause the mp4 can't be decoded.
so delete the redundant data in the driver.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
2020-07-03 14:35:38 +08:00
Ming Qian 7f3a9db8ad LF-1406-2:[8QM_MEK/8QXP_MEK]mxc:vpu_windsor: support insmod repeatly
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 malone,
so we don't do vpu reset when remove module.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
2020-05-25 09:25:49 +08:00
Ming Qian 1e607ac346 LF-1406-1:[8QM_MEK/8QXP_MEK]mxc:vpu_windsor: support insmod separately
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>
2020-05-25 09:25:49 +08:00
Ming Qian c1a6c87e78 LF-1278:[8QM_MEK/8QXP_MEK]mxc:vpu_windsor: implement ctrl to set h264 aspect ratio
The default aspect ratio supplied by firmware may be not correct.
And V4L2 have some ctrl interface to set it.
	V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE,
	V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC,
	V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH,
	V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT
So driver can implement these controls and supply a proper default value
vpu_windsor driver 1.0.3

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
2020-04-24 10:05:58 +08:00
Shijie Qin ec7568ce2f LF-1220-2 mxc: vpu_windsor manage mailbox according to runtime PM
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>
2020-04-17 09:07:15 +08:00
Ming Qian 63fd75743f LF-1210:[8QM_MEK/8QXP_MEK]mxc:vpu_windsor: add LVL_FLOW debug log level to help trace some key information
Keep up with the decoder.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
2020-04-09 10:31:48 +08:00
Ming Qian d44ac89670 LF-1208:[8QM_MEK/8QXP_MEK]mxc:vpu_windsor:instance may hang caused by stop cmd is not sent in some case
If close encoder after streamon immediately,
driver may try to stop instance before really start,
so stop cmd may be not sent,
but start cmd will be send when mem_request event is received.
It'll led to intance hang
driver version 1.0.2

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
2020-04-09 10:31:47 +08:00
Ming Qian 005804e23f LF-1078-2:[8QM_MEK/8QXP_MEK]mxc:vpu_windsor:compatible with ffmpeg h264_v4l2m2m encoder
set the last_buffer_queued flag

Signed-off-by: Ming Qian <ming.qian@nxp.com>
2020-03-24 15:44:47 +08:00
Ming Qian 7c5d76d7a1 LF-1078:[8QM_MEK/8QXP_MEK]mxc:vpu_windsor:compatible with ffmpeg h264_v4l2m2m encoder
1.calcuate a timestamp for the eos frame
2.send eos event after all frames are dequeueed

Signed-off-by: Ming Qian <ming.qian@nxp.com>
2020-03-24 15:41:25 +08:00
Li Yang 072173c984 LF-994 mxc: vpu_malone vpu_windsor: cope with upstream y2038 changes
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>
2020-02-24 17:00:12 +08:00
Ming Qian 00eee65de7 LF-840-6:[8QM_MEK/8QXP_MEK]mxc:vpu_malone:abort or stop cmd may timeout after resume from suspend when run multi h264 instance
fix the similar issue of vpu windsor

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Acked-by: Shijie Qin <shijie.qin@nxp.com>
2020-02-21 15:03:11 +08:00
Ming Qian a8512d04d2 LF-711:[8QM_MEK/8QXP_MEK]mxc:vpu_malone:stream may hang due to the event
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>
2020-01-07 13:48:51 +08:00
Ming Qian beafe9f8ed LF-690:[8QM_MEK/8QXP_MEK]mxc:vpu_windsor:extends the range of frame rate from integers to real numbers
currently, vpu encoder only support integer frame rate,
we need improve the firmware to support fractional frame rate
so extends the range of frame rate from integers to real numbers

Signed-off-by: Ming Qian <ming.qian@nxp.com>
2020-01-06 14:19:14 +08:00
Ming Qian a96c3aee9f LF-688:[8QM_MEK/8QXP_MEK]mxc:vpu_windsor:export fw log via debugfs
export fw log via debugfs
the fw log can help us debug some firmware issue.
keep consistent with the decoder

Signed-off-by: Ming Qian <ming.qian@nxp.com>
2020-01-06 14:19:14 +08:00
Shijie Qin 9fde70430f MLK-22991 mxc: vpu_malone vpu_windsor: check is vpu poweroff when suspend
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>
2019-11-25 15:47:46 +08:00
Julien Olivain cd5340e7f6 MLK-22952 mxc: vpu_windsor: add missing semicolon
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>
2019-11-25 15:47:44 +08:00
ming_qian 008627cc26 MLK-22920 vpu: windsor encoder: change the writeable flag synchronously
If the writeable flag is not change synchronously,
the flag may not changed correct,
it'll case the encode stream hang.
It's likely to happen when small resolution stream do suspend.

Signed-off-by: ming_qian <ming.qian@nxp.com>
Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
2019-11-25 15:47:43 +08:00
Shijie Qin 23401f11ca MLK-22913 vpu: windsor malone: fix kernel panic caused by directly read MU
- After switch to use mailbox, shall not read MU register directly
- VPU shall always poweroff when suspend, hence related check
  unnecessary.
- Remain the API to unify code of 4.19 kernel version

[  123.773671] Call trace:
[  123.776123]  vpu_resume+0x90/0x1d8
[  123.779534]  platform_pm_resume+0x24/0x48
[  123.783542]  dpm_run_callback.isra.15+0x38/0xec
[  123.788075]  device_resume+0x74/0x11c
[  123.791740]  dpm_resume+0xdc/0x20c
[  123.795144]  dpm_resume_end+0x14/0x28
[  123.798809]  suspend_devices_and_enter+0x190/0x5a4
[  123.803596]  pm_suspend+0x258/0x320
[  123.807091]  state_store+0x84/0x108
[  123.810581]  kobj_attr_store+0x14/0x24
[  123.814333]  sysfs_kf_write+0x40/0x48
[  123.817993]  kernfs_fop_write+0xe8/0x1e4
[  123.821916]  __vfs_write+0x18/0x3c
[  123.825318]  vfs_write+0xb8/0x1ac
[  123.828634]  ksys_write+0x60/0xd8
[  123.831946]  __arm64_sys_write+0x18/0x20
[  123.835879]  el0_svc_common.constprop.2+0xb0/0x160
[  123.840669]  el0_svc_handler+0x20/0x7c
[  123.844422]  el0_svc+0x8/0x640
[  123.847484] Code: d65f03c0 f940d296 914042d6 910092d6 (b94002d6)
[  123.853581] ---[ end trace d17f2f7d780f8e3f ]---

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>
2019-11-25 15:47:42 +08:00
Shijie Qin b8ce664bea vpu: windor encoder: malone decoder: fix kernel panic caused by MU_Init
- Remove MU_Init() and other related operations after switch to
  mailbox
- Remain API for unify code between 4.19 and 5.x

[   30.052738] Call trace:
[   30.055182]  MU_Init+0x10/0x80
[   30.058237]  vpu_resume+0x48/0x1e8
[   30.061638]  platform_pm_resume+0x24/0x60
[   30.065653]  dpm_run_callback.isra.16+0x1c/0x70
[   30.070186]  device_resume+0x88/0x148
[   30.073850]  dpm_resume+0xd4/0x1e0
[   30.077253]  dpm_resume_end+0x14/0x28
[   30.080918]  suspend_devices_and_enter+0x14c/0x500
[   30.085706]  pm_suspend+0x1f4/0x260
[   30.089194]  state_store+0x84/0xf0
[   30.092603]  kobj_attr_store+0x14/0x28
[   30.096357]  sysfs_kf_write+0x48/0x58
[   30.100016]  kernfs_fop_write+0xe0/0x1f8
[   30.103940]  __vfs_write+0x18/0x40
[   30.107339]  vfs_write+0x19c/0x1f0
[   30.110738]  ksys_write+0x64/0xf0
[   30.114054]  __arm64_sys_write+0x14/0x20
[   30.117989]  el0_svc_common.constprop.2+0xb0/0x168
[   30.122779]  el0_svc_handler+0x20/0x80
[   30.126534]  el0_svc+0x8/0xc

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
2019-11-25 15:47:42 +08:00
Shijie Qin de893e3f79 vpu: windsor encoder: enable mailbox and unify code
- Enable mailbox for vpu encoder
  The mailbox of mu1_m0 is used by imx8qxp
  The mailbox of mu2_m0 are used by imx8qm

- Unify code between 4.19 and 5.x
  Update code from 4.19
  Separate sc and mu contents to vpu_encoder_mu.h/.c
  Separate pm_domain contents to vpu_encoder_pm.h/.c
  Add kfifo for better hold received mu message
  Sync v4l2 change

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
2019-11-25 15:47:41 +08:00
Shijie Qin 82e0fc6154 vpu: windsor encoder: add vpuenc2 power domain for imx8qm
Add vpuenc2 power for imx8qm.
Unify name as vpuenc1 and vpuenc2

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
2019-11-25 15:47:40 +08:00
Zhou Peng bb61f55140 vpu: malone: encoder: add mu2 power domain for imx8qm
add mu2 power domain

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:38 +08:00
Dong Aisheng 92e1bbb20a media: vpu_windsor: fix boot warning by intialize device_caps
Caused by:
049e684 media: v4l2-dev: fix WARN_ON(!vdev->device_caps)
3c13505 media: v4l2-dev/ioctl: require non-zero device_caps, verify sane querycap results

[    1.672018] WARNING: CPU: 0 PID: 61 at ../drivers/media/v4l2-core/v4l2-dev.c:864 __video_register_device+0x70/0x1524
[    1.682454] Modules linked in:
[    1.685501] CPU: 0 PID: 61 Comm: kworker/0:1 Not tainted 5.3.0-rc2-next-20190730-01100-gb0d5e17 #476
[    1.694617] Hardware name: Freescale i.MX8QXP MEK (DT)
[    1.699751] Workqueue: events deferred_probe_work_func
[    1.704870] pstate: 60000005 (nZCv daif -PAN -UAO)
[    1.709647] pc : __video_register_device+0x70/0x1524
[    1.714603] lr : __video_register_device+0x70/0x1524
[    1.719550] sp : ffff00001207ba70
[    1.722849] x29: ffff00001207ba70 x28: ffff00001005bcd8
[    1.728148] x27: ffff80083b4e23b8 x26: ffff0000119a0230
[    1.733448] x25: ffff80083af4d800 x24: 0000000000000001
[    1.738747] x23: 0000000000000000 x22: ffff80083bfc7c10
[    1.744046] x21: ffff80083fa285c0 x20: ffff000011041d90
[    1.749346] x19: ffff000011989000 x18: ffff000014ffffff
[    1.754645] x17: 0000000037cab0d3 x16: ffff000014ffffff
[    1.759945] x15: ffff0000113e6000 x14: 0000008000000000
[    1.765244] x13: 0000000000000000 x12: 00000000000000e9
[    1.770543] x11: ffffffffffffffff x10: 00000000000000ea
[    1.775843] x9 : ffff0000119a34c0 x8 : 5d20657265682074
[    1.781142] x7 : 7563205b2d2d2d2d x6 : ffff0000106dc978
[    1.786441] x5 : 0000000000000000 x4 : 0000000000000000
[    1.791741] x3 : 00000000ffffffff x2 : 1e3af7ec181d8600
[    1.797040] x1 : 0000000000000000 x0 : 0000000000000024
[    1.802342] Call trace:
[    1.804779]  __video_register_device+0x70/0x1524
[    1.809383]  vpu_enc_probe+0x290/0xb94
[    1.813117]  platform_drv_probe+0x4c/0xb0
[    1.817112]  really_probe+0x1c4/0x2d0
[    1.820761]  driver_probe_device+0x58/0xfc
[    1.824842]  __device_attach_driver+0x90/0xac
[    1.829190]  bus_for_each_drv+0x68/0xbc
[    1.833008]  __device_attach+0xe0/0x138
[    1.836831]  device_initial_probe+0x10/0x18
[    1.841000]  bus_probe_device+0x90/0x98
[    1.844823]  deferred_probe_work_func+0x70/0xa4
[    1.849346]  process_one_work+0x13c/0x2b4
[    1.853337]  worker_thread+0x35c/0x3e4
[    1.857077]  kthread+0xf8/0x124
[    1.860204]  ret_from_fork+0x10/0x18

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:37 +08:00
Dong Aisheng 9d9cc0d614 MLK-21985-3 vpu: windsor: b0: fix build for next 20190607 upgrade
Due to below commit:
7e98b7b542 ("media: v4l2: Get rid of ->vidioc_enum_fmt_vid_{cap, out}_mplane")

../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:1586:2: error: unknown field ‘vidioc_enum_fmt_vid_cap_mplane’ specified in initializer
  .vidioc_enum_fmt_vid_cap_mplane = vpu_enc_v4l2_ioctl_enum_fmt_vid_cap_mplane,
  ^
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:1587:2: error: unknown field ‘vidioc_enum_fmt_vid_out_mplane’ specified in initializer
  .vidioc_enum_fmt_vid_out_mplane = vpu_enc_v4l2_ioctl_enum_fmt_vid_out_mplane,
  ^
../scripts/Makefile.build:278: recipe for target 'drivers/mxc/vpu_windsor/vpu_encoder_b0.o' failed
make[4]: *** [drivers/mxc/vpu_windsor/vpu_encoder_b0.o] Error 1

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:36 +08:00
Zhou Peng feb3fc549f vpu: windsor encoder: porting from 4.19 rc3 release
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'/'vidioc_s_crop' removed
  comment function 'v4l2_ioctl_g_crop'
- remove legacy macro, such as 'VB2_BUF_STATE_PREPARED'

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:34 +08:00
Zhou Peng 6c775159dd vpu: windsor encoder: porting from 4.19 rc3 release
updating source in drivers/mxc/vpu_windsor

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:34 +08:00
Dong Aisheng 67b35d2120 vpu: windsor: fix build error
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c: In function ‘show_buffer_info’:
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:3951:23: error: ‘VB2_BUF_STATE_REQUEUEING’ undeclared (first use in this function)
    " %d:requeueing,", VB2_BUF_STATE_REQUEUEING);

Due to this macro was removed by the following commit:
commit c6e4e2c403
Author: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Date:   Thu Feb 28 07:35:46 2019 -0500

    media: vb2: drop VB2_BUF_STATE_REQUEUEING

    The last user of this state has been converted, so we can now drop
    this. Requeueing causes the queue to become unordered, which causes
    problems with requests and (in the future) fences.

    Since it is no longer needed, just get rid of this.

    Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:31 +08:00
Dong Aisheng 3f0ca5ec74 vpu: windsor: remove deprecated using of VB2_BUF_STATE_PREPARED
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c: In function ‘show_buffer_info’:
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:4001:21: error: ‘VB2_BUF_STATE_PREPARED’ undeclared (first use in this function)
    " %d:prepared,", VB2_BUF_STATE_PREPARED);

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:31 +08:00
Dong Aisheng d450dea80f vpu: windsor: remove deprecated using of s_crop/g_crop
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c: At top level:
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:1415:2: error: unknown field ‘vidioc_g_crop’ specified in initializer
  .vidioc_g_crop                  = vpu_enc_v4l2_ioctl_g_crop,
  ^
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:1415:2: warning: initialization from incompatible pointer type
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:1415:2: warning: (near initialization for ‘vpu_enc_v4l2_ioctl_ops.vidioc_dqbuf’)
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:1416:2: error: unknown field ‘vidioc_s_crop’ specified in initializer
  .vidioc_s_crop   = vpu_enc_v4l2_ioctl_s_crop,
  ^

Module owner can double check later if need implement the same function
in other callbackes.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:30 +08:00
Dong Aisheng 79ab5d4a80 vpu: windsor: fix build failure
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c: In function ‘vpu_enc_v4l2_ioctl_qbuf’:
../drivers/mxc/vpu_windsor/vpu_encoder_b0.c:1048: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_windsor/vpu_encoder_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_windsor/vpu_encoder_b0.c:1048:8: error: too few arguments to function ‘vb2_qbuf’
  ret = vb2_qbuf(&q_data->vb2_q, buf);

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:47:30 +08:00
Zhou Peng 95b1763c0a Add Malone decoder and windsor encoder for QXP/QM
Add vpu driver:
drivers/mxc/vpu_malone
drivers/mxc/vpu_windsor

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2019-11-25 15:47:27 +08:00