Add Unisoc's drm kms module
Subsystems (4)
v4 cover Add Unisoc's drm kms module
ChangeList:
v1:
1. only upstream modeset and atomic at first commit.
2. remove some unused code;
3. use alpha and blend_mode properties;
3. add yaml support;
4. remove auto-adaptive panel driver;
5. bugfix
v2:
1. add sprd crtc and plane module for KMS, preparing for multi crtc&encoder
2. remove gem drivers, use generic CMA handlers
3. remove redundant "module_init", all the sub modules loading by KMS
v3:
1. multi crtc&encoder design have problem, so rollback to v1
v4:
1. update to gcc-linaro-7.5.0
2. update to Linux 5.6-rc3
3. remove pm_runtime support
4. add COMPILE_TEST, remove unused kconfig
5. "drm_dev_put" on drm_unbind
6. fix some naming convention issue
7. remove semaphore lock for crtc flip
8. remove static variables
Kevin Tang (6):
dt-bindings: display: add Unisoc's drm master bindings drm/sprd: add Unisoc's drm kms master
dt-bindings: display: add Unisoc's dpu bindings drm/sprd: add Unisoc's drm display controller driver
dt-bindings: display: add Unisoc's mipi dsi&dphy bindings drm/sprd: add Unisoc's drm mipi dsi&dphy driver
.../devicetree/bindings/display/sprd/dphy.yaml | 75 ++ .../devicetree/bindings/display/sprd/dpu.yaml | 82 ++ .../devicetree/bindings/display/sprd/drm.yaml | 36 + .../devicetree/bindings/display/sprd/dsi.yaml | 98 ++ drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/sprd/Kconfig | 12 + drivers/gpu/drm/sprd/Makefile | 13 + drivers/gpu/drm/sprd/disp_lib.c | 59 + drivers/gpu/drm/sprd/disp_lib.h | 21 + drivers/gpu/drm/sprd/dphy/Makefile | 7 + drivers/gpu/drm/sprd/dphy/pll/Makefile | 3 + drivers/gpu/drm/sprd/dphy/pll/megacores_sharkle.c | 628 +++++++++ drivers/gpu/drm/sprd/dphy/sprd_dphy_api.c | 254 ++++ drivers/gpu/drm/sprd/dphy/sprd_dphy_hal.h | 329 +++++ drivers/gpu/drm/sprd/dpu/Makefile | 7 + drivers/gpu/drm/sprd/dpu/dpu_r2p0.c | 770 +++++++++++ drivers/gpu/drm/sprd/dsi/Makefile | 8 + drivers/gpu/drm/sprd/dsi/core/Makefile | 4 + drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c | 1169 ++++++++++++++++ drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.h | 1417 ++++++++++++++++++++ drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c | 375 ++++++ drivers/gpu/drm/sprd/dsi/sprd_dsi_api.c | 544 ++++++++ drivers/gpu/drm/sprd/dsi/sprd_dsi_api.h | 28 + drivers/gpu/drm/sprd/dsi/sprd_dsi_hal.h | 1102 +++++++++++++++ drivers/gpu/drm/sprd/sprd_dphy.c | 224 ++++ drivers/gpu/drm/sprd/sprd_dphy.h | 99 ++ drivers/gpu/drm/sprd/sprd_dpu.c | 611 +++++++++ drivers/gpu/drm/sprd/sprd_dpu.h | 130 ++ drivers/gpu/drm/sprd/sprd_drm.c | 229 ++++ drivers/gpu/drm/sprd/sprd_drm.h | 20 + drivers/gpu/drm/sprd/sprd_dsi.c | 628 +++++++++ drivers/gpu/drm/sprd/sprd_dsi.h | 193 +++ 33 files changed, 9178 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/sprd/dphy.yaml create mode 100644 Documentation/devicetree/bindings/display/sprd/dpu.yaml create mode 100644 Documentation/devicetree/bindings/display/sprd/drm.yaml create mode 100644 Documentation/devicetree/bindings/display/sprd/dsi.yaml create mode 100644 drivers/gpu/drm/sprd/Kconfig create mode 100644 drivers/gpu/drm/sprd/Makefile create mode 100644 drivers/gpu/drm/sprd/disp_lib.c create mode 100644 drivers/gpu/drm/sprd/disp_lib.h create mode 100644 drivers/gpu/drm/sprd/dphy/Makefile create mode 100644 drivers/gpu/drm/sprd/dphy/pll/Makefile create mode 100644 drivers/gpu/drm/sprd/dphy/pll/megacores_sharkle.c create mode 100644 drivers/gpu/drm/sprd/dphy/sprd_dphy_api.c create mode 100644 drivers/gpu/drm/sprd/dphy/sprd_dphy_hal.h create mode 100644 drivers/gpu/drm/sprd/dpu/Makefile create mode 100644 drivers/gpu/drm/sprd/dpu/dpu_r2p0.c create mode 100644 drivers/gpu/drm/sprd/dsi/Makefile create mode 100644 drivers/gpu/drm/sprd/dsi/core/Makefile create mode 100644 drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c create mode 100644 drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.h create mode 100644 drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c create mode 100644 drivers/gpu/drm/sprd/dsi/sprd_dsi_api.c create mode 100644 drivers/gpu/drm/sprd/dsi/sprd_dsi_api.h create mode 100644 drivers/gpu/drm/sprd/dsi/sprd_dsi_hal.h create mode 100644 drivers/gpu/drm/sprd/sprd_dphy.c create mode 100644 drivers/gpu/drm/sprd/sprd_dphy.h create mode 100644 drivers/gpu/drm/sprd/sprd_dpu.c create mode 100644 drivers/gpu/drm/sprd/sprd_dpu.h create mode 100644 drivers/gpu/drm/sprd/sprd_drm.c create mode 100644 drivers/gpu/drm/sprd/sprd_drm.h create mode 100644 drivers/gpu/drm/sprd/sprd_dsi.c create mode 100644 drivers/gpu/drm/sprd/sprd_dsi.h
Signature · 1 line
2.7.4
RFC PATCH v4 1/6 dt-bindings: display: add Unisoc's drm master bindings
From: Kevin Tang <[email protected]>
The Unisoc DRM master device is a virtual device needed to list all DPU devices or other display interface nodes that comprise the graphics subsystem
--- .../devicetree/bindings/display/sprd/drm.yaml | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/sprd/drm.yaml
Documentation/devicetree/bindings/display/sprd/drm.yaml new file +36 -0
@@ -0,0 +1,36 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/sprd/drm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Unisoc DRM master device + +maintainers: + - Mark Rutland <[email protected]> + +description: | + The Unisoc DRM master device is a virtual device needed to list all + DPU devices or other display interface nodes that comprise the + graphics subsystem. + +properties: + compatible: + const: sprd,display-subsystem + + ports: + description: + Should contain a list of phandles pointing to display interface port + of DPU devices. + +required: + - compatible + - ports + +examples: + - | + display-subsystem { + compatible = "sprd,display-subsystem"; + ports = <&dpu_out>; + }; +
Signature · 1 line
2.7.4
Re: [PATCH RFC v4 1/6] dt-bindings: display: add Unisoc's drm master bindings
Quoted 46 lines · Kevin Tang
From: Kevin Tang <[email protected]>
The Unisoc DRM master device is a virtual device needed to list all DPU devices or other display interface nodes that comprise the graphics subsystem
Cc Orson Zhai <[email protected]>Cc Baolin Wang <[email protected]>Cc Chunyan Zhang <[email protected]>Signed-off-by Kevin Tang <[email protected]>--- .../devicetree/bindings/display/sprd/drm.yaml | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/sprd/drm.yamlDocumentation/devicetree/bindings/display/sprd/drm.yaml new file +24
-0@@ -0,0 +1,36 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/sprd/drm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Unisoc DRM master device + +maintainers: + - Mark Rutland <[email protected]> + +description: | + The Unisoc DRM master device is a virtual device needed to list all + DPU devices or other display interface nodes that comprise the + graphics subsystem. + +properties: + compatible: + const: sprd,display-subsystem + + ports: + description: + Should contain a list of phandles pointing to display interface port + of DPU devices.
Documentation/devicetree/bindings/display/sprd/drm.yaml line 34
Quoted 10 lines
Documentation/devicetree/bindings/display/sprd/drm.yaml new file +10
-0+ +required: + - compatible + - ports + +examples: + - | + display-subsystem { + compatible = "sprd,display-subsystem"; + ports = <&dpu_out>;
We try to avoid these virtual nodes and bind with actual h/w nodes. Can you have more than one DPU and if so does it need to be a single DRM driver instance?
Rob
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH RFC v4 1/6] dt-bindings: display: add Unisoc's drm master bindings
Quoted 50 lines · Rob Herring
Quoted 7 lines · Kevin Tang
From: Kevin Tang <[email protected]>
The Unisoc DRM master device is a virtual device needed to list all DPU devices or other display interface nodes that comprise the graphics subsystem
Quoted 6 lines
Cc Orson Zhai <[email protected]>Cc Baolin Wang <[email protected]>Cc Chunyan Zhang <[email protected]>Signed-off-by Kevin Tang <[email protected]>--- .../devicetree/bindings/display/sprd/drm.yaml | 36++++++++++++++++++++++
Quoted 2 lines
1 file changed, 36 insertions(+) create mode 100644
Documentation/devicetree/bindings/display/sprd/drm.yamlReview
Quoted 2 lines
(quoted diff) +0
-0
b/Documentation/devicetree/bindings/display/sprd/drm.yamlQuoted 18 lines
new file mode 100644
index 0000000..b5792c0Documentation/devicetree/bindings/display/sprd/drm.yaml new file +13
-0@@ -0,0 +1,36 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/sprd/drm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Unisoc DRM master device + +maintainers: + - Mark Rutland <[email protected]> + +description: | + The Unisoc DRM master device is a virtual device needed to list allDocumentation/devicetree/bindings/display/sprd/drm.yaml line 23
Quoted 10 lines
Documentation/devicetree/bindings/display/sprd/drm.yaml new file +10
-0+ DPU devices or other display interface nodes that comprise the + graphics subsystem. + +properties: + compatible: + const: sprd,display-subsystem + + ports: + description: + Should contain a list of phandles pointing to display interfaceport
Quoted 16 lines
Documentation/devicetree/bindings/display/sprd/drm.yaml line 34
Quoted 11 lines
Documentation/devicetree/bindings/display/sprd/drm.yaml new file +11
-0+ of DPU devices. + +required: + - compatible + - ports + +examples: + - | + display-subsystem { + compatible = "sprd,display-subsystem"; + ports = <&dpu_out>;We try to avoid these virtual nodes and bind with actual h/w nodes. Can you have more than one DPU and if so does it need to be a single DRM driver instance?
I don't really understand what you mean, so reply as I understand... "dpu_out" node is the real h/w node, defined on dpu.yaml Yeah, we will be have multi DPU
Quoted 3 lines
Rob
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
RFC PATCH v4 2/6 drm/sprd: add Unisoc's drm kms master
In reply to Kevin TangFrom: Kevin Tang <[email protected]>
Adds drm support for the Unisoc's display subsystem.
This is drm kms driver, this driver provides support for the application framework in Android, Yocto and more.
Application framework can access Unisoc's display internel peripherals through libdrm or libkms, it's test ok by modetest (DRM/KMS test tool) and Android HWComposer.
--- drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/sprd/Kconfig | 12 +++ drivers/gpu/drm/sprd/Makefile | 5 + drivers/gpu/drm/sprd/sprd_drm.c | 226 ++++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/sprd/sprd_drm.h | 16 +++ 6 files changed, 262 insertions(+) create mode 100644 drivers/gpu/drm/sprd/Kconfig create mode 100644 drivers/gpu/drm/sprd/Makefile create mode 100644 drivers/gpu/drm/sprd/sprd_drm.c create mode 100644 drivers/gpu/drm/sprd/sprd_drm.h
drivers/gpu/drm/Kconfig +2 -0
@@ -389,6 +389,8 @@ source "drivers/gpu/drm/aspeed/Kconfig" source "drivers/gpu/drm/mcde/Kconfig" +source "drivers/gpu/drm/sprd/Kconfig" + # Keep legacy drivers last menuconfig DRM_LEGACY
drivers/gpu/drm/Makefile +1 -0
@@ -122,3 +122,4 @@ obj-$(CONFIG_DRM_LIMA) += lima/ obj-$(CONFIG_DRM_PANFROST) += panfrost/ obj-$(CONFIG_DRM_ASPEED_GFX) += aspeed/ obj-$(CONFIG_DRM_MCDE) += mcde/ +obj-$(CONFIG_DRM_SPRD) += sprd/
drivers/gpu/drm/sprd/Kconfig new file +12 -0
@@ -0,0 +1,12 @@ +config DRM_SPRD + tristate "DRM Support for Unisoc SoCs Platform" + depends on ARCH_SPRD || COMPILE_TEST + depends on DRM && OF + select DRM_KMS_HELPER + select DRM_GEM_CMA_HELPER + select DRM_KMS_CMA_HELPER + select DRM_MIPI_DSI + help + Choose this option if you have a Unisoc chipsets. + If M is selected the module will be called sprd-drm. +
drivers/gpu/drm/sprd/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0 + +subdir-ccflags-y += -I$(srctree)/$(src) + +obj-y := sprd_drm.o
drivers/gpu/drm/sprd/sprd_drm.c new file +226 -0
226 lines not on this page · raw message
drivers/gpu/drm/sprd/sprd_drm.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020 Unisoc Inc. +*/ + +#ifndef _SPRD_DRM_H_ +#define _SPRD_DRM_H_ + +#include <drm/drm_atomic.h> +#include <drm/drm_print.h> + +struct sprd_drm { +struct drm_device *drm; +}; + +#endif /* _SPRD_DRM_H_ */
Signature · 1 line
2.7.4
RFC PATCH v4 3/6 dt-bindings: display: add Unisoc's dpu bindings
In reply to Kevin TangFrom: Kevin Tang <[email protected]>
DPU (Display Processor Unit) is the Display Controller for the Unisoc SoCs which transfers the image data from a video memory buffer to an internal LCD interface.
--- .../devicetree/bindings/display/sprd/dpu.yaml | 82 ++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/sprd/dpu.yaml
Documentation/devicetree/bindings/display/sprd/dpu.yaml new file +82 -0
@@ -0,0 +1,82 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/sprd/dpu.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Unisoc SoC Display Processor Unit (DPU) + +maintainers: + - Mark Rutland <[email protected]> + +description: | + DPU (Display Processor Unit) is the Display Controller for the Unisoc SoCs + which transfers the image data from a video memory buffer to an internal + LCD interface. + +properties: + compatible: + const: sprd,sharkl3-dpu + + reg: + maxItems: 1 + description: + Physical base address and length of the DPU registers set + + interrupts: + maxItems: 1 + description: + The interrupt signal from DPU + + clocks: + minItems: 2 + + clock-names: + items: + - const: clk_src_128m + - const: clk_src_384m + + power-domains: + description: A phandle to DPU power domain node. + + iommus: + description: A phandle to DPU iommu node. + + port: + type: object + description: + A port node with endpoint definitions as defined in + Documentation/devicetree/bindings/media/video-interfaces.txt. + That port should be the output endpoint, usually output to + the associated DSI. + +required: + - compatible + - reg + - interrupts + - clocks + - clock-names + - port + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/clock/sprd,sc9860-clk.h> + dpu: dpu@0x63000000 { + compatible = "sprd,sharkl3-dpu"; + reg = <0x0 0x63000000 0x0 0x1000>; + interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>; + clock-names = "clk_src_128m", + "clk_src_384m"; + + clocks = <&pll CLK_TWPLL_128M>, + <&pll CLK_TWPLL_384M>; + + dpu_port: port { + dpu_out: endpoint { + remote-endpoint = <&dsi_in>; + }; + }; + };
Signature · 1 line
2.7.4
RFC PATCH v4 4/6 drm/sprd: add Unisoc's drm display controller driver
In reply to Kevin TangAdds DPU(Display Processor Unit) support for the Unisoc's display subsystem. It's support multi planes, scaler, rotation, PQ(Picture Quality) and more.
--- drivers/gpu/drm/sprd/Makefile | 5 +- drivers/gpu/drm/sprd/dpu/Makefile | 7 + drivers/gpu/drm/sprd/dpu/dpu_r2p0.c | 770 ++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/sprd/sprd_dpu.c | 586 +++++++++++++++++++++++++++ drivers/gpu/drm/sprd/sprd_dpu.h | 127 ++++++ drivers/gpu/drm/sprd/sprd_drm.c | 1 + drivers/gpu/drm/sprd/sprd_drm.h | 2 + 7 files changed, 1497 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/sprd/dpu/Makefile create mode 100644 drivers/gpu/drm/sprd/dpu/dpu_r2p0.c create mode 100644 drivers/gpu/drm/sprd/sprd_dpu.c create mode 100644 drivers/gpu/drm/sprd/sprd_dpu.h
drivers/gpu/drm/sprd/Makefile +4 -1
@@ -2,4 +2,7 @@ subdir-ccflags-y += -I$(srctree)/$(src) -obj-y := sprd_drm.o +obj-y := sprd_drm.o \ + sprd_dpu.o + +obj-y += dpu/
drivers/gpu/drm/sprd/dpu/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 + +ifdef CONFIG_ARM64 +KBUILD_CFLAGS += -mstrict-align +endif + +obj-y += dpu_r2p0.o
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +770 -0
770 lines not on this page · raw message
drivers/gpu/drm/sprd/sprd_dpu.c new file +586 -0
586 lines not on this page · raw message
drivers/gpu/drm/sprd/sprd_dpu.h new file +127 -0
127 lines not on this page · raw message
drivers/gpu/drm/sprd/sprd_drm.c +1 -0
@@ -200,6 +200,7 @@ static struct platform_driver sprd_drm_driver = {static struct platform_driver *sprd_drm_drivers[] = { &sprd_drm_driver, + &sprd_dpu_driver, };static int __init sprd_drm_init (void )
drivers/gpu/drm/sprd/sprd_drm.h +2 -0
@@ -13,4 +13,6 @@ struct sprd_drm { struct drm_device *drm; }; +extern struct platform_driver sprd_dpu_driver; +#endif /* _SPRD_DRM_H_ */
Signature · 1 line
2.7.4
Re: [PATCH RFC v4 4/6] drm/sprd: add Unisoc's drm display controller driver
Quoted 81 lines · Kevin Tang
Adds DPU(Display Processor Unit) support for the Unisoc's display subsystem. It's support multi planes, scaler, rotation, PQ(Picture Quality) and more.
Cc Orson Zhai <[email protected]>Cc Baolin Wang <[email protected]>Cc Chunyan Zhang <[email protected]>Signed-off-by Kevin Tang <[email protected]>--- drivers/gpu/drm/sprd/Makefile | 5 +- drivers/gpu/drm/sprd/dpu/Makefile | 7 + drivers/gpu/drm/sprd/dpu/dpu_r2p0.c | 770 ++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/sprd/sprd_dpu.c | 586 +++++++++++++++++++++++++++ drivers/gpu/drm/sprd/sprd_dpu.h | 127 ++++++ drivers/gpu/drm/sprd/sprd_drm.c | 1 + drivers/gpu/drm/sprd/sprd_drm.h | 2 + 7 files changed, 1497 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/sprd/dpu/Makefile create mode 100644 drivers/gpu/drm/sprd/dpu/dpu_r2p0.c create mode 100644 drivers/gpu/drm/sprd/sprd_dpu.c create mode 100644 drivers/gpu/drm/sprd/sprd_dpu.hdrivers/gpu/drm/sprd/Makefile +4
-1@@ -2,4 +2,7 @@ subdir-ccflags-y += -I$(srctree)/$(src) -obj-y := sprd_drm.o +obj-y := sprd_drm.o \ + sprd_dpu.o + +obj-y += dpu/drivers/gpu/drm/sprd/dpu/Makefile new file +7
-0@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 + +ifdef CONFIG_ARM64 +KBUILD_CFLAGS += -mstrict-align +endif + +obj-y += dpu_r2p0.odrivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +27
-0@@ -0,0 +1,770 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2020 Unisoc Inc. +*/ + +#include <linux/delay.h> +#include <linux/wait.h> +#include <linux/workqueue.h> +#include "sprd_dpu.h" + +#define DISPC_INT_FBC_PLD_ERR_MASK BIT(8) +#define DISPC_INT_FBC_HDR_ERR_MASK BIT(9) + +#define DISPC_INT_MMU_INV_WR_MASK BIT(19) +#define DISPC_INT_MMU_INV_RD_MASK BIT(18) +#define DISPC_INT_MMU_VAOR_WR_MASK BIT(17) +#define DISPC_INT_MMU_VAOR_RD_MASK BIT(16) + +struct layer_reg { +u32 addr[4 ]; +u32 ctrl; +u32 size; +u32 pitch; +u32 pos; +u32 alpha; +u32 ck; +u32 pallete;
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c line 37
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +10
-0+u32 crop_start; +}; + +struct wb_region_reg { +u32 pos; +u32 size; +}; + +/* dpu controller register */ +struct dpu_reg {
structs for registers is not normal coding style. #defines of offsets is. More below.
Quoted 178 lines
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +178
-0+u32 dpu_version; +u32 dpu_ctrl; +u32 dpu_cfg0; +u32 dpu_cfg1; +u32 dpu_cfg2; +u32 dpu_secure; +u32 reserved_0x0018_0x001C[2 ]; +u32 panel_size; +u32 blend_size; +u32 reserved_0x0028; +u32 bg_color; +struct layer_reg layers[8 ]; +u32 wb_base_addr; +u32 wb_ctrl; +u32 wb_cfg; +u32 wb_pitch; +struct wb_region_reg region[3 ]; +u32 reserved_0x01D8_0x01DC[2 ]; +u32 dpu_int_en; +u32 dpu_int_clr; +u32 dpu_int_sts; +u32 dpu_int_raw; +u32 dpi_ctrl; +u32 dpi_h_timing; +u32 dpi_v_timing; +u32 reserved_0x01FC; +u32 dpu_enhance_cfg; +u32 reserved_0x0204_0x020C[3 ]; +u32 epf_epsilon; +u32 epf_gain0_3; +u32 epf_gain4_7; +u32 epf_diff; +u32 reserved_0x0220_0x023C[8 ]; +u32 hsv_lut_addr; +u32 hsv_lut_wdata; +u32 hsv_lut_rdata; +u32 reserved_0x024C_0x027C[13 ]; +u32 cm_coef01_00; +u32 cm_coef03_02; +u32 cm_coef11_10; +u32 cm_coef13_12; +u32 cm_coef21_20; +u32 cm_coef23_22; +u32 reserved_0x0298_0x02BC[10 ]; +u32 slp_cfg0; +u32 slp_cfg1; +u32 reserved_0x02C8_0x02FC[14 ]; +u32 gamma_lut_addr; +u32 gamma_lut_wdata; +u32 gamma_lut_rdata; +u32 reserved_0x030C_0x033C[13 ]; +u32 checksum_en; +u32 checksum0_start_pos; +u32 checksum0_end_pos; +u32 checksum1_start_pos; +u32 checksum1_end_pos; +u32 checksum0_result; +u32 checksum1_result; +u32 reserved_0x035C; +u32 dpu_sts[18 ]; +u32 reserved_0x03A8_0x03AC[2 ]; +u32 dpu_fbc_cfg0; +u32 dpu_fbc_cfg1; +u32 reserved_0x03B8_0x03EC[14 ]; +u32 rf_ram_addr; +u32 rf_ram_rdata_low; +u32 rf_ram_rdata_high; +u32 reserved_0x03FC_0x07FC[257 ]; +u32 mmu_en; +u32 mmu_update; +u32 mmu_min_vpn; +u32 mmu_vpn_range; +u32 mmu_pt_addr; +u32 mmu_default_page; +u32 mmu_vaor_addr_rd; +u32 mmu_vaor_addr_wr; +u32 mmu_inv_addr_rd; +u32 mmu_inv_addr_wr; +u32 mmu_uns_addr_rd; +u32 mmu_uns_addr_wr; +u32 mmu_miss_cnt; +u32 mmu_pt_update_qos; +u32 mmu_version; +u32 mmu_min_ppn1; +u32 mmu_ppn_range1; +u32 mmu_min_ppn2; +u32 mmu_ppn_range2; +u32 mmu_vpn_paor_rd; +u32 mmu_vpn_paor_wr; +u32 mmu_ppn_paor_rd; +u32 mmu_ppn_paor_wr; +u32 mmu_reg_au_manage; +u32 mmu_page_rd_ch; +u32 mmu_page_wr_ch; +u32 mmu_read_page_cmd_cnt; +u32 mmu_read_page_latency_cnt; +u32 mmu_page_max_latency; +}; + +static void dpu_dump (struct dpu_context *ctx) +{ +u32 *reg = (u32 *)ctx->base; +int i; + +pr_info (" 0 4 8 C\n" ); +for (i =0 ; i <256 ; i +=4 ) { +pr_info ("%04x: 0x%08x 0x%08x 0x%08x 0x%08x\n" , + i *4 , reg[i], reg[i +1 ], reg[i +2 ], reg[i +3 ]); + } +} + +static u32 check_mmu_isr (struct dpu_context *ctx,u32 reg_val) +{ +struct dpu_reg *reg = (struct dpu_reg *)ctx->base; +u32 mmu_mask =DISPC_INT_MMU_VAOR_RD_MASK | +DISPC_INT_MMU_VAOR_WR_MASK | +DISPC_INT_MMU_INV_RD_MASK | +DISPC_INT_MMU_INV_WR_MASK ; +u32 val = reg_val & mmu_mask; + +if (val) { +pr_err ("--- iommu interrupt err: 0x%04x ---\n" , val); + +pr_err ("iommu invalid read error, addr: 0x%08x\n" , + reg->mmu_inv_addr_rd); +pr_err ("iommu invalid write error, addr: 0x%08x\n" , + reg->mmu_inv_addr_wr); +pr_err ("iommu va out of range read error, addr: 0x%08x\n" , + reg->mmu_vaor_addr_rd); +pr_err ("iommu va out of range write error, addr: 0x%08x\n" , + reg->mmu_vaor_addr_wr); +pr_err ("BUG: iommu failure at %s:%d/%s()!\n" , + __FILE__, __LINE__, __func__); + +dpu_dump (ctx); + } + +return val; +} + +static void dpu_clean_all (struct dpu_context *ctx) +{ +int i; +struct dpu_reg *reg = (struct dpu_reg *)ctx->base; + +for (i =0 ; i <8 ; i++) + reg->layers[i].ctrl =0 ; +} + +static u32 dpu_isr (struct dpu_context *ctx) +{ +struct dpu_reg *reg = (struct dpu_reg *)ctx->base; +u32 reg_val, int_mask =0 ; + + reg_val = reg->dpu_int_sts; + +/* disable err interrupt */ +if (reg_val &DISPC_INT_ERR_MASK ) + int_mask |=DISPC_INT_ERR_MASK ; + +/* dpu update done isr */ +if (reg_val &DISPC_INT_UPDATE_DONE_MASK ) { + ctx->evt_update = true; +wake_up_interruptible_all (&ctx->wait_queue); + } + +/* dpu stop done isr */ +if (reg_val &DISPC_INT_DONE_MASK ) { + ctx->evt_stop = true; +wake_up_interruptible_all (&ctx->wait_queue); + } + +/* dpu ifbc payload error isr */ +if (reg_val &DISPC_INT_FBC_PLD_ERR_MASK ) { + int_mask |=DISPC_INT_FBC_PLD_ERR_MASK ; +pr_err ("dpu ifbc payload error\n" ); + } +
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c line 225
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +10
-0+/* dpu ifbc header error isr */ +if (reg_val &DISPC_INT_FBC_HDR_ERR_MASK ) { + int_mask |=DISPC_INT_FBC_HDR_ERR_MASK ; +pr_err ("dpu ifbc header error\n" ); + } + + int_mask |=check_mmu_isr (ctx, reg_val); + + reg->dpu_int_clr = reg_val; + reg->dpu_int_en &= ~int_mask;
Also, not coding style. Use readl/writel{_relaxed}. This is fragile because the compiler has a lot of freedom in what it can do here including reordering the accesses, changing the access size or skipping the register access altogether. I don't think the latter would happen in this case, but if a read has side effects such as causing bits to clear you'll see problems.
Quoted 990 lines
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +545
-0+ +return reg_val; +} + +static int dpu_wait_stop_done (struct dpu_context *ctx) +{ +int rc; + +if (ctx->stopped) +return 0 ; + + rc =wait_event_interruptible_timeout (ctx->wait_queue, ctx->evt_stop, +msecs_to_jiffies (500 )); + ctx->evt_stop = false; + + ctx->stopped = true; + +if (!rc) { +pr_err ("dpu wait for stop done time out!\n" ); +return -ETIMEDOUT ; + } + +return 0 ; +} + +static int dpu_wait_update_done (struct dpu_context *ctx) +{ +int rc; + + ctx->evt_update = false; + + rc =wait_event_interruptible_timeout (ctx->wait_queue, ctx->evt_update, +msecs_to_jiffies (500 )); + +if (!rc) { +pr_err ("dpu wait for reg update done time out!\n" ); +return -ETIMEDOUT ; + } + +return 0 ; +} + +static void dpu_stop (struct dpu_context *ctx) +{ +struct dpu_reg *reg = (struct dpu_reg *)ctx->base; + +if (ctx->stopped) +return ; + +if (ctx->if_type ==SPRD_DISPC_IF_DPI ) + reg->dpu_ctrl |=BIT (1 ); + +dpu_wait_stop_done (ctx); + +pr_info ("dpu stop\n" ); +} + +static void dpu_run (struct dpu_context *ctx) +{ +struct dpu_reg *reg = (struct dpu_reg *)ctx->base; + +if (!ctx->stopped) +return ; + + reg->dpu_ctrl |=BIT (0 ); + + ctx->stopped = false; + +pr_info ("dpu run\n" ); +} + +static int dpu_init (struct dpu_context *ctx) +{ +struct dpu_reg *reg = (struct dpu_reg *)ctx->base; +u32 size; + + reg->bg_color =0 ; + + size = (ctx->vm.vactive <<16 ) | ctx->vm.hactive; + reg->panel_size = size; + reg->blend_size = size; + + reg->dpu_cfg0 =BIT (4 ) |BIT (5 ); + + reg->dpu_cfg1 =0x004466da ; + reg->dpu_cfg2 =0 ; + +if (ctx->stopped) +dpu_clean_all (ctx); + + reg->mmu_en =0 ; + reg->mmu_min_ppn1 =0 ; + reg->mmu_ppn_range1 =0xffff ; + reg->mmu_min_ppn2 =0 ; + reg->mmu_ppn_range2 =0xffff ; + reg->mmu_vpn_range =0x1ffff ; + + reg->dpu_int_clr =0xffff ; + +init_waitqueue_head (&ctx->wait_queue); + +return 0 ; +} + +static void dpu_fini (struct dpu_context *ctx) +{ +struct dpu_reg *reg = (struct dpu_reg *)ctx->base; + + reg->dpu_int_en =0 ; + reg->dpu_int_clr =0xff ; +} + +enum { +DPU_LAYER_FORMAT_YUV422_2PLANE , +DPU_LAYER_FORMAT_YUV420_2PLANE , +DPU_LAYER_FORMAT_YUV420_3PLANE , +DPU_LAYER_FORMAT_ARGB8888 , +DPU_LAYER_FORMAT_RGB565 , +DPU_LAYER_FORMAT_XFBC_ARGB8888 =8 , +DPU_LAYER_FORMAT_XFBC_RGB565 , +DPU_LAYER_FORMAT_MAX_TYPES , +}; + +enum { +DPU_LAYER_ROTATION_0 , +DPU_LAYER_ROTATION_90 , +DPU_LAYER_ROTATION_180 , +DPU_LAYER_ROTATION_270 , +DPU_LAYER_ROTATION_0_M , +DPU_LAYER_ROTATION_90_M , +DPU_LAYER_ROTATION_180_M , +DPU_LAYER_ROTATION_270_M , +}; + +static u32 to_dpu_rotation (u32 angle) +{ +u32 rot =DPU_LAYER_ROTATION_0 ; + +switch (angle) { +case 0 : +case DRM_MODE_ROTATE_0 : + rot =DPU_LAYER_ROTATION_0 ; +break ; +case DRM_MODE_ROTATE_90 : + rot =DPU_LAYER_ROTATION_90 ; +break ; +case DRM_MODE_ROTATE_180 : + rot =DPU_LAYER_ROTATION_180 ; +break ; +case DRM_MODE_ROTATE_270 : + rot =DPU_LAYER_ROTATION_270 ; +break ; +case DRM_MODE_REFLECT_Y : + rot =DPU_LAYER_ROTATION_180_M ; +break ; +case (DRM_MODE_REFLECT_Y |DRM_MODE_ROTATE_90 ): + rot =DPU_LAYER_ROTATION_90_M ; +break ; +case DRM_MODE_REFLECT_X : + rot =DPU_LAYER_ROTATION_0_M ; +break ; +case (DRM_MODE_REFLECT_X |DRM_MODE_ROTATE_90 ): + rot =DPU_LAYER_ROTATION_270_M ; +break ; +default : +pr_err ("rotation convert unsupport angle (drm)= 0x%x\n" , angle); +break ; + } + +return rot; +} + +static u32 dpu_img_ctrl (u32 format,u32 blending,u32 rotation) +{ +int reg_val =0 ; + +/* layer enable */ + reg_val |=BIT (0 ); + +switch (format) { +case DRM_FORMAT_BGRA8888 : +/* BGRA8888 -> ARGB8888 */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B3B2B1B0 <<8 ; + reg_val |= (DPU_LAYER_FORMAT_ARGB8888 <<4 ); +break ; +case DRM_FORMAT_RGBX8888 : +case DRM_FORMAT_RGBA8888 : +/* RGBA8888 -> ABGR8888 */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B3B2B1B0 <<8 ; +/* FALLTHRU */ +case DRM_FORMAT_ABGR8888 : +/* rb switch */ + reg_val |=BIT (10 ); +/* FALLTHRU */ +case DRM_FORMAT_ARGB8888 : + reg_val |= (DPU_LAYER_FORMAT_ARGB8888 <<4 ); +break ; +case DRM_FORMAT_XBGR8888 : +/* rb switch */ + reg_val |=BIT (10 ); +/* FALLTHRU */ +case DRM_FORMAT_XRGB8888 : + reg_val |= (DPU_LAYER_FORMAT_ARGB8888 <<4 ); +break ; +case DRM_FORMAT_BGR565 : +/* rb switch */ + reg_val |=BIT (10 ); +/* FALLTHRU */ +case DRM_FORMAT_RGB565 : + reg_val |= (DPU_LAYER_FORMAT_RGB565 <<4 ); +break ; +case DRM_FORMAT_NV12 : +/* 2-Lane: Yuv420 */ + reg_val |=DPU_LAYER_FORMAT_YUV420_2PLANE <<4 ; +/* Y endian */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B0B1B2B3 <<8 ; +/* UV endian */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B0B1B2B3 <<10 ; +break ; +case DRM_FORMAT_NV21 : +/* 2-Lane: Yuv420 */ + reg_val |=DPU_LAYER_FORMAT_YUV420_2PLANE <<4 ; +/* Y endian */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B0B1B2B3 <<8 ; +/* UV endian */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B3B2B1B0 <<10 ; +break ; +case DRM_FORMAT_NV16 : +/* 2-Lane: Yuv422 */ + reg_val |=DPU_LAYER_FORMAT_YUV422_2PLANE <<4 ; +/* Y endian */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B3B2B1B0 <<8 ; +/* UV endian */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B3B2B1B0 <<10 ; +break ; +case DRM_FORMAT_NV61 : +/* 2-Lane: Yuv422 */ + reg_val |=DPU_LAYER_FORMAT_YUV422_2PLANE <<4 ; +/* Y endian */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B0B1B2B3 <<8 ; +/* UV endian */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B0B1B2B3 <<10 ; +break ; +case DRM_FORMAT_YUV420 : + reg_val |=DPU_LAYER_FORMAT_YUV420_3PLANE <<4 ; +/* Y endian */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B0B1B2B3 <<8 ; +/* UV endian */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B0B1B2B3 <<10 ; +break ; +case DRM_FORMAT_YVU420 : + reg_val |=DPU_LAYER_FORMAT_YUV420_3PLANE <<4 ; +/* Y endian */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B0B1B2B3 <<8 ; +/* UV endian */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B3B2B1B0 <<10 ; +break ; +default : +pr_err ("error: invalid format %c%c%c%c\n" , format, + format >>8 , + format >>16 , + format >>24 ); +break ; + } + +switch (blending) { +case DRM_MODE_BLEND_PIXEL_NONE : +/* don't do blending, maybe RGBX */ +/* alpha mode select - layer alpha */ + reg_val |=BIT (2 ); +break ; +case DRM_MODE_BLEND_COVERAGE : +/* alpha mode select - combo alpha */ + reg_val |=BIT (3 ); +/*Normal mode*/ + reg_val &= (~BIT (16 )); +break ; +case DRM_MODE_BLEND_PREMULTI : +/* alpha mode select - combo alpha */ + reg_val |=BIT (3 ); +/*Pre-mult mode*/ + reg_val |=BIT (16 ); +break ; +default : +/* alpha mode select - layer alpha */ + reg_val |=BIT (2 ); +break ; + } + + rotation =to_dpu_rotation (rotation); + reg_val |= (rotation &0x7 ) <<20 ; + +return reg_val; +} + +static void dpu_bgcolor (struct dpu_context *ctx,u32 color) +{ +struct dpu_reg *reg = (struct dpu_reg *)ctx->base; + +if (ctx->if_type ==SPRD_DISPC_IF_EDPI ) +dpu_wait_stop_done (ctx); + + reg->bg_color = color; + +dpu_clean_all (ctx); + +if ((ctx->if_type ==SPRD_DISPC_IF_DPI ) && !ctx->stopped) { + reg->dpu_ctrl |=BIT (2 ); +dpu_wait_update_done (ctx); + }else if (ctx->if_type ==SPRD_DISPC_IF_EDPI ) { + reg->dpu_ctrl |=BIT (0 ); + ctx->stopped = false; + } +} + +static void dpu_layer (struct dpu_context *ctx, +struct sprd_dpu_layer *hwlayer) +{ +struct dpu_reg *reg = (struct dpu_reg *)ctx->base; +const struct drm_format_info *info; +struct layer_reg *layer; +u32 addr, size, offset; +int i; + + layer = ®->layers[hwlayer->index]; + offset = (hwlayer->dst_x &0xffff ) | ((hwlayer->dst_y) <<16 ); + +if (hwlayer->src_w && hwlayer->src_h) + size = (hwlayer->src_w &0xffff ) | ((hwlayer->src_h) <<16 ); +else + size = (hwlayer->dst_w &0xffff ) | ((hwlayer->dst_h) <<16 ); + +for (i =0 ; i < hwlayer->planes; i++) { + addr = hwlayer->addr[i]; + +if (addr %16 ) +pr_err ("layer addr[%d] is not 16 bytes align, it's 0x%08x\n" , + i, addr); + layer->addr[i] = addr; + } + + layer->pos = offset; + layer->size = size; + layer->crop_start = (hwlayer->src_y <<16 ) | hwlayer->src_x; + layer->alpha = hwlayer->alpha; + + info =drm_format_info (hwlayer->format); +if (info->cpp[0 ] ==0 ) { +pr_err ("layer[%d] bytes per pixel is invalid\n" , hwlayer->index); +return ; + } + +if (hwlayer->planes ==3 ) +/* UV pitch is 1/2 of Y pitch*/ + layer->pitch = (hwlayer->pitch[0 ] / info->cpp[0 ]) | + (hwlayer->pitch[0 ] / info->cpp[0 ] <<15 ); +else + layer->pitch = hwlayer->pitch[0 ] / info->cpp[0 ]; + + layer->ctrl =dpu_img_ctrl (hwlayer->format, hwlayer->blending, + hwlayer->rotation); + +pr_debug ("dst_x = %d, dst_y = %d, dst_w = %d, dst_h = %d\n" , + hwlayer->dst_x, hwlayer->dst_y, + hwlayer->dst_w, hwlayer->dst_h); +pr_debug ("start_x = %d, start_y = %d, start_w = %d, start_h = %d\n" , + hwlayer->src_x, hwlayer->src_y, + hwlayer->src_w, hwlayer->src_h); +} + +static void dpu_flip (struct dpu_context *ctx, +struct sprd_dpu_layer layers[],u8 count) +{ +struct dpu_reg *reg = (struct dpu_reg *)ctx->base; +int i; + +/* +* Make sure the dpu is in stop status. DPU_R2P0 has no shadow +* registers in EDPI mode. So the config registers can only be +* updated in the rising edge of DPU_RUN bit. +*/ +if (ctx->if_type ==SPRD_DISPC_IF_EDPI ) +dpu_wait_stop_done (ctx); + +/* reset the bgcolor to black */ + reg->bg_color =0 ; + +/* disable all the layers */ +dpu_clean_all (ctx); + +/* start configure dpu layers */ +for (i =0 ; i < count; i++) +dpu_layer (ctx, &layers[i]); + +/* update trigger and wait */ +if (ctx->if_type ==SPRD_DISPC_IF_DPI ) { +if (!ctx->stopped) { + reg->dpu_ctrl |=BIT (2 ); +dpu_wait_update_done (ctx); + } + + reg->dpu_int_en |=DISPC_INT_ERR_MASK ; + + }else if (ctx->if_type ==SPRD_DISPC_IF_EDPI ) { + reg->dpu_ctrl |=BIT (0 ); + + ctx->stopped = false; + } + +/* +* If the following interrupt was disabled in isr, +* re-enable it. +*/ + reg->dpu_int_en |=DISPC_INT_FBC_PLD_ERR_MASK | +DISPC_INT_FBC_HDR_ERR_MASK | +DISPC_INT_MMU_VAOR_RD_MASK | +DISPC_INT_MMU_VAOR_WR_MASK | +DISPC_INT_MMU_INV_RD_MASK | +DISPC_INT_MMU_INV_WR_MASK ; +} + +static void dpu_dpi_init (struct dpu_context *ctx) +{ +struct dpu_reg *reg = (struct dpu_reg *)ctx->base; +u32 int_mask =0 ; + +if (ctx->if_type ==SPRD_DISPC_IF_DPI ) { +/* use dpi as interface */ + reg->dpu_cfg0 &= ~BIT (0 ); + +/* disable Halt function for SPRD DSI */ + reg->dpi_ctrl &= ~BIT (16 ); + +/* select te from external pad */ + reg->dpi_ctrl |=BIT (10 ); + +/* set dpi timing */ + reg->dpi_h_timing = (ctx->vm.hsync_len <<0 ) | + (ctx->vm.hback_porch <<8 ) | + (ctx->vm.hfront_porch <<20 ); + reg->dpi_v_timing = (ctx->vm.vsync_len <<0 ) | + (ctx->vm.vback_porch <<8 ) | + (ctx->vm.vfront_porch <<20 ); +if (ctx->vm.vsync_len + ctx->vm.vback_porch <32 ) +pr_warn ("Warning: (vsync + vbp) < 32, " +"underflow risk!\n" ); + +/* enable dpu update done INT */ + int_mask |=DISPC_INT_UPDATE_DONE_MASK ; +/* enable dpu DONE INT */ + int_mask |=DISPC_INT_DONE_MASK ; +/* enable dpu dpi vsync */ + int_mask |=DISPC_INT_DPI_VSYNC_MASK ; +/* enable dpu TE INT */ + int_mask |=DISPC_INT_TE_MASK ; +/* enable underflow err INT */ + int_mask |=DISPC_INT_ERR_MASK ; +/* enable write back done INT */ + int_mask |=DISPC_INT_WB_DONE_MASK ; +/* enable write back fail INT */ + int_mask |=DISPC_INT_WB_FAIL_MASK ; + + }else if (ctx->if_type ==SPRD_DISPC_IF_EDPI ) { +/* use edpi as interface */ + reg->dpu_cfg0 |=BIT (0 ); + +/* use external te */ + reg->dpi_ctrl |=BIT (10 ); + +/* enable te */ + reg->dpi_ctrl |=BIT (8 ); + +/* enable stop DONE INT */ + int_mask |=DISPC_INT_DONE_MASK ; +/* enable TE INT */ + int_mask |=DISPC_INT_TE_MASK ; + } + +/* enable ifbc payload error INT */ + int_mask |=DISPC_INT_FBC_PLD_ERR_MASK ; +/* enable ifbc header error INT */ + int_mask |=DISPC_INT_FBC_HDR_ERR_MASK ; +/* enable iommu va out of range read error INT */ + int_mask |=DISPC_INT_MMU_VAOR_RD_MASK ; +/* enable iommu va out of range write error INT */ + int_mask |=DISPC_INT_MMU_VAOR_WR_MASK ; +/* enable iommu invalid read error INT */ + int_mask |=DISPC_INT_MMU_INV_RD_MASK ; +/* enable iommu invalid write error INT */ + int_mask |=DISPC_INT_MMU_INV_WR_MASK ; + + reg->dpu_int_en = int_mask; +} + +static void enable_vsync (struct dpu_context *ctx) +{ +struct dpu_reg *reg = (struct dpu_reg *)ctx->base; + + reg->dpu_int_en |=DISPC_INT_DPI_VSYNC_MASK ; +} + +static void disable_vsync (struct dpu_context *ctx) +{ +struct dpu_reg *reg = (struct dpu_reg *)ctx->base; + + reg->dpu_int_en &= ~DISPC_INT_DPI_VSYNC_MASK ; +} + +static const u32 primary_fmts[] = { +DRM_FORMAT_XRGB8888 ,DRM_FORMAT_XBGR8888 , +DRM_FORMAT_ARGB8888 ,DRM_FORMAT_ABGR8888 , +DRM_FORMAT_RGBA8888 ,DRM_FORMAT_BGRA8888 , +DRM_FORMAT_RGBX8888 ,DRM_FORMAT_BGRX8888 , +DRM_FORMAT_RGB565 ,DRM_FORMAT_BGR565 , +DRM_FORMAT_NV12 ,DRM_FORMAT_NV21 , +DRM_FORMAT_NV16 ,DRM_FORMAT_NV61 , +DRM_FORMAT_YUV420 ,DRM_FORMAT_YVU420 , +}; + +static int dpu_capability (struct dpu_context *ctx, +struct dpu_capability *cap) +{ +if (!cap) +return -EINVAL ; + + cap->max_layers =6 ; + cap->fmts_ptr = primary_fmts; + cap->fmts_cnt =ARRAY_SIZE (primary_fmts); + +return 0 ; +} + +const struct dpu_core_ops sharkl3_dpu_core_ops = { + .init = dpu_init, + .fini = dpu_fini, + .run = dpu_run, + .stop = dpu_stop, + .isr = dpu_isr, + .ifconfig = dpu_dpi_init, + .capability = dpu_capability, + .flip = dpu_flip, + .bg_color = dpu_bgcolor, + .enable_vsync = enable_vsync, + .disable_vsync = disable_vsync, +};drivers/gpu/drm/sprd/sprd_dpu.c new file +439
-0@@ -0,0 +1,586 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2020 Unisoc Inc. +*/ + +#include <linux/component.h> +#include <linux/dma-buf.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/of_device.h> +#include <linux/of_irq.h> + +#include <drm/drm_atomic_helper.h> +#include <drm/drm_crtc_helper.h> +#include <drm/drm_fb_cma_helper.h> +#include <drm/drm_gem_cma_helper.h> +#include <drm/drm_gem_framebuffer_helper.h> +#include <drm/drm_plane_helper.h> + +#include "sprd_drm.h" +#include "sprd_dpu.h" + +struct sprd_plane { +struct drm_plane plane; +u32 index; +}; + +static int sprd_dpu_init (struct sprd_dpu *dpu); +static int sprd_dpu_fini (struct sprd_dpu *dpu); + +static inline struct sprd_plane *to_sprd_plane (struct drm_plane *plane) +{ + return container_of(plane, struct sprd_plane, plane); +} + +static int sprd_plane_atomic_check (struct drm_plane *plane, +struct drm_plane_state *state) +{ +DRM_DEBUG ("%s()\n" , __func__); + +return 0 ; +} + +static void sprd_plane_atomic_update (struct drm_plane *plane, +struct drm_plane_state *old_state) +{ +struct drm_plane_state *state = plane->state; +struct drm_framebuffer *fb = plane->state->fb; +struct drm_gem_cma_object *cma_obj; +struct sprd_plane *p =to_sprd_plane (plane); +struct sprd_dpu *dpu =crtc_to_dpu (plane->state->crtc); +struct sprd_dpu_layer *layer = &dpu->layers[p->index]; +int i; + +if (plane->state->crtc->state->active_changed) { +DRM_DEBUG ("resume or suspend, no need to update plane\n" ); +return ; + } + + layer->index = p->index; + layer->src_x = state->src_x >>16 ; + layer->src_y = state->src_y >>16 ; + layer->src_w = state->src_w >>16 ; + layer->src_h = state->src_h >>16 ; + layer->dst_x = state->crtc_x; + layer->dst_y = state->crtc_y; + layer->dst_w = state->crtc_w; + layer->dst_h = state->crtc_h; + layer->alpha = state->alpha; + layer->blending = state->pixel_blend_mode; + layer->rotation = state->rotation; + layer->planes = fb->format->num_planes; + layer->format = fb->format->format; + +DRM_DEBUG ("%s() alpha = %u, blending = %u, rotation = %u\n" , + __func__, layer->alpha, layer->blending, layer->rotation); + +for (i =0 ; i < layer->planes; i++) { + cma_obj =drm_fb_cma_get_gem_obj (fb, i); + layer->addr[i] = cma_obj->paddr + fb->offsets[i]; + layer->pitch[i] = fb->pitches[i]; + } + + dpu->pending_planes++; +} + +static void sprd_plane_atomic_disable (struct drm_plane *plane, +struct drm_plane_state *old_state) +{ +struct sprd_plane *p =to_sprd_plane (plane); + +/* +* NOTE: +* The dpu->core->flip() will disable all the planes each time. +* So there is no need to impliment the atomic_disable() function. +* But this function can not be removed, because it will change +* to call atomic_update() callback instead. Which will cause +* kernel panic in sprd_plane_atomic_update(). +* +* We do nothing here but just print a debug log. +*/ +DRM_DEBUG ("%s() layer_id = %u\n" , __func__, p->index); +} + +static int sprd_plane_create_properties (struct sprd_plane *p,int index) +{ +unsigned int supported_modes =BIT (DRM_MODE_BLEND_PIXEL_NONE ) | +BIT (DRM_MODE_BLEND_PREMULTI ) | +BIT (DRM_MODE_BLEND_COVERAGE ); + +/* create rotation property */ +drm_plane_create_rotation_property (&p->plane, +DRM_MODE_ROTATE_0 , +DRM_MODE_ROTATE_MASK | +DRM_MODE_REFLECT_MASK ); + +/* create alpha property */ +drm_plane_create_alpha_property (&p->plane); + +/* create blend mode property */ +drm_plane_create_blend_mode_property (&p->plane, supported_modes); + +/* create zpos property */ +drm_plane_create_zpos_immutable_property (&p->plane, index); + +return 0 ; +} + +static const struct drm_plane_helper_funcs sprd_plane_helper_funcs = { + .atomic_check = sprd_plane_atomic_check, + .atomic_update = sprd_plane_atomic_update, + .atomic_disable = sprd_plane_atomic_disable, +}; + +static const struct drm_plane_funcs sprd_plane_funcs = { + .update_plane = drm_atomic_helper_update_plane, + .disable_plane = drm_atomic_helper_disable_plane, + .destroy = drm_plane_cleanup, + .reset = drm_atomic_helper_plane_reset, + .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, +}; + +static struct drm_plane *sprd_plane_init (struct drm_device *drm, +struct sprd_dpu *dpu) +{ +struct drm_plane *primary =NULL ; +struct sprd_plane *p =NULL ; +struct dpu_capability cap = {}; +int err, i; + +if (dpu->core && dpu->core->capability) + dpu->core->capability (&dpu->ctx, &cap); + + dpu->layers =devm_kcalloc (drm->dev, cap.max_layers, +sizeof (struct sprd_dpu_layer ),GFP_KERNEL ); +if (!dpu->layers) +return ERR_PTR (-ENOMEM ); + +for (i =0 ; i < cap.max_layers; i++) { + + p =devm_kzalloc (drm->dev,sizeof (*p),GFP_KERNEL ); +if (!p) +return ERR_PTR (-ENOMEM ); + + err =drm_universal_plane_init (drm, &p->plane,1 , + &sprd_plane_funcs, cap.fmts_ptr, + cap.fmts_cnt,NULL , +DRM_PLANE_TYPE_PRIMARY ,NULL ); +if (err) { +DRM_ERROR ("fail to init primary plane\n" ); +return ERR_PTR (err); + } + +drm_plane_helper_add (&p->plane, &sprd_plane_helper_funcs); + +sprd_plane_create_properties (p, i); + + p->index = i; +if (i ==0 ) + primary = &p->plane; + } + +if (p) +DRM_INFO ("dpu plane init ok\n" ); + +return primary; +} + +static void sprd_crtc_mode_set_nofb (struct drm_crtc *crtc) +{ +struct sprd_dpu *dpu =crtc_to_dpu (crtc); + +if ((dpu->mode->hdisplay == dpu->mode->htotal) || + (dpu->mode->vdisplay == dpu->mode->vtotal)) + dpu->ctx.if_type =SPRD_DISPC_IF_EDPI ; +else + dpu->ctx.if_type =SPRD_DISPC_IF_DPI ; +} + +static enum drm_mode_status sprd_crtc_mode_valid (struct drm_crtc *crtc, +const struct drm_display_mode *mode) +{ +struct sprd_dpu *dpu =crtc_to_dpu (crtc); + +DRM_INFO ("%s() mode: " DRM_MODE_FMT "\n" , __func__,DRM_MODE_ARG (mode)); + +if (mode->type &DRM_MODE_TYPE_DEFAULT ) + dpu->mode = (struct drm_display_mode *)mode; + +if (mode->type &DRM_MODE_TYPE_PREFERRED ) { + dpu->mode = (struct drm_display_mode *)mode; +drm_display_mode_to_videomode (dpu->mode, &dpu->ctx.vm); + } + +return MODE_OK ; +} + +static void sprd_crtc_atomic_enable (struct drm_crtc *crtc, +struct drm_crtc_state *old_state) +{ +struct sprd_dpu *dpu =crtc_to_dpu (crtc); + +DRM_INFO ("%s()\n" , __func__); + +sprd_dpu_init (dpu); + +enable_irq (dpu->ctx.irq); + +drm_crtc_vblank_on (crtc); +} + +static void sprd_crtc_atomic_disable (struct drm_crtc *crtc, +struct drm_crtc_state *old_state) +{ +struct sprd_dpu *dpu =crtc_to_dpu (crtc); +struct drm_device *drm = dpu->crtc.dev; + +DRM_INFO ("%s()\n" , __func__); + +drm_crtc_vblank_off (crtc); + +disable_irq (dpu->ctx.irq); + +sprd_dpu_fini (dpu); + +spin_lock_irq (&drm->event_lock); +if (crtc->state->event) { +drm_crtc_send_vblank_event (crtc, crtc->state->event); + crtc->state->event =NULL ; + } +spin_unlock_irq (&drm->event_lock); +} + +static int sprd_crtc_atomic_check (struct drm_crtc *crtc, +struct drm_crtc_state *state) +{ +DRM_DEBUG ("%s()\n" , __func__); + +return 0 ; +} + +static void sprd_crtc_atomic_begin (struct drm_crtc *crtc, +struct drm_crtc_state *old_state) +{ +struct sprd_dpu *dpu =crtc_to_dpu (crtc); + +DRM_DEBUG ("%s()\n" , __func__); + +memset (dpu->layers,0 ,sizeof (*dpu->layers) * dpu->pending_planes); + + dpu->pending_planes =0 ; +} + +static void sprd_crtc_atomic_flush (struct drm_crtc *crtc, +struct drm_crtc_state *old_state) + +{ +struct sprd_dpu *dpu =crtc_to_dpu (crtc); +struct drm_device *drm = dpu->crtc.dev; + +DRM_DEBUG ("%s()\n" , __func__); + +if (dpu->core && dpu->core->flip && dpu->pending_planes) + dpu->core->flip (&dpu->ctx, dpu->layers, dpu->pending_planes); + +spin_lock_irq (&drm->event_lock); +if (crtc->state->event) { +drm_crtc_send_vblank_event (crtc, crtc->state->event); + crtc->state->event =NULL ; + } +spin_unlock_irq (&drm->event_lock); +} + +static int sprd_crtc_enable_vblank (struct drm_crtc *crtc) +{ +struct sprd_dpu *dpu =crtc_to_dpu (crtc); + +DRM_DEBUG ("%s()\n" , __func__); + +if (dpu->core && dpu->core->enable_vsync) + dpu->core->enable_vsync (&dpu->ctx); + +return 0 ; +} + +static void sprd_crtc_disable_vblank (struct drm_crtc *crtc) +{ +struct sprd_dpu *dpu =crtc_to_dpu (crtc); + +DRM_DEBUG ("%s()\n" , __func__); + +if (dpu->core && dpu->core->disable_vsync) + dpu->core->disable_vsync (&dpu->ctx); +} + +static int sprd_crtc_create_properties (struct drm_crtc *crtc) +{ +struct sprd_dpu *dpu =crtc_to_dpu (crtc); +struct drm_device *drm = dpu->crtc.dev; +struct drm_property *prop; +struct drm_property_blob *blob; +size_t blob_size; + + blob_size =strlen (dpu->ctx.version) +1 ; + + blob =drm_property_create_blob (dpu->crtc.dev, blob_size, + dpu->ctx.version); +if (IS_ERR (blob)) { +DRM_ERROR ("drm_property_create_blob dpu version failed\n" ); +return PTR_ERR (blob); + } + +/* create dpu version property */ + prop =drm_property_create (drm, +DRM_MODE_PROP_IMMUTABLE |DRM_MODE_PROP_BLOB , +"dpu version" ,0 ); +if (!prop) { +DRM_ERROR ("drm_property_create dpu version failed\n" ); +return -ENOMEM ; + } +drm_object_attach_property (&crtc->base, prop, blob->base.id); + +return 0 ; +} + +static const struct drm_crtc_helper_funcs sprd_crtc_helper_funcs = { + .mode_set_nofb = sprd_crtc_mode_set_nofb, + .mode_valid = sprd_crtc_mode_valid, + .atomic_check = sprd_crtc_atomic_check, + .atomic_begin = sprd_crtc_atomic_begin, + .atomic_flush = sprd_crtc_atomic_flush, + .atomic_enable = sprd_crtc_atomic_enable, + .atomic_disable = sprd_crtc_atomic_disable, +}; + +static const struct drm_crtc_funcs sprd_crtc_funcs = { + .destroy = drm_crtc_cleanup, + .set_config = drm_atomic_helper_set_config, + .page_flip = drm_atomic_helper_page_flip, + .reset = drm_atomic_helper_crtc_reset, + .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, + .enable_vblank = sprd_crtc_enable_vblank, + .disable_vblank = sprd_crtc_disable_vblank, +}; + +static int sprd_crtc_init (struct drm_device *drm,struct drm_crtc *crtc, +struct drm_plane *primary) +{ +struct device_node *port; +int err; + +/* +* set crtc port so that drm_of_find_possible_crtcs call works +*/ + port =of_parse_phandle (drm->dev->of_node,"ports" ,0 ); +if (!port) { +DRM_ERROR ("find 'ports' phandle of %s failed\n" , + drm->dev->of_node->full_name); +return -EINVAL ; + } +of_node_put (port); + crtc->port = port; + + err =drm_crtc_init_with_planes (drm, crtc, primary,NULL , + &sprd_crtc_funcs,NULL ); +if (err) { +DRM_ERROR ("failed to init crtc.\n" ); +return err; + } + +drm_mode_crtc_set_gamma_size (crtc,256 ); + +drm_crtc_helper_add (crtc, &sprd_crtc_helper_funcs); + +sprd_crtc_create_properties (crtc); + +DRM_INFO ("%s() ok\n" , __func__); +return 0 ; +} + +static int sprd_dpu_init (struct sprd_dpu *dpu) +{ +struct dpu_context *ctx = &dpu->ctx; + +if (dpu->core && dpu->core->init) + dpu->core->init (ctx); +if (dpu->core && dpu->core->ifconfig) + dpu->core->ifconfig (ctx); + +return 0 ; +} + +static int sprd_dpu_fini (struct sprd_dpu *dpu) +{ +struct dpu_context *ctx = &dpu->ctx; + +if (dpu->core && dpu->core->fini) + dpu->core->fini (ctx); + +return 0 ; +} + +static irqreturn_t sprd_dpu_isr (int irq,void *data) +{ +struct sprd_dpu *dpu = data; +struct dpu_context *ctx = &dpu->ctx; +u32 int_mask =0 ; + +if (dpu->core && dpu->core->isr) + int_mask = dpu->core->isr (ctx); + +if (int_mask &DISPC_INT_ERR_MASK ) +DRM_WARN ("Warning: dpu underflow!\n" ); + +if ((int_mask &DISPC_INT_DPI_VSYNC_MASK )) +drm_crtc_handle_vblank (&dpu->crtc);
drivers/gpu/drm/sprd/sprd_dpu.c line 449
Quoted 10 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +10
-0+ +return IRQ_HANDLED ; +} + +static int sprd_dpu_irq_request (struct sprd_dpu *dpu) +{ +int err; +int irq_num; + + irq_num =irq_of_parse_and_map (dpu->dev.of_node,0 );
Use platform_get_irq instead.
drivers/gpu/drm/sprd/sprd_dpu.c line 456
Quoted 7 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +7
-0+if (!irq_num) { +DRM_ERROR ("error: dpu parse irq num failed\n" ); +return -EINVAL ; + } +DRM_INFO ("dpu irq_num = %d\n" , irq_num); + +irq_set_status_flags (irq_num,IRQ_NOAUTOEN );
I think you shouldn't need this. Make sure you've disabled interrupts in the h/w first or that the handler can handle it if you haven't.
Quoted 75 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +75
-0+ err =devm_request_irq (&dpu->dev, irq_num, sprd_dpu_isr, +0 ,"DISPC" , dpu); +if (err) { +DRM_ERROR ("error: dpu request irq failed\n" ); +return -EINVAL ; + } + dpu->ctx.irq = irq_num; + +return 0 ; +} + +static int sprd_dpu_bind (struct device *dev,struct device *master,void *data) +{ +struct drm_device *drm = data; +struct sprd_dpu *dpu =dev_get_drvdata (dev); +struct drm_plane *plane; +int err; + +DRM_INFO ("%s()\n" , __func__); + + plane =sprd_plane_init (drm, dpu); +if (IS_ERR_OR_NULL (plane)) { + err =PTR_ERR (plane); +return err; + } + + err =sprd_crtc_init (drm, &dpu->crtc, plane); +if (err) +return err; + +sprd_dpu_irq_request (dpu); + +return 0 ; +} + +static void sprd_dpu_unbind (struct device *dev,struct device *master, +void *data) +{ +struct sprd_dpu *dpu =dev_get_drvdata (dev); + +DRM_INFO ("%s()\n" , __func__); + +drm_crtc_cleanup (&dpu->crtc); +} + +static const struct component_ops dpu_component_ops = { + .bind = sprd_dpu_bind, + .unbind = sprd_dpu_unbind, +}; + +static int sprd_dpu_context_init (struct sprd_dpu *dpu, +struct device_node *np) +{ +struct resource r; +struct dpu_context *ctx = &dpu->ctx; + +if (of_address_to_resource (np,0 , &r)) { +DRM_ERROR ("parse dt base address failed\n" ); +return -ENODEV ; + } + ctx->base = (unsigned long )ioremap (r.start, +resource_size (&r)); +if (ctx->base ==0 ) { +DRM_ERROR ("ioremap base address failed\n" ); +return -EFAULT ; + } + +return 0 ; +} + +static const struct sprd_dpu_ops sharkl3_dpu = { + .core = &sharkl3_dpu_core_ops, +}; + +static const struct of_device_id dpu_match_table[] = {
drivers/gpu/drm/sprd/sprd_dpu.c line 541
Quoted 10 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +10
-0+ { .compatible = "sprd,sharkl3-dpu", + .data = &sharkl3_dpu }, + { /* sentinel */ }, +}; + +static int sprd_dpu_probe (struct platform_device *pdev) +{ +struct device_node *np = pdev->dev.of_node; +const struct of_device_id *of_id = +of_match_node (dpu_match_table, np);
Don't need this.
Quoted 202 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +45
-0+const struct sprd_dpu_ops *pdata; +struct sprd_dpu *dpu; +int ret; + + dpu =devm_kzalloc (&pdev->dev,sizeof (*dpu),GFP_KERNEL ); +if (!dpu) +return -ENOMEM ; + + pdata =of_device_get_match_data (&pdev->dev); +if (pdata) { + dpu->core = pdata->core; + dpu->ctx.version ="dpu-r2p0" ; + }else { +DRM_ERROR ("Can't get %s ops data\n" , of_id->name); +return -EINVAL ; + } + + ret =sprd_dpu_context_init (dpu, np); +if (ret) +return ret; + +platform_set_drvdata (pdev, dpu); + +return component_add (&pdev->dev, &dpu_component_ops); +} + +static int sprd_dpu_remove (struct platform_device *pdev) +{ +component_del (&pdev->dev, &dpu_component_ops); +return 0 ; +} + +struct platform_driver sprd_dpu_driver = { + .probe = sprd_dpu_probe, + .remove = sprd_dpu_remove, + .driver = { + .name ="sprd-dpu-drv" , + .of_match_table = dpu_match_table, + }, +}; + +MODULE_AUTHOR ("Leon He <[email protected]>" ); +MODULE_AUTHOR ("Kevin Tang <[email protected]>" ); +MODULE_DESCRIPTION ("Unisoc Display Controller Driver" ); +MODULE_LICENSE ("GPL v2" );drivers/gpu/drm/sprd/sprd_dpu.h new file +127
-0@@ -0,0 +1,127 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020 Unisoc Inc. +*/ + +#ifndef __SPRD_DPU_H__ +#define __SPRD_DPU_H__ + +#include <linux/bug.h> +#include <linux/delay.h> +#include <linux/device.h> +#include <linux/kernel.h> +#include <linux/platform_device.h> +#include <linux/string.h> +#include <video/videomode.h> + +#include <drm/drm_crtc.h> +#include <drm/drm_fourcc.h> +#include <drm/drm_print.h> +#include <drm/drm_vblank.h> +#include <uapi/drm/drm_mode.h> +#include "disp_lib.h" + +#define DISPC_INT_DONE_MASK BIT(0) +#define DISPC_INT_TE_MASK BIT(1) +#define DISPC_INT_ERR_MASK BIT(2) +#define DISPC_INT_EDPI_TE_MASK BIT(3) +#define DISPC_INT_UPDATE_DONE_MASK BIT(4) +#define DISPC_INT_DPI_VSYNC_MASK BIT(5) +#define DISPC_INT_WB_DONE_MASK BIT(6) +#define DISPC_INT_WB_FAIL_MASK BIT(7) + +/* NOTE: this mask is not a realy dpu interrupt mask */ +#define DISPC_INT_FENCE_SIGNAL_REQUEST BIT(31) + +enum { +SPRD_DISPC_IF_DBI =0 , +SPRD_DISPC_IF_DPI , +SPRD_DISPC_IF_EDPI , +SPRD_DISPC_IF_LIMIT +}; + +enum { +SPRD_IMG_DATA_ENDIAN_B0B1B2B3 =0 , +SPRD_IMG_DATA_ENDIAN_B3B2B1B0 , +SPRD_IMG_DATA_ENDIAN_B2B3B0B1 , +SPRD_IMG_DATA_ENDIAN_B1B0B3B2 , +SPRD_IMG_DATA_ENDIAN_LIMIT +}; + +struct sprd_dpu_layer { +u8 index; +u8 planes; +u32 addr[4 ]; +u32 pitch[4 ]; +s16 src_x; +s16 src_y; +s16 src_w; +s16 src_h; +s16 dst_x; +s16 dst_y; +u16 dst_w; +u16 dst_h; +u32 format; +u32 alpha; +u32 blending; +u32 rotation; +}; + +struct dpu_capability { +u32 max_layers; +const u32 *fmts_ptr; +u32 fmts_cnt; +}; + +struct dpu_context ; + +struct dpu_core_ops { +int (*init)(struct dpu_context *ctx); +void (*fini)(struct dpu_context *ctx); +void (*run)(struct dpu_context *ctx); +void (*stop)(struct dpu_context *ctx); +void (*disable_vsync)(struct dpu_context *ctx); +void (*enable_vsync)(struct dpu_context *ctx); +u32 (*isr)(struct dpu_context *ctx); +void (*ifconfig)(struct dpu_context *ctx); +void (*flip)(struct dpu_context *ctx, +struct sprd_dpu_layer layers[],u8 count); +int (*capability)(struct dpu_context *ctx, +struct dpu_capability *cap); +void (*bg_color)(struct dpu_context *ctx,u32 color); +}; + +struct sprd_dpu_ops { +const struct dpu_core_ops *core; +}; + +struct dpu_context { +unsigned long base; +const char *version; +int irq; +u8 if_type; +struct videomode vm; +bool stopped; +wait_queue_head_t wait_queue; +bool evt_update; +bool evt_stop; +}; + +struct sprd_dpu { +struct device dev; +struct drm_crtc crtc; +struct dpu_context ctx; +const struct dpu_core_ops *core; +struct drm_display_mode *mode; +struct sprd_dpu_layer *layers; +u8 pending_planes; +}; + +static inline struct sprd_dpu *crtc_to_dpu (struct drm_crtc *crtc) +{ + return crtc ? container_of(crtc, struct sprd_dpu, crtc) : NULL; +} + +extern const struct dpu_core_ops sharkl3_dpu_core_ops; + +#endif drivers/gpu/drm/sprd/sprd_drm.c +1
-0@@ -200,6 +200,7 @@ static struct platform_driver sprd_drm_driver = {static struct platform_driver *sprd_drm_drivers[] = { &sprd_drm_driver, + &sprd_dpu_driver, };static int __init sprd_drm_init (void )drivers/gpu/drm/sprd/sprd_drm.h +2
-1@@ -13,4 +13,6 @@ struct sprd_drm { struct drm_device *drm; }; +extern struct platform_driver sprd_dpu_driver; +#endif /* _SPRD_DRM_H_ */ --
Quoted 2 lines
2.7.4
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH RFC v4 4/6] drm/sprd: add Unisoc's drm display controller driver
Quoted 292 lines · Rob Herring
Quoted 2 lines · Kevin Tang
Adds DPU(Display Processor Unit) support for the Unisoc's display
subsystem.
Quoted 1 line
It's support multi planes, scaler, rotation, PQ(Picture Quality) and
more.
Quoted 9 lines
Cc Orson Zhai <[email protected]>Cc Baolin Wang <[email protected]>Cc Chunyan Zhang <[email protected]>Signed-off-by Kevin Tang <[email protected]>--- drivers/gpu/drm/sprd/Makefile | 5 +- drivers/gpu/drm/sprd/dpu/Makefile | 7 + drivers/gpu/drm/sprd/dpu/dpu_r2p0.c | 770++++++++++++++++++++++++++++++++++++
Review
Quoted 11 lines
drivers/gpu/drm/sprd/sprd_dpu.c | 586 +++++++++++++++++++++++++++ drivers/gpu/drm/sprd/sprd_dpu.h | 127 ++++++ drivers/gpu/drm/sprd/sprd_drm.c | 1 + drivers/gpu/drm/sprd/sprd_drm.h | 2 + 7 files changed, 1497 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/sprd/dpu/Makefile create mode 100644 drivers/gpu/drm/sprd/dpu/dpu_r2p0.c create mode 100644 drivers/gpu/drm/sprd/sprd_dpu.c create mode 100644 drivers/gpu/drm/sprd/sprd_dpu.h(quoted diff) +0
-0b/drivers/gpu/drm/sprd/Makefile
Review
Quoted 13 lines
index 86d95d9..88ab32a 100644
drivers/gpu/drm/sprd/Makefile +4
-1@@ -2,4 +2,7 @@ subdir-ccflags-y += -I$(srctree)/$(src) -obj-y := sprd_drm.o +obj-y := sprd_drm.o \ + sprd_dpu.o + +obj-y += dpu/(quoted diff) +0
-0b/drivers/gpu/drm/sprd/dpu/Makefile
Review
Quoted 13 lines
new file mode 100644
index 0000000..73bd497drivers/gpu/drm/sprd/dpu/Makefile new file +7
-0@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 + +ifdef CONFIG_ARM64 +KBUILD_CFLAGS += -mstrict-align +endif + +obj-y += dpu_r2p0.o(quoted diff) +0
-0
b/drivers/gpu/drm/sprd/dpu/dpu_r2p0.cQuoted 32 lines
new file mode 100644
index 0000000..984fa9bdrivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +27
-0@@ -0,0 +1,770 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2020 Unisoc Inc. +*/ + +#include <linux/delay.h> +#include <linux/wait.h> +#include <linux/workqueue.h> +#include "sprd_dpu.h" + +#define DISPC_INT_FBC_PLD_ERR_MASK BIT(8) +#define DISPC_INT_FBC_HDR_ERR_MASK BIT(9) + +#define DISPC_INT_MMU_INV_WR_MASK BIT(19) +#define DISPC_INT_MMU_INV_RD_MASK BIT(18) +#define DISPC_INT_MMU_VAOR_WR_MASK BIT(17) +#define DISPC_INT_MMU_VAOR_RD_MASK BIT(16) + +struct layer_reg { +u32 addr[4 ]; +u32 ctrl; +u32 size; +u32 pitch; +u32 pos; +u32 alpha; +u32 ck; +u32 pallete;drivers/gpu/drm/sprd/dpu/dpu_r2p0.c line 37
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +10
-0+u32 crop_start; +}; + +struct wb_region_reg { +u32 pos; +u32 size; +}; + +/* dpu controller register */ +struct dpu_reg {structs for registers is not normal coding style. #defines of offsets is. More below.
Quoted 98 lines
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +98
-0+u32 dpu_version; +u32 dpu_ctrl; +u32 dpu_cfg0; +u32 dpu_cfg1; +u32 dpu_cfg2; +u32 dpu_secure; +u32 reserved_0x0018_0x001C[2 ]; +u32 panel_size; +u32 blend_size; +u32 reserved_0x0028; +u32 bg_color; +struct layer_reg layers[8 ]; +u32 wb_base_addr; +u32 wb_ctrl; +u32 wb_cfg; +u32 wb_pitch; +struct wb_region_reg region[3 ]; +u32 reserved_0x01D8_0x01DC[2 ]; +u32 dpu_int_en; +u32 dpu_int_clr; +u32 dpu_int_sts; +u32 dpu_int_raw; +u32 dpi_ctrl; +u32 dpi_h_timing; +u32 dpi_v_timing; +u32 reserved_0x01FC; +u32 dpu_enhance_cfg; +u32 reserved_0x0204_0x020C[3 ]; +u32 epf_epsilon; +u32 epf_gain0_3; +u32 epf_gain4_7; +u32 epf_diff; +u32 reserved_0x0220_0x023C[8 ]; +u32 hsv_lut_addr; +u32 hsv_lut_wdata; +u32 hsv_lut_rdata; +u32 reserved_0x024C_0x027C[13 ]; +u32 cm_coef01_00; +u32 cm_coef03_02; +u32 cm_coef11_10; +u32 cm_coef13_12; +u32 cm_coef21_20; +u32 cm_coef23_22; +u32 reserved_0x0298_0x02BC[10 ]; +u32 slp_cfg0; +u32 slp_cfg1; +u32 reserved_0x02C8_0x02FC[14 ]; +u32 gamma_lut_addr; +u32 gamma_lut_wdata; +u32 gamma_lut_rdata; +u32 reserved_0x030C_0x033C[13 ]; +u32 checksum_en; +u32 checksum0_start_pos; +u32 checksum0_end_pos; +u32 checksum1_start_pos; +u32 checksum1_end_pos; +u32 checksum0_result; +u32 checksum1_result; +u32 reserved_0x035C; +u32 dpu_sts[18 ]; +u32 reserved_0x03A8_0x03AC[2 ]; +u32 dpu_fbc_cfg0; +u32 dpu_fbc_cfg1; +u32 reserved_0x03B8_0x03EC[14 ]; +u32 rf_ram_addr; +u32 rf_ram_rdata_low; +u32 rf_ram_rdata_high; +u32 reserved_0x03FC_0x07FC[257 ]; +u32 mmu_en; +u32 mmu_update; +u32 mmu_min_vpn; +u32 mmu_vpn_range; +u32 mmu_pt_addr; +u32 mmu_default_page; +u32 mmu_vaor_addr_rd; +u32 mmu_vaor_addr_wr; +u32 mmu_inv_addr_rd; +u32 mmu_inv_addr_wr; +u32 mmu_uns_addr_rd; +u32 mmu_uns_addr_wr; +u32 mmu_miss_cnt; +u32 mmu_pt_update_qos; +u32 mmu_version; +u32 mmu_min_ppn1; +u32 mmu_ppn_range1; +u32 mmu_min_ppn2; +u32 mmu_ppn_range2; +u32 mmu_vpn_paor_rd; +u32 mmu_vpn_paor_wr; +u32 mmu_ppn_paor_rd; +u32 mmu_ppn_paor_wr; +u32 mmu_reg_au_manage; +u32 mmu_page_rd_ch; +u32 mmu_page_wr_ch; +u32 mmu_read_page_cmd_cnt; +u32 mmu_read_page_latency_cnt; +u32 mmu_page_max_latency; +};drivers/gpu/drm/sprd/dpu/dpu_r2p0.c
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +10
-0+ +static void dpu_dump (struct dpu_context *ctx) +{ +u32 *reg = (u32 *)ctx->base; +int i; + +pr_info (" 0 4 8 C\n" ); +for (i =0 ; i <256 ; i +=4 ) { + pr_info("%04x: 0x%08x 0x%08x 0x%08x 0x%08x\n", + i * 4, reg[i], reg[i + 1], reg[i + 2], reg[i +3]);
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +10
-0+ } +} + +static u32 check_mmu_isr (struct dpu_context *ctx,u32 reg_val) +{ +struct dpu_reg *reg = (struct dpu_reg *)ctx->base; +u32 mmu_mask =DISPC_INT_MMU_VAOR_RD_MASK | +DISPC_INT_MMU_VAOR_WR_MASK | +DISPC_INT_MMU_INV_RD_MASK | +DISPC_INT_MMU_INV_WR_MASK ;drivers/gpu/drm/sprd/dpu/dpu_r2p0.c
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +10
-0+u32 val = reg_val & mmu_mask; + +if (val) { +pr_err ("--- iommu interrupt err: 0x%04x ---\n" , val); + +pr_err ("iommu invalid read error, addr: 0x%08x\n" , + reg->mmu_inv_addr_rd); +pr_err ("iommu invalid write error, addr: 0x%08x\n" , + reg->mmu_inv_addr_wr); + pr_err("iommu va out of range read error, addr:0x%08x\n",
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c line 167
Quoted 2 lines
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +2
-0+ reg->mmu_vaor_addr_rd); + pr_err("iommu va out of range write error, addr:0x%08x\n",
Quoted 57 lines
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +57
-0+ reg->mmu_vaor_addr_wr); +pr_err ("BUG: iommu failure at %s:%d/%s()!\n" , + __FILE__, __LINE__, __func__); + +dpu_dump (ctx); + } + +return val; +} + +static void dpu_clean_all (struct dpu_context *ctx) +{ +int i; +struct dpu_reg *reg = (struct dpu_reg *)ctx->base; + +for (i =0 ; i <8 ; i++) + reg->layers[i].ctrl =0 ; +} + +static u32 dpu_isr (struct dpu_context *ctx) +{ +struct dpu_reg *reg = (struct dpu_reg *)ctx->base; +u32 reg_val, int_mask =0 ; + + reg_val = reg->dpu_int_sts; + +/* disable err interrupt */ +if (reg_val &DISPC_INT_ERR_MASK ) + int_mask |=DISPC_INT_ERR_MASK ; + +/* dpu update done isr */ +if (reg_val &DISPC_INT_UPDATE_DONE_MASK ) { + ctx->evt_update = true; +wake_up_interruptible_all (&ctx->wait_queue); + } + +/* dpu stop done isr */ +if (reg_val &DISPC_INT_DONE_MASK ) { + ctx->evt_stop = true; +wake_up_interruptible_all (&ctx->wait_queue); + } + +/* dpu ifbc payload error isr */ +if (reg_val &DISPC_INT_FBC_PLD_ERR_MASK ) { + int_mask |=DISPC_INT_FBC_PLD_ERR_MASK ; +pr_err ("dpu ifbc payload error\n" ); + } + +/* dpu ifbc header error isr */ +if (reg_val &DISPC_INT_FBC_HDR_ERR_MASK ) { + int_mask |=DISPC_INT_FBC_HDR_ERR_MASK ; +pr_err ("dpu ifbc header error\n" ); + } + + int_mask |=check_mmu_isr (ctx, reg_val); + + reg->dpu_int_clr = reg_val;
Quoted 9 lines
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c line 225
Quoted 1 line
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +1
-0+ reg->dpu_int_en &= ~int_mask;Also, not coding style. Use readl/writel{_relaxed}. This is fragile because the compiler has a lot of freedom in what it can do here including reordering the accesses, changing the access size or skipping the register access altogether. I don't think the latter would happen in this case, but if a read has side effects such as causing bits to clear you'll see problems.
This is maybe a bad design for a long time on our platform, but it ’s really convenient,
direct access I/O resources by structs...
So i will be try use readl/writel to replace it.
Quoted 1,034 lines
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c
Quoted 13 lines
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +12
-0+ +return reg_val; +} + +static int dpu_wait_stop_done (struct dpu_context *ctx) +{ +int rc; + +if (ctx->stopped) +return 0 ; + + rc = wait_event_interruptible_timeout(ctx->wait_queue,
ctx->evt_stop,Quoted 10 lines
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +10
-0+ msecs_to_jiffies(500)); + ctx->evt_stop = false; + + ctx->stopped = true; + +if (!rc) { +pr_err ("dpu wait for stop done time out!\n" ); +return -ETIMEDOUT ; + } +drivers/gpu/drm/sprd/dpu/dpu_r2p0.c
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +10
-0+return 0 ; +} + +static int dpu_wait_update_done (struct dpu_context *ctx) +{ +int rc; + + ctx->evt_update = false; + + rc = wait_event_interruptible_timeout(ctx->wait_queue,
ctx->evt_update,Quoted 124 lines
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +124
-0+ msecs_to_jiffies(500)); + +if (!rc) { +pr_err ("dpu wait for reg update done time out!\n" ); +return -ETIMEDOUT ; + } + +return 0 ; +} + +static void dpu_stop (struct dpu_context *ctx) +{ +struct dpu_reg *reg = (struct dpu_reg *)ctx->base; + +if (ctx->stopped) +return ; + +if (ctx->if_type ==SPRD_DISPC_IF_DPI ) + reg->dpu_ctrl |=BIT (1 ); + +dpu_wait_stop_done (ctx); + +pr_info ("dpu stop\n" ); +} + +static void dpu_run (struct dpu_context *ctx) +{ +struct dpu_reg *reg = (struct dpu_reg *)ctx->base; + +if (!ctx->stopped) +return ; + + reg->dpu_ctrl |=BIT (0 ); + + ctx->stopped = false; + +pr_info ("dpu run\n" ); +} + +static int dpu_init (struct dpu_context *ctx) +{ +struct dpu_reg *reg = (struct dpu_reg *)ctx->base; +u32 size; + + reg->bg_color =0 ; + + size = (ctx->vm.vactive <<16 ) | ctx->vm.hactive; + reg->panel_size = size; + reg->blend_size = size; + + reg->dpu_cfg0 =BIT (4 ) |BIT (5 ); + + reg->dpu_cfg1 =0x004466da ; + reg->dpu_cfg2 =0 ; + +if (ctx->stopped) +dpu_clean_all (ctx); + + reg->mmu_en =0 ; + reg->mmu_min_ppn1 =0 ; + reg->mmu_ppn_range1 =0xffff ; + reg->mmu_min_ppn2 =0 ; + reg->mmu_ppn_range2 =0xffff ; + reg->mmu_vpn_range =0x1ffff ; + + reg->dpu_int_clr =0xffff ; + +init_waitqueue_head (&ctx->wait_queue); + +return 0 ; +} + +static void dpu_fini (struct dpu_context *ctx) +{ +struct dpu_reg *reg = (struct dpu_reg *)ctx->base; + + reg->dpu_int_en =0 ; + reg->dpu_int_clr =0xff ; +} + +enum { +DPU_LAYER_FORMAT_YUV422_2PLANE , +DPU_LAYER_FORMAT_YUV420_2PLANE , +DPU_LAYER_FORMAT_YUV420_3PLANE , +DPU_LAYER_FORMAT_ARGB8888 , +DPU_LAYER_FORMAT_RGB565 , +DPU_LAYER_FORMAT_XFBC_ARGB8888 =8 , +DPU_LAYER_FORMAT_XFBC_RGB565 , +DPU_LAYER_FORMAT_MAX_TYPES , +}; + +enum { +DPU_LAYER_ROTATION_0 , +DPU_LAYER_ROTATION_90 , +DPU_LAYER_ROTATION_180 , +DPU_LAYER_ROTATION_270 , +DPU_LAYER_ROTATION_0_M , +DPU_LAYER_ROTATION_90_M , +DPU_LAYER_ROTATION_180_M , +DPU_LAYER_ROTATION_270_M , +}; + +static u32 to_dpu_rotation (u32 angle) +{ +u32 rot =DPU_LAYER_ROTATION_0 ; + +switch (angle) { +case 0 : +case DRM_MODE_ROTATE_0 : + rot =DPU_LAYER_ROTATION_0 ; +break ; +case DRM_MODE_ROTATE_90 : + rot =DPU_LAYER_ROTATION_90 ; +break ; +case DRM_MODE_ROTATE_180 : + rot =DPU_LAYER_ROTATION_180 ; +break ; +case DRM_MODE_ROTATE_270 : + rot =DPU_LAYER_ROTATION_270 ; +break ; +case DRM_MODE_REFLECT_Y : + rot =DPU_LAYER_ROTATION_180_M ; +break ; +case (DRM_MODE_REFLECT_Y |DRM_MODE_ROTATE_90 ):drivers/gpu/drm/sprd/dpu/dpu_r2p0.c
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +10
-0+ rot =DPU_LAYER_ROTATION_90_M ; +break ; +case DRM_MODE_REFLECT_X : + rot =DPU_LAYER_ROTATION_0_M ; +break ; +case (DRM_MODE_REFLECT_X |DRM_MODE_ROTATE_90 ): + rot =DPU_LAYER_ROTATION_270_M ; +break ; +default : + pr_err("rotation convert unsupport angle (drm)= 0x%x\n",angle);
Quoted 153 lines
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +153
-0+break ; + } + +return rot; +} + +static u32 dpu_img_ctrl (u32 format,u32 blending,u32 rotation) +{ +int reg_val =0 ; + +/* layer enable */ + reg_val |=BIT (0 ); + +switch (format) { +case DRM_FORMAT_BGRA8888 : +/* BGRA8888 -> ARGB8888 */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B3B2B1B0 <<8 ; + reg_val |= (DPU_LAYER_FORMAT_ARGB8888 <<4 ); +break ; +case DRM_FORMAT_RGBX8888 : +case DRM_FORMAT_RGBA8888 : +/* RGBA8888 -> ABGR8888 */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B3B2B1B0 <<8 ; +/* FALLTHRU */ +case DRM_FORMAT_ABGR8888 : +/* rb switch */ + reg_val |=BIT (10 ); +/* FALLTHRU */ +case DRM_FORMAT_ARGB8888 : + reg_val |= (DPU_LAYER_FORMAT_ARGB8888 <<4 ); +break ; +case DRM_FORMAT_XBGR8888 : +/* rb switch */ + reg_val |=BIT (10 ); +/* FALLTHRU */ +case DRM_FORMAT_XRGB8888 : + reg_val |= (DPU_LAYER_FORMAT_ARGB8888 <<4 ); +break ; +case DRM_FORMAT_BGR565 : +/* rb switch */ + reg_val |=BIT (10 ); +/* FALLTHRU */ +case DRM_FORMAT_RGB565 : + reg_val |= (DPU_LAYER_FORMAT_RGB565 <<4 ); +break ; +case DRM_FORMAT_NV12 : +/* 2-Lane: Yuv420 */ + reg_val |=DPU_LAYER_FORMAT_YUV420_2PLANE <<4 ; +/* Y endian */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B0B1B2B3 <<8 ; +/* UV endian */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B0B1B2B3 <<10 ; +break ; +case DRM_FORMAT_NV21 : +/* 2-Lane: Yuv420 */ + reg_val |=DPU_LAYER_FORMAT_YUV420_2PLANE <<4 ; +/* Y endian */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B0B1B2B3 <<8 ; +/* UV endian */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B3B2B1B0 <<10 ; +break ; +case DRM_FORMAT_NV16 : +/* 2-Lane: Yuv422 */ + reg_val |=DPU_LAYER_FORMAT_YUV422_2PLANE <<4 ; +/* Y endian */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B3B2B1B0 <<8 ; +/* UV endian */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B3B2B1B0 <<10 ; +break ; +case DRM_FORMAT_NV61 : +/* 2-Lane: Yuv422 */ + reg_val |=DPU_LAYER_FORMAT_YUV422_2PLANE <<4 ; +/* Y endian */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B0B1B2B3 <<8 ; +/* UV endian */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B0B1B2B3 <<10 ; +break ; +case DRM_FORMAT_YUV420 : + reg_val |=DPU_LAYER_FORMAT_YUV420_3PLANE <<4 ; +/* Y endian */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B0B1B2B3 <<8 ; +/* UV endian */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B0B1B2B3 <<10 ; +break ; +case DRM_FORMAT_YVU420 : + reg_val |=DPU_LAYER_FORMAT_YUV420_3PLANE <<4 ; +/* Y endian */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B0B1B2B3 <<8 ; +/* UV endian */ + reg_val |=SPRD_IMG_DATA_ENDIAN_B3B2B1B0 <<10 ; +break ; +default : +pr_err ("error: invalid format %c%c%c%c\n" , format, + format >>8 , + format >>16 , + format >>24 ); +break ; + } + +switch (blending) { +case DRM_MODE_BLEND_PIXEL_NONE : +/* don't do blending, maybe RGBX */ +/* alpha mode select - layer alpha */ + reg_val |=BIT (2 ); +break ; +case DRM_MODE_BLEND_COVERAGE : +/* alpha mode select - combo alpha */ + reg_val |=BIT (3 ); +/*Normal mode*/ + reg_val &= (~BIT (16 )); +break ; +case DRM_MODE_BLEND_PREMULTI : +/* alpha mode select - combo alpha */ + reg_val |=BIT (3 ); +/*Pre-mult mode*/ + reg_val |=BIT (16 ); +break ; +default : +/* alpha mode select - layer alpha */ + reg_val |=BIT (2 ); +break ; + } + + rotation =to_dpu_rotation (rotation); + reg_val |= (rotation &0x7 ) <<20 ; + +return reg_val; +} + +static void dpu_bgcolor (struct dpu_context *ctx,u32 color) +{ +struct dpu_reg *reg = (struct dpu_reg *)ctx->base; + +if (ctx->if_type ==SPRD_DISPC_IF_EDPI ) +dpu_wait_stop_done (ctx); + + reg->bg_color = color; + +dpu_clean_all (ctx); + +if ((ctx->if_type ==SPRD_DISPC_IF_DPI ) && !ctx->stopped) { + reg->dpu_ctrl |=BIT (2 ); +dpu_wait_update_done (ctx); + }else if (ctx->if_type ==SPRD_DISPC_IF_EDPI ) { + reg->dpu_ctrl |=BIT (0 ); + ctx->stopped = false; + } +} + +static void dpu_layer (struct dpu_context *ctx, +struct sprd_dpu_layer *hwlayer) +{ +struct dpu_reg *reg = (struct dpu_reg *)ctx->base;drivers/gpu/drm/sprd/dpu/dpu_r2p0.c
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +10
-0+const struct drm_format_info *info; +struct layer_reg *layer; +u32 addr, size, offset; +int i; + + layer = ®->layers[hwlayer->index]; + offset = (hwlayer->dst_x &0xffff ) | ((hwlayer->dst_y) <<16 ); + +if (hwlayer->src_w && hwlayer->src_h) + size = (hwlayer->src_w & 0xffff) | ((hwlayer->src_h) <<16);
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c line 556
Quoted 2 lines
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +2
-0+else + size = (hwlayer->dst_w & 0xffff) | ((hwlayer->dst_h) <<16);
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c
Quoted 6 lines
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +6
-0+ +for (i =0 ; i < hwlayer->planes; i++) { + addr = hwlayer->addr[i]; + +if (addr %16 ) + pr_err("layer addr[%d] is not 16 bytes align,it's 0x%08x\n",
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c
Quoted 12 lines
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +12
-0+ i, addr); + layer->addr[i] = addr; + } + + layer->pos = offset; + layer->size = size; + layer->crop_start = (hwlayer->src_y <<16 ) | hwlayer->src_x; + layer->alpha = hwlayer->alpha; + + info =drm_format_info (hwlayer->format); +if (info->cpp[0 ] ==0 ) { + pr_err("layer[%d] bytes per pixel is invalid\n",
hwlayer->index);Quoted 7 lines
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +7
-0+return ; + } + +if (hwlayer->planes ==3 ) +/* UV pitch is 1/2 of Y pitch*/ + layer->pitch = (hwlayer->pitch[0 ] / info->cpp[0 ]) | + (hwlayer->pitch[0 ] / info->cpp[0 ] <<15 );drivers/gpu/drm/sprd/dpu/dpu_r2p0.c
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +10
-0+else + layer->pitch = hwlayer->pitch[0 ] / info->cpp[0 ]; + + layer->ctrl =dpu_img_ctrl (hwlayer->format, hwlayer->blending, + hwlayer->rotation); + +pr_debug ("dst_x = %d, dst_y = %d, dst_w = %d, dst_h = %d\n" , + hwlayer->dst_x, hwlayer->dst_y, + hwlayer->dst_w, hwlayer->dst_h); + pr_debug("start_x = %d, start_y = %d, start_w = %d, start_h =%d\n",
Review
Quoted 180 lines
drivers/gpu/drm/sprd/dpu/dpu_r2p0.c new file +179
-0+ hwlayer->src_x, hwlayer->src_y, + hwlayer->src_w, hwlayer->src_h); +} + +static void dpu_flip (struct dpu_context *ctx, +struct sprd_dpu_layer layers[],u8 count) +{ +struct dpu_reg *reg = (struct dpu_reg *)ctx->base; +int i; + +/* +* Make sure the dpu is in stop status. DPU_R2P0 has no shadow +* registers in EDPI mode. So the config registers can only be +* updated in the rising edge of DPU_RUN bit. +*/ +if (ctx->if_type ==SPRD_DISPC_IF_EDPI ) +dpu_wait_stop_done (ctx); + +/* reset the bgcolor to black */ + reg->bg_color =0 ; + +/* disable all the layers */ +dpu_clean_all (ctx); + +/* start configure dpu layers */ +for (i =0 ; i < count; i++) +dpu_layer (ctx, &layers[i]); + +/* update trigger and wait */ +if (ctx->if_type ==SPRD_DISPC_IF_DPI ) { +if (!ctx->stopped) { + reg->dpu_ctrl |=BIT (2 ); +dpu_wait_update_done (ctx); + } + + reg->dpu_int_en |=DISPC_INT_ERR_MASK ; + + }else if (ctx->if_type ==SPRD_DISPC_IF_EDPI ) { + reg->dpu_ctrl |=BIT (0 ); + + ctx->stopped = false; + } + +/* +* If the following interrupt was disabled in isr, +* re-enable it. +*/ + reg->dpu_int_en |=DISPC_INT_FBC_PLD_ERR_MASK | +DISPC_INT_FBC_HDR_ERR_MASK | +DISPC_INT_MMU_VAOR_RD_MASK | +DISPC_INT_MMU_VAOR_WR_MASK | +DISPC_INT_MMU_INV_RD_MASK | +DISPC_INT_MMU_INV_WR_MASK ; +} + +static void dpu_dpi_init (struct dpu_context *ctx) +{ +struct dpu_reg *reg = (struct dpu_reg *)ctx->base; +u32 int_mask =0 ; + +if (ctx->if_type ==SPRD_DISPC_IF_DPI ) { +/* use dpi as interface */ + reg->dpu_cfg0 &= ~BIT (0 ); + +/* disable Halt function for SPRD DSI */ + reg->dpi_ctrl &= ~BIT (16 ); + +/* select te from external pad */ + reg->dpi_ctrl |=BIT (10 ); + +/* set dpi timing */ + reg->dpi_h_timing = (ctx->vm.hsync_len <<0 ) | + (ctx->vm.hback_porch <<8 ) | + (ctx->vm.hfront_porch <<20 ); + reg->dpi_v_timing = (ctx->vm.vsync_len <<0 ) | + (ctx->vm.vback_porch <<8 ) | + (ctx->vm.vfront_porch <<20 ); +if (ctx->vm.vsync_len + ctx->vm.vback_porch <32 ) +pr_warn ("Warning: (vsync + vbp) < 32, " +"underflow risk!\n" ); + +/* enable dpu update done INT */ + int_mask |=DISPC_INT_UPDATE_DONE_MASK ; +/* enable dpu DONE INT */ + int_mask |=DISPC_INT_DONE_MASK ; +/* enable dpu dpi vsync */ + int_mask |=DISPC_INT_DPI_VSYNC_MASK ; +/* enable dpu TE INT */ + int_mask |=DISPC_INT_TE_MASK ; +/* enable underflow err INT */ + int_mask |=DISPC_INT_ERR_MASK ; +/* enable write back done INT */ + int_mask |=DISPC_INT_WB_DONE_MASK ; +/* enable write back fail INT */ + int_mask |=DISPC_INT_WB_FAIL_MASK ; + + }else if (ctx->if_type ==SPRD_DISPC_IF_EDPI ) { +/* use edpi as interface */ + reg->dpu_cfg0 |=BIT (0 ); + +/* use external te */ + reg->dpi_ctrl |=BIT (10 ); + +/* enable te */ + reg->dpi_ctrl |=BIT (8 ); + +/* enable stop DONE INT */ + int_mask |=DISPC_INT_DONE_MASK ; +/* enable TE INT */ + int_mask |=DISPC_INT_TE_MASK ; + } + +/* enable ifbc payload error INT */ + int_mask |=DISPC_INT_FBC_PLD_ERR_MASK ; +/* enable ifbc header error INT */ + int_mask |=DISPC_INT_FBC_HDR_ERR_MASK ; +/* enable iommu va out of range read error INT */ + int_mask |=DISPC_INT_MMU_VAOR_RD_MASK ; +/* enable iommu va out of range write error INT */ + int_mask |=DISPC_INT_MMU_VAOR_WR_MASK ; +/* enable iommu invalid read error INT */ + int_mask |=DISPC_INT_MMU_INV_RD_MASK ; +/* enable iommu invalid write error INT */ + int_mask |=DISPC_INT_MMU_INV_WR_MASK ; + + reg->dpu_int_en = int_mask; +} + +static void enable_vsync (struct dpu_context *ctx) +{ +struct dpu_reg *reg = (struct dpu_reg *)ctx->base; + + reg->dpu_int_en |=DISPC_INT_DPI_VSYNC_MASK ; +} + +static void disable_vsync (struct dpu_context *ctx) +{ +struct dpu_reg *reg = (struct dpu_reg *)ctx->base; + + reg->dpu_int_en &= ~DISPC_INT_DPI_VSYNC_MASK ; +} + +static const u32 primary_fmts[] = { +DRM_FORMAT_XRGB8888 ,DRM_FORMAT_XBGR8888 , +DRM_FORMAT_ARGB8888 ,DRM_FORMAT_ABGR8888 , +DRM_FORMAT_RGBA8888 ,DRM_FORMAT_BGRA8888 , +DRM_FORMAT_RGBX8888 ,DRM_FORMAT_BGRX8888 , +DRM_FORMAT_RGB565 ,DRM_FORMAT_BGR565 , +DRM_FORMAT_NV12 ,DRM_FORMAT_NV21 , +DRM_FORMAT_NV16 ,DRM_FORMAT_NV61 , +DRM_FORMAT_YUV420 ,DRM_FORMAT_YVU420 , +}; + +static int dpu_capability (struct dpu_context *ctx, +struct dpu_capability *cap) +{ +if (!cap) +return -EINVAL ; + + cap->max_layers =6 ; + cap->fmts_ptr = primary_fmts; + cap->fmts_cnt =ARRAY_SIZE (primary_fmts); + +return 0 ; +} + +const struct dpu_core_ops sharkl3_dpu_core_ops = { + .init = dpu_init, + .fini = dpu_fini, + .run = dpu_run, + .stop = dpu_stop, + .isr = dpu_isr, + .ifconfig = dpu_dpi_init, + .capability = dpu_capability, + .flip = dpu_flip, + .bg_color = dpu_bgcolor, + .enable_vsync = enable_vsync, + .disable_vsync = disable_vsync, +};(quoted diff) +0
-0
b/drivers/gpu/drm/sprd/sprd_dpu.cQuoted 52 lines
new file mode 100644
index 0000000..f122b0edrivers/gpu/drm/sprd/sprd_dpu.c new file +47
-0@@ -0,0 +1,586 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2020 Unisoc Inc. +*/ + +#include <linux/component.h> +#include <linux/dma-buf.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/of_device.h> +#include <linux/of_irq.h> + +#include <drm/drm_atomic_helper.h> +#include <drm/drm_crtc_helper.h> +#include <drm/drm_fb_cma_helper.h> +#include <drm/drm_gem_cma_helper.h> +#include <drm/drm_gem_framebuffer_helper.h> +#include <drm/drm_plane_helper.h> + +#include "sprd_drm.h" +#include "sprd_dpu.h" + +struct sprd_plane { +struct drm_plane plane; +u32 index; +}; + +static int sprd_dpu_init (struct sprd_dpu *dpu); +static int sprd_dpu_fini (struct sprd_dpu *dpu); + +static inline struct sprd_plane *to_sprd_plane (struct drm_plane *plane) +{ + return container_of(plane, struct sprd_plane, plane); +} + +static int sprd_plane_atomic_check (struct drm_plane *plane, +struct drm_plane_state *state) +{ +DRM_DEBUG ("%s()\n" , __func__); + +return 0 ; +} + +static void sprd_plane_atomic_update (struct drm_plane *plane, +struct drm_plane_state *old_state) +{drivers/gpu/drm/sprd/sprd_dpu.c line 57
Quoted 10 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +10
-0+struct drm_plane_state *state = plane->state; +struct drm_framebuffer *fb = plane->state->fb; +struct drm_gem_cma_object *cma_obj; +struct sprd_plane *p =to_sprd_plane (plane); +struct sprd_dpu *dpu =crtc_to_dpu (plane->state->crtc); +struct sprd_dpu_layer *layer = &dpu->layers[p->index]; +int i; + +if (plane->state->crtc->state->active_changed) { + DRM_DEBUG("resume or suspend, no need to updateplane\n");
Quoted 10 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +10
-0+return ; + } + + layer->index = p->index; + layer->src_x = state->src_x >>16 ; + layer->src_y = state->src_y >>16 ; + layer->src_w = state->src_w >>16 ; + layer->src_h = state->src_h >>16 ; + layer->dst_x = state->crtc_x; + layer->dst_y = state->crtc_y;drivers/gpu/drm/sprd/sprd_dpu.c
Quoted 10 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +10
-0+ layer->dst_w = state->crtc_w; + layer->dst_h = state->crtc_h; + layer->alpha = state->alpha; + layer->blending = state->pixel_blend_mode; + layer->rotation = state->rotation; + layer->planes = fb->format->num_planes; + layer->format = fb->format->format; + + DRM_DEBUG("%s() alpha = %u, blending = %u, rotation = %u\n", + __func__, layer->alpha, layer->blending,
layer->rotation);Quoted 9 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +9
-0+ +for (i =0 ; i < layer->planes; i++) { + cma_obj =drm_fb_cma_get_gem_obj (fb, i); + layer->addr[i] = cma_obj->paddr + fb->offsets[i]; + layer->pitch[i] = fb->pitches[i]; + } + + dpu->pending_planes++; +}drivers/gpu/drm/sprd/sprd_dpu.c
Quoted 10 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +10
-0+ +static void sprd_plane_atomic_disable (struct drm_plane *plane, +struct drm_plane_state *old_state) +{ +struct sprd_plane *p =to_sprd_plane (plane); + +/* +* NOTE: +* The dpu->core->flip() will disable all the planes each time. +* So there is no need to impliment the atomic_disable() function.
Quoted 35 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +35
-0+* But this function can not be removed, because it will change +* to call atomic_update() callback instead. Which will cause +* kernel panic in sprd_plane_atomic_update(). +* +* We do nothing here but just print a debug log. +*/ +DRM_DEBUG ("%s() layer_id = %u\n" , __func__, p->index); +} + +static int sprd_plane_create_properties (struct sprd_plane *p,int index) +{ +unsigned int supported_modes =BIT (DRM_MODE_BLEND_PIXEL_NONE ) | +BIT (DRM_MODE_BLEND_PREMULTI ) | +BIT (DRM_MODE_BLEND_COVERAGE ); + +/* create rotation property */ +drm_plane_create_rotation_property (&p->plane, +DRM_MODE_ROTATE_0 , +DRM_MODE_ROTATE_MASK | +DRM_MODE_REFLECT_MASK ); + +/* create alpha property */ +drm_plane_create_alpha_property (&p->plane); + +/* create blend mode property */ +drm_plane_create_blend_mode_property (&p->plane, supported_modes); + +/* create zpos property */ +drm_plane_create_zpos_immutable_property (&p->plane, index); + +return 0 ; +} + +static const struct drm_plane_helper_funcs sprd_plane_helper_funcs = { + .atomic_check = sprd_plane_atomic_check,drivers/gpu/drm/sprd/sprd_dpu.c
Quoted 10 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +10
-0+ .atomic_update = sprd_plane_atomic_update, + .atomic_disable = sprd_plane_atomic_disable, +}; + +static const struct drm_plane_funcs sprd_plane_funcs = { + .update_plane = drm_atomic_helper_update_plane, + .disable_plane = drm_atomic_helper_disable_plane, + .destroy = drm_plane_cleanup, + .reset = drm_atomic_helper_plane_reset, + .atomic_duplicate_state =
drm_atomic_helper_plane_duplicate_state,Quoted 6 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +6
-0+ .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, +}; + +static struct drm_plane *sprd_plane_init (struct drm_device *drm, +struct sprd_dpu *dpu) +{drivers/gpu/drm/sprd/sprd_dpu.c
Quoted 10 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +10
-0+struct drm_plane *primary =NULL ; +struct sprd_plane *p =NULL ; +struct dpu_capability cap = {}; +int err, i; + +if (dpu->core && dpu->core->capability) + dpu->core->capability (&dpu->ctx, &cap); + + dpu->layers = devm_kcalloc(drm->dev, cap.max_layers, + sizeof(struct sprd_dpu_layer),
GFP_KERNEL);drivers/gpu/drm/sprd/sprd_dpu.c
Quoted 11 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +11
-0+if (!dpu->layers) +return ERR_PTR (-ENOMEM ); + +for (i =0 ; i < cap.max_layers; i++) { + + p =devm_kzalloc (drm->dev,sizeof (*p),GFP_KERNEL ); +if (!p) +return ERR_PTR (-ENOMEM ); + + err = drm_universal_plane_init(drm, &p->plane, 1, + &sprd_plane_funcs,cap.fmts_ptr,
drivers/gpu/drm/sprd/sprd_dpu.c line 170
Quoted 2 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +2
-0+ cap.fmts_cnt,NULL , + DRM_PLANE_TYPE_PRIMARY,NULL);
drivers/gpu/drm/sprd/sprd_dpu.c
Quoted 6 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +6
-0+if (err) { +DRM_ERROR ("fail to init primary plane\n" ); +return ERR_PTR (err); + } + + drm_plane_helper_add(&p->plane,
&sprd_plane_helper_funcs);Quoted 17 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +17
-0+ +sprd_plane_create_properties (p, i); + + p->index = i; +if (i ==0 ) + primary = &p->plane; + } + +if (p) +DRM_INFO ("dpu plane init ok\n" ); + +return primary; +} + +static void sprd_crtc_mode_set_nofb (struct drm_crtc *crtc) +{ +struct sprd_dpu *dpu =crtc_to_dpu (crtc);drivers/gpu/drm/sprd/sprd_dpu.c
Quoted 10 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +10
-0+ +if ((dpu->mode->hdisplay == dpu->mode->htotal) || + (dpu->mode->vdisplay == dpu->mode->vtotal)) + dpu->ctx.if_type =SPRD_DISPC_IF_EDPI ; +else + dpu->ctx.if_type =SPRD_DISPC_IF_DPI ; +} + +static enum drm_mode_status sprd_crtc_mode_valid (struct drm_crtc *crtc, + const struct drm_display_mode*mode)
drivers/gpu/drm/sprd/sprd_dpu.c
Quoted 4 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +4
-0+{ +struct sprd_dpu *dpu =crtc_to_dpu (crtc); + + DRM_INFO("%s() mode: "DRM_MODE_FMT"\n", __func__,
DRM_MODE_ARG(mode));Quoted 54 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +54
-0+ +if (mode->type &DRM_MODE_TYPE_DEFAULT ) + dpu->mode = (struct drm_display_mode *)mode; + +if (mode->type &DRM_MODE_TYPE_PREFERRED ) { + dpu->mode = (struct drm_display_mode *)mode; +drm_display_mode_to_videomode (dpu->mode, &dpu->ctx.vm); + } + +return MODE_OK ; +} + +static void sprd_crtc_atomic_enable (struct drm_crtc *crtc, +struct drm_crtc_state *old_state) +{ +struct sprd_dpu *dpu =crtc_to_dpu (crtc); + +DRM_INFO ("%s()\n" , __func__); + +sprd_dpu_init (dpu); + +enable_irq (dpu->ctx.irq); + +drm_crtc_vblank_on (crtc); +} + +static void sprd_crtc_atomic_disable (struct drm_crtc *crtc, +struct drm_crtc_state *old_state) +{ +struct sprd_dpu *dpu =crtc_to_dpu (crtc); +struct drm_device *drm = dpu->crtc.dev; + +DRM_INFO ("%s()\n" , __func__); + +drm_crtc_vblank_off (crtc); + +disable_irq (dpu->ctx.irq); + +sprd_dpu_fini (dpu); + +spin_lock_irq (&drm->event_lock); +if (crtc->state->event) { +drm_crtc_send_vblank_event (crtc, crtc->state->event); + crtc->state->event =NULL ; + } +spin_unlock_irq (&drm->event_lock); +} + +static int sprd_crtc_atomic_check (struct drm_crtc *crtc, +struct drm_crtc_state *state) +{ +DRM_DEBUG ("%s()\n" , __func__); + +return 0 ;drivers/gpu/drm/sprd/sprd_dpu.c
Quoted 10 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +10
-0+} + +static void sprd_crtc_atomic_begin (struct drm_crtc *crtc, +struct drm_crtc_state *old_state) +{ +struct sprd_dpu *dpu =crtc_to_dpu (crtc); + +DRM_DEBUG ("%s()\n" , __func__); + + memset(dpu->layers, 0, sizeof(*dpu->layers) *
dpu->pending_planes);Quoted 5 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +5
-0+ + dpu->pending_planes =0 ; +} + +static void sprd_crtc_atomic_flush(struct drm_crtc *crtc,drivers/gpu/drm/sprd/sprd_dpu.c
Quoted 10 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +10
-0+ struct drm_crtc_state *old_state) + +{ +struct sprd_dpu *dpu =crtc_to_dpu (crtc); +struct drm_device *drm = dpu->crtc.dev; + +DRM_DEBUG ("%s()\n" , __func__); + +if (dpu->core && dpu->core->flip && dpu->pending_planes) + dpu->core->flip(&dpu->ctx, dpu->layers,
dpu->pending_planes);Quoted 35 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +35
-0+ +spin_lock_irq (&drm->event_lock); +if (crtc->state->event) { +drm_crtc_send_vblank_event (crtc, crtc->state->event); + crtc->state->event =NULL ; + } +spin_unlock_irq (&drm->event_lock); +} + +static int sprd_crtc_enable_vblank (struct drm_crtc *crtc) +{ +struct sprd_dpu *dpu =crtc_to_dpu (crtc); + +DRM_DEBUG ("%s()\n" , __func__); + +if (dpu->core && dpu->core->enable_vsync) + dpu->core->enable_vsync (&dpu->ctx); + +return 0 ; +} + +static void sprd_crtc_disable_vblank (struct drm_crtc *crtc) +{ +struct sprd_dpu *dpu =crtc_to_dpu (crtc); + +DRM_DEBUG ("%s()\n" , __func__); + +if (dpu->core && dpu->core->disable_vsync) + dpu->core->disable_vsync (&dpu->ctx); +} + +static int sprd_crtc_create_properties (struct drm_crtc *crtc) +{ +struct sprd_dpu *dpu =crtc_to_dpu (crtc); +struct drm_device *drm = dpu->crtc.dev;drivers/gpu/drm/sprd/sprd_dpu.c
Quoted 10 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +10
-0+struct drm_property *prop; +struct drm_property_blob *blob; +size_t blob_size; + + blob_size =strlen (dpu->ctx.version) +1 ; + + blob =drm_property_create_blob (dpu->crtc.dev, blob_size, + dpu->ctx.version); +if (IS_ERR (blob)) { + DRM_ERROR("drm_property_create_blob dpu versionfailed\n");
Quoted 108 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +108
-0+return PTR_ERR (blob); + } + +/* create dpu version property */ + prop =drm_property_create (drm, +DRM_MODE_PROP_IMMUTABLE |DRM_MODE_PROP_BLOB , +"dpu version" ,0 ); +if (!prop) { +DRM_ERROR ("drm_property_create dpu version failed\n" ); +return -ENOMEM ; + } +drm_object_attach_property (&crtc->base, prop, blob->base.id); + +return 0 ; +} + +static const struct drm_crtc_helper_funcs sprd_crtc_helper_funcs = { + .mode_set_nofb = sprd_crtc_mode_set_nofb, + .mode_valid = sprd_crtc_mode_valid, + .atomic_check = sprd_crtc_atomic_check, + .atomic_begin = sprd_crtc_atomic_begin, + .atomic_flush = sprd_crtc_atomic_flush, + .atomic_enable = sprd_crtc_atomic_enable, + .atomic_disable = sprd_crtc_atomic_disable, +}; + +static const struct drm_crtc_funcs sprd_crtc_funcs = { + .destroy = drm_crtc_cleanup, + .set_config = drm_atomic_helper_set_config, + .page_flip = drm_atomic_helper_page_flip, + .reset = drm_atomic_helper_crtc_reset, + .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, + .enable_vblank = sprd_crtc_enable_vblank, + .disable_vblank = sprd_crtc_disable_vblank, +}; + +static int sprd_crtc_init (struct drm_device *drm,struct drm_crtc *crtc, +struct drm_plane *primary) +{ +struct device_node *port; +int err; + +/* +* set crtc port so that drm_of_find_possible_crtcs call works +*/ + port =of_parse_phandle (drm->dev->of_node,"ports" ,0 ); +if (!port) { +DRM_ERROR ("find 'ports' phandle of %s failed\n" , + drm->dev->of_node->full_name); +return -EINVAL ; + } +of_node_put (port); + crtc->port = port; + + err =drm_crtc_init_with_planes (drm, crtc, primary,NULL , + &sprd_crtc_funcs,NULL ); +if (err) { +DRM_ERROR ("failed to init crtc.\n" ); +return err; + } + +drm_mode_crtc_set_gamma_size (crtc,256 ); + +drm_crtc_helper_add (crtc, &sprd_crtc_helper_funcs); + +sprd_crtc_create_properties (crtc); + +DRM_INFO ("%s() ok\n" , __func__); +return 0 ; +} + +static int sprd_dpu_init (struct sprd_dpu *dpu) +{ +struct dpu_context *ctx = &dpu->ctx; + +if (dpu->core && dpu->core->init) + dpu->core->init (ctx); +if (dpu->core && dpu->core->ifconfig) + dpu->core->ifconfig (ctx); + +return 0 ; +} + +static int sprd_dpu_fini (struct sprd_dpu *dpu) +{ +struct dpu_context *ctx = &dpu->ctx; + +if (dpu->core && dpu->core->fini) + dpu->core->fini (ctx); + +return 0 ; +} + +static irqreturn_t sprd_dpu_isr (int irq,void *data) +{ +struct sprd_dpu *dpu = data; +struct dpu_context *ctx = &dpu->ctx; +u32 int_mask =0 ; + +if (dpu->core && dpu->core->isr) + int_mask = dpu->core->isr (ctx); + +if (int_mask &DISPC_INT_ERR_MASK ) +DRM_WARN ("Warning: dpu underflow!\n" ); + +if ((int_mask &DISPC_INT_DPI_VSYNC_MASK )) +drm_crtc_handle_vblank (&dpu->crtc);drivers/gpu/drm/sprd/sprd_dpu.c line 449
Quoted 10 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +10
-0+ +return IRQ_HANDLED ; +} + +static int sprd_dpu_irq_request (struct sprd_dpu *dpu) +{ +int err; +int irq_num; + + irq_num =irq_of_parse_and_map (dpu->dev.of_node,0 );Use
platform_get_irqinstead.drivers/gpu/drm/sprd/sprd_dpu.c line 456
Quoted 7 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +7
-0+if (!irq_num) { +DRM_ERROR ("error: dpu parse irq num failed\n" ); +return -EINVAL ; + } +DRM_INFO ("dpu irq_num = %d\n" , irq_num); + +irq_set_status_flags (irq_num,IRQ_NOAUTOEN );
Quoted 3 lines
I think you shouldn't need this. Make sure you've disabled interrupts in the h/w first or that the handler can handle it if you haven't.
Sorry, our h/w can't disabled interrupt after power on, so we need to disabled irq handler when irq request.
Quoted 291 lines
drivers/gpu/drm/sprd/sprd_dpu.c
Quoted 13 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +12
-0+ err =devm_request_irq (&dpu->dev, irq_num, sprd_dpu_isr, +0 ,"DISPC" , dpu); +if (err) { +DRM_ERROR ("error: dpu request irq failed\n" ); +return -EINVAL ; + } + dpu->ctx.irq = irq_num; + +return 0 ; +} + +static int sprd_dpu_bind(struct device *dev, struct device *master,void *data)
Quoted 63 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +63
-0+{ +struct drm_device *drm = data; +struct sprd_dpu *dpu =dev_get_drvdata (dev); +struct drm_plane *plane; +int err; + +DRM_INFO ("%s()\n" , __func__); + + plane =sprd_plane_init (drm, dpu); +if (IS_ERR_OR_NULL (plane)) { + err =PTR_ERR (plane); +return err; + } + + err =sprd_crtc_init (drm, &dpu->crtc, plane); +if (err) +return err; + +sprd_dpu_irq_request (dpu); + +return 0 ; +} + +static void sprd_dpu_unbind (struct device *dev,struct device *master, +void *data) +{ +struct sprd_dpu *dpu =dev_get_drvdata (dev); + +DRM_INFO ("%s()\n" , __func__); + +drm_crtc_cleanup (&dpu->crtc); +} + +static const struct component_ops dpu_component_ops = { + .bind = sprd_dpu_bind, + .unbind = sprd_dpu_unbind, +}; + +static int sprd_dpu_context_init (struct sprd_dpu *dpu, +struct device_node *np) +{ +struct resource r; +struct dpu_context *ctx = &dpu->ctx; + +if (of_address_to_resource (np,0 , &r)) { +DRM_ERROR ("parse dt base address failed\n" ); +return -ENODEV ; + } + ctx->base = (unsigned long )ioremap (r.start, +resource_size (&r)); +if (ctx->base ==0 ) { +DRM_ERROR ("ioremap base address failed\n" ); +return -EFAULT ; + } + +return 0 ; +} + +static const struct sprd_dpu_ops sharkl3_dpu = { + .core = &sharkl3_dpu_core_ops, +}; + +static const struct of_device_id dpu_match_table[] = {drivers/gpu/drm/sprd/sprd_dpu.c line 541
Quoted 10 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +10
-0+ { .compatible = "sprd,sharkl3-dpu", + .data = &sharkl3_dpu }, + { /* sentinel */ }, +}; + +static int sprd_dpu_probe (struct platform_device *pdev) +{ +struct device_node *np = pdev->dev.of_node; +const struct of_device_id *of_id = +of_match_node (dpu_match_table, np);Don't need this.
Review
Quoted 46 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +45
-0+const struct sprd_dpu_ops *pdata; +struct sprd_dpu *dpu; +int ret; + + dpu =devm_kzalloc (&pdev->dev,sizeof (*dpu),GFP_KERNEL ); +if (!dpu) +return -ENOMEM ; + + pdata =of_device_get_match_data (&pdev->dev); +if (pdata) { + dpu->core = pdata->core; + dpu->ctx.version ="dpu-r2p0" ; + }else { +DRM_ERROR ("Can't get %s ops data\n" , of_id->name); +return -EINVAL ; + } + + ret =sprd_dpu_context_init (dpu, np); +if (ret) +return ret; + +platform_set_drvdata (pdev, dpu); + +return component_add (&pdev->dev, &dpu_component_ops); +} + +static int sprd_dpu_remove (struct platform_device *pdev) +{ +component_del (&pdev->dev, &dpu_component_ops); +return 0 ; +} + +struct platform_driver sprd_dpu_driver = { + .probe = sprd_dpu_probe, + .remove = sprd_dpu_remove, + .driver = { + .name ="sprd-dpu-drv" , + .of_match_table = dpu_match_table, + }, +}; + +MODULE_AUTHOR ("Leon He <[email protected]>" ); +MODULE_AUTHOR ("Kevin Tang <[email protected]>" ); +MODULE_DESCRIPTION ("Unisoc Display Controller Driver" ); +MODULE_LICENSE ("GPL v2" );(quoted diff) +0
-0
b/drivers/gpu/drm/sprd/sprd_dpu.hReview
Quoted 133 lines
new file mode 100644
index 0000000..3e7f91fdrivers/gpu/drm/sprd/sprd_dpu.h new file +127
-0@@ -0,0 +1,127 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020 Unisoc Inc. +*/ + +#ifndef __SPRD_DPU_H__ +#define __SPRD_DPU_H__ + +#include <linux/bug.h> +#include <linux/delay.h> +#include <linux/device.h> +#include <linux/kernel.h> +#include <linux/platform_device.h> +#include <linux/string.h> +#include <video/videomode.h> + +#include <drm/drm_crtc.h> +#include <drm/drm_fourcc.h> +#include <drm/drm_print.h> +#include <drm/drm_vblank.h> +#include <uapi/drm/drm_mode.h> +#include "disp_lib.h" + +#define DISPC_INT_DONE_MASK BIT(0) +#define DISPC_INT_TE_MASK BIT(1) +#define DISPC_INT_ERR_MASK BIT(2) +#define DISPC_INT_EDPI_TE_MASK BIT(3) +#define DISPC_INT_UPDATE_DONE_MASK BIT(4) +#define DISPC_INT_DPI_VSYNC_MASK BIT(5) +#define DISPC_INT_WB_DONE_MASK BIT(6) +#define DISPC_INT_WB_FAIL_MASK BIT(7) + +/* NOTE: this mask is not a realy dpu interrupt mask */ +#define DISPC_INT_FENCE_SIGNAL_REQUEST BIT(31) + +enum { +SPRD_DISPC_IF_DBI =0 , +SPRD_DISPC_IF_DPI , +SPRD_DISPC_IF_EDPI , +SPRD_DISPC_IF_LIMIT +}; + +enum { +SPRD_IMG_DATA_ENDIAN_B0B1B2B3 =0 , +SPRD_IMG_DATA_ENDIAN_B3B2B1B0 , +SPRD_IMG_DATA_ENDIAN_B2B3B0B1 , +SPRD_IMG_DATA_ENDIAN_B1B0B3B2 , +SPRD_IMG_DATA_ENDIAN_LIMIT +}; + +struct sprd_dpu_layer { +u8 index; +u8 planes; +u32 addr[4 ]; +u32 pitch[4 ]; +s16 src_x; +s16 src_y; +s16 src_w; +s16 src_h; +s16 dst_x; +s16 dst_y; +u16 dst_w; +u16 dst_h; +u32 format; +u32 alpha; +u32 blending; +u32 rotation; +}; + +struct dpu_capability { +u32 max_layers; +const u32 *fmts_ptr; +u32 fmts_cnt; +}; + +struct dpu_context ; + +struct dpu_core_ops { +int (*init)(struct dpu_context *ctx); +void (*fini)(struct dpu_context *ctx); +void (*run)(struct dpu_context *ctx); +void (*stop)(struct dpu_context *ctx); +void (*disable_vsync)(struct dpu_context *ctx); +void (*enable_vsync)(struct dpu_context *ctx); +u32 (*isr)(struct dpu_context *ctx); +void (*ifconfig)(struct dpu_context *ctx); +void (*flip)(struct dpu_context *ctx, +struct sprd_dpu_layer layers[],u8 count); +int (*capability)(struct dpu_context *ctx, +struct dpu_capability *cap); +void (*bg_color)(struct dpu_context *ctx,u32 color); +}; + +struct sprd_dpu_ops { +const struct dpu_core_ops *core; +}; + +struct dpu_context { +unsigned long base; +const char *version; +int irq; +u8 if_type; +struct videomode vm; +bool stopped; +wait_queue_head_t wait_queue; +bool evt_update; +bool evt_stop; +}; + +struct sprd_dpu { +struct device dev; +struct drm_crtc crtc; +struct dpu_context ctx; +const struct dpu_core_ops *core; +struct drm_display_mode *mode; +struct sprd_dpu_layer *layers; +u8 pending_planes; +}; + +static inline struct sprd_dpu *crtc_to_dpu (struct drm_crtc *crtc) +{ + return crtc ? container_of(crtc, struct sprd_dpu, crtc) : NULL; +} + +extern const struct dpu_core_ops sharkl3_dpu_core_ops; + +#endif (quoted diff) +0
-0
b/drivers/gpu/drm/sprd/sprd_drm.cReview
Quoted 12 lines
index 4706185..200020f 100644
drivers/gpu/drm/sprd/sprd_drm.c +1
-0@@ -200,6 +200,7 @@ static struct platform_driver sprd_drm_driver = {static struct platform_driver *sprd_drm_drivers[] = { &sprd_drm_driver, + &sprd_dpu_driver, };static int __init sprd_drm_init (void )(quoted diff) +0
-0
b/drivers/gpu/drm/sprd/sprd_drm.hQuoted 7 lines
index edf0881..3c32f3a 100644
drivers/gpu/drm/sprd/sprd_drm.h +0
-0@@ -13,4 +13,6 @@ struct sprd_drm {struct drm_device *drm; };
Quoted 7 lines
Quoted 6 lines
drivers/gpu/drm/sprd/sprd_drm.h +2
-1+extern struct platform_driver sprd_dpu_driver; +#endif /* _SPRD_DRM_H_ */ --2.7.4
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH RFC v4 4/6] drm/sprd: add Unisoc's drm display controller driver
In reply to Kevin TangHi Kevin,
There's a few small suggestions, although overall the driver looks a lot better.
drivers/gpu/drm/sprd/dpu/Makefile line 4
Quoted 7 lines · Kevin Tang
drivers/gpu/drm/sprd/dpu/Makefile new file +4
-0@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 + +ifdef CONFIG_ARM64 +KBUILD_CFLAGS += -mstrict-align
There are many other drivers that do not use readl/writel for register access, yet none has this workaround... Even those that they are exclusively ARM64.
Have you tried that it's not a buggy version of GCC? At the very least, I'd encourage you to add a brief comment about the problem + setup.
... In general I think one should follow the suggestions from Rob Herring.
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 9 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +9
-0+static void dpu_dump(struct dpu_context *ctx) +{ + u32 *reg = (u32 *)ctx->base; + int i; + + pr_info(" 0 4 8 C\n"); + for (i = 0; i < 256; i += 4) { + pr_info("%04x: 0x%08x 0x%08x 0x%08x 0x%08x\n", + i * 4, reg[i], reg[i + 1], reg[i + 2], reg[i + 3]);
Using some of the helpers from drm_print.h would be better than pr_*. This applies for the rest of the patch.
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 6 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +6
-0+static void dpu_clean_all(struct dpu_context *ctx) +{ + int i; + struct dpu_reg *reg = (struct dpu_reg *)ctx->base; + + for (i = 0; i < 8; i++)
This "< 8" seem pretty magical. How about "< ARRAY_SIZE(reg->layers)" Same logic applies through the rest of the patch.
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 7 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +7
-0+static int dpu_wait_stop_done(struct dpu_context *ctx) +{ + int rc; + + if (ctx->stopped) + return 0; +
The stopped handling does look suspicious. Admittedly I did not look too closely at the dpu_flip code, which seems to require it.
Let's add a small comment in the struct dpu_context::stopped declaration, why it is needed, if it truely is.
Quoted 18 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +17
-0+ rc = wait_event_interruptible_timeout(ctx->wait_queue, ctx->evt_stop, + msecs_to_jiffies(500)); + ctx->evt_stop = false; + + ctx->stopped = true; + + if (!rc) { + pr_err("dpu wait for stop done time out!\n"); + return -ETIMEDOUT; + } + + return 0; +} + +static void dpu_stop(struct dpu_context *ctx) +{ + struct dpu_reg *reg = (struct dpu_reg *)ctx->base;
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ + if (ctx->stopped) + return; + + if (ctx->if_type == SPRD_DISPC_IF_DPI) + reg->dpu_ctrl |= BIT(1); + + dpu_wait_stop_done(ctx); + + pr_info("dpu stop\n");
This and the dpu_run pr_info() messages can be removed.
Quoted 37 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +37
-0+} + +static void dpu_run(struct dpu_context *ctx) +{ + struct dpu_reg *reg = (struct dpu_reg *)ctx->base; + + if (!ctx->stopped) + return; + + reg->dpu_ctrl |= BIT(0); + + ctx->stopped = false; + + pr_info("dpu run\n"); +} + +static int dpu_init(struct dpu_context *ctx) +{ + struct dpu_reg *reg = (struct dpu_reg *)ctx->base; + u32 size; + + reg->bg_color = 0; + + size = (ctx->vm.vactive << 16) | ctx->vm.hactive; + reg->panel_size = size; + reg->blend_size = size; + + reg->dpu_cfg0 = BIT(4) | BIT(5); + + reg->dpu_cfg1 = 0x004466da; + reg->dpu_cfg2 = 0; + + if (ctx->stopped) + dpu_clean_all(ctx); + + reg->mmu_en = 0; + reg->mmu_min_ppn1 = 0;
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ reg->mmu_ppn_range1 = 0xffff; + reg->mmu_min_ppn2 = 0; + reg->mmu_ppn_range2 = 0xffff; + reg->mmu_vpn_range = 0x1ffff; + + reg->dpu_int_clr = 0xffff; + + init_waitqueue_head(&ctx->wait_queue); + + return 0;
Function always returns 0. Let's make it static void dpu_init()
Quoted 23 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +23
-0+static u32 to_dpu_rotation(u32 angle) +{ + u32 rot = DPU_LAYER_ROTATION_0; + + switch (angle) { + case 0: + case DRM_MODE_ROTATE_0: + rot = DPU_LAYER_ROTATION_0; + break; + case DRM_MODE_ROTATE_90: + rot = DPU_LAYER_ROTATION_90; + break; + case DRM_MODE_ROTATE_180: + rot = DPU_LAYER_ROTATION_180; + break; + case DRM_MODE_ROTATE_270: + rot = DPU_LAYER_ROTATION_270; + break; + case DRM_MODE_REFLECT_Y: + rot = DPU_LAYER_ROTATION_180_M; + break; + case (DRM_MODE_REFLECT_Y | DRM_MODE_ROTATE_90): + rot = DPU_LAYER_ROTATION_90_M;
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ break; + case DRM_MODE_REFLECT_X: + rot = DPU_LAYER_ROTATION_0_M; + break; + case (DRM_MODE_REFLECT_X | DRM_MODE_ROTATE_90): + rot = DPU_LAYER_ROTATION_270_M; + break; + default: + pr_err("rotation convert unsupport angle (drm)= 0x%x\n", angle); + break;
Have you seen a case where the 0 or default case are reached? AFAICT they will never trigger. So one might as well use:
switch (angle) {
case DRM_MODE_FOO:
return DPU_LAYER_ROTATION_FOO;
...
case DRM_MODE_BAR:
return DPU_LAYER_ROTATION_BAR;
}Quoted 86 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +86
-0+ } + + return rot; +} + +static u32 dpu_img_ctrl(u32 format, u32 blending, u32 rotation) +{ + int reg_val = 0; + + /* layer enable */ + reg_val |= BIT(0); + + switch (format) { + case DRM_FORMAT_BGRA8888: + /* BGRA8888 -> ARGB8888 */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B3B2B1B0 << 8; + reg_val |= (DPU_LAYER_FORMAT_ARGB8888 << 4); + break; + case DRM_FORMAT_RGBX8888: + case DRM_FORMAT_RGBA8888: + /* RGBA8888 -> ABGR8888 */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B3B2B1B0 << 8; + /* FALLTHRU */ + case DRM_FORMAT_ABGR8888: + /* rb switch */ + reg_val |= BIT(10); + /* FALLTHRU */ + case DRM_FORMAT_ARGB8888: + reg_val |= (DPU_LAYER_FORMAT_ARGB8888 << 4); + break; + case DRM_FORMAT_XBGR8888: + /* rb switch */ + reg_val |= BIT(10); + /* FALLTHRU */ + case DRM_FORMAT_XRGB8888: + reg_val |= (DPU_LAYER_FORMAT_ARGB8888 << 4); + break; + case DRM_FORMAT_BGR565: + /* rb switch */ + reg_val |= BIT(10); + /* FALLTHRU */ + case DRM_FORMAT_RGB565: + reg_val |= (DPU_LAYER_FORMAT_RGB565 << 4); + break; + case DRM_FORMAT_NV12: + /* 2-Lane: Yuv420 */ + reg_val |= DPU_LAYER_FORMAT_YUV420_2PLANE << 4; + /* Y endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B0B1B2B3 << 8; + /* UV endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B0B1B2B3 << 10; + break; + case DRM_FORMAT_NV21: + /* 2-Lane: Yuv420 */ + reg_val |= DPU_LAYER_FORMAT_YUV420_2PLANE << 4; + /* Y endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B0B1B2B3 << 8; + /* UV endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B3B2B1B0 << 10; + break; + case DRM_FORMAT_NV16: + /* 2-Lane: Yuv422 */ + reg_val |= DPU_LAYER_FORMAT_YUV422_2PLANE << 4; + /* Y endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B3B2B1B0 << 8; + /* UV endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B3B2B1B0 << 10; + break; + case DRM_FORMAT_NV61: + /* 2-Lane: Yuv422 */ + reg_val |= DPU_LAYER_FORMAT_YUV422_2PLANE << 4; + /* Y endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B0B1B2B3 << 8; + /* UV endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B0B1B2B3 << 10; + break; + case DRM_FORMAT_YUV420: + reg_val |= DPU_LAYER_FORMAT_YUV420_3PLANE << 4; + /* Y endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B0B1B2B3 << 8; + /* UV endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B0B1B2B3 << 10; + break; + case DRM_FORMAT_YVU420: + reg_val |= DPU_LAYER_FORMAT_YUV420_3PLANE << 4; + /* Y endian */
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ reg_val |= SPRD_IMG_DATA_ENDIAN_B0B1B2B3 << 8; + /* UV endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B3B2B1B0 << 10; + break; + default: + pr_err("error: invalid format %c%c%c%c\n", format, + format >> 8, + format >> 16, + format >> 24); + break;
The default case here should be unreachable. Either it is or the upper layer (or earlier code) should ensure that.
Quoted 14 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +14
-0+ } + + switch (blending) { + case DRM_MODE_BLEND_PIXEL_NONE: + /* don't do blending, maybe RGBX */ + /* alpha mode select - layer alpha */ + reg_val |= BIT(2); + break; + case DRM_MODE_BLEND_COVERAGE: + /* alpha mode select - combo alpha */ + reg_val |= BIT(3); + /*Normal mode*/ + reg_val &= (~BIT(16)); + break;
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ case DRM_MODE_BLEND_PREMULTI: + /* alpha mode select - combo alpha */ + reg_val |= BIT(3); + /*Pre-mult mode*/ + reg_val |= BIT(16); + break; + default: + /* alpha mode select - layer alpha */ + reg_val |= BIT(2); + break;
Ditto
Quoted 32 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +31
-0+ } + + rotation = to_dpu_rotation(rotation); + reg_val |= (rotation & 0x7) << 20; + + return reg_val; +} + +static void dpu_layer(struct dpu_context *ctx, + struct sprd_dpu_layer *hwlayer) +{ + struct dpu_reg *reg = (struct dpu_reg *)ctx->base; + const struct drm_format_info *info; + struct layer_reg *layer; + u32 addr, size, offset; + int i; + + layer = ®->layers[hwlayer->index]; + offset = (hwlayer->dst_x & 0xffff) | ((hwlayer->dst_y) << 16); + + if (hwlayer->src_w && hwlayer->src_h) + size = (hwlayer->src_w & 0xffff) | ((hwlayer->src_h) << 16); + else + size = (hwlayer->dst_w & 0xffff) | ((hwlayer->dst_h) << 16); + + for (i = 0; i < hwlayer->planes; i++) { + addr = hwlayer->addr[i]; + + if (addr % 16) + pr_err("layer addr[%d] is not 16 bytes align, it's 0x%08x\n", + i, addr);
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ layer->addr[i] = addr; + } + + layer->pos = offset; + layer->size = size; + layer->crop_start = (hwlayer->src_y << 16) | hwlayer->src_x; + layer->alpha = hwlayer->alpha; + + info = drm_format_info(hwlayer->format); + if (info->cpp[0] == 0) {
Ditto
Quoted 4 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +4
-0+ pr_err("layer[%d] bytes per pixel is invalid\n", hwlayer->index); + return; + } +
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +6
-0+static int dpu_capability(struct dpu_context *ctx, + struct dpu_capability *cap) +{ + if (!cap) + return -EINVAL; +
Ensure the caller always passes cap != NULL and drop the function return type?
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 13 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +11
-0+ cap->max_layers = 6; + cap->fmts_ptr = primary_fmts; + cap->fmts_cnt = ARRAY_SIZE(primary_fmts); + + return 0; +} +static int sprd_plane_atomic_check(struct drm_plane *plane, + struct drm_plane_state *state) +{ + DRM_DEBUG("%s()\n", __func__); +
Would be nice to hear from the atomic experts, how a no-op atomic_check goes with the overall atomic semantics.
Quoted 11 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +9
-0+ return 0; +} + +static void sprd_plane_atomic_disable(struct drm_plane *plane, + struct drm_plane_state *old_state) +{ + struct sprd_plane *p = to_sprd_plane(plane); + + /*
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ * NOTE: + * The dpu->core->flip() will disable all the planes each time. + * So there is no need to impliment the atomic_disable() function. + * But this function can not be removed, because it will change + * to call atomic_update() callback instead. Which will cause + * kernel panic in sprd_plane_atomic_update(). + * + * We do nothing here but just print a debug log. + */ + DRM_DEBUG("%s() layer_id = %u\n", __func__, p->index);
Similar to the check - would be nice to see a confirmation, that this isn't abusing atomics in some way.
Quoted 13 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +13
-0+} + +static int sprd_plane_create_properties(struct sprd_plane *p, int index) +{ + unsigned int supported_modes = BIT(DRM_MODE_BLEND_PIXEL_NONE) | + BIT(DRM_MODE_BLEND_PREMULTI) | + BIT(DRM_MODE_BLEND_COVERAGE); + + /* create rotation property */ + drm_plane_create_rotation_property(&p->plane, + DRM_MODE_ROTATE_0, + DRM_MODE_ROTATE_MASK | + DRM_MODE_REFLECT_MASK);
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ + /* create alpha property */ + drm_plane_create_alpha_property(&p->plane); + + /* create blend mode property */ + drm_plane_create_blend_mode_property(&p->plane, supported_modes); + + /* create zpos property */ + drm_plane_create_zpos_immutable_property(&p->plane, index); +
Either check if creating the properties fail (and propagate the error) or drop the function return type. As-is it's in the middle making it fairly misleading.
Quoted 4 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +3
-0+ return 0; +} +
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +9
-0+static struct drm_plane *sprd_plane_init(struct drm_device *drm, + struct sprd_dpu *dpu) +{ + struct drm_plane *primary = NULL; + struct sprd_plane *p = NULL; + struct dpu_capability cap = {}; + int err, i; + + if (dpu->core && dpu->core->capability)
As mentioned before - this always evaluates to true, so drop the check. Same applies for the other dpu->core->foo checks.
Still not a huge fan of the abstraction layer, but I guess you're hesitant on removing it.
Quoted 23 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +23
-0+ dpu->core->capability(&dpu->ctx, &cap); + + dpu->layers = devm_kcalloc(drm->dev, cap.max_layers, + sizeof(struct sprd_dpu_layer), GFP_KERNEL); + if (!dpu->layers) + return ERR_PTR(-ENOMEM); + + for (i = 0; i < cap.max_layers; i++) { + + p = devm_kzalloc(drm->dev, sizeof(*p), GFP_KERNEL); + if (!p) + return ERR_PTR(-ENOMEM); + + err = drm_universal_plane_init(drm, &p->plane, 1, + &sprd_plane_funcs, cap.fmts_ptr, + cap.fmts_cnt, NULL, + DRM_PLANE_TYPE_PRIMARY, NULL); + if (err) { + DRM_ERROR("fail to init primary plane\n"); + return ERR_PTR(err); + } + + drm_plane_helper_add(&p->plane, &sprd_plane_helper_funcs);
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ + sprd_plane_create_properties(p, i); + + p->index = i; + if (i == 0) + primary = &p->plane; + } + + if (p) + DRM_INFO("dpu plane init ok\n");
This and nearly all the other DRM_INFO() messages look like a debug/development left over. Please remove them - the driver does not need to print when functions are successfull.
Quoted 12 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +12
-0+ + return primary; +} + +static void sprd_crtc_mode_set_nofb(struct drm_crtc *crtc) +{ + struct sprd_dpu *dpu = crtc_to_dpu(crtc); + + if ((dpu->mode->hdisplay == dpu->mode->htotal) || + (dpu->mode->vdisplay == dpu->mode->vtotal)) + dpu->ctx.if_type = SPRD_DISPC_IF_EDPI; + else
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ dpu->ctx.if_type = SPRD_DISPC_IF_DPI; +} + +static enum drm_mode_status sprd_crtc_mode_valid(struct drm_crtc *crtc, + const struct drm_display_mode *mode) +{ + struct sprd_dpu *dpu = crtc_to_dpu(crtc); + + DRM_INFO("%s() mode: "DRM_MODE_FMT"\n", __func__, DRM_MODE_ARG(mode)); +
If needed, let's move this to core and make it a debug message. As-is it will cause spam for no reason.
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 5 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +5
-0+ if (mode->type & DRM_MODE_TYPE_DEFAULT) + dpu->mode = (struct drm_display_mode *)mode; + + if (mode->type & DRM_MODE_TYPE_PREFERRED) { + dpu->mode = (struct drm_display_mode *)mode;
Casting away the constness is a bad idea.
Instead, let's move the if_type decision here, thus we can remove the nsprd_crtc_mode_set_nofb function? This way we can also remove sprd_dpu::mode.
Quoted 1 line
+
drm_display_mode_to_videomode(dpu->mode, &dpu->ctx.vm);
Similarly, one could derive the vm based attributes here and remove dpu->ctx.vm.
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 12 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +12
-0+ } + + return MODE_OK; +} + +static void sprd_crtc_atomic_enable(struct drm_crtc *crtc, + struct drm_crtc_state *old_state) +{ + struct sprd_dpu *dpu = crtc_to_dpu(crtc); + + DRM_INFO("%s()\n", __func__); +
More sprurious info messages - debug leftover?
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 6 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +6
-0+static int sprd_crtc_enable_vblank(struct drm_crtc *crtc) +{ + struct sprd_dpu *dpu = crtc_to_dpu(crtc); + + DRM_DEBUG("%s()\n", __func__); +
Personally, I don't see the appeal in these debug messages. While a few display controllers have the odd piece, they are an exception in DRM.
Quoted 11 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +11
-0+static int sprd_crtc_create_properties(struct drm_crtc *crtc) +{ + struct sprd_dpu *dpu = crtc_to_dpu(crtc); + struct drm_device *drm = dpu->crtc.dev; + struct drm_property *prop; + struct drm_property_blob *blob; + size_t blob_size; + + blob_size = strlen(dpu->ctx.version) + 1; + + blob = drm_property_create_blob(dpu->crtc.dev, blob_size,
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ dpu->ctx.version); + if (IS_ERR(blob)) { + DRM_ERROR("drm_property_create_blob dpu version failed\n"); + return PTR_ERR(blob); + } + + /* create dpu version property */ + prop = drm_property_create(drm, + DRM_MODE_PROP_IMMUTABLE | DRM_MODE_PROP_BLOB, + "dpu version", 0);
Note: Custom properties should be separate patches. This includes documentation why they are needed and references to open-source userspace.
HTH
Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH RFC v4 4/6] drm/sprd: add Unisoc's drm display controller driver
Quoted 63 lines · Emil Velikov
Hi Kevin,
There's a few small suggestions, although overall the driver looks a lot better.
drivers/gpu/drm/sprd/dpu/Makefile line 4
Quoted 7 lines · Kevin Tang
drivers/gpu/drm/sprd/dpu/Makefile new file +4
-0@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 + +ifdef CONFIG_ARM64 +KBUILD_CFLAGS += -mstrict-alignThere are many other drivers that do not use readl/writel for register access,
yet none has this workaround... Even those that they are exclusively ARM64.Have you tried that it's not a buggy version of GCC? At the very least, I'd encourage you to add a brief comment about the problem + setup.
... In general I think one should follow the suggestions from Rob Herring.
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 9 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +9
-0+static void dpu_dump(struct dpu_context *ctx) +{ + u32 *reg = (u32 *)ctx->base; + int i; + + pr_info(" 0 4 8 C\n"); + for (i = 0; i < 256; i += 4) { + pr_info("%04x: 0x%08x 0x%08x 0x%08x 0x%08x\n", + i * 4, reg[i], reg[i + 1], reg[i + 2], reg[i +3]);
Using some of the helpers from
drm_print.hwould be better than pr_*. This applies for the rest of the patch.drivers/gpu/drm/sprd/dpu/Makefile
Quoted 6 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +6
-0+static void dpu_clean_all(struct dpu_context *ctx) +{ + int i; + struct dpu_reg *reg = (struct dpu_reg *)ctx->base; + + for (i = 0; i < 8; i++)This "< 8" seem pretty magical. How about "<
ARRAY_SIZE(reg->layers)" Same logic applies through the rest of the patch.drivers/gpu/drm/sprd/dpu/Makefile
Quoted 7 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +7
-0+static int dpu_wait_stop_done(struct dpu_context *ctx) +{ + int rc; + + if (ctx->stopped) + return 0; +The stopped handling does look suspicious. Admittedly I did not look too closely
at thedpu_flipcode, which seems to require it.
Quoted 4 lines
Let's add a small comment in the struct
dpu_context::stoppeddeclaration, why it
is needed, if it truely is.
Dpu have running and stopped states, "stopped " declaration is for dpu stop done isr signal.
if we need to stop the dpu or dpu_flip, we must wait for stop done isr signal, for waiting last h/w composer done.
Not only suspend/resume and dpu_flip, we have other scenes that need this flag, eg: background color, PQ enhance...
All this need "stopped" flag to sync.
Quoted 119 lines
Quoted 2 lines
+ rc = wait_event_interruptible_timeout(ctx->wait_queue,
ctx->evt_stop,Quoted 17 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +16
-0+ msecs_to_jiffies(500)); + ctx->evt_stop = false; + + ctx->stopped = true; + + if (!rc) { + pr_err("dpu wait for stop done time out!\n"); + return -ETIMEDOUT; + } + + return 0; +} + +static void dpu_stop(struct dpu_context *ctx) +{ + struct dpu_reg *reg = (struct dpu_reg *)ctx->base;drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ + if (ctx->stopped) + return; + + if (ctx->if_type == SPRD_DISPC_IF_DPI) + reg->dpu_ctrl |= BIT(1); + + dpu_wait_stop_done(ctx); + + pr_info("dpu stop\n");This and the
dpu_runpr_info()messages can be removed.Quoted 37 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +37
-0+} + +static void dpu_run(struct dpu_context *ctx) +{ + struct dpu_reg *reg = (struct dpu_reg *)ctx->base; + + if (!ctx->stopped) + return; + + reg->dpu_ctrl |= BIT(0); + + ctx->stopped = false; + + pr_info("dpu run\n"); +} + +static int dpu_init(struct dpu_context *ctx) +{ + struct dpu_reg *reg = (struct dpu_reg *)ctx->base; + u32 size; + + reg->bg_color = 0; + + size = (ctx->vm.vactive << 16) | ctx->vm.hactive; + reg->panel_size = size; + reg->blend_size = size; + + reg->dpu_cfg0 = BIT(4) | BIT(5); + + reg->dpu_cfg1 = 0x004466da; + reg->dpu_cfg2 = 0; + + if (ctx->stopped) + dpu_clean_all(ctx); + + reg->mmu_en = 0; + reg->mmu_min_ppn1 = 0;drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ reg->mmu_ppn_range1 = 0xffff; + reg->mmu_min_ppn2 = 0; + reg->mmu_ppn_range2 = 0xffff; + reg->mmu_vpn_range = 0x1ffff; + + reg->dpu_int_clr = 0xffff; + + init_waitqueue_head(&ctx->wait_queue); + + return 0;Function always returns 0. Let's make it static void
dpu_init()Quoted 22 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +22
-0+static u32 to_dpu_rotation(u32 angle) +{ + u32 rot = DPU_LAYER_ROTATION_0; + + switch (angle) { + case 0: + case DRM_MODE_ROTATE_0: + rot = DPU_LAYER_ROTATION_0; + break; + case DRM_MODE_ROTATE_90: + rot = DPU_LAYER_ROTATION_90; + break; + case DRM_MODE_ROTATE_180: + rot = DPU_LAYER_ROTATION_180; + break; + case DRM_MODE_ROTATE_270: + rot = DPU_LAYER_ROTATION_270; + break; + case DRM_MODE_REFLECT_Y: + rot = DPU_LAYER_ROTATION_180_M; + break; + case (DRM_MODE_REFLECT_Y | DRM_MODE_ROTATE_90):drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ rot = DPU_LAYER_ROTATION_90_M; + break; + case DRM_MODE_REFLECT_X: + rot = DPU_LAYER_ROTATION_0_M; + break; + case (DRM_MODE_REFLECT_X | DRM_MODE_ROTATE_90): + rot = DPU_LAYER_ROTATION_270_M; + break; + default: + pr_err("rotation convert unsupport angle (drm)= 0x%x\n",angle);
Quoted 5 lines
Quoted 1 line
+ break;
Have you seen a case where the 0 or default case are reached? AFAICT they will
never trigger. So one might as well use:
switch (angle) {Quoted 8 lines
case DRM_MODE_FOO: return DPU_LAYER_ROTATION_FOO; ... case DRM_MODE_BAR: return DPU_LAYER_ROTATION_BAR; }Yeah, the 0 maybe unused code, i will remove it.
But i think default is need, because userspace could give an incorrect value .
So we need to setup a default value and doing error check.
Quoted 92 lines
Quoted 92 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +91
-0+ } + + return rot; +} + +static u32 dpu_img_ctrl(u32 format, u32 blending, u32 rotation) +{ + int reg_val = 0; + + /* layer enable */ + reg_val |= BIT(0); + + switch (format) { + case DRM_FORMAT_BGRA8888: + /* BGRA8888 -> ARGB8888 */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B3B2B1B0 << 8; + reg_val |= (DPU_LAYER_FORMAT_ARGB8888 << 4); + break; + case DRM_FORMAT_RGBX8888: + case DRM_FORMAT_RGBA8888: + /* RGBA8888 -> ABGR8888 */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B3B2B1B0 << 8; + /* FALLTHRU */ + case DRM_FORMAT_ABGR8888: + /* rb switch */ + reg_val |= BIT(10); + /* FALLTHRU */ + case DRM_FORMAT_ARGB8888: + reg_val |= (DPU_LAYER_FORMAT_ARGB8888 << 4); + break; + case DRM_FORMAT_XBGR8888: + /* rb switch */ + reg_val |= BIT(10); + /* FALLTHRU */ + case DRM_FORMAT_XRGB8888: + reg_val |= (DPU_LAYER_FORMAT_ARGB8888 << 4); + break; + case DRM_FORMAT_BGR565: + /* rb switch */ + reg_val |= BIT(10); + /* FALLTHRU */ + case DRM_FORMAT_RGB565: + reg_val |= (DPU_LAYER_FORMAT_RGB565 << 4); + break; + case DRM_FORMAT_NV12: + /* 2-Lane: Yuv420 */ + reg_val |= DPU_LAYER_FORMAT_YUV420_2PLANE << 4; + /* Y endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B0B1B2B3 << 8; + /* UV endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B0B1B2B3 << 10; + break; + case DRM_FORMAT_NV21: + /* 2-Lane: Yuv420 */ + reg_val |= DPU_LAYER_FORMAT_YUV420_2PLANE << 4; + /* Y endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B0B1B2B3 << 8; + /* UV endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B3B2B1B0 << 10; + break; + case DRM_FORMAT_NV16: + /* 2-Lane: Yuv422 */ + reg_val |= DPU_LAYER_FORMAT_YUV422_2PLANE << 4; + /* Y endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B3B2B1B0 << 8; + /* UV endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B3B2B1B0 << 10; + break; + case DRM_FORMAT_NV61: + /* 2-Lane: Yuv422 */ + reg_val |= DPU_LAYER_FORMAT_YUV422_2PLANE << 4; + /* Y endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B0B1B2B3 << 8; + /* UV endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B0B1B2B3 << 10; + break; + case DRM_FORMAT_YUV420: + reg_val |= DPU_LAYER_FORMAT_YUV420_3PLANE << 4; + /* Y endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B0B1B2B3 << 8; + /* UV endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B0B1B2B3 << 10; + break; + case DRM_FORMAT_YVU420: + reg_val |= DPU_LAYER_FORMAT_YUV420_3PLANE << 4; + /* Y endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B0B1B2B3 << 8; + /* UV endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B3B2B1B0 << 10; + break; + default:
Quoted 9 lines
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 5 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +5
-0+ pr_err("error: invalid format %c%c%c%c\n", format, + format >> 8, + format >> 16, + format >> 24); + break;The default case here should be unreachable. Either it is or the upper layer (or
earlier code) should ensure that.
There will be some differences in the formats supported by different chips, but userspace will only have one set of code.
So it is necessary to check whether the parameters passed by the user layer are wrong. I think it is necessary
Quoted 159 lines
Quoted 15 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +14
-0+ } + + switch (blending) { + case DRM_MODE_BLEND_PIXEL_NONE: + /* don't do blending, maybe RGBX */ + /* alpha mode select - layer alpha */ + reg_val |= BIT(2); + break; + case DRM_MODE_BLEND_COVERAGE: + /* alpha mode select - combo alpha */ + reg_val |= BIT(3); + /*Normal mode*/ + reg_val &= (~BIT(16)); + break;drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ case DRM_MODE_BLEND_PREMULTI: + /* alpha mode select - combo alpha */ + reg_val |= BIT(3); + /*Pre-mult mode*/ + reg_val |= BIT(16); + break; + default: + /* alpha mode select - layer alpha */ + reg_val |= BIT(2); + break;Ditto
Quoted 13 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +12
-0+ } + + rotation = to_dpu_rotation(rotation); + reg_val |= (rotation & 0x7) << 20; + + return reg_val; +} + +static void dpu_layer(struct dpu_context *ctx, + struct sprd_dpu_layer *hwlayer) +{ + struct dpu_reg *reg = (struct dpu_reg *)ctx->base;drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ const struct drm_format_info *info; + struct layer_reg *layer; + u32 addr, size, offset; + int i; + + layer = ®->layers[hwlayer->index]; + offset = (hwlayer->dst_x & 0xffff) | ((hwlayer->dst_y) << 16); + + if (hwlayer->src_w && hwlayer->src_h) + size = (hwlayer->src_w & 0xffff) | ((hwlayer->src_h) <<16);
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 2 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +2
-0+ else + size = (hwlayer->dst_w & 0xffff) | ((hwlayer->dst_h) <<16);
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 6 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +6
-0+ + for (i = 0; i < hwlayer->planes; i++) { + addr = hwlayer->addr[i]; + + if (addr % 16) + pr_err("layer addr[%d] is not 16 bytes align,it's 0x%08x\n",
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 11 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +11
-0+ i, addr); + layer->addr[i] = addr; + } + + layer->pos = offset; + layer->size = size; + layer->crop_start = (hwlayer->src_y << 16) | hwlayer->src_x; + layer->alpha = hwlayer->alpha; + + info = drm_format_info(hwlayer->format); + if (info->cpp[0] == 0) {Ditto
Quoted 1 line
+ pr_err("layer[%d] bytes per pixel is invalid\n",
hwlayer->index);drivers/gpu/drm/sprd/dpu/Makefile
Quoted 13 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +9
-0+ return; + } + +static int dpu_capability(struct dpu_context *ctx, + struct dpu_capability *cap) +{ + if (!cap) + return -EINVAL; +Ensure the caller always passes cap != NULL and drop the function return type?
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 13 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +11
-0+ cap->max_layers = 6; + cap->fmts_ptr = primary_fmts; + cap->fmts_cnt = ARRAY_SIZE(primary_fmts); + + return 0; +} +static int sprd_plane_atomic_check(struct drm_plane *plane, + struct drm_plane_state *state) +{ + DRM_DEBUG("%s()\n", __func__); +Would be nice to hear from the atomic experts, how a no-op
atomic_checkgoes
with the overall atomic semantics.Quoted 4 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +3
-0+ return 0; +} +drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +9
-0+static void sprd_plane_atomic_disable(struct drm_plane *plane, + struct drm_plane_state *old_state) +{ + struct sprd_plane *p = to_sprd_plane(plane); + + /* + * NOTE: + * The dpu->core->flip() will disable all the planes each time. + * So there is no need to impliment the atomic_disable()function.
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 7 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +7
-0+ * But this function can not be removed, because it will change + * to call atomic_update() callback instead. Which will cause + * kernel panic in sprd_plane_atomic_update(). + * + * We do nothing here but just print a debug log. + */ + DRM_DEBUG("%s() layer_id = %u\n", __func__, p->index);Similar to the check - would be nice to see a confirmation, that this isn't abusing atomics in some way.
Quoted 19 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +19
-0+} + +static int sprd_plane_create_properties(struct sprd_plane *p, int index) +{ + unsigned int supported_modes = BIT(DRM_MODE_BLEND_PIXEL_NONE) | + BIT(DRM_MODE_BLEND_PREMULTI) | + BIT(DRM_MODE_BLEND_COVERAGE); + + /* create rotation property */ + drm_plane_create_rotation_property(&p->plane, + DRM_MODE_ROTATE_0, + DRM_MODE_ROTATE_MASK | + DRM_MODE_REFLECT_MASK); + + /* create alpha property */ + drm_plane_create_alpha_property(&p->plane); + + /* create blend mode property */ + drm_plane_create_blend_mode_property(&p->plane, supported_modes);
Quoted 9 lines
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 4 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +4
-0+ + /* create zpos property */ + drm_plane_create_zpos_immutable_property(&p->plane, index); +Either check if creating the properties fail (and propagate the error) or drop
the function return type. As-is it's in the middle making it fairly misleading.
Ok, i will drop the func return type.
Quoted 18 lines
Quoted 5 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +3
-0+ return 0; +} +drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +9
-0+static struct drm_plane *sprd_plane_init(struct drm_device *drm, + struct sprd_dpu *dpu) +{ + struct drm_plane *primary = NULL; + struct sprd_plane *p = NULL; + struct dpu_capability cap = {}; + int err, i; + + if (dpu->core && dpu->core->capability)As mentioned before - this always evaluates to true, so drop the check. Same applies for the other
dpu->core->foochecks.
Quoted 4 lines
Still not a huge fan of the abstraction layer, but I guess you're hesitant on
removing it.
Sometimes, some "dpu->core->foo" maybe always need, compatibility will be better.
eg:
if (dpu->glb && dpu->glb->power)
dpu->glb->power(ctx, true);
if (dpu->glb && dpu->glb->enable)
dpu->glb->enable(ctx);
if (ctx->is_stopped && dpu->glb && dpu->glb->reset)
dpu->glb->reset(ctx);
if (dpu->clk && dpu->clk->init)
dpu->clk->init(ctx);
if (dpu->clk && dpu->clk->enable)
dpu->clk->enable(ctx);
if (dpu->core && dpu->core->init)
dpu->core->init(ctx);
if (dpu->core && dpu->core->ifconfig)
dpu->core->ifconfig(ctx);But here, "dpu->core->capability", your are right, this always evaluates to true
So i will remove the error checking about always being true...
drivers/gpu/drm/sprd/sprd_dpu.c
Quoted 4 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +4
-0+ dpu->core->capability (&dpu->ctx, &cap); + + dpu->layers = devm_kcalloc(drm->dev, cap.max_layers, + sizeof(struct sprd_dpu_layer),
GFP_KERNEL);
drivers/gpu/drm/sprd/sprd_dpu.c
Quoted 11 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +11
-0+if (!dpu->layers) +return ERR_PTR (-ENOMEM ); + +for (i =0 ; i < cap.max_layers; i++) { + + p =devm_kzalloc (drm->dev,sizeof (*p),GFP_KERNEL ); +if (!p) +return ERR_PTR (-ENOMEM ); + + err = drm_universal_plane_init(drm, &p->plane, 1, + &sprd_plane_funcs,
cap.fmts_ptr,
Review
Quoted 2 lines
(quoted diff) +2
-0+ cap.fmts_cnt, NULL, + DRM_PLANE_TYPE_PRIMARY,
NULL);
Quoted 6 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +6
-0+if (err) { +DRM_ERROR ("fail to init primary plane\n" ); +return ERR_PTR (err); + } + +drm_plane_helper_add (&p->plane, &sprd_plane_helper_funcs);
drivers/gpu/drm/sprd/sprd_dpu.c line 186
Quoted 10 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +10
-0+ +sprd_plane_create_properties (p, i); + + p->index = i; +if (i ==0 ) + primary = &p->plane; + } + +if (p) +DRM_INFO ("dpu plane init ok\n" );
This and nearly all the other DRM_INFO() messages look like a debug/development
left over. Please remove them - the driver does not need to print when functions
are successfull.
Quoted 7 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +7
-0+ +return primary; +} + +static void sprd_crtc_mode_set_nofb (struct drm_crtc *crtc) +{ +struct sprd_dpu *dpu =crtc_to_dpu (crtc);
drivers/gpu/drm/sprd/sprd_dpu.c
Quoted 10 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +10
-0+ +if ((dpu->mode->hdisplay == dpu->mode->htotal) || + (dpu->mode->vdisplay == dpu->mode->vtotal)) + dpu->ctx.if_type =SPRD_DISPC_IF_EDPI ; +else + dpu->ctx.if_type =SPRD_DISPC_IF_DPI ; +} + +static enum drm_mode_status sprd_crtc_mode_valid (struct drm_crtc *crtc, + const struct drm_display_mode
*mode)
drivers/gpu/drm/sprd/sprd_dpu.c
Quoted 4 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +4
-0+{ +struct sprd_dpu *dpu =crtc_to_dpu (crtc); + + DRM_INFO("%s() mode: "DRM_MODE_FMT"\n", __func__,
DRM_MODE_ARG(mode));
Quoted 1 line
+
If needed, let's move this to core and make it a debug message. As-is it will
cause spam for no reason.
drivers/gpu/drm/sprd/sprd_dpu.c line 213
Quoted 5 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +5
-0+if (mode->type &DRM_MODE_TYPE_DEFAULT ) + dpu->mode = (struct drm_display_mode *)mode; + +if (mode->type &DRM_MODE_TYPE_PREFERRED ) { + dpu->mode = (struct drm_display_mode *)mode;
Casting away the constness is a bad idea.
Instead, let's move the if_type decision here, thus we can remove the nsprd_crtc_mode_set_nofb function? This way we can also remove sprd_dpu::mode.
Quoted 1 line
+
drm_display_mode_to_videomode(dpu->mode, &dpu->ctx.vm);
Similarly, one could derive the vm based attributes here and remove dpu->ctx.vm.
drivers/gpu/drm/sprd/sprd_dpu.c line 226
Quoted 12 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +12
-0+ } + +return MODE_OK ; +} + +static void sprd_crtc_atomic_enable (struct drm_crtc *crtc, +struct drm_crtc_state *old_state) +{ +struct sprd_dpu *dpu =crtc_to_dpu (crtc); + +DRM_INFO ("%s()\n" , __func__); +
More sprurious info messages - debug leftover?
drivers/gpu/drm/sprd/sprd_dpu.c line 301
Quoted 6 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +6
-0+static int sprd_crtc_enable_vblank (struct drm_crtc *crtc) +{ +struct sprd_dpu *dpu =crtc_to_dpu (crtc); + +DRM_DEBUG ("%s()\n" , __func__); +
Personally, I don't see the appeal in these debug messages. While a few display
controllers have the odd piece, they are an exception in DRM.
Quoted 4 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +4
-0+static int sprd_crtc_create_properties (struct drm_crtc *crtc) +{ +struct sprd_dpu *dpu =crtc_to_dpu (crtc); +struct drm_device *drm = dpu->crtc.dev;
drivers/gpu/drm/sprd/sprd_dpu.c
Quoted 10 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +10
-0+struct drm_property *prop; +struct drm_property_blob *blob; +size_t blob_size; + + blob_size =strlen (dpu->ctx.version) +1 ; + + blob =drm_property_create_blob (dpu->crtc.dev, blob_size, + dpu->ctx.version); +if (IS_ERR (blob)) { + DRM_ERROR("drm_property_create_blob dpu version
failed\n");
drivers/gpu/drm/sprd/sprd_dpu.c line 338
Quoted 7 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +7
-0+return PTR_ERR (blob); + } + +/* create dpu version property */ + prop =drm_property_create (drm, +DRM_MODE_PROP_IMMUTABLE |DRM_MODE_PROP_BLOB , +"dpu version" ,0 );
Note: Custom properties should be separate patches. This includes documentation
why they are needed and references to open-source userspace. This only need for our chips, what documentation do we need to provide?
HTH
Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH RFC v4 4/6] drm/sprd: add Unisoc's drm display controller driver
Quoted 13 lines · tang pengchuan
Quoted 11 lines · Emil Velikov
Have you seen a case where the 0 or default case are reached? AFAICT they will never trigger. So one might as well use:
switch (angle) { case DRM_MODE_FOO: return DPU_LAYER_ROTATION_FOO; ... case DRM_MODE_BAR: return DPU_LAYER_ROTATION_BAR; }
Quoted 3 lines
Yeah, the 0 maybe unused code, i will remove it.
But i think default is need, because userspace could give an incorrect value . So we need to setup a default value and doing error check.
As mentioned in the documentation [0] input (userspace) validation should happen in atomic_check. This function here is called during atomic_flush which is _not_ allowed to fail.
Quoted 5 lines
Quoted 2 lines
The default case here should be unreachable. Either it is or the upper layer (or earlier code) should ensure that.
There will be some differences in the formats supported by different chips, but userspace will only have one set of code. So it is necessary to check whether the parameters passed by the user layer are wrong. I think it is necessary
As said above - this type of issues should be checked _before_ reaching atomic_flush - aka in atomic_check.
Quoted 27 lines
Quoted 12 lines
drivers/gpu/drm/sprd/sprd_dpu.c line 153
Quoted 9 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +9
-0+static struct drm_plane *sprd_plane_init (struct drm_device *drm, +struct sprd_dpu *dpu) +{ +struct drm_plane *primary =NULL ; +struct sprd_plane *p =NULL ; +struct dpu_capability cap = {}; +int err, i; + +if (dpu->core && dpu->core->capability)As mentioned before - this always evaluates to true, so drop the check. Same applies for the other
dpu->core->foochecks.Quoted 2 lines
Still not a huge fan of the abstraction layer, but I guess you're hesitant on removing it.
Sometimes, some "
dpu->core->foo" maybe always need, compatibility will be better. eg:if (dpu->glb && dpu->glb->power) dpu->glb->power(ctx, true); if (dpu->glb && dpu->glb->enable) dpu->glb->enable(ctx); if (ctx->is_stopped && dpu->glb && dpu->glb->reset) dpu->glb->reset(ctx); if (dpu->clk && dpu->clk->init)
Quoted 9 lines
dpu->clk->init(ctx);
if (dpu->clk && dpu->clk->enable)
dpu->clk->enable(ctx);
if (dpu->core && dpu->core->init)
dpu->core->init(ctx);
if (dpu->core && dpu->core->ifconfig)
dpu->core->ifconfig(ctx);If there are no hooks, then the whole thing is dead code. As such it should not be included.
Quoted 5 lines
Quoted 3 lines
Note: Custom properties should be separate patches. This includes documentation why they are needed and references to open-source userspace.
This only need for our chips, what documentation do we need to provide?
KMS properties should be generic. Reason being is that divergence causes substantial overhead, and fragility, to each and every userspace consumer. The documentation has some general notes on the topic [1]. Don't forget the "Testing and validation" section ;-)
Although I've tried to catch everything, I might have missed a comment or two due the HTML formatting. Please toggle to plain text [2] for the future.
Thanks
-Emil
[0] https://www.kernel.org/doc/html/v5.5/gpu/drm-kms.html
[1] Documentation/gpu/drm-uapi.rst in particular "Open-Source Userspace Requirements"
[2] https://smallbusiness.chron.com/reply-inline-gmail-40679.html
Re: [PATCH RFC v4 4/6] drm/sprd: add Unisoc's drm display controller driver
Quoted 15 lines · Emil Velikov <[email protected]> 于2020年3月7日周六 上午1:14写道:
Quoted 13 lines · tang pengchuan
Quoted 11 lines · Emil Velikov
Have you seen a case where the 0 or default case are reached? AFAICT they will never trigger. So one might as well use:
switch (angle) { case DRM_MODE_FOO: return DPU_LAYER_ROTATION_FOO; ... case DRM_MODE_BAR: return DPU_LAYER_ROTATION_BAR; }
Quoted 7 lines
Quoted 3 lines
Yeah, the 0 maybe unused code, i will remove it.
But i think default is need, because userspace could give an incorrect value . So we need to setup a default value and doing error check.As mentioned in the documentation [0] input (userspace) validation should happen in
atomic_check. This function here is called duringatomic_flushwhich is _not_ allowed to fail.
In drm atomic commit codepath:
drm_atomic_commit-->drm_atomic_plane_check--->drm_plane_check_pixel_format already helped us check DRM_FORMAT_XXX, so default laber is dead code. Is just a waste of time and increases the complexity of the code for no reason.
We can't use "return" replace "break"
Because "switch(format)" and "switch(blending)"exist at the same funtion, and I don't think it's a good idea to split them. I think there are two solutions:
1. Remove default label completely
2. Add "default: // Do nothing", Eg:
int flag = value > 1000 ? 1 : 0;
swich(flag) {
case 0:
// do something
break;
case 1:
// do something
break;
default: // do nothing
break;
}Quoted 11 lines
Quoted 8 lines
Quoted 5 lines
The default case here should be unreachable. Either it is or the upper layer (or earlier code) should ensure that.
There will be some differences in the formats supported by different chips, but userspace will only have one set of code. So it is necessary to check whether the parameters passed by the user layer are wrong. I think it is necessary
As said above - this type of issues should be checked _before_ reaching
atomic_flush- aka inatomic_check.
Your are right, switch(format) and switch(blending) will never reach default label, so it's dead code.
As for rotation, we will ensure it is correct at the user layer.
Quoted 49 lines
Quoted 29 lines
Quoted 14 lines
drivers/gpu/drm/sprd/sprd_dpu.c line 153
Quoted 11 lines
drivers/gpu/drm/sprd/sprd_dpu.c new file +9
-0+static struct drm_plane *sprd_plane_init (struct drm_device *drm, +struct sprd_dpu *dpu) +{ +struct drm_plane *primary =NULL ; +struct sprd_plane *p =NULL ; +struct dpu_capability cap = {}; +int err, i; + +if (dpu->core && dpu->core->capability)As mentioned before - this always evaluates to true, so drop the check. Same applies for the other
dpu->core->foochecks.Quoted 2 lines
Still not a huge fan of the abstraction layer, but I guess you're hesitant on removing it.
Sometimes, some "
dpu->core->foo" maybe always need, compatibility will be better. eg:if (dpu->glb && dpu->glb->power) dpu->glb->power(ctx, true); if (dpu->glb && dpu->glb->enable) dpu->glb->enable(ctx); if (ctx->is_stopped && dpu->glb && dpu->glb->reset) dpu->glb->reset(ctx); if (dpu->clk && dpu->clk->init)Quoted 9 lines
dpu->clk->init(ctx); if (dpu->clk && dpu->clk->enable) dpu->clk->enable(ctx); if (dpu->core && dpu->core->init) dpu->core->init(ctx); if (dpu->core && dpu->core->ifconfig) dpu->core->ifconfig(ctx);If there are no hooks, then the whole thing is dead code. As such it should not be included.
Quoted 5 lines
Quoted 3 lines
Note: Custom properties should be separate patches. This includes documentation why they are needed and references to open-source userspace.
This only need for our chips, what documentation do we need to provide?
Quoted 8 lines
KMS properties should be generic. Reason being is that divergence causes substantial overhead, and fragility, to each and every userspace consumer. The documentation has some general notes on the topic [1]. Don't forget the "Testing and validation" section ;-)
Although I've tried to catch everything, I might have missed a comment or two due the HTML formatting. Please toggle to plain text [2] for the future.
I got it
Quoted 8 lines
Thanks
-Emil[0] https://www.kernel.org/doc/html/v5.5/gpu/drm-kms.html
[1]Documentation/gpu/drm-uapi.rstin particular "Open-Source Userspace Requirements"
[2] https://smallbusiness.chron.com/reply-inline-gmail-40679.html
Re: [PATCH RFC v4 4/6] drm/sprd: add Unisoc's drm display controller driver
In reply to Emil VelikovHi Emil,
Maybe here is your missing comments
I ’m really sorry, sometimes I forget to use plain text by gmail, never make the same mistake again.
Quoted 19 lines · Emil Velikov <[email protected]> 于2020年3月3日周二 上午2:29写道:
Hi Kevin,
There's a few small suggestions, although overall the driver looks a lot better.
drivers/gpu/drm/sprd/dpu/Makefile line 4
Quoted 7 lines · Kevin Tang
drivers/gpu/drm/sprd/dpu/Makefile new file +4
-0@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 + +ifdef CONFIG_ARM64 +KBUILD_CFLAGS += -mstrict-alignThere are many other drivers that do not use readl/writel for register access, yet none has this workaround... Even those that they are exclusively ARM64.
Quoted 5 lines
Have you tried that it's not a buggy version of GCC? At the very least, I'd encourage you to add a brief comment about the problem + setup.
... In general I think one should follow the suggestions from Rob Herring.
Yocto v2.5
aarch64-linaro-linux-gcc (Linaro GCC 7.2-2017.11) 7.2.1 20171011
Crash Stack:
/sprd/drv/dispc/dpu_r2p0.c:729
1796256 ffffff8008486650: f803c043 stur x3, [x2,#60]
=>Unhandled fault: alignment fault (0x96000061) at 0xffffff80098b883c
729 reg->mmu_min_ppn1 = 0; 730 reg->mmu_ppn_range1 = 0xffff; 731 reg->mmu_min_ppn2 = 0; 732 reg->mmu_ppn_range2 = 0xffff;
The above C code operation are continuous. The compiler may think that the access can be completed by directly using two 64-bit assignment operations, so it is optimized to 64-bit operation.
Assembly code:
=============================
/sprd/drv/dispc/dpu_r2p0.c:729
1796244 ffffff8008486638: 91200022 add x2, x1, #0x800
/sprd/drv/dispc/dpu_r2p0.c:728
1796246 ffffff800848663c: b908003f str wzr, [x1,#2048]
/sprd/drv/dispc/dpu_r2p0.c:729
1796248 ffffff8008486640: d2dfffe3 mov x3,
#0xffff00000000
/sprd/drv/dispc/dpu_r2p0.c:733
1796250 ffffff8008486644: 12bfffc4 mov w4, #0x1ffff
/sprd/drv/dispc/dpu_r2p0.c:735
1796252 ffffff8008486648: 529fffe5 mov w5, #0xffff
/sprd/drv/dispc/dpu_r2p0.c:741
1796254 ffffff800848664c: 52800000 mov w0, #0x0
/sprd/drv/dispc/dpu_r2p0.c:729
1796256 ffffff8008486650: f803c043 stur x3, [x2,#60]
=>Unhandled fault: alignment fault (0x96000061) at 0xffffff80098b883c /sprd/drv/dispc/dpu_r2p0.c:730
1796258 ffffff8008486654: f8044043 stur x3, [x2,#68]
/sprd/drv/dispc/dpu_r2p0.c:735
1796260 ffffff8008486658: b901e425 str w5, [x1,#484]
/sprd/drv/dispc/dpu_r2p0.c:733
1796262 ffffff800848665c: b9080c24 str w4, [x1,#2060] 1796263 ffffff8008486660: f9400274 ldr x20, [x19]
Quoted 442 lines
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 11 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +9
-0+static void dpu_dump(struct dpu_context *ctx) +{ + u32 *reg = (u32 *)ctx->base; + int i; + + pr_info(" 0 4 8 C\n"); + for (i = 0; i < 256; i += 4) { + pr_info("%04x: 0x%08x 0x%08x 0x%08x 0x%08x\n", + i * 4, reg[i], reg[i + 1], reg[i + 2], reg[i + 3]);Using some of the helpers from
drm_print.hwould be better than pr_*. This applies for the rest of the patch.drivers/gpu/drm/sprd/dpu/Makefile
Quoted 6 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +6
-0+static void dpu_clean_all(struct dpu_context *ctx) +{ + int i; + struct dpu_reg *reg = (struct dpu_reg *)ctx->base; + + for (i = 0; i < 8; i++)This "< 8" seem pretty magical. How about "<
ARRAY_SIZE(reg->layers)" Same logic applies through the rest of the patch.drivers/gpu/drm/sprd/dpu/Makefile
Quoted 7 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +7
-0+static int dpu_wait_stop_done(struct dpu_context *ctx) +{ + int rc; + + if (ctx->stopped) + return 0; +The stopped handling does look suspicious. Admittedly I did not look too closely at the
dpu_flipcode, which seems to require it.Let's add a small comment in the struct
dpu_context::stoppeddeclaration, why it is needed, if it truely is.Quoted 18 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +17
-0+ rc = wait_event_interruptible_timeout(ctx->wait_queue, ctx->evt_stop, + msecs_to_jiffies(500)); + ctx->evt_stop = false; + + ctx->stopped = true; + + if (!rc) { + pr_err("dpu wait for stop done time out!\n"); + return -ETIMEDOUT; + } + + return 0; +} + +static void dpu_stop(struct dpu_context *ctx) +{ + struct dpu_reg *reg = (struct dpu_reg *)ctx->base;drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ + if (ctx->stopped) + return; + + if (ctx->if_type == SPRD_DISPC_IF_DPI) + reg->dpu_ctrl |= BIT(1); + + dpu_wait_stop_done(ctx); + + pr_info("dpu stop\n");This and the
dpu_runpr_info()messages can be removed.Quoted 37 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +37
-0+} + +static void dpu_run(struct dpu_context *ctx) +{ + struct dpu_reg *reg = (struct dpu_reg *)ctx->base; + + if (!ctx->stopped) + return; + + reg->dpu_ctrl |= BIT(0); + + ctx->stopped = false; + + pr_info("dpu run\n"); +} + +static int dpu_init(struct dpu_context *ctx) +{ + struct dpu_reg *reg = (struct dpu_reg *)ctx->base; + u32 size; + + reg->bg_color = 0; + + size = (ctx->vm.vactive << 16) | ctx->vm.hactive; + reg->panel_size = size; + reg->blend_size = size; + + reg->dpu_cfg0 = BIT(4) | BIT(5); + + reg->dpu_cfg1 = 0x004466da; + reg->dpu_cfg2 = 0; + + if (ctx->stopped) + dpu_clean_all(ctx); + + reg->mmu_en = 0; + reg->mmu_min_ppn1 = 0;drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ reg->mmu_ppn_range1 = 0xffff; + reg->mmu_min_ppn2 = 0; + reg->mmu_ppn_range2 = 0xffff; + reg->mmu_vpn_range = 0x1ffff; + + reg->dpu_int_clr = 0xffff; + + init_waitqueue_head(&ctx->wait_queue); + + return 0;Function always returns 0. Let's make it static void
dpu_init()Quoted 23 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +23
-0+static u32 to_dpu_rotation(u32 angle) +{ + u32 rot = DPU_LAYER_ROTATION_0; + + switch (angle) { + case 0: + case DRM_MODE_ROTATE_0: + rot = DPU_LAYER_ROTATION_0; + break; + case DRM_MODE_ROTATE_90: + rot = DPU_LAYER_ROTATION_90; + break; + case DRM_MODE_ROTATE_180: + rot = DPU_LAYER_ROTATION_180; + break; + case DRM_MODE_ROTATE_270: + rot = DPU_LAYER_ROTATION_270; + break; + case DRM_MODE_REFLECT_Y: + rot = DPU_LAYER_ROTATION_180_M; + break; + case (DRM_MODE_REFLECT_Y | DRM_MODE_ROTATE_90): + rot = DPU_LAYER_ROTATION_90_M;drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ break; + case DRM_MODE_REFLECT_X: + rot = DPU_LAYER_ROTATION_0_M; + break; + case (DRM_MODE_REFLECT_X | DRM_MODE_ROTATE_90): + rot = DPU_LAYER_ROTATION_270_M; + break; + default: + pr_err("rotation convert unsupport angle (drm)= 0x%x\n", angle); + break;Have you seen a case where the 0 or default case are reached? AFAICT they will never trigger. So one might as well use:
switch (angle) { case DRM_MODE_FOO: return DPU_LAYER_ROTATION_FOO; ... case DRM_MODE_BAR: return DPU_LAYER_ROTATION_BAR; }Quoted 86 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +86
-0+ } + + return rot; +} + +static u32 dpu_img_ctrl(u32 format, u32 blending, u32 rotation) +{ + int reg_val = 0; + + /* layer enable */ + reg_val |= BIT(0); + + switch (format) { + case DRM_FORMAT_BGRA8888: + /* BGRA8888 -> ARGB8888 */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B3B2B1B0 << 8; + reg_val |= (DPU_LAYER_FORMAT_ARGB8888 << 4); + break; + case DRM_FORMAT_RGBX8888: + case DRM_FORMAT_RGBA8888: + /* RGBA8888 -> ABGR8888 */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B3B2B1B0 << 8; + /* FALLTHRU */ + case DRM_FORMAT_ABGR8888: + /* rb switch */ + reg_val |= BIT(10); + /* FALLTHRU */ + case DRM_FORMAT_ARGB8888: + reg_val |= (DPU_LAYER_FORMAT_ARGB8888 << 4); + break; + case DRM_FORMAT_XBGR8888: + /* rb switch */ + reg_val |= BIT(10); + /* FALLTHRU */ + case DRM_FORMAT_XRGB8888: + reg_val |= (DPU_LAYER_FORMAT_ARGB8888 << 4); + break; + case DRM_FORMAT_BGR565: + /* rb switch */ + reg_val |= BIT(10); + /* FALLTHRU */ + case DRM_FORMAT_RGB565: + reg_val |= (DPU_LAYER_FORMAT_RGB565 << 4); + break; + case DRM_FORMAT_NV12: + /* 2-Lane: Yuv420 */ + reg_val |= DPU_LAYER_FORMAT_YUV420_2PLANE << 4; + /* Y endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B0B1B2B3 << 8; + /* UV endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B0B1B2B3 << 10; + break; + case DRM_FORMAT_NV21: + /* 2-Lane: Yuv420 */ + reg_val |= DPU_LAYER_FORMAT_YUV420_2PLANE << 4; + /* Y endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B0B1B2B3 << 8; + /* UV endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B3B2B1B0 << 10; + break; + case DRM_FORMAT_NV16: + /* 2-Lane: Yuv422 */ + reg_val |= DPU_LAYER_FORMAT_YUV422_2PLANE << 4; + /* Y endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B3B2B1B0 << 8; + /* UV endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B3B2B1B0 << 10; + break; + case DRM_FORMAT_NV61: + /* 2-Lane: Yuv422 */ + reg_val |= DPU_LAYER_FORMAT_YUV422_2PLANE << 4; + /* Y endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B0B1B2B3 << 8; + /* UV endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B0B1B2B3 << 10; + break; + case DRM_FORMAT_YUV420: + reg_val |= DPU_LAYER_FORMAT_YUV420_3PLANE << 4; + /* Y endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B0B1B2B3 << 8; + /* UV endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B0B1B2B3 << 10; + break; + case DRM_FORMAT_YVU420: + reg_val |= DPU_LAYER_FORMAT_YUV420_3PLANE << 4; + /* Y endian */drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ reg_val |= SPRD_IMG_DATA_ENDIAN_B0B1B2B3 << 8; + /* UV endian */ + reg_val |= SPRD_IMG_DATA_ENDIAN_B3B2B1B0 << 10; + break; + default: + pr_err("error: invalid format %c%c%c%c\n", format, + format >> 8, + format >> 16, + format >> 24); + break;The default case here should be unreachable. Either it is or the upper layer (or earlier code) should ensure that.
Quoted 14 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +14
-0+ } + + switch (blending) { + case DRM_MODE_BLEND_PIXEL_NONE: + /* don't do blending, maybe RGBX */ + /* alpha mode select - layer alpha */ + reg_val |= BIT(2); + break; + case DRM_MODE_BLEND_COVERAGE: + /* alpha mode select - combo alpha */ + reg_val |= BIT(3); + /*Normal mode*/ + reg_val &= (~BIT(16)); + break;drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ case DRM_MODE_BLEND_PREMULTI: + /* alpha mode select - combo alpha */ + reg_val |= BIT(3); + /*Pre-mult mode*/ + reg_val |= BIT(16); + break; + default: + /* alpha mode select - layer alpha */ + reg_val |= BIT(2); + break;Ditto
Quoted 32 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +31
-0+ } + + rotation = to_dpu_rotation(rotation); + reg_val |= (rotation & 0x7) << 20; + + return reg_val; +} + +static void dpu_layer(struct dpu_context *ctx, + struct sprd_dpu_layer *hwlayer) +{ + struct dpu_reg *reg = (struct dpu_reg *)ctx->base; + const struct drm_format_info *info; + struct layer_reg *layer; + u32 addr, size, offset; + int i; + + layer = ®->layers[hwlayer->index]; + offset = (hwlayer->dst_x & 0xffff) | ((hwlayer->dst_y) << 16); + + if (hwlayer->src_w && hwlayer->src_h) + size = (hwlayer->src_w & 0xffff) | ((hwlayer->src_h) << 16); + else + size = (hwlayer->dst_w & 0xffff) | ((hwlayer->dst_h) << 16); + + for (i = 0; i < hwlayer->planes; i++) { + addr = hwlayer->addr[i]; + + if (addr % 16) + pr_err("layer addr[%d] is not 16 bytes align, it's 0x%08x\n", + i, addr);drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ layer->addr[i] = addr; + } + + layer->pos = offset; + layer->size = size; + layer->crop_start = (hwlayer->src_y << 16) | hwlayer->src_x; + layer->alpha = hwlayer->alpha; + + info = drm_format_info(hwlayer->format); + if (info->cpp[0] == 0) {Ditto
Quoted 4 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +4
-0+ pr_err("layer[%d] bytes per pixel is invalid\n", hwlayer->index); + return; + } +drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +6
-0+static int dpu_capability(struct dpu_context *ctx, + struct dpu_capability *cap) +{ + if (!cap) + return -EINVAL; +Ensure the caller always passes cap != NULL and drop the function return type?
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 13 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +11
-0+ cap->max_layers = 6; + cap->fmts_ptr = primary_fmts; + cap->fmts_cnt = ARRAY_SIZE(primary_fmts); + + return 0; +} +static int sprd_plane_atomic_check(struct drm_plane *plane, + struct drm_plane_state *state) +{ + DRM_DEBUG("%s()\n", __func__); +Would be nice to hear from the atomic experts, how a no-op
atomic_checkgoes with the overall atomic semantics.Quoted 11 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +9
-0+ return 0; +} + +static void sprd_plane_atomic_disable(struct drm_plane *plane, + struct drm_plane_state *old_state) +{ + struct sprd_plane *p = to_sprd_plane(plane); + + /*drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ * NOTE: + * The dpu->core->flip() will disable all the planes each time. + * So there is no need to impliment the atomic_disable() function. + * But this function can not be removed, because it will change + * to call atomic_update() callback instead. Which will cause + * kernel panic in sprd_plane_atomic_update(). + * + * We do nothing here but just print a debug log. + */ + DRM_DEBUG("%s() layer_id = %u\n", __func__, p->index);Similar to the check - would be nice to see a confirmation, that this isn't abusing atomics in some way.
Quoted 13 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +13
-0+} + +static int sprd_plane_create_properties(struct sprd_plane *p, int index) +{ + unsigned int supported_modes = BIT(DRM_MODE_BLEND_PIXEL_NONE) | + BIT(DRM_MODE_BLEND_PREMULTI) | + BIT(DRM_MODE_BLEND_COVERAGE); + + /* create rotation property */ + drm_plane_create_rotation_property(&p->plane, + DRM_MODE_ROTATE_0, + DRM_MODE_ROTATE_MASK | + DRM_MODE_REFLECT_MASK);drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ + /* create alpha property */ + drm_plane_create_alpha_property(&p->plane); + + /* create blend mode property */ + drm_plane_create_blend_mode_property(&p->plane, supported_modes); + + /* create zpos property */ + drm_plane_create_zpos_immutable_property(&p->plane, index); +Either check if creating the properties fail (and propagate the error) or drop the function return type. As-is it's in the middle making it fairly misleading.
Quoted 4 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +3
-0+ return 0; +} +drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +9
-0+static struct drm_plane *sprd_plane_init(struct drm_device *drm, + struct sprd_dpu *dpu) +{ + struct drm_plane *primary = NULL; + struct sprd_plane *p = NULL; + struct dpu_capability cap = {}; + int err, i; + + if (dpu->core && dpu->core->capability)As mentioned before - this always evaluates to true, so drop the check. Same applies for the other
dpu->core->foochecks.
Quoted 2 lines
Still not a huge fan of the abstraction layer, but I guess you're hesitant on removing it.
Here is the complete implementation of our "sprd_dpu_init":
if (dpu->glb && dpu->glb->power)
dpu->glb->power(ctx, true);
if (dpu->glb && dpu->glb->enable)
dpu->glb->enable(ctx);
if (ctx->is_stopped && dpu->glb && dpu->glb->reset)
dpu->glb->reset(ctx);
if (dpu->clk && dpu->clk->init)
dpu->clk->init(ctx);
if (dpu->clk && dpu->clk->enable)
dpu->clk->enable(ctx);
if (dpu->core && dpu->core->init)
dpu->core->init(ctx);
if (dpu->core && dpu->core->ifconfig)
dpu->core->ifconfig(ctx);“dpu->core", "dpu->clk", "dpu->glb" checking maybe is not needed, i will remove it.
But, Eg: "dpu->glb->power" not always need for all h/w So in order to keep the same coding style, could i do like this:
if (dpu->glb->power)
dpu->glb->power(ctx, true);
if (dpu->glb->enable)
dpu->glb->enable(ctx);......
But here, "dpu->core->capability", your are right, this always evaluates to true So i will remove the error checking about always being true...
Quoted 139 lines
Quoted 24 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +23
-0+ dpu->core->capability(&dpu->ctx, &cap); + + dpu->layers = devm_kcalloc(drm->dev, cap.max_layers, + sizeof(struct sprd_dpu_layer), GFP_KERNEL); + if (!dpu->layers) + return ERR_PTR(-ENOMEM); + + for (i = 0; i < cap.max_layers; i++) { + + p = devm_kzalloc(drm->dev, sizeof(*p), GFP_KERNEL); + if (!p) + return ERR_PTR(-ENOMEM); + + err = drm_universal_plane_init(drm, &p->plane, 1, + &sprd_plane_funcs, cap.fmts_ptr, + cap.fmts_cnt, NULL, + DRM_PLANE_TYPE_PRIMARY, NULL); + if (err) { + DRM_ERROR("fail to init primary plane\n"); + return ERR_PTR(err); + } + + drm_plane_helper_add(&p->plane, &sprd_plane_helper_funcs);drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ + sprd_plane_create_properties(p, i); + + p->index = i; + if (i == 0) + primary = &p->plane; + } + + if (p) + DRM_INFO("dpu plane init ok\n");This and nearly all the other
DRM_INFO()messages look like a debug/development left over. Please remove them - the driver does not need to print when functions are successfull.Quoted 12 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +12
-0+ + return primary; +} + +static void sprd_crtc_mode_set_nofb(struct drm_crtc *crtc) +{ + struct sprd_dpu *dpu = crtc_to_dpu(crtc); + + if ((dpu->mode->hdisplay == dpu->mode->htotal) || + (dpu->mode->vdisplay == dpu->mode->vtotal)) + dpu->ctx.if_type = SPRD_DISPC_IF_EDPI; + elsedrivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ dpu->ctx.if_type = SPRD_DISPC_IF_DPI; +} + +static enum drm_mode_status sprd_crtc_mode_valid(struct drm_crtc *crtc, + const struct drm_display_mode *mode) +{ + struct sprd_dpu *dpu = crtc_to_dpu(crtc); + + DRM_INFO("%s() mode: "DRM_MODE_FMT"\n", __func__, DRM_MODE_ARG(mode)); +If needed, let's move this to core and make it a debug message. As-is it will cause spam for no reason.
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 5 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +5
-0+ if (mode->type & DRM_MODE_TYPE_DEFAULT) + dpu->mode = (struct drm_display_mode *)mode; + + if (mode->type & DRM_MODE_TYPE_PREFERRED) { + dpu->mode = (struct drm_display_mode *)mode;Casting away the constness is a bad idea.
Instead, let's move the
if_typedecision here, thus we can remove thensprd_crtc_mode_set_nofbfunction? This way we can also removesprd_dpu::mode.Quoted 1 line
+
drm_display_mode_to_videomode(dpu->mode, &dpu->ctx.vm);Similarly, one could derive the vm based attributes here and remove
dpu->ctx.vm.drivers/gpu/drm/sprd/dpu/Makefile
Quoted 12 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +12
-0+ } + + return MODE_OK; +} + +static void sprd_crtc_atomic_enable(struct drm_crtc *crtc, + struct drm_crtc_state *old_state) +{ + struct sprd_dpu *dpu = crtc_to_dpu(crtc); + + DRM_INFO("%s()\n", __func__); +More sprurious info messages - debug leftover?
drivers/gpu/drm/sprd/dpu/Makefile
Quoted 6 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +6
-0+static int sprd_crtc_enable_vblank(struct drm_crtc *crtc) +{ + struct sprd_dpu *dpu = crtc_to_dpu(crtc); + + DRM_DEBUG("%s()\n", __func__); +Personally, I don't see the appeal in these debug messages. While a few display controllers have the odd piece, they are an exception in DRM.
Quoted 11 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +11
-0+static int sprd_crtc_create_properties(struct drm_crtc *crtc) +{ + struct sprd_dpu *dpu = crtc_to_dpu(crtc); + struct drm_device *drm = dpu->crtc.dev; + struct drm_property *prop; + struct drm_property_blob *blob; + size_t blob_size; + + blob_size = strlen(dpu->ctx.version) + 1; + + blob = drm_property_create_blob(dpu->crtc.dev, blob_size,drivers/gpu/drm/sprd/dpu/Makefile
Quoted 10 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +10
-0+ dpu->ctx.version); + if (IS_ERR(blob)) { + DRM_ERROR("drm_property_create_blob dpu version failed\n"); + return PTR_ERR(blob); + } + + /* create dpu version property */ + prop = drm_property_create(drm, + DRM_MODE_PROP_IMMUTABLE | DRM_MODE_PROP_BLOB, + "dpu version", 0);Note: Custom properties should be separate patches. This includes documentation why they are needed and references to open-source userspace.
HTH
Emil
Re: [PATCH RFC v4 4/6] drm/sprd: add Unisoc's drm display controller driver
Hi Kevin
Quoted 21 lines
Quoted 8 lines
drivers/gpu/drm/sprd/dpu/Makefile line 4
Quoted 3 lines
drivers/gpu/drm/sprd/dpu/Makefile new file +3
-0+ +ifdef CONFIG_ARM64 +KBUILD_CFLAGS += -mstrict-alignThere are many other drivers that do not use readl/writel for register access, yet none has this workaround... Even those that they are exclusively ARM64.
Quoted 5 lines
Have you tried that it's not a buggy version of GCC? At the very least, I'd encourage you to add a brief comment about the problem + setup.
... In general I think one should follow the suggestions from Rob Herring.
Yocto v2.5
aarch64-linaro-linux-gcc (Linaro GCC 7.2-2017.11) 7.2.1 20171011Crash Stack:
/sprd/drv/dispc/dpu_r2p0.c:729
1796256ffffff8008486650:f803c043stur x3, [x2,#60]
=>Unhandled fault: alignment fault (0x96000061) at0xffffff80098b883c
Quoted 8 lines
729 reg->mmu_min_ppn1 = 0; 730 reg->mmu_ppn_range1 = 0xffff; 731 reg->mmu_min_ppn2 = 0; 732 reg->mmu_ppn_range2 = 0xffff;The above C code operation are continuous. The compiler may think that the access can be completed by directly using two 64-bit assignment operations, so it is optimized to 64-bit operation.
What you see is a side-effect of using a sturct for register access. When you ave your code change to use readl()/writel() and friends this is no logner a problem, and you can drop the cc flag.
Sam
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
RFC PATCH v4 5/6 dt-bindings: display: add Unisoc's mipi dsi&dphy bindings
In reply to Kevin TangFrom: Kevin Tang <[email protected]>
Adds MIPI DSI Master and MIPI DSI-PHY (D-PHY)
support for Unisoc's display subsystem.
--- .../devicetree/bindings/display/sprd/dphy.yaml | 75 +++++++++++++++++ .../devicetree/bindings/display/sprd/dsi.yaml | 98 ++++++++++++++++++++++ 2 files changed, 173 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/sprd/dphy.yaml create mode 100644 Documentation/devicetree/bindings/display/sprd/dsi.yaml
Documentation/devicetree/bindings/display/sprd/dphy.yaml new file +75 -0
@@ -0,0 +1,75 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/sprd/dphy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Unisoc MIPI DSI-PHY (D-PHY) + +maintainers: + - Mark Rutland <[email protected]> + +properties: + compatible: + const: sprd,sharkl3-dsi-phy + + reg: + maxItems: 1 + description: + Must be the dsi controller base address. + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + port@0: + type: object + description: + A port node with endpoint definitions as defined in + Documentation/devicetree/bindings/media/video-interfaces.txt. + That port should be the output endpoint, usually output to + the associated panel. + port@1: + type: object + description: + A port node with endpoint definitions as defined in + Documentation/devicetree/bindings/media/video-interfaces.txt. + That port should be the input endpoint, usually coming from + the associated DSI controller. + +required: + - compatible + - reg + - port@0 + - port@1 + - "#address-cells" + - "#size-cells" + +additionalProperties: false + +examples: + - | + dphy: dphy { + compatible = "sprd,sharkl3-dsi-phy"; + reg = <0x0 0x63100000 0x0 0x1000>; + #address-cells = <1>; + #size-cells = <0>; + + /* input port*/ + port@1 { + reg = <1>; + dphy_in: endpoint { + remote-endpoint = <&dsi_out>; + }; + }; + + /* output port */ + port@0 { + reg = <0>; + dphy_out: endpoint { + remote-endpoint = <&panel_in>; + }; + }; + };
Documentation/devicetree/bindings/display/sprd/dsi.yaml new file +98 -0
98 lines not on this page · raw message
Signature · 1 line
2.7.4
RFC PATCH v4 6/6 drm/sprd: add Unisoc's drm mipi dsi&dphy driver
In reply to Kevin TangAdds dsi host controller support for the Unisoc's display subsystem. Adds dsi phy support for the Unisoc's display subsystem. Only MIPI DSI Displays supported, DP/TV/HMDI will be support in the feature.
--- drivers/gpu/drm/sprd/Makefile | 7 +- drivers/gpu/drm/sprd/disp_lib.c | 59 + drivers/gpu/drm/sprd/disp_lib.h | 21 + drivers/gpu/drm/sprd/dphy/Makefile | 7 + drivers/gpu/drm/sprd/dphy/pll/Makefile | 3 + drivers/gpu/drm/sprd/dphy/pll/megacores_sharkle.c | 628 +++++++++ drivers/gpu/drm/sprd/dphy/sprd_dphy_api.c | 254 ++++ drivers/gpu/drm/sprd/dphy/sprd_dphy_hal.h | 329 +++++ drivers/gpu/drm/sprd/dsi/Makefile | 8 + drivers/gpu/drm/sprd/dsi/core/Makefile | 4 + drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c | 1169 +++++++++++++++++ drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.h | 1417 +++++++++++++++++++++ drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c | 375 ++++++ drivers/gpu/drm/sprd/dsi/sprd_dsi_api.c | 544 ++++++++ drivers/gpu/drm/sprd/dsi/sprd_dsi_api.h | 28 + drivers/gpu/drm/sprd/dsi/sprd_dsi_hal.h | 1102 ++++++++++++++++ drivers/gpu/drm/sprd/sprd_dphy.c | 224 ++++ drivers/gpu/drm/sprd/sprd_dphy.h | 99 ++ drivers/gpu/drm/sprd/sprd_dpu.c | 25 + drivers/gpu/drm/sprd/sprd_dpu.h | 3 + drivers/gpu/drm/sprd/sprd_drm.c | 2 + drivers/gpu/drm/sprd/sprd_drm.h | 2 + drivers/gpu/drm/sprd/sprd_dsi.c | 628 +++++++++ drivers/gpu/drm/sprd/sprd_dsi.h | 193 +++ 24 files changed, 7130 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/sprd/disp_lib.c create mode 100644 drivers/gpu/drm/sprd/disp_lib.h create mode 100644 drivers/gpu/drm/sprd/dphy/Makefile create mode 100644 drivers/gpu/drm/sprd/dphy/pll/Makefile create mode 100644 drivers/gpu/drm/sprd/dphy/pll/megacores_sharkle.c create mode 100644 drivers/gpu/drm/sprd/dphy/sprd_dphy_api.c create mode 100644 drivers/gpu/drm/sprd/dphy/sprd_dphy_hal.h create mode 100644 drivers/gpu/drm/sprd/dsi/Makefile create mode 100644 drivers/gpu/drm/sprd/dsi/core/Makefile create mode 100644 drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c create mode 100644 drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.h create mode 100644 drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c create mode 100644 drivers/gpu/drm/sprd/dsi/sprd_dsi_api.c create mode 100644 drivers/gpu/drm/sprd/dsi/sprd_dsi_api.h create mode 100644 drivers/gpu/drm/sprd/dsi/sprd_dsi_hal.h create mode 100644 drivers/gpu/drm/sprd/sprd_dphy.c create mode 100644 drivers/gpu/drm/sprd/sprd_dphy.h create mode 100644 drivers/gpu/drm/sprd/sprd_dsi.c create mode 100644 drivers/gpu/drm/sprd/sprd_dsi.h
drivers/gpu/drm/sprd/Makefile +6 -1
@@ -3,6 +3,11 @@ subdir-ccflags-y += -I$(srctree)/$(src) obj-y := sprd_drm.o \ - sprd_dpu.o + sprd_dpu.o \ + sprd_dsi.o \ + sprd_dphy.o +obj-y += disp_lib.o obj-y += dpu/ +obj-y += dsi/ +obj-y += dphy/
drivers/gpu/drm/sprd/disp_lib.c new file +59 -0
59 lines not on this page · raw message
drivers/gpu/drm/sprd/disp_lib.h new file +21 -0
@@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020 Unisoc Inc. +*/ + +#ifndef _DISP_LIB_H_ +#define _DISP_LIB_H_ + +#include <linux/list.h> +#include <drm/drm_print.h> + +#ifdef pr_fmt +#undef pr_fmt +#define pr_fmt (__fmt) "[drm][%20s] "__fmt, __func__ +#endif + +struct device *sprd_disp_pipe_get_by_port (struct device *dev,int port); +struct device *sprd_disp_pipe_get_input (struct device *dev); +struct device *sprd_disp_pipe_get_output (struct device *dev); + +#endif
drivers/gpu/drm/sprd/dphy/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 + +subdir-ccflags-y += -I$(srctree)/$(src) + +obj-y := sprd_dphy_api.o + +obj-y += pll/
drivers/gpu/drm/sprd/dphy/pll/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-y += megacores_sharkle.o
drivers/gpu/drm/sprd/dphy/pll/megacores_sharkle.c new file +628 -0
628 lines not on this page · raw message
drivers/gpu/drm/sprd/dphy/sprd_dphy_api.c new file +254 -0
254 lines not on this page · raw message
drivers/gpu/drm/sprd/dphy/sprd_dphy_hal.h new file +329 -0
329 lines not on this page · raw message
drivers/gpu/drm/sprd/dsi/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0 + +subdir-ccflags-y += -I$(srctree)/$(src) + +obj-y += sprd_dsi_api.o + +obj-y += core/ +
drivers/gpu/drm/sprd/dsi/core/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-y += dsi_ctrl_r1p0.o dsi_ctrl_r1p0_ppi.o +
drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c new file +1169 -0
1,169 lines not on this page · raw message
drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.h new file +1417 -0
506 lines not on this page · raw message
drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c new file +375 -0
375 lines not on this page · raw message
drivers/gpu/drm/sprd/dsi/sprd_dsi_api.c new file +544 -0
544 lines not on this page · raw message
drivers/gpu/drm/sprd/dsi/sprd_dsi_api.h new file +28 -0
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/sprd/dsi/sprd_dsi_hal.h new file +1102 -0
1,102 lines not on this page · raw message
drivers/gpu/drm/sprd/sprd_dphy.c new file +224 -0
224 lines not on this page · raw message
drivers/gpu/drm/sprd/sprd_dphy.h new file +99 -0
99 lines not on this page · raw message
drivers/gpu/drm/sprd/sprd_dsi.c new file +628 -0
628 lines not on this page · raw message
drivers/gpu/drm/sprd/sprd_dsi.h new file +193 -0
193 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.7.4
Part of the diff is not shown here. View the raw message.
kbuild test robot
build botRe: [PATCH RFC v4 6/6] drm/sprd: add Unisoc's drm mipi dsi&dphy driver
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please…
Hi Kevin,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on robh/for-next]
[also build test WARNING on linus/master v5.6-rc3]
[cannot apply to next-20200226]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Kevin-Tang/Add-Unisoc-s-drm-kms-module/20200226-202320 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next reproduce: # apt-get install sparse # sparse version: v0.6.1-173-ge0787745-dirty make ARCH=x86_64 allmodconfig make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag
sparse warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:22:30: sparse: sparse: incorrect type in argument 1 (different address spaces) >> drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:22:30: sparse: expected void const volatile [noderef] <asn:2> *addr >> drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:22:30: sparse: got union _0x00 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:42:25: sparse: sparse: incorrect type in argument 2 (different address spaces) >> drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:42:25: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:42:25: sparse: got union _0x04 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:53:20: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:53:20: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:53:20: sparse: got union _0x18 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:64:20: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:64:20: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:64:20: sparse: got union _0x18 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:71:23: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:71:23: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:71:23: sparse: got union _0x18 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:83:41: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:83:41: sparse: expected void const volatile [noderef] <asn:2> *addr >> drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:83:41: sparse: got union _0x1C * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:86:41: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:86:41: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:86:41: sparse: got union _0x1C * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:98:41: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:98:41: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:98:41: sparse: got union _0x1C * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:101:41: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:101:41: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:101:41: sparse: got union _0x1C * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:114:35: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:114:35: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:114:35: sparse: got union _0x38 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:117:35: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:117:35: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:117:35: sparse: got union _0x38 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:130:39: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:130:39: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:130:39: sparse: got union _0x20 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:133:39: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:133:39: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:133:39: sparse: got union _0x20 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:145:39: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:145:39: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:145:39: sparse: got union _0x20 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:148:39: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:148:39: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:148:39: sparse: got union _0x20 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:160:38: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:160:38: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:160:38: sparse: got union _0x2C * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:163:38: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:163:38: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:163:38: sparse: got union _0x2C * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:175:43: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:175:43: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:175:43: sparse: got union _0x28 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:178:43: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:178:43: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:178:43: sparse: got union _0x28 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:190:43: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:190:43: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:190:43: sparse: got union _0x28 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:193:43: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:193:43: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:193:43: sparse: got union _0x28 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:205:41: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:205:41: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:205:41: sparse: got union _0x34 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:208:41: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:208:41: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:208:41: sparse: got union _0x34 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:220:39: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:220:39: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:220:39: sparse: got union _0x30 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:223:39: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:223:39: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:223:39: sparse: got union _0x30 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:235:39: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:235:39: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:235:39: sparse: got union _0x30 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:238:39: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:238:39: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:238:39: sparse: got union _0x30 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:250:39: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:250:39: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:250:39: sparse: got union _0x30 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:253:39: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:253:39: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:253:39: sparse: got union _0x30 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:266:35: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:266:35: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:266:35: sparse: got union _0x38 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:271:35: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:271:35: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:271:35: sparse: got union _0x38 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:284:35: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:284:35: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:284:35: sparse: got union _0x38 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:291:35: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:291:35: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:291:35: sparse: got union _0x38 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:303:35: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:303:35: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:303:35: sparse: got union _0x38 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:306:35: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:306:35: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:306:35: sparse: got union _0x38 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:319:39: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:319:39: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:319:39: sparse: got union _0x24 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:322:39: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:322:39: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:322:39: sparse: got union _0x24 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:336:41: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:336:41: sparse: expected void const volatile [noderef] <asn:2> *addr >> drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:336:41: sparse: got union _0xC0 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:339:41: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:339:41: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:339:41: sparse: got union _0xC0 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:352:39: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:352:39: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:352:39: sparse: got union _0x24 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:355:39: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:355:39: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:355:39: sparse: got union _0x24 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:368:38: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:368:38: sparse: expected void const volatile [noderef] <asn:2> *addr >> drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:368:38: sparse: got union _0xC4 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:371:38: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:371:38: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:371:38: sparse: got union _0xC4 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:383:35: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:383:35: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:383:35: sparse: got union _0x68 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:386:35: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:386:35: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:386:35: sparse: got union _0x68 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:398:35: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:398:35: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:398:35: sparse: got union _0x68 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:401:35: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:401:35: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:401:35: sparse: got union _0x68 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:415:35: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:415:35: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:415:35: sparse: got union _0x68 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:431:35: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:431:35: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:431:35: sparse: got union _0x68 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:445:35: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:445:35: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:445:35: sparse: got union _0x38 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:448:35: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:448:35: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:448:35: sparse: got union _0x38 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:475:30: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:475:30: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:475:30: sparse: got union _0x6C * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:487:26: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:487:26: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:487:26: sparse: got union _0x70 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:499:23: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:499:23: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:499:23: sparse: got union _0x70 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:511:25: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:511:25: sparse: expected void volatile [noderef] <asn:2> *addr >> drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:511:25: sparse: got union _0xB8 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:523:30: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:523:30: sparse: expected void const volatile [noderef] <asn:2> *addr >> drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:523:30: sparse: got union _0xBC * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:526:30: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:526:30: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:526:30: sparse: got union _0xBC * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:538:30: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:538:30: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:538:30: sparse: got union _0xBC * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:541:30: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:541:30: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:541:30: sparse: got union _0xBC * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:553:42: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:553:42: sparse: expected void const volatile [noderef] <asn:2> *addr >> drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:553:42: sparse: got union _0xB4 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:556:42: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:556:42: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:556:42: sparse: got union _0xB4 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:568:42: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:568:42: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:568:42: sparse: got union _0xB4 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:571:42: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:571:42: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:571:42: sparse: got union _0xB4 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:585:38: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:585:38: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:585:38: sparse: got union _0x98 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:599:38: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:599:38: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:599:38: sparse: got union _0x98 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:613:38: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:613:38: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:613:38: sparse: got union _0x98 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:627:38: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:627:38: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:627:38: sparse: got union _0x98 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:641:38: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:641:38: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:641:38: sparse: got union _0x98 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:655:38: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:655:38: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:655:38: sparse: got union _0x98 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:669:38: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:669:38: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:669:38: sparse: got union _0x98 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:686:45: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:686:45: sparse: expected void const volatile [noderef] <asn:2> *addr >> drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:686:45: sparse: got union _0xD0 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:689:45: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:689:45: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:689:45: sparse: got union _0xD0 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:703:47: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:703:47: sparse: expected void const volatile [noderef] <asn:2> *addr >> drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:703:47: sparse: got union _0xAC * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:706:47: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:706:47: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:706:47: sparse: got union _0xAC * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:720:47: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:720:47: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:720:47: sparse: got union _0xAC * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:723:47: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:723:47: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:723:47: sparse: got union _0xAC * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:737:46: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:737:46: sparse: expected void const volatile [noderef] <asn:2> *addr >> drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:737:46: sparse: got union _0xA8 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:740:46: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:740:46: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:740:46: sparse: got union _0xA8 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:754:46: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:754:46: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:754:46: sparse: got union _0xA8 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:757:46: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:757:46: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:757:46: sparse: got union _0xA8 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:770:29: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:770:29: sparse: expected void volatile [noderef] <asn:2> *addr >> drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:770:29: sparse: got union _0xB0 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:784:43: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:784:43: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:784:43: sparse: got union _0x74 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:787:43: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:787:43: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:787:43: sparse: got union _0x74 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:800:22: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:800:22: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:800:22: sparse: got union _0x5C * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:813:22: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:813:22: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:813:22: sparse: got union _0x40 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:824:29: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:824:29: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:824:29: sparse: got union _0x48 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:835:29: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:835:29: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:835:29: sparse: got union _0x44 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:848:29: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:848:29: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:848:29: sparse: got union _0x58 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:862:29: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:862:29: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:862:29: sparse: got union _0x54 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:877:41: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:877:41: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:877:41: sparse: got union _0x4C * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:880:41: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:880:41: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:880:41: sparse: got union _0x4C * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:895:43: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:895:43: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:895:43: sparse: got union _0x50 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:898:43: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:898:43: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:898:43: sparse: got union _0x50 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:912:41: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:912:41: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:912:41: sparse: got union _0x4C * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:915:41: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:915:41: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:915:41: sparse: got union _0x4C * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:928:39: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:928:39: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:928:39: sparse: got union _0x08 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:929:39: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:929:39: sparse: expected void volatile [noderef] <asn:2> *addr >> drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:929:39: sparse: got union _0xC8 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:1008:39: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:1008:39: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:1008:39: sparse: got union _0x10 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:1009:39: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:1009:39: sparse: expected void volatile [noderef] <asn:2> *addr >> drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:1009:39: sparse: got union _0xCC * >> drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c:1064:20: sparse: sparse: too many warnings -- >> drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:24:41: sparse: sparse: incorrect type in argument 1 (different address spaces) >> drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:24:41: sparse: expected void const volatile [noderef] <asn:2> *addr >> drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:24:41: sparse: got union _0x78 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:27:41: sparse: sparse: incorrect type in argument 2 (different address spaces) >> drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:27:41: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:27:41: sparse: got union _0x78 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:41:41: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:41:41: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:41:41: sparse: got union _0x78 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:44:41: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:44:41: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:44:41: sparse: got union _0x78 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:59:41: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:59:41: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:59:41: sparse: got union _0x78 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:62:41: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:62:41: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:62:41: sparse: got union _0x78 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:70:41: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:70:41: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:70:41: sparse: got union _0x78 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:73:41: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:73:41: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:73:41: sparse: got union _0x78 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:81:41: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:81:41: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:81:41: sparse: got union _0x78 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:84:41: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:84:41: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:84:41: sparse: got union _0x78 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:92:41: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:92:41: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:92:41: sparse: got union _0x78 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:95:41: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:95:41: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:95:41: sparse: got union _0x78 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:103:41: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:103:41: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:103:41: sparse: got union _0x78 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:106:41: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:106:41: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:106:41: sparse: got union _0x78 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:119:29: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:119:29: sparse: expected void volatile [noderef] <asn:2> *addr >> drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:119:29: sparse: got union _0xA0 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:132:33: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:132:33: sparse: expected void volatile [noderef] <asn:2> *addr >> drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:132:33: sparse: got union _0xA4 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:146:41: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:146:41: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:146:41: sparse: got union _0x78 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:149:41: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:149:41: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:149:41: sparse: got union _0x78 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:167:43: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:167:43: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:167:43: sparse: got union _0x74 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:171:43: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:171:43: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:171:43: sparse: got union _0x74 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:186:33: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:186:33: sparse: expected void const volatile [noderef] <asn:2> *addr >> drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:186:33: sparse: got union _0x9C * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:196:33: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:196:33: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:196:33: sparse: got union _0x9C * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:206:33: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:206:33: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:206:33: sparse: got union _0x9C * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:217:33: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:217:33: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:217:33: sparse: got union _0x9C * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:236:33: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:236:33: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:236:33: sparse: got union _0x9C * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:247:33: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:247:33: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:247:33: sparse: got union _0x9C * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:266:33: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:266:33: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:266:33: sparse: got union _0x9C * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:281:36: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:281:36: sparse: expected void const volatile [noderef] <asn:2> *addr >> drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:281:36: sparse: got union _0xF0 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:284:36: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:284:36: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:284:36: sparse: got union _0xF0 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:297:36: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:297:36: sparse: expected void const volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:297:36: sparse: got union _0xF0 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:300:36: sparse: sparse: incorrect type in argument 2 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:300:36: sparse: expected void volatile [noderef] <asn:2> *addr drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:300:36: sparse: got union _0xF0 * drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:313:36: sparse: sparse: incorrect type in argument 1 (different address spaces) drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:313:36: sparse: expected void const volatile [noderef] <asn:2> *addr >> drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:313:36: sparse: got union _0xF4 *
drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:316:36: sparse: sparse: incorrect type in argument 2 (different address spaces)
drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:316:36: sparse: expected void volatile [noderef] <asn:2> *addr
drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:316:36: sparse: got union _0xF4 *
drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:328:36: sparse: sparse: incorrect type in argument 1 (different address spaces)
drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:328:36: sparse: expected void const volatile [noderef] <asn:2> *addr
drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:328:36: sparse: got union _0xF4 *
drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:343:36: sparse: sparse: incorrect type in argument 1 (different address spaces)
drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:343:36: sparse: expected void const volatile [noderef] <asn:2> *addr
drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:343:36: sparse: got union _0xF4 *
drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:346:36: sparse: sparse: incorrect type in argument 2 (different address spaces)
drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:346:36: sparse: expected void volatile [noderef] <asn:2> *addr
drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0_ppi.c:346:36: sparse: got union _0xF4 *
vim +22 drivers/gpu/drm/sprd/dsi/core/dsi_ctrl_r1p0.c
13
14 /*
15 * Get DSI Host core version
16 * @param instance pointer to structure holding the DSI Host core information
17 * @return ascii number of the version
18 */
19 static bool dsi_check_version(struct dsi_context *ctx)
20 {
21 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
> 22 u32 version = readl(®->DSI_VERSION);
23
24 if (version == 0x100)
25 return true;
26 else if (version == 0x200)
27 return true;
28 else if (version == 0x300)
29 return true;
30 else
31 return false;
32 }
33 /*
34 * Modify power status of DSI Host core
35 * @param instance pointer to structure holding the DSI Host core information
36 * @param on (1) or off (0)
37 */
38 static void dsi_power_enable(struct dsi_context *ctx, int enable)
39 {
40 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
41
> 42 writel(enable, ®->SOFT_RESET);
43 }
44 /*
45 * Enable/disable DPI video mode
46 * @param instance pointer to structure holding the DSI Host core information
47 * @param enable (1) - disable (0)
48 */
49 static void dsi_video_mode(struct dsi_context *ctx)
50 {
51 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
52
> 53 writel(0, ®->DSI_MODE_CFG);
54 }
55 /*
56 * Enable command mode (Generic interface)
57 * @param instance pointer to structure holding the DSI Host core information
58 * @param enable
59 */
60 static void dsi_cmd_mode(struct dsi_context *ctx)
61 {
62 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
63
64 writel(1, ®->DSI_MODE_CFG);
65 }
66
67 static bool dsi_is_cmd_mode(struct dsi_context *ctx)
68 {
69 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
70
71 return readl(®->DSI_MODE_CFG);
72 }
73 /*
74 * Configure the read back virtual channel for the generic interface
75 * @param instance pointer to structure holding the DSI Host core information
76 * @param vc to listen to on the line
77 */
78 static void dsi_rx_vcid(struct dsi_context *ctx, u8 vc)
79 {
80 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
81 union _0x1C virtual_channel_id;
82
> 83 virtual_channel_id.val = readl(®->VIRTUAL_CHANNEL_ID);
84 virtual_channel_id.bits.gen_rx_vcid = vc;
85
86 writel(virtual_channel_id.val, ®->VIRTUAL_CHANNEL_ID);
87 }
88 /*
89 * Write the DPI video virtual channel destination
90 * @param instance pointer to structure holding the DSI Host core information
91 * @param vc virtual channel
92 */
93 static void dsi_video_vcid(struct dsi_context *ctx, u8 vc)
94 {
95 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
96 union _0x1C virtual_channel_id;
97
98 virtual_channel_id.val = readl(®->VIRTUAL_CHANNEL_ID);
99 virtual_channel_id.bits.video_pkt_vcid = vc; 100
101 writel(virtual_channel_id.val, ®->VIRTUAL_CHANNEL_ID);
102 }
103 /*
104 * Set DPI video mode type (burst/non-burst - with sync pulses or events)
105 * @param instance pointer to structure holding the DSI Host core information
106 * @param type
107 * @return error code
108 */
109 static void dsi_dpi_video_burst_mode(struct dsi_context *ctx, int mode)
110 {
111 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
112 union _0x38 vid_mode_cfg;
113
114 vid_mode_cfg.val = readl(®->VID_MODE_CFG);
115 vid_mode_cfg.bits.vid_mode_type = mode;
116
117 writel(vid_mode_cfg.val, ®->VID_MODE_CFG);
118 }
119 /*
120 * Set DPI video color coding
121 * @param instance pointer to structure holding the DSI Host core information
122 * @param color_coding enum (configuration and color depth)
123 * @return error code
124 */
125 static void dsi_dpi_color_coding(struct dsi_context *ctx, int coding)
126 {
127 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
128 union _0x20 dpi_video_format;
129
130 dpi_video_format.val = readl(®->DPI_VIDEO_FORMAT);
131 dpi_video_format.bits.dpi_video_mode_format = coding;
132
133 writel(dpi_video_format.val, ®->DPI_VIDEO_FORMAT);
134 }
135 /*
136 * Set DPI loosely packetisation video (used only when color depth = 18
137 * @param instance pointer to structure holding the DSI Host core information
138 * @param enable
139 */
140 static void dsi_dpi_18_loosely_packet_en(struct dsi_context *ctx, int enable)
141 {
142 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
143 union _0x20 dpi_video_format;
144
145 dpi_video_format.val = readl(®->DPI_VIDEO_FORMAT);
146 dpi_video_format.bits.loosely18_en = enable;
147
148 writel(dpi_video_format.val, ®->DPI_VIDEO_FORMAT);
149 }
150 /*
151 * Configure the Horizontal Line time
152 * @param instance pointer to structure holding the DSI Host core information
153 * @param byte_cycle taken to transmit the total of the horizontal line
154 */
155 static void dsi_dpi_hline_time(struct dsi_context *ctx, u16 byte_cycle)
156 {
157 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
158 union _0x2C video_line_time;
159
160 video_line_time.val = readl(®->VIDEO_LINE_TIME);
161 video_line_time.bits.video_line_time = byte_cycle;
162
163 writel(video_line_time.val, ®->VIDEO_LINE_TIME);
164 }
165 /*
166 * Configure the Horizontal back porch time
167 * @param instance pointer to structure holding the DSI Host core information
168 * @param byte_cycle taken to transmit the horizontal back porch
169 */
170 static void dsi_dpi_hbp_time(struct dsi_context *ctx, u16 byte_cycle)
171 {
172 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
173 union _0x28 video_line_hblk_time;
174
175 video_line_hblk_time.val = readl(®->VIDEO_LINE_HBLK_TIME);
176 video_line_hblk_time.bits.video_line_hbp_time = byte_cycle;
177
178 writel(video_line_hblk_time.val, ®->VIDEO_LINE_HBLK_TIME);
179 }
180 /*
181 * Configure the Horizontal sync time
182 * @param instance pointer to structure holding the DSI Host core information
183 * @param byte_cycle taken to transmit the horizontal sync
184 */
185 static void dsi_dpi_hsync_time(struct dsi_context *ctx, u16 byte_cycle)
186 {
187 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
188 union _0x28 video_line_hblk_time;
189
190 video_line_hblk_time.val = readl(®->VIDEO_LINE_HBLK_TIME);
191 video_line_hblk_time.bits.video_line_hsa_time = byte_cycle;
192
193 writel(video_line_hblk_time.val, ®->VIDEO_LINE_HBLK_TIME);
194 }
195 /*
196 * Configure the vertical active lines of the video stream
197 * @param instance pointer to structure holding the DSI Host core information
198 * @param lines
199 */
200 static void dsi_dpi_vact(struct dsi_context *ctx, u16 lines)
201 {
202 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
203 union _0x34 video_active_lines;
204
205 video_active_lines.val = readl(®->VIDEO_VACTIVE_LINES);
206 video_active_lines.bits.vactive_lines = lines;
207
208 writel(video_active_lines.val, ®->VIDEO_VACTIVE_LINES);
209 }
210 /*
211 * Configure the vertical front porch lines of the video stream
212 * @param instance pointer to structure holding the DSI Host core information
213 * @param lines
214 */
215 static void dsi_dpi_vfp(struct dsi_context *ctx, u16 lines)
216 {
217 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
218 union _0x30 video_vblk_lines;
219
220 video_vblk_lines.val = readl(®->VIDEO_VBLK_LINES);
221 video_vblk_lines.bits.vfp_lines = lines;
222
223 writel(video_vblk_lines.val, ®->VIDEO_VBLK_LINES);
224 }
225 /*
226 * Configure the vertical back porch lines of the video stream
227 * @param instance pointer to structure holding the DSI Host core information
228 * @param lines
229 */
230 static void dsi_dpi_vbp(struct dsi_context *ctx, u16 lines)
231 {
232 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
233 union _0x30 video_vblk_lines;
234
235 video_vblk_lines.val = readl(®->VIDEO_VBLK_LINES);
236 video_vblk_lines.bits.vbp_lines = lines;
237
238 writel(video_vblk_lines.val, ®->VIDEO_VBLK_LINES);
239 }
240 /*
241 * Configure the vertical sync lines of the video stream
242 * @param instance pointer to structure holding the DSI Host core information
243 * @param lines
244 */
245 static void dsi_dpi_vsync(struct dsi_context *ctx, u16 lines)
246 {
247 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
248 union _0x30 video_vblk_lines;
249
250 video_vblk_lines.val = readl(®->VIDEO_VBLK_LINES);
251 video_vblk_lines.bits.vsa_lines = lines;
252
253 writel(video_vblk_lines.val, ®->VIDEO_VBLK_LINES);
254 }
255 /*
256 * Enable return to low power mode inside horizontal front porch periods when
257 * timing allows
258 * @param instance pointer to structure holding the DSI Host core information
259 * @param enable (1) - disable (0)
260 */
261 static void dsi_dpi_hporch_lp_en(struct dsi_context *ctx, int enable)
262 {
263 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
264 union _0x38 vid_mode_cfg;
265
266 vid_mode_cfg.val = readl(®->VID_MODE_CFG);
267
268 vid_mode_cfg.bits.lp_hfp_en = enable;
269 vid_mode_cfg.bits.lp_hbp_en = enable;
270
271 writel(vid_mode_cfg.val, ®->VID_MODE_CFG);
272 }
273 /*
274 * Enable return to low power mode inside vertical active lines periods when
275 * timing allows
276 * @param instance pointer to structure holding the DSI Host core information
277 * @param enable (1) - disable (0)
278 */
279 static void dsi_dpi_vporch_lp_en(struct dsi_context *ctx, int enable)
280 {
281 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
282 union _0x38 vid_mode_cfg;
283
284 vid_mode_cfg.val = readl(®->VID_MODE_CFG);
285
286 vid_mode_cfg.bits.lp_vact_en = enable;
287 vid_mode_cfg.bits.lp_vfp_en = enable;
288 vid_mode_cfg.bits.lp_vbp_en = enable;
289 vid_mode_cfg.bits.lp_vsa_en = enable;
290
291 writel(vid_mode_cfg.val, ®->VID_MODE_CFG);
292 }
293 /*
294 * Enable FRAME BTA ACK
295 * @param instance pointer to structure holding the DSI Host core information
296 * @param enable (1) - disable (0)
297 */
298 static void dsi_dpi_frame_ack_en(struct dsi_context *ctx, int enable)
299 {
300 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
301 union _0x38 vid_mode_cfg;
302
303 vid_mode_cfg.val = readl(®->VID_MODE_CFG);
304 vid_mode_cfg.bits.frame_bta_ack_en = enable;
305
306 writel(vid_mode_cfg.val, ®->VID_MODE_CFG);
307 }
308 /*
309 * Write no of chunks to core - taken into consideration only when multi packet
310 * is enabled
311 * @param instance pointer to structure holding the DSI Host core information
312 * @param no of chunks
313 */
314 static void dsi_dpi_chunk_num(struct dsi_context *ctx, u16 num)
315 {
316 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
317 union _0x24 video_pkt_config;
318
319 video_pkt_config.val = readl(®->VIDEO_PKT_CONFIG);
320 video_pkt_config.bits.video_line_chunk_num = num;
321
322 writel(video_pkt_config.val, ®->VIDEO_PKT_CONFIG);
323 }
324 /*
325 * Write the null packet size - will only be taken into account when null
326 * packets are enabled.
327 * @param instance pointer to structure holding the DSI Host core information
328 * @param size of null packet
329 * @return error code
330 */
331 static void dsi_dpi_null_packet_size(struct dsi_context *ctx, u16 size)
332 {
333 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
334 union _0xC0 video_nullpkt_size;
335
336 video_nullpkt_size.val = readl(®->VIDEO_NULLPKT_SIZE);
337 video_nullpkt_size.bits.video_nullpkt_size = size;
338
339 writel(video_nullpkt_size.val, ®->VIDEO_NULLPKT_SIZE);
340 }
341 /*
342 * Write video packet size. obligatory for sending video
343 * @param instance pointer to structure holding the DSI Host core information
344 * @param size of video packet - containing information
345 * @return error code
346 */
347 static void dsi_dpi_video_packet_size(struct dsi_context *ctx, u16 size)
348 {
349 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
350 union _0x24 video_pkt_config;
351
352 video_pkt_config.val = readl(®->VIDEO_PKT_CONFIG);
353 video_pkt_config.bits.video_pkt_size = size;
354
355 writel(video_pkt_config.val, ®->VIDEO_PKT_CONFIG);
356 }
357 /*
358 * Specifiy the size of the packet memory write start/continue
359 * @param instance pointer to structure holding the DSI Host core information
360 * @ size of the packet
361 * @note when different than zero (0) eDPI is enabled
362 */
363 static void dsi_edpi_max_pkt_size(struct dsi_context *ctx, u16 size)
364 {
365 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
366 union _0xC4 dcs_wm_pkt_size;
367
368 dcs_wm_pkt_size.val = readl(®->DCS_WM_PKT_SIZE);
369 dcs_wm_pkt_size.bits.dcs_wm_pkt_size = size;
370
371 writel(dcs_wm_pkt_size.val, ®->DCS_WM_PKT_SIZE);
372 }
373 /*
374 * Enable tear effect acknowledge
375 * @param instance pointer to structure holding the DSI Host core information
376 * @param enable (1) - disable (0)
377 */
378 static void dsi_tear_effect_ack_en(struct dsi_context *ctx, int enable)
379 {
380 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
381 union _0x68 cmd_mode_cfg;
382
383 cmd_mode_cfg.val = readl(®->CMD_MODE_CFG);
384 cmd_mode_cfg.bits.tear_fx_en = enable;
385
386 writel(cmd_mode_cfg.val, ®->CMD_MODE_CFG);
387 }
388 /*
389 * Enable packets acknowledge request after each packet transmission
390 * @param instance pointer to structure holding the DSI Host core information
391 * @param enable (1) - disable (0)
392 */
393 static void dsi_cmd_ack_request_en(struct dsi_context *ctx, int enable)
394 {
395 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
396 union _0x68 cmd_mode_cfg;
397
398 cmd_mode_cfg.val = readl(®->CMD_MODE_CFG);
399 cmd_mode_cfg.bits.ack_rqst_en = enable;
400
401 writel(cmd_mode_cfg.val, ®->CMD_MODE_CFG);
402 }
403 /*
404 * Set DCS command packet transmission to transmission type
405 * @param instance pointer to structure holding the DSI Host core information
406 * @param no_of_param of command
407 * @param lp transmit in low power
408 * @return error code
409 */
410 static void dsi_cmd_mode_lp_cmd_en(struct dsi_context *ctx, int enable)
411 {
412 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
413 union _0x68 cmd_mode_cfg;
414
415 cmd_mode_cfg.val = readl(®->CMD_MODE_CFG);
416
417 cmd_mode_cfg.bits.gen_sw_0p_tx = enable;
418 cmd_mode_cfg.bits.gen_sw_1p_tx = enable;
419 cmd_mode_cfg.bits.gen_sw_2p_tx = enable;
420 cmd_mode_cfg.bits.gen_lw_tx = enable;
421 cmd_mode_cfg.bits.dcs_sw_0p_tx = enable;
422 cmd_mode_cfg.bits.dcs_sw_1p_tx = enable;
423 cmd_mode_cfg.bits.dcs_lw_tx = enable;
424 cmd_mode_cfg.bits.max_rd_pkt_size = enable;
425
426 cmd_mode_cfg.bits.gen_sr_0p_tx = enable;
427 cmd_mode_cfg.bits.gen_sr_1p_tx = enable;
428 cmd_mode_cfg.bits.gen_sr_2p_tx = enable;
429 cmd_mode_cfg.bits.dcs_sr_0p_tx = enable;
430
431 writel(cmd_mode_cfg.val, ®->CMD_MODE_CFG);
432 }
433 /*
434 * Set DCS read command packet transmission to transmission type
435 * @param instance pointer to structure holding the DSI Host core information
436 * @param no_of_param of command
437 * @param lp transmit in low power
438 * @return error code
439 */
440 static void dsi_video_mode_lp_cmd_en(struct dsi_context *ctx, int enable)
441 {
442 struct dsi_reg *reg = (struct dsi_reg *)ctx->base;
443 union _0x38 vid_mode_cfg;
444
445 vid_mode_cfg.val = readl(®->VID_MODE_CFG);
446 vid_mode_cfg.bits.lp_cmd_en = enable;
447
448 writel(vid_mode_cfg.val, ®->VID_MODE_CFG);
449 }
450
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org