Overview of Arm komeda display driver
Subsystems (6)
v4 cover Overview of Arm komeda display driver
This is the first patchset of ARM new komeda display driver, this patchset added all basic structure of komeda, relationship of DRM-KMS with komeda, for tring to give a brife overview of komeda-driver.
komeda is for supporting the ARM display processor D71 and later IPs, Since from D71, Arm display IP begins to adopt a flexible and modularized architecture:
A display pipeline is made up of multiple individual and functional pipeline stages called components, and every component has some specific capabilities that can give the flowed pipeline pixel data a specific data processing.
The typical components like:
- Layer:
Layer is the first pipeline stage, It fetches the pixel from memory and prepare the source pixel data for the next stage, like rotation, format, color-space handling.
- Scaler:
As its name, scaler is for scaling and image enhancement.
- Compositor (compiz)
Compositor is for blending multiple layers or pixel data flows into one single display frame.
- Writeback Layer (wb_layer)
Writeback layer do the opposite things of Layer, Which connect to compiz for writing the composition result to memory.
- Post image processor (improc)
Post image processor is for adjusting frame data like gamma and color space to fit the requirements of the monitor.
- Timing controller (timing_ctrlr)
Final stage of display pipeline, Timing controller is not for the pixel handling, but only for controlling the display timing.
Benefitting from the modularized architecture, D71 pipelines can be easily adjusted to fit different usages. And D71 has two pipelines, which support two types of working mode:
- Dual display mode
Two pipelines work independently and separately to drive two display outputs.
- Single pipeline data flow
Layer_0 -> (scaler) ->\
Layer_1 -> (scaler) ->\ /-> (scaler) -> wb_layer -> memory
compiz ->
Layer_2 -> (scaler) ->/ \-> improc ->timing_ctrlr ->monitor
Layer_3 -> (scaler) ->/- Single display mode
Two pipelines work together to drive only one display output.
On this mode, pipeline_B doesn't work indenpendently, but outputs its composition result into pipeline_A, and its pixel timing also derived from pipeline_A.timing_ctrlr. The pipeline_B works just like a "slave" of pipeline_A(master)
- Slave enabled data flow
Layer_0 -> (scaler) ->\
Layer_1 -> (scaler) ->\
compiz_B -> compiz_A
Layer_2 -> (scaler) ->/
Layer_3 -> (scaler) ->/ compiz_B ->\
Layer_4 -> (scaler) ->\
Layer_5 -> (scaler) ->\ /-> (scaler) -> wb_layer -> memory
compiz_A -> Layer_6 -> (scaler) ->/ \-> improc ->timing_ctrlr ->monitor
Layer_7 -> (scaler) ->/
To fully utilize and easily access/configure the HW, komeda use a similar
architecture: Pipeline/Component to describe the HW features and capabilities. Add the DRM-KMS consideration. then:
A Komeda driver is comprised of two layers of data structures:
1. komeda_dev/pipeline/component
Which are used by komeda driver to describe and abstract a display HW.
- komeda_layer/scaler/compiz/improc/timing_ctrlr
for describing a specific pipeline component stage.
- komeda_pipeline
for abstracting a display pipeline and the pipeline is composed of multiple components.
- komeda_dev
for the whole view of the device, manage the pipeline, irq, and the other control-abilites of device.
2. komeda_kms_dev/crtc/plane:
Which connect Komeda-dev to DRM-KMS, basically it collects and organizes komeda_dev's capabilities and resurces by DRM-KMS's way (crtc/plane/connector), and convert the DRM-KMS's requirement to the real komeda_dev's configuration.
So generally, the komeda_dev is like a resource collection, and the komeda_kms is a group of users (crtc/plane/wb_connector), the drm_state defined or described the resource requirement of user, and every KMS-OBJ maps or represents to a specific komeda data pipeline:
- Plane: Layer -> (Scaler) -> Compiz
- Wb_connector: Compiz-> (scaler) -> Wb_layer -> memory
- Crtc: Compiz -> Improc -> Timing_Ctrlr -> Monitor
The features and properties of KMS-OBJ based on the mapping pipeline, and the komeda_kms level function (crtc/plane/wb_connector->atomic_check) actually is for pickuping suitable pipeline and component resources, configure them to a specific state and build these input/output pipeline of komeda to fit the requirement.
Furthermore, To support multiple IPs, komeda_dev has been split into two layers:
- Komeda-CORE or common layer.
for the common feature validation and handling
- Komeda-CHIP.
for reporting and exposing the HW resource by CORE's way, the HW register programming and updating.
With this two Layer's device abstraction, the most operations are handled in Komeda-CORE, the Komeda-CHIP is only for CHIP-specific stuff, easy for adding new chipset or IP in future.
v4
- Address Liviu and Daniel's comments.
v3:
- Fixed style problem found by checkpatch.pl --strict.
- Updated DT binding document according to Rob Herring's comments.
v2:
- Use "pipe" (to replace "ppl") as the short form of "pipeline".
- Some editing changes for document according to Randy Dunlap's comments.
- Adjusted the position of KOMEDA by alphabetical order.
james qian wang (Arm Technology China) (9):
drm/komeda: komeda_dev/pipeline/component definition and initialzation dt/bindings: drm/komeda: Add DT bindings for ARM display processor D71 drm/komeda: Build komeda to be a platform module drm/komeda: Add DT parsing
drm/komeda: Add komeda_format_caps for format handling drm/komeda: Add komeda_framebuffer
drm/komeda: Attach komeda_dev to DRM-KMS
drm/doc: Add initial komeda driver documentation
MAINTAINERS: Add maintainer for Arm komeda driver
.../bindings/display/arm/arm,komeda.txt | 73 +++ Documentation/gpu/drivers.rst | 1 + Documentation/gpu/komeda-kms.rst | 488 ++++++++++++++++++ MAINTAINERS | 10 + drivers/gpu/drm/arm/Kconfig | 2 + drivers/gpu/drm/arm/Makefile | 1 + drivers/gpu/drm/arm/display/Kbuild | 3 + drivers/gpu/drm/arm/display/Kconfig | 14 + .../gpu/drm/arm/display/include/malidp_io.h | 42 ++ .../drm/arm/display/include/malidp_product.h | 23 + .../drm/arm/display/include/malidp_utils.h | 16 + drivers/gpu/drm/arm/display/komeda/Makefile | 21 + .../gpu/drm/arm/display/komeda/d71/d71_dev.c | 111 ++++ .../gpu/drm/arm/display/komeda/komeda_crtc.c | 106 ++++ .../gpu/drm/arm/display/komeda/komeda_dev.c | 192 +++++++ .../gpu/drm/arm/display/komeda/komeda_dev.h | 113 ++++ .../gpu/drm/arm/display/komeda/komeda_drv.c | 144 ++++++ .../arm/display/komeda/komeda_format_caps.c | 75 +++ .../arm/display/komeda/komeda_format_caps.h | 89 ++++ .../arm/display/komeda/komeda_framebuffer.c | 165 ++++++ .../arm/display/komeda/komeda_framebuffer.h | 31 ++ .../gpu/drm/arm/display/komeda/komeda_kms.c | 169 ++++++ .../gpu/drm/arm/display/komeda/komeda_kms.h | 113 ++++ .../drm/arm/display/komeda/komeda_pipeline.c | 200 +++++++ .../drm/arm/display/komeda/komeda_pipeline.h | 359 +++++++++++++ .../gpu/drm/arm/display/komeda/komeda_plane.c | 109 ++++ .../arm/display/komeda/komeda_private_obj.c | 88 ++++ 27 files changed, 2758 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/arm/arm,komeda.txt create mode 100644 Documentation/gpu/komeda-kms.rst create mode 100644 drivers/gpu/drm/arm/display/Kbuild create mode 100644 drivers/gpu/drm/arm/display/Kconfig create mode 100644 drivers/gpu/drm/arm/display/include/malidp_io.h create mode 100644 drivers/gpu/drm/arm/display/include/malidp_product.h create mode 100644 drivers/gpu/drm/arm/display/include/malidp_utils.h create mode 100644 drivers/gpu/drm/arm/display/komeda/Makefile create mode 100644 drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_crtc.c create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_dev.c create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_dev.h create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_drv.c create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_format_caps.c create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_format_caps.h create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.h create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_kms.c create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_kms.h create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_plane.c create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_private_obj.c
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 1/9 drm/komeda: komeda_dev/pipeline/component definition and initialzation
From: "james qian wang (Arm Technology China)" <[email protected]>
1. Added a brief definition of komeda_dev/pipeline/component, this change didn't add the detailed component features and capabilities, which will be added in the following changes.
2. Corresponding resources discovery and initialzation functions.
Changes in v4:
- Deleted unnecessary header including [Liviu Dudau]
Changes in v3:
- Fixed style problem found by checkpatch.pl --strict.
Changes in v2:
- Unified abbreviation of "pipeline" to "pipe".
--- drivers/gpu/drm/arm/Kconfig | 2 + drivers/gpu/drm/arm/Makefile | 1 + drivers/gpu/drm/arm/display/Kbuild | 3 + drivers/gpu/drm/arm/display/Kconfig | 14 + .../drm/arm/display/include/malidp_product.h | 23 ++ .../drm/arm/display/include/malidp_utils.h | 16 + drivers/gpu/drm/arm/display/komeda/Makefile | 11 + .../gpu/drm/arm/display/komeda/komeda_dev.c | 114 ++++++ .../gpu/drm/arm/display/komeda/komeda_dev.h | 98 +++++ .../drm/arm/display/komeda/komeda_pipeline.c | 196 ++++++++++ .../drm/arm/display/komeda/komeda_pipeline.h | 348 ++++++++++++++++++ 11 files changed, 826 insertions(+) create mode 100644 drivers/gpu/drm/arm/display/Kbuild create mode 100644 drivers/gpu/drm/arm/display/Kconfig create mode 100644 drivers/gpu/drm/arm/display/include/malidp_product.h create mode 100644 drivers/gpu/drm/arm/display/include/malidp_utils.h create mode 100644 drivers/gpu/drm/arm/display/komeda/Makefile create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_dev.c create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_dev.h create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h
drivers/gpu/drm/arm/Kconfig +2 -0
@@ -37,4 +37,6 @@ config DRM_MALI_DISPLAY If compiled as a module it will be called mali-dp. +source "drivers/gpu/drm/arm/display/Kconfig" + endmenu
drivers/gpu/drm/arm/Makefile +1 -0
@@ -3,3 +3,4 @@ obj-$(CONFIG_DRM_HDLCD) += hdlcd.o mali-dp-y := malidp_drv.o malidp_hw.o malidp_planes.o malidp_crtc.o mali-dp-y += malidp_mw.o obj-$(CONFIG_DRM_MALI_DISPLAY) += mali-dp.o +obj-$(CONFIG_DRM_KOMEDA) += display/
drivers/gpu/drm/arm/display/Kbuild new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_DRM_KOMEDA) += komeda/
drivers/gpu/drm/arm/display/Kconfig new file +14 -0
@@ -0,0 +1,14 @@ +# SPDX-License-Identifier: GPL-2.0 +config DRM_KOMEDA + tristate "ARM Komeda display driver" + depends on DRM && OF + depends on COMMON_CLK + select DRM_KMS_HELPER + select DRM_KMS_CMA_HELPER + select DRM_GEM_CMA_HELPER + select VIDEOMODE_HELPERS + help + Choose this option if you want to compile the ARM Komeda display + Processor driver. It supports the D71 variants of the hardware. + + If compiled as a module it will be called komeda.
drivers/gpu/drm/arm/display/include/malidp_product.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* (C) COPYRIGHT 2018 ARM Limited. All rights reserved. +* Author: James.Qian.Wang <[email protected]> +* +*/ +#ifndef _MALIDP_PRODUCT_H_ +#define _MALIDP_PRODUCT_H_ + +/* Product identification */ +#define MALIDP_CORE_ID (__product, __major, __minor, __status) \ + ((((__product) & 0xFFFF) << 16) | (((__major) & 0xF) << 12) | \ + (((__minor) & 0xF) << 8) | ((__status) & 0xFF)) + +#define MALIDP_CORE_ID_PRODUCT_ID (__core_id) ((__u32)(__core_id) >> 16) +#define MALIDP_CORE_ID_MAJOR (__core_id) (((__u32)(__core_id) >> 12) & 0xF) +#define MALIDP_CORE_ID_MINOR (__core_id) (((__u32)(__core_id) >> 8) & 0xF) +#define MALIDP_CORE_ID_STATUS (__core_id) (((__u32)(__core_id)) & 0xFF) + +/* Mali-display product IDs */ +#define MALIDP_D71_PRODUCT_ID 0x0071 + +#endif /* _MALIDP_PRODUCT_H_ */
drivers/gpu/drm/arm/display/include/malidp_utils.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* (C) COPYRIGHT 2018 ARM Limited. All rights reserved. +* Author: James.Qian.Wang <[email protected]> +* +*/ +#ifndef _MALIDP_UTILS_ +#define _MALIDP_UTILS_ + +#define has_bit (nr, mask) (BIT(nr) & (mask)) +#define has_bits (bits, mask) (((bits) & (mask)) == (bits)) + +#define dp_for_each_set_bit (bit, mask) \ + for_each_set_bit((bit), ((unsigned long *)&(mask)), sizeof(mask) * 8) + +#endif /* _MALIDP_UTILS_ */
drivers/gpu/drm/arm/display/komeda/Makefile new file +11 -0
@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 + +ccflags-y := \ + -I$(src)/../include \ + -I$(src) + +komeda-y := \ + komeda_dev.o \ + komeda_pipeline.o \ + +obj-$(CONFIG_DRM_KOMEDA) += komeda.o
drivers/gpu/drm/arm/display/komeda/komeda_dev.c new file +114 -0
114 lines not on this page · raw message
drivers/gpu/drm/arm/display/komeda/komeda_dev.h new file +98 -0
98 lines not on this page · raw message
drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c new file +196 -0
196 lines not on this page · raw message
drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h new file +348 -0
348 lines not on this page · raw message
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 2/9 dt/bindings: drm/komeda: Add DT bindings for ARM display processor D71
In reply to james qian wang (Arm Technology China)From: "james qian wang (Arm Technology China)" <[email protected]>
Add DT bindings documentation for the ARM display processor D71 and later IPs.
Changes in v4:
- Deleted unnecessary address-cells, size-cells [Liviu Dudau]
Changes in v3:
- Deleted unnecessary property: interrupt-names.
- Dropped 'ports' and moving 'port' up a level.
--- .../bindings/display/arm/arm,komeda.txt | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/arm/arm,komeda.txt
Documentation/devicetree/bindings/display/arm/arm,komeda.txt new file +73 -0
@@ -0,0 +1,73 @@ +Device Tree bindings for Arm Komeda display driver + +Required properties: +- compatible: Should be "arm,mali-d71" +- reg: Physical base address and length of the registers in the system +- interrupts: the interrupt line number of the device in the system +- clocks: A list of phandle + clock-specifier pairs, one for each entry + in 'clock-names' +- clock-names: A list of clock names. It should contain: + - "mclk": for the main processor clock + - "pclk": for the APB interface clock +- #address-cells: Must be 1 +- #size-cells: Must be 0 + +Required properties for sub-node: pipeline@nq +Each device contains one or two pipeline sub-nodes (at least one), each +pipeline node should provide properties: +- reg: Zero-indexed identifier for the pipeline +- clocks: A list of phandle + clock-specifier pairs, one for each entry + in 'clock-names' +- clock-names: should contain: + - "pxclk": pixel clock + - "aclk": AXI interface clock + +- port: each pipeline connect to an encoder input port. The connection is + modeled using the OF graph bindings specified in + Documentation/devicetree/bindings/graph.txt + +Optional properties: + - memory-region: phandle to a node describing memory (see + Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt) + to be used for the framebuffer; if not present, the framebuffer may + be located anywhere in memory. + +Example: +/ { + ... + + dp0: display@c00000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "arm,mali-d71"; + reg = <0xc00000 0x20000>; + interrupts = <0 168 4>; + clocks = <&dpu_mclk>, <&dpu_aclk>; + clock-names = "mclk", "pclk"; + + dp0_pipe0: pipeline@0 { + clocks = <&fpgaosc2>, <&dpu_aclk>; + clock-names = "pxclk", "aclk"; + reg = <0>; + + port@0 { + dp0_pipe0_out: endpoint { + remote-endpoint = <&db_dvi0_in>; + }; + }; + }; + + dp0_pipe1: pipeline@1 { + clocks = <&fpgaosc2>, <&dpu_aclk>; + clock-names = "pxclk", "aclk"; + reg = <1>; + + port@0 { + dp0_pipe1_out: endpoint { + remote-endpoint = <&db_dvi1_in>; + }; + }; + }; + }; + ... +};
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 2/9] dt/bindings: drm/komeda: Add DT bindings for ARM display processor D71
Quoted 68 lines · james qian wang (Arm Technology China)
From: "james qian wang (Arm Technology China)" <[email protected]>
Add DT bindings documentation for the ARM display processor D71 and later IPs.
Changes in v4:
- Deleted unnecessary address-cells, size-cells [Liviu Dudau]Changes in v3:
- Deleted unnecessary property: interrupt-names.
- Dropped 'ports' and moving 'port' up a level.Reviewed-by Liviu Dudau <[email protected]>--- .../bindings/display/arm/arm,komeda.txt | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/arm/arm,komeda.txtDocumentation/devicetree/bindings/display/arm/arm,komeda.txt new file +43
-0@@ -0,0 +1,73 @@ +Device Tree bindings for Arm Komeda display driver + +Required properties: +- compatible: Should be "arm,mali-d71" +- reg: Physical base address and length of the registers in the system +- interrupts: the interrupt line number of the device in the system +- clocks: A list of phandle + clock-specifier pairs, one for each entry + in 'clock-names' +- clock-names: A list of clock names. It should contain: + - "mclk": for the main processor clock + - "pclk": for the APB interface clock +- #address-cells: Must be 1 +- #size-cells: Must be 0 + +Required properties for sub-node: pipeline@nq +Each device contains one or two pipeline sub-nodes (at least one), each +pipeline node should provide properties: +- reg: Zero-indexed identifier for the pipeline +- clocks: A list of phandle + clock-specifier pairs, one for each entry + in 'clock-names' +- clock-names: should contain: + - "pxclk": pixel clock + - "aclk": AXI interface clock + +- port: each pipeline connect to an encoder input port. The connection is + modeled using the OF graph bindings specified in + Documentation/devicetree/bindings/graph.txt + +Optional properties: + - memory-region: phandle to a node describing memory (see + Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt) + to be used for the framebuffer; if not present, the framebuffer may + be located anywhere in memory. + +Example: +/ { + ... + + dp0: display@c00000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "arm,mali-d71"; + reg = <0xc00000 0x20000>;
Documentation/devicetree/bindings/display/arm/arm,komeda.txt line 53
Quoted 10 lines
Documentation/devicetree/bindings/display/arm/arm,komeda.txt new file +10
-0+ interrupts = <0 168 4>; + clocks = <&dpu_mclk>, <&dpu_aclk>; + clock-names = "mclk", "pclk"; + + dp0_pipe0: pipeline@0 { + clocks = <&fpgaosc2>, <&dpu_aclk>; + clock-names = "pxclk", "aclk"; + reg = <0>; + + port@0 {
Drop the '@0'
Documentation/devicetree/bindings/display/arm/arm,komeda.txt line 65
Quoted 12 lines
Documentation/devicetree/bindings/display/arm/arm,komeda.txt new file +12
-0+ dp0_pipe0_out: endpoint { + remote-endpoint = <&db_dvi0_in>; + }; + }; + }; + + dp0_pipe1: pipeline@1 { + clocks = <&fpgaosc2>, <&dpu_aclk>; + clock-names = "pxclk", "aclk"; + reg = <1>; + + port@0 {
And here.
With that,
Quoted 15 lines
Documentation/devicetree/bindings/display/arm/arm,komeda.txt new file +8
-0+ dp0_pipe1_out: endpoint { + remote-endpoint = <&db_dvi1_in>; + }; + }; + }; + }; + ... +};Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 3/9 drm/komeda: Build komeda to be a platform module
In reply to james qian wang (Arm Technology China)From: "james qian wang (Arm Technology China)" <[email protected]>
Implement a simple wrapper for platform module to build komeda to module, Also add a very simple D71 layer code to show how to discover a product. Komeda driver direct bind the product ENTRY function xxx_identity to DT compatible name like:
d71_product = {
.product_id = MALIDP_D71_PRODUCT_ID,
.identify = d71_identify,
},
const struct of_device_id komeda_of_match[] = {
{ .compatible = "arm,mali-d71", .data = &d71_product, },
{},
};Then when linux found a matched DT node and call driver to probe, we can easily get the of data, and call into the product to do the identify:
komeda_bind()
{
...
product = of_device_get_match_data(dev);
product->identify();
...
}Changes in v4:
- Replaced kzalloc with devm_kzalloc
Changes in v3:
- Fixed style problem found by checkpatch.pl --strict.
--- .../gpu/drm/arm/display/include/malidp_io.h | 42 ++++++ drivers/gpu/drm/arm/display/komeda/Makefile | 6 +- .../gpu/drm/arm/display/komeda/d71/d71_dev.c | 33 +++++ .../gpu/drm/arm/display/komeda/komeda_dev.h | 3 + .../gpu/drm/arm/display/komeda/komeda_drv.c | 132 ++++++++++++++++++ 5 files changed, 215 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/arm/display/include/malidp_io.h create mode 100644 drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_drv.c
drivers/gpu/drm/arm/display/include/malidp_io.h new file +42 -0
@@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* (C) COPYRIGHT 2018 ARM Limited. All rights reserved. +* Author: James.Qian.Wang <[email protected]> +* +*/ +#ifndef _MALIDP_IO_H_ +#define _MALIDP_IO_H_ + +#include <linux/io.h> + +static inline u32 +malidp_read32 (u32 __iomem *base,u32 offset) +{ +return readl ((base + (offset >>2 ))); +} + +static inline void +malidp_write32 (u32 __iomem *base,u32 offset,u32 v) +{ +writel (v, (base + (offset >>2 ))); +} + +static inline void +malidp_write32_mask (u32 __iomem *base,u32 offset,u32 m,u32 v) +{ +u32 tmp =malidp_read32 (base, offset); + + tmp &= (~m); +malidp_write32 (base, offset, v | tmp); +} + +static inline void +malidp_write_group (u32 __iomem *base,u32 offset,int num,const u32 *values) +{ +int i; + +for (i =0 ; i < num; i++) +malidp_write32 (base, offset + i *4 , values[i]); +} + +#endif /*_MALIDP_IO_H_*/
drivers/gpu/drm/arm/display/komeda/Makefile +5 -1
@@ -5,7 +5,11 @@ ccflags-y := \ -I$(src) komeda-y := \ + komeda_drv.o \ komeda_dev.o \ - komeda_pipeline.o \ + komeda_pipeline.o + +komeda-y += \ + d71/d71_dev.o obj-$(CONFIG_DRM_KOMEDA) += komeda.o
drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c new file +33 -0
@@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* (C) COPYRIGHT 2018 ARM Limited. All rights reserved. +* Author: James.Qian.Wang <[email protected]> +* +*/ +#include "malidp_io.h" +#include "komeda_dev.h" + +static int d71_enum_resources (struct komeda_dev *mdev) +{ +/* TODO add enum resources */ +return -1 ; +} + +static struct komeda_dev_funcs d71_chip_funcs = { + .enum_resources = d71_enum_resources, + .cleanup =NULL , +}; + +#define GLB_ARCH_ID 0x000 +#define GLB_CORE_ID 0x004 +#define GLB_CORE_INFO 0x008 + +struct komeda_dev_funcs * +d71_identify (u32 __iomem *reg_base,struct komeda_chip_info *chip) +{ + chip->arch_id =malidp_read32 (reg_base,GLB_ARCH_ID ); + chip->core_id =malidp_read32 (reg_base,GLB_CORE_ID ); + chip->core_info =malidp_read32 (reg_base,GLB_CORE_INFO ); + +return &d71_chip_funcs; +}
drivers/gpu/drm/arm/display/komeda/komeda_dev.h +3 -0
@@ -92,6 +92,9 @@ komeda_product_match(struct komeda_dev *mdev, u32 target)return MALIDP_CORE_ID_PRODUCT_ID (mdev->chip.core_id) == target; } +struct komeda_dev_funcs * +d71_identify (u32 __iomem *reg,struct komeda_chip_info *chip); +struct komeda_dev *komeda_dev_create (struct device *dev);void komeda_dev_destroy (struct komeda_dev *mdev);
drivers/gpu/drm/arm/display/komeda/komeda_drv.c new file +132 -0
132 lines not on this page · raw message
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 4/9 drm/komeda: Add DT parsing
In reply to james qian wang (Arm Technology China)From: "james qian wang (Arm Technology China)" <[email protected]>
Parse DT and initialize corresponding dev/pipeline attributes.
Changes in v4:
- Rebase.
Changes in v3:
- Fixed style problem found by checkpatch.pl --strict.
Changes in v2:
- Unified abbreviation of "pipeline" to "pipe".
--- .../gpu/drm/arm/display/komeda/komeda_dev.c | 76 +++++++++++++++++++ .../gpu/drm/arm/display/komeda/komeda_dev.h | 3 + .../drm/arm/display/komeda/komeda_pipeline.c | 4 + .../drm/arm/display/komeda/komeda_pipeline.h | 7 ++ 4 files changed, 90 insertions(+)
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +76 -0
@@ -9,6 +9,76 @@#include <linux/of_graph.h> #include "komeda_dev.h" +static int komeda_parse_pipe_dt (struct komeda_dev *mdev,struct device_node *np) +{ +struct komeda_pipeline *pipe; +struct clk *clk; +u32 pipe_id; +int ret =0 ; + + ret =of_property_read_u32 (np,"reg" , &pipe_id); +if (ret !=0 || pipe_id >= mdev->n_pipelines) +return -EINVAL ; + + pipe = mdev->pipelines[pipe_id]; + + clk =of_clk_get_by_name (np,"aclk" ); +if (IS_ERR (clk)) { +DRM_ERROR ("get aclk for pipeline %d failed!\n" , pipe_id); +return PTR_ERR (clk); + } + pipe->aclk = clk; + + clk =of_clk_get_by_name (np,"pxclk" ); +if (IS_ERR (clk)) { +DRM_ERROR ("get pxclk for pipeline %d failed!\n" , pipe_id); +return PTR_ERR (clk); + } + pipe->pxlclk = clk; + +/* enum ports */ + pipe->of_output_dev = +of_graph_get_remote_node (np,KOMEDA_OF_PORT_OUTPUT ,0 ); + pipe->of_output_port = +of_graph_get_port_by_id (np,KOMEDA_OF_PORT_OUTPUT ); + + pipe->of_node = np; + +return 0 ; +} + +static int komeda_parse_dt (struct device *dev,struct komeda_dev *mdev) +{ +struct platform_device *pdev =to_platform_device (dev); +struct device_node *child, *np = dev->of_node; +struct clk *clk; +int ret; + + clk =devm_clk_get (dev,"mclk" ); +if (IS_ERR (clk)) +return PTR_ERR (clk); + + mdev->mclk = clk; + mdev->irq =platform_get_irq (pdev,0 ); +if (mdev->irq <0 ) { +DRM_ERROR ("could not get IRQ number.\n" ); +return mdev->irq; + } + +for_each_available_child_of_node (np, child) { +if (of_node_cmp (child->name,"pipeline" ) ==0 ) { + ret =komeda_parse_pipe_dt (mdev, child); +if (ret) { +DRM_ERROR ("parse pipeline dt error!\n" ); +of_node_put (child); +break ; + } + } + } + +return ret; +} +struct komeda_dev *komeda_dev_create (struct device *dev) {struct platform_device *pdev =to_platform_device (dev);
@@ -71,6 +141,12 @@ struct komeda_dev *komeda_dev_create(struct device *dev) goto err_cleanup; } + err =komeda_parse_dt (dev, mdev); +if (err) { +DRM_ERROR ("parse device tree failed.\n" ); + goto err_cleanup; + } +return mdev; err_cleanup:
drivers/gpu/drm/arm/display/komeda/komeda_dev.h +3 -0
@@ -72,6 +72,9 @@ struct komeda_dev {/** @mck: HW main engine clk */ struct clk *mclk; +/** @irq: irq number */ +u32 irq; +int n_pipelines;struct komeda_pipeline *pipelines[KOMEDA_MAX_PIPELINES ];
drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c +4 -0
@@ -53,6 +53,10 @@ void komeda_pipeline_destroy(struct komeda_dev *mdev,clk_put (pipe->pxlclk);clk_put (pipe->aclk); +of_node_put (pipe->of_output_dev); +of_node_put (pipe->of_output_port); +of_node_put (pipe->of_node); +devm_kfree (mdev->dev, pipe); }
drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h +7 -0
@@ -288,6 +288,13 @@ struct komeda_pipeline {struct komeda_improc *improc;struct komeda_timing_ctrlr *ctrlr;struct komeda_pipeline_funcs *funcs;/* private pipeline functions */ + +/** @of_node: pipeline dt node */ +struct device_node *of_node; +/** @of_output_port: pipeline output port */ +struct device_node *of_output_port; +/** @of_output_dev: output connector device node */ +struct device_node *of_output_dev; };/**
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 5/9 drm/komeda: Add komeda_format_caps for format handling
In reply to james qian wang (Arm Technology China)From: "james qian wang (Arm Technology China)" <[email protected]>
komeda_format_caps is for describing ARM display specific features and limitations of a specific format, and format_caps will be linked into &komeda_framebuffer like a extension of &drm_format_info.
And komed_format_caps_table will be initialized before the enum_resources, since the layer features description depend on this format_caps table, so we'd better initialize the table first.
Changes in v4:
- Rebase.
Changes in v3:
- Fixed style problem found by checkpatch.pl --strict.
--- drivers/gpu/drm/arm/display/komeda/Makefile | 1 + .../gpu/drm/arm/display/komeda/d71/d71_dev.c | 78 ++++++++++++++++ .../gpu/drm/arm/display/komeda/komeda_dev.c | 2 + .../gpu/drm/arm/display/komeda/komeda_dev.h | 11 ++- .../arm/display/komeda/komeda_format_caps.c | 75 ++++++++++++++++ .../arm/display/komeda/komeda_format_caps.h | 89 +++++++++++++++++++ .../drm/arm/display/komeda/komeda_pipeline.h | 1 + 7 files changed, 256 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_format_caps.c create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_format_caps.h
drivers/gpu/drm/arm/display/komeda/Makefile +1 -0
@@ -7,6 +7,7 @@ ccflags-y := \ komeda-y := \ komeda_drv.o \ komeda_dev.o \ + komeda_format_caps.o \ komeda_pipeline.o komeda-y += \
drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c +78 -0
85 lines not on this page · raw message
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +2 -0
@@ -135,6 +135,8 @@ struct komeda_dev *komeda_dev_create(struct device *dev)MALIDP_CORE_ID_MAJOR (mdev->chip.core_id), MALIDP_CORE_ID_MINOR(mdev->chip.core_id)); + mdev->funcs->init_format_table (mdev); + err = mdev->funcs->enum_resources (mdev);if (err) {DRM_ERROR ("enumerate display resource failed.\n" );
drivers/gpu/drm/arm/display/komeda/komeda_dev.h +10 -1
@@ -11,6 +11,7 @@#include <linux/clk.h> #include "komeda_pipeline.h" #include "malidp_product.h" +#include "komeda_format_caps.h" /* malidp device id */ enum {
@@ -44,6 +45,13 @@ struct komeda_dev;* Supplied by chip level and returned by the chip entry function xxx_identify, */ struct komeda_dev_funcs { +/** +* @init_format_table: +* +* initialize &komeda_dev->format_table, this function should be called +* before the &enum_resource +*/ +void (*init_format_table)(struct komeda_dev *mdev);/** * @enum_resources: *
@@ -66,7 +74,8 @@ struct komeda_dev {u32 __iomem *reg_base;struct komeda_chip_info chip; - +/** @fmt_tbl: initialized by &komeda_dev_funcs->init_format_table */ +struct komeda_format_caps_table fmt_tbl;/** @pclk: APB clock for register access */ struct clk *pclk;/** @mck: HW main engine clk */
drivers/gpu/drm/arm/display/komeda/komeda_format_caps.c new file +75 -0
75 lines not on this page · raw message
drivers/gpu/drm/arm/display/komeda/komeda_format_caps.h new file +89 -0
89 lines not on this page · raw message
drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h +1 -0
@@ -211,6 +211,7 @@ static inline u16 component_changed_inputs(struct komeda_component_state *st)struct komeda_layer {struct komeda_component base;/* layer specific features and caps */ +int layer_type;/* RICH, SIMPLE or WB */ };struct komeda_layer_state {
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 6/9 drm/komeda: Add komeda_framebuffer
In reply to james qian wang (Arm Technology China)From: "james qian wang (Arm Technology China)" <[email protected]>
komeda_framebuffer is for extending drm_framebuffer to add komeda own attributes and komeda specific fb handling.
Changes in v3:
- Fixed style problem found by checkpatch.pl --strict.
--- drivers/gpu/drm/arm/display/komeda/Makefile | 3 +- .../arm/display/komeda/komeda_framebuffer.c | 165 ++++++++++++++++++ .../arm/display/komeda/komeda_framebuffer.h | 31 ++++ 3 files changed, 198 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.h
drivers/gpu/drm/arm/display/komeda/Makefile +2 -1
@@ -8,7 +8,8 @@ komeda-y := \ komeda_drv.o \ komeda_dev.o \ komeda_format_caps.o \ - komeda_pipeline.o + komeda_pipeline.o \ + komeda_framebuffer.o komeda-y += \ d71/d71_dev.o
drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c new file +165 -0
165 lines not on this page · raw message
drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.h new file +31 -0
@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* (C) COPYRIGHT 2018 ARM Limited. All rights reserved. +* Author: James.Qian.Wang <[email protected]> +* +*/ +#ifndef _KOMEDA_FRAMEBUFFER_H_ +#define _KOMEDA_FRAMEBUFFER_H_ + +/** struct komeda_fb - entend drm_framebuffer with komeda attribute */ +struct komeda_fb { +/** @base: &drm_framebuffer */ +struct drm_framebuffer base; +/* @format_caps: &komeda_format_caps */ +const struct komeda_format_caps *format_caps; +/** @aligned_w: aligned frame buffer width */ +u32 aligned_w; +/** @aligned_h: aligned frame buffer height */ +u32 aligned_h; +}; + +#define to_kfb (dfb) container_of(dfb, struct komeda_fb, base) + +struct drm_framebuffer * +komeda_fb_create (struct drm_device *dev,struct drm_file *file, +const struct drm_mode_fb_cmd2 *mode_cmd); +dma_addr_t +komeda_fb_get_pixel_addr (struct komeda_fb *kfb,int x,int y,int plane); +bool komeda_fb_is_layer_supported (struct komeda_fb *kfb,u32 layer_type); + +#endif
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 7/9 drm/komeda: Attach komeda_dev to DRM-KMS
In reply to james qian wang (Arm Technology China)From: "james qian wang (Arm Technology China)" <[email protected]>
Add komeda_kms abstracton to attach komeda_dev to DRM-KMS
CRTC: according to the komeda_pipeline
PLANE: according to komeda_layer (layer input pipeline)
PRIVATE_OBJS: komeda_pipeline/component all will be treat as private_objs
komeda_kms is for connecting DRM-KMS and komeda_dev, like reporting the kms object properties according to the komeda_dev, and pass/convert KMS's requirement to komeda_dev.
Changes in v4:
- Set drm_atomic_helper_check as mode_config->atomic_check.
Changes in v3:
- Fixed style problem found by checkpatch.pl --strict.
Changes in v2:
- Unified abbreviation of "pipeline" to "pipe".
--- drivers/gpu/drm/arm/display/komeda/Makefile | 6 +- .../gpu/drm/arm/display/komeda/komeda_crtc.c | 106 +++++++++++ .../gpu/drm/arm/display/komeda/komeda_drv.c | 12 ++ .../gpu/drm/arm/display/komeda/komeda_kms.c | 169 ++++++++++++++++++ .../gpu/drm/arm/display/komeda/komeda_kms.h | 113 ++++++++++++ .../drm/arm/display/komeda/komeda_pipeline.h | 3 + .../gpu/drm/arm/display/komeda/komeda_plane.c | 109 +++++++++++ .../arm/display/komeda/komeda_private_obj.c | 88 +++++++++ 8 files changed, 605 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_crtc.c create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_kms.c create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_kms.h create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_plane.c create mode 100644 drivers/gpu/drm/arm/display/komeda/komeda_private_obj.c
drivers/gpu/drm/arm/display/komeda/Makefile +5 -1
@@ -9,7 +9,11 @@ komeda-y := \ komeda_dev.o \ komeda_format_caps.o \ komeda_pipeline.o \ - komeda_framebuffer.o + komeda_framebuffer.o \ + komeda_kms.o \ + komeda_crtc.o \ + komeda_plane.o \ + komeda_private_obj.o komeda-y += \ d71/d71_dev.o
drivers/gpu/drm/arm/display/komeda/komeda_crtc.c new file +106 -0
106 lines not on this page · raw message
drivers/gpu/drm/arm/display/komeda/komeda_drv.c +12 -0
@@ -10,9 +10,11 @@#include <linux/component.h> #include <drm/drm_of.h> #include "komeda_dev.h" +#include "komeda_kms.h" struct komeda_drv {struct komeda_dev *mdev; +struct komeda_kms_dev *kms; };static void komeda_unbind (struct device *dev)
@@ -22,6 +24,7 @@ static void komeda_unbind(struct device *dev)if (!mdrv)return ; +komeda_kms_detach (mdrv->kms);komeda_dev_destroy (mdrv->mdev);dev_set_drvdata (dev,NULL );
@@ -43,10 +46,19 @@ static int komeda_bind(struct device *dev) goto free_mdrv; } + mdrv->kms =komeda_kms_attach (mdrv->mdev); +if (IS_ERR (mdrv->kms)) { + err =PTR_ERR (mdrv->kms); + goto destroy_mdev; + } +dev_set_drvdata (dev, mdrv);return 0 ; +destroy_mdev: +komeda_dev_destroy (mdrv->mdev); + free_mdrv:devm_kfree (dev, mdrv);return err;
drivers/gpu/drm/arm/display/komeda/komeda_kms.c new file +169 -0
169 lines not on this page · raw message
drivers/gpu/drm/arm/display/komeda/komeda_kms.h new file +113 -0
113 lines not on this page · raw message
drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h +3 -0
@@ -331,6 +331,9 @@ struct komeda_pipeline_state {#define to_improc_st (c) container_of(c, struct komeda_improc_state, base)#define to_ctrlr_st (c) container_of(c, struct komeda_timing_ctrlr_state, base) +#define priv_to_comp_st (o) container_of(o, struct komeda_component_state, obj) +#define priv_to_pipe_st (o) container_of(o, struct komeda_pipeline_state, obj) +/* pipeline APIs */ struct komeda_pipeline * komeda_pipeline_add(struct komeda_dev *mdev, size_t size,
drivers/gpu/drm/arm/display/komeda/komeda_plane.c new file +109 -0
109 lines not on this page · raw message
drivers/gpu/drm/arm/display/komeda/komeda_private_obj.c new file +88 -0
88 lines not on this page · raw message
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 8/9 drm/doc: Add initial komeda driver documentation
In reply to james qian wang (Arm Technology China)From: "james qian wang (Arm Technology China)" <[email protected]>
v2: Some editing changes according to Randy Dunlap's comments
--- Documentation/gpu/drivers.rst | 1 + Documentation/gpu/komeda-kms.rst | 488 +++++++++++++++++++++++++++++++ 2 files changed, 489 insertions(+) create mode 100644 Documentation/gpu/komeda-kms.rst
Documentation/gpu/drivers.rst +1 -0
@@ -17,6 +17,7 @@ GPU Driver Documentation vkms bridge/dw-hdmi xen-front + komeda-kms .. only:: subproject and html
Documentation/gpu/komeda-kms.rst new file +488 -0
488 lines not on this page · raw message
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 9/9 MAINTAINERS: Add maintainer for Arm komeda driver
In reply to james qian wang (Arm Technology China)From: "james qian wang (Arm Technology China)" <[email protected]>
v4: Added git tree [Daniel Vetter]
v2: Adjusted the position of KOMEDA by alphabetical order
--- MAINTAINERS | 10 ++++++++++ 1 file changed, 10 insertions(+)
MAINTAINERS +10 -0
@@ -1124,6 +1124,16 @@ S: Supported F: drivers/gpu/drm/arm/hdlcd_* F: Documentation/devicetree/bindings/display/arm,hdlcd.txt +ARM KOMEDA DRM-KMS DRIVER +M: James (Qian) Wang <[email protected]> +M: Mali DP Maintainers <[email protected]> +S: Supported +T: git git://linux-arm.org/linux-ld.git for-upstream/mali-dp +F: drivers/gpu/drm/arm/display/include/ +F: drivers/gpu/drm/arm/display/komeda/ +F: Documentation/devicetree/bindings/display/arm/arm,komeda.txt +F: Documentation/gpu/komeda-kms.rst + ARM MALI-DP DRM DRIVER M: Liviu Dudau <[email protected]> M: Brian Starkey <[email protected]>
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel