Skip to contentSkip to conversation

Add support for DMA2D of STMicroelectronics STM32 Soc series

PATCH Superseded Dillon Min 2 participants 14 messages Oct 19, 2021 – Oct 22, 2021

Subsystems (5)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Dillon Min

author
#0 lore raw

v6 cover Add support for DMA2D of STMicroelectronics STM32 Soc series

This patchset introduces a basic support for DMA2D Interface of STMicroelectronics STM32 SoC series.

This first basic support implements R2M, M2M, M2M_PFC M2M_BLEND support will be added later on.

This has been tested on STM32469-DISCO board.

history
v6:
- use 2592x2592 instead of 0x3fff, 0xffff. [PATCH v6 10/10]
- add space in '(V4L2_CID_BASE+43)' to avoid checkpatch warrnings. [PATCH v6 08/10]

v5 link:
https://lore.kernel.org/lkml/[email protected]/

v5:
- rebase to media_tree https://git.linuxtv.org/media_tree.git/
- remove unused log from dma2d driver to avoid spam kernel log.
- fix 0xFFFFFF to 0xffffff, 2^24 to 2^24 -1, etc.
- introduce patch "media: v4l2-ctrls: Add V4L2_CID_COLORFX_CBCR max setting" to add V4L2_CID_COLORFX_CBCR entry.
- thanks to Hans's patch, open nullptr check in v4l2-compliance, update new test result. thanks.
https://lore.kernel.org/linux-media/[email protected]/

v4 link:
https://lore.kernel.org/lkml/[email protected]/

v4:
- replace V4L2_COLORFX_SET_ARGB, V4L2_CID_COLORFX_ARGB to V4L2_COLORFX_SET_RGB, V4L2_CID_COLORFX_RGB since Alpha paramter not used in current. thanks Hans.
v3 link:
https://lore.kernel.org/lkml/[email protected]/

v3:
- use V4L2_COLORFX_SET_ARGB, V4L2_CID_COLORFX_ARGB to pass argb paramter to the dma2d driver, instead of add stm32 private ioctl.
- some v2's patch are removed in this version.
- "[PATCH v2 7/9] media: docs: add doc for the stm32 dma2d driver"
- "[PATCH v2 8/9] media: v4l: uapi: Add user control base for stm32 dma2d controls"
- dma2d's driver changes based on Hans's review result. detail can be found at "media: stm32-dma2d: STM32 DMA2D driver"
- add stm32 clk drivers bugfix, ltdc clock disabled after kenerl boot up. v3 based on kernel and v4l-utils git:

kernel:
commit 9e1ff307c779ce1f0f810c7ecce3d95bbae40896

Author: Linus Torvalds <[email protected]>
Date:   Sun Oct 3 14:08:47 2021 -0700
    Linux 5.15-rc4

v4l-utils:
commit 700f5ded9c6de2c6dfe5d1b453d85566f95b4f0c

Author: Hans Verkuil <[email protected]>
Date:   Sat Oct 2 11:01:05 2021 +0200

test-media: show version info earlier and show cmd args

Log the version info earlier and also log the command line arguments.

v2 link:
https://lore.kernel.org/lkml/[email protected]/

v2:
- update v4l2-compliance to SHA: a4f2e3a6f306 2021-07-13 08:04:15 the test results at below [1].
- introduce Documentation/userspace-api/media/drivers/stm32-uapi.rst to explain the detail of dma2d's ioctl.
- reserved 16 ioctls from v4l2-controls.h for stm32, introduce stm32-media.h.
- collect Reviewed-by tag from Rob Herring.
- update dma2d driver from Hans's review. the details can be found at related patches.
v1 link:
https://lore.kernel.org/lkml/[email protected]/

v1:
The commit based on kernel(master): c3d0e3fd41b7f0f5d5d5b6022ab7e813f04ea727

Note for v4l2-compliance tool on nu-mmu platform:
I add two change based on v4l-utils since commit:
f0c7e3d71eaf4182bae7eb3ee0e43b4eeb047ea9

- change fork() to vfork() in v4l2-test-controls.cpp since no-mmu platform don't include fork().

with v4l2-compliance test log (with above modification):
since the stm32f469-disco ram limitation, there are 25 failed on dma_alloc_coherent()

