This patchset add support for mt2701 JPEG ENC support.
This is the compliance test result for jpeg dec and enc.
The JPEG dec log:
------------------------------------------------------------
v4l2-compliance -d /dev/video0
v4l2-compliance SHA: c7f03287bbd64c168975e7ff3192e6fd3b507686, 32 bits, 32-bit time_t
Compliance test for mtk-jpeg-dec device /dev/video0:
Driver Info:
Driver name : mtk-jpeg-dec
Card type : mtk-jpeg-dec
Bus info : platform:15004000.jpegdec
Driver version : 5.8.0
Capabilities : 0x84204000
Video Memory-to-Memory Multiplanar
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04204000
Video Memory-to-Memory Multiplanar
Streaming
Extended Pix Format
Detected JPEG Decoder
Required ioctls:
test VIDIOC_QUERYCAP: OK
Allow for multiple opens:
test second /dev/video0 open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK
test invalid ioctls: OK
Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
test VIDIOC_LOG_STATUS: OK (Not Supported)
Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported)
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0
Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_ENUMAUDOUT: OK (Not Supported)
test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0
Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
test VIDIOC_G/S_EDID: OK (Not Supported)
Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported)
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 0 Private Controls: 0
Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
test VIDIOC_G/S_PARM: OK (Not Supported)
test VIDIOC_G_FBUF: OK (Not Supported)
test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
test VIDIOC_S_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK
test Scaling: OK (Not Supported)
Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
test VIDIOC_G_ENC_INDEX: OK (Not Supported)
test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
test VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported)
Total for mtk-jpeg-dec device /dev/video0: 45, Succeeded: 45, Failed: 0, Warnings: 0
------------------------------------------------------------
The JPEG enc log:
------------------------------------------------------------
v4l2-compliance -d /dev/video1
v4l2-compliance SHA: c7f03287bbd64c168975e7ff3192e6fd3b507686, 32 bits, 32-bit time_t
Compliance test for mtk-jpeg-enc device /dev/video1:
Driver Info:
Driver name : mtk-jpeg-enc
Card type : mtk-jpeg-enc
Bus info : platform:1500a000.jpegenc
Driver version : 5.8.0
Capabilities : 0x84204000
Video Memory-to-Memory Multiplanar
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04204000
Video Memory-to-Memory Multiplanar
Streaming
Extended Pix Format
Detected JPEG Encoder
Required ioctls:
test VIDIOC_QUERYCAP: OK
Allow for multiple opens:
test second /dev/video1 open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK
test invalid ioctls: OK
Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
test VIDIOC_LOG_STATUS: OK (Not Supported)
Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported)
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0
Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_ENUMAUDOUT: OK (Not Supported)
test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0
Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
test VIDIOC_G/S_EDID: OK (Not Supported)
Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 4 Private Controls: 0
Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
test VIDIOC_G/S_PARM: OK (Not Supported)
test VIDIOC_G_FBUF: OK (Not Supported)
test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
test VIDIOC_S_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)
Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
test VIDIOC_G_ENC_INDEX: OK (Not Supported)
test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
test VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported)
Total for mtk-jpeg-enc device /dev/video1: 45, Succeeded: 45, Failed: 0, Warnings: 0
------------------------------------------------------------
Change compared to v10:
-specify the names of the clocks in the driver of patch 22/28
Xia Jiang (28):
media: platform: Improve subscribe event flow for bug fixing
media: platform: Improve queue set up flow for bug fixing
media: platform: Improve getting and requesting irq flow for bug
fixing
media: platform: Change the fixed device node number to unfixed value
media: platform: Improve power on and power off flow
media: platform: Delete the resetting hardware flow in the system PM
ops
media: platform: Improve the implementation of the system PM ops
media: platform: Add mechanism to handle jpeg hardware's locking up
media: platform: Cancel the last frame handling flow
media: platform: Delete zeroing the reserved fields
media: platform: Stylistic changes for improving code quality
media: platform: Use generic rounding helpers
media: platform: Change MTK_JPEG_COMP_MAX macro definition location
media: platform: Delete redundant code and add annotation for an enum
media: platform: Delete vidioc_s_selection ioctl of jpeg dec
media: platform: Change the maximum width and height supported by JPEG
dec
media: platform: Refactor mtk_jpeg_try_fmt_mplane()
media: platform: Refactor mtk_jpeg_find_format()
media: platform: Redefinition of mtk_jpeg_q_data structure
media: platform: Change the colorspace of jpeg to the fixed value
media: platform: Refactor mtk_jpeg_set_default_params()
media: platform: Change the call functions of getting/enable/disable
the jpeg's clock
media: dt-bindings: Add jpeg enc device tree node document
arm: dts: mt2701: Add jpeg enc device tree node
media: platform: Rename jpeg dec file name
media: platform: Rename existing functions/defines/variables
media: platform: Using the variant structure to contain the varability
between dec and enc
media: platform: Add jpeg enc feature
.../bindings/media/mediatek-jpeg-encoder.txt | 35 +
arch/arm/boot/dts/mt2701.dtsi | 13 +
drivers/media/platform/mtk-jpeg/Makefile | 5 +-
.../media/platform/mtk-jpeg/mtk_jpeg_core.c | 931 ++++++++++++------
.../media/platform/mtk-jpeg/mtk_jpeg_core.h | 108 +-
.../{mtk_jpeg_hw.c => mtk_jpeg_dec_hw.c} | 10 +-
.../{mtk_jpeg_hw.h => mtk_jpeg_dec_hw.h} | 12 +-
...{mtk_jpeg_parse.c => mtk_jpeg_dec_parse.c} | 2 +-
...{mtk_jpeg_parse.h => mtk_jpeg_dec_parse.h} | 2 +-
.../{mtk_jpeg_reg.h => mtk_jpeg_dec_reg.h} | 19 +-
.../media/platform/mtk-jpeg/mtk_jpeg_enc_hw.c | 154 +++
.../media/platform/mtk-jpeg/mtk_jpeg_enc_hw.h | 91 ++
12 files changed, 999 insertions(+), 383 deletions(-)
create mode 100644 Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.txt
rename drivers/media/platform/mtk-jpeg/{mtk_jpeg_hw.c => mtk_jpeg_dec_hw.c} (98%)
rename drivers/media/platform/mtk-jpeg/{mtk_jpeg_hw.h => mtk_jpeg_dec_hw.h} (91%)
rename drivers/media/platform/mtk-jpeg/{mtk_jpeg_parse.c => mtk_jpeg_dec_parse.c} (98%)
rename drivers/media/platform/mtk-jpeg/{mtk_jpeg_parse.h => mtk_jpeg_dec_parse.h} (92%)
rename drivers/media/platform/mtk-jpeg/{mtk_jpeg_reg.h => mtk_jpeg_dec_reg.h} (77%)
create mode 100644 drivers/media/platform/mtk-jpeg/mtk_jpeg_enc_hw.c
create mode 100644 drivers/media/platform/mtk-jpeg/mtk_jpeg_enc_hw.h
--
2.18.0
Delete the resetting hardware flow in suspend and resume function
because that resetting operation will be done in device_run().
Reviewed-by: Tomasz Figa <[email protected]>
Signed-off-by: Xia Jiang <[email protected]>
---
v11: no changes
---
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
index fb624385969e..7f74597262fc 100644
--- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
+++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
@@ -1191,7 +1191,6 @@ static __maybe_unused int mtk_jpeg_pm_suspend(struct device *dev)
{
struct mtk_jpeg_dev *jpeg = dev_get_drvdata(dev);
- mtk_jpeg_dec_reset(jpeg->dec_reg_base);
mtk_jpeg_clk_off(jpeg);
return 0;
@@ -1202,7 +1201,6 @@ static __maybe_unused int mtk_jpeg_pm_resume(struct device *dev)
struct mtk_jpeg_dev *jpeg = dev_get_drvdata(dev);
mtk_jpeg_clk_on(jpeg);
- mtk_jpeg_dec_reset(jpeg->dec_reg_base);
return 0;
}
--
2.18.0
On 04/08/2020 05:40, Xia Jiang wrote:
> This patchset add support for mt2701 JPEG ENC support.
I'm getting these compile warnings/errors:
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c: In function ‘mtk_jpeg_enc_device_run’:
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c:917:27: warning: variable ‘jpeg_src_buf’ set but not used [-Wunused-but-set-variable]
917 | struct mtk_jpeg_src_buf *jpeg_src_buf;
| ^~~~~~~~~~~~
It's indeed not used.
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c: In function ‘mtk_jpeg_suspend’:
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c:1482:2: error: implicit declaration of function ‘v4l2_m2m_suspend’; did you mean ‘v4l2_m2m_mmap’? [-Werror=implicit-function-declaration]
1482 | v4l2_m2m_suspend(jpeg->m2m_dev);
| ^~~~~~~~~~~~~~~~
| v4l2_m2m_mmap
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c: In function ‘mtk_jpeg_resume’:
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c:1495:2: error: implicit declaration of function ‘v4l2_m2m_resume’; did you mean ‘v4l2_m2m_release’? [-Werror=implicit-function-declaration]
1495 | v4l2_m2m_resume(jpeg->m2m_dev);
| ^~~~~~~~~~~~~~~
| v4l2_m2m_release
This apparently relies on https://lore.kernel.org/linux-arm-kernel/[email protected]/
Please add this patch to this series. Don't forget to add Tomasz' 'Reviewed-by' line.
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c: In function ‘mtk_jpeg_enc_g_selection’:
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c:525:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
525 | s->r = ctx->out_q.enc_crop_rect;
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c:526:2: note: here
526 | case V4L2_SEL_TGT_CROP_BOUNDS:
| ^~~~
This is definitely wrong. A break is missing here.
Regards,
Hans