drm/tidss: New driver for TI Keystone platform Display SubSystem
Subsystems (5)
cover drm/tidss: New driver for TI Keystone platform Display SubSystem
There was couple of attempts upstream an earlier version of this driver about a year ago [1]. Back then I needed to stop my efforts to implement support for next Keystone DSS version, so now the driver supports three different Keystone DSS version on three different SoCs.
I am starting the patch series versioning from the beginning since it has been over a year since the previous patch set and the structure of the driver has evolved quite a bit. However, all the earlier comments should be addressed in this series.
[1] https://patchwork.freedesktop.org/series/44947/
Jyri Sarha (5):
dt-bindings: display: ti,k2g-dss: Add dt-schema yaml binding
dt-bindings: display: ti,am65x-dss: Add dt-schema yaml binding
dt-bindings: display: ti,j721e-dss: Add dt-schema yaml binding drm/tidss: New driver for TI Keystone platform Display SubSystem
MAINTAINERS: add entry for tidss
.../bindings/display/ti/ti,am65x-dss.yaml | 133 + .../bindings/display/ti/ti,j721e-dss.yaml | 177 ++ .../bindings/display/ti/ti,k2g-dss.yaml | 97 + MAINTAINERS | 10 + drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/tidss/Kconfig | 15 + drivers/gpu/drm/tidss/Makefile | 12 + drivers/gpu/drm/tidss/tidss_crtc.c | 373 +++ drivers/gpu/drm/tidss/tidss_crtc.h | 45 + drivers/gpu/drm/tidss/tidss_dispc.c | 2645 +++++++++++++++++ drivers/gpu/drm/tidss/tidss_dispc.h | 132 + drivers/gpu/drm/tidss/tidss_dispc_regs.h | 243 ++ drivers/gpu/drm/tidss/tidss_drv.c | 292 ++ drivers/gpu/drm/tidss/tidss_drv.h | 42 + drivers/gpu/drm/tidss/tidss_encoder.c | 89 + drivers/gpu/drm/tidss/tidss_encoder.h | 17 + drivers/gpu/drm/tidss/tidss_irq.c | 185 ++ drivers/gpu/drm/tidss/tidss_irq.h | 71 + drivers/gpu/drm/tidss/tidss_kms.c | 239 ++ drivers/gpu/drm/tidss/tidss_kms.h | 15 + drivers/gpu/drm/tidss/tidss_plane.c | 218 ++ drivers/gpu/drm/tidss/tidss_plane.h | 25 + drivers/gpu/drm/tidss/tidss_scale_coefs.c | 201 ++ drivers/gpu/drm/tidss/tidss_scale_coefs.h | 22 + 25 files changed, 5301 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml create mode 100644 Documentation/devicetree/bindings/display/ti/ti,j721e-dss.yaml create mode 100644 Documentation/devicetree/bindings/display/ti/ti,k2g-dss.yaml create mode 100644 drivers/gpu/drm/tidss/Kconfig create mode 100644 drivers/gpu/drm/tidss/Makefile create mode 100644 drivers/gpu/drm/tidss/tidss_crtc.c create mode 100644 drivers/gpu/drm/tidss/tidss_crtc.h create mode 100644 drivers/gpu/drm/tidss/tidss_dispc.c create mode 100644 drivers/gpu/drm/tidss/tidss_dispc.h create mode 100644 drivers/gpu/drm/tidss/tidss_dispc_regs.h create mode 100644 drivers/gpu/drm/tidss/tidss_drv.c create mode 100644 drivers/gpu/drm/tidss/tidss_drv.h create mode 100644 drivers/gpu/drm/tidss/tidss_encoder.c create mode 100644 drivers/gpu/drm/tidss/tidss_encoder.h create mode 100644 drivers/gpu/drm/tidss/tidss_irq.c create mode 100644 drivers/gpu/drm/tidss/tidss_irq.h create mode 100644 drivers/gpu/drm/tidss/tidss_kms.c create mode 100644 drivers/gpu/drm/tidss/tidss_kms.h create mode 100644 drivers/gpu/drm/tidss/tidss_plane.c create mode 100644 drivers/gpu/drm/tidss/tidss_plane.h create mode 100644 drivers/gpu/drm/tidss/tidss_scale_coefs.c create mode 100644 drivers/gpu/drm/tidss/tidss_scale_coefs.h
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/5 dt-bindings: display: ti, k2g-dss: Add dt-schema yaml binding
Add dt-schema yaml bindig for K2G DSS, an ultra-light version of TI Keystone Display SubSystem.
--- .../bindings/display/ti/ti,k2g-dss.yaml | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/ti/ti,k2g-dss.yaml
Documentation/devicetree/bindings/display/ti/ti,k2g-dss.yaml new file +97 -0
@@ -0,0 +1,97 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +# Copyright 2019 Texas Instruments Incorporated +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/display/ti/ti,k2g-dss.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Texas Instruments K2G Display Subsystem + +maintainers: + - Jyri Sarha <[email protected]> + - Tomi Valkeinen <[email protected]> + +description: | + The K2G DSS is an ultra-light version of TI Keystone Display + SubSystem. It has only one output port and video plane. The + output is DPI. + +properties: + compatible: + const: ti,k2g-dss + + reg: + maxItems: 5 + minItems: 5 + + reg-names: + items: + - const: cfg + - const: common + - const: vid1 + - const: ovr1 + - const: vp1 + + clocks: + maxItems: 2 + minItems: 2 + + clock-names: + items: + - const: fck + - const: vp1 + + interrupts: + maxItems: 1 + + power-domains: + maxItems: 1 + description: phandle to the associated power domain + + port@0: + type: object + description: + The DSS DPI output port node + + max-memory-bandwidth: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + Input memory (from main memory to dispc) bandwidth limit in + bytes per second + +required: + - compatible + - reg + - reg-names + - clocks + - clock-names + - interrupts + - port@0 + +additionalProperties: false + +examples: + - | + dss: dss@02540000 { + compatible = "ti,k2g-dss"; + reg = <0x02540000 0x400>, + <0x02550000 0x1000>, + <0x02557000 0x1000>, + <0x0255a800 0x100>, + <0x0255ac00 0x100>; + reg-names = "cfg", "common", "vid1", "ovr1", "vp1"; + clocks = <&k2g_clks 0x2 0>, + <&k2g_clks 0x2 1>; + clock-names = "fck", "vp1"; + interrupts = <GIC_SPI 247 IRQ_TYPE_EDGE_RISING>; + + power-domains = <&k2g_pds 0x2>; + status = "disabled"; + + max-memory-bandwidth = <230000000>; + port { + dpi_out: endpoint { + remote-endpoint = <&sii9022_in>; + }; + }; + };
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/5 dt-bindings: display: ti, am65x-dss: Add dt-schema yaml binding
In reply to Jyri SarhaAdd dt-schema yaml bindig for AM65x DSS, AM65x version TI Keystone Display SubSystem.
--- .../bindings/display/ti/ti,am65x-dss.yaml | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml new file +133 -0
@@ -0,0 +1,133 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +# Copyright 2019 Texas Instruments Incorporated +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/display/ti/ti,am65x-dss.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Texas Instruments AM65x Display Subsystem + +maintainers: + - Jyri Sarha <[email protected]> + - Tomi Valkeinen <[email protected]> + +description: | + The AM65x TI Keystone Display SubSystem with two output ports and + two video planes. The first video port supports OLDI and the second + supports DPI format. The fist plane is full video plane with all + features and the second is a "lite plane" without scaling support. + +properties: + compatible: + const: ti,am65x-dss + + reg: + maxItems: 7 + minItems: 7 + + reg-names: + items: + - const: common + - const: vidl1 + - const: vid + - const: ovr1 + - const: ovr2 + - const: vp1 + - const: vp2 + + clocks: + maxItems: 3 + minItems: 3 + + clock-names: + items: + - const: fck + - const: vp1 + - const: vp2 + + interrupts: + maxItems: 1 + + power-domains: + maxItems: 1 + description: phandle to the associated power domain + + port@0: + type: object + description: + The DSS OLDI output port node form video port 1 + + port@1: + type: object + description: + The DSS DPI output port node from video port 2 + + ti,am65x-oldi-io-ctrl: + maxItems: 1 + description: + $ref: "/schemas/types.yaml#/definitions/phandle-array" + phandle to syscon device node mapping OLDI IO_CTRL registers. + The mapped range should point to OLDI_DAT0_IO_CTRL, map it and + following OLDI_DAT1_IO_CTRL, OLDI_DAT2_IO_CTRL, OLDI_DAT3_IO_CTRL, + and OLDI_CLK_IO_CTRL registers. This property is needed for OLDI + interface to work. + + max-memory-bandwidth: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + Input memory (from main memory to dispc) bandwidth limit in + bytes per second + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + +required: + - compatible + - reg + - reg-names + - clocks + - clock-names + - interrupts + - "#address-cells" + - "#size-cells" + +additionalProperties: false + +examples: + - | + dss: dss@04a00000 { + compatible = "ti,am65x-dss"; + reg = <0x0 0x04a00000 0x0 0x1000>, /* common */ + <0x0 0x04a02000 0x0 0x1000>, /* vidl1 */ + <0x0 0x04a06000 0x0 0x1000>, /* vid */ + <0x0 0x04a07000 0x0 0x1000>, /* ovr1 */ + <0x0 0x04a08000 0x0 0x1000>, /* ovr2 */ + <0x0 0x04a0a000 0x0 0x1000>, /* vp1 */ + <0x0 0x04a0b000 0x0 0x1000>; /* vp2 */ + reg-names = "common", "vidl1", "vid", + "ovr1", "ovr2", "vp1", "vp2"; + + ti,am65x-oldi-io-ctrl = <&dss_oldi_io_ctrl>; + + power-domains = <&k3_pds 67 TI_SCI_PD_EXCLUSIVE>; + + clocks = <&k3_clks 67 1>, + <&k3_clks 216 1>, + <&k3_clks 67 2>; + clock-names = "fck", "vp1", "vp2"; + + interrupts = <GIC_SPI 166 IRQ_TYPE_EDGE_RISING>; + + status = "disabled"; + + port@0 { + reg = <0>; + + oldi_out0: endpoint { + remote-endpoint = <&lcd_in0>; + }; + }; + };
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/5 dt-bindings: display: ti, j721e-dss: Add dt-schema yaml binding
In reply to Jyri SarhaAdd dt-schema yaml bindig for J721E DSS, J721E version TI Keystone Display SubSystem.
--- .../bindings/display/ti/ti,j721e-dss.yaml | 177 ++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/ti/ti,j721e-dss.yaml
Documentation/devicetree/bindings/display/ti/ti,j721e-dss.yaml new file +177 -0
@@ -0,0 +1,177 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +# Copyright 2019 Texas Instruments Incorporated +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/display/ti/ti,j721e-dss.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Texas Instruments J721E Display Subsystem + +maintainers: + - Jyri Sarha <[email protected]> + - Tomi Valkeinen <[email protected]> + +description: | + The J721E TI Keystone Display SubSystem with four output ports and + four video planes. There is two full video planes and two "lite + planes" without scaling support. The video ports can be connected to + the SoC's DPI pins or to integrated display bridges on the SoC. + +properties: + compatible: + const: ti,j721e-dss + + reg: + maxItems: 17 + minItems: 17 + + reg-names: + items: + - const: common_m + - const: common_s0 + - const: common_s1 + - const: common_s2 + - const: vidl1 + - const: vidl2 + - const: vid1 + - const: vid2 + - const: ovr1 + - const: ovr2 + - const: ovr3 + - const: ovr4 + - const: vp1 + - const: vp2 + - const: vp3 + - const: vp4 + - const: wp + + clocks: + maxItems: 5 + minItems: 5 + + clock-names: + items: + - const: fck + - const: vp1 + - const: vp2 + - const: vp3 + - const: vp4 + + interrupts: + maxItems: 4 + + interrupt-names: + items: + - const: common_m + - const: common_s0 + - const: common_s1 + - const: common_s2 + + power-domains: + maxItems: 1 + description: phandle to the associated power domain + + port@0: + type: object + description: + The output port node form video port 1 + + port@1: + type: object + description: + The output port node from video port 2 + + port@2: + type: object + description: + The output port node from video port 3 + + port@3: + type: object + description: + The output port node from video port 4 + + max-memory-bandwidth: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + Input memory (from main memory to dispc) bandwidth limit in + bytes per second + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + +required: + - compatible + - reg + - reg-names + - clocks + - clock-names + - interrupts + - interrupt-names + - "#address-cells" + - "#size-cells" + +additionalProperties: false + +examples: + - | + dss: dss@04a00000 { + compatible = "ti,j721e-dss"; + reg = + <0x00 0x04a00000 0x00 0x10000>, /* common_m */ + <0x00 0x04a10000 0x00 0x10000>, /* common_s0*/ + <0x00 0x04b00000 0x00 0x10000>, /* common_s1*/ + <0x00 0x04b10000 0x00 0x10000>, /* common_s2*/ + + <0x00 0x04a20000 0x00 0x10000>, /* vidl1 */ + <0x00 0x04a30000 0x00 0x10000>, /* vidl2 */ + <0x00 0x04a50000 0x00 0x10000>, /* vid1 */ + <0x00 0x04a60000 0x00 0x10000>, /* vid2 */ + + <0x00 0x04a70000 0x00 0x10000>, /* ovr1 */ + <0x00 0x04a90000 0x00 0x10000>, /* ovr2 */ + <0x00 0x04ab0000 0x00 0x10000>, /* ovr3 */ + <0x00 0x04ad0000 0x00 0x10000>, /* ovr4 */ + + <0x00 0x04a80000 0x00 0x10000>, /* vp1 */ + <0x00 0x04aa0000 0x00 0x10000>, /* vp2 */ + <0x00 0x04ac0000 0x00 0x10000>, /* vp3 */ + <0x00 0x04ae0000 0x00 0x10000>, /* vp4 */ + + <0x00 0x04af0000 0x00 0x10000>; /* wb */ + reg-names = "common_m", "common_s0", + "common_s1", "common_s2", + "vidl1", "vidl2","vid1","vid2", + "ovr1", "ovr2", "ovr3", "ovr4", + "vp1", "vp2", "vp3", "vp4", + "wb"; + + clocks = <&k3_clks 152 0>, + <&k3_clks 152 1>, + <&k3_clks 152 4>, + <&k3_clks 152 9>, + <&k3_clks 152 13>; + clock-names = "fck", "vp1", "vp2", "vp3", "vp4"; + + interrupts = <GIC_SPI 602 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 603 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 604 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 605 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "common_m", + "common_s0", + "common_s1", + "common_s2"; + + #address-cells = <1>; + #size-cells = <0>; + port@0 { + reg = <0>; + + dpi_out_real0: endpoint { + remote-endpoint = <&dp_bridge_input>; + }; + }; + };
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/5 drm/tidss: New driver for TI Keystone platform Display SubSystem
In reply to Jyri SarhaThis patch adds a new DRM driver for Texas Instruments DSS IPs used on Texas Instruments Keystone K2G, AM65x, and J721e SoCs. The new DSS IP is a major change to the older DSS IP versions, which are supported by the omapdrm driver. While on higher level the Keystone DSS resembles the older DSS versions, the registers are completely different and the internal pipelines differ a lot.
DSS IP found on K2G is an "ultra-light" version, and has only a single plane and a single output. The Keystone 3 DSS IPs are found on AM65x and J721E SoCs. AM65x DSS has two video ports, one full video plane, and another "lite" plane without scaling support. J721E has 4 video ports, 2 video planes and 2 lite planes. AM65x DSS has also integrated OLDI (LVDS) output.
--- drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/tidss/Kconfig | 15 + drivers/gpu/drm/tidss/Makefile | 12 + drivers/gpu/drm/tidss/tidss_crtc.c | 373 +++ drivers/gpu/drm/tidss/tidss_crtc.h | 45 + drivers/gpu/drm/tidss/tidss_dispc.c | 2645 +++++++++++++++++++++ drivers/gpu/drm/tidss/tidss_dispc.h | 132 + drivers/gpu/drm/tidss/tidss_dispc_regs.h | 243 ++ drivers/gpu/drm/tidss/tidss_drv.c | 292 +++ drivers/gpu/drm/tidss/tidss_drv.h | 42 + drivers/gpu/drm/tidss/tidss_encoder.c | 89 + drivers/gpu/drm/tidss/tidss_encoder.h | 17 + drivers/gpu/drm/tidss/tidss_irq.c | 185 ++ drivers/gpu/drm/tidss/tidss_irq.h | 71 + drivers/gpu/drm/tidss/tidss_kms.c | 239 ++ drivers/gpu/drm/tidss/tidss_kms.h | 15 + drivers/gpu/drm/tidss/tidss_plane.c | 218 ++ drivers/gpu/drm/tidss/tidss_plane.h | 25 + drivers/gpu/drm/tidss/tidss_scale_coefs.c | 201 ++ drivers/gpu/drm/tidss/tidss_scale_coefs.h | 22 + 21 files changed, 4884 insertions(+) create mode 100644 drivers/gpu/drm/tidss/Kconfig create mode 100644 drivers/gpu/drm/tidss/Makefile create mode 100644 drivers/gpu/drm/tidss/tidss_crtc.c create mode 100644 drivers/gpu/drm/tidss/tidss_crtc.h create mode 100644 drivers/gpu/drm/tidss/tidss_dispc.c create mode 100644 drivers/gpu/drm/tidss/tidss_dispc.h create mode 100644 drivers/gpu/drm/tidss/tidss_dispc_regs.h create mode 100644 drivers/gpu/drm/tidss/tidss_drv.c create mode 100644 drivers/gpu/drm/tidss/tidss_drv.h create mode 100644 drivers/gpu/drm/tidss/tidss_encoder.c create mode 100644 drivers/gpu/drm/tidss/tidss_encoder.h create mode 100644 drivers/gpu/drm/tidss/tidss_irq.c create mode 100644 drivers/gpu/drm/tidss/tidss_irq.h create mode 100644 drivers/gpu/drm/tidss/tidss_kms.c create mode 100644 drivers/gpu/drm/tidss/tidss_kms.h create mode 100644 drivers/gpu/drm/tidss/tidss_plane.c create mode 100644 drivers/gpu/drm/tidss/tidss_plane.h create mode 100644 drivers/gpu/drm/tidss/tidss_scale_coefs.c create mode 100644 drivers/gpu/drm/tidss/tidss_scale_coefs.h
drivers/gpu/drm/Kconfig +2 -0
@@ -358,6 +358,8 @@ source "drivers/gpu/drm/aspeed/Kconfig" source "drivers/gpu/drm/mcde/Kconfig" +source "drivers/gpu/drm/tidss/Kconfig" + # Keep legacy drivers last menuconfig DRM_LEGACY
drivers/gpu/drm/Makefile +1 -0
@@ -120,3 +120,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_TIDSS) += tidss/
drivers/gpu/drm/tidss/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +config DRM_TIDSS + tristate "DRM Support for TI Keystone" + depends on DRM && OF + depends on ARM || ARM64 || COMPILE_TEST + select DRM_KMS_HELPER + select DRM_KMS_CMA_HELPER + select DRM_GEM_CMA_HELPER + select VIDEOMODE_HELPERS + help + The TI Keystone family SoCs introduced a new generation of + Display SubSystem. There is currently three Keystone family + SoCs released with DSS. Each with somewhat different version + of it. The SoCs are 66AK2Gx, AM65x, and J721E. Set this to Y + or M to add display support for TI Keystone family + platforms.
drivers/gpu/drm/tidss/Makefile new file +12 -0
@@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0 + +tidss-y := tidss_crtc.o \ + tidss_drv.o \ + tidss_encoder.o \ + tidss_kms.o \ + tidss_irq.o \ + tidss_plane.o \ + tidss_scale_coefs.o \ + tidss_dispc.o + +obj-$(CONFIG_DRM_TIDSS) += tidss.o
drivers/gpu/drm/tidss/tidss_crtc.c new file +373 -0
373 lines not on this page · raw message
drivers/gpu/drm/tidss/tidss_crtc.h new file +45 -0
45 lines not on this page · raw message
drivers/gpu/drm/tidss/tidss_dispc.c new file +2645 -0
2,543 lines not on this page · raw message
drivers/gpu/drm/tidss/tidss_dispc.h new file +132 -0
132 lines not on this page · raw message
drivers/gpu/drm/tidss/tidss_dispc_regs.h new file +243 -0
243 lines not on this page · raw message
drivers/gpu/drm/tidss/tidss_drv.c new file +292 -0
292 lines not on this page · raw message
drivers/gpu/drm/tidss/tidss_drv.h new file +42 -0
42 lines not on this page · raw message
drivers/gpu/drm/tidss/tidss_encoder.c new file +89 -0
89 lines not on this page · raw message
drivers/gpu/drm/tidss/tidss_encoder.h new file +17 -0
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/tidss/tidss_irq.c new file +185 -0
185 lines not on this page · raw message
drivers/gpu/drm/tidss/tidss_irq.h new file +71 -0
71 lines not on this page · raw message
drivers/gpu/drm/tidss/tidss_kms.c new file +239 -0
239 lines not on this page · raw message
drivers/gpu/drm/tidss/tidss_kms.h new file +15 -0
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/tidss/tidss_plane.c new file +218 -0
218 lines not on this page · raw message
drivers/gpu/drm/tidss/tidss_plane.h new file +25 -0
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/tidss/tidss_scale_coefs.c new file +201 -0
201 lines not on this page · raw message
drivers/gpu/drm/tidss/tidss_scale_coefs.h new file +22 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Part of the diff is not shown here. View the raw message.
Hi Jyri.
Took a quick look - looks like a very nice driver. Some drive by comments below.
I was left with the impression that there is a lot of code to support vblank - and I wonder if there is some general code that can help you here that you have missed.
Sam
Quoted 18 lines · Jyri Sarha
This patch adds a new DRM driver for Texas Instruments DSS IPs used on Texas Instruments Keystone K2G, AM65x, and J721e SoCs. The new DSS IP is a major change to the older DSS IP versions, which are supported by the omapdrm driver. While on higher level the Keystone DSS resembles the older DSS versions, the registers are completely different and the internal pipelines differ a lot.
DSS IP found on K2G is an "ultra-light" version, and has only a single plane and a single output. The Keystone 3 DSS IPs are found on AM65x and J721E SoCs. AM65x DSS has two video ports, one full video plane, and another "lite" plane without scaling support. J721E has 4 video ports, 2 video planes and 2 lite planes. AM65x DSS has also integrated OLDI (LVDS) output.
Co-developed-by Tomi Valkeinen <[email protected]>Signed-off-by Jyri Sarha <[email protected]>+++ b/drivers/gpu/drm/tidss/Kconfig
drivers/gpu/drm/tidss/Kconfig line 8
Quoted 8 lines
drivers/gpu/drm/tidss/Kconfig new file +8
-0@@ -0,0 +1,15 @@ +config DRM_TIDSS + tristate "DRM Support for TI Keystone" + depends on DRM && OF + depends on ARM || ARM64 || COMPILE_TEST + select DRM_KMS_HELPER + select DRM_KMS_CMA_HELPER + select DRM_GEM_CMA_HELPER + select VIDEOMODE_HELPERS
VIDEOMODE_HELPERS seems unused.
Quoted 11 lines
drivers/gpu/drm/tidss/Kconfig new file +8
-0+ help + The TI Keystone family SoCs introduced a new generation of + Display SubSystem. There is currently three Keystone family + SoCs released with DSS. Each with somewhat different version + of it. The SoCs are 66AK2Gx, AM65x, and J721E. Set this to Y + or M to add display support for TI Keystone family + platforms. +++ b/drivers/gpu/drm/tidss/tidss_crtc.c
drivers/gpu/drm/tidss/Kconfig line 7
Quoted 7 lines
drivers/gpu/drm/tidss/Kconfig new file +7
-0@@ -0,0 +1,373 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/ + * Author: Tomi Valkeinen <[email protected]> + */ + +#include <drm/drmP.h>
This file is no longer present in the tree.
Quoted 18 lines
drivers/gpu/drm/tidss/tidss_crtc.c new file +13
-0+#include <drm/drm_atomic.h> +#include <drm/drm_atomic_helper.h> +#include <drm/drm_crtc.h> +#include <drm/drm_crtc_helper.h> +#include <drm/drm_fb_cma_helper.h> +#include <drm/drm_gem_cma_helper.h> +#include <drm/drm_plane_helper.h> + +#include "tidss_crtc.h" +#include "tidss_dispc.h" +#include "tidss_drv.h" +#include "tidss_irq.h" +drivers/gpu/drm/tidss/tidss_crtc.h new file +2
-0@@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/*
drivers/gpu/drm/tidss/tidss_crtc.h line 12
Quoted 10 lines
drivers/gpu/drm/tidss/tidss_crtc.h new file +10
-0+* Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/ +* Author: Tomi Valkeinen <[email protected]> +*/ + +#ifndef __TIDSS_CRTC_H__ +#define __TIDSS_CRTC_H__ + +#include <drm/drm_crtc.h> +#include <linux/completion.h> +#include <linux/wait.h>
The normal way to structure header files are:
#include <linux/*.h>
#include <drm/*.h>
with each block sorted alphabetically.
Quoted 19 lines
drivers/gpu/drm/tidss/tidss_dispc.c new file +16
-0@@ -0,0 +1,2645 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2016-2018 Texas Instruments Incorporated - http://www.ti.com/ +* Author: Jyri Sarha <[email protected]> +*/ + +#include <linux/clk.h> +#include <linux/delay.h> +#include <linux/dma-mapping.h> +#include <linux/err.h> +#include <linux/interrupt.h> +#include <linux/io.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/mfd/syscon.h> +#include <linux/of.h>
drivers/gpu/drm/tidss/tidss_dispc.c line 26
Quoted 10 lines
drivers/gpu/drm/tidss/tidss_dispc.c new file +10
-0+#include <linux/of_graph.h> +#include <linux/of_device.h> +#include <linux/platform_device.h> +#include <linux/pm_runtime.h> +#include <linux/regmap.h> + +#include <drm/drm_fourcc.h> +#include <drm/drm_panel.h> +#include <drm/drm_fb_cma_helper.h> +#include <drm/drm_gem_cma_helper.h>
Blocks are fine, but sort the include files.
Quoted 42 lines
drivers/gpu/drm/tidss/tidss_dispc.c new file +41
-0+ +#include "tidss_drv.h" +#include "tidss_crtc.h" +#include "tidss_plane.h" +#include "tidss_irq.h" + +#include "tidss_scale_coefs.h" +#include "tidss_dispc_regs.h" + +#include "tidss_dispc.h" + + +enum c8_to_c12_mode {C8_TO_C12_REPLICATE ,C8_TO_C12_MAX ,C8_TO_C12_MIN }; + +static u16 c8_to_c12 (u8 c8,enum c8_to_c12_mode mode) +{ +u16 c12; + + c12 = c8 <<4 ; + +switch (mode) { +case C8_TO_C12_REPLICATE : +/* Copy c8 4 MSB to 4 LSB for full scale c12 */ + c12 |= c8 >>4 ; +break ; +case C8_TO_C12_MAX : + c12 |=0xF ; +break ; +default : +case C8_TO_C12_MIN : +break ; + } + +return c12; +} + +static u64 argb8888_to_argb12121212 (u32 argb8888,enum c8_to_c12_mode m) +{ +u8 a, r, g, b; +u64 v; +
drivers/gpu/drm/tidss/tidss_dispc.c line 1058
Quoted 10 lines
drivers/gpu/drm/tidss/tidss_dispc.c new file +10
-0+ a = (argb8888 >>24 ) &0xff ; + r = (argb8888 >>16 ) &0xff ; + g = (argb8888 >>8 ) &0xff ; + b = (argb8888 >>0 ) &0xff ; + + v = ((u64 )c8_to_c12 (a, m) <<36 ) | ((u64 )c8_to_c12 (r, m) <<24 ) | + ((u64 )c8_to_c12 (g, m) <<12 ) | (u64 )c8_to_c12 (b, m); + +return v; +}
This looks like a helper that could be useful for others. Maybe move up one level?
Quoted 7 lines
drivers/gpu/drm/tidss/tidss_drv.c new file +1
-0@@ -0,0 +1,292 @@ +// SPDX-License-Identifier: GPL-2.0
drivers/gpu/drm/tidss/tidss_drv.c line 11
Quoted 10 lines
drivers/gpu/drm/tidss/tidss_drv.c new file +10
-0+/* +* Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/ +* Author: Tomi Valkeinen <[email protected]> +*/ + +#include <linux/console.h> +#include <linux/of_device.h> +#include <linux/pm_runtime.h> + +#include <drm/drmP.h>
This file is no longer present.
Quoted 27 lines
drivers/gpu/drm/tidss/tidss_drv.c new file +27
-0+#include <drm/drm_atomic.h> +#include <drm/drm_atomic_helper.h> +#include <drm/drm_crtc.h> +#include <drm/drm_crtc_helper.h> +#include <drm/drm_fb_helper.h> +#include <drm/drm_gem_cma_helper.h> +#include <drm/drm_probe_helper.h> + +#include "tidss_dispc.h" +#include "tidss_drv.h" +#include "tidss_kms.h" +#include "tidss_irq.h" + +/* Power management */ + +int tidss_runtime_get (struct tidss_device *tidss) +{ +int r; + +dev_dbg (tidss->dev,"%s\n" , __func__); + + r =pm_runtime_get_sync (tidss->dev); +WARN_ON (r <0 ); +return r <0 ? r :0 ; +} + +void tidss_runtime_put (struct tidss_device *tidss)
drivers/gpu/drm/tidss/tidss_drv.c line 48
Quoted 10 lines
drivers/gpu/drm/tidss/tidss_drv.c new file +10
-0+{ +int r; + +dev_dbg (tidss->dev,"%s\n" , __func__); + + r =pm_runtime_put_sync (tidss->dev); +WARN_ON (r <0 ); +} + +#ifdef CONFIG_PM
Use __maybe_unused here - then you can drop the #ifdef
Quoted 50 lines
drivers/gpu/drm/tidss/tidss_drv.c new file +50
-0+ +static int tidss_pm_runtime_suspend (struct device *dev) +{ +struct tidss_device *tidss =dev_get_drvdata (dev); + +dev_dbg (dev,"%s\n" , __func__); + +return dispc_runtime_suspend (tidss->dispc); +} + +static int tidss_pm_runtime_resume (struct device *dev) +{ +struct tidss_device *tidss =dev_get_drvdata (dev); +int r; + +dev_dbg (dev,"%s\n" , __func__); + + r =dispc_runtime_resume (tidss->dispc); +if (r) +return r; + +return 0 ; +} + +#ifdef CONFIG_PM_SLEEP +static int tidss_suspend (struct device *dev) +{ +struct tidss_device *tidss =dev_get_drvdata (dev); + +dev_dbg (dev,"%s\n" , __func__); + +return drm_mode_config_helper_suspend (tidss->ddev); +} + +static int tidss_resume (struct device *dev) +{ +struct tidss_device *tidss =dev_get_drvdata (dev); + +dev_dbg (dev,"%s\n" , __func__); + +return drm_mode_config_helper_resume (tidss->ddev); +} +#endif /* CONFIG_PM_SLEEP */ + +static const struct dev_pm_ops tidss_pm_ops = { + .runtime_suspend = tidss_pm_runtime_suspend, + .runtime_resume = tidss_pm_runtime_resume, +SET_SYSTEM_SLEEP_PM_OPS (tidss_suspend, tidss_resume) +}; +
drivers/gpu/drm/tidss/tidss_drv.c line 108
Quoted 10 lines
drivers/gpu/drm/tidss/tidss_drv.c new file +10
-0+#endif /* CONFIG_PM */ + +/* Platform driver */ + +/* DRM device Information */ +DEFINE_DRM_GEM_CMA_FOPS (tidss_fops); + +static struct drm_driver tidss_driver = { + .driver_features =DRIVER_GEM |DRIVER_MODESET |DRIVER_ATOMIC | +DRIVER_HAVE_IRQ ,
DRIVER_HAVE_IRQ is only for legacy drivers.
In general - look through the comments in drm_drv.h - and remove use of all obsoleted callbacks.
I checked .gem_free_object_unlocked - it is deprecated. I guess there is more.
Quoted 20 lines
drivers/gpu/drm/tidss/tidss_drv.c new file +20
-0+ .gem_free_object_unlocked = drm_gem_cma_free_object, + .gem_vm_ops = &drm_gem_cma_vm_ops, + .prime_handle_to_fd = drm_gem_prime_handle_to_fd, + .prime_fd_to_handle = drm_gem_prime_fd_to_handle, + .gem_prime_import = drm_gem_prime_import, + .gem_prime_export = drm_gem_prime_export, + .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, + .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, + .gem_prime_vmap = drm_gem_cma_prime_vmap, + .gem_prime_vunmap = drm_gem_cma_prime_vunmap, + .gem_prime_mmap = drm_gem_cma_prime_mmap, + .dumb_create = drm_gem_cma_dumb_create, + .fops = &tidss_fops, + .name = "tidss", + .desc = "TI Keystone DSS", + .date = "20180215", + .major = 1, + .minor = 0, + + .irq_preinstall = tidss_irq_preinstall,
drivers/gpu/drm/tidss/tidss_drv.c line 138
Quoted 10 lines
drivers/gpu/drm/tidss/tidss_drv.c new file +10
-0+ .irq_postinstall = tidss_irq_postinstall, + .irq_handler = tidss_irq_handler, + .irq_uninstall = tidss_irq_uninstall, +}; + +static int tidss_probe (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +struct tidss_device *tidss; +struct drm_device *ddev;
See code example in drm_drv.c how to embed drm_device. This is the preferred approach these days.
Quoted 171 lines
drivers/gpu/drm/tidss/tidss_drv.c new file +154
-0+int ret; +int irq; + +dev_dbg (dev,"%s\n" , __func__); + + tidss =devm_kzalloc (dev,sizeof (*tidss),GFP_KERNEL ); +if (tidss ==NULL ) +return -ENOMEM ; + + tidss->dev = dev; + tidss->feat =of_device_get_match_data (dev); + +platform_set_drvdata (pdev, tidss); + + ddev =drm_dev_alloc (&tidss_driver, dev); +if (IS_ERR (ddev)) +return PTR_ERR (ddev); + + tidss->ddev = ddev; + ddev->dev_private = tidss; + +pm_runtime_enable (dev); + + ret =dispc_init (tidss); +if (ret) { +dev_err (dev,"failed to initialize dispc: %d\n" , ret); + goto err_disable_pm; + } + +#ifndef CONFIG_PM +/* If we don't have PM, we need to call resume manually */ +dispc_runtime_resume (tidss->dispc); +#endif + + ret =tidss_modeset_init (tidss); +if (ret <0 ) { +if (ret != -EPROBE_DEFER ) +dev_err (dev,"failed to init DRM/KMS (%d)\n" , ret); + goto err_runtime_suspend; + } + + irq =platform_get_irq (pdev,0 ); +if (irq <0 ) { + ret = irq; + goto err_modeset_cleanup; + } + + ret =drm_irq_install (ddev, irq); +if (ret) { +dev_err (dev,"drm_irq_install failed: %d\n" , ret); + goto err_modeset_cleanup; + } + +drm_kms_helper_poll_init (ddev); + + ret =drm_dev_register (ddev,0 ); +if (ret) { +dev_err (dev,"failed to register DRM device\n" ); + goto err_poll_fini; + } + +drm_fbdev_generic_setup (ddev,32 ); + +dev_dbg (dev,"%s done\n" , __func__); + +return 0 ; + +err_poll_fini: +drm_kms_helper_poll_fini (ddev); + +drm_atomic_helper_shutdown (ddev); + +drm_irq_uninstall (ddev); + +err_modeset_cleanup: +tidss_modeset_cleanup (tidss); + +err_runtime_suspend: +#ifndef CONFIG_PM +/* If we don't have PM, we need to call suspend manually */ +dispc_runtime_suspend (tidss->dispc); +#endif + +dispc_remove (tidss); + +err_disable_pm: +pm_runtime_disable (dev); + +drm_dev_put (ddev); + +return ret; +} + +static int tidss_remove (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +struct tidss_device *tidss =platform_get_drvdata (pdev); +struct drm_device *ddev = tidss->ddev; + +dev_dbg (dev,"%s\n" , __func__); + +drm_dev_unregister (ddev); + +drm_kms_helper_poll_fini (ddev); + +drm_atomic_helper_shutdown (ddev); + +drm_irq_uninstall (ddev); + +tidss_modeset_cleanup (tidss); + +#ifndef CONFIG_PM +/* If we don't have PM, we need to call suspend manually */ +dispc_runtime_suspend (tidss->dispc); +#endif + +dispc_remove (tidss); + +pm_runtime_disable (dev); + +drm_dev_put (ddev); + +dev_dbg (dev,"%s done\n" , __func__); + +return 0 ; +} + +static const struct of_device_id tidss_of_table[] = { + { .compatible ="ti,k2g-dss" , .data = &dispc_k2g_feats, }, + { .compatible ="ti,am65x-dss" , .data = &dispc_am65x_feats, }, + { .compatible ="ti,j721e-dss" , .data = &dispc_j721e_feats, }, + { } +}; + +MODULE_DEVICE_TABLE (of, tidss_of_table); + +static struct platform_driver tidss_platform_driver = { + .probe = tidss_probe, + .remove = tidss_remove, + .driver = { + .name ="tidss" , +#ifdef CONFIG_PM + .pm = &tidss_pm_ops, +#endif + .of_match_table = tidss_of_table, + .suppress_bind_attrs = true, + }, +}; + +module_platform_driver (tidss_platform_driver); + +MODULE_AUTHOR ("Tomi Valkeinen <[email protected]>" ); +MODULE_DESCRIPTION ("TI Keystone DSS Driver" ); +MODULE_LICENSE ("GPL v2" );drivers/gpu/drm/tidss/tidss_drv.h new file +11
-0@@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/ +* Author: Tomi Valkeinen <[email protected]> +*/ + +#ifndef __TIDSS_DRV_H__ +#define __TIDSS_DRV_H__ + +#include <linux/spinlock.h> +
drivers/gpu/drm/tidss/tidss_drv.h line 21
Quoted 10 lines
drivers/gpu/drm/tidss/tidss_drv.h new file +10
-0+#define TIDSS_MAX_PORTS 4 +#define TIDSS_MAX_PLANES 4 + +typedef u32 dispc_irq_t ; + +struct tidss_device { +struct device *dev;/* Underlying DSS device */ +struct drm_device *ddev;/* DRM device for DSS */ + +struct drm_fbdev_cma *fbdev;
Unused, can be removed.
Quoted 27 lines
drivers/gpu/drm/tidss/tidss_drv.h new file +21
-0+ +const struct dispc_features *feat; +struct dispc_device *dispc; + +unsigned int num_crtcs; +struct drm_crtc *crtcs[TIDSS_MAX_PORTS ]; + +unsigned int num_planes; +struct drm_plane *planes[TIDSS_MAX_PLANES ]; + +spinlock_t wait_lock;/* protects the irq masks */ +dispc_irq_t irq_mask;/* enabled irqs in addition to wait_list */ +dispc_irq_t irq_uf_mask;/* underflow irq bits for all planes */ + + struct drm_atomic_state *saved_state; +}; + +int tidss_runtime_get (struct tidss_device *tidss); +void tidss_runtime_put (struct tidss_device *tidss); + +#endif drivers/gpu/drm/tidss/tidss_encoder.c new file +0
-0
drivers/gpu/drm/tidss/tidss_encoder.c line 9
Quoted 9 lines
drivers/gpu/drm/tidss/tidss_encoder.c new file +9
-0@@ -0,0 +1,89 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/ +* Author: Tomi Valkeinen <[email protected]> +*/ + +#include <linux/export.h> + +#include <drm/drmP.h>
File no longer present in the tree.
drivers/gpu/drm/tidss/tidss_encoder.c line 13
Quoted 4 lines
drivers/gpu/drm/tidss/tidss_encoder.c new file +4
-0+#include <drm/drm_crtc.h> +#include <drm/drm_crtc_helper.h> +#include <drm/drm_panel.h> +#include <drm/drm_of.h>
Sort include files.
Quoted 105 lines
drivers/gpu/drm/tidss/tidss_encoder.c new file +76
-0+ +#include "tidss_drv.h" +#include "tidss_encoder.h" +#include "tidss_crtc.h" + +static int tidss_encoder_atomic_check (struct drm_encoder *encoder, +struct drm_crtc_state *crtc_state, +struct drm_connector_state *conn_state) +{ +struct drm_device *ddev = encoder->dev; +struct tidss_crtc_state *tcrtc_state =to_tidss_crtc_state (crtc_state); +struct drm_display_info *di = &conn_state->connector->display_info; +struct drm_bridge *bridge; +bool bus_flags_set = false; + +dev_dbg (ddev->dev,"%s\n" , __func__); + +/* +* Take the bus_flags from the first bridge that defines +* bridge timings, or from the connector's display_info if no +* bridge defines the timings. +*/ +for (bridge = encoder->bridge; bridge; bridge = bridge->next) { +if (!bridge->timings) +continue ; + + tcrtc_state->bus_flags = bridge->timings->input_bus_flags; + bus_flags_set = true; +break ; + } + +if (!di->bus_formats || di->num_bus_formats ==0 ) { +dev_err (ddev->dev,"%s: No bus_formats in connected display\n" , + __func__); +return -EINVAL ; + } + +// XXX any cleaner way to set bus format and flags? + tcrtc_state->bus_format = di->bus_formats[0 ]; +if (!bus_flags_set) + tcrtc_state->bus_flags = di->bus_flags; + +return 0 ; +} + +static const struct drm_encoder_helper_funcs encoder_helper_funcs = { + .atomic_check = tidss_encoder_atomic_check, +}; + +static const struct drm_encoder_funcs encoder_funcs = { + .destroy = drm_encoder_cleanup, +}; + +struct drm_encoder *tidss_encoder_create (struct tidss_device *tidss, +u32 encoder_type,u32 possible_crtcs) +{ +struct drm_encoder *enc; +int ret; + + enc =devm_kzalloc (tidss->dev,sizeof (*enc),GFP_KERNEL ); +if (!enc) +return ERR_PTR (-ENOMEM ); + + enc->possible_crtcs = possible_crtcs; + + ret =drm_encoder_init (tidss->ddev, enc, &encoder_funcs, + encoder_type,NULL ); +if (ret <0 ) +return ERR_PTR (ret); + +drm_encoder_helper_add (enc, &encoder_helper_funcs); + +dev_dbg (tidss->dev,"Encoder create done\n" ); + +return enc; +}drivers/gpu/drm/tidss/tidss_encoder.h new file +17
-0@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/ +* Author: Tomi Valkeinen <[email protected]> +*/ + +#ifndef __TIDSS_ENCODER_H__ +#define __TIDSS_ENCODER_H__ + +#include <drm/drm_encoder.h> + +struct tidss_device ; + +struct drm_encoder *tidss_encoder_create (struct tidss_device *tidss, +u32 encoder_type,u32 possible_crtcs); + +#endif drivers/gpu/drm/tidss/tidss_irq.c new file +0
-0
drivers/gpu/drm/tidss/tidss_irq.c line 7
Quoted 7 lines
drivers/gpu/drm/tidss/tidss_irq.c new file +7
-0@@ -0,0 +1,185 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/ +* Author: Tomi Valkeinen <[email protected]> +*/ + +#include <drm/drmP.h>
No longer present in the tree.
drivers/gpu/drm/tidss/tidss_irq.c line 13
Quoted 6 lines
drivers/gpu/drm/tidss/tidss_irq.c new file +6
-0+ +#include "tidss_irq.h" +#include "tidss_drv.h" +#include "tidss_dispc.h" +#include "tidss_crtc.h" +#include "tidss_plane.h"
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Sam,
And thank you for the prompt review comments!
Quoted 9 lines · Sam Ravnborg
Hi Jyri.
Took a quick look - looks like a very nice driver. Some drive by comments below.
I was left with the impression that there is a lot of code to support vblank - and I wonder if there is some general code that can help you here that you have missed.
I am not so sure if the DSS go-bit functionality (hw support to commit changes to display during next vertical blank) so widely used concept that it would make sense to make drm wide helpers to handle it.
I applied already the simple to fix comments. There is couple of comments and questions bellow about the more complex ones.
Quoted 21 lines
Sam
Quoted 17 lines · Jyri Sarha
This patch adds a new DRM driver for Texas Instruments DSS IPs used on Texas Instruments Keystone K2G, AM65x, and J721e SoCs. The new DSS IP is a major change to the older DSS IP versions, which are supported by the omapdrm driver. While on higher level the Keystone DSS resembles the older DSS versions, the registers are completely different and the internal pipelines differ a lot.
DSS IP found on K2G is an "ultra-light" version, and has only a single plane and a single output. The Keystone 3 DSS IPs are found on AM65x and J721E SoCs. AM65x DSS has two video ports, one full video plane, and another "lite" plane without scaling support. J721E has 4 video ports, 2 video planes and 2 lite planes. AM65x DSS has also integrated OLDI (LVDS) output.
Co-developed-by Tomi Valkeinen <[email protected]>Signed-off-by Jyri Sarha <[email protected]>+++ b/drivers/gpu/drm/tidss/Kconfig
...
Quoted 8 lines
drivers/gpu/drm/tidss/tidss_dispc.c line 5
Quoted 8 lines
drivers/gpu/drm/tidss/tidss_dispc.c new file +5
-0@@ -0,0 +1,2645 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2016-2018 Texas Instruments Incorporated - http://www.ti.com/ +* Author: Jyri Sarha <[email protected]> +*/
...>> +
Quoted 33 lines
Quoted 33 lines
drivers/gpu/drm/tidss/tidss_dispc.c new file +33
-0+enum c8_to_c12_mode {C8_TO_C12_REPLICATE ,C8_TO_C12_MAX ,C8_TO_C12_MIN }; + +static u16 c8_to_c12 (u8 c8,enum c8_to_c12_mode mode) +{ +u16 c12; + + c12 = c8 <<4 ; + +switch (mode) { +case C8_TO_C12_REPLICATE : +/* Copy c8 4 MSB to 4 LSB for full scale c12 */ + c12 |= c8 >>4 ; +break ; +case C8_TO_C12_MAX : + c12 |=0xF ; +break ; +default : +case C8_TO_C12_MIN : +break ; + } + +return c12; +} + +static u64 argb8888_to_argb12121212 (u32 argb8888,enum c8_to_c12_mode m) +{ +u8 a, r, g, b; +u64 v; + + a = (argb8888 >>24 ) &0xff ; + r = (argb8888 >>16 ) &0xff ; + g = (argb8888 >>8 ) &0xff ; + b = (argb8888 >>0 ) &0xff ;
Quoted 9 lines
drivers/gpu/drm/tidss/tidss_dispc.c line 1058
Quoted 6 lines
drivers/gpu/drm/tidss/tidss_dispc.c new file +6
-0+ + v = ((u64 )c8_to_c12 (a, m) <<36 ) | ((u64 )c8_to_c12 (r, m) <<24 ) | + ((u64 )c8_to_c12 (g, m) <<12 ) | (u64 )c8_to_c12 (b, m); + +return v; +}This looks like a helper that could be useful for others. Maybe move up one level?
I feel the function should probably be a bit more generic and support other formats too, but for the moment DRM does not even recognize argb12121212 format used here. So there is some plumbing to do before that would make sense. I happy to help with that (K3 DSS has support for some other 64-bit formats too), but first I need to get this driver in shape for merging.
Quoted 5 lines
drivers/gpu/drm/tidss/tidss_drv.c
Quoted 5 lines
drivers/gpu/drm/tidss/tidss_drv.c new file +0
-0
...>> +
Quoted 37 lines
drivers/gpu/drm/tidss/tidss_drv.c line 108
Quoted 6 lines
drivers/gpu/drm/tidss/tidss_drv.c new file +6
-0+/* DRM device Information */ +DEFINE_DRM_GEM_CMA_FOPS (tidss_fops); + +static struct drm_driver tidss_driver = { + .driver_features =DRIVER_GEM |DRIVER_MODESET |DRIVER_ATOMIC | +DRIVER_HAVE_IRQ ,
DRIVER_HAVE_IRQis only for legacy drivers.In general - look through the comments in
drm_drv.h- and remove use of all obsoleted callbacks.
I checked .gem_free_object_unlocked - it is deprecated. I guess there is more.Quoted 24 lines
drivers/gpu/drm/tidss/tidss_drv.c new file +24
-0+ .gem_free_object_unlocked = drm_gem_cma_free_object, + .gem_vm_ops = &drm_gem_cma_vm_ops, + .prime_handle_to_fd = drm_gem_prime_handle_to_fd, + .prime_fd_to_handle = drm_gem_prime_fd_to_handle, + .gem_prime_import = drm_gem_prime_import, + .gem_prime_export = drm_gem_prime_export, + .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, + .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, + .gem_prime_vmap = drm_gem_cma_prime_vmap, + .gem_prime_vunmap = drm_gem_cma_prime_vunmap, + .gem_prime_mmap = drm_gem_cma_prime_mmap, + .dumb_create = drm_gem_cma_dumb_create, + .fops = &tidss_fops, + .name = "tidss", + .desc = "TI Keystone DSS", + .date = "20180215", + .major = 1, + .minor = 0, + + .irq_preinstall = tidss_irq_preinstall, + .irq_postinstall = tidss_irq_postinstall, + .irq_handler = tidss_irq_handler, + .irq_uninstall = tidss_irq_uninstall, +};
Quoted 9 lines
drivers/gpu/drm/tidss/tidss_drv.c line 138
Quoted 6 lines
drivers/gpu/drm/tidss/tidss_drv.c new file +6
-0+ +static int tidss_probe (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +struct tidss_device *tidss; +struct drm_device *ddev;See code example in
drm_drv.chow to embeddrm_device. This is the preferred approach these days.
Thanks, I will do that. I just got the driver working on top of drm-next-2019-11-27 with the old probe approach, but it looks like the things will have to changed quite a bit for the new approach. It will probably take some time before I get module load-unload cycles to go smoothly again.
One generic question about that. What will happen if the probe fails after successful devm_drm_dev_init()?
The release callback gets called, and it should survive releasing the resources from the unfinished driver object?
Quoted 159 lines
Quoted 159 lines
drivers/gpu/drm/tidss/tidss_drv.c new file +154
-0+int ret; +int irq; + +dev_dbg (dev,"%s\n" , __func__); + + tidss =devm_kzalloc (dev,sizeof (*tidss),GFP_KERNEL ); +if (tidss ==NULL ) +return -ENOMEM ; + + tidss->dev = dev; + tidss->feat =of_device_get_match_data (dev); + +platform_set_drvdata (pdev, tidss); + + ddev =drm_dev_alloc (&tidss_driver, dev); +if (IS_ERR (ddev)) +return PTR_ERR (ddev); + + tidss->ddev = ddev; + ddev->dev_private = tidss; + +pm_runtime_enable (dev); + + ret =dispc_init (tidss); +if (ret) { +dev_err (dev,"failed to initialize dispc: %d\n" , ret); + goto err_disable_pm; + } + +#ifndef CONFIG_PM +/* If we don't have PM, we need to call resume manually */ +dispc_runtime_resume (tidss->dispc); +#endif + + ret =tidss_modeset_init (tidss); +if (ret <0 ) { +if (ret != -EPROBE_DEFER ) +dev_err (dev,"failed to init DRM/KMS (%d)\n" , ret); + goto err_runtime_suspend; + } + + irq =platform_get_irq (pdev,0 ); +if (irq <0 ) { + ret = irq; + goto err_modeset_cleanup; + } + + ret =drm_irq_install (ddev, irq); +if (ret) { +dev_err (dev,"drm_irq_install failed: %d\n" , ret); + goto err_modeset_cleanup; + } + +drm_kms_helper_poll_init (ddev); + + ret =drm_dev_register (ddev,0 ); +if (ret) { +dev_err (dev,"failed to register DRM device\n" ); + goto err_poll_fini; + } + +drm_fbdev_generic_setup (ddev,32 ); + +dev_dbg (dev,"%s done\n" , __func__); + +return 0 ; + +err_poll_fini: +drm_kms_helper_poll_fini (ddev); + +drm_atomic_helper_shutdown (ddev); + +drm_irq_uninstall (ddev); + +err_modeset_cleanup: +tidss_modeset_cleanup (tidss); + +err_runtime_suspend: +#ifndef CONFIG_PM +/* If we don't have PM, we need to call suspend manually */ +dispc_runtime_suspend (tidss->dispc); +#endif + +dispc_remove (tidss); + +err_disable_pm: +pm_runtime_disable (dev); + +drm_dev_put (ddev); + +return ret; +} + +static int tidss_remove (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +struct tidss_device *tidss =platform_get_drvdata (pdev); +struct drm_device *ddev = tidss->ddev; + +dev_dbg (dev,"%s\n" , __func__); + +drm_dev_unregister (ddev); + +drm_kms_helper_poll_fini (ddev); + +drm_atomic_helper_shutdown (ddev); + +drm_irq_uninstall (ddev); + +tidss_modeset_cleanup (tidss); + +#ifndef CONFIG_PM +/* If we don't have PM, we need to call suspend manually */ +dispc_runtime_suspend (tidss->dispc); +#endif + +dispc_remove (tidss); + +pm_runtime_disable (dev); + +drm_dev_put (ddev); + +dev_dbg (dev,"%s done\n" , __func__); + +return 0 ; +} + +static const struct of_device_id tidss_of_table[] = { + { .compatible ="ti,k2g-dss" , .data = &dispc_k2g_feats, }, + { .compatible ="ti,am65x-dss" , .data = &dispc_am65x_feats, }, + { .compatible ="ti,j721e-dss" , .data = &dispc_j721e_feats, }, + { } +}; + +MODULE_DEVICE_TABLE (of, tidss_of_table); + +static struct platform_driver tidss_platform_driver = { + .probe = tidss_probe, + .remove = tidss_remove, + .driver = { + .name ="tidss" , +#ifdef CONFIG_PM + .pm = &tidss_pm_ops, +#endif + .of_match_table = tidss_of_table, + .suppress_bind_attrs = true, + }, +}; + +module_platform_driver (tidss_platform_driver); + +MODULE_AUTHOR ("Tomi Valkeinen <[email protected]>" ); +MODULE_DESCRIPTION ("TI Keystone DSS Driver" ); +MODULE_LICENSE ("GPL v2" );drivers/gpu/drm/tidss/tidss_drv.h new file +0
-0
...
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Jyri
Quoted 3 lines
I am not so sure if the DSS go-bit functionality (hw support to commit changes to display during next vertical blank) so widely used concept that it would make sense to make drm wide helpers to handle it.
The question was the other way around.
I was just wondering if there is some of the present helpers that the driver can benefit from.
It is not that I found something - it was just a drive-by comment.
Sam
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/5 MAINTAINERS: add entry for tidss
In reply to Jyri SarhaAdd entry for tidss DRM driver.
--- MAINTAINERS | 10 ++++++++++ 1 file changed, 10 insertions(+)
MAINTAINERS +10 -0
@@ -5554,6 +5554,16 @@ F: include/uapi/drm/v3d_drm.h F: Documentation/devicetree/bindings/gpu/brcm,bcm-v3d.txt T: git git://anongit.freedesktop.org/drm/drm-misc +DRM DRIVERS FOR TI KEYSTONE +M: Jyri Sarha <[email protected]> +M: Tomi Valkeinen <[email protected]> +L: [email protected] +S: Maintained +F: drivers/gpu/drm/tidss/ +F: Documentation/devicetree/bindings/display/ti/ti,k2g-dss.txt +F: Documentation/devicetree/bindings/display/ti/ti,am65x-dss.txt +F: Documentation/devicetree/bindings/display/ti/ti,j721e-dss.txt + DRM DRIVERS FOR VC4 M: Eric Anholt <[email protected]> T: git git://github.com/anholt/linux
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel