Add Mediatek JPEG Decoder
Subsystems (3)
v2 cover Add Mediatek JPEG Decoder
This series of patches provide a v4l2 driver to control Mediatek JPEG hw for decoding JPEG image and Motion JPEG bitstream.
changes since v1:
- Rebase for v4.9-rc1.
- Update Compliance test version and result
- Remove redundant path in Makefile
- Fix potential build error without CONFIG_PM_RUNTIME and CONFIG_PM_SLEEP
- Fix warnings from patch check and smatch check
* Dependency
The patch "arm: dts: mt2701: Add node for JPEG decoder" depends on:
CCF "Add clock support for Mediatek MT2701"[1]
iommu and smi "Add the dtsi node of iommu and smi for mt2701"[2]
[1] http://lists.infradead.org/pipermail/linux-mediatek/2016-October/007271.html
[2] https://patchwork.kernel.org/patch/9164013/
* Compliance test
v4l2-compliance SHA : 4ad7174b908a36c4f315e3fe2efa7e2f8a6f375a
Driver Info:
Driver name : mtk-jpeg decode
Card type : mtk-jpeg decoder
Bus info : platform:15004000.jpegdec Driver version: 4.9.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
Compliance test for device /dev/video3 (not using libv4l2):
Required ioctls:
test VIDIOC_QUERYCAP: OK
Allow for multiple opens:
test second video open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: 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 (Not Supported) test VIDIOC_QUERYCTRL: OK (Not Supported)
test VIDIOC_G/S_CTRL: OK (Not Supported)
test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported) 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
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 input 0:
Total: 43, Succeeded: 43, Failed: 0, Warnings: 0
Rick Chang (3):
dt-bindings: mediatek: Add a binding for Mediatek JPEG Decoder
vcodec: mediatek: Add Mediatek JPEG Decoder Driver
arm: dts: mt2701: Add node for Mediatek JPEG Decoder
.../bindings/media/mediatek-jpeg-codec.txt | 35 + arch/arm/boot/dts/mt2701.dtsi | 14 + drivers/media/platform/Kconfig | 15 + drivers/media/platform/Makefile | 2 + drivers/media/platform/mtk-jpeg/Makefile | 2 + drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 1271 ++++++++++++++++++++ drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h | 141 +++ drivers/media/platform/mtk-jpeg/mtk_jpeg_hw.c | 417 +++++++ drivers/media/platform/mtk-jpeg/mtk_jpeg_hw.h | 91 ++ drivers/media/platform/mtk-jpeg/mtk_jpeg_parse.c | 160 +++ drivers/media/platform/mtk-jpeg/mtk_jpeg_parse.h | 25 + drivers/media/platform/mtk-jpeg/mtk_jpeg_reg.h | 58 + 12 files changed, 2231 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt create mode 100644 drivers/media/platform/mtk-jpeg/Makefile create mode 100644 drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c create mode 100644 drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h create mode 100644 drivers/media/platform/mtk-jpeg/mtk_jpeg_hw.c create mode 100644 drivers/media/platform/mtk-jpeg/mtk_jpeg_hw.h create mode 100644 drivers/media/platform/mtk-jpeg/mtk_jpeg_parse.c create mode 100644 drivers/media/platform/mtk-jpeg/mtk_jpeg_parse.h create mode 100644 drivers/media/platform/mtk-jpeg/mtk_jpeg_reg.h
Signature · 1 line
1.9.1
PATCH v2 1/3 dt-bindings: mediatek: Add a binding for Mediatek JPEG Decoder
Add a DT binding documentation for Mediatek JPEG Decoder of MT2701 SoC.
--- .../bindings/media/mediatek-jpeg-codec.txt | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +35 -0
@@ -0,0 +1,35 @@ +* Mediatek JPEG Codec + +Mediatek JPEG Codec device driver is a v4l2 driver which can decode +JPEG-encoded video frames. + +Required properties: + - compatible : "mediatek,mt2701-jpgdec" + - reg : Physical base address of the jpeg codec registers and length of + memory mapped region. + - interrupts : interrupt number to the cpu. + - clocks : clock name from clock manager + - clock-names: the clocks of the jpeg codec H/W + - power-domains : a phandle to the power domain. + - larb : must contain the larbes of current platform + - iommus : Mediatek IOMMU H/W has designed the fixed associations with + the multimedia H/W. and there is only one multimedia iommu domain. + "iommus = <&iommu portid>" the "portid" is from + dt-bindings\iommu\mt2701-iommu-port.h, it means that this portid will + enable iommu. The portid default is disable iommu if "<&iommu portid>" + don't be added. + +Example: + jpegdec: jpegdec@15004000 { + compatible = "mediatek,mt2701-jpgdec"; + reg = <0 0x15004000 0 0x1000>; + interrupts = <GIC_SPI 143 IRQ_TYPE_LEVEL_LOW>; + clocks = <&imgsys CLK_IMG_JPGDEC_SMI>, + <&imgsys CLK_IMG_JPGDEC>; + clock-names = "jpgdec-smi", + "jpgdec"; + power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>; + mediatek,larb = <&larb2>; + iommus = <&iommu MT2701_M4U_PORT_JPGDEC_WDMA>, + <&iommu MT2701_M4U_PORT_JPGDEC_BSDMA>; + };
Signature · 1 line
1.9.1
Re: [PATCH v2 1/3] dt-bindings: mediatek: Add a binding for Mediatek JPEG Decoder
Hi Rick,
Thank you for the patch.
Quoted 18 lines · On Monday 31 Oct 2016 15:16:55 Rick Chang wrote:
Add a DT binding documentation for Mediatek JPEG Decoder of MT2701 SoC.
Signed-off-by Rick Chang <[email protected]>Signed-off-by Minghsiu Tsai <[email protected]>--- .../bindings/media/mediatek-jpeg-codec.txt | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt(quoted diff) +0
-0
b/Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txtnew file mode 100644
index 0000000..514e656
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt line 1
Quoted 1 line
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +1
-0@@ -0,0 +1,35 @@ +* Mediatek JPEG Codec
Is it a codec or a decoder only ?
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt line 4
Quoted 2 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +2
-0+Mediatek JPEG Codec device driver is a v4l2 driver which can decode +JPEG-encoded video frames.
DT bindings should not reference drivers, they are OS-agnostic.
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt line 10
Quoted 5 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +5
-0+Required properties: + - compatible : "mediatek,mt2701-jpgdec" + - reg : Physical base address of the jpeg codec registers and length of + memory mapped region. + - interrupts : interrupt number to the cpu.
That's actually not correct, the interrupt number is local to the interrupt controller, not to the CPU.
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt line 11
Quoted 1 line
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +1
-0+ - clocks : clock name from clock manager
The clocks property doesn't contain a name.
Until we provide standardized descriptions for those properties, I recommend copying the compatible, reg, interrupts, clocks, clock-names, power-domains and iommus properties descriptions from good DT bindings. Which DT bindings are good source of inspiration here is left as an exercise for the reader I'm afraid :-(
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt line 14
Quoted 3 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +3
-0+ - clock-names: the clocks of the jpeg codec H/W + - power-domains : a phandle to the power domain. + - larb : must contain the larbes of current platform
Shouldn't this be mediatek,larb ? And what is a larb ?
Quoted 6 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +4
-0+ - iommus : Mediatek IOMMU H/W has designed the fixed associations with + the multimedia H/W. and there is only one multimedia iommu domain. + "iommus = <&iommu portid>" the "portid" is from + dt-bindings\iommu\mt2701-iommu-port.h, it means that this portidwill
+ enable iommu. The portid default is disable iommu if "<&iommu>
portid>"
Quoted 1 line
+ don't be added.
There are two iommus instances in your example below, this should be documented. This description is not very clear I'm afraid.
Quoted 15 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +15
-0+ +Example: + jpegdec: jpegdec@15004000 { + compatible = "mediatek,mt2701-jpgdec"; + reg = <0 0x15004000 0 0x1000>; + interrupts = <GIC_SPI 143 IRQ_TYPE_LEVEL_LOW>; + clocks = <&imgsys CLK_IMG_JPGDEC_SMI>, + <&imgsys CLK_IMG_JPGDEC>; + clock-names = "jpgdec-smi", + "jpgdec"; + power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>; + mediatek,larb = <&larb2>; + iommus = <&iommu MT2701_M4U_PORT_JPGDEC_WDMA>, + <&iommu MT2701_M4U_PORT_JPGDEC_BSDMA>; + };
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v2 1/3] dt-bindings: mediatek: Add a binding for Mediatek JPEG Decoder
Hi Rick,
A few more comments.
Quoted 25 lines · On Thursday 03 Nov 2016 20:33:12 Laurent Pinchart wrote:
Quoted 20 lines · On Monday 31 Oct 2016 15:16:55 Rick Chang wrote:
Add a DT binding documentation for Mediatek JPEG Decoder of MT2701 SoC.
Signed-off-by Rick Chang <[email protected]>Signed-off-by Minghsiu Tsai <[email protected]>---
.../bindings/media/mediatek-jpeg-codec.txt | 35 ++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txtdiff --git
a/Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txtb/Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txtnew file mode 100644
index 0000000..514e656Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt line 1
Quoted 1 line
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +1
-0@@ -0,0 +1,35 @@ +* Mediatek JPEG CodecIs it a codec or a decoder only ?
Quoted 7 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt line 4
Quoted 2 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +2
-0+Mediatek JPEG Codec device driver is a v4l2 driver which can decode +JPEG-encoded video frames.DT bindings should not reference drivers, they are OS-agnostic.
Quoted 2 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +2
-0+Required properties: + - compatible : "mediatek,mt2701-jpgdec"
Is the JPEG decoder found in MT2701 only, or in other Mediatek SoCs as well ?
Quoted 10 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt line 10
Quoted 3 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +3
-0+ - reg : Physical base address of the jpeg codec registers and length of + memory mapped region. + - interrupts : interrupt number to the cpu.That's actually not correct, the interrupt number is local to the interrupt controller, not to the CPU.
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt line 11
Quoted 1 line
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +1
-0+ - clocks : clock name from clock managerThe clocks property doesn't contain a name.
Furthermore you should document which clocks need to be specified here. There are two of them in the example below, the documentation should explain this clearly.
Quoted 42 lines
Until we provide standardized descriptions for those properties, I recommend copying the compatible, reg, interrupts, clocks, clock-names, power-domains and iommus properties descriptions from good DT bindings. Which DT bindings are good source of inspiration here is left as an exercise for the reader I'm afraid :-(
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt line 14
Quoted 3 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +3
-0+ - clock-names: the clocks of the jpeg codec H/W + - power-domains : a phandle to the power domain. + - larb : must contain the larbes of current platformShouldn't this be mediatek,larb ? And what is a larb ?
Quoted 7 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +2
-0+ - iommus : Mediatek IOMMU H/W has designed the fixed associations with + the multimedia H/W. and there is only one multimedia iommudomain.
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +2
-0+ "iommus = <&iommu portid>" the "portid" is from + dt-bindings\iommu\mt2701-iommu-port.h, it means that this portidwill
+ enable iommu. The portid default is disable iommu if "<&iommu>portid>"
Quoted 1 line
+ don't be added.
There are two iommus instances in your example below, this should be documented. This description is not very clear I'm afraid.
Quoted 15 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +15
-0+ +Example: + jpegdec: jpegdec@15004000 { + compatible = "mediatek,mt2701-jpgdec"; + reg = <0 0x15004000 0 0x1000>; + interrupts = <GIC_SPI 143 IRQ_TYPE_LEVEL_LOW>; + clocks = <&imgsys CLK_IMG_JPGDEC_SMI>, + <&imgsys CLK_IMG_JPGDEC>; + clock-names = "jpgdec-smi", + "jpgdec"; + power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>; + mediatek,larb = <&larb2>; + iommus = <&iommu MT2701_M4U_PORT_JPGDEC_WDMA>, + <&iommu MT2701_M4U_PORT_JPGDEC_BSDMA>; + };
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v2 1/3] dt-bindings: mediatek: Add a binding for Mediatek JPEG Decoder
Hi Laurent,
Thank you for the comments.I will fix them in the next patch (v3).
Quoted 35 lines · Laurent Pinchart
Hi Rick,
A few more comments.
Quoted 30 lines · On Thursday 03 Nov 2016 20:33:12 Laurent Pinchart wrote:
Quoted 20 lines · On Monday 31 Oct 2016 15:16:55 Rick Chang wrote:
Add a DT binding documentation for Mediatek JPEG Decoder of MT2701 SoC.
Signed-off-by Rick Chang <[email protected]>Signed-off-by Minghsiu Tsai <[email protected]>---
.../bindings/media/mediatek-jpeg-codec.txt | 35 ++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txtdiff --git
a/Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txtb/Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txtnew file mode 100644
index 0000000..514e656Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt line 1
Quoted 1 line
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +1
-0@@ -0,0 +1,35 @@ +* Mediatek JPEG CodecIs it a codec or a decoder only ?
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt line 4
Quoted 2 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +2
-0+Mediatek JPEG Codec device driver is a v4l2 driver which can decode +JPEG-encoded video frames.DT bindings should not reference drivers, they are OS-agnostic.
Quoted 4 lines
Quoted 2 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt line 7
Quoted 2 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +2
-0+Required properties: + - compatible : "mediatek,mt2701-jpgdec"Is the JPEG decoder found in MT2701 only, or in other Mediatek SoCs as well ?
Yes, the JPEG decoder is found in other Mediatek SoCs. However, the JPEG decoder HW in different SoCs have different register base, interrupt, power-domain and iommu setting. This patch series is only applicable in MT2701.
Quoted 7 lines
Quoted 7 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt line 10
Quoted 3 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +3
-0+ - reg : Physical base address of the jpeg codec registers and length of + memory mapped region. + - interrupts : interrupt number to the cpu.That's actually not correct, the interrupt number is local to the interrupt controller, not to the CPU.
Quoted 7 lines
Quoted 3 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt line 11
Quoted 1 line
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +1
-0+ - clocks : clock name from clock managerThe clocks property doesn't contain a name.
Furthermore you should document which clocks need to be specified here. There are two of them in the example below, the documentation should explain this clearly.
OK.
Quoted 43 lines
Quoted 42 lines
Until we provide standardized descriptions for those properties, I recommend copying the compatible, reg, interrupts, clocks, clock-names, power-domains and iommus properties descriptions from good DT bindings. Which DT bindings are good source of inspiration here is left as an exercise for the reader I'm afraid :-(
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt line 14
Quoted 3 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +3
-0+ - clock-names: the clocks of the jpeg codec H/W + - power-domains : a phandle to the power domain. + - larb : must contain the larbes of current platformShouldn't this be mediatek,larb ? And what is a larb ?
Quoted 7 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +2
-0+ - iommus : Mediatek IOMMU H/W has designed the fixed associations with + the multimedia H/W. and there is only one multimedia iommudomain.
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +2
-0+ "iommus = <&iommu portid>" the "portid" is from + dt-bindings\iommu\mt2701-iommu-port.h, it means that this portidwill
+ enable iommu. The portid default is disable iommu if "<&iommu>portid>"
Quoted 1 line
+ don't be added.
There are two iommus instances in your example below, this should be documented. This description is not very clear I'm afraid.
Quoted 15 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +15
-0+ +Example: + jpegdec: jpegdec@15004000 { + compatible = "mediatek,mt2701-jpgdec"; + reg = <0 0x15004000 0 0x1000>; + interrupts = <GIC_SPI 143 IRQ_TYPE_LEVEL_LOW>; + clocks = <&imgsys CLK_IMG_JPGDEC_SMI>, + <&imgsys CLK_IMG_JPGDEC>; + clock-names = "jpgdec-smi", + "jpgdec"; + power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>; + mediatek,larb = <&larb2>; + iommus = <&iommu MT2701_M4U_PORT_JPGDEC_WDMA>, + <&iommu MT2701_M4U_PORT_JPGDEC_BSDMA>; + };
Re: [PATCH v2 1/3] dt-bindings: mediatek: Add a binding for Mediatek JPEG Decoder
Hi Rick,
Quoted 35 lines · On Friday 04 Nov 2016 12:51:00 Rick Chang wrote:
Quoted 34 lines · Laurent Pinchart
Quoted 32 lines · On Thursday 03 Nov 2016 20:33:12 Laurent Pinchart wrote:
Quoted 20 lines · On Monday 31 Oct 2016 15:16:55 Rick Chang wrote:
Add a DT binding documentation for Mediatek JPEG Decoder of MT2701 SoC.
Signed-off-by Rick Chang <[email protected]>Signed-off-by Minghsiu Tsai <[email protected]>---
.../bindings/media/mediatek-jpeg-codec.txt | 35 ++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txtdiff --git
a/Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txtb/Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txtnew file mode 100644
index 0000000..514e656Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt line 1
Quoted 1 line
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +1
-0@@ -0,0 +1,35 @@ +* Mediatek JPEG CodecIs it a codec or a decoder only ?
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt line 4
Quoted 2 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +2
-0+Mediatek JPEG Codec device driver is a v4l2 driver which can decode +JPEG-encoded video frames.DT bindings should not reference drivers, they are OS-agnostic.
Quoted 2 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +2
-0+Required properties: + - compatible : "mediatek,mt2701-jpgdec"
Quoted 6 lines
Quoted 2 lines
Is the JPEG decoder found in MT2701 only, or in other Mediatek SoCs as well ?
Yes, the JPEG decoder is found in other Mediatek SoCs. However, the JPEG decoder HW in different SoCs have different register base, interrupt, power-domain and iommu setting.
That's fine, and that's exactly what the device tree is used for. When an identical IP core is integrated differently in different SoCs, the driver retrieves the resources (base address, clocks, IOMMU, interrupt, power domain and more) from the device tree without any need for SoC-specific code.
Quoted 1 line
This patch series is only applicable in MT2701.
That was precisely my question, apart from integration properties, is there anything specific to the MT2701 in patches 1/3 and 2/3 ?
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v2 1/3] dt-bindings: mediatek: Add a binding for Mediatek JPEG Decoder
In reply to Laurent PinchartHi Laurent,
Thanks for your patient review.I will fix them in the next patch (v3).
Quoted 16 lines · Laurent Pinchart
Hi Rick,
Thank you for the patch.
Quoted 11 lines · On Monday 31 Oct 2016 15:16:55 Rick Chang wrote:
Add a DT binding documentation for Mediatek JPEG Decoder of MT2701 SoC.
Signed-off-by Rick Chang <[email protected]>Signed-off-by Minghsiu Tsai <[email protected]>--- .../bindings/media/mediatek-jpeg-codec.txt | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt
Quoted 10 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt line 1
Quoted 8 lines
(quoted diff) +0
-0
b/Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txtnew file mode 100644
index 0000000..514e656Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +1
-0@@ -0,0 +1,35 @@ +* Mediatek JPEG CodecIs it a codec or a decoder only ?
It's a decoder precisely.
Quoted 4 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt line 4
Quoted 2 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +2
-0+Mediatek JPEG Codec device driver is a v4l2 driver which can decode +JPEG-encoded video frames.DT bindings should not reference drivers, they are OS-agnostic.
OK.
Quoted 8 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt line 10
Quoted 5 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +5
-0+Required properties: + - compatible : "mediatek,mt2701-jpgdec" + - reg : Physical base address of the jpeg codec registers and length of + memory mapped region. + - interrupts : interrupt number to the cpu.That's actually not correct, the interrupt number is local to the interrupt controller, not to the CPU.
OK.
Quoted 3 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt line 11
Quoted 1 line
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +1
-0+ - clocks : clock name from clock managerThe clocks property doesn't contain a name.
OK.
Quoted 5 lines
Until we provide standardized descriptions for those properties, I recommend copying the compatible, reg, interrupts, clocks, clock-names, power-domains and iommus properties descriptions from good DT bindings. Which DT bindings are good source of inspiration here is left as an exercise for the reader I'm afraid :-(
Thank you for the advice. I will revise the descriptions with the statements in existed upstream documents.
Quoted 5 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt line 14
Quoted 3 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +3
-0+ - clock-names: the clocks of the jpeg codec H/W + - power-domains : a phandle to the power domain. + - larb : must contain the larbes of current platformShouldn't this be mediatek,larb ? And what is a larb ?
It should be mediatek,larb.
Quoted 11 lines
Quoted 6 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +4
-0+ - iommus : Mediatek IOMMU H/W has designed the fixed associations with + the multimedia H/W. and there is only one multimedia iommu domain. + "iommus = <&iommu portid>" the "portid" is from + dt-bindings\iommu\mt2701-iommu-port.h, it means that this portidwill
+ enable iommu. The portid default is disable iommu if "<&iommu>portid>"
Quoted 1 line
+ don't be added.
There are two iommus instances in your example below, this should be documented. This description is not very clear I'm afraid.
OK.
Quoted 16 lines
Quoted 15 lines
Documentation/devicetree/bindings/media/mediatek-jpeg-codec.txt new file +15
-0+ +Example: + jpegdec: jpegdec@15004000 { + compatible = "mediatek,mt2701-jpgdec"; + reg = <0 0x15004000 0 0x1000>; + interrupts = <GIC_SPI 143 IRQ_TYPE_LEVEL_LOW>; + clocks = <&imgsys CLK_IMG_JPGDEC_SMI>, + <&imgsys CLK_IMG_JPGDEC>; + clock-names = "jpgdec-smi", + "jpgdec"; + power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>; + mediatek,larb = <&larb2>; + iommus = <&iommu MT2701_M4U_PORT_JPGDEC_WDMA>, + <&iommu MT2701_M4U_PORT_JPGDEC_BSDMA>; + };
PATCH v2 2/3 vcodec: mediatek: Add Mediatek JPEG Decoder Driver
In reply to Rick ChangAdd v4l2 driver for Mediatek JPEG Decoder
--- drivers/media/platform/Kconfig | 15 + drivers/media/platform/Makefile | 2 + drivers/media/platform/mtk-jpeg/Makefile | 2 + drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 1271 ++++++++++++++++++++++ drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h | 141 +++ drivers/media/platform/mtk-jpeg/mtk_jpeg_hw.c | 417 +++++++ drivers/media/platform/mtk-jpeg/mtk_jpeg_hw.h | 91 ++ drivers/media/platform/mtk-jpeg/mtk_jpeg_parse.c | 160 +++ drivers/media/platform/mtk-jpeg/mtk_jpeg_parse.h | 25 + drivers/media/platform/mtk-jpeg/mtk_jpeg_reg.h | 58 + 10 files changed, 2182 insertions(+) create mode 100644 drivers/media/platform/mtk-jpeg/Makefile create mode 100644 drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c create mode 100644 drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h create mode 100644 drivers/media/platform/mtk-jpeg/mtk_jpeg_hw.c create mode 100644 drivers/media/platform/mtk-jpeg/mtk_jpeg_hw.h create mode 100644 drivers/media/platform/mtk-jpeg/mtk_jpeg_parse.c create mode 100644 drivers/media/platform/mtk-jpeg/mtk_jpeg_parse.h create mode 100644 drivers/media/platform/mtk-jpeg/mtk_jpeg_reg.h
drivers/media/platform/Kconfig +15 -0
@@ -162,6 +162,21 @@ config VIDEO_CODA Coda is a range of video codec IPs that supports H.264, MPEG-4, and other video formats. +config VIDEO_MEDIATEK_JPEG + tristate "Mediatek JPEG Codec driver" + depends on MTK_IOMMU_V1 || COMPILE_TEST + depends on VIDEO_DEV && VIDEO_V4L2 + depends on ARCH_MEDIATEK || COMPILE_TEST + depends on HAS_DMA + select VIDEOBUF2_DMA_CONTIG + select V4L2_MEM2MEM_DEV + ---help--- + Mediatek jpeg codec driver provides HW capability to decode + JPEG format + + To compile this driver as a module, choose M here: the + module will be called mtk-jpeg + config VIDEO_MEDIATEK_VPU tristate "Mediatek Video Processor Unit" depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA
drivers/media/platform/Makefile +2 -0
@@ -68,3 +68,5 @@ obj-$(CONFIG_VIDEO_MEDIATEK_VPU) += mtk-vpu/ obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec/ obj-$(CONFIG_VIDEO_MEDIATEK_MDP) += mtk-mdp/ + +obj-$(CONFIG_VIDEO_MEDIATEK_JPEG) += mtk-jpeg/
drivers/media/platform/mtk-jpeg/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +mtk_jpeg-objs := mtk_jpeg_core.o mtk_jpeg_hw.o mtk_jpeg_parse.o +obj-$(CONFIG_VIDEO_MEDIATEK_JPEG) += mtk_jpeg.o
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c new file +1271 -0
1,271 lines not on this page · raw message
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h new file +141 -0
141 lines not on this page · raw message
drivers/media/platform/mtk-jpeg/mtk_jpeg_hw.c new file +417 -0
417 lines not on this page · raw message
drivers/media/platform/mtk-jpeg/mtk_jpeg_hw.h new file +91 -0
91 lines not on this page · raw message
drivers/media/platform/mtk-jpeg/mtk_jpeg_parse.c new file +160 -0
160 lines not on this page · raw message
drivers/media/platform/mtk-jpeg/mtk_jpeg_parse.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* Copyright (c) 2016 MediaTek Inc. +* Author: Ming Hsiu Tsai <[email protected]> +* Rick Chang <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef _MTK_JPEG_PARSE_H +#define _MTK_JPEG_PARSE_H + +#include "mtk_jpeg_hw.h" + +bool mtk_jpeg_parse (struct mtk_jpeg_dec_param *param,u8 *src_addr_va, +u32 src_size); + +#endif /* _MTK_JPEG_PARSE_H */ +
drivers/media/platform/mtk-jpeg/mtk_jpeg_reg.h new file +58 -0
58 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v2 3/3 arm: dts: mt2701: Add node for Mediatek JPEG Decoder
In reply to Rick Chang---
This patch depends on:
CCF "Add clock support for Mediatek MT2701"[1]
iommu and smi "Add the dtsi node of iommu and smi for mt2701"[2]
[1] http://lists.infradead.org/pipermail/linux-mediatek/2016-October/007271.html
[2] https://patchwork.kernel.org/patch/9164013/
--- arch/arm/boot/dts/mt2701.dtsi | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
arch/arm/boot/dts/mt2701.dtsi +14 -0
@@ -298,6 +298,20 @@ power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>; }; + jpegdec: jpegdec@15004000 { + compatible = "mediatek,mt2701-jpgdec"; + reg = <0 0x15004000 0 0x1000>; + interrupts = <GIC_SPI 143 IRQ_TYPE_LEVEL_LOW>; + clocks = <&imgsys CLK_IMG_JPGDEC_SMI>, + <&imgsys CLK_IMG_JPGDEC>; + clock-names = "jpgdec-smi", + "jpgdec"; + power-domains = <&scpsys MT2701_POWER_DOMAIN_ISP>; + mediatek,larb = <&larb2>; + iommus = <&iommu MT2701_M4U_PORT_JPGDEC_WDMA>, + <&iommu MT2701_M4U_PORT_JPGDEC_BSDMA>; + }; + vdecsys: syscon@16000000 { compatible = "mediatek,mt2701-vdecsys", "syscon"; reg = <0 0x16000000 0 0x1000>;
Signature · 1 line
1.9.1