Really appreciate if someone can help to test this patch on the STM32429I-EVAL evaluation board (https://www.st.com/en/evaluation-tools/stm32429i-eval.html)
8M x 32-bit SDRAM, 1M x 16-bit SRAM and 8M x 16-bit NOR Flash

~ # free

              total        used        free      shared  buff/cache   available
Mem:          15648        4076        8260           0        3312        7632

~ # v4l2-compliance -f -d /dev/video0 > /dev/ttyprintk

[  234.919026] [U] v4l2-compliance 1.21.0-4855, 32 bits, 32-bit time_t
[  235.880625] [U] v4l2-compliance SHA: 700f5ded9c6d 2021-10-02 09:01:05
[  236.877059] [U] Compliance test for stm-dma2d device /dev/video0:
[  237.835965] [U] Driver Info:
[  238.311502] [U] 	Driver name      : stm-dma2d
[  238.787381] [U] 	Card type        : stm-dma2d
[  239.255574] [U] 	Bus info         : platform:stm-dma2d
[  239.722920] [U] 	Driver version   : 5.15.0
[  240.183388] [U] 	Capabilities     : 0x84208000
[  240.640809] [U] 		Video Memory-to-Memory
[  241.095669] [U] 		Streaming
[  241.540812] [U] 		Extended Pix Format
[  241.978288] [U] 		Device Capabilities
[  242.409891] [U] 	Device Caps      : 0x04208000
[  242.841150] [U] 		Video Memory-to-Memory
[  243.265246] [U] 		Streaming
[  243.680040] [U] 		Extended Pix Format
[  244.092896] [U] Required ioctls:
[  244.499208] [U] 	test VIDIOC_QUERYCAP: OK
[  244.943985] [U] 	test invalid ioctls: OK
[  245.346521] [U] Allow for multiple opens:
[  245.749312] [U] 	test second /dev/video0 open: OK
[  246.526863] [U] 	test VIDIOC_QUERYCAP: OK
[  246.929589] [U] 	test VIDIOC_G/S_PRIORITY: OK
[  247.548185] [U] 	test for unlimited opens: OK
[  247.936192] [U] Debug ioctls:
[  248.311265] [U] 	test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
[  249.058547] [U] 	test VIDIOC_LOG_STATUS: OK (Not Supported)
[  249.802868] [U] Input ioctls:
[  250.173701] [U] 	test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
[  250.914653] [U] 	test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
[  251.657517] [U] 	test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
[  252.408231] [U] 	test VIDIOC_ENUMAUDIO: OK (Not Supported)
[  253.166559] [U] 	test VIDIOC_G/S/ENUMINPUT: OK (Not Supported)
[  253.933560] [U] 	test VIDIOC_G/S_AUDIO: OK (Not Supported)
[  254.695551] [U] 	Inputs: 0 Audio Inputs: 0 Tuners: 0
[  255.082805] [U] Output ioctls:
[  255.462189] [U] 	test VIDIOC_G/S_MODULATOR: OK (Not Supported)
[  256.218699] [U] 	test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
[  256.997586] [U] 	test VIDIOC_ENUMAUDOUT: OK (Not Supported)
[  257.796012] [U] 	test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
[  258.609978] [U] 	test VIDIOC_G/S_AUDOUT: OK (Not Supported)
[  259.453435] [U] 	Outputs: 0 Audio Outputs: 0 Modulators: 0
[  260.303571] [U] Input/Output configuration ioctls:
[  260.741454] [U] 	test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
[  261.618607] [U] 	test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
[  262.517280] [U] 	test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
[  263.427620] [U] 	test VIDIOC_G/S_EDID: OK (Not Supported)
[  264.344630] [U] Control ioctls:
[  264.833262] [U] 	test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
[  265.763394] [U] 	test VIDIOC_QUERYCTRL: OK
[  266.247635] [U] 	test VIDIOC_G/S_CTRL: OK
[  266.730244] [U] 	test VIDIOC_G/S/TRY_EXT_CTRLS: OK
[  267.651495] [U] 	test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
[  268.573048] [U] 	test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
[  269.503304] [U] 	Standard Controls: 3 Private Controls: 0
[  269.976154] [U] Format ioctls:
[  270.458701] [U] 	test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
[  271.395051] [U] 	test VIDIOC_G/S_PARM: OK (Not Supported)
[  272.316304] [U] 	test VIDIOC_G_FBUF: OK (Not Supported)
[  273.242824] [U] 	test VIDIOC_G_FMT: OK
[  273.719213] [U] 	test VIDIOC_TRY_FMT: OK
[  274.187524] [U] 	test VIDIOC_S_FMT: OK
[  274.643930] [U] 	test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
[  275.547089] [U] 	test Cropping: OK (Not Supported)
[  276.446375] [U] 	test Composing: OK (Not Supported)
[  277.347458] [U] 	test Scaling: OK
[  277.800218] [U] Codec ioctls:
[  278.245926] [U] 	test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
[  279.140451] [U] 	test VIDIOC_G_ENC_INDEX: OK (Not Supported)
[  280.023765] [U] 	test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
[  280.910844] [U] Buffer ioctls:
[  281.466649] [U] 	test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
[  282.381634] [U] 	test VIDIOC_EXPBUF: OK
[  282.830946] [U] 	test Requests: OK (Not Supported)
[  283.698629] [U] 	test TIME32/64: OK
[  284.157170] [U] Test input 0:
[  284.594093] [U] Stream using all formats:
[  288.379647] [U] 	                                                  
[  289.111860] [U] 	Video Capture: Captured 8 buffers
[  289.487473] [U] 	BA24 (32-bit ARGB 8-8-8-8) 1x1 -> BA24 (32-bit ARGB 8-8-8-8) 1x1: OK
[  293.012687] [U] 	                                                  
[  293.629532] [U] 	Video Capture: Captured 8 buffers
[  293.947618] [U] 	BA24 (32-bit ARGB 8-8-8-8) 1x1 -> RGB3 (24-bit RGB 8-8-8) 1x1: OK
[  296.900762] [U] 	                                                  
[  297.387693] [U] 	Video Capture: Captured 8 buffers
[  297.643353] [U] 	BA24 (32-bit ARGB 8-8-8-8) 1x1 -> RGBP (16-bit RGB 5-6-5) 1x1: OK
[  299.994539] [U] 	                                                  
[  300.426567] [U] 	Video Capture: Captured 8 buffers
[  300.669991] [U] 	BA24 (32-bit ARGB 8-8-8-8) 1x1 -> AR15 (16-bit ARGB 1-5-5-5) 1x1: OK
[  303.087504] [U] 	                                                  
[  303.519269] [U] 	Video Capture: Captured 8 buffers
[  303.757695] [U] 	BA24 (32-bit ARGB 8-8-8-8) 1x1 -> AR12 (16-bit ARGB 4-4-4-4) 1x1: OK
[  304.244993] stm-dma2d 4002b000.dma2d: dma alloc of size 26873856 failed
[  304.745438] [U] 		fail: v4l2-test-buffers.cpp(1349): q.reqbufs(node, 2)
[  305.257392] [U] 	BA24 (32-bit ARGB 8-8-8-8) 2592x2592 -> BA24 (32-bit ARGB 8-8-8-8) 2592x2592: FAIL
[  305.781175] stm-dma2d 4002b000.dma2d: dma alloc of size 26873856 failed
[  306.321901] [U] 		fail: v4l2-test-buffers.cpp(1349): q.reqbufs(node, 2)
[  306.902217] [U] 	BA24 (32-bit ARGB 8-8-8-8) 2592x2592 -> RGB3 (24-bit RGB 8-8-8) 2592x2592: FAIL
[  307.528929] stm-dma2d 4002b000.dma2d: dma alloc of size 26873856 failed
[  308.174441] [U] 		fail: v4l2-test-buffers.cpp(1349): q.reqbufs(node, 2)
[  308.848959] [U] 	BA24 (32-bit ARGB 8-8-8-8) 2592x2592 -> RGBP (16-bit RGB 5-6-5) 2592x2592: FAIL
[  309.535999] stm-dma2d 4002b000.dma2d: dma alloc of size 26873856 failed
[  310.217444] [U] 		fail: v4l2-test-buffers.cpp(1349): q.reqbufs(node, 2)
[  310.943592] [U] 	BA24 (32-bit ARGB 8-8-8-8) 2592x2592 -> AR15 (16-bit ARGB 1-5-5-5) 2592x2592: FAIL
[  311.713854] stm-dma2d 4002b000.dma2d: dma alloc of size 26873856 failed
[  312.508128] [U] 		fail: v4l2-test-buffers.cpp(1349): q.reqbufs(node, 2)
[  313.338010] [U] 	BA24 (32-bit ARGB 8-8-8-8) 2592x2592 -> AR12 (16-bit ARGB 4-4-4-4) 2592x2592: FAIL
[  317.675312] [U] 	                                                  
[  318.494207] [U] 	Video Capture: Captured 8 buffers
[  318.931776] [U] 	BA24 (32-bit ARGB 8-8-8-8) 240x320 -> BA24 (32-bit ARGB 8-8-8-8) 240x320: OK
[  323.087768] [U] 	                                                  
[  323.775244] [U] 	Video Capture: Captured 8 buffers
[  324.126855] [U] 	BA24 (32-bit ARGB 8-8-8-8) 240x320 -> RGB3 (24-bit RGB 8-8-8) 240x320: OK
[  327.479277] [U] 	                                                  
[  328.005695] [U] 	Video Capture: Captured 8 buffers
[  328.284117] [U] 	BA24 (32-bit ARGB 8-8-8-8) 240x320 -> RGBP (16-bit RGB 5-6-5) 240x320: OK
[  330.830015] [U] 	                                                  
[  331.260303] [U] 	Video Capture: Captured 8 buffers
[  331.497654] [U] 	BA24 (32-bit ARGB 8-8-8-8) 240x320 -> AR15 (16-bit ARGB 1-5-5-5) 240x320: OK
[  334.011389] [U] 	                                                  
[  334.440311] [U] 	Video Capture: Captured 8 buffers
[  334.677829] [U] 	BA24 (32-bit ARGB 8-8-8-8) 240x320 -> AR12 (16-bit ARGB 4-4-4-4) 240x320: OK
[  337.086566] [U] 	                                                  
[  337.517015] [U] 	Video Capture: Captured 8 buffers
[  337.756281] [U] 	RGB3 (24-bit RGB 8-8-8) 1x1 -> BA24 (32-bit ARGB 8-8-8-8) 1x1: OK
[  340.148849] [U] 	                                                  
[  340.579169] [U] 	Video Capture: Captured 8 buffers
[  340.823597] [U] 	RGB3 (24-bit RGB 8-8-8) 1x1 -> RGB3 (24-bit RGB 8-8-8) 1x1: OK
[  343.230816] [U] 	                                                  
[  343.661231] [U] 	Video Capture: Captured 8 buffers
[  343.899455] [U] 	RGB3 (24-bit RGB 8-8-8) 1x1 -> RGBP (16-bit RGB 5-6-5) 1x1: OK
[  346.276450] [U] 	                                                  
[  346.707406] [U] 	Video Capture: Captured 8 buffers
[  346.950489] [U] 	RGB3 (24-bit RGB 8-8-8) 1x1 -> AR15 (16-bit ARGB 1-5-5-5) 1x1: OK
[  349.363029] [U] 	                                                  
[  349.794791] [U] 	Video Capture: Captured 8 buffers
[  350.034303] [U] 	RGB3 (24-bit RGB 8-8-8) 1x1 -> AR12 (16-bit ARGB 4-4-4-4) 1x1: OK
[  350.526018] stm-dma2d 4002b000.dma2d: dma alloc of size 20156416 failed
[  351.023695] [U] 		fail: v4l2-test-buffers.cpp(1349): q.reqbufs(node, 2)
[  351.536683] [U] 	RGB3 (24-bit RGB 8-8-8) 2592x2592 -> BA24 (32-bit ARGB 8-8-8-8) 2592x2592: FAIL
[  352.060944] stm-dma2d 4002b000.dma2d: dma alloc of size 20156416 failed
[  352.603734] [U] 		fail: v4l2-test-buffers.cpp(1349): q.reqbufs(node, 2)
[  353.185847] [U] 	RGB3 (24-bit RGB 8-8-8) 2592x2592 -> RGB3 (24-bit RGB 8-8-8) 2592x2592: FAIL
[  353.814453] stm-dma2d 4002b000.dma2d: dma alloc of size 20156416 failed
[  354.463286] [U] 		fail: v4l2-test-buffers.cpp(1349): q.reqbufs(node, 2)
[  355.138479] [U] 	RGB3 (24-bit RGB 8-8-8) 2592x2592 -> RGBP (16-bit RGB 5-6-5) 2592x2592: FAIL
[  355.826797] stm-dma2d 4002b000.dma2d: dma alloc of size 20156416 failed
[  356.510828] [U] 		fail: v4l2-test-buffers.cpp(1349): q.reqbufs(node, 2)
[  357.237230] [U] 	RGB3 (24-bit RGB 8-8-8) 2592x2592 -> AR15 (16-bit ARGB 1-5-5-5) 2592x2592: FAIL
[  358.008304] stm-dma2d 4002b000.dma2d: dma alloc of size 20156416 failed
[  358.803816] [U] 		fail: v4l2-test-buffers.cpp(1349): q.reqbufs(node, 2)
[  359.630589] [U] 	RGB3 (24-bit RGB 8-8-8) 2592x2592 -> AR12 (16-bit ARGB 4-4-4-4) 2592x2592: FAIL
[  363.960327] [U] 	                                                  
[  364.781066] [U] 	Video Capture: Captured 8 buffers
[  365.214046] [U] 	RGB3 (24-bit RGB 8-8-8) 240x320 -> BA24 (32-bit ARGB 8-8-8-8) 240x320: OK
[  369.359436] [U] 	                                                  
[  370.047235] [U] 	Video Capture: Captured 8 buffers
[  370.411149] [U] 	RGB3 (24-bit RGB 8-8-8) 240x320 -> RGB3 (24-bit RGB 8-8-8) 240x320: OK
[  373.744081] [U] 	                                                  
[  374.268922] [U] 	Video Capture: Captured 8 buffers
[  374.538707] [U] 	RGB3 (24-bit RGB 8-8-8) 240x320 -> RGBP (16-bit RGB 5-6-5) 240x320: OK
[  377.084393] [U] 	                                                  
[  377.514706] [U] 	Video Capture: Captured 8 buffers
[  377.759132] [U] 	RGB3 (24-bit RGB 8-8-8) 240x320 -> AR15 (16-bit ARGB 1-5-5-5) 240x320: OK
[  380.203358] [U] 	                                                  
[  380.637202] [U] 	Video Capture: Captured 8 buffers
[  380.872188] [U] 	RGB3 (24-bit RGB 8-8-8) 240x320 -> AR12 (16-bit ARGB 4-4-4-4) 240x320: OK
[  383.271589] [U] 	                                                  
[  383.700928] [U] 	Video Capture: Captured 8 buffers
[  383.943595] [U] 	RGBP (16-bit RGB 5-6-5) 1x1 -> BA24 (32-bit ARGB 8-8-8-8) 1x1: OK
[  386.328863] [U] 	                                                  
[  386.764962] [U] 	Video Capture: Captured 8 buffers
[  386.999766] [U] 	RGBP (16-bit RGB 5-6-5) 1x1 -> RGB3 (24-bit RGB 8-8-8) 1x1: OK
[  389.410754] [U] 	                                                  
[  389.843266] [U] 	Video Capture: Captured 8 buffers
[  390.087088] [U] 	RGBP (16-bit RGB 5-6-5) 1x1 -> RGBP (16-bit RGB 5-6-5) 1x1: OK
[  392.471763] [U] 	                                                  
[  392.905730] [U] 	Video Capture: Captured 8 buffers
[  393.146591] [U] 	RGBP (16-bit RGB 5-6-5) 1x1 -> AR15 (16-bit ARGB 1-5-5-5) 1x1: OK
[  395.568817] [U] 	                                                  
[  396.000735] [U] 	Video Capture: Captured 8 buffers
[  396.239683] [U] 	RGBP (16-bit RGB 5-6-5) 1x1 -> AR12 (16-bit ARGB 4-4-4-4) 1x1: OK
[  396.726035] stm-dma2d 4002b000.dma2d: dma alloc of size 13438976 failed
[  397.228167] [U] 		fail: v4l2-test-buffers.cpp(1349): q.reqbufs(node, 2)
[  397.740467] [U] 	RGBP (16-bit RGB 5-6-5) 2592x2592 -> BA24 (32-bit ARGB 8-8-8-8) 2592x2592: FAIL
[  398.265046] stm-dma2d 4002b000.dma2d: dma alloc of size 13438976 failed
[  398.806330] [U] 		fail: v4l2-test-buffers.cpp(1349): q.reqbufs(node, 2)
[  399.386895] [U] 	RGBP (16-bit RGB 5-6-5) 2592x2592 -> RGB3 (24-bit RGB 8-8-8) 2592x2592: FAIL
[  400.014307] stm-dma2d 4002b000.dma2d: dma alloc of size 13438976 failed
[  400.661722] [U] 		fail: v4l2-test-buffers.cpp(1349): q.reqbufs(node, 2)
[  401.334815] [U] 	RGBP (16-bit RGB 5-6-5) 2592x2592 -> RGBP (16-bit RGB 5-6-5) 2592x2592: FAIL
[  402.022646] stm-dma2d 4002b000.dma2d: dma alloc of size 13438976 failed
[  402.705189] [U] 		fail: v4l2-test-buffers.cpp(1349): q.reqbufs(node, 2)
[  403.429313] [U] 	RGBP (16-bit RGB 5-6-5) 2592x2592 -> AR15 (16-bit ARGB 1-5-5-5) 2592x2592: FAIL
[  404.199336] stm-dma2d 4002b000.dma2d: dma alloc of size 13438976 failed
[  404.993926] [U] 		fail: v4l2-test-buffers.cpp(1349): q.reqbufs(node, 2)
[  405.824722] [U] 	RGBP (16-bit RGB 5-6-5) 2592x2592 -> AR12 (16-bit ARGB 4-4-4-4) 2592x2592: FAIL
[  410.123611] [U] 	                                                  
[  410.945529] [U] 	Video Capture: Captured 8 buffers
[  411.378867] [U] 	RGBP (16-bit RGB 5-6-5) 240x320 -> BA24 (32-bit ARGB 8-8-8-8) 240x320: OK
[  415.488227] [U] 	                                                  
[  416.177766] [U] 	Video Capture: Captured 8 buffers
[  416.538441] [U] 	RGBP (16-bit RGB 5-6-5) 240x320 -> RGB3 (24-bit RGB 8-8-8) 240x320: OK
[  419.826273] [U] 	                                                  
[  420.354543] [U] 	Video Capture: Captured 8 buffers
[  420.636913] [U] 	RGBP (16-bit RGB 5-6-5) 240x320 -> RGBP (16-bit RGB 5-6-5) 240x320: OK
[  423.163619] [U] 	                                                  
[  423.594915] [U] 	Video Capture: Captured 8 buffers
[  423.832290] [U] 	RGBP (16-bit RGB 5-6-5) 240x320 -> AR15 (16-bit ARGB 1-5-5-5) 240x320: OK
[  426.311384] [U] 	                                                  
[  426.741478] [U] 	Video Capture: Captured 8 buffers
[  426.982107] [U] 	RGBP (16-bit RGB 5-6-5) 240x320 -> AR12 (16-bit ARGB 4-4-4-4) 240x320: OK
[  429.371663] [U] 	                                                  
[  429.806431] [U] 	Video Capture: Captured 8 buffers
[  430.040867] [U] 	AR15 (16-bit ARGB 1-5-5-5) 1x1 -> BA24 (32-bit ARGB 8-8-8-8) 1x1: OK
[  432.455072] [U] 	                                                  
[  432.887528] [U] 	Video Capture: Captured 8 buffers
[  433.131724] [U] 	AR15 (16-bit ARGB 1-5-5-5) 1x1 -> RGB3 (24-bit RGB 8-8-8) 1x1: OK
[  435.531286] [U] 	                                                  
[  435.969388] [U] 	Video Capture: Captured 8 buffers
[  436.205712] [U] 	AR15 (16-bit ARGB 1-5-5-5) 1x1 -> RGBP (16-bit RGB 5-6-5) 1x1: OK
[  438.632679] [U] 	                                                  
[  439.067025] [U] 	Video Capture: Captured 8 buffers
[  439.307189] [U] 	AR15 (16-bit ARGB 1-5-5-5) 1x1 -> AR15 (16-bit ARGB 1-5-5-5) 1x1: OK
[  441.703205] [U] 	                                                  
[  442.135816] [U] 	Video Capture: Captured 8 buffers
[  442.379741] [U] 	AR15 (16-bit ARGB 1-5-5-5) 1x1 -> AR12 (16-bit ARGB 4-4-4-4) 1x1: OK
[  442.867674] stm-dma2d 4002b000.dma2d: dma alloc of size 13438976 failed
[  443.364265] [U] 		fail: v4l2-test-buffers.cpp(1349): q.reqbufs(node, 2)
[  443.879575] [U] 	AR15 (16-bit ARGB 1-5-5-5) 2592x2592 -> BA24 (32-bit ARGB 8-8-8-8) 2592x2592: FAIL
[  444.408321] stm-dma2d 4002b000.dma2d: dma alloc of size 13438976 failed
[  444.954042] [U] 		fail: v4l2-test-buffers.cpp(1349): q.reqbufs(node, 2)
[  445.542126] [U] 	AR15 (16-bit ARGB 1-5-5-5) 2592x2592 -> RGB3 (24-bit RGB 8-8-8) 2592x2592: FAIL
[  446.167742] stm-dma2d 4002b000.dma2d: dma alloc of size 13438976 failed
[  446.813974] [U] 		fail: v4l2-test-buffers.cpp(1349): q.reqbufs(node, 2)
[  447.484183] [U] 	AR15 (16-bit ARGB 1-5-5-5) 2592x2592 -> RGBP (16-bit RGB 5-6-5) 2592x2592: FAIL
[  448.169137] stm-dma2d 4002b000.dma2d: dma alloc of size 13438976 failed
[  448.857907] [U] 		fail: v4l2-test-buffers.cpp(1349): q.reqbufs(node, 2)
[  449.586237] [U] 	AR15 (16-bit ARGB 1-5-5-5) 2592x2592 -> AR15 (16-bit ARGB 1-5-5-5) 2592x2592: FAIL
[  450.354594] stm-dma2d 4002b000.dma2d: dma alloc of size 13438976 failed
[  451.147715] [U] 		fail: v4l2-test-buffers.cpp(1349): q.reqbufs(node, 2)
[  451.969070] [U] 	AR15 (16-bit ARGB 1-5-5-5) 2592x2592 -> AR12 (16-bit ARGB 4-4-4-4) 2592x2592: FAIL
[  456.270179] [U] 	                                                  
[  457.092815] [U] 	Video Capture: Captured 8 buffers
[  457.527337] [U] 	AR15 (16-bit ARGB 1-5-5-5) 240x320 -> BA24 (32-bit ARGB 8-8-8-8) 240x320: OK
[  461.646816] [U] 	                                                  
[  462.336816] [U] 	Video Capture: Captured 8 buffers
[  462.699807] [U] 	AR15 (16-bit ARGB 1-5-5-5) 240x320 -> RGB3 (24-bit RGB 8-8-8) 240x320: OK
[  466.018352] [U] 	                                                  
[  466.552070] [U] 	Video Capture: Captured 8 buffers
[  466.828635] [U] 	AR15 (16-bit ARGB 1-5-5-5) 240x320 -> RGBP (16-bit RGB 5-6-5) 240x320: OK
[  469.335696] [U] 	                                                  
[  469.773367] [U] 	Video Capture: Captured 8 buffers
[  470.010331] [U] 	AR15 (16-bit ARGB 1-5-5-5) 240x320 -> AR15 (16-bit ARGB 1-5-5-5) 240x320: OK
[  472.487852] [U] 	                                                  
[  472.925831] [U] 	Video Capture: Captured 8 buffers
[  473.167824] [U] 	AR15 (16-bit ARGB 1-5-5-5) 240x320 -> AR12 (16-bit ARGB 4-4-4-4) 240x320: OK
[  475.552623] [U] 	                                                  
[  475.985703] [U] 	Video Capture: Captured 8 buffers
[  476.229768] [U] 	AR12 (16-bit ARGB 4-4-4-4) 1x1 -> BA24 (32-bit ARGB 8-8-8-8) 1x1: OK
[  478.654381] [U] 	                                                  
[  479.086506] [U] 	Video Capture: Captured 8 buffers
[  479.326295] [U] 	AR12 (16-bit ARGB 4-4-4-4) 1x1 -> RGB3 (24-bit RGB 8-8-8) 1x1: OK
[  481.714968] [U] 	                                                  
[  482.146937] [U] 	Video Capture: Captured 8 buffers
[  482.390623] [U] 	AR12 (16-bit ARGB 4-4-4-4) 1x1 -> RGBP (16-bit RGB 5-6-5) 1x1: OK
[  484.807477] [U] 	                                                  
[  485.238512] [U] 	Video Capture: Captured 8 buffers
[  485.477276] [U] 	AR12 (16-bit ARGB 4-4-4-4) 1x1 -> AR15 (16-bit ARGB 1-5-5-5) 1x1: OK
[  487.860325] [U] 	                                                  
[  488.292229] [U] 	Video Capture: Captured 8 buffers
[  488.533258] [U] 	AR12 (16-bit ARGB 4-4-4-4) 1x1 -> AR12 (16-bit ARGB 4-4-4-4) 1x1: OK
[  489.019563] stm-dma2d 4002b000.dma2d: dma alloc of size 13438976 failed
[  489.515301] [U] 		fail: v4l2-test-buffers.cpp(1349): q.reqbufs(node, 2)
[  490.029317] [U] 	AR12 (16-bit ARGB 4-4-4-4) 2592x2592 -> BA24 (32-bit ARGB 8-8-8-8) 2592x2592: FAIL
[  490.556478] stm-dma2d 4002b000.dma2d: dma alloc of size 13438976 failed
[  491.097922] [U] 		fail: v4l2-test-buffers.cpp(1349): q.reqbufs(node, 2)
[  491.688235] [U] 	AR12 (16-bit ARGB 4-4-4-4) 2592x2592 -> RGB3 (24-bit RGB 8-8-8) 2592x2592: FAIL
[  492.312625] stm-dma2d 4002b000.dma2d: dma alloc of size 13438976 failed
[  492.957251] [U] 		fail: v4l2-test-buffers.cpp(1349): q.reqbufs(node, 2)
[  493.626205] [U] 	AR12 (16-bit ARGB 4-4-4-4) 2592x2592 -> RGBP (16-bit RGB 5-6-5) 2592x2592: FAIL
[  494.309810] stm-dma2d 4002b000.dma2d: dma alloc of size 13438976 failed
[  494.997367] [U] 		fail: v4l2-test-buffers.cpp(1349): q.reqbufs(node, 2)
[  495.724499] [U] 	AR12 (16-bit ARGB 4-4-4-4) 2592x2592 -> AR15 (16-bit ARGB 1-5-5-5) 2592x2592: FAIL
[  496.490971] stm-dma2d 4002b000.dma2d: dma alloc of size 13438976 failed
[  497.282391] [U] 		fail: v4l2-test-buffers.cpp(1349): q.reqbufs(node, 2)
[  498.101859] [U] 	AR12 (16-bit ARGB 4-4-4-4) 2592x2592 -> AR12 (16-bit ARGB 4-4-4-4) 2592x2592: FAIL
[  502.390697] [U] 	                                                  
[  503.210399] [U] 	Video Capture: Captured 8 buffers
[  503.643633] [U] 	AR12 (16-bit ARGB 4-4-4-4) 240x320 -> BA24 (32-bit ARGB 8-8-8-8) 240x320: OK
[  507.747367] [U] 	                                                  
[  508.434468] [U] 	Video Capture: Captured 8 buffers
[  508.784910] [U] 	AR12 (16-bit ARGB 4-4-4-4) 240x320 -> RGB3 (24-bit RGB 8-8-8) 240x320: OK
[  512.102183] [U] 	                                                  
[  512.630437] [U] 	Video Capture: Captured 8 buffers
[  512.906497] [U] 	AR12 (16-bit ARGB 4-4-4-4) 240x320 -> RGBP (16-bit RGB 5-6-5) 240x320: OK
[  515.423391] [U] 	                                                  
[  515.863057] [U] 	Video Capture: Captured 8 buffers
[  516.100521] [U] 	AR12 (16-bit ARGB 4-4-4-4) 240x320 -> AR15 (16-bit ARGB 1-5-5-5) 240x320: OK
[  518.575789] [U] 	                                                  
[  519.013201] [U] 	Video Capture: Captured 8 buffers
[  519.256483] [U] 	AR12 (16-bit ARGB 4-4-4-4) 240x320 -> AR12 (16-bit ARGB 4-4-4-4) 240x320: OK
[  519.746238] [U] Total for stm-dma2d device /dev/video0: 121, Succeeded: 96, Failed: 25, Warnings: 0

*** BLURB HERE ***

Dillon Min (10):
media: admin-guide: add stm32-dma2d description
media: dt-bindings: media: add document for STM32 DMA2d bindings
ARM: dts: stm32: Add DMA2D support for STM32F429 series soc
ARM: dts: stm32: Enable DMA2D on STM32F469-DISCO board
media: v4l2-mem2mem: add v4l2_m2m_get_unmapped_area for no-mmu
platform
media: videobuf2: Fix the size printk format
media: v4l2-ctrls: Add V4L2_CID_COLORFX_CBCR max setting
media: v4l2-ctrls: Add RGB color effects control
clk: stm32: Fix ltdc's clock turn off by clk_disable_unused() after
system enter shell
media: stm32-dma2d: STM32 DMA2D driver

 .../admin-guide/media/platform-cardlist.rst        |   1 +
 .../devicetree/bindings/media/st,stm32-dma2d.yaml  |  71 ++
 Documentation/userspace-api/media/v4l/control.rst  |   9 +
 arch/arm/boot/dts/stm32f429.dtsi                   |  10 +
 arch/arm/boot/dts/stm32f469-disco.dts              |   4 +
 drivers/clk/clk-stm32f4.c                          |   4 -
 .../media/common/videobuf2/videobuf2-dma-contig.c  |   8 +-
 drivers/media/platform/Kconfig                     |  11 +
 drivers/media/platform/Makefile                    |   1 +
 drivers/media/platform/stm32/Makefile              |   2 +
 drivers/media/platform/stm32/dma2d/dma2d-hw.c      | 143 ++++
 drivers/media/platform/stm32/dma2d/dma2d-regs.h    | 113 ++++
 drivers/media/platform/stm32/dma2d/dma2d.c         | 739 +++++++++++++++++++++
 drivers/media/platform/stm32/dma2d/dma2d.h         | 135 ++++
 drivers/media/v4l2-core/v4l2-ctrls-defs.c          |  12 +-
 drivers/media/v4l2-core/v4l2-mem2mem.c             |  21 +
 include/media/v4l2-mem2mem.h                       |   5 +
 include/uapi/linux/v4l2-controls.h                 |   4 +-
 18 files changed, 1282 insertions(+), 11 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/st,stm32-dma2d.yaml
 create mode 100644 drivers/media/platform/stm32/dma2d/dma2d-hw.c
 create mode 100644 drivers/media/platform/stm32/dma2d/dma2d-regs.h
 create mode 100644 drivers/media/platform/stm32/dma2d/dma2d.c
 create mode 100644 drivers/media/platform/stm32/dma2d/dma2d.h
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v6 1/10 media: admin-guide: add stm32-dma2d description

add stm32-dma2d description for dma2d driver

---
v6: no change.

 Documentation/admin-guide/media/platform-cardlist.rst | 1 +
 1 file changed, 1 insertion(+)
Documentation/admin-guide/media/platform-cardlist.rst +1 -0
index 261e7772eb3e..ac73c4166d1e 100644
@@ -60,6 +60,7 @@ s5p-mfc            Samsung S5P MFC Video Codec
 sh_veu             SuperH VEU mem2mem video processing
 sh_vou             SuperH VOU video output
 stm32-dcmi         STM32 Digital Camera Memory Interface (DCMI)
+stm32-dma2d        STM32 Chrom-Art Accelerator Unit
 sun4i-csi          Allwinner A10 CMOS Sensor Interface Support
 sun6i-csi          Allwinner V3s Camera Sensor Interface
 sun8i-di           Allwinner Deinterlace
Signature · 1 line
2.7.4
author
#2 lore raw

PATCH v6 2/10 media: dt-bindings: media: add document for STM32 DMA2d bindings

In reply to Dillon Min

This adds documentation of device tree bindings for the STM32 DMA2D

---
v6: no change.

 .../devicetree/bindings/media/st,stm32-dma2d.yaml  | 71 ++++++++++++++++++++++
 1 file changed, 71 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/st,stm32-dma2d.yaml
Documentation/devicetree/bindings/media/st,stm32-dma2d.yaml new file +71 -0
new file mode 100644
index 000000000000..f97b4a246605
@@ -0,0 +1,71 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/st,stm32-dma2d.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: STMicroelectronics STM32 Chrom-Art Accelerator DMA2D binding
+
+description:
+  Chrom-ART Accelerator(DMA2D), graphical hardware accelerator
+  enabling enhanced graphical user interface with minimum CPU load
+
+  It can perform the following operations.
+
+  - Filling a part or the whole of a destination image with a specific color.
+  - Copying a part or the whole of a source image into a part or the whole of
+    a destination image.
+  - Copying a part or the whole of a source image into a part or the whole of
+    a destination image with a pixel format conversion.
+  - Blending a part and/or two complete source images with different pixel
+    format and copy the result into a part or the whole of a destination image
+    with a different color format. (TODO)
+
+
+maintainers:
+  - Dillon Min <[email protected]>
+
+properties:
+  compatible:
+    const: st,stm32-dma2d
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  clock-names:
+    items:
+      - const: dma2d
+
+  resets:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+  - resets
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/stm32fx-clock.h>
+    #include <dt-bindings/mfd/stm32f4-rcc.h>
+    dma2d: dma2d@4002b000 {
+        compatible = "st,stm32-dma2d";
+        reg = <0x4002b000 0xc00>;
+        interrupts = <90>;
+        resets = <&rcc STM32F4_AHB1_RESET(DMA2D)>;
+        clocks = <&rcc 0 STM32F4_AHB1_CLOCK(DMA2D)>;
+        clock-names = "dma2d";
+    };
+
+...
Signature · 1 line
2.7.4
author
#3 lore raw

PATCH v6 3/10 ARM: dts: stm32: Add DMA2D support for STM32F429 series soc

In reply to Dillon Min

Add DMA2D for STM32F429 series soc.

---
v6: no change.

 arch/arm/boot/dts/stm32f429.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm/boot/dts/stm32f429.dtsi +10 -0
index 8748d5850298..1d8be5e7c8b8 100644
@@ -743,6 +743,16 @@
 			st,mem2mem;
 		};
 
