Commit Graph

94 Commits

Author SHA1 Message Date
Zhou Peng
90192c5d29 LF-15731: mxc: vpu: wave6: no copyright in one header file
Add copyright for file 'drivers/mxc/vpu/wave6/wave6-trace.h'

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
2025-07-08 20:00:06 +08:00
Jason Liu
ab72b4936f Revert "LF-14286-2: mxc: vpu: wave6: remove the second parameter in __assign_str()"
This reverts commit 55c1e61714.

This commit breaks the build and no need for 6.6 kernel

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
2025-05-20 11:01:15 +08:00
Zhou Peng
55c1e61714 LF-14286-2: mxc: vpu: wave6: remove the second parameter in __assign_str()
fix potential compiler issue on many platforms:
error: macro "__assign_str" passed 2 arguments, but takes just 1

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
2025-04-22 17:26:58 +08:00
Zhou Peng
a792be88ba MA-23263: mxc: vpu: wave6: Allow 2x2 cropping size for the encoder.
enhance crop feature with 2x2 alignment

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
2025-04-22 17:26:44 +08:00
Zhou Peng
8e8c10515d LF-14462: mxc: vpu: wave6: Add 'identical size ranges' feature for vpu encoder
Increase W6_MAX_ENC_PIC_HEIGHT from 2304 to 4096

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
2025-04-22 17:26:34 +08:00
Ming Qian
b33d9ef0f0 MA-23237-2: mxc: vpu: wave6: Support decoding size up to 4096x4096
The wave6 decoder support identical size ranges horizontally as
vertically.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Ming Zhou <ming.zhou@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
2025-04-22 17:26:23 +08:00
Ming Qian
d60f271ccc MA-23268-3: mxc: vpu: wave6: Handle colorspace change
When colorspace change, but size is not changed, firmware still trigger
a source chagne event.

1. Implement decoder start cmd.
2. Report V4L2_EVENT_SRC_CH_COLORSPACE if only colorspace change
3. Don't do buffer allocation again if only colorspace change
4. Use macro to magic number 32

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
2025-04-22 17:26:12 +08:00
Ming Qian
e88de905f5 CARPL-471: mxc: vpu: wave6: Guarantee vpu power state in requiring work
In requiring work, driver need to access register, if it's scheduled too
late, and the instance has been destroyed due to timeout, then it will
led to kernel panic.

