Sunxi-Cedrus driver for the Allwinner Video Engine, using media requests
v5 cover Sunxi-Cedrus driver for the Allwinner Video Engine, using media requests
This is the fifth iteration of the updated Sunxi-Cedrus driver, that supports the Video Engine found in most Allwinner SoCs, starting with the A10. It was tested on the A13, A20, A33 and H3.
The initial version of this driver[0] was originally written and submitted by Florent Revest using a previous version of the request API that is necessary to provide coherency between controls and the buffers they apply to.
The driver was adapted to use the latest version of the media request API[1], as submitted by Hand Verkuil. Media request API support is a hard requirement for the Sunxi-Cedrus driver.
The driver itself currently only supports MPEG2 and more codecs will be added to the driver eventually. The output frames provided by the Video Engine are in a multi-planar 32x32-tiled YUV format, with a plane for luminance (Y) and a plane for chrominance (UV). A specific format is introduced in the V4L2 API to describe it.
This implementation is based on the significant work that was conducted by various members of the linux-sunxi community for understanding and documenting the Video Engine's innards.
In addition to the media requests API, the following series is required for Sunxi-Cedrus:
* allwinner: a64: add SRAM controller / system control
Changes since v4:
* updated to version 16 of the media requests API;
* added support for VPU-based untiling (starting with the A33);
* added support for the H3, with SRAM support;
* reworked SRAM support and associated compatibles;
* improved failure paths;
* added some MPEG2 input data validation;
* reworked video/format functions to handle multiple formats;
* removed in-driver buffer queues;
* used a threaded irq instead of a workqueue;
* merged various improvements and cleanups from Maxime;
* renamed MPEG2_SLICE_HEADER to MPEG2_SLICE_PARAMS;
* added prefixes to MPEG2 picture coding types;
* used single-buffer allocations to ensure contiguous planes
Changes since v3:
* updated to version 15 of the media request API;
* got rid of untested MPEG1 support;
* added definitons for picture coding types;
* added documentation about MPEG2 slice header fields;
* added documentation about MPEG2 slice format;
* added documentation about the MB32 NV12 format;
* added MPEG2 slice header validation;
* removed the assigned-clocks property;
* reworked and fixed error paths;
* harmonized debug prints, with v4l2 helpers when applicable;
* checked the series through checkpatch;
* switched to SPDX license headers;
* renamed MPEG2 frame header to slice header for consistency and clarity;
* removed A20 SRAM compatible from the driver's list.
Changes since v2:
* updated to version 13 of the media request API;
* integrated various changes from Maxime Ripard;
* reworked memory reservation to use CMA, dynamic allocation and allow DMABUF;
* removed reserved memory binding since the CMA pool is the default one (and allow ENODEV in the driver, for that use case);
* added SRAM controller support for the SRAM region used by the VE;
* updated the device-tree bindings the for SRAM region;
* added per-platform bindings;
* added A13 support;
* renamed VE node name and label;
* fixed Florent's authorship for the MPEG2 headers;
* added a MAINTAINERS entry.
Changes since v1:
* use the latest version of the request API for Hans Verkuil;
* added media controller support and dependency
* renamed v4l2 format to the more explicit V4L2_PIX_FMT_MB32_NV12;
* reworked bindings documentation;
* moved driver to drivers/media/platforms/sunxi/cedrus to pair with incoming CSI support ;
* added a workqueue and lists to schedule buffer completion, since it cannot be done in interrupt context;
* split mpeg2 support into a setup and a trigger function to avoid race condition;
* split video-related ops to a dedicated sunxi_cedrus_video file;
* cleaned up the included headers for each file;
* used device PFN offset instead of subtracting PHYS_BASE;
* used reset_control_reset instead of assert+deassert;
* put the device in reset when removing driver;
* changed dt bindings to use the last 96 Mib of the first 256 MiB of DRAM;
* made it clear in the mpeg frame header structure that forward and backward indexes are used as reference frames for motion vectors;
* lots of small cosmetic and consistency changes, including naming harmonization and headers text rework.
Cheers!
[0]: https://patchwork.kernel.org/patch/9299073/
[1]: https://git.linuxtv.org/hverkuil/media_tree.git/log/?h=reqv16
Hans Verkuil (1):
v4l2-ctrls: add v4l2_ctrl_request_hdl_find/put/ctrl_find functions
Maxime Ripard (4):
drivers: soc: sunxi: Add support for the C1 SRAM region
ARM: sun5i: Add support for the C1 SRAM region with the SRAM
controller
ARM: sun7i-a20: Add support for the C1 SRAM region with the SRAM
controller
ARM: sun8i-a23-a33: Add SRAM controller node and C1 SRAM region
Paul Kocialkowski (17):
fixup! v4l2-ctrls: add v4l2_ctrl_request_hdl_find/put/ctrl_find
functions
dt-bindings: sram: sunxi: Introduce new A10 binding for system-control
dt-bindings: sram: sunxi: Add A13, A20, A23 and H3 dedicated bindings
dt-bindings: sram: sunxi: Populate valid sections compatibles
soc: sunxi: sram: Add dt match for the A10 system-control compatible
ARM: dts: sun4i-a10: Use system-control compatible
ARM: dts: sun5i: Use most-qualified system control compatibles
ARM: dts: sun7i-a20: Use most-qualified system control compatibles
ARM: sun8i-h3: Add SRAM controller node and C1 SRAM region
media: v4l: Add definitions for MPEG2 slice format and header metadata
media: v4l: Add definition for Allwinner's MB32-tiled NV12 format
dt-bindings: media: Document bindings for the Sunxi-Cedrus VPU driver
media: platform: Add Sunxi-Cedrus VPU decoder driver
ARM: dts: sun5i: Add Video Engine and reserved memory nodes
ARM: dts: sun7i-a20: Add Video Engine and reserved memory nodes
ARM: dts: sun8i-a33: Add Video Engine and reserved memory nodes
ARM: dts: sun8i-h3: Add Video Engine and reserved memory nodes
.../bindings/media/sunxi-cedrus.txt | 54 ++ .../devicetree/bindings/sram/sunxi-sram.txt | 36 +- .../media/uapi/v4l/extended-controls.rst | 74 +++ .../media/uapi/v4l/pixfmt-compressed.rst | 5 + .../media/uapi/v4l/pixfmt-reserved.rst | 15 +- MAINTAINERS | 7 + arch/arm/boot/dts/sun4i-a10.dtsi | 4 +- arch/arm/boot/dts/sun5i.dtsi | 53 +- arch/arm/boot/dts/sun7i-a20.dtsi | 53 +- arch/arm/boot/dts/sun8i-a23-a33.dtsi | 23 + arch/arm/boot/dts/sun8i-a33.dtsi | 29 + arch/arm/boot/dts/sun8i-h3.dtsi | 50 ++ drivers/media/platform/Kconfig | 2 + drivers/media/platform/Makefile | 1 + drivers/media/platform/sunxi/Kconfig | 15 + drivers/media/platform/sunxi/Makefile | 1 + drivers/media/platform/sunxi/cedrus/Kconfig | 13 + drivers/media/platform/sunxi/cedrus/Makefile | 3 + drivers/media/platform/sunxi/cedrus/cedrus.c | 374 ++++++++++++ drivers/media/platform/sunxi/cedrus/cedrus.h | 161 +++++ .../media/platform/sunxi/cedrus/cedrus_dec.c | 129 ++++ .../media/platform/sunxi/cedrus/cedrus_dec.h | 27 + .../media/platform/sunxi/cedrus/cedrus_hw.c | 325 ++++++++++ .../media/platform/sunxi/cedrus/cedrus_hw.h | 29 + .../platform/sunxi/cedrus/cedrus_mpeg2.c | 178 ++++++ .../media/platform/sunxi/cedrus/cedrus_regs.h | 195 ++++++ .../platform/sunxi/cedrus/cedrus_video.c | 556 ++++++++++++++++++ .../platform/sunxi/cedrus/cedrus_video.h | 31 + drivers/media/v4l2-core/v4l2-ctrls.c | 69 +++ drivers/media/v4l2-core/v4l2-ioctl.c | 2 + drivers/soc/sunxi/sunxi_sram.c | 14 + include/media/v4l2-ctrls.h | 60 +- include/uapi/linux/v4l2-controls.h | 30 + include/uapi/linux/videodev2.h | 4 + 34 files changed, 2600 insertions(+), 22 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/sunxi-cedrus.txt create mode 100644 drivers/media/platform/sunxi/Kconfig create mode 100644 drivers/media/platform/sunxi/Makefile create mode 100644 drivers/media/platform/sunxi/cedrus/Kconfig create mode 100644 drivers/media/platform/sunxi/cedrus/Makefile create mode 100644 drivers/media/platform/sunxi/cedrus/cedrus.c create mode 100644 drivers/media/platform/sunxi/cedrus/cedrus.h create mode 100644 drivers/media/platform/sunxi/cedrus/cedrus_dec.c create mode 100644 drivers/media/platform/sunxi/cedrus/cedrus_dec.h create mode 100644 drivers/media/platform/sunxi/cedrus/cedrus_hw.c create mode 100644 drivers/media/platform/sunxi/cedrus/cedrus_hw.h create mode 100644 drivers/media/platform/sunxi/cedrus/cedrus_mpeg2.c create mode 100644 drivers/media/platform/sunxi/cedrus/cedrus_regs.h create mode 100644 drivers/media/platform/sunxi/cedrus/cedrus_video.c create mode 100644 drivers/media/platform/sunxi/cedrus/cedrus_video.h
Signature · 1 line
2.17.1
PATCH v5 1/22 v4l2-ctrls: add v4l2_ctrl_request_hdl_find/put/ctrl_find functions
From: Hans Verkuil <[email protected]>
If a driver needs to find/inspect the controls set in a request then it can use these functions.
E.g. to check if a required control is set in a request use this in the req_validate() implementation:
int res = -EINVAL;
hdl = v4l2_ctrl_request_hdl_find(req, parent_hdl);
if (hdl) {
if (v4l2_ctrl_request_hdl_ctrl_find(hdl, ctrl_id))
res = 0;
v4l2_ctrl_request_hdl_put(hdl);
}
return res;--- drivers/media/v4l2-core/v4l2-ctrls.c | 25 ++++++++++++++++ include/media/v4l2-ctrls.h | 44 +++++++++++++++++++++++++++- 2 files changed, 68 insertions(+), 1 deletion(-)
drivers/media/v4l2-core/v4l2-ctrls.c +25 -0
@@ -2976,6 +2976,31 @@ static const struct media_request_object_ops req_ops = { .release = v4l2_ctrl_request_release, }; +struct v4l2_ctrl_handler *v4l2_ctrl_request_hdl_find (struct media_request *req, +struct v4l2_ctrl_handler *parent) +{ +struct media_request_object *obj; + +if (WARN_ON (req->state !=MEDIA_REQUEST_STATE_VALIDATING && + req->state !=MEDIA_REQUEST_STATE_QUEUED )) +return NULL ; + + obj =media_request_object_find (req, &req_ops, parent); +if (obj) + return container_of(obj, struct v4l2_ctrl_handler, req_obj); +return NULL ; +} +EXPORT_SYMBOL_GPL (v4l2_ctrl_request_hdl_find); + +struct v4l2_ctrl * +v4l2_ctrl_request_hdl_ctrl_find (struct v4l2_ctrl_handler *hdl,u32 id) +{ +struct v4l2_ctrl_ref *ref =find_ref_lock (hdl, id); + +return (ref && ref->req == ref) ? ref :NULL ; +} +EXPORT_SYMBOL_GPL (v4l2_ctrl_request_hdl_ctrl_find); +static int v4l2_ctrl_request_bind (struct media_request *req,struct v4l2_ctrl_handler *hdl,struct v4l2_ctrl_handler *from)
include/media/v4l2-ctrls.h +43 -1
50 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v5 2/22 fixup! v4l2-ctrls: add v4l2_ctrl_request_hdl_find/put/ctrl_find functions
In reply to Paul Kocialkowski--- drivers/media/v4l2-core/v4l2-ctrls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/v4l2-core/v4l2-ctrls.c +1 -1
@@ -2997,7 +2997,7 @@ v4l2_ctrl_request_hdl_ctrl_find(struct v4l2_ctrl_handler *hdl, u32 id) {struct v4l2_ctrl_ref *ref =find_ref_lock (hdl, id); -return (ref && ref->req == ref) ? ref :NULL ; +return (ref && ref->req == ref) ? ref->ctrl :NULL ; }EXPORT_SYMBOL_GPL (v4l2_ctrl_request_hdl_ctrl_find);
Signature · 1 line
2.17.1
PATCH v5 3/22 dt-bindings: sram: sunxi: Introduce new A10 binding for system-control
In reply to Paul KocialkowskiFollowing-up on the introduction of a new binding for the A64, this introduces a system-control binding for the A10 as a replacement of the sram-controller binding.
This change is motivated by consistency with the Allwinner literature, that mentions system control over SRAM controller. Moreover, the system control block is sometimes used for more than SRAM (e.g. for muxing related to the ethernet PHY).
--- Documentation/devicetree/bindings/sram/sunxi-sram.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/sram/sunxi-sram.txt +4 -3
@@ -10,7 +10,8 @@ Controller Node Required properties: - compatible : should be: - - "allwinner,sun4i-a10-sram-controller" + - "allwinner,sun4i-a10-sram-controller" (deprecated) + - "allwinner,sun4i-a10-system-control" - "allwinner,sun50i-a64-sram-controller" (deprecated) - "allwinner,sun50i-a64-system-control" - reg : sram controller register offset + length
@@ -48,8 +49,8 @@ This valid values for this argument are: Example ------- -sram-controller at 1c00000 { - compatible = "allwinner,sun4i-a10-sram-controller"; +system-control at 1c00000 { + compatible = "allwinner,sun4i-a10-system-control"; reg = <0x01c00000 0x30>; #address-cells = <1>; #size-cells = <1>;
Signature · 1 line
2.17.1
PATCH v5 4/22 dt-bindings: sram: sunxi: Add A13, A20, A23 and H3 dedicated bindings
In reply to Paul KocialkowskiThis introduces dedicated bindings for the system control blocks found on the A13, A20, A23 and H3 sunxi platforms.
Since the controllers on the A33 are the very same as those on the A23, no specific compatible is introduced for it.
These bindings are introduced to allow reflecting the differences that exist between these controllers, that may become significant to driver implementations.
--- Documentation/devicetree/bindings/sram/sunxi-sram.txt | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/sram/sunxi-sram.txt +4 -0
@@ -12,6 +12,10 @@ Required properties: - compatible : should be: - "allwinner,sun4i-a10-sram-controller" (deprecated) - "allwinner,sun4i-a10-system-control" + - "allwinner,sun5i-a13-system-control" + - "allwinner,sun7i-a20-system-control" + - "allwinner,sun8i-a23-system-control" + - "allwinner,sun8i-h3-system-control" - "allwinner,sun50i-a64-sram-controller" (deprecated) - "allwinner,sun50i-a64-system-control" - reg : sram controller register offset + length
Signature · 1 line
2.17.1
PATCH v5 5/22 dt-bindings: sram: sunxi: Populate valid sections compatibles
In reply to Paul KocialkowskiThis adds a list of valid SRAM sections compatibles for the A13, A20, A23 and H3 platforms. Per-platform compatibles are introduced for the SRAM sections of these platforms, with the A10 compatibles also listed as valid when applicable.
In particular, compatibles for the C1 SRAM section are introduced.
--- .../devicetree/bindings/sram/sunxi-sram.txt | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+)
Documentation/devicetree/bindings/sram/sunxi-sram.txt +25 -0
@@ -32,8 +32,33 @@ once again the representation described in the mmio-sram binding. The valid sections compatible for A10 are: - allwinner,sun4i-a10-sram-a3-a4 + - allwinner,sun4i-a10-sram-c1 - allwinner,sun4i-a10-sram-d +The valid sections compatible for A13 are: + - allwinner,sun5i-a13-sram-a3-a4 + - allwinner,sun4i-a10-sram-a3-a4 + - allwinner,sun5i-a13-sram-c1 + - allwinner,sun4i-a10-sram-c1 + - allwinner,sun5i-a13-sram-d + - allwinner,sun4i-a10-sram-d + +The valid sections compatible for A20 are: + - allwinner,sun7i-a20-sram-a3-a4 + - allwinner,sun4i-a10-sram-a3-a4 + - allwinner,sun7i-a20-sram-c1 + - allwinner,sun4i-a10-sram-c1 + - allwinner,sun7i-a20-sram-d + - allwinner,sun4i-a10-sram-d + +The valid sections compatible for A23/A33 are: + - allwinner,sun8i-a23-sram-c1 + - allwinner,sun4i-a10-sram-c1 + +The valid sections compatible for H3 are: + - allwinner,sun8i-h3-sram-c1 + - allwinner,sun4i-a10-sram-c1 + The valid sections compatible for A64 are: - allwinner,sun50i-a64-sram-c
Signature · 1 line
2.17.1
PATCH v5 6/22 soc: sunxi: sram: Add dt match for the A10 system-control compatible
In reply to Paul KocialkowskiThis binds the new A10 system-control compatible to the associated driver, with the same driver data as the previous compatible.
--- drivers/soc/sunxi/sunxi_sram.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/soc/sunxi/sunxi_sram.c +4 -0
@@ -355,6 +355,10 @@ static const struct of_device_id sunxi_sram_dt_match[] = { .compatible = "allwinner,sun4i-a10-sram-controller", .data = &sun4i_a10_sramc_variant, }, + { + .compatible = "allwinner,sun4i-a10-system-control", + .data = &sun4i_a10_sramc_variant, + }, { .compatible = "allwinner,sun50i-a64-sram-controller", .data = &sun50i_a64_sramc_variant,
Signature · 1 line
2.17.1
PATCH v5 7/22 drivers: soc: sunxi: Add support for the C1 SRAM region
In reply to Paul KocialkowskiFrom: Maxime Ripard <[email protected]>
This introduces support for the SRAM C1 section, that is controlled by the system controller. This SRAM area can be muxed either to the CPU or the Video Engine, that needs this area to store various tables (e.g. the Huffman VLD decoding tables).
This only supports devices with the same layout as the A10 (which also includes the A13, A20, A33 and other SoCs).
--- drivers/soc/sunxi/sunxi_sram.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/soc/sunxi/sunxi_sram.c +10 -0
@@ -64,6 +64,12 @@ static struct sunxi_sram_desc sun4i_a10_sram_a3_a4 = { SUNXI_SRAM_MAP(1, 1, "emac")), }; +static struct sunxi_sram_desc sun4i_a10_sram_c1 = { + .data =SUNXI_SRAM_DATA ("C1" ,0x0 ,0x0 ,31 , +SUNXI_SRAM_MAP (0 ,0 ,"cpu" ), +SUNXI_SRAM_MAP (0x7fffffff ,1 ,"ve" )), +}; +static struct sunxi_sram_desc sun4i_a10_sram_d = { .data = SUNXI_SRAM_DATA("D", 0x4, 0x0, 1, SUNXI_SRAM_MAP(0, 0, "cpu"),
@@ -81,6 +87,10 @@ static const struct of_device_id sunxi_sram_dt_ids[] = { .compatible = "allwinner,sun4i-a10-sram-a3-a4", .data = &sun4i_a10_sram_a3_a4.data, }, + { + .compatible = "allwinner,sun4i-a10-sram-c1", + .data = &sun4i_a10_sram_c1.data, + }, { .compatible = "allwinner,sun4i-a10-sram-d", .data = &sun4i_a10_sram_d.data,
Signature · 1 line
2.17.1
PATCH v5 8/22 ARM: dts: sun4i-a10: Use system-control compatible
In reply to Paul KocialkowskiThis switches the sun4i-a10 dtsi to use the new compatible for the system-control block (previously named SRAM controller) instead of the deprecated one.
The phandle is also updated to reflect the fact that the controller described is really about system control rather than SRAM control.
--- arch/arm/boot/dts/sun4i-a10.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/sun4i-a10.dtsi +2 -2
@@ -190,8 +190,8 @@ #size-cells = <1>; ranges; - sram-controller at 1c00000 { - compatible = "allwinner,sun4i-a10-sram-controller"; + system-control at 1c00000 { + compatible = "allwinner,sun4i-a10-system-control"; reg = <0x01c00000 0x30>; #address-cells = <1>; #size-cells = <1>;
Signature · 1 line
2.17.1
PATCH v5 9/22 ARM: dts: sun5i: Use most-qualified system control compatibles
In reply to Paul KocialkowskiThis switches the sun5i dtsi to use the most qualified compatibles for the system-control block (previously named SRAM controller) as well as the SRAM blocks. The sun4i-a10 compatibles are kept since these hardware blocks are backward-compatible.
The phandle for system control is also updated to reflect the fact that the controller described is really about system control rather than SRAM control.
--- arch/arm/boot/dts/sun5i.dtsi | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
arch/arm/boot/dts/sun5i.dtsi +7 -4
@@ -114,8 +114,9 @@ #size-cells = <1>; ranges; - sram-controller at 1c00000 { - compatible = "allwinner,sun4i-a10-sram-controller"; + system-control at 1c00000 { + compatible = "allwinner,sun5i-a13-system-control", + "allwinner,sun4i-a10-system-control"; reg = <0x01c00000 0x30>; #address-cells = <1>; #size-cells = <1>;
@@ -130,7 +131,8 @@ }; emac_sram: sram-section at 8000 { - compatible = "allwinner,sun4i-a10-sram-a3-a4"; + compatible = "allwinner,sun5i-a13-sram-a3-a4", + "allwinner,sun4i-a10-sram-a3-a4"; reg = <0x8000 0x4000>; status = "disabled"; };
@@ -143,7 +145,8 @@ ranges = <0 0x00010000 0x1000>; otg_sram: sram-section at 0 { - compatible = "allwinner,sun4i-a10-sram-d"; + compatible = "allwinner,sun5i-a13-sram-d", + "allwinner,sun4i-a10-sram-d"; reg = <0x0000 0x1000>; status = "disabled"; };
Signature · 1 line
2.17.1
PATCH v5 10/22 ARM: dts: sun7i-a20: Use most-qualified system control compatibles
In reply to Paul KocialkowskiThis switches the sun7i-a20 dtsi to use the most qualified compatibles for the system-control block (previously named SRAM controller) as well as the SRAM blocks. The sun4i-a10 compatibles are kept since these hardware blocks are backward-compatible.
The phandle for system control is also updated to reflect the fact that the controller described is really about system control rather than SRAM control.
--- arch/arm/boot/dts/sun7i-a20.dtsi | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
arch/arm/boot/dts/sun7i-a20.dtsi +7 -4
@@ -239,8 +239,9 @@ #size-cells = <1>; ranges; - sram-controller at 1c00000 { - compatible = "allwinner,sun4i-a10-sram-controller"; + system-control at 1c00000 { + compatible = "allwinner,sun7i-a20-system-control", + "allwinner,sun4i-a10-system-control"; reg = <0x01c00000 0x30>; #address-cells = <1>; #size-cells = <1>;
@@ -254,7 +255,8 @@ ranges = <0 0x00000000 0xc000>; emac_sram: sram-section at 8000 { - compatible = "allwinner,sun4i-a10-sram-a3-a4"; + compatible = "allwinner,sun7i-a20-sram-a3-a4", + "allwinner,sun4i-a10-sram-a3-a4"; reg = <0x8000 0x4000>; status = "disabled"; };
@@ -268,7 +270,8 @@ ranges = <0 0x00010000 0x1000>; otg_sram: sram-section at 0 { - compatible = "allwinner,sun4i-a10-sram-d"; + compatible = "allwinner,sun7i-a20-sram-d", + "allwinner,sun4i-a10-sram-d"; reg = <0x0000 0x1000>; status = "disabled"; };
Signature · 1 line
2.17.1
PATCH v5 11/22 ARM: sun5i: Add support for the C1 SRAM region with the SRAM controller
In reply to Paul KocialkowskiFrom: Maxime Ripard <[email protected]>
This adds support for the C1 SRAM region (to be used with the SRAM controller driver) for sun5i-based platforms. The region is shared between the Video Engine and the CPU.
--- arch/arm/boot/dts/sun5i.dtsi | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
arch/arm/boot/dts/sun5i.dtsi +14 -0
@@ -137,6 +137,20 @@ status = "disabled"; }; + sram_c: sram at 1d00000 { + compatible = "mmio-sram"; + reg = <0x01d00000 0x80000>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0x01d00000 0x80000>; + + ve_sram: sram-section at 0 { + compatible = "allwinner,sun5i-a13-sram-c1", + "allwinner,sun4i-a10-sram-c1"; + reg = <0x000000 0x80000>; + }; + }; + sram_d: sram at 10000 { compatible = "mmio-sram"; reg = <0x00010000 0x1000>;
Signature · 1 line
2.17.1
PATCH v5 12/22 ARM: sun7i-a20: Add support for the C1 SRAM region with the SRAM controller
In reply to Paul KocialkowskiFrom: Maxime Ripard <[email protected]>
This adds support for the C1 SRAM region (to be used with the SRAM controller driver) for the A20 platform. The region is shared between the Video Engine and the CPU.
--- arch/arm/boot/dts/sun7i-a20.dtsi | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
arch/arm/boot/dts/sun7i-a20.dtsi +14 -0
@@ -276,6 +276,20 @@ status = "disabled"; }; }; + + sram_c: sram at 1d00000 { + compatible = "mmio-sram"; + reg = <0x01d00000 0x80000>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0x01d00000 0x80000>; + + ve_sram: sram-section at 0 { + compatible = "allwinner,sun7i-a20-sram-c1", + "allwinner,sun4i-a10-sram-c1"; + reg = <0x000000 0x80000>; + }; + }; }; nmi_intc: interrupt-controller at 1c00030 {
Signature · 1 line
2.17.1
PATCH v5 13/22 ARM: sun8i-a23-a33: Add SRAM controller node and C1 SRAM region
In reply to Paul KocialkowskiFrom: Maxime Ripard <[email protected]>
This adds a SRAM controller node for the A23 and A33, with support for the C1 SRAM region that is shared between the Video Engine and the CPU.
--- arch/arm/boot/dts/sun8i-a23-a33.dtsi | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
arch/arm/boot/dts/sun8i-a23-a33.dtsi +23 -0
@@ -124,6 +124,29 @@ #size-cells = <1>; ranges; + system-control at 1c00000 { + compatible = "allwinner,sun8i-a23-system-control", + "allwinner,sun4i-a10-system-control"; + reg = <0x01c00000 0x30>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + sram_c: sram at 1d00000 { + compatible = "mmio-sram"; + reg = <0x01d00000 0x80000>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0x01d00000 0x80000>; + + ve_sram: sram-section at 0 { + compatible = "allwinner,sun8i-a23-sram-c1", + "allwinner,sun4i-a10-sram-c1"; + reg = <0x000000 0x80000>; + }; + }; + }; + dma: dma-controller at 1c02000 { compatible = "allwinner,sun8i-a23-dma"; reg = <0x01c02000 0x1000>;
Signature · 1 line
2.17.1
PATCH v5 14/22 ARM: sun8i-h3: Add SRAM controller node and C1 SRAM region
In reply to Paul KocialkowskiThis adds a SRAM controller node for the H3, with support for the C1 SRAM region that is shared between the Video Engine and the CPU.
--- arch/arm/boot/dts/sun8i-h3.dtsi | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
arch/arm/boot/dts/sun8i-h3.dtsi +23 -0
@@ -111,6 +111,29 @@ }; soc { + system-control at 1c00000 { + compatible = "allwinner,sun8i-h3-system-control", + "allwinner,sun4i-a10-system-control"; + reg = <0x01c00000 0x30>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + sram_c: sram at 1d00000 { + compatible = "mmio-sram"; + reg = <0x01d00000 0x80000>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0x01d00000 0x80000>; + + ve_sram: sram-section at 0 { + compatible = "allwinner,sun8i-h3-sram-c1", + "allwinner,sun4i-a10-sram-c1"; + reg = <0x000000 0x80000>; + }; + }; + }; + mali: gpu at 1c40000 { compatible = "allwinner,sun8i-h3-mali", "arm,mali-400"; reg = <0x01c40000 0x10000>;
Signature · 1 line
2.17.1
PATCH v5 15/22 media: v4l: Add definitions for MPEG2 slice format and header metadata
In reply to Paul KocialkowskiStateless video decoding engines require both the MPEG slices and associated metadata from the video stream in order to decode frames.
This introduces definitions for a new pixel format, describing buffers with MPEG2 slice data, as well as a control structure for passing the frame header (metadata) to drivers.
This is based on work from both Florent Revest and Hugues Fruchet.
--- .../media/uapi/v4l/extended-controls.rst | 74 +++++++++++++++++++ .../media/uapi/v4l/pixfmt-compressed.rst | 5 ++ drivers/media/v4l2-core/v4l2-ctrls.c | 44 +++++++++++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/media/v4l2-ctrls.h | 16 ++-- include/uapi/linux/v4l2-controls.h | 30 ++++++++ include/uapi/linux/videodev2.h | 3 + 7 files changed, 166 insertions(+), 7 deletions(-)
Documentation/media/uapi/v4l/extended-controls.rst +74 -0
@@ -1497,6 +1497,80 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - +.. _v4l2-mpeg-mpeg2: + +``V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS (struct)`` + Specifies the slice parameters (also known as slice header) for an + associated MPEG-2 slice data. This includes all the necessary + parameters for configuring a hardware decoder pipeline for MPEG-2. + +.. tabularcolumns:: |p{2.0cm}|p{4.0cm}|p{11.0cm}| + +.. c:type:: v4l2_ctrl_mpeg2_slice_params + +.. cssclass:: longtable + +.. flat-table:: struct v4l2_ctrl_mpeg2_slice_params + :header-rows: 0 + :stub-columns: 0 + :widths: 1 1 2 + + * - __u32 + - ``slice_len`` + - Length (in bits) of the current slice data. + * - __u32 + - ``slice_pos`` + - Position (in bits) of the current slice data, relative to the + frame start. + * - __u16 + - ``width`` + - Width of the corresponding output frame for the current slice. + * - __u16 + - ``height`` + - Height of the corresponding output frame for the current slice. + * - __u8 + - ``slice_type`` + - Picture coding type for the frame covered by the current slice + (V4L2_MPEG2_SLICE_TYPE_I, V4L2_MPEG2_SLICE_TYPE_P or + V4L2_MPEG2_SLICE_PCT_B). + * - __u8 + - ``f_code[2][2]`` + - Motion vector codes. + * - __u8 + - ``intra_dc_precision`` + - Precision of Discrete Cosine transform (0: 8 bits precision, + 1: 9 bits precision, 2: 10 bits precision, 11: 11 bits precision). + * - __u8 + - ``picture_structure`` + - Picture structure (1: interlaced top field, + 2: interlaced bottom field, 3: progressive frame). + * - __u8 + - ``top_field_first`` + - If set to 1 and interlaced stream, top field is output first. + * - __u8 + - ``frame_pred_frame_dct`` + - If set to 1, only frame-DCT and frame prediction are used. + * - __u8 + - ``concealment_motion_vectors`` + - If set to 1, motion vectors are coded for intra macroblocks. + * - __u8 + - ``q_scale_type`` + - This flag affects the inverse quantisation process. + * - __u8 + - ``intra_vlc_format`` + - This flag affects the decoding of transform coefficient data. + * - __u8 + - ``alternate_scan`` + - This flag affects the decoding of transform coefficient data. + * - __u8 + - ``backward_ref_index`` + - Index for the V4L2 buffer to use as backward reference, used with + B-coded and P-coded frames. + * - __u8 + - ``forward_ref_index`` + - Index for the V4L2 buffer to use as forward reference, used with + P-coded frames. + * - :cspan:`2` MFC 5.1 MPEG Controls ---------------------
Documentation/media/uapi/v4l/pixfmt-compressed.rst +5 -0
@@ -60,6 +60,11 @@ Compressed Formats - ``V4L2_PIX_FMT_MPEG2`` - 'MPG2' - MPEG2 video elementary stream. + * .. _V4L2-PIX-FMT-MPEG2-SLICE: + + - ``V4L2_PIX_FMT_MPEG2_SLICE`` + - 'MG2S' + - MPEG2 parsed slice data, as extracted from the MPEG2 bitstream. * .. _V4L2-PIX-FMT-MPEG4: - ``V4L2_PIX_FMT_MPEG4``
drivers/media/v4l2-core/v4l2-ctrls.c +44 -0
74 lines not on this page · raw message
drivers/media/v4l2-core/v4l2-ioctl.c +1 -0
@@ -1304,6 +1304,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_PIX_FMT_H263 : descr ="H.263" ;break ;case V4L2_PIX_FMT_MPEG1 : descr ="MPEG-1 ES" ;break ;case V4L2_PIX_FMT_MPEG2 : descr ="MPEG-2 ES" ;break ; +case V4L2_PIX_FMT_MPEG2_SLICE : descr ="MPEG-2 parsed slice data" ;break ;case V4L2_PIX_FMT_MPEG4 : descr ="MPEG-4 part 2 ES" ;break ;case V4L2_PIX_FMT_XVID : descr ="Xvid" ;break ;case V4L2_PIX_FMT_VC1_ANNEX_G : descr ="VC-1 (SMPTE 412M Annex G)" ;break ;
include/media/v4l2-ctrls.h +9 -7
@@ -35,13 +35,14 @@ struct poll_table_struct;/** * union v4l2_ctrl_ptr - A pointer to a control value. -* @p_s32: Pointer to a 32-bit signed value. -* @p_s64: Pointer to a 64-bit signed value. -* @p_u8: Pointer to a 8-bit unsigned value. -* @p_u16: Pointer to a 16-bit unsigned value. -* @p_u32: Pointer to a 32-bit unsigned value. -* @p_char: Pointer to a string. -* @p: Pointer to a compound value. +* @p_s32: Pointer to a 32-bit signed value. +* @p_s64: Pointer to a 64-bit signed value. +* @p_u8: Pointer to a 8-bit unsigned value. +* @p_u16: Pointer to a 16-bit unsigned value. +* @p_u32: Pointer to a 32-bit unsigned value. +* @p_char: Pointer to a string. +* @p_mpeg2_slice_params: Pointer to a MPEG2 slice parameters structure. +* @p: Pointer to a compound value. */ union v4l2_ctrl_ptr {s32 *p_s32;
@@ -50,6 +51,7 @@ union v4l2_ctrl_ptr {u16 *p_u16;u32 *p_u32;char *p_char; +struct v4l2_ctrl_mpeg2_slice_params *p_mpeg2_slice_params;void *p; };
include/uapi/linux/v4l2-controls.h +30 -0
@@ -557,6 +557,8 @@ enum v4l2_mpeg_video_mpeg4_profile { };#define V4L2_CID_MPEG_VIDEO_MPEG4_QPEL (V4L2_CID_MPEG_BASE+407) +#define V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS (V4L2_CID_MPEG_BASE+450) +/* Control IDs for VP8 streams * Although VP8 is not part of MPEG we add these controls to the MPEG class * as that class is already handling other video compression standards
@@ -1092,4 +1094,32 @@ enum v4l2_detect_md_mode {#define V4L2_CID_DETECT_MD_THRESHOLD_GRID (V4L2_CID_DETECT_CLASS_BASE + 3)#define V4L2_CID_DETECT_MD_REGION_GRID (V4L2_CID_DETECT_CLASS_BASE + 4) +#define V4L2_MPEG2_SLICE_TYPE_I 1 +#define V4L2_MPEG2_SLICE_TYPE_P 2 +#define V4L2_MPEG2_SLICE_TYPE_B 3 +#define V4L2_MPEG2_SLICE_TYPE_D 4 + +struct v4l2_ctrl_mpeg2_slice_params { +__u32 slice_len; +__u32 slice_pos; + +__u16 width; +__u16 height; + +__u8 slice_type; +__u8 f_code[2 ][2 ]; + +__u8 intra_dc_precision; +__u8 picture_structure; +__u8 top_field_first; +__u8 frame_pred_frame_dct; +__u8 concealment_motion_vectors; +__u8 q_scale_type; +__u8 intra_vlc_format; +__u8 alternate_scan; + +__u8 backward_ref_index; +__u8 forward_ref_index; +}; +#endif
include/uapi/linux/videodev2.h +3 -0
@@ -629,6 +629,7 @@ struct v4l2_pix_format {#define V4L2_PIX_FMT_H263 v4l2_fourcc('H', '2', '6', '3')/* H263 */ #define V4L2_PIX_FMT_MPEG1 v4l2_fourcc('M', 'P', 'G', '1')/* MPEG-1 ES */ #define V4L2_PIX_FMT_MPEG2 v4l2_fourcc('M', 'P', 'G', '2')/* MPEG-2 ES */ +#define V4L2_PIX_FMT_MPEG2_SLICE v4l2_fourcc('M', 'G', '2', 'S')/* MPEG-2 parsed slice data */ #define V4L2_PIX_FMT_MPEG4 v4l2_fourcc('M', 'P', 'G', '4')/* MPEG-4 part 2 ES */ #define V4L2_PIX_FMT_XVID v4l2_fourcc('X', 'V', 'I', 'D')/* Xvid */ #define V4L2_PIX_FMT_VC1_ANNEX_G v4l2_fourcc('V', 'C', '1', 'G')/* SMPTE 421M Annex G compliant stream */
@@ -1587,6 +1588,7 @@ struct v4l2_ext_control {__u8 __user *p_u8;__u16 __user *p_u16;__u32 __user *p_u32; +struct v4l2_ctrl_mpeg2_slice_params __user *p_mpeg2_slice_params;void __user *ptr; }; } __attribute__ ((packed));
@@ -1632,6 +1634,7 @@ enum v4l2_ctrl_type {V4L2_CTRL_TYPE_U8 =0x0100 ,V4L2_CTRL_TYPE_U16 =0x0101 ,V4L2_CTRL_TYPE_U32 =0x0102 , + V4L2_CTRL_TYPE_MPEG2_SLICE_PARAMS = 0x0103, };/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
Signature · 1 line
2.17.1
PATCH v5 16/22 media: v4l: Add definition for Allwinner's MB32-tiled NV12 format
In reply to Paul KocialkowskiThis introduces support for Allwinner's MB32-tiled NV12 format, where each plane is divided into macroblocks of 32x32 pixels. Hence, the size of each plane has to be aligned to 32 bytes. The pixels inside each macroblock are coded as they would be if the macroblock was a single plane, line after line.
The MB32-tiled NV12 format is used by the video engine on Allwinner
platforms: it is the default format for decoded frames (and the only one available in the oldest supported platforms).
--- Documentation/media/uapi/v4l/pixfmt-reserved.rst | 15 ++++++++++++++- drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 3 files changed, 16 insertions(+), 1 deletion(-)
Documentation/media/uapi/v4l/pixfmt-reserved.rst +14 -1
@@ -243,7 +243,20 @@ please make a proposal on the linux-media mailing list. It is an opaque intermediate format and the MDP hardware must be used to convert ``V4L2_PIX_FMT_MT21C`` to ``V4L2_PIX_FMT_NV12M``, ``V4L2_PIX_FMT_YUV420M`` or ``V4L2_PIX_FMT_YVU420``. - + * .. _V4L2-PIX-FMT-MB32-NV12: + + - ``V4L2_PIX_FMT_MB32_NV12`` + - 'MN12' + - Two-planar NV12-based format used by the Allwinner video engine + hardware, with 32x32 tiles for the luminance plane and 32x64 tiles + for the chrominance plane. Each tile is a linear pixel data + representation within its own bounds. Each tile follows the previous + one linearly (as in, from left to right, top to bottom). + + The frame dimensions are aligned to match an integer number of + tiles, resulting in 32-aligned resolutions for the luminance plane + and 16-aligned resolutions for the chrominance plane (with 2x2 + subsampling). .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
drivers/media/v4l2-core/v4l2-ioctl.c +1 -0
@@ -1331,6 +1331,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_PIX_FMT_SE401 : descr ="GSPCA SE401" ;break ;case V4L2_PIX_FMT_S5C_UYVY_JPG : descr ="S5C73MX interleaved UYVY/JPEG" ;break ;case V4L2_PIX_FMT_MT21C : descr ="Mediatek Compressed Format" ;break ; +case V4L2_PIX_FMT_MB32_NV12 : descr ="Allwinner tiled NV12 format" ;break ;default :WARN (1 ,"Unknown pixelformat 0x%08x\n" , fmt->pixelformat);if (fmt->description[0 ])
include/uapi/linux/videodev2.h +1 -0
@@ -670,6 +670,7 @@ struct v4l2_pix_format {#define V4L2_PIX_FMT_Z16 v4l2_fourcc('Z', '1', '6', ' ')/* Depth data 16-bit */ #define V4L2_PIX_FMT_MT21C v4l2_fourcc('M', 'T', '2', '1')/* Mediatek compressed block mode */ #define V4L2_PIX_FMT_INZI v4l2_fourcc('I', 'N', 'Z', 'I')/* Intel Planar Greyscale 10-bit and Depth 16-bit */ +#define V4L2_PIX_FMT_MB32_NV12 v4l2_fourcc('M', 'N', '1', '2')/* Allwinner tiled NV12 format */ /* 10bit raw bayer packed, 32 bytes for every 25 pixels, last LSB 6 bits unused */ #define V4L2_PIX_FMT_IPU3_SBGGR10 v4l2_fourcc('i', 'p', '3', 'b')/* IPU3 packed 10-bit BGGR bayer */
Signature · 1 line
2.17.1
PATCH v5 17/22 dt-bindings: media: Document bindings for the Sunxi-Cedrus VPU driver
In reply to Paul KocialkowskiThis adds a device-tree binding document that specifies the properties used by the Sunxi-Cedurs VPU driver, as well as examples.
--- .../bindings/media/sunxi-cedrus.txt | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/sunxi-cedrus.txt
Documentation/devicetree/bindings/media/sunxi-cedrus.txt new file +54 -0
@@ -0,0 +1,54 @@ +Device-tree bindings for the VPU found in Allwinner SoCs, referred to as the +Video Engine (VE) in Allwinner literature. + +The VPU can only access the first 256 MiB of DRAM, that are DMA-mapped starting +from the DRAM base. This requires specific memory allocation and handling. + +Required properties: +- compatible : must be one of the following compatibles: + - "allwinner,sun4i-a10-video-engine" + - "allwinner,sun5i-a13-video-engine" + - "allwinner,sun7i-a20-video-engine" + - "allwinner,sun8i-a33-video-engine" + - "allwinner,sun8i-h3-video-engine" +- reg : register base and length of VE; +- clocks : list of clock specifiers, corresponding to entries in + the clock-names property; +- clock-names : should contain "ahb", "mod" and "ram" entries; +- resets : phandle for reset; +- interrupts : VE interrupt number; +- allwinner,sram : SRAM region to use with the VE. + +Optional properties: +- memory-region : CMA pool to use for buffers allocation instead of the + default CMA pool. + +Example: + +reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + /* Address must be kept in the lower 256 MiBs of DRAM for VE. */ + cma_pool: cma at 4a000000 { + compatible = "shared-dma-pool"; + size = <0x6000000>; + alloc-ranges = <0x4a000000 0x6000000>; + reusable; + linux,cma-default; + }; +}; + +video-codec at 1c0e000 { + compatible = "allwinner,sun7i-a20-video-engine"; + reg = <0x01c0e000 0x1000>; + + clocks = <&ccu CLK_AHB_VE>, <&ccu CLK_VE>, + <&ccu CLK_DRAM_VE>; + clock-names = "ahb", "mod", "ram"; + + resets = <&ccu RST_VE>; + interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>; + allwinner,sram = <&ve_sram 1>; +};
Signature · 1 line
2.17.1
PATCH v5 18/22 media: platform: Add Sunxi-Cedrus VPU decoder driver
In reply to Paul KocialkowskiThis introduces the Sunxi-Cedrus VPU driver that supports the VPU found in Allwinner SoCs, also known as Video Engine. It is implemented through a v4l2 m2m decoder device and a media device (used for media requests). So far, it only supports MPEG2 decoding.
Since this VPU is stateless, synchronization with media requests is required in order to ensure consistency between frame headers that contain metadata about the frame to process and the raw slice data that is used to generate the frame.
This driver was made possible thanks to the long-standing effort carried out by the linux-sunxi community in the interest of reverse engineering, documenting and implementing support for Allwinner VPU.
--- MAINTAINERS | 7 + drivers/media/platform/Kconfig | 2 + drivers/media/platform/Makefile | 1 + drivers/media/platform/sunxi/Kconfig | 15 + drivers/media/platform/sunxi/Makefile | 1 + drivers/media/platform/sunxi/cedrus/Kconfig | 13 + drivers/media/platform/sunxi/cedrus/Makefile | 3 + drivers/media/platform/sunxi/cedrus/cedrus.c | 374 ++++++++++++ drivers/media/platform/sunxi/cedrus/cedrus.h | 161 +++++ .../media/platform/sunxi/cedrus/cedrus_dec.c | 129 ++++ .../media/platform/sunxi/cedrus/cedrus_dec.h | 27 + .../media/platform/sunxi/cedrus/cedrus_hw.c | 325 ++++++++++ .../media/platform/sunxi/cedrus/cedrus_hw.h | 29 + .../platform/sunxi/cedrus/cedrus_mpeg2.c | 178 ++++++ .../media/platform/sunxi/cedrus/cedrus_regs.h | 195 ++++++ .../platform/sunxi/cedrus/cedrus_video.c | 556 ++++++++++++++++++ .../platform/sunxi/cedrus/cedrus_video.h | 31 + 17 files changed, 2047 insertions(+) create mode 100644 drivers/media/platform/sunxi/Kconfig create mode 100644 drivers/media/platform/sunxi/Makefile create mode 100644 drivers/media/platform/sunxi/cedrus/Kconfig create mode 100644 drivers/media/platform/sunxi/cedrus/Makefile create mode 100644 drivers/media/platform/sunxi/cedrus/cedrus.c create mode 100644 drivers/media/platform/sunxi/cedrus/cedrus.h create mode 100644 drivers/media/platform/sunxi/cedrus/cedrus_dec.c create mode 100644 drivers/media/platform/sunxi/cedrus/cedrus_dec.h create mode 100644 drivers/media/platform/sunxi/cedrus/cedrus_hw.c create mode 100644 drivers/media/platform/sunxi/cedrus/cedrus_hw.h create mode 100644 drivers/media/platform/sunxi/cedrus/cedrus_mpeg2.c create mode 100644 drivers/media/platform/sunxi/cedrus/cedrus_regs.h create mode 100644 drivers/media/platform/sunxi/cedrus/cedrus_video.c create mode 100644 drivers/media/platform/sunxi/cedrus/cedrus_video.h
MAINTAINERS +7 -0
@@ -656,6 +656,13 @@ L: linux-crypto at vger.kernel.org S: Maintained F: drivers/crypto/sunxi-ss/ +ALLWINNER VPU DRIVER +M: Maxime Ripard <[email protected]> +M: Paul Kocialkowski <[email protected]> +L: linux-media at vger.kernel.org +S: Maintained +F: drivers/media/platform/sunxi/cedrus/ + ALPHA PORT M: Richard Henderson <[email protected]> M: Ivan Kokshaysky <[email protected]>
drivers/media/platform/Kconfig +2 -0
@@ -32,6 +32,8 @@ source "drivers/media/platform/davinci/Kconfig" source "drivers/media/platform/omap/Kconfig" +source "drivers/media/platform/sunxi/Kconfig" + config VIDEO_SH_VOU tristate "SuperH VOU video output driver" depends on MEDIA_CAMERA_SUPPORT
drivers/media/platform/Makefile +1 -0
@@ -70,6 +70,7 @@ obj-$(CONFIG_VIDEO_ROCKCHIP_RGA) += rockchip/rga/ obj-y += omap/ obj-$(CONFIG_VIDEO_AM437X_VPFE) += am437x/ +obj-$(CONFIG_VIDEO_SUNXI) += sunxi/ obj-$(CONFIG_VIDEO_XILINX) += xilinx/
drivers/media/platform/sunxi/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +config VIDEO_SUNXI + bool "Allwinner sunXi family Video Devices" + depends on ARCH_SUNXI + help + If you have an Allwinner SoC based on the sunXi family, say Y. + + Note that this option doesn't include new drivers in the + kernel: saying N will just cause Kconfig to skip all the + questions about Allwinner media devices. + +if VIDEO_SUNXI + +source "drivers/media/platform/sunxi/cedrus/Kconfig" + +endif
drivers/media/platform/sunxi/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_VIDEO_SUNXI_CEDRUS) += cedrus/
drivers/media/platform/sunxi/cedrus/Kconfig new file +13 -0
@@ -0,0 +1,13 @@ +config VIDEO_SUNXI_CEDRUS + tristate "Allwinner Cedrus VPU driver" + depends on VIDEO_DEV && VIDEO_V4L2 && MEDIA_CONTROLLER + depends on HAS_DMA + select VIDEOBUF2_DMA_CONTIG + select MEDIA_REQUEST_API + select V4L2_MEM2MEM_DEV + help + Support for the VPU found in Allwinner SoCs, also known as the Cedar + video engine. + + To compile this driver as a module, choose M here: the module + will be called cedrus.
drivers/media/platform/sunxi/cedrus/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +obj-$(CONFIG_VIDEO_SUNXI_CEDRUS) += cedrus.o + +cedrus-y = cedrus.o cedrus_video.o cedrus_hw.o cedrus_dec.o cedrus_mpeg2.o
drivers/media/platform/sunxi/cedrus/cedrus.c new file +374 -0
374 lines not on this page · raw message
drivers/media/platform/sunxi/cedrus/cedrus.h new file +161 -0
161 lines not on this page · raw message
drivers/media/platform/sunxi/cedrus/cedrus_dec.c new file +129 -0
129 lines not on this page · raw message
drivers/media/platform/sunxi/cedrus/cedrus_dec.h new file +27 -0
@@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Sunxi-Cedrus VPU driver +* +* Copyright (C) 2018 Paul Kocialkowski <[email protected]> +* Copyright (C) 2016 Florent Revest <[email protected]> +* +* Based on the vim2m driver, that is: +* +* Copyright (c) 2009-2010 Samsung Electronics Co., Ltd. +* Pawel Osciak, <[email protected]> +* Marek Szyprowski, <[email protected]> +*/ + +#ifndef _CEDRUS_DEC_H_ +#define _CEDRUS_DEC_H_ + +extern const struct v4l2_ioctl_ops cedrus_ioctl_ops; + +void cedrus_device_work (struct work_struct *work); +void cedrus_device_run (void *priv); +void cedrus_job_abort (void *priv); + +int cedrus_queue_init (void *priv,struct vb2_queue *src_vq, +struct vb2_queue *dst_vq); + +#endif
drivers/media/platform/sunxi/cedrus/cedrus_hw.c new file +325 -0
325 lines not on this page · raw message
drivers/media/platform/sunxi/cedrus/cedrus_hw.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Sunxi-Cedrus VPU driver +* +* Copyright (C) 2018 Paul Kocialkowski <[email protected]> +* Copyright (C) 2016 Florent Revest <[email protected]> +* +* Based on the vim2m driver, that is: +* +* Copyright (c) 2009-2010 Samsung Electronics Co., Ltd. +* Pawel Osciak, <[email protected]> +* Marek Szyprowski, <[email protected]> +*/ + +#ifndef _CEDRUS_HW_H_ +#define _CEDRUS_HW_H_ + +#define CEDRUS_CLOCK_RATE_DEFAULT 320000000 + +int cedrus_engine_enable (struct cedrus_dev *dev,enum cedrus_codec codec); +void cedrus_engine_disable (struct cedrus_dev *dev); + +void cedrus_dst_format_set (struct cedrus_dev *dev, +struct v4l2_pix_format_mplane *fmt); + +int cedrus_hw_probe (struct cedrus_dev *dev); +void cedrus_hw_remove (struct cedrus_dev *dev); + +#endif
drivers/media/platform/sunxi/cedrus/cedrus_mpeg2.c new file +178 -0
178 lines not on this page · raw message
drivers/media/platform/sunxi/cedrus/cedrus_regs.h new file +195 -0
195 lines not on this page · raw message
drivers/media/platform/sunxi/cedrus/cedrus_video.c new file +556 -0
556 lines not on this page · raw message
drivers/media/platform/sunxi/cedrus/cedrus_video.h new file +31 -0
@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Sunxi-Cedrus VPU driver +* +* Copyright (C) 2018 Paul Kocialkowski <[email protected]> +* Copyright (C) 2016 Florent Revest <[email protected]> +* +* Based on the vim2m driver, that is: +* +* Copyright (c) 2009-2010 Samsung Electronics Co., Ltd. +* Pawel Osciak, <[email protected]> +* Marek Szyprowski, <[email protected]> +*/ + +#ifndef _CEDRUS_VIDEO_H_ +#define _CEDRUS_VIDEO_H_ + +struct cedrus_format { +u32 pixelformat; +u32 directions; +unsigned int num_planes; +unsigned int num_buffers; +unsigned int capabilities; +}; + +extern const struct v4l2_ioctl_ops cedrus_ioctl_ops; + +int cedrus_queue_init (void *priv,struct vb2_queue *src_vq, +struct vb2_queue *dst_vq); + +#endif
Signature · 1 line
2.17.1
PATCH v5 19/22 ARM: dts: sun5i: Add Video Engine and reserved memory nodes
In reply to Paul KocialkowskiThis adds nodes for the Video Engine and the associated reserved memory for sun5i-based platforms. Up to 96 MiB of memory are dedicated to the CMA pool.
The VPU can only map the first 256 MiB of DRAM, so the reserved memory pool has to be located in that area. Following Allwinner's decision in downstream software, the last 96 MiB of the first 256 MiB of RAM are reserved for this purpose.
--- arch/arm/boot/dts/sun5i.dtsi | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
arch/arm/boot/dts/sun5i.dtsi +28 -0
@@ -108,6 +108,21 @@ }; }; + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + /* Address must be kept in the lower 256 MiBs of DRAM for VE. */ + cma_pool: cma at 4a000000 { + compatible = "shared-dma-pool"; + size = <0x6000000>; + alloc-ranges = <0x4a000000 0x6000000>; + reusable; + linux,cma-default; + }; + }; + soc at 1c00000 { compatible = "simple-bus"; #address-cells = <1>;
@@ -295,6 +310,19 @@ }; }; + vpu: video-codec at 1c0e000 { + compatible = "allwinner,sun5i-a13-video-engine"; + reg = <0x01c0e000 0x1000>; + + clocks = <&ccu CLK_AHB_VE>, <&ccu CLK_VE>, + <&ccu CLK_DRAM_VE>; + clock-names = "ahb", "mod", "ram"; + + resets = <&ccu RST_VE>; + interrupts = <53>; + allwinner,sram = <&ve_sram 1>; + }; + mmc0: mmc at 1c0f000 { compatible = "allwinner,sun5i-a13-mmc"; reg = <0x01c0f000 0x1000>;
Signature · 1 line
2.17.1
PATCH v5 20/22 ARM: dts: sun7i-a20: Add Video Engine and reserved memory nodes
In reply to Paul KocialkowskiThis adds nodes for the Video Engine and the associated reserved memory for the A20. Up to 96 MiB of memory are dedicated to the CMA pool.
The VPU can only map the first 256 MiB of DRAM, so the reserved memory pool has to be located in that area. Following Allwinner's decision in downstream software, the last 96 MiB of the first 256 MiB of RAM are reserved for this purpose.
--- arch/arm/boot/dts/sun7i-a20.dtsi | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
arch/arm/boot/dts/sun7i-a20.dtsi +28 -0
@@ -161,6 +161,21 @@ reg = <0x40000000 0x80000000>; }; + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + /* Address must be kept in the lower 256 MiBs of DRAM for VE. */ + cma_pool: cma at 4a000000 { + compatible = "shared-dma-pool"; + size = <0x6000000>; + alloc-ranges = <0x4a000000 0x6000000>; + reusable; + linux,cma-default; + }; + }; + timer { compatible = "arm,armv7-timer"; interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
@@ -466,6 +481,19 @@ }; }; + vpu: video-codec at 1c0e000 { + compatible = "allwinner,sun7i-a20-video-engine"; + reg = <0x01c0e000 0x1000>; + + clocks = <&ccu CLK_AHB_VE>, <&ccu CLK_VE>, + <&ccu CLK_DRAM_VE>; + clock-names = "ahb", "mod", "ram"; + + resets = <&ccu RST_VE>; + interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>; + allwinner,sram = <&ve_sram 1>; + }; + mmc0: mmc at 1c0f000 { compatible = "allwinner,sun7i-a20-mmc"; reg = <0x01c0f000 0x1000>;
Signature · 1 line
2.17.1
PATCH v5 21/22 ARM: dts: sun8i-a33: Add Video Engine and reserved memory nodes
In reply to Paul KocialkowskiThis adds nodes for the Video Engine and the associated reserved memory for the A33. Up to 96 MiB of memory are dedicated to the CMA pool.
The VPU can only map the first 256 MiB of DRAM, so the reserved memory pool has to be located in that area. Following Allwinner's decision in downstream software, the last 96 MiB of the first 256 MiB of RAM are reserved for this purpose.
--- arch/arm/boot/dts/sun8i-a33.dtsi | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
arch/arm/boot/dts/sun8i-a33.dtsi +29 -0
@@ -181,6 +181,21 @@ reg = <0x40000000 0x80000000>; }; + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + /* Address must be kept in the lower 256 MiBs of DRAM for VE. */ + cma_pool: cma at 4a000000 { + compatible = "shared-dma-pool"; + size = <0x6000000>; + alloc-ranges = <0x4a000000 0x6000000>; + reusable; + linux,cma-default; + }; + }; + sound: sound { compatible = "simple-audio-card"; simple-audio-card,name = "sun8i-a33-audio";
@@ -245,6 +260,20 @@ }; }; + vpu: video-codec at 01c0e000 { + compatible = "allwinner,sun8i-a33-video-engine"; + reg = <0x01c0e000 0x1000>; + + clocks = <&ccu CLK_BUS_VE>, <&ccu CLK_VE>, + <&ccu CLK_DRAM_VE>; + clock-names = "ahb", "mod", "ram"; + + resets = <&ccu RST_BUS_VE>; + + interrupts = <GIC_SPI 58 IRQ_TYPE_LEVEL_HIGH>; + allwinner,sram = <&ve_sram 1>; + }; + crypto: crypto-engine at 1c15000 { compatible = "allwinner,sun4i-a10-crypto"; reg = <0x01c15000 0x1000>;
Signature · 1 line
2.17.1
PATCH v5 22/22 ARM: dts: sun8i-h3: Add Video Engine and reserved memory nodes
In reply to Paul KocialkowskiThis adds nodes for the Video Engine and the associated reserved memory for the H3. Up to 96 MiB of memory are dedicated to the CMA pool.
--- arch/arm/boot/dts/sun8i-h3.dtsi | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
arch/arm/boot/dts/sun8i-h3.dtsi +27 -0
@@ -110,6 +110,20 @@ <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>; }; + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + cma_pool: cma at 4a000000 { + compatible = "shared-dma-pool"; + size = <0x6000000>; + alloc-ranges = <0x4a000000 0x6000000>; + reusable; + linux,cma-default; + }; + }; + soc { system-control at 1c00000 { compatible = "allwinner,sun8i-h3-system-control",
@@ -134,6 +148,19 @@ }; }; + vpu: video-codec at 01c0e000 { + compatible = "allwinner,sun8i-h3-video-engine"; + reg = <0x01c0e000 0x1000>; + + clocks = <&ccu CLK_BUS_VE>, <&ccu CLK_VE>, + <&ccu CLK_DRAM_VE>; + clock-names = "ahb", "mod", "ram"; + + resets = <&ccu RST_BUS_VE>; + interrupts = <GIC_SPI 58 IRQ_TYPE_LEVEL_HIGH>; + allwinner,sram = <&ve_sram 1>; + }; + mali: gpu at 1c40000 { compatible = "allwinner,sun8i-h3-mali", "arm,mali-400"; reg = <0x01c40000 0x10000>;
Signature · 1 line
2.17.1
Re: [PATCH v5 02/22] fixup! v4l2-ctrls: add v4l2_ctrl_request_hdl_find/put/ctrl_find functions
In reply to Paul KocialkowskiQuoted 1 line · Paul Kocialkowski
[PATCH v5 02/22] fixup! v4l2-ctrls: add v4l2_ctrl_request_hdl_find/put/ctrl_find functions
git rebase -i ;-)
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus TorvaldsRe: [PATCH v5 02/22] fixup! v4l2-ctrls: add v4l2_ctrl_request_hdl_find/put/ctrl_find functions
Hi,
Quoted 5 lines · Geert Uytterhoeven
Quoted 1 line · Paul Kocialkowski
[PATCH v5 02/22] fixup! v4l2-ctrls: add v4l2_ctrl_request_hdl_find/put/ctrl_find functions
git rebase -i ;-)
Although I should have mentionned it (and did not), this is totally intentional! The first patch (from Hans Verkuil) requires said fixup to work properly. I didn't want to squash that change into the commit to make the diff obvious.
Ultimately, this framework patch is not really part of the series but is one of its underlying requirements, that should be merged separately (as part of the requests API series).
I hope this clears up some of the confusion about this patch :)
Cheers!
Quoted 4 lines
Gr{oetje,eeting}s,
Geert
Signature · 10 lines
Paul Kocialkowski, Bootlin (formerly Free Electrons) Embedded Linux and kernel engineering https://bootlin.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: This is a digitally signed message part URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180710/8fa5c1f7/attachment.sig>
Re: [PATCH v5 02/22] fixup! v4l2-ctrls: add v4l2_ctrl_request_hdl_find/put/ctrl_find functions
Quoted 5 lines · Paul Kocialkowski
Hi,
Quoted 2 lines · Geert Uytterhoeven
On Tue, Jul 10, 2018 at 10:02 AM Paul Kocialkowski <[email protected]> wrote:
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
[PATCH v5 02/22] fixup! v4l2-ctrls: add v4l2_ctrl_request_hdl_find/put/ctrl_find functions
git rebase -i ;-)
Although I should have mentionned it (and did not), this is totally intentional! The first patch (from Hans Verkuil) requires said fixup to work properly. I didn't want to squash that change into the commit to make the diff obvious.
Just squash the two for the next version you post.
Quoted 3 lines
Ultimately, this framework patch is not really part of the series but is one of its underlying requirements, that should be merged separately (as part of the requests API series).
There is a good chance that this patch will go in via your series anyway since it is not needed by vivid or vim2m.
Regards,
Hans
Quoted 9 lines
I hope this clears up some of the confusion about this patch :)
Cheers!
Quoted 4 lines
Gr{oetje,eeting}s,
Geert
Re: [PATCH v5 02/22] fixup! v4l2-ctrls: add v4l2_ctrl_request_hdl_find/put/ctrl_find functions
Hi,
Quoted 8 lines · Hans Verkuil
Quoted 7 lines · Paul Kocialkowski
Hi,
Quoted 4 lines · Geert Uytterhoeven
Quoted 1 line · Paul Kocialkowski
[PATCH v5 02/22] fixup! v4l2-ctrls: add v4l2_ctrl_request_hdl_find/put/ctrl_find functions
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
git rebase -i ;-)
Although I should have mentionned it (and did not), this is totally intentional! The first patch (from Hans Verkuil) requires said fixup to work properly. I didn't want to squash that change into the commit to make the diff obvious.
Just squash the two for the next version you post.
That works for me! I must admit I was rather unsure this was a sensible way to do things.
Quoted 6 lines
Quoted 3 lines
Ultimately, this framework patch is not really part of the series but is one of its underlying requirements, that should be merged separately (as part of the requests API series).
There is a good chance that this patch will go in via your series anyway since it is not needed by vivid or vim2m.
Alright, I will keep it around then.
Cheers,
Paul
Quoted 15 lines
Regards,
Hans
Quoted 9 lines
I hope this clears up some of the confusion about this patch :)
Cheers!
Quoted 4 lines
Gr{oetje,eeting}s,
Geert
Signature · 10 lines
Paul Kocialkowski, Bootlin (formerly Free Electrons) Embedded Linux and kernel engineering https://bootlin.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: This is a digitally signed message part URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180710/064a3afb/attachment.sig>
Re: [PATCH v5 18/22] media: platform: Add Sunxi-Cedrus VPU decoder driver
In reply to Paul Kocialkowskidrivers/media/platform/sunxi/cedrus/cedrus.c line 334
Quoted 5 lines · Paul Kocialkowski
drivers/media/platform/sunxi/cedrus/cedrus.c new file +5
-0+static int cedrus_remove (struct platform_device *pdev) +{ +struct cedrus_dev *dev =platform_get_drvdata (pdev); + +v4l2_info (&dev->v4l2_dev,"Removing " CEDRUS_NAME );
That log is kind of pointless.
drivers/media/platform/sunxi/cedrus/cedrus_hw.c line 177
Quoted 8 lines
drivers/media/platform/sunxi/cedrus/cedrus_hw.c new file +8
-0+static void cedrus_hw_set_capabilities (struct cedrus_dev *dev) +{ +unsigned int engine_version; + + engine_version =cedrus_read (dev,VE_VERSION ) >>VE_VERSION_SHIFT ; + +if (engine_version >=0x1667 ) + dev->capabilities |=CEDRUS_CAPABILITY_UNTILED ;
The version used here would need a define, but I'm wondering if this is the right solution here. You are using at the same time the version ID returned by the register and the compatible in various places, and they are both redundant. If you want to base the capabilities on the compatible, then you can do it for all of those properties and capabilities, and if you want to use the version register, then you don't need all those compatibles but just one.
I think that basing all our capabilities on the compatible makes more sense, since you need to have access to the registers in order to read the version register, and this changes from one SoC generation to the other (for example, keeping the reset line asserted would prevent you from reading it, and the fact that there is a reset line depends on the SoC).
drivers/media/platform/sunxi/cedrus/cedrus_hw.c line 190
Quoted 11 lines
drivers/media/platform/sunxi/cedrus/cedrus_hw.c new file +11
-0+int cedrus_hw_probe (struct cedrus_dev *dev) +{ +struct resource *res; +int irq_dec; +int ret; + + irq_dec =platform_get_irq (dev->pdev,0 ); +if (irq_dec <=0 ) { +v4l2_err (&dev->v4l2_dev,"Failed to get IRQ\n" ); +return -ENXIO ; + }
You already have an error code returned by platform_get_irq, there's no point in masking it and returning -ENXIO. This can even lead to some bugs, for example when the error code is EPROBE_DEFER.
(and please add a new line there).
drivers/media/platform/sunxi/cedrus/cedrus_hw.c line 197
Quoted 7 lines
drivers/media/platform/sunxi/cedrus/cedrus_hw.c new file +7
-0+ ret =devm_request_threaded_irq (dev->dev, irq_dec, cedrus_irq, + cedrus_bh,0 ,dev_name (dev->dev), + dev); +if (ret) { +v4l2_err (&dev->v4l2_dev,"Failed to request IRQ\n" ); +return -ENXIO ; + }
Same thing here, you're masking the actual error code.
drivers/media/platform/sunxi/cedrus/cedrus_hw.c line 254
Quoted 6 lines
drivers/media/platform/sunxi/cedrus/cedrus_hw.c new file +6
-0+ res =platform_get_resource (dev->pdev,IORESOURCE_MEM ,0 ); + dev->base =devm_ioremap_resource (dev->dev, res); +if (!dev->base) { +v4l2_err (&dev->v4l2_dev,"Failed to map registers\n" ); + + ret = -EFAULT ;
ENOMEM is usually returned in such a case.
Quoted 5 lines
drivers/media/platform/sunxi/cedrus/cedrus_hw.c new file +5
-0+ goto err_sram; + } + + ret =clk_set_rate (dev->mod_clk,CEDRUS_CLOCK_RATE_DEFAULT ); +if (ret) {
drivers/media/platform/sunxi/cedrus/cedrus_hw.c line 269
Quoted 10 lines
drivers/media/platform/sunxi/cedrus/cedrus_hw.c new file +10
-0+v4l2_err (&dev->v4l2_dev,"Failed to set clock rate\n" ); + goto err_sram; + } + + ret =clk_prepare_enable (dev->ahb_clk); +if (ret) { +v4l2_err (&dev->v4l2_dev,"Failed to enable AHB clock\n" ); + + ret = -EFAULT ; + goto err_sram;
Same thing for the error code.
drivers/media/platform/sunxi/cedrus/cedrus_hw.c line 277
Quoted 8 lines
drivers/media/platform/sunxi/cedrus/cedrus_hw.c new file +8
-0+ } + + ret =clk_prepare_enable (dev->mod_clk); +if (ret) { +v4l2_err (&dev->v4l2_dev,"Failed to enable MOD clock\n" ); + + ret = -EFAULT ; + goto err_ahb_clk;
Ditto.
drivers/media/platform/sunxi/cedrus/cedrus_hw.c line 285
Quoted 8 lines
drivers/media/platform/sunxi/cedrus/cedrus_hw.c new file +8
-0+ } + + ret =clk_prepare_enable (dev->ram_clk); +if (ret) { +v4l2_err (&dev->v4l2_dev,"Failed to enable RAM clock\n" ); + + ret = -EFAULT ; + goto err_mod_clk;
Ditto.
drivers/media/platform/sunxi/cedrus/cedrus_hw.c line 292
Quoted 7 lines
drivers/media/platform/sunxi/cedrus/cedrus_hw.c new file +7
-0+ } + + ret =reset_control_reset (dev->rstc); +if (ret) { +v4l2_err (&dev->v4l2_dev,"Failed to apply reset\n" ); + + ret = -EFAULT ;
Ditto.
There's also a bunch of warnings/checks reported by checkpatch that should be fixed in the next iteration: the spaces after a cast, the NULL comparison, macros arguments precedence, parenthesis alignments issues, etc.)
Thanks!
Maxime
Signature · 10 lines
Maxime Ripard, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180710/8e9d4db5/attachment.sig>
Re: [PATCH v5 20/22] ARM: dts: sun7i-a20: Add Video Engine and reserved memory nodes
In reply to Paul Kocialkowskiarch/arm/boot/dts/sun7i-a20.dtsi line 487
Quoted 4 lines · Paul Kocialkowski
arch/arm/boot/dts/sun7i-a20.dtsi +4
-0+ vpu: video-codec at 1c0e000 { + compatible = "allwinner,sun7i-a20-video-engine"; + reg = <0x01c0e000 0x1000>; +
The issue is here with all your patches, but you should drop the node label and the extra new line.
Maxime
Signature · 10 lines
Maxime Ripard, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180710/889d9f7c/attachment.sig>
Re: [PATCH v5 03/22] dt-bindings: sram: sunxi: Introduce new A10 binding for system-control
In reply to Paul KocialkowskiQuoted 10 lines · Paul Kocialkowski
Following-up on the introduction of a new binding for the A64, this introduces a system-control binding for the A10 as a replacement of the sram-controller binding.
This change is motivated by consistency with the Allwinner literature, that mentions system control over SRAM controller. Moreover, the system control block is sometimes used for more than SRAM (e.g. for muxing related to the ethernet PHY).
Signed-off-by Paul Kocialkowski <[email protected]>
Re: [PATCH v5 04/22] dt-bindings: sram: sunxi: Add A13, A20, A23 and H3 dedicated bindings
In reply to Paul KocialkowskiQuoted 11 lines · Paul Kocialkowski
This introduces dedicated bindings for the system control blocks found on the A13, A20, A23 and H3 sunxi platforms.
Since the controllers on the A33 are the very same as those on the A23, no specific compatible is introduced for it.
These bindings are introduced to allow reflecting the differences that exist between these controllers, that may become significant to driver implementations.
Signed-off-by Paul Kocialkowski <[email protected]>
Not sure if there's a difference between A10 and A20, if you don't count the NMI that we have a separate node for. But anyway,
Re: [PATCH v5 05/22] dt-bindings: sram: sunxi: Populate valid sections compatibles
In reply to Paul KocialkowskiQuoted 6 lines · Paul Kocialkowski
This adds a list of valid SRAM sections compatibles for the A13, A20, A23 and H3 platforms. Per-platform compatibles are introduced for the SRAM sections of these platforms, with the A10 compatibles also listed as valid when applicable.
In particular, compatibles for the C1 SRAM section are introduced.
You should probably mention that this is not an exhaustive list. In particular, the C2 and C3 (sun5i) mappings are still missing.
Quoted 30 lines
Signed-off-by Paul Kocialkowski <[email protected]>--- .../devicetree/bindings/sram/sunxi-sram.txt | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+)Documentation/devicetree/bindings/sram/sunxi-sram.txt +14
-0@@ -32,8 +32,33 @@ once again the representation described in the mmio-sram binding. The valid sections compatible for A10 are: - allwinner,sun4i-a10-sram-a3-a4 + - allwinner,sun4i-a10-sram-c1 - allwinner,sun4i-a10-sram-d +The valid sections compatible for A13 are: + - allwinner,sun5i-a13-sram-a3-a4 + - allwinner,sun4i-a10-sram-a3-a4 + - allwinner,sun5i-a13-sram-c1 + - allwinner,sun4i-a10-sram-c1 + - allwinner,sun5i-a13-sram-d + - allwinner,sun4i-a10-sram-d + +The valid sections compatible for A20 are: + - allwinner,sun7i-a20-sram-a3-a4 + - allwinner,sun4i-a10-sram-a3-a4 + - allwinner,sun7i-a20-sram-c1 + - allwinner,sun4i-a10-sram-c1
Documentation/devicetree/bindings/sram/sunxi-sram.txt once again the representation described in the mmio-sram binding. · line 60
Quoted 10 lines
Documentation/devicetree/bindings/sram/sunxi-sram.txt +10
-0+ - allwinner,sun7i-a20-sram-d + - allwinner,sun4i-a10-sram-d + +The valid sections compatible for A23/A33 are: + - allwinner,sun8i-a23-sram-c1 + - allwinner,sun4i-a10-sram-c1 + +The valid sections compatible for H3 are: + - allwinner,sun8i-h3-sram-c1 + - allwinner,sun4i-a10-sram-c1
I'm not quite sure why we want to list these... I think it makes more sense to just have the SoC specific compatible. They are tied to the controls after all. Maybe Rob has a different opinion?
ChenYu
Quoted 7 lines
Documentation/devicetree/bindings/sram/sunxi-sram.txt +1
-1+ The valid sections compatible for A64 are: - allwinner,sun50i-a64-sram-c --2.17.1
Re: [PATCH v5 06/22] soc: sunxi: sram: Add dt match for the A10 system-control compatible
In reply to Paul KocialkowskiQuoted 4 lines · Paul Kocialkowski
This binds the new A10 system-control compatible to the associated driver, with the same driver data as the previous compatible.
Signed-off-by Paul Kocialkowski <[email protected]>
Re: [PATCH v5 07/22] drivers: soc: sunxi: Add support for the C1 SRAM region
In reply to Paul KocialkowskiQuoted 7 lines · Paul Kocialkowski
From: Maxime Ripard <[email protected]>
This introduces support for the SRAM C1 section, that is controlled by the system controller. This SRAM area can be muxed either to the CPU or the Video Engine, that needs this area to store various tables (e.g. the Huffman VLD decoding tables).
Quoted 5 lines
This only supports devices with the same layout as the A10 (which also includes the A13, A20, A33 and other SoCs).
Signed-off-by Maxime Ripard <[email protected]>Signed-off-by Paul Kocialkowski <[email protected]>
Re: [PATCH v5 08/22] ARM: dts: sun4i-a10: Use system-control compatible
In reply to Paul KocialkowskiOn Tue, Jul 10, 2018 at 4:01 PM, Paul Kocialkowski <[email protected]> wrote:
Subject prefix should be "ARM: dts: sun4i:"
We don't need the "a10" part since the A10 owns into this category all by itself.
Also, it doesn't say what the system control compatible is for. "Switch to new system control compatible string" would be slightly better.
Quoted 5 lines
This switches the sun4i-a10 dtsi to use the new compatible for the system-control block (previously named SRAM controller) instead of the deprecated one.
The phandle is also updated to reflect the fact that the controller
The label actually.
ChenYu
Quoted 25 lines
described is really about system control rather than SRAM control.
Signed-off-by Paul Kocialkowski <[email protected]>--- arch/arm/boot/dts/sun4i-a10.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/arm/boot/dts/sun4i-a10.dtsi +2
-3@@ -190,8 +190,8 @@ #size-cells = <1>; ranges; - sram-controller at 1c00000 { - compatible = "allwinner,sun4i-a10-sram-controller"; + system-control at 1c00000 { + compatible = "allwinner,sun4i-a10-system-control"; reg = <0x01c00000 0x30>; #address-cells = <1>; #size-cells = <1>; --2.17.1
Re: [linux-sunxi] [PATCH v5 09/22] ARM: dts: sun5i: Use most-qualified system control compatibles
In reply to Paul KocialkowskiQuoted 4 lines · Paul Kocialkowski
This switches the sun5i dtsi to use the most qualified compatibles for the system-control block (previously named SRAM controller) as well as the SRAM blocks. The sun4i-a10 compatibles are kept since these hardware blocks are backward-compatible.
Not quite sure why they are backward-compatible. The A13 has less SRAM mapping controls than the A10.
ChenYu
Quoted 52 lines
The phandle for system control is also updated to reflect the fact that the controller described is really about system control rather than SRAM control.
Signed-off-by Paul Kocialkowski <[email protected]>--- arch/arm/boot/dts/sun5i.dtsi | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)arch/arm/boot/dts/sun5i.dtsi +7
-5@@ -114,8 +114,9 @@ #size-cells = <1>; ranges; - sram-controller at 1c00000 { - compatible = "allwinner,sun4i-a10-sram-controller"; + system-control at 1c00000 { + compatible = "allwinner,sun5i-a13-system-control", + "allwinner,sun4i-a10-system-control"; reg = <0x01c00000 0x30>; #address-cells = <1>; #size-cells = <1>;@@ -130,7 +131,8 @@ }; emac_sram: sram-section at 8000 { - compatible = "allwinner,sun4i-a10-sram-a3-a4"; + compatible = "allwinner,sun5i-a13-sram-a3-a4", + "allwinner,sun4i-a10-sram-a3-a4"; reg = <0x8000 0x4000>; status = "disabled"; };@@ -143,7 +145,8 @@ ranges = <0 0x00010000 0x1000>; otg_sram: sram-section at 0 { - compatible = "allwinner,sun4i-a10-sram-d"; + compatible = "allwinner,sun5i-a13-sram-d", + "allwinner,sun4i-a10-sram-d"; reg = <0x0000 0x1000>; status = "disabled"; }; --2.17.1
--
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe at googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [linux-sunxi] [PATCH v5 10/22] ARM: dts: sun7i-a20: Use most-qualified system control compatibles
In reply to Paul KocialkowskiQuoted 10 lines · Paul Kocialkowski
This switches the sun7i-a20 dtsi to use the most qualified compatibles for the system-control block (previously named SRAM controller) as well as the SRAM blocks. The sun4i-a10 compatibles are kept since these hardware blocks are backward-compatible.
The phandle for system control is also updated to reflect the fact that the controller described is really about system control rather than SRAM control.
Signed-off-by Paul Kocialkowski <[email protected]>
But see discussion about the SRAM mapping compatibles.
Re: [PATCH v5 11/22] ARM: sun5i: Add support for the C1 SRAM region with the SRAM controller
In reply to Paul KocialkowskiQuoted 8 lines · Paul Kocialkowski
From: Maxime Ripard <[email protected]>
This adds support for the C1 SRAM region (to be used with the SRAM controller driver) for sun5i-based platforms. The region is shared between the Video Engine and the CPU.
Signed-off-by Maxime Ripard <[email protected]>Signed-off-by Paul Kocialkowski <[email protected]>
But again, see discussion about SRAM compatibles.
Re: [PATCH v5 08/22] ARM: dts: sun4i-a10: Use system-control compatible
In reply to Chen-Yu TsaiQuoted 12 lines · Chen-Yu Tsai
On Tue, Jul 10, 2018 at 4:01 PM, Paul Kocialkowski <[email protected]> wrote:
Subject prefix should be "ARM: dts: sun4i:"
We don't need the "a10" part since the A10 owns into this category all by itself.
Also, it doesn't say what the system control compatible is for. "Switch to new system control compatible string" would be slightly better.
Quoted 7 lines
Quoted 5 lines
This switches the sun4i-a10 dtsi to use the new compatible for the system-control block (previously named SRAM controller) instead of the deprecated one.
The phandle is also updated to reflect the fact that the controller
The label actually.
Node name, actually :)
Maxime
Signature · 10 lines
Maxime Ripard, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180710/bb82b662/attachment-0001.sig>
Re: [PATCH v5 18/22] media: platform: Add Sunxi-Cedrus VPU decoder driver
In reply to Paul KocialkowskiHey Paul,
My comments on v4 of course apply here as well.
One other thing...
Quoted 20 lines · Paul Kocialkowski
This introduces the Sunxi-Cedrus VPU driver that supports the VPU found
in Allwinner SoCs, also known as Video Engine. It is implemented through
a v4l2 m2m decoder device and a media device (used for media requests).
So far, it only supports MPEG2 decoding.Since this VPU is stateless, synchronization with media requests is required in order to ensure consistency between frame headers that contain metadata about the frame to process and the raw slice data that
is used to generate the frame.This driver was made possible thanks to the long-standing effort carried out by the linux-sunxi community in the interest of reverse engineering, documenting and implementing support for Allwinner VPU.
Signed-off-by Paul Kocialkowski <[email protected]>
[..]
Quoted 11 lines
drivers/media/platform/sunxi/cedrus/cedrus_hw.c new file +10
-0+ +static irqreturn_t cedrus_bh (int irq,void *data) +{ +struct cedrus_dev *dev = data; +struct cedrus_ctx *ctx; + + ctx =v4l2_m2m_get_curr_priv (dev->m2m_dev); +if (!ctx) { + v4l2_err(&dev->v4l2_dev, + "Instance released before the end oftransaction\n");
drivers/media/platform/sunxi/cedrus/cedrus_hw.c line 113
Quoted 5 lines
drivers/media/platform/sunxi/cedrus/cedrus_hw.c new file +5
-0+return IRQ_HANDLED ; + } + +v4l2_m2m_job_finish (ctx->dev->m2m_dev, ctx->fh.m2m_ctx); +
I don't like the fact that v4l2_m2m_job_finish calls .device_run reentrantly. Let me try to make v4l2_m2m_job_finish() safe to be called in atomic context, so hopefully drivers can just call it in the top- half.
You are returning the buffers in the top-half, so this is just a matter or better design, not a performance improvement.
Thanks,
Eze
Maxime Ripard
AppliedRe: [PATCH v5 03/22] dt-bindings: sram: sunxi: Introduce new A10 binding for system-control
In reply to Paul KocialkowskiQuoted 10 lines · Paul Kocialkowski
Following-up on the introduction of a new binding for the A64, this introduces a system-control binding for the A10 as a replacement of the sram-controller binding.
This change is motivated by consistency with the Allwinner literature, that mentions system control over SRAM controller. Moreover, the system control block is sometimes used for more than SRAM (e.g. for muxing related to the ethernet PHY).
Signed-off-by Paul Kocialkowski <[email protected]>
Applied, thanks!
Maxime
Signature · 10 lines
Maxime Ripard, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180711/c4ebea48/attachment.sig>
Maxime Ripard
AppliedRe: [PATCH v5 06/22] soc: sunxi: sram: Add dt match for the A10 system-control compatible
In reply to Paul KocialkowskiQuoted 4 lines · Paul Kocialkowski
This binds the new A10 system-control compatible to the associated driver, with the same driver data as the previous compatible.
Signed-off-by Paul Kocialkowski <[email protected]>
Applied, thanks!
Maxime
Signature · 10 lines
Maxime Ripard, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180711/221fb320/attachment-0001.sig>
Re: [PATCH v5 04/22] dt-bindings: sram: sunxi: Add A13, A20, A23 and H3 dedicated bindings
In reply to Chen-Yu TsaiQuoted 12 lines · Chen-Yu Tsai
Quoted 10 lines · Paul Kocialkowski
This introduces dedicated bindings for the system control blocks found on the A13, A20, A23 and H3 sunxi platforms.
Since the controllers on the A33 are the very same as those on the A23, no specific compatible is introduced for it.
These bindings are introduced to allow reflecting the differences that exist between these controllers, that may become significant to driver implementations.
Quoted 6 lines
Quoted 1 line
Signed-off-by Paul Kocialkowski <[email protected]>Not sure if there's a difference between A10 and A20, if you don't count the NMI that we have a separate node for. But anyway,
Reviewed-by Chen-Yu Tsai <[email protected]>
I've applied it, adding the A10 fallback compatible for the A20.
Maxime
Signature · 10 lines
Maxime Ripard, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180711/ada2e66a/attachment.sig>
Re: [PATCH v5 05/22] dt-bindings: sram: sunxi: Populate valid sections compatibles
In reply to Chen-Yu TsaiQuoted 48 lines · Chen-Yu Tsai
Quoted 6 lines · Paul Kocialkowski
This adds a list of valid SRAM sections compatibles for the A13, A20, A23 and H3 platforms. Per-platform compatibles are introduced for the SRAM sections of these platforms, with the A10 compatibles also listed as valid when applicable.
In particular, compatibles for the C1 SRAM section are introduced.
You should probably mention that this is not an exhaustive list. In particular, the C2 and C3 (sun5i) mappings are still missing.
Quoted 36 lines
Signed-off-by Paul Kocialkowski <[email protected]>--- .../devicetree/bindings/sram/sunxi-sram.txt | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+)Documentation/devicetree/bindings/sram/sunxi-sram.txt +20
-0@@ -32,8 +32,33 @@ once again the representation described in the mmio-sram binding. The valid sections compatible for A10 are: - allwinner,sun4i-a10-sram-a3-a4 + - allwinner,sun4i-a10-sram-c1 - allwinner,sun4i-a10-sram-d +The valid sections compatible for A13 are: + - allwinner,sun5i-a13-sram-a3-a4 + - allwinner,sun4i-a10-sram-a3-a4 + - allwinner,sun5i-a13-sram-c1 + - allwinner,sun4i-a10-sram-c1 + - allwinner,sun5i-a13-sram-d + - allwinner,sun4i-a10-sram-d + +The valid sections compatible for A20 are: + - allwinner,sun7i-a20-sram-a3-a4 + - allwinner,sun4i-a10-sram-a3-a4 + - allwinner,sun7i-a20-sram-c1 + - allwinner,sun4i-a10-sram-c1 + - allwinner,sun7i-a20-sram-d + - allwinner,sun4i-a10-sram-d + +The valid sections compatible for A23/A33 are: + - allwinner,sun8i-a23-sram-c1 + - allwinner,sun4i-a10-sram-c1
Quoted 8 lines
Documentation/devicetree/bindings/sram/sunxi-sram.txt once again the representation described in the mmio-sram binding. · line 60
Quoted 4 lines
Documentation/devicetree/bindings/sram/sunxi-sram.txt +4
-0+ +The valid sections compatible for H3 are: + - allwinner,sun8i-h3-sram-c1 + - allwinner,sun4i-a10-sram-c1I'm not quite sure why we want to list these... I think it makes more sense to just have the SoC specific compatible. They are tied to the controls after all. Maybe Rob has a different opinion?
We had that discussion not so long ago, and the outcome was to list the SoC specific and the fallback compatibles on the same line. I've amended the patch to do so and applied.
(and added the mention of the C2 and C3 SRAMs as you suggested)
Maxime
Signature · 10 lines
Maxime Ripard, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180711/0a5663df/attachment-0001.sig>
Re: [linux-sunxi] [PATCH v5 09/22] ARM: dts: sun5i: Use most-qualified system control compatibles
In reply to Chen-Yu TsaiQuoted 9 lines · Chen-Yu Tsai
Quoted 4 lines · Paul Kocialkowski
This switches the sun5i dtsi to use the most qualified compatibles for the system-control block (previously named SRAM controller) as well as the SRAM blocks. The sun4i-a10 compatibles are kept since these hardware blocks are backward-compatible.
Not quite sure why they are backward-compatible. The A13 has less SRAM mapping controls than the A10.
I've applied this patch, and removed that compatible (and its mention in the commit log).
Signature · 10 lines
Maxime Ripard, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180711/f852be1d/attachment.sig>
Re: [PATCH v5 11/22] ARM: sun5i: Add support for the C1 SRAM region with the SRAM controller
In reply to Chen-Yu TsaiQuoted 8 lines · Chen-Yu Tsai
Quoted 6 lines · Paul Kocialkowski
From: Maxime Ripard <[email protected]>
This adds support for the C1 SRAM region (to be used with the SRAM controller driver) for sun5i-based platforms. The region is shared between the Video Engine and the CPU.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Maxime Ripard <[email protected]>Signed-off-by Paul Kocialkowski <[email protected]>Reviewed-by Chen-Yu Tsai <[email protected]>But again, see discussion about SRAM compatibles.
I've fixed the SRAM C size (which is 0xd0000 and not 0x80000) and applied, thanks!
Maxime
Signature · 10 lines
Maxime Ripard, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180711/d585deb3/attachment.sig>
Re: [PATCH v5 12/22] ARM: sun7i-a20: Add support for the C1 SRAM region with the SRAM controller
In reply to Paul KocialkowskiQuoted 8 lines · Paul Kocialkowski
From: Maxime Ripard <[email protected]>
This adds support for the C1 SRAM region (to be used with the SRAM controller driver) for the A20 platform. The region is shared between the Video Engine and the CPU.
Signed-off-by Maxime Ripard <[email protected]>Signed-off-by Paul Kocialkowski <[email protected]>
Fixed the SRAM size and applied.
Maxime
Signature · 10 lines
Maxime Ripard, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180711/5a756ef9/attachment.sig>
Re: [PATCH v5 13/22] ARM: sun8i-a23-a33: Add SRAM controller node and C1 SRAM region
In reply to Paul KocialkowskiQuoted 7 lines · Paul Kocialkowski
From: Maxime Ripard <[email protected]>
This adds a SRAM controller node for the A23 and A33, with support for the C1 SRAM region that is shared between the Video Engine and the CPU.
Signed-off-by Maxime Ripard <[email protected]>Signed-off-by Paul Kocialkowski <[email protected]>
Fixed the compatible and the commit prefix and applied.
Maxime
Signature · 10 lines
Maxime Ripard, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180711/13c6a1c6/attachment.sig>
Re: [PATCH v5 14/22] ARM: sun8i-h3: Add SRAM controller node and C1 SRAM region
In reply to Paul KocialkowskiQuoted 4 lines · Paul Kocialkowski
This adds a SRAM controller node for the H3, with support for the C1 SRAM region that is shared between the Video Engine and the CPU.
Signed-off-by Paul Kocialkowski <[email protected]>
Fixed the commit prefix and the compatible and applied, thanks! Maxime
Signature · 10 lines
Maxime Ripard, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180711/fad409af/attachment.sig>
Re: [PATCH v5 20/22] ARM: dts: sun7i-a20: Add Video Engine and reserved memory nodes
In reply to Maxime RipardHi,
Quoted 8 lines · Maxime Ripard
arch/arm/boot/dts/sun7i-a20.dtsi line 487
Quoted 4 lines · Paul Kocialkowski
arch/arm/boot/dts/sun7i-a20.dtsi +4
-0+ vpu: video-codec at 1c0e000 { + compatible = "allwinner,sun7i-a20-video-engine"; + reg = <0x01c0e000 0x1000>; +The issue is here with all your patches, but you should drop the node label and the extra new line.
Noted, this will be fixed in the next revision.
Cheers,
Paul
Signature · 10 lines
Paul Kocialkowski, Bootlin (formerly Free Electrons) Embedded Linux and kernel engineering https://bootlin.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: This is a digitally signed message part URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180713/fd3f168d/attachment.sig>
Re: [PATCH v5 18/22] media: platform: Add Sunxi-Cedrus VPU decoder driver
In reply to Ezequiel GarciaHi,
Quoted 3 lines · Ezequiel Garcia
Hey Paul,
My comments on v4 of course apply here as well.
Yes, it seems that most of your comments were not already adressed by this v5. I will answer your remarks and suggestions on the v4 thread.
Quoted 38 lines
One other thing...
Quoted 20 lines · Paul Kocialkowski
This introduces the Sunxi-Cedrus VPU driver that supports the VPU found
in Allwinner SoCs, also known as Video Engine. It is implemented through
a v4l2 m2m decoder device and a media device (used for media requests).
So far, it only supports MPEG2 decoding.Since this VPU is stateless, synchronization with media requests is required in order to ensure consistency between frame headers that contain metadata about the frame to process and the raw slice data that
is used to generate the frame.This driver was made possible thanks to the long-standing effort carried out by the linux-sunxi community in the interest of reverse engineering, documenting and implementing support for Allwinner VPU.
Signed-off-by Paul Kocialkowski <[email protected]>[..]
Quoted 13 lines
drivers/media/platform/sunxi/cedrus/cedrus_hw.c new file +10
-0+ +static irqreturn_t cedrus_bh (int irq,void *data) +{ +struct cedrus_dev *dev = data; +struct cedrus_ctx *ctx; + + ctx =v4l2_m2m_get_curr_priv (dev->m2m_dev); +if (!ctx) { + v4l2_err(&dev->v4l2_dev, + "Instance released before the end oftransaction\n");
(quoted diff) +2
-0+ return IRQ_HANDLED; + }
Quoted 8 lines
drivers/media/platform/sunxi/cedrus/cedrus_dec.c line 99
Quoted 3 lines
drivers/media/platform/sunxi/cedrus/cedrus_dec.c new file +3
-0+ +v4l2_m2m_job_finish (ctx->dev->m2m_dev, ctx->fh.m2m_ctx); +I don't like the fact that
v4l2_m2m_job_finishcalls .device_run reentrantly. Let me try to makev4l2_m2m_job_finish()safe to be called in atomic context, so hopefully drivers can just call it in the top- half.
Thanks for your patches in this direction, I will try them and hopefully base our next Sunxi-Cedrus version on them, if it seems that this framework change will be picked-up by maintainers.
Quoted 2 lines
You are returning the buffers in the top-half, so this is just a matter or better design, not a performance improvement.
This is definitely a nice design improvement IMO (if not only for avoiding reentrancy)!
And this reduces our code path between starting decoding and userspace notification that decoding finished. Starting the worker thread is no longer required before notifying userspace, so I think we are going to see performance improvements from this. Hopefully, the worker thread will run while userspace is busy preparing the next frame, so this should work a lot better for us!
Cheers,
Paul
Signature · 10 lines
Paul Kocialkowski, Bootlin (formerly Free Electrons) Embedded Linux and kernel engineering https://bootlin.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: This is a digitally signed message part URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180713/2680b4da/attachment-0001.sig>
Re: [PATCH v5 18/22] media: platform: Add Sunxi-Cedrus VPU decoder driver
In reply to Maxime RipardHi,
Quoted 8 lines · Maxime Ripard
drivers/media/platform/sunxi/cedrus/cedrus.c line 334
Quoted 5 lines · Paul Kocialkowski
drivers/media/platform/sunxi/cedrus/cedrus.c new file +5
-0+static int cedrus_remove (struct platform_device *pdev) +{ +struct cedrus_dev *dev =platform_get_drvdata (pdev); + +v4l2_info (&dev->v4l2_dev,"Removing " CEDRUS_NAME );That log is kind of pointless.
Fair enough, I'll get rid of it.
Quoted 17 lines
drivers/media/platform/sunxi/cedrus/cedrus_hw.c line 177
Quoted 8 lines
drivers/media/platform/sunxi/cedrus/cedrus_hw.c new file +8
-0+static void cedrus_hw_set_capabilities (struct cedrus_dev *dev) +{ +unsigned int engine_version; + + engine_version =cedrus_read (dev,VE_VERSION ) >>VE_VERSION_SHIFT ; + +if (engine_version >=0x1667 ) + dev->capabilities |=CEDRUS_CAPABILITY_UNTILED ;The version used here would need a define, but I'm wondering if this is the right solution here. You are using at the same time the version ID returned by the register and the compatible in various places, and they are both redundant. If you want to base the capabilities on the compatible, then you can do it for all of those properties and capabilities, and if you want to use the version register, then you don't need all those compatibles but just one.
Quoted 6 lines
I think that basing all our capabilities on the compatible makes more sense, since you need to have access to the registers in order to read the version register, and this changes from one SoC generation to the other (for example, keeping the reset line asserted would prevent you from reading it, and the fact that there is a reset line depends on the SoC).
I concur, let's move this to a compatible-based logic instead!
Quoted 7 lines
Quoted 7 lines
drivers/media/platform/sunxi/cedrus/cedrus_hw.c new file +7
-0+int cedrus_hw_probe (struct cedrus_dev *dev) +{ +struct resource *res; +int irq_dec; +int ret; + + irq_dec =platform_get_irq (dev->pdev,0 );
Quoted 8 lines
drivers/media/platform/sunxi/cedrus/cedrus_hw.c line 190
Quoted 4 lines
drivers/media/platform/sunxi/cedrus/cedrus_hw.c new file +4
-0+if (irq_dec <=0 ) { +v4l2_err (&dev->v4l2_dev,"Failed to get IRQ\n" ); +return -ENXIO ; + }You already have an error code returned by
platform_get_irq, there's no point in masking it and returning-ENXIO. This can even lead to some bugs, for example when the error code isEPROBE_DEFER.
Right, I'll fix this and all the similar issues you mentionned.
[...]
Quoted 4 lines
There's also a bunch of warnings/checks reported by checkpatch that should be fixed in the next iteration: the spaces after a cast, the NULL comparison, macros arguments precedence, parenthesis alignments issues, etc.)
Thanks, I'll look into that for the next revision.
Cheers,
Paul
Signature · 10 lines
Paul Kocialkowski, Bootlin (formerly Free Electrons) Embedded Linux and kernel engineering https://bootlin.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: This is a digitally signed message part URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180724/2e27a68b/attachment.sig>