+		dma2d: dma2d@4002b000 {
+			compatible = "st,stm32-dma2d";
+			reg = <0x4002b000 0xc00>;
+			interrupts = <90>;
+			resets = <&rcc STM32F4_AHB1_RESET(DMA2D)>;
+			clocks = <&rcc 0 STM32F4_AHB1_CLOCK(DMA2D)>;
+			clock-names = "dma2d";
+			status = "disabled";
+		};
+
 		mac: ethernet@40028000 {
 			compatible = "st,stm32-dwmac", "snps,dwmac-3.50a";
 			reg = <0x40028000 0x8000>;
Signature · 1 line
2.7.4
author
#4 lore raw

PATCH v6 4/10 ARM: dts: stm32: Enable DMA2D on STM32F469-DISCO board

In reply to Dillon Min

Enable DMA2D on STM32F469-DISCO board.

---
v6: no change.

 arch/arm/boot/dts/stm32f469-disco.dts | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/boot/dts/stm32f469-disco.dts +4 -0
index 30905ce672a0..ba26a3375b0d 100644
@@ -132,6 +132,10 @@
 	clock-frequency = <8000000>;
 };
 
+&dma2d {
+	status = "okay";
+};
+
 &dsi {
 	#address-cells = <1>;
 	#size-cells = <0>;
Signature · 1 line
2.7.4
author
#5 lore raw

PATCH v6 5/10 media: v4l2-mem2mem: add v4l2_m2m_get_unmapped_area for no-mmu platform

In reply to Dillon Min

For platforms without MMU the m2m provides a helper method v4l2_m2m_get_unmapped_area(), The mmap() routines will call this to get a proposed address for the mapping.

More detailed information about get_unmapped_area can be found in Documentation/nommu-mmap.txt

---
v6: no change.

 drivers/media/v4l2-core/v4l2-mem2mem.c | 21 +++++++++++++++++++++
 include/media/v4l2-mem2mem.h           |  5 +++++
 2 files changed, 26 insertions(+)
drivers/media/v4l2-core/v4l2-mem2mem.c +21 -0
index e7f4bf5bc8dd..e2654b422334 100644
@@ -966,6 +966,27 @@ int v4l2_m2m_mmap(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
 }
 EXPORT_SYMBOL(v4l2_m2m_mmap);
 
+#ifndef CONFIG_MMU
+unsigned long v4l2_m2m_get_unmapped_area(struct file *file, unsigned long addr,
+					 unsigned long len, unsigned long pgoff,
+					 unsigned long flags)
+{
+	struct v4l2_fh *fh = file->private_data;
+	unsigned long offset = pgoff << PAGE_SHIFT;
+	struct vb2_queue *vq;
+
+	if (offset < DST_QUEUE_OFF_BASE) {
+		vq = v4l2_m2m_get_src_vq(fh->m2m_ctx);
+	} else {
+		vq = v4l2_m2m_get_dst_vq(fh->m2m_ctx);
+		pgoff -= (DST_QUEUE_OFF_BASE >> PAGE_SHIFT);
+	}
+
+	return vb2_get_unmapped_area(vq, addr, len, pgoff, flags);
+}
+EXPORT_SYMBOL_GPL(v4l2_m2m_get_unmapped_area);
+#endif
+
 #if defined(CONFIG_MEDIA_CONTROLLER)
 void v4l2_m2m_unregister_media_controller(struct v4l2_m2m_dev *m2m_dev)
 {
include/media/v4l2-mem2mem.h +5 -0
index 5a91b548ecc0..fdbd5257e020 100644
@@ -495,6 +495,11 @@ __poll_t v4l2_m2m_poll(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
 int v4l2_m2m_mmap(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
 		  struct vm_area_struct *vma);
 
+#ifndef CONFIG_MMU
+unsigned long v4l2_m2m_get_unmapped_area(struct file *file, unsigned long addr,
+					 unsigned long len, unsigned long pgoff,
+					 unsigned long flags);
+#endif
 /**
  * v4l2_m2m_init() - initialize per-driver m2m data
  *
Signature · 1 line
2.7.4
author
#6 lore raw

PATCH v6 6/10 media: videobuf2: Fix the size printk format

In reply to Dillon Min

Since the type of parameter size is unsigned long, it should printk by %lu, instead of %ld, fix it.

Fixes 7952be9b6ece ("media: drivers/media/common/videobuf2: rename from videobuf")

---
v6: no change.

 drivers/media/common/videobuf2/videobuf2-dma-contig.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/common/videobuf2/videobuf2-dma-contig.c +4 -4
index b052a4e36961..7cd6648ccd26 100644
@@ -257,7 +257,7 @@ static void *vb2_dc_alloc(struct vb2_buffer *vb,
 		ret = vb2_dc_alloc_coherent(buf);
 
 	if (ret) {
-		dev_err(dev, "dma alloc of size %ld failed\n", size);
+		dev_err(dev, "dma alloc of size %lu failed\n", size);
 		kfree(buf);
 		return ERR_PTR(-ENOMEM);
 	}
@@ -298,9 +298,9 @@ static int vb2_dc_mmap(void *buf_priv, struct vm_area_struct *vma)
 
 	vma->vm_ops->open(vma);
 
-	pr_debug("%s: mapped dma addr 0x%08lx at 0x%08lx, size %ld\n",
-		__func__, (unsigned long)buf->dma_addr, vma->vm_start,
-		buf->size);
+	pr_debug("%s: mapped dma addr 0x%08lx at 0x%08lx, size %lu\n",
+		 __func__, (unsigned long)buf->dma_addr, vma->vm_start,
+		 buf->size);
 
 	return 0;
 }
Signature · 1 line
2.7.4
author
#7 lore raw

PATCH v6 7/10 media: v4l2-ctrls: Add V4L2_CID_COLORFX_CBCR max setting

In reply to Dillon Min

The max of V4L2_CID_COLORFX_CBCR is 0xffff, so add it to v4l2_ctrl_fill() to sure not beyond that.

---
v6: no change.

 drivers/media/v4l2-core/v4l2-ctrls-defs.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/media/v4l2-core/v4l2-ctrls-defs.c +6 -0
index ebe82b6ba6e6..0cb6c0f18b39 100644
@@ -1400,6 +1400,12 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
 		/* Max is calculated as RGB888 that is 2^24 */
 		*max = 0xFFFFFF;
 		break;
+	case V4L2_CID_COLORFX_CBCR:
+		*type = V4L2_CTRL_TYPE_INTEGER;
+		*step = 1;
+		*min = 0;
+		*max = 0xffff;
+		break;
 	case V4L2_CID_FLASH_FAULT:
 	case V4L2_CID_JPEG_ACTIVE_MARKER:
 	case V4L2_CID_3A_LOCK:
Signature · 1 line
2.7.4
author
#8 lore raw

PATCH v6 8/10 media: v4l2-ctrls: Add RGB color effects control

In reply to Dillon Min

Add V4L2_COLORFX_SET_RGB color effects control, V4L2_CID_COLORFX_RGB for RGB color setting.

with two mirror changes:
- change 0xFFFFFF to 0xffffff
- fix comments 2^24 to 2^24 - 1

---
v6: add space in '(V4L2_CID_BASE+43)' to avoid checkpatch warrnings.

 Documentation/userspace-api/media/v4l/control.rst | 9 +++++++++
 drivers/media/v4l2-core/v4l2-ctrls-defs.c         | 6 ++++--
 include/uapi/linux/v4l2-controls.h                | 4 +++-
 3 files changed, 16 insertions(+), 3 deletions(-)
Documentation/userspace-api/media/v4l/control.rst +9 -0
index f8d0b923da20..3eec65174260 100644
@@ -242,8 +242,17 @@ Control IDs
     * - ``V4L2_COLORFX_SET_CBCR``
       - The Cb and Cr chroma components are replaced by fixed coefficients
 	determined by ``V4L2_CID_COLORFX_CBCR`` control.
+    * - ``V4L2_COLORFX_SET_RGB``
+      - The RGB components are replaced by the fixed RGB components determined
+        by ``V4L2_CID_COLORFX_RGB`` control.
 
 
+``V4L2_CID_COLORFX_RGB`` ``(integer)``
+    Determines the Red, Green, and Blue coefficients for
+    ``V4L2_COLORFX_SET_RGB`` color effect.
+    Bits [7:0] of the supplied 32 bit value are interpreted as Blue component,
+    bits [15:8] as Green component, bits [23:16] as Red component, and
+    bits [31:24] must be zero.
 
 ``V4L2_CID_COLORFX_CBCR`` ``(integer)``
     Determines the Cb and Cr coefficients for ``V4L2_COLORFX_SET_CBCR``
drivers/media/v4l2-core/v4l2-ctrls-defs.c +4 -2
index 0cb6c0f18b39..431f7ec17557 100644
@@ -785,6 +785,7 @@ const char *v4l2_ctrl_get_name(u32 id)
 	case V4L2_CID_MIN_BUFFERS_FOR_OUTPUT:	return "Min Number of Output Buffers";
 	case V4L2_CID_ALPHA_COMPONENT:		return "Alpha Component";
 	case V4L2_CID_COLORFX_CBCR:		return "Color Effects, CbCr";
+	case V4L2_CID_COLORFX_RGB:              return "Color Effects, RGB";
 
 	/*
 	 * Codec controls
@@ -1394,11 +1395,12 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
 		*min = *max = *step = *def = 0;
 		break;
 	case V4L2_CID_BG_COLOR:
+	case V4L2_CID_COLORFX_RGB:
 		*type = V4L2_CTRL_TYPE_INTEGER;
 		*step = 1;
 		*min = 0;
-		/* Max is calculated as RGB888 that is 2^24 */
-		*max = 0xFFFFFF;
+		/* Max is calculated as RGB888 that is 2^24 - 1 */
+		*max = 0xffffff;
 		break;
 	case V4L2_CID_COLORFX_CBCR:
 		*type = V4L2_CTRL_TYPE_INTEGER;
include/uapi/linux/v4l2-controls.h +3 -1
index 133e20444939..1406df0cc107 100644
@@ -128,6 +128,7 @@ enum v4l2_colorfx {
 	V4L2_COLORFX_SOLARIZATION		= 13,
 	V4L2_COLORFX_ANTIQUE			= 14,
 	V4L2_COLORFX_SET_CBCR			= 15,
+	V4L2_COLORFX_SET_RGB			= 16,
 };
 #define V4L2_CID_AUTOBRIGHTNESS			(V4L2_CID_BASE+32)
 #define V4L2_CID_BAND_STOP_FILTER		(V4L2_CID_BASE+33)
@@ -145,9 +146,10 @@ enum v4l2_colorfx {
 
 #define V4L2_CID_ALPHA_COMPONENT		(V4L2_CID_BASE+41)
 #define V4L2_CID_COLORFX_CBCR			(V4L2_CID_BASE+42)
+#define V4L2_CID_COLORFX_RGB			(V4L2_CID_BASE + 43)
 
 /* last CID + 1 */
-#define V4L2_CID_LASTP1                         (V4L2_CID_BASE+43)
+#define V4L2_CID_LASTP1                         (V4L2_CID_BASE + 44)
 
 /* USER-class private control IDs */
 
Signature · 1 line
2.7.4
author
#9 lore raw

PATCH v6 9/10 clk: stm32: Fix ltdc's clock turn off by clk_disable_unused() after system enter shell

In reply to Dillon Min

stm32's clk driver register two ltdc gate clk to clk core by clk_hw_register_gate() and clk_hw_register_composite()

first: 'stm32f429_gates[]', clk name is 'ltdc', which no user to use.
second: 'stm32f429_aux_clk[]', clk name is 'lcd-tft', used by ltdc driver

both of them point to the same offset of stm32's RCC register. after kernel enter console, clk core turn off ltdc's clk as 'stm32f429_gates[]' is no one to use. but, actually 'stm32f429_aux_clk[]' is in use.

stm32f469/746/769 have the same issue, fix it.

---
v6: no change.

 drivers/clk/clk-stm32f4.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/clk/clk-stm32f4.c +0 -4
index af46176ad053..473dfe632cc5 100644
@@ -129,7 +129,6 @@ static const struct stm32f4_gate_data stm32f429_gates[] __initconst = {
 	{ STM32F4_RCC_APB2ENR, 20,	"spi5",		"apb2_div" },
 	{ STM32F4_RCC_APB2ENR, 21,	"spi6",		"apb2_div" },
 	{ STM32F4_RCC_APB2ENR, 22,	"sai1",		"apb2_div" },
-	{ STM32F4_RCC_APB2ENR, 26,	"ltdc",		"apb2_div" },
 };
 
 static const struct stm32f4_gate_data stm32f469_gates[] __initconst = {
@@ -211,7 +210,6 @@ static const struct stm32f4_gate_data stm32f469_gates[] __initconst = {
 	{ STM32F4_RCC_APB2ENR, 20,	"spi5",		"apb2_div" },
 	{ STM32F4_RCC_APB2ENR, 21,	"spi6",		"apb2_div" },
 	{ STM32F4_RCC_APB2ENR, 22,	"sai1",		"apb2_div" },
-	{ STM32F4_RCC_APB2ENR, 26,	"ltdc",		"apb2_div" },
 };
 
 static const struct stm32f4_gate_data stm32f746_gates[] __initconst = {
@@ -286,7 +284,6 @@ static const struct stm32f4_gate_data stm32f746_gates[] __initconst = {
 	{ STM32F4_RCC_APB2ENR, 21,	"spi6",		"apb2_div" },
 	{ STM32F4_RCC_APB2ENR, 22,	"sai1",		"apb2_div" },
 	{ STM32F4_RCC_APB2ENR, 23,	"sai2",		"apb2_div" },
-	{ STM32F4_RCC_APB2ENR, 26,	"ltdc",		"apb2_div" },
 };
 
 static const struct stm32f4_gate_data stm32f769_gates[] __initconst = {
@@ -364,7 +361,6 @@ static const struct stm32f4_gate_data stm32f769_gates[] __initconst = {
 	{ STM32F4_RCC_APB2ENR, 21,	"spi6",		"apb2_div" },
 	{ STM32F4_RCC_APB2ENR, 22,	"sai1",		"apb2_div" },
 	{ STM32F4_RCC_APB2ENR, 23,	"sai2",		"apb2_div" },
-	{ STM32F4_RCC_APB2ENR, 26,	"ltdc",		"apb2_div" },
 	{ STM32F4_RCC_APB2ENR, 30,	"mdio",		"apb2_div" },
 };
 
Signature · 1 line
2.7.4
author
#10 lore raw

Re: [PATCH v6 09/10] clk: stm32: Fix ltdc's clock turn off by clk_disable_unused() after system enter shell

Hi Gabriel

I guess you are the maintainer of stm32 clk subsystem from [1], Could you help to review this patch, just give a brief of the history:

- this patch was acked by Stephen Boyd at [2].
- reviewed by Patrice Chotard at [3].

Without this patch , the kernel will turn off ltdc's clk after the system reach shell.

[1] https://lore.kernel.org/lkml/AM8PR10MB4785545DC980090C1E7D66B281009@AM8PR10MB4785.EURPRD10.PROD.OUTLOOK.COM/

[2] https://lore.kernel.org/linux-arm-kernel/159056850835.88029.9264848839121822798@swboyd.mtv.corp.google.com/

[3] https://lore.kernel.org/lkml/[email protected]/#t

Best Regards
Dillon

Quoted 63 lines · Dillon Min

stm32's clk driver register two ltdc gate clk to clk core by clk_hw_register_gate() and clk_hw_register_composite()

first: 'stm32f429_gates[]', clk name is 'ltdc', which no user to use.
second: 'stm32f429_aux_clk[]', clk name is 'lcd-tft', used by ltdc driver

both of them point to the same offset of stm32's RCC register. after kernel enter console, clk core turn off ltdc's clk as 'stm32f429_gates[]' is no one to use. but, actually 'stm32f429_aux_clk[]' is in use.

stm32f469/746/769 have the same issue, fix it.

---
v6: no change.

 drivers/clk/clk-stm32f4.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/clk/clk-stm32f4.c +0 -5
index af46176ad053..473dfe632cc5 100644
@@ -129,7 +129,6 @@ static const struct stm32f4_gate_data stm32f429_gates[] __initconst = {
        { STM32F4_RCC_APB2ENR, 20,      "spi5",         "apb2_div" },
        { STM32F4_RCC_APB2ENR, 21,      "spi6",         "apb2_div" },
        { STM32F4_RCC_APB2ENR, 22,      "sai1",         "apb2_div" },
-       { STM32F4_RCC_APB2ENR, 26,      "ltdc",         "apb2_div" },
 };
 
 static const struct stm32f4_gate_data stm32f469_gates[] __initconst = {
@@ -211,7 +210,6 @@ static const struct stm32f4_gate_data stm32f469_gates[] __initconst = {
        { STM32F4_RCC_APB2ENR, 20,      "spi5",         "apb2_div" },
        { STM32F4_RCC_APB2ENR, 21,      "spi6",         "apb2_div" },
        { STM32F4_RCC_APB2ENR, 22,      "sai1",         "apb2_div" },
-       { STM32F4_RCC_APB2ENR, 26,      "ltdc",         "apb2_div" },
 };
 
 static const struct stm32f4_gate_data stm32f746_gates[] __initconst = {
@@ -286,7 +284,6 @@ static const struct stm32f4_gate_data stm32f746_gates[] __initconst = {
        { STM32F4_RCC_APB2ENR, 21,      "spi6",         "apb2_div" },
        { STM32F4_RCC_APB2ENR, 22,      "sai1",         "apb2_div" },
        { STM32F4_RCC_APB2ENR, 23,      "sai2",         "apb2_div" },
-       { STM32F4_RCC_APB2ENR, 26,      "ltdc",         "apb2_div" },
 };
 
 static const struct stm32f4_gate_data stm32f769_gates[] __initconst = {
@@ -364,7 +361,6 @@ static const struct stm32f4_gate_data stm32f769_gates[] __initconst = {
        { STM32F4_RCC_APB2ENR, 21,      "spi6",         "apb2_div" },
        { STM32F4_RCC_APB2ENR, 22,      "sai1",         "apb2_div" },
        { STM32F4_RCC_APB2ENR, 23,      "sai2",         "apb2_div" },
-       { STM32F4_RCC_APB2ENR, 26,      "ltdc",         "apb2_div" },
        { STM32F4_RCC_APB2ENR, 30,      "mdio",         "apb2_div" },
 };
 
--

2.7.4

#11 lore raw

Re: [PATCH v6 09/10] clk: stm32: Fix ltdc's clock turn off by clk_disable_unused() after system enter shell

Hi Dillon,

You can add my Acked-by: Gabriel Fernandez <[email protected]>

Best Regards
Gabriel

Quoted 84 lines · Dillon Min

Hi Gabriel

I guess you are the maintainer of stm32 clk subsystem from [1], Could you help to review this patch, just give a brief of the history:

- this patch was acked by Stephen Boyd at [2].
- reviewed by Patrice Chotard at [3].

Without this patch , the kernel will turn off ltdc's clk after the system reach shell.

[1] https://lore.kernel.org/lkml/AM8PR10MB4785545DC980090C1E7D66B281009@AM8PR10MB4785.EURPRD10.PROD.OUTLOOK.COM/

[2] https://lore.kernel.org/linux-arm-kernel/159056850835.88029.9264848839121822798@swboyd.mtv.corp.google.com/

[3] https://lore.kernel.org/lkml/[email protected]/#t

Best Regards
Dillon

Quoted 63 lines · Dillon Min

stm32's clk driver register two ltdc gate clk to clk core by clk_hw_register_gate() and clk_hw_register_composite()

first: 'stm32f429_gates[]', clk name is 'ltdc', which no user to use.
second: 'stm32f429_aux_clk[]', clk name is 'lcd-tft', used by ltdc driver

both of them point to the same offset of stm32's RCC register. after kernel enter console, clk core turn off ltdc's clk as 'stm32f429_gates[]' is no one to use. but, actually 'stm32f429_aux_clk[]' is in use.

stm32f469/746/769 have the same issue, fix it.

---
v6: no change.

  drivers/clk/clk-stm32f4.c | 4 ----
  1 file changed, 4 deletions(-)
drivers/clk/clk-stm32f4.c +0 -5
index af46176ad053..473dfe632cc5 100644
@@ -129,7 +129,6 @@ static const struct stm32f4_gate_data stm32f429_gates[] __initconst = {
         { STM32F4_RCC_APB2ENR, 20,      "spi5",         "apb2_div" },
         { STM32F4_RCC_APB2ENR, 21,      "spi6",         "apb2_div" },
         { STM32F4_RCC_APB2ENR, 22,      "sai1",         "apb2_div" },
-       { STM32F4_RCC_APB2ENR, 26,      "ltdc",         "apb2_div" },
  };
 
  static const struct stm32f4_gate_data stm32f469_gates[] __initconst = {
@@ -211,7 +210,6 @@ static const struct stm32f4_gate_data stm32f469_gates[] __initconst = {
         { STM32F4_RCC_APB2ENR, 20,      "spi5",         "apb2_div" },
         { STM32F4_RCC_APB2ENR, 21,      "spi6",         "apb2_div" },
         { STM32F4_RCC_APB2ENR, 22,      "sai1",         "apb2_div" },
-       { STM32F4_RCC_APB2ENR, 26,      "ltdc",         "apb2_div" },
  };
 
  static const struct stm32f4_gate_data stm32f746_gates[] __initconst = {
@@ -286,7 +284,6 @@ static const struct stm32f4_gate_data stm32f746_gates[] __initconst = {
         { STM32F4_RCC_APB2ENR, 21,      "spi6",         "apb2_div" },
         { STM32F4_RCC_APB2ENR, 22,      "sai1",         "apb2_div" },
         { STM32F4_RCC_APB2ENR, 23,      "sai2",         "apb2_div" },
-       { STM32F4_RCC_APB2ENR, 26,      "ltdc",         "apb2_div" },
  };
 
  static const struct stm32f4_gate_data stm32f769_gates[] __initconst = {
@@ -364,7 +361,6 @@ static const struct stm32f4_gate_data stm32f769_gates[] __initconst = {
         { STM32F4_RCC_APB2ENR, 21,      "spi6",         "apb2_div" },
         { STM32F4_RCC_APB2ENR, 22,      "sai1",         "apb2_div" },
         { STM32F4_RCC_APB2ENR, 23,      "sai2",         "apb2_div" },
-       { STM32F4_RCC_APB2ENR, 26,      "ltdc",         "apb2_div" },
         { STM32F4_RCC_APB2ENR, 30,      "mdio",         "apb2_div" },
  };
 
--

2.7.4

author
#12 lore raw

Re: [PATCH v6 09/10] clk: stm32: Fix ltdc's clock turn off by clk_disable_unused() after system enter shell

Hi Gabriel

Thanks for the quick response.

Best Regards
Dillon

Quoted 93 lines · On Fri, 22 Oct 2021 at 17:10, [email protected]…

Hi Dillon,

You can add my Acked-by: Gabriel Fernandez <[email protected]>

Best Regards
Gabriel

Quoted 84 lines · Dillon Min

Hi Gabriel

I guess you are the maintainer of stm32 clk subsystem from [1], Could you help to review this patch, just give a brief of the history:

- this patch was acked by Stephen Boyd at [2].
- reviewed by Patrice Chotard at [3].

Without this patch , the kernel will turn off ltdc's clk after the system reach shell.

[1] https://lore.kernel.org/lkml/AM8PR10MB4785545DC980090C1E7D66B281009@AM8PR10MB4785.EURPRD10.PROD.OUTLOOK.COM/

[2] https://lore.kernel.org/linux-arm-kernel/159056850835.88029.9264848839121822798@swboyd.mtv.corp.google.com/

[3] https://lore.kernel.org/lkml/[email protected]/#t

Best Regards
Dillon

Quoted 63 lines · Dillon Min

stm32's clk driver register two ltdc gate clk to clk core by clk_hw_register_gate() and clk_hw_register_composite()

first: 'stm32f429_gates[]', clk name is 'ltdc', which no user to use.
second: 'stm32f429_aux_clk[]', clk name is 'lcd-tft', used by ltdc driver

both of them point to the same offset of stm32's RCC register. after kernel enter console, clk core turn off ltdc's clk as 'stm32f429_gates[]' is no one to use. but, actually 'stm32f429_aux_clk[]' is in use.

stm32f469/746/769 have the same issue, fix it.

---
v6: no change.

  drivers/clk/clk-stm32f4.c | 4 ----
  1 file changed, 4 deletions(-)
drivers/clk/clk-stm32f4.c +0 -5
index af46176ad053..473dfe632cc5 100644
@@ -129,7 +129,6 @@ static const struct stm32f4_gate_data stm32f429_gates[] __initconst = {
         { STM32F4_RCC_APB2ENR, 20,      "spi5",         "apb2_div" },
         { STM32F4_RCC_APB2ENR, 21,      "spi6",         "apb2_div" },
         { STM32F4_RCC_APB2ENR, 22,      "sai1",         "apb2_div" },
-       { STM32F4_RCC_APB2ENR, 26,      "ltdc",         "apb2_div" },
  };
 
  static const struct stm32f4_gate_data stm32f469_gates[] __initconst = {
@@ -211,7 +210,6 @@ static const struct stm32f4_gate_data stm32f469_gates[] __initconst = {
         { STM32F4_RCC_APB2ENR, 20,      "spi5",         "apb2_div" },
         { STM32F4_RCC_APB2ENR, 21,      "spi6",         "apb2_div" },
         { STM32F4_RCC_APB2ENR, 22,      "sai1",         "apb2_div" },
-       { STM32F4_RCC_APB2ENR, 26,      "ltdc",         "apb2_div" },
  };
 
  static const struct stm32f4_gate_data stm32f746_gates[] __initconst = {
@@ -286,7 +284,6 @@ static const struct stm32f4_gate_data stm32f746_gates[] __initconst = {
         { STM32F4_RCC_APB2ENR, 21,      "spi6",         "apb2_div" },
         { STM32F4_RCC_APB2ENR, 22,      "sai1",         "apb2_div" },
         { STM32F4_RCC_APB2ENR, 23,      "sai2",         "apb2_div" },
-       { STM32F4_RCC_APB2ENR, 26,      "ltdc",         "apb2_div" },
  };
 
  static const struct stm32f4_gate_data stm32f769_gates[] __initconst = {
@@ -364,7 +361,6 @@ static const struct stm32f4_gate_data stm32f769_gates[] __initconst = {
         { STM32F4_RCC_APB2ENR, 21,      "spi6",         "apb2_div" },
         { STM32F4_RCC_APB2ENR, 22,      "sai1",         "apb2_div" },
         { STM32F4_RCC_APB2ENR, 23,      "sai2",         "apb2_div" },
-       { STM32F4_RCC_APB2ENR, 26,      "ltdc",         "apb2_div" },
         { STM32F4_RCC_APB2ENR, 30,      "mdio",         "apb2_div" },
  };
 
--

2.7.4

author
#13 lore raw

PATCH v6 10/10 media: stm32-dma2d: STM32 DMA2D driver

In reply to Dillon Min

This V4L2 subdev m2m driver enables Chrom-Art Accelerator unit of STMicroelectronics STM32 SoC series.

Currently support r2m, m2m, m2m_pfc functions.
- r2m, Filling a part or the whole of a destination image with a specific color.
- m2m, Copying a part or the whole of a source image into a part or the whole of a destination.
- m2m_pfc, Copying a part or the whole of a source image into a part or the whole of a destination image with a pixel format conversion.

---
v6: use 2592x2592 instead of 0x3fff, 0xffff.

 drivers/media/platform/Kconfig                  |  11 +
 drivers/media/platform/Makefile                 |   1 +
 drivers/media/platform/stm32/Makefile           |   2 +
 drivers/media/platform/stm32/dma2d/dma2d-hw.c   | 143 +++++
 drivers/media/platform/stm32/dma2d/dma2d-regs.h | 113 ++++
 drivers/media/platform/stm32/dma2d/dma2d.c      | 739 ++++++++++++++++++++++++
 drivers/media/platform/stm32/dma2d/dma2d.h      | 135 +++++
 7 files changed, 1144 insertions(+)
 create mode 100644 drivers/media/platform/stm32/dma2d/dma2d-hw.c
 create mode 100644 drivers/media/platform/stm32/dma2d/dma2d-regs.h
 create mode 100644 drivers/media/platform/stm32/dma2d/dma2d.c
 create mode 100644 drivers/media/platform/stm32/dma2d/dma2d.h
drivers/media/platform/Kconfig +11 -0
index d9f90084c2f6..0b3bdf56b44e 100644
@@ -476,6 +476,17 @@ config VIDEO_STI_DELTA_DRIVER
 
 endif # VIDEO_STI_DELTA
 
+config VIDEO_STM32_DMA2D
+	tristate "STM32 Chrom-Art Accelerator (DMA2D)"
+	depends on (VIDEO_DEV && VIDEO_V4L2 && ARCH_STM32) || COMPILE_TEST
+	select VIDEOBUF2_DMA_CONTIG
+	select V4L2_MEM2MEM_DEV
+	help
+	  Enables DMA2D hwarware support on stm32.
+
+	  The STM32 DMA2D is a memory-to-memory engine for pixel conversion
+	  and specialized DMA dedicated to image manipulation.
+
 config VIDEO_RENESAS_FDP1
 	tristate "Renesas Fine Display Processor"
 	depends on VIDEO_DEV && VIDEO_V4L2
drivers/media/platform/Makefile +1 -0
index 73ce083c2fc6..46f1c05bc576 100644
@@ -70,6 +70,7 @@ obj-$(CONFIG_VIDEO_ATMEL_ISI)		+= atmel/
 obj-$(CONFIG_VIDEO_ATMEL_XISC)		+= atmel/
 
 obj-$(CONFIG_VIDEO_STM32_DCMI)		+= stm32/
+obj-$(CONFIG_VIDEO_STM32_DMA2D)		+= stm32/
 
 obj-$(CONFIG_VIDEO_MEDIATEK_VPU)	+= mtk-vpu/
 
drivers/media/platform/stm32/Makefile +2 -0
index 48b36db2c2e2..896ef98a73ab 100644
@@ -1,2 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_VIDEO_STM32_DCMI) += stm32-dcmi.o
+stm32-dma2d-objs := dma2d/dma2d.o dma2d/dma2d-hw.o
+obj-$(CONFIG_VIDEO_STM32_DMA2D) += stm32-dma2d.o
drivers/media/platform/stm32/dma2d/dma2d-hw.c new file +143 -0

143 lines not on this page · raw message

drivers/media/platform/stm32/dma2d/dma2d-regs.h new file +113 -0

113 lines not on this page · raw message

drivers/media/platform/stm32/dma2d/dma2d.c new file +739 -0

739 lines not on this page · raw message

drivers/media/platform/stm32/dma2d/dma2d.h new file +135 -0

135 lines not on this page · raw message

Signature · 1 line
2.7.4