====== V4L2DEC: 1.24.0 build on Jul 24 2024 02:25:45. ======
[video] on_pad_added: Found v4l2h264dec element
[  170.658267] SError Interrupt on CPU0, code 0x00000000be000011 – SError
[  170.658279] CPU: 0 PID: 110 Comm: irq/204-vpu_irq Not tainted 6.6.36-lts-next-g5348b0336fb3-dirty #1
[  170.658284] Hardware name: NXP i.MX95 19X19 board (DT)
[  170.658287] pstate: 60400009 (nZCv daif +PAN UAO -TCO -DIT -SSBS BTYPE=-)
[  170.658292] pc : wave6_vpu_ctrl_require_buffer+0x5c/0x150
[  170.658308] lr : wave6_vpu_ctrl_require_buffer+0x118/0x150
[  170.658313] sp : ffff80008398bd20
[  170.658314] x29: ffff80008398bd30 x28: 0000000000000000 x27: 0000000000000000
[  170.658323] x26: ffff8000800f5758 x25: ffff8000800f31c4 x24: 0000000000000000
[  170.658329] x23: ffff800083363010 x22: ffff000081217e80 x21: ffff800083363000
[  170.658334] x20: ffff000081268c80 x19: ffff000081268e10 x18: 0000000000000001
[  170.658340] x17: ffff0003fdfffb10 x16: 0000000000000100 x15: 0000000000000000
[  170.658345] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000352f2f
[  170.658350] x11: 0000000000181000 x10: ffff80009fe01000 x9 : 0000000000000000
[  170.658356] x8 : ffff80008984d000 x7 : 0000000000000000 x6 : 000000000000003f
[  170.658361] x5 : 0000000000000040 x4 : 0000000000000000 x3 : ffff80008106bcf8
[  170.658366] x2 : 0000000000000000 x1 : ffff800084b305f4 x0 : ffff800084b30000
[  170.658374] Kernel panic - not syncing: Asynchronous SError Interrupt
[  170.658376] CPU: 0 PID: 110 Comm: irq/204-vpu_irq Not tainted 6.6.36-lts-next-g5348b0336fb3-dirty #1
[  170.658380] Hardware name: NXP i.MX95 19X19 board (DT)
[  170.658383] Call trace:
[  170.658385]  dump_backtrace+0x90/0xe8
[  170.658395]  show_stack+0x18/0x24
[  170.658400]  dump_stack_lvl+0x48/0x60
[  170.658408]  dump_stack+0x18/0x24
[  170.658413]  panic+0x324/0x380
[  170.658419]  nmi_panic+0x8c/0x90
[  170.658423]  arm64_serror_panic+0x6c/0x78
[  170.658427]  arm64_is_fatal_ras_serror+0x3c/0xac
[  170.658432]  do_serror+0x5c/0x70
[  170.658435]  el1h_64_error_handler+0x30/0x48
[  170.658441]  el1h_64_error+0x64/0x68
[  170.658445]  wave6_vpu_ctrl_require_buffer+0x5c/0x150
[  170.658450]  wave6_vpu_irq_thread+0x68/0x114
[  170.658454]  irq_thread_fn+0x2c/0xa8
[  170.658460]  irq_thread+0x160/0x248
[  170.658466]  kthread+0x110/0x114
[  170.658471]  ret_from_fork+0x10/0x20
[  170.658477] SMP: stopping secondary CPUs
[  170.658486] Kernel Offset: disabled
[  170.658487] CPU features: 0x0,c0000000,40028143,1000721b
[  170.658491] Memory Limit: none
[  170.873278] {}{}[ end Kernel panic - not syncing: Asynchronous SError Interrupt ]{}{}

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
2025-04-22 17:25:22 +08:00
Ming Qian
31699a5f0b CARPL-467-2: mxc: vpu: wave6: Preallocate some work buffer
Firmware may require work buffer in handling create_instance,
that dma_alloc_coherent with GFP_KERNEL may spend too much
time, that may led to CREATE_INSTANCE timeout, then fail the
pipeline.

So just preallocate some work buffers, to reduce the probability of
timeout

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
2025-04-22 17:25:11 +08:00
Ming Qian
ec0d4d6468 CARPL-467-1: mxc: vpu: wave6: Add delay in read_poll_timeout
Make delay interval in read_poll_timeout, take the initiative to
yield the scheduling.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
2025-04-22 17:24:59 +08:00
Ming Qian
25da9355ba LF-14286: mxc: vpu: wave6: update to driver v1.3.11
update wave6 v4l2 driver to v1.3.11,
and fix the following issues:

1. NXPSEU-377: solve encoder rc issue
2. reduce the required sram size from 96K to 82K

and retain the following changes:

1. fix compile errors
2. LF-11686-9: mxc: vpu: wave6: report the firmware git sha code
3. LF-10942-1: mxc: vpu: wave6: add a debugfs to get the firmware log
4. LF-10942-2: mxc: vpu: wave6: support to reload firmware
5. LF-13605: sync bounce buffer
6. LF-13681: arm64: virtio video: adjust 6.12 version
7. increase some error log levels

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
2025-04-22 17:24:43 +08:00
Nas Chung
c39e8bb6b3 LF-13473-5: mxc: vpu: wave6: Prevent load firmware in delete module.
Don't load vpu firmware if just rmmod after insmod.

Signed-off-by: Nas Chung <nas.chung@chipsnmedia.com>
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-10-10 18:29:24 +09:00
Ming Qian
5862ed2020 LF-13473-4: mxc: vpu: wave6: Put power domain before wait done
Ensure the loading firmware work has put power domain in wait boot done,
then it won't cause some asynchronous problems.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-10-10 18:29:24 +09:00
Ming Qian
c15a1c148d LF-13473-3: mxc: vpu: wave6: Ensure power suppliers be suspended before detach them
The power suppliers are always requested to suspend asynchronously,
dev_pm_domain_detach_list() requires the caller to ensure proper
synchronization of this function with power management callbacks.
otherwise the detach may led to kernel panic, like below:

[ 1457.107934] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000040
[ 1457.116777] Mem abort info:
[ 1457.119589]   ESR = 0x0000000096000004
[ 1457.123358]   EC = 0x25: DABT (current EL), IL = 32 bits
[ 1457.128692]   SET = 0, FnV = 0
[ 1457.131764]   EA = 0, S1PTW = 0
[ 1457.134920]   FSC = 0x04: level 0 translation fault
[ 1457.139812] Data abort info:
[ 1457.142707]   ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
[ 1457.148196]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[ 1457.153256]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[ 1457.158563] user pgtable: 4k pages, 48-bit VAs, pgdp=00000001138b6000
[ 1457.165000] [0000000000000040] pgd=0000000000000000, p4d=0000000000000000
[ 1457.171792] Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
[ 1457.178045] Modules linked in: v4l2_jpeg wave6_vpu_ctrl(-) [last unloaded: mxc_jpeg_encdec]
[ 1457.186383] CPU: 0 PID: 51938 Comm: kworker/0:3 Not tainted 6.6.36-gd23d64eea511 #66
[ 1457.194112] Hardware name: NXP i.MX95 19X19 board (DT)
[ 1457.199236] Workqueue: pm pm_runtime_work
[ 1457.203247] pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 1457.210188] pc : genpd_runtime_suspend+0x20/0x290
[ 1457.214886] lr : __rpm_callback+0x48/0x1d8
[ 1457.218968] sp : ffff80008250bc50
[ 1457.222270] x29: ffff80008250bc50 x28: 0000000000000000 x27: 0000000000000000
[ 1457.229394] x26: 0000000000000000 x25: 0000000000000008 x24: 00000000000f4240
[ 1457.236518] x23: 0000000000000000 x22: ffff00008590f0e4 x21: 0000000000000008
[ 1457.243642] x20: ffff80008099c434 x19: ffff00008590f000 x18: ffffffffffffffff
[ 1457.250766] x17: 5300326563697665 x16: 645f676e696c6f6f x15: 63343a6d726f6674
[ 1457.257890] x14: 0000000000000004 x13: 00000000000003a4 x12: 0000000000000002
[ 1457.265014] x11: 0000000000000000 x10: 0000000000000a60 x9 : ffff80008250bbb0
[ 1457.272138] x8 : ffff000092937200 x7 : ffff0003fdf6af80 x6 : 0000000000000000
[ 1457.279262] x5 : 00000000410fd050 x4 : 0000000000200000 x3 : 0000000000000000
[ 1457.286386] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff00008590f000
[ 1457.293510] Call trace:
[ 1457.295946]  genpd_runtime_suspend+0x20/0x290
[ 1457.300296]  __rpm_callback+0x48/0x1d8
[ 1457.304038]  rpm_callback+0x6c/0x78
[ 1457.307515]  rpm_suspend+0x10c/0x570
[ 1457.311077]  pm_runtime_work+0xc4/0xc8
[ 1457.314813]  process_one_work+0x138/0x248
[ 1457.318816]  worker_thread+0x320/0x438
[ 1457.322552]  kthread+0x110/0x114
[ 1457.325767]  ret_from_fork+0x10/0x20

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-10-10 18:29:24 +09:00
Ming Qian
04e192941a LF-13473-2: mxc: vpu: wave6: Release video device before othre resource
need to register video device after other resource is ready, and
release the video device before other related resource, otherwise we may
meet oops in open() or realse() file ops. just like below:

[ 1613.145043] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000218
[ 1613.153833] Mem abort info:
[ 1613.156613]   ESR = 0x0000000096000004
[ 1613.160348]   EC = 0x25: DABT (current EL), IL = 32 bits
[ 1613.165643]   SET = 0, FnV = 0
[ 1613.168685]   EA = 0, S1PTW = 0
[ 1613.171814]   FSC = 0x04: level 0 translation fault
[ 1613.176676] Data abort info:
[ 1613.179544]   ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
[ 1613.185013]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[ 1613.190048]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[ 1613.195351] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000105c2a000
[ 1613.201774] [0000000000000218] pgd=0000000000000000, p4d=0000000000000000
[ 1613.208553] Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
[ 1613.214801] Modules linked in: v4l2_jpeg wave6(+) wave6_vpu_ctrl [last unloaded: v4l2_jpeg]
[ 1613.223140] CPU: 0 PID: 99207 Comm: v4l_id Not tainted 6.6.36-gd23d64eea511 #66
[ 1613.230435] Hardware name: NXP i.MX95 19X19 board (DT)
[ 1613.235558] pstate: 604000c9 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 1613.242508] pc : _raw_spin_lock_irqsave+0x34/0x8c
[ 1613.247205] lr : v4l2_m2m_cancel_job+0x3c/0x190
[ 1613.251729] sp : ffff800083d2bcb0
[ 1613.255031] x29: ffff800083d2bcb0 x28: ffff000084641d80 x27: 0000000000000000
[ 1613.262155] x26: 0000000000000000 x25: 0000000000000000 x24: 0000000000000000
[ 1613.269279] x23: ffff00008077c160 x22: ffff00008319d780 x21: 0000000000000000
[ 1613.276403] x20: 0000000000000218 x19: 0000000000000000 x18: 0000000000000000
[ 1613.283527] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
[ 1613.290651] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000
[ 1613.297775] x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000
[ 1613.304899] x8 : ffff800083d2bd88 x7 : 0000000000000000 x6 : 000000000000003f
[ 1613.312023] x5 : ffff00008558bad0 x4 : ffff000084641d80 x3 : 0000000000000000
[ 1613.319156] x2 : 0000000000000001 x1 : 0000000000000000 x0 : 0000000000000218
[ 1613.326280] Call trace:
[ 1613.328722]  _raw_spin_lock_irqsave+0x34/0x8c
[ 1613.333066]  v4l2_m2m_cancel_job+0x3c/0x190
[ 1613.337234]  v4l2_m2m_ctx_release+0x18/0x40
[ 1613.341403]  wave6_vpu_dec_release+0x24/0xe4 [wave6]
[ 1613.346369]  v4l2_release+0xe4/0xec
[ 1613.349853]  __fput+0xb4/0x274
[ 1613.352904]  __fput_sync+0x50/0x5c
[ 1613.356292]  __arm64_sys_close+0x38/0x7c
[ 1613.360201]  invoke_syscall+0x48/0x114
[ 1613.363945]  el0_svc_common.constprop.0+0xc0/0xe0
[ 1613.368642]  do_el0_svc+0x1c/0x28
[ 1613.371944]  el0_svc+0x40/0xe4
[ 1613.374995]  el0t_64_sync_handler+0x120/0x12c
[ 1613.379345]  el0t_64_sync+0x190/0x194
[ 1613.382998] Code: b9000841 d503201f 52800001 52800022 (88e17c02)
[ 1613.389079] ---[ end trace 0000000000000000 ]---
[ 1613.393681] note: v4l_id[99207] exited with irqs disabled
[ 1613.399141] note: v4l_id[99207] exited with preempt_count 1

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-10-10 18:29:23 +09:00
Ming Qian
04024cdebe LF-13473-1: mxc: vpu: wave6: Set video drvdata before register it
the video drvdata should be set before the video device is registered,
otherwise video_drvdata() may return NULL in the open() file ops, and led
to oops like below:

[  310.000223] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000080
[  310.009051] Mem abort info:
[  310.011888]   ESR = 0x0000000096000004
[  310.014888] vpu 4c480000.vpu: wave6_vpu_dec_release: [0] release
[  310.016036]   EC = 0x25: DABT (current EL), IL = 32 bits
[  310.027084]   SET = 0, FnV = 0
[  310.030248]   EA = 0, S1PTW = 0
[  310.033419]   FSC = 0x04: level 0 translation fault
[  310.038377] Data abort info:
[  310.041269]   ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
[  310.046749]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[  310.051805]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[  310.057115] user pgtable: 4k pages, 48-bit VAs, pgdp=000000010a12d000
[  310.063553] [0000000000000080] pgd=0000000000000000, p4d=0000000000000000
[  310.070340] Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
[  310.076592] Modules linked in: wave6 wave6_vpu_ctrl [last unloaded: v4l2_jpeg]
[  310.076604] CPU: 5 PID: 18156 Comm: v4l_id Not tainted 6.6.36-gd23d64eea511 #66
[  310.076610] Hardware name: NXP i.MX95 19X19 board (DT)
[  310.096220] pstate: a0400009 (NzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[  310.096225] pc : wave6_vpu_open_enc+0x7c/0x7f0 [wave6]
[  310.108292] lr : wave6_vpu_open_enc+0x7c/0x7f0 [wave6]
[  310.108306] sp : ffff800087fcba60
[  310.108308] x29: ffff800087fcba60 x28: ffff0000974e0000 x27: ffff800087fcbc40
[  310.108316] x26: 0000000000000000 x25: 0000000000020100 x24: 0000000000000000
[  310.130973] x23: ffff000084f86500 x22: 0000000000000001 x21: ffff000097a94000
[  310.130980] x20: ffff000097a94090 x19: ffff80007a2b5e30 x18: 0000000000000001
[  310.130987] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
[  310.130993] x14: 0000000000000000 x13: ffff0000808ec025 x12: 00000000003523a0
[  310.131000] x11: 0000000000000000 x10: ffff0003fdffc6f0 x9 : 0000000000000000
[  310.131006] x8 : 0000000000040dc0 x7 : 0000000000000006 x6 : ffff80037c27c000
[  310.131012] x5 : ffff800087fcb9e0 x4 : 00000000ffffffff x3 : ffff00009770c4a0
[  310.131019] x2 : ffff00009770c080 x1 : ffff0000974e0000 x0 : 0000000100000000
[  310.131026] Call trace:
[  310.131028]  wave6_vpu_open_enc+0x7c/0x7f0 [wave6]
[  310.195167]  v4l2_open+0x7c/0x11c
[  310.195178]  chrdev_open+0xbc/0x208

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-10-10 18:29:23 +09:00
TaoJiang
820ff45096 LF-13605: sync bounce buffer
VPU did not support 4G+ address, and IOMMU not enable now.
So in XEN, swiotlb was used in dom0 VPU driver.
Need add dma_sync_xxx for bounce buffer.

Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
2024-10-08 14:30:56 +05:30
Ming Qian
c81f76818d MA-22670: mxc: vpu: wave6: decoder report correct color info
Fix a mistake that decoder always report default color info.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-07-23 14:21:32 +09:00
Ming Qian
33494653cd LF-12975-3: mxc: vpu: wave6: improve wave6 vpu pause
driver use v4l2_m2m_suspend to pause vpu jobs, and it may be called in
different context besides the real suspend. To avoid mutual influence,
we implement a wave6_vpu_pause to handle the pause function.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-07-22 14:55:15 +09:00
Ming Qian
820124db12 LF-12975-2: mxc: vpu: wave6: init seq in decoder's m2m job instead of workqueue
if we keep the workqueue, before suspend, we need to freeze the
workqueue job manually.
if we move the parsing sequencee header to the v4l2 m2m job, then
the v4l2_m2m_suspend will help handle it.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-07-22 14:55:09 +09:00
Ming Qian
76955a8b9f LF-12975-1: mxc: vpu: wave6: fix a bug that driver may clear all buffers after sleep
1. sleep without power off, the cur_pc is not zero, driver will boot
   done directly, without wakeup cmd. in this case, we should not clear
   the work buffers.
2. remove the GLOBAL_WR register, there is only 1 vpu-ctrl device to
   manage the firmware loading.
3. add some debug log

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-07-22 14:55:04 +09:00
TaoJiang
857084dff4 LF-12936: arm64: vpu: wave6: slove wait loading fw timeout
waiting and loading firmware are asynchronous.
and loading process is called in default worker kernel thread.
waiting process may timeout due to scheduling delays,
especially just waking up from system sleep.
(phylink change,kauditd...)

so use 'wait event + longterm timeout + interruptible + freezeble'
but not 'read_poll_timeout'

Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
Reviewed-by: MingQian <ming.qian@nxp.com>
2024-07-17 11:35:22 +05:30
TaoJiang
6f03c84a8c LF-12900: vpu: iwave6: Separated encoder parameter for each codec
if using hevc format and setting 5_0 level,
the actural level of encoded stream is 3_0.

the root cause is when open device,the default level is set.
set hevc format first and then set avc format.

the default level of avc format is 50 which equal to 3_0 level for hevc.
when userspace set level of hevc again, the value is not changed.
so driver will use the error value

Separated encoder parameters by codec to prevent
default values of some parameters from being overwritten.

Signed-off-by: Nas Chung <nas.chung@chipsnmedia.com>
Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
Reviewed-by: MingQian <ming.qian@nxp.com>
2024-07-15 15:12:44 +05:30
TaoJiang
256ca5b4b9 MMFMWK-9397: arm64: wave6: remove level interface
For 4k decoding in our board, the performance can reach higher level than
which marked in datasheet.
So removing level interface of decoder is reasonable.
Otherwise, We can not ensure that the encoder will not use a large level
when encoding with a small bitrate or resolution.

Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
Reviewed-by: MingQian <ming.qian@nxp.com>
2024-07-15 10:55:40 +05:30
Ming Qian
333d432542 LF-12867: mxc: vpu: wave6: Don't register too many frame buffer one time
The number of registered frame buffer should not exceed the firmware
limitation. The maximum fb number that firmware can support is 31.
Don't register too many frame buffer one time.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-07-15 11:33:49 +09:00
Ming Qian
106b8dfd59 LF-12866-2: mxc: vpu: wave6: Get clk rate for each vpu job
In LF-12523, the wave6 vpu has enabled the thermal cooling, that means
the vpu clk rate may be changed. but it won't be changed during one
encoding or decoding task.

we can get clk rate for every encoding or decoding task.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-07-15 11:33:49 +09:00
Mihai Despotovici
917c91a786 LF-12523: vpu: wave6: passive cooling solve checkpatch errors
Signed-off-by: Mihai Despotovici <mihai.despotovici@nxp.com>
2024-07-04 12:13:58 +03:00
Mihai Despotovici
cb21a45f1d LF-12523: vpu: wave6: add passive cooling
Add support for Wave6 VPU passive cooling using dynamic frequency scaling.

Signed-off-by: Mihai Despotovici <mihai.despotovici@nxp.comn>
Reviewed-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Nas Chung <nas.chung@chipsnmedia.com>
2024-07-04 10:21:25 +03:00
Mihai Despotovici
22c26a77e8 LF-12523: vpu: wave6: Add pause support for the VPU entities
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: Mihai Despotovici <mihai.despotovici@nxp.comn>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Nas Chung <nas.chung@chipsnmedia.com>
2024-07-04 10:21:25 +03:00
TaoJiang
038bfb6ffb LF-12805: vpu: wave6: Add profile/level v4l2 ctrls for decoder
Support profile and level v4l2 controls for decoder.
These controls can be used by host for reference.
The control values are updated by decoder driver after parsing header.

Signed-off-by: Nas Chung <nas.chung@chipsnmedia.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
Reviewed-by: MingQian <ming.qian@nxp.com>
2024-07-03 07:24:16 +05:30
Ming Qian
b491229a4e LF-12695: mxc: vpu: wave6: Report the average QP of current encoded frame
Report the average QP value of current encoded frame via the control
V4L2_CID_MPEG_VIDEO_AVERAGE_QP, the value applies to the last dequeued
capture buffer.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
2024-07-02 10:08:01 +09:00
Zhou Peng
392ef2705b LF-12605: mxc: vpu: wave6: update to driver v1.3.10
update wave6 v4l2 driver to v1.3.10, and the following patch is still
retained

LF-10673: mxc: vpu: wave6: add fps statistics
LF-11686-5: NXPSEU-267: mxc: vpu: wave6: support sei recovery flag
LF-11686-9: mxc: vpu: wave6: report the firmware git sha code
LF-10942-1: NXPSEU-269: mxc: vpu: wave6: add a debugfs to get the
firmware log
LF-10942-2: mxc: vpu: wave6: support to reload firmware
fix some coverity issues in v1.3.10
increase some error log levels
fix some coding style in wave6-hw.c

Fix some issues based on v1.3.10
NXPSEU-310: add compatible firmware version
NXPSEU-308: Fix some coverity issues.

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
2024-07-02 10:07:57 +09:00
TaoJiang
d4e40d1a51 LF11696: vpu: wave6: open frame rc by default
Ae hope to open frame level rate control feature by default

Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
Reviewed-by: Ming Qian <ming.qian@nxp.com>
2024-04-11 11:47:14 +05:30
Ming Qian
97d65c042c MA-22235: NXPSEU-280: mxc: vpu: wave6: clear drain flag in output streamoff
We use the src_buffered to indicate the drain flag, but if output
streamoff is called during drain, but before eso, then the src_buffered
may be not cleared.  after output streamon again, driver may trigger an
eos directly, that's not the expected result.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-04-01 17:12:25 +09:00
Ming Qian
10e15f2b29 LF-11768: NXPSEU-269: mxc: vpu: wave6: report performance statistics
report performance statistics via debugfs.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-04-01 17:12:23 +09:00
Ming Qian
d504a383c1 LF-10942-2: mxc: vpu: wave6: support to reload firmware
add a module parameter to make driver reload firmware without reboot,
it's just for debugging.

Based on wave6 v4l2 driver v1.3.9

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-04-01 17:12:23 +09:00
Ming Qian
e8ac7f0ae1 LF-10942-1: NXPSEU-269: mxc: vpu: wave6: add a debugfs to get the firmware log
driver add a debugfs to get firmware log, add a module parameter to
enable the log

Based on wave6 v4l2 driver v1.3.9

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-04-01 17:12:14 +09:00
Ming Qian
bfc53e60f7 LF-11686-9: mxc: vpu: wave6: report the firmware git sha code
chipsnmedia use svn to manage the firmware code, so the git sha code is
only valid for nxp released firmware.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-04-01 17:11:23 +09:00
Ming Qian
cb6fbbb069 LF-11686-8: NXPSEU-261-3: mxc: vpu: wave6: power off if boot fail
call pm_runtime_put_sync() if fail to try boot.
enhance some error handling in suspend and resume.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-04-01 17:11:22 +09:00
Ming Qian
2c21037cc5 LF-11686-7: NXPSEU-261-2: mxc: vpu: wave6: fix some bug in multi vm
fix some bug in current multi vm supporting, the final multi-vm solution
is to be decided

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-04-01 17:11:22 +09:00
Ming Qian
09fb53d628 LF-11686-6: NXPSEU-269-2: mxc: vpu: wave6: return buffers after job finished
call wave6_vpu_return_buffers() in the end of stop_streaming()

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-04-01 17:11:21 +09:00
Ming Qian
6790f77577 LF-11686-5: NXPSEU-267: mxc: vpu: wave6: support sei recovery flag
support the recovery I frame, otherwise it may be skipped.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-04-01 17:11:21 +09:00
Ming Qian
02c03653cc LF-11686-4: NXPSEU-265: mxc: vpu: wave6: decoder output don't align width to 32
only align capture width to 32, otherwise it may fail some cts testcase

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-04-01 17:11:11 +09:00
Ming Qian
b561652068 LF-11686-3: NXPSEU-262: mxc: vpu: wave6: improve code buffer size checking and remap
the max code buffer is supported up to 4M, and make sure there is extra
256K buffer for bss and stack and other sections

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-04-01 16:58:19 +09:00
Ming Qian
21b92a1ed6 LF-11686-2: NXPSEU-261: mxc: vpu: wave6: fix a synchronization problem in wait done
wait until the state is changed to W6_VCPU_BOOT_TIMEOUT, the register
W6_VCPU_CUR_PC just means the firmware is running, doesn't mean it has
finish the initialization.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-04-01 16:58:19 +09:00
TaoJiang
eea80a2358 LF-10673: mxc: vpu: wave6: add fps statistics
1.add total frames and frame cycle stastics.
2.calculate to fps
3.add this function for gstreamer performance test
4.add divide 0 protection

Based on wave6 v4l2 driver v1.3.9

Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
Reviewed-by: Ming Qian <ming.qian@nxp.com>
2024-04-01 16:58:18 +09:00
Ming Qian
7e37cd53d1 LF-11686: mxc: vpu: wave6: update wave6 v4l2 driver 1.3.9
update wave6 v4l2 driver to 1.3.9, the following patches are not
included in it, need to reapply again:

NXPSEU-262: mxc: vpu: wave6: improve code buffer size checking and remap
NXPSEU-261: mxc: vpu: wave6: fix a synchronization problem in wait done
LF-10942-2: mxc: vpu: wave6: support to reload firmware
LF-10942-1: mxc: vpu: wave6: add a debugfs to get the firmware log
LF-10673: mxc: vpu: wave6: add fps statistics

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
2024-04-01 16:58:16 +09:00
Ming Qian
a194f6de11 LF-11273: mxc: vpu: wave6: update wave6 v4l2 driver 1.3.8
update wave6 v4l2 driver to 1.3.8, the following patches are not
included in it, need to reapply again:

LF-11135: mxc: vpu: wave6: decoder report error once firmware report
LF-11095-2: mxc: vpu: wave6: check pointer before reference it
LF-11110: mxc: vpu: wave6: correct the maximum resolution of decoder
LF-11095: mxc: vpu: wave6: decoder initialize default uv data for yuv400
LF-11053: mxc: vpu: wave6: handle decoding error
LF-10942-2: mxc: vpu: wave6: support to reload firmware
LF-10942-1: mxc: vpu: wave6: add a debugfs to get the firmware log
LF-10673-2: arm64: vpu: wave6: add fps statistics
LF-10673: arm64: vpu: wave6: add fps statistics

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-04-01 16:58:13 +09:00
TaoJiang
b3aba8ebb7 LF-11398: arm64: vpu: wave6: encoder add crop function
Set conformance window encoder parameter if host set CROP region.
Report correct CROP region through g_selection().

Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
Reviewed-by: Ming Qian <ming.qian@nxp.com>
Tested-by: Ming Qian <ming.qian@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
2024-01-25 18:17:01 +08:00
Ming Qian
feee11ecde LF-11135: mxc: vpu: wave6: decoder report error once firmware report unsupport in init_seq
The error reason of init_seq may be a bitmask, it may report not support
and other error in the same time. driver may ignore the not support
error if the error_reason is not equal to WAVE6_SYSERR_NOT_SUPPORT.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2023-12-27 14:26:04 +09:00