* [PATCH v11 0/5] Add support for CDNS DSI J721E wrapper
@ 2023-01-03 10:19 Rahul T R
2023-01-03 10:19 ` [PATCH v11 1/5] dt-bindings: display: bridge: Convert cdns,dsi.txt to yaml Rahul T R
` (5 more replies)
0 siblings, 6 replies; 13+ messages in thread
From: Rahul T R @ 2023-01-03 10:19 UTC (permalink / raw)
To: dri-devel, robh+dt, krzysztof.kozlowski+dt
Cc: andrzej.hajda, narmstrong, robert.foss, jonas, jernej.skrabec,
airlied, daniel, p.zabel, tomi.valkeinen, laurent.pinchart,
linux-kernel, jpawar, sjakhade, mparab, a-bhatia1, devicetree,
vigneshr, lee.jones, Rahul T R
Following series of patches adds supports for CDNS DSI
bridge on j721e.
v11:
- Wrap commmit messages at 72 chars
- Fix the order in Kconfig and Makefile
- Clean up the includes, move macros and some headers to .c file
- Add missing forward declarations
- Add __ prefix to header gaurds
- Change dsi_platform_ops to cdns_dsi_platform_ops
- Add documentation to struct cdns_dsi_platform_ops
v10:
- Rebased to v6.2-rc1
- Accumulated the Reviewed-by acks
v9:
- Fixed below based on review comments in v8
- Added more info on wrapper in the commit message
- Fixed the description in Kconfig
- Fixed the formatting of of_match table
- exit -> deinit in platform ops
- Remove duplicate of struct declaration in cdns-dsi-j721e.h
v8:
- Rebased to 6.1-rc1
v7:
- Rebased to next-20220920
- Accumulated the Reviewed-by acks
v6:
- Dropped generic definations for properties like reg, resets etc..
- Fixed the defination for port@0 and port@1
- removed the ti,sn65dsi86 node from the example, which is not related
v5:
- Remove power-domain property in the conversion commit
- Add power-domain only for j721e compatible
- Fix white space error in one of the commit
v4:
- split conversion txt to yaml
- seperate commit for addinig new compatible
- conditionally limit the items for reg property, based on the compatible
v3:
- Convert cdns-dsi.txt binding to yaml
- Move the bridge under display/bridge/cadence
- Add new compatible to enable the wrapper module
v2:
- Moved setting DPI0 to bridge_enable, since it
should be done after pm_runtime_get
Rahul T R (5):
dt-bindings: display: bridge: Convert cdns,dsi.txt to yaml
dt-bindings: display: bridge: cdns,dsi: Add compatible for dsi on
j721e
drm/bridge: cdns-dsi: Move to drm/bridge/cadence
drm/bridge: cdns-dsi: Create a header file
drm/bridge: cdns-dsi: Add support for J721E wrapper
.../bindings/display/bridge/cdns,dsi.txt | 112 -----------
.../bindings/display/bridge/cdns,dsi.yaml | 180 ++++++++++++++++++
drivers/gpu/drm/bridge/Kconfig | 11 --
drivers/gpu/drm/bridge/Makefile | 1 -
drivers/gpu/drm/bridge/cadence/Kconfig | 21 ++
drivers/gpu/drm/bridge/cadence/Makefile | 3 +
.../{cdns-dsi.c => cadence/cdns-dsi-core.c} | 83 ++++----
.../gpu/drm/bridge/cadence/cdns-dsi-core.h | 84 ++++++++
.../gpu/drm/bridge/cadence/cdns-dsi-j721e.c | 51 +++++
.../gpu/drm/bridge/cadence/cdns-dsi-j721e.h | 16 ++
10 files changed, 391 insertions(+), 171 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/display/bridge/cdns,dsi.txt
create mode 100644 Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
rename drivers/gpu/drm/bridge/{cdns-dsi.c => cadence/cdns-dsi-core.c} (97%)
create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-core.h
create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.c
create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.h
--
2.39.0
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v11 1/5] dt-bindings: display: bridge: Convert cdns,dsi.txt to yaml
2023-01-03 10:19 [PATCH v11 0/5] Add support for CDNS DSI J721E wrapper Rahul T R
@ 2023-01-03 10:19 ` Rahul T R
2023-01-17 11:30 ` Andrzej Hajda
2023-01-03 10:19 ` [PATCH v11 2/5] dt-bindings: display: bridge: cdns,dsi: Add compatible for dsi on j721e Rahul T R
` (4 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Rahul T R @ 2023-01-03 10:19 UTC (permalink / raw)
To: dri-devel, robh+dt, krzysztof.kozlowski+dt
Cc: andrzej.hajda, narmstrong, robert.foss, jonas, jernej.skrabec,
airlied, daniel, p.zabel, tomi.valkeinen, laurent.pinchart,
linux-kernel, jpawar, sjakhade, mparab, a-bhatia1, devicetree,
vigneshr, lee.jones, Rahul T R, Rob Herring
Convert cdns,dsi.txt binding to yaml format
Signed-off-by: Rahul T R <r-ravikumar@ti.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
.../bindings/display/bridge/cdns,dsi.txt | 112 -------------
.../bindings/display/bridge/cdns,dsi.yaml | 157 ++++++++++++++++++
2 files changed, 157 insertions(+), 112 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/display/bridge/cdns,dsi.txt
create mode 100644 Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
diff --git a/Documentation/devicetree/bindings/display/bridge/cdns,dsi.txt b/Documentation/devicetree/bindings/display/bridge/cdns,dsi.txt
deleted file mode 100644
index 525a4bfd8634..000000000000
--- a/Documentation/devicetree/bindings/display/bridge/cdns,dsi.txt
+++ /dev/null
@@ -1,112 +0,0 @@
-Cadence DSI bridge
-==================
-
-The Cadence DSI bridge is a DPI to DSI bridge supporting up to 4 DSI lanes.
-
-Required properties:
-- compatible: should be set to "cdns,dsi".
-- reg: physical base address and length of the controller's registers.
-- interrupts: interrupt line connected to the DSI bridge.
-- clocks: DSI bridge clocks.
-- clock-names: must contain "dsi_p_clk" and "dsi_sys_clk".
-- phys: phandle link to the MIPI D-PHY controller.
-- phy-names: must contain "dphy".
-- #address-cells: must be set to 1.
-- #size-cells: must be set to 0.
-
-Optional properties:
-- resets: DSI reset lines.
-- reset-names: can contain "dsi_p_rst".
-
-Required subnodes:
-- ports: Ports as described in Documentation/devicetree/bindings/graph.txt.
- 2 ports are available:
- * port 0: this port is only needed if some of your DSI devices are
- controlled through an external bus like I2C or SPI. Can have at
- most 4 endpoints. The endpoint number is directly encoding the
- DSI virtual channel used by this device.
- * port 1: represents the DPI input.
- Other ports will be added later to support the new kind of inputs.
-
-- one subnode per DSI device connected on the DSI bus. Each DSI device should
- contain a reg property encoding its virtual channel.
-
-Example:
- dsi0: dsi@fd0c0000 {
- compatible = "cdns,dsi";
- reg = <0x0 0xfd0c0000 0x0 0x1000>;
- clocks = <&pclk>, <&sysclk>;
- clock-names = "dsi_p_clk", "dsi_sys_clk";
- interrupts = <1>;
- phys = <&dphy0>;
- phy-names = "dphy";
- #address-cells = <1>;
- #size-cells = <0>;
-
- ports {
- #address-cells = <1>;
- #size-cells = <0>;
-
- port@1 {
- reg = <1>;
- dsi0_dpi_input: endpoint {
- remote-endpoint = <&xxx_dpi_output>;
- };
- };
- };
-
- panel: dsi-dev@0 {
- compatible = "<vendor,panel>";
- reg = <0>;
- };
- };
-
-or
-
- dsi0: dsi@fd0c0000 {
- compatible = "cdns,dsi";
- reg = <0x0 0xfd0c0000 0x0 0x1000>;
- clocks = <&pclk>, <&sysclk>;
- clock-names = "dsi_p_clk", "dsi_sys_clk";
- interrupts = <1>;
- phys = <&dphy1>;
- phy-names = "dphy";
- #address-cells = <1>;
- #size-cells = <0>;
-
- ports {
- #address-cells = <1>;
- #size-cells = <0>;
-
- port@0 {
- reg = <0>;
- #address-cells = <1>;
- #size-cells = <0>;
-
- dsi0_output: endpoint@0 {
- reg = <0>;
- remote-endpoint = <&dsi_panel_input>;
- };
- };
-
- port@1 {
- reg = <1>;
- dsi0_dpi_input: endpoint {
- remote-endpoint = <&xxx_dpi_output>;
- };
- };
- };
- };
-
- i2c@xxx {
- panel: panel@59 {
- compatible = "<vendor,panel>";
- reg = <0x59>;
-
- port {
- dsi_panel_input: endpoint {
- remote-endpoint = <&dsi0_output>;
- };
- };
- };
- };
diff --git a/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml b/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
new file mode 100644
index 000000000000..3161c33093c1
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
@@ -0,0 +1,157 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/cdns,dsi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Cadence DSI bridge
+
+maintainers:
+ - Boris Brezillon <boris.brezillon@bootlin.com>
+
+description: |
+ CDNS DSI is a bridge device which converts DPI to DSI
+
+properties:
+ compatible:
+ enum:
+ - cdns,dsi
+
+ reg:
+ maxItems: 1
+
+ clocks:
+ items:
+ - description: PSM clock, used by the IP
+ - description: sys clock, used by the IP
+
+ clock-names:
+ items:
+ - const: dsi_p_clk
+ - const: dsi_sys_clk
+
+ phys:
+ maxItems: 1
+
+ phy-names:
+ const: dphy
+
+ interrupts:
+ maxItems: 1
+
+ resets:
+ maxItems: 1
+
+ reset-names:
+ const: dsi_p_rst
+
+ ports:
+ $ref: /schemas/graph.yaml#/properties/ports
+
+ properties:
+ port@0:
+ $ref: /schemas/graph.yaml#/properties/port
+ description:
+ Output port representing the DSI output. It can have
+ at most 4 endpoints. The endpoint number is directly encoding
+ the DSI virtual channel used by this device.
+
+ port@1:
+ $ref: /schemas/graph.yaml#/properties/port
+ description:
+ Input port representing the DPI input.
+
+ required:
+ - port@1
+
+allOf:
+ - $ref: ../dsi-controller.yaml#
+
+required:
+ - compatible
+ - reg
+ - interrupts
+ - clocks
+ - clock-names
+ - phys
+ - phy-names
+ - ports
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ bus {
+ #address-cells = <2>;
+ #size-cells = <2>;
+
+ dsi@fd0c0000 {
+ compatible = "cdns,dsi";
+ reg = <0x0 0xfd0c0000 0x0 0x1000>;
+ clocks = <&pclk>, <&sysclk>;
+ clock-names = "dsi_p_clk", "dsi_sys_clk";
+ interrupts = <1>;
+ phys = <&dphy0>;
+ phy-names = "dphy";
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@1 {
+ reg = <1>;
+ endpoint {
+ remote-endpoint = <&xxx_dpi_output>;
+ };
+ };
+ };
+
+ panel@0 {
+ compatible = "panasonic,vvx10f034n00";
+ reg = <0>;
+ power-supply = <&vcc_lcd_reg>;
+ };
+ };
+ };
+
+ - |
+ bus {
+ #address-cells = <2>;
+ #size-cells = <2>;
+
+ dsi@fd0c0000 {
+ compatible = "cdns,dsi";
+ reg = <0x0 0xfd0c0000 0x0 0x1000>;
+ clocks = <&pclk>, <&sysclk>;
+ clock-names = "dsi_p_clk", "dsi_sys_clk";
+ interrupts = <1>;
+ phys = <&dphy1>;
+ phy-names = "dphy";
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ endpoint@0 {
+ reg = <0>;
+ remote-endpoint = <&dsi_panel_input>;
+ };
+ };
+
+ port@1 {
+ reg = <1>;
+ endpoint {
+ remote-endpoint = <&xxx_dpi_output>;
+ };
+ };
+ };
+ };
+ };
--
2.39.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v11 2/5] dt-bindings: display: bridge: cdns,dsi: Add compatible for dsi on j721e
2023-01-03 10:19 [PATCH v11 0/5] Add support for CDNS DSI J721E wrapper Rahul T R
2023-01-03 10:19 ` [PATCH v11 1/5] dt-bindings: display: bridge: Convert cdns,dsi.txt to yaml Rahul T R
@ 2023-01-03 10:19 ` Rahul T R
2023-01-17 11:31 ` Andrzej Hajda
2023-01-03 10:19 ` [PATCH v11 3/5] drm/bridge: cdns-dsi: Move to drm/bridge/cadence Rahul T R
` (3 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Rahul T R @ 2023-01-03 10:19 UTC (permalink / raw)
To: dri-devel, robh+dt, krzysztof.kozlowski+dt
Cc: andrzej.hajda, narmstrong, robert.foss, jonas, jernej.skrabec,
airlied, daniel, p.zabel, tomi.valkeinen, laurent.pinchart,
linux-kernel, jpawar, sjakhade, mparab, a-bhatia1, devicetree,
vigneshr, lee.jones, Rahul T R, Rob Herring
Add compatible to support dsi bridge on j721e
Signed-off-by: Rahul T R <r-ravikumar@ti.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
.../bindings/display/bridge/cdns,dsi.yaml | 25 ++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml b/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
index 3161c33093c1..23060324d16e 100644
--- a/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
+++ b/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
@@ -16,9 +16,15 @@ properties:
compatible:
enum:
- cdns,dsi
+ - ti,j721e-dsi
reg:
- maxItems: 1
+ minItems: 1
+ items:
+ - description:
+ Register block for controller's registers.
+ - description:
+ Register block for wrapper settings registers in case of TI J7 SoCs.
clocks:
items:
@@ -67,6 +73,23 @@ properties:
allOf:
- $ref: ../dsi-controller.yaml#
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: ti,j721e-dsi
+ then:
+ properties:
+ reg:
+ minItems: 2
+ maxItems: 2
+ power-domains:
+ maxItems: 1
+ else:
+ properties:
+ reg:
+ maxItems: 1
+
required:
- compatible
- reg
--
2.39.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v11 3/5] drm/bridge: cdns-dsi: Move to drm/bridge/cadence
2023-01-03 10:19 [PATCH v11 0/5] Add support for CDNS DSI J721E wrapper Rahul T R
2023-01-03 10:19 ` [PATCH v11 1/5] dt-bindings: display: bridge: Convert cdns,dsi.txt to yaml Rahul T R
2023-01-03 10:19 ` [PATCH v11 2/5] dt-bindings: display: bridge: cdns,dsi: Add compatible for dsi on j721e Rahul T R
@ 2023-01-03 10:19 ` Rahul T R
2023-01-17 11:31 ` Andrzej Hajda
2023-01-03 10:19 ` [PATCH v11 4/5] drm/bridge: cdns-dsi: Create a header file Rahul T R
` (2 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Rahul T R @ 2023-01-03 10:19 UTC (permalink / raw)
To: dri-devel, robh+dt, krzysztof.kozlowski+dt
Cc: andrzej.hajda, narmstrong, robert.foss, jonas, jernej.skrabec,
airlied, daniel, p.zabel, tomi.valkeinen, laurent.pinchart,
linux-kernel, jpawar, sjakhade, mparab, a-bhatia1, devicetree,
vigneshr, lee.jones, Rahul T R
Move the cadence dsi bridge under drm/bridge/cadence directory, to
prepare for adding j721e wrapper support
Signed-off-by: Rahul T R <r-ravikumar@ti.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/gpu/drm/bridge/Kconfig | 11 -----------
drivers/gpu/drm/bridge/Makefile | 1 -
drivers/gpu/drm/bridge/cadence/Kconfig | 11 +++++++++++
drivers/gpu/drm/bridge/cadence/Makefile | 2 ++
.../bridge/{cdns-dsi.c => cadence/cdns-dsi-core.c} | 0
5 files changed, 13 insertions(+), 12 deletions(-)
rename drivers/gpu/drm/bridge/{cdns-dsi.c => cadence/cdns-dsi-core.c} (100%)
diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 57946d80b02d..8b2226f72b24 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -15,17 +15,6 @@ config DRM_PANEL_BRIDGE
menu "Display Interface Bridges"
depends on DRM && DRM_BRIDGE
-config DRM_CDNS_DSI
- tristate "Cadence DPI/DSI bridge"
- select DRM_KMS_HELPER
- select DRM_MIPI_DSI
- select DRM_PANEL_BRIDGE
- select GENERIC_PHY_MIPI_DPHY
- depends on OF
- help
- Support Cadence DPI to DSI bridge. This is an internal
- bridge and is meant to be directly embedded in a SoC.
-
config DRM_CHIPONE_ICN6211
tristate "Chipone ICN6211 MIPI-DSI/RGB Converter bridge"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 1884803c6860..52f6e8b4a821 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -1,5 +1,4 @@
# SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
obj-$(CONFIG_DRM_CHIPONE_ICN6211) += chipone-icn6211.o
obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
obj-$(CONFIG_DRM_CROS_EC_ANX7688) += cros-ec-anx7688.o
diff --git a/drivers/gpu/drm/bridge/cadence/Kconfig b/drivers/gpu/drm/bridge/cadence/Kconfig
index 1d06182bea71..5f39859dcfdd 100644
--- a/drivers/gpu/drm/bridge/cadence/Kconfig
+++ b/drivers/gpu/drm/bridge/cadence/Kconfig
@@ -1,4 +1,15 @@
# SPDX-License-Identifier: GPL-2.0-only
+config DRM_CDNS_DSI
+ tristate "Cadence DPI/DSI bridge"
+ select DRM_KMS_HELPER
+ select DRM_MIPI_DSI
+ select DRM_PANEL_BRIDGE
+ select GENERIC_PHY_MIPI_DPHY
+ depends on OF
+ help
+ Support Cadence DPI to DSI bridge. This is an internal
+ bridge and is meant to be directly embedded in a SoC.
+
config DRM_CDNS_MHDP8546
tristate "Cadence DPI/DP bridge"
select DRM_DISPLAY_DP_HELPER
diff --git a/drivers/gpu/drm/bridge/cadence/Makefile b/drivers/gpu/drm/bridge/cadence/Makefile
index 4d2db8df1bc6..9e2f34c84480 100644
--- a/drivers/gpu/drm/bridge/cadence/Makefile
+++ b/drivers/gpu/drm/bridge/cadence/Makefile
@@ -1,4 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
+cdns-dsi-y := cdns-dsi-core.o
obj-$(CONFIG_DRM_CDNS_MHDP8546) += cdns-mhdp8546.o
cdns-mhdp8546-y := cdns-mhdp8546-core.o cdns-mhdp8546-hdcp.o
cdns-mhdp8546-$(CONFIG_DRM_CDNS_MHDP8546_J721E) += cdns-mhdp8546-j721e.o
diff --git a/drivers/gpu/drm/bridge/cdns-dsi.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
similarity index 100%
rename from drivers/gpu/drm/bridge/cdns-dsi.c
rename to drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
--
2.39.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v11 4/5] drm/bridge: cdns-dsi: Create a header file
2023-01-03 10:19 [PATCH v11 0/5] Add support for CDNS DSI J721E wrapper Rahul T R
` (2 preceding siblings ...)
2023-01-03 10:19 ` [PATCH v11 3/5] drm/bridge: cdns-dsi: Move to drm/bridge/cadence Rahul T R
@ 2023-01-03 10:19 ` Rahul T R
2023-01-17 11:34 ` Andrzej Hajda
2023-01-03 10:19 ` [PATCH v11 5/5] drm/bridge: cdns-dsi: Add support for J721E wrapper Rahul T R
2023-01-17 12:15 ` [PATCH v11 0/5] Add support for CDNS DSI " Tomi Valkeinen
5 siblings, 1 reply; 13+ messages in thread
From: Rahul T R @ 2023-01-03 10:19 UTC (permalink / raw)
To: dri-devel, robh+dt, krzysztof.kozlowski+dt
Cc: andrzej.hajda, narmstrong, robert.foss, jonas, jernej.skrabec,
airlied, daniel, p.zabel, tomi.valkeinen, laurent.pinchart,
linux-kernel, jpawar, sjakhade, mparab, a-bhatia1, devicetree,
vigneshr, lee.jones, Rahul T R
Create a header file for cdns dsi and move structure definations to
prepare for adding j721e wrapper support
Signed-off-by: Rahul T R <r-ravikumar@ti.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
.../gpu/drm/bridge/cadence/cdns-dsi-core.c | 48 +-------------
.../gpu/drm/bridge/cadence/cdns-dsi-core.h | 64 +++++++++++++++++++
2 files changed, 66 insertions(+), 46 deletions(-)
create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-core.h
diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
index 20bece84ff8c..058349bfeb67 100644
--- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
@@ -6,10 +6,7 @@
*/
#include <drm/drm_atomic_helper.h>
-#include <drm/drm_bridge.h>
#include <drm/drm_drv.h>
-#include <drm/drm_mipi_dsi.h>
-#include <drm/drm_panel.h>
#include <drm/drm_probe_helper.h>
#include <video/mipi_display.h>
@@ -23,9 +20,10 @@
#include <linux/pm_runtime.h>
#include <linux/reset.h>
-#include <linux/phy/phy.h>
#include <linux/phy/phy-mipi-dphy.h>
+#include "cdns-dsi-core.h"
+
#define IP_CONF 0x0
#define SP_HS_FIFO_DEPTH(x) (((x) & GENMASK(30, 26)) >> 26)
#define SP_LP_FIFO_DEPTH(x) (((x) & GENMASK(25, 21)) >> 21)
@@ -424,48 +422,6 @@
#define DSI_NULL_FRAME_OVERHEAD 6
#define DSI_EOT_PKT_SIZE 4
-struct cdns_dsi_output {
- struct mipi_dsi_device *dev;
- struct drm_panel *panel;
- struct drm_bridge *bridge;
- union phy_configure_opts phy_opts;
-};
-
-enum cdns_dsi_input_id {
- CDNS_SDI_INPUT,
- CDNS_DPI_INPUT,
- CDNS_DSC_INPUT,
-};
-
-struct cdns_dsi_cfg {
- unsigned int hfp;
- unsigned int hsa;
- unsigned int hbp;
- unsigned int hact;
- unsigned int htotal;
-};
-
-struct cdns_dsi_input {
- enum cdns_dsi_input_id id;
- struct drm_bridge bridge;
-};
-
-struct cdns_dsi {
- struct mipi_dsi_host base;
- void __iomem *regs;
- struct cdns_dsi_input input;
- struct cdns_dsi_output output;
- unsigned int direct_cmd_fifo_depth;
- unsigned int rx_fifo_depth;
- struct completion direct_cmd_comp;
- struct clk *dsi_p_clk;
- struct reset_control *dsi_p_rst;
- struct clk *dsi_sys_clk;
- bool link_initialized;
- bool phy_initialized;
- struct phy *dphy;
-};
-
static inline struct cdns_dsi *input_to_dsi(struct cdns_dsi_input *input)
{
return container_of(input, struct cdns_dsi, input);
diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.h b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.h
new file mode 100644
index 000000000000..d5bb5caf77b1
--- /dev/null
+++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.h
@@ -0,0 +1,64 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright: 2017 Cadence Design Systems, Inc.
+ *
+ * Author: Boris Brezillon <boris.brezillon@bootlin.com>
+ */
+
+#ifndef __CDNS_DSI_H__
+#define __CDNS_DSI_H__
+
+#include <drm/drm_bridge.h>
+#include <drm/drm_mipi_dsi.h>
+#include <drm/drm_panel.h>
+
+#include <linux/bits.h>
+#include <linux/completion.h>
+#include <linux/phy/phy.h>
+
+struct clk;
+struct reset_control;
+
+struct cdns_dsi_output {
+ struct mipi_dsi_device *dev;
+ struct drm_panel *panel;
+ struct drm_bridge *bridge;
+ union phy_configure_opts phy_opts;
+};
+
+enum cdns_dsi_input_id {
+ CDNS_SDI_INPUT,
+ CDNS_DPI_INPUT,
+ CDNS_DSC_INPUT,
+};
+
+struct cdns_dsi_cfg {
+ unsigned int hfp;
+ unsigned int hsa;
+ unsigned int hbp;
+ unsigned int hact;
+ unsigned int htotal;
+};
+
+struct cdns_dsi_input {
+ enum cdns_dsi_input_id id;
+ struct drm_bridge bridge;
+};
+
+struct cdns_dsi {
+ struct mipi_dsi_host base;
+ void __iomem *regs;
+ struct cdns_dsi_input input;
+ struct cdns_dsi_output output;
+ unsigned int direct_cmd_fifo_depth;
+ unsigned int rx_fifo_depth;
+ struct completion direct_cmd_comp;
+ struct clk *dsi_p_clk;
+ struct reset_control *dsi_p_rst;
+ struct clk *dsi_sys_clk;
+ bool link_initialized;
+ bool phy_initialized;
+ struct phy *dphy;
+};
+
+#endif /* !__CDNS_DSI_H__ */
--
2.39.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v11 5/5] drm/bridge: cdns-dsi: Add support for J721E wrapper
2023-01-03 10:19 [PATCH v11 0/5] Add support for CDNS DSI J721E wrapper Rahul T R
` (3 preceding siblings ...)
2023-01-03 10:19 ` [PATCH v11 4/5] drm/bridge: cdns-dsi: Create a header file Rahul T R
@ 2023-01-03 10:19 ` Rahul T R
2023-01-17 10:47 ` Laurent Pinchart
2023-01-17 11:35 ` Andrzej Hajda
2023-01-17 12:15 ` [PATCH v11 0/5] Add support for CDNS DSI " Tomi Valkeinen
5 siblings, 2 replies; 13+ messages in thread
From: Rahul T R @ 2023-01-03 10:19 UTC (permalink / raw)
To: dri-devel, robh+dt, krzysztof.kozlowski+dt
Cc: andrzej.hajda, narmstrong, robert.foss, jonas, jernej.skrabec,
airlied, daniel, p.zabel, tomi.valkeinen, laurent.pinchart,
linux-kernel, jpawar, sjakhade, mparab, a-bhatia1, devicetree,
vigneshr, lee.jones, Rahul T R
Add support for wrapper settings for DSI bridge on j721e. Also enable
DPI0
--------------- -----------------------
| -------| |------- |
| DSS | DPI2 |----->| DPI0 | DSI Wrapper |
| -------| |------- |
--------------- -----------------------
As shown above DPI2 output of DSS is connected to DPI0 input of DSI
Wrapper, DSI wrapper gives control wheather to enable/disable DPI0
input. In j721e above is the only configuration supported
Signed-off-by: Rahul T R <r-ravikumar@ti.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
drivers/gpu/drm/bridge/cadence/Kconfig | 10 ++++
drivers/gpu/drm/bridge/cadence/Makefile | 1 +
.../gpu/drm/bridge/cadence/cdns-dsi-core.c | 35 ++++++++++++-
.../gpu/drm/bridge/cadence/cdns-dsi-core.h | 20 ++++++++
.../gpu/drm/bridge/cadence/cdns-dsi-j721e.c | 51 +++++++++++++++++++
.../gpu/drm/bridge/cadence/cdns-dsi-j721e.h | 16 ++++++
6 files changed, 132 insertions(+), 1 deletion(-)
create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.c
create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.h
diff --git a/drivers/gpu/drm/bridge/cadence/Kconfig b/drivers/gpu/drm/bridge/cadence/Kconfig
index 5f39859dcfdd..ec35215a2003 100644
--- a/drivers/gpu/drm/bridge/cadence/Kconfig
+++ b/drivers/gpu/drm/bridge/cadence/Kconfig
@@ -10,6 +10,16 @@ config DRM_CDNS_DSI
Support Cadence DPI to DSI bridge. This is an internal
bridge and is meant to be directly embedded in a SoC.
+if DRM_CDNS_DSI
+
+config DRM_CDNS_DSI_J721E
+ bool "J721E Cadence DSI wrapper support"
+ default y
+ help
+ Support J721E Cadence DSI wrapper. The wrapper manages
+ the routing of the DSS DPI signal to the Cadence DSI.
+endif
+
config DRM_CDNS_MHDP8546
tristate "Cadence DPI/DP bridge"
select DRM_DISPLAY_DP_HELPER
diff --git a/drivers/gpu/drm/bridge/cadence/Makefile b/drivers/gpu/drm/bridge/cadence/Makefile
index 9e2f34c84480..c95fd5b81d13 100644
--- a/drivers/gpu/drm/bridge/cadence/Makefile
+++ b/drivers/gpu/drm/bridge/cadence/Makefile
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
cdns-dsi-y := cdns-dsi-core.o
+cdns-dsi-$(CONFIG_DRM_CDNS_DSI_J721E) += cdns-dsi-j721e.o
obj-$(CONFIG_DRM_CDNS_MHDP8546) += cdns-mhdp8546.o
cdns-mhdp8546-y := cdns-mhdp8546-core.o cdns-mhdp8546-hdcp.o
cdns-mhdp8546-$(CONFIG_DRM_CDNS_MHDP8546_J721E) += cdns-mhdp8546-j721e.o
diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
index 058349bfeb67..5dbfc7226b31 100644
--- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
@@ -15,6 +15,7 @@
#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/of_address.h>
+#include <linux/of_device.h>
#include <linux/of_graph.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
@@ -23,6 +24,9 @@
#include <linux/phy/phy-mipi-dphy.h>
#include "cdns-dsi-core.h"
+#ifdef CONFIG_DRM_CDNS_DSI_J721E
+#include "cdns-dsi-j721e.h"
+#endif
#define IP_CONF 0x0
#define SP_HS_FIFO_DEPTH(x) (((x) & GENMASK(30, 26)) >> 26)
@@ -665,6 +669,10 @@ static void cdns_dsi_bridge_disable(struct drm_bridge *bridge)
val = readl(dsi->regs + MCTL_MAIN_EN) & ~IF_EN(input->id);
writel(val, dsi->regs + MCTL_MAIN_EN);
+
+ if (dsi->platform_ops && dsi->platform_ops->disable)
+ dsi->platform_ops->disable(dsi);
+
pm_runtime_put(dsi->base.dev);
}
@@ -760,6 +768,9 @@ static void cdns_dsi_bridge_enable(struct drm_bridge *bridge)
if (WARN_ON(pm_runtime_get_sync(dsi->base.dev) < 0))
return;
+ if (dsi->platform_ops && dsi->platform_ops->enable)
+ dsi->platform_ops->enable(dsi);
+
mode = &bridge->encoder->crtc->state->adjusted_mode;
nlanes = output->dev->lanes;
@@ -1200,6 +1211,8 @@ static int cdns_dsi_drm_probe(struct platform_device *pdev)
goto err_disable_pclk;
}
+ dsi->platform_ops = of_device_get_match_data(&pdev->dev);
+
val = readl(dsi->regs + IP_CONF);
dsi->direct_cmd_fifo_depth = 1 << (DIRCMD_FIFO_DEPTH(val) + 2);
dsi->rx_fifo_depth = RX_FIFO_DEPTH(val);
@@ -1235,14 +1248,27 @@ static int cdns_dsi_drm_probe(struct platform_device *pdev)
dsi->base.dev = &pdev->dev;
dsi->base.ops = &cdns_dsi_ops;
+ if (dsi->platform_ops && dsi->platform_ops->init) {
+ ret = dsi->platform_ops->init(dsi);
+ if (ret != 0) {
+ dev_err(&pdev->dev, "platform initialization failed: %d\n",
+ ret);
+ goto err_disable_runtime_pm;
+ }
+ }
+
ret = mipi_dsi_host_register(&dsi->base);
if (ret)
- goto err_disable_runtime_pm;
+ goto err_deinit_platform;
clk_disable_unprepare(dsi->dsi_p_clk);
return 0;
+err_deinit_platform:
+ if (dsi->platform_ops && dsi->platform_ops->deinit)
+ dsi->platform_ops->deinit(dsi);
+
err_disable_runtime_pm:
pm_runtime_disable(&pdev->dev);
@@ -1257,6 +1283,10 @@ static int cdns_dsi_drm_remove(struct platform_device *pdev)
struct cdns_dsi *dsi = platform_get_drvdata(pdev);
mipi_dsi_host_unregister(&dsi->base);
+
+ if (dsi->platform_ops && dsi->platform_ops->deinit)
+ dsi->platform_ops->deinit(dsi);
+
pm_runtime_disable(&pdev->dev);
return 0;
@@ -1264,6 +1294,9 @@ static int cdns_dsi_drm_remove(struct platform_device *pdev)
static const struct of_device_id cdns_dsi_of_match[] = {
{ .compatible = "cdns,dsi" },
+#ifdef CONFIG_DRM_CDNS_DSI_J721E
+ { .compatible = "ti,j721e-dsi", .data = &dsi_ti_j721e_ops, },
+#endif
{ },
};
MODULE_DEVICE_TABLE(of, cdns_dsi_of_match);
diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.h b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.h
index d5bb5caf77b1..dc05f3ad6951 100644
--- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.h
+++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.h
@@ -45,9 +45,29 @@ struct cdns_dsi_input {
struct drm_bridge bridge;
};
+struct cdns_dsi;
+
+/**
+ * struct cdns_dsi_platform_ops - CDNS DSI Platform operations
+ * @init: Called in the CDNS DSI probe
+ * @deinit: Called in the CDNS DSI remove
+ * @enable: Called at the begining of CDNS DSI bridge enable
+ * @disable: Called at the end of CDNS DSI bridge disable
+ */
+struct cdns_dsi_platform_ops {
+ int (*init)(struct cdns_dsi *dsi);
+ void (*deinit)(struct cdns_dsi *dsi);
+ void (*enable)(struct cdns_dsi *dsi);
+ void (*disable)(struct cdns_dsi *dsi);
+};
+
struct cdns_dsi {
struct mipi_dsi_host base;
void __iomem *regs;
+#ifdef CONFIG_DRM_CDNS_DSI_J721E
+ void __iomem *j721e_regs;
+#endif
+ const struct cdns_dsi_platform_ops *platform_ops;
struct cdns_dsi_input input;
struct cdns_dsi_output output;
unsigned int direct_cmd_fifo_depth;
diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.c
new file mode 100644
index 000000000000..b654d4b3cb5c
--- /dev/null
+++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.c
@@ -0,0 +1,51 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * TI j721e Cadence DSI wrapper
+ *
+ * Copyright (C) 2022 Texas Instruments Incorporated - http://www.ti.com/
+ * Author: Rahul T R <r-ravikumar@ti.com>
+ */
+
+#include <linux/io.h>
+#include <linux/platform_device.h>
+
+#include "cdns-dsi-j721e.h"
+
+#define DSI_WRAP_REVISION 0x0
+#define DSI_WRAP_DPI_CONTROL 0x4
+#define DSI_WRAP_DSC_CONTROL 0x8
+#define DSI_WRAP_DPI_SECURE 0xc
+#define DSI_WRAP_DSI_0_ASF_STATUS 0x10
+
+#define DSI_WRAP_DPI_0_EN BIT(0)
+#define DSI_WRAP_DSI2_MUX_SEL BIT(4)
+
+static int cdns_dsi_j721e_init(struct cdns_dsi *dsi)
+{
+ struct platform_device *pdev = to_platform_device(dsi->base.dev);
+
+ dsi->j721e_regs = devm_platform_ioremap_resource(pdev, 1);
+ return PTR_ERR_OR_ZERO(dsi->j721e_regs);
+}
+
+static void cdns_dsi_j721e_enable(struct cdns_dsi *dsi)
+{
+ /*
+ * Enable DPI0 as its input. DSS0 DPI2 is connected
+ * to DSI DPI0. This is the only supported configuration on
+ * J721E.
+ */
+ writel(DSI_WRAP_DPI_0_EN, dsi->j721e_regs + DSI_WRAP_DPI_CONTROL);
+}
+
+static void cdns_dsi_j721e_disable(struct cdns_dsi *dsi)
+{
+ /* Put everything to defaults */
+ writel(0, dsi->j721e_regs + DSI_WRAP_DPI_CONTROL);
+}
+
+const struct cdns_dsi_platform_ops dsi_ti_j721e_ops = {
+ .init = cdns_dsi_j721e_init,
+ .enable = cdns_dsi_j721e_enable,
+ .disable = cdns_dsi_j721e_disable,
+};
diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.h b/drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.h
new file mode 100644
index 000000000000..275e5e8e7583
--- /dev/null
+++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.h
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * TI j721e Cadence DSI wrapper
+ *
+ * Copyright (C) 2022 Texas Instruments Incorporated - http://www.ti.com/
+ * Author: Rahul T R <r-ravikumar@ti.com>
+ */
+
+#ifndef __CDNS_DSI_J721E_H__
+#define __CDNS_DSI_J721E_H__
+
+#include "cdns-dsi-core.h"
+
+extern const struct cdns_dsi_platform_ops dsi_ti_j721e_ops;
+
+#endif /* !__CDNS_DSI_J721E_H__ */
--
2.39.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v11 5/5] drm/bridge: cdns-dsi: Add support for J721E wrapper
2023-01-03 10:19 ` [PATCH v11 5/5] drm/bridge: cdns-dsi: Add support for J721E wrapper Rahul T R
@ 2023-01-17 10:47 ` Laurent Pinchart
2023-01-17 11:35 ` Andrzej Hajda
1 sibling, 0 replies; 13+ messages in thread
From: Laurent Pinchart @ 2023-01-17 10:47 UTC (permalink / raw)
To: Rahul T R
Cc: dri-devel, robh+dt, krzysztof.kozlowski+dt, andrzej.hajda,
narmstrong, robert.foss, jonas, jernej.skrabec, airlied, daniel,
p.zabel, tomi.valkeinen, linux-kernel, jpawar, sjakhade, mparab,
a-bhatia1, devicetree, vigneshr, lee.jones
Hi Rahul,
Thank you for the patch.
On Tue, Jan 03, 2023 at 03:49:51PM +0530, Rahul T R wrote:
> Add support for wrapper settings for DSI bridge on j721e. Also enable
> DPI0
>
> --------------- -----------------------
> | -------| |------- |
> | DSS | DPI2 |----->| DPI0 | DSI Wrapper |
> | -------| |------- |
> --------------- -----------------------
>
> As shown above DPI2 output of DSS is connected to DPI0 input of DSI
> Wrapper, DSI wrapper gives control wheather to enable/disable DPI0
> input. In j721e above is the only configuration supported
>
> Signed-off-by: Rahul T R <r-ravikumar@ti.com>
> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> drivers/gpu/drm/bridge/cadence/Kconfig | 10 ++++
> drivers/gpu/drm/bridge/cadence/Makefile | 1 +
> .../gpu/drm/bridge/cadence/cdns-dsi-core.c | 35 ++++++++++++-
> .../gpu/drm/bridge/cadence/cdns-dsi-core.h | 20 ++++++++
> .../gpu/drm/bridge/cadence/cdns-dsi-j721e.c | 51 +++++++++++++++++++
> .../gpu/drm/bridge/cadence/cdns-dsi-j721e.h | 16 ++++++
> 6 files changed, 132 insertions(+), 1 deletion(-)
> create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.c
> create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.h
>
> diff --git a/drivers/gpu/drm/bridge/cadence/Kconfig b/drivers/gpu/drm/bridge/cadence/Kconfig
> index 5f39859dcfdd..ec35215a2003 100644
> --- a/drivers/gpu/drm/bridge/cadence/Kconfig
> +++ b/drivers/gpu/drm/bridge/cadence/Kconfig
> @@ -10,6 +10,16 @@ config DRM_CDNS_DSI
> Support Cadence DPI to DSI bridge. This is an internal
> bridge and is meant to be directly embedded in a SoC.
>
> +if DRM_CDNS_DSI
> +
> +config DRM_CDNS_DSI_J721E
> + bool "J721E Cadence DSI wrapper support"
> + default y
> + help
> + Support J721E Cadence DSI wrapper. The wrapper manages
> + the routing of the DSS DPI signal to the Cadence DSI.
> +endif
> +
> config DRM_CDNS_MHDP8546
> tristate "Cadence DPI/DP bridge"
> select DRM_DISPLAY_DP_HELPER
> diff --git a/drivers/gpu/drm/bridge/cadence/Makefile b/drivers/gpu/drm/bridge/cadence/Makefile
> index 9e2f34c84480..c95fd5b81d13 100644
> --- a/drivers/gpu/drm/bridge/cadence/Makefile
> +++ b/drivers/gpu/drm/bridge/cadence/Makefile
> @@ -1,6 +1,7 @@
> # SPDX-License-Identifier: GPL-2.0-only
> obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
> cdns-dsi-y := cdns-dsi-core.o
> +cdns-dsi-$(CONFIG_DRM_CDNS_DSI_J721E) += cdns-dsi-j721e.o
> obj-$(CONFIG_DRM_CDNS_MHDP8546) += cdns-mhdp8546.o
> cdns-mhdp8546-y := cdns-mhdp8546-core.o cdns-mhdp8546-hdcp.o
> cdns-mhdp8546-$(CONFIG_DRM_CDNS_MHDP8546_J721E) += cdns-mhdp8546-j721e.o
> diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> index 058349bfeb67..5dbfc7226b31 100644
> --- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> @@ -15,6 +15,7 @@
> #include <linux/iopoll.h>
> #include <linux/module.h>
> #include <linux/of_address.h>
> +#include <linux/of_device.h>
> #include <linux/of_graph.h>
> #include <linux/platform_device.h>
> #include <linux/pm_runtime.h>
> @@ -23,6 +24,9 @@
> #include <linux/phy/phy-mipi-dphy.h>
>
> #include "cdns-dsi-core.h"
> +#ifdef CONFIG_DRM_CDNS_DSI_J721E
> +#include "cdns-dsi-j721e.h"
> +#endif
>
> #define IP_CONF 0x0
> #define SP_HS_FIFO_DEPTH(x) (((x) & GENMASK(30, 26)) >> 26)
> @@ -665,6 +669,10 @@ static void cdns_dsi_bridge_disable(struct drm_bridge *bridge)
>
> val = readl(dsi->regs + MCTL_MAIN_EN) & ~IF_EN(input->id);
> writel(val, dsi->regs + MCTL_MAIN_EN);
> +
> + if (dsi->platform_ops && dsi->platform_ops->disable)
> + dsi->platform_ops->disable(dsi);
> +
> pm_runtime_put(dsi->base.dev);
> }
>
> @@ -760,6 +768,9 @@ static void cdns_dsi_bridge_enable(struct drm_bridge *bridge)
> if (WARN_ON(pm_runtime_get_sync(dsi->base.dev) < 0))
> return;
>
> + if (dsi->platform_ops && dsi->platform_ops->enable)
> + dsi->platform_ops->enable(dsi);
> +
> mode = &bridge->encoder->crtc->state->adjusted_mode;
> nlanes = output->dev->lanes;
>
> @@ -1200,6 +1211,8 @@ static int cdns_dsi_drm_probe(struct platform_device *pdev)
> goto err_disable_pclk;
> }
>
> + dsi->platform_ops = of_device_get_match_data(&pdev->dev);
> +
> val = readl(dsi->regs + IP_CONF);
> dsi->direct_cmd_fifo_depth = 1 << (DIRCMD_FIFO_DEPTH(val) + 2);
> dsi->rx_fifo_depth = RX_FIFO_DEPTH(val);
> @@ -1235,14 +1248,27 @@ static int cdns_dsi_drm_probe(struct platform_device *pdev)
> dsi->base.dev = &pdev->dev;
> dsi->base.ops = &cdns_dsi_ops;
>
> + if (dsi->platform_ops && dsi->platform_ops->init) {
> + ret = dsi->platform_ops->init(dsi);
> + if (ret != 0) {
> + dev_err(&pdev->dev, "platform initialization failed: %d\n",
> + ret);
> + goto err_disable_runtime_pm;
> + }
> + }
> +
> ret = mipi_dsi_host_register(&dsi->base);
> if (ret)
> - goto err_disable_runtime_pm;
> + goto err_deinit_platform;
>
> clk_disable_unprepare(dsi->dsi_p_clk);
>
> return 0;
>
> +err_deinit_platform:
> + if (dsi->platform_ops && dsi->platform_ops->deinit)
> + dsi->platform_ops->deinit(dsi);
> +
> err_disable_runtime_pm:
> pm_runtime_disable(&pdev->dev);
>
> @@ -1257,6 +1283,10 @@ static int cdns_dsi_drm_remove(struct platform_device *pdev)
> struct cdns_dsi *dsi = platform_get_drvdata(pdev);
>
> mipi_dsi_host_unregister(&dsi->base);
> +
> + if (dsi->platform_ops && dsi->platform_ops->deinit)
> + dsi->platform_ops->deinit(dsi);
> +
> pm_runtime_disable(&pdev->dev);
>
> return 0;
> @@ -1264,6 +1294,9 @@ static int cdns_dsi_drm_remove(struct platform_device *pdev)
>
> static const struct of_device_id cdns_dsi_of_match[] = {
> { .compatible = "cdns,dsi" },
> +#ifdef CONFIG_DRM_CDNS_DSI_J721E
> + { .compatible = "ti,j721e-dsi", .data = &dsi_ti_j721e_ops, },
> +#endif
> { },
> };
> MODULE_DEVICE_TABLE(of, cdns_dsi_of_match);
> diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.h b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.h
> index d5bb5caf77b1..dc05f3ad6951 100644
> --- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.h
> +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.h
> @@ -45,9 +45,29 @@ struct cdns_dsi_input {
> struct drm_bridge bridge;
> };
>
> +struct cdns_dsi;
> +
> +/**
> + * struct cdns_dsi_platform_ops - CDNS DSI Platform operations
> + * @init: Called in the CDNS DSI probe
> + * @deinit: Called in the CDNS DSI remove
> + * @enable: Called at the begining of CDNS DSI bridge enable
> + * @disable: Called at the end of CDNS DSI bridge disable
> + */
> +struct cdns_dsi_platform_ops {
> + int (*init)(struct cdns_dsi *dsi);
> + void (*deinit)(struct cdns_dsi *dsi);
> + void (*enable)(struct cdns_dsi *dsi);
> + void (*disable)(struct cdns_dsi *dsi);
> +};
> +
> struct cdns_dsi {
> struct mipi_dsi_host base;
> void __iomem *regs;
> +#ifdef CONFIG_DRM_CDNS_DSI_J721E
> + void __iomem *j721e_regs;
> +#endif
> + const struct cdns_dsi_platform_ops *platform_ops;
> struct cdns_dsi_input input;
> struct cdns_dsi_output output;
> unsigned int direct_cmd_fifo_depth;
> diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.c
> new file mode 100644
> index 000000000000..b654d4b3cb5c
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.c
> @@ -0,0 +1,51 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * TI j721e Cadence DSI wrapper
> + *
> + * Copyright (C) 2022 Texas Instruments Incorporated - http://www.ti.com/
> + * Author: Rahul T R <r-ravikumar@ti.com>
> + */
> +
> +#include <linux/io.h>
> +#include <linux/platform_device.h>
> +
> +#include "cdns-dsi-j721e.h"
> +
> +#define DSI_WRAP_REVISION 0x0
> +#define DSI_WRAP_DPI_CONTROL 0x4
> +#define DSI_WRAP_DSC_CONTROL 0x8
> +#define DSI_WRAP_DPI_SECURE 0xc
> +#define DSI_WRAP_DSI_0_ASF_STATUS 0x10
> +
> +#define DSI_WRAP_DPI_0_EN BIT(0)
> +#define DSI_WRAP_DSI2_MUX_SEL BIT(4)
> +
> +static int cdns_dsi_j721e_init(struct cdns_dsi *dsi)
> +{
> + struct platform_device *pdev = to_platform_device(dsi->base.dev);
> +
> + dsi->j721e_regs = devm_platform_ioremap_resource(pdev, 1);
> + return PTR_ERR_OR_ZERO(dsi->j721e_regs);
> +}
> +
> +static void cdns_dsi_j721e_enable(struct cdns_dsi *dsi)
> +{
> + /*
> + * Enable DPI0 as its input. DSS0 DPI2 is connected
> + * to DSI DPI0. This is the only supported configuration on
> + * J721E.
> + */
> + writel(DSI_WRAP_DPI_0_EN, dsi->j721e_regs + DSI_WRAP_DPI_CONTROL);
> +}
> +
> +static void cdns_dsi_j721e_disable(struct cdns_dsi *dsi)
> +{
> + /* Put everything to defaults */
> + writel(0, dsi->j721e_regs + DSI_WRAP_DPI_CONTROL);
> +}
> +
> +const struct cdns_dsi_platform_ops dsi_ti_j721e_ops = {
> + .init = cdns_dsi_j721e_init,
> + .enable = cdns_dsi_j721e_enable,
> + .disable = cdns_dsi_j721e_disable,
> +};
> diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.h b/drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.h
> new file mode 100644
> index 000000000000..275e5e8e7583
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.h
> @@ -0,0 +1,16 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * TI j721e Cadence DSI wrapper
> + *
> + * Copyright (C) 2022 Texas Instruments Incorporated - http://www.ti.com/
> + * Author: Rahul T R <r-ravikumar@ti.com>
> + */
> +
> +#ifndef __CDNS_DSI_J721E_H__
> +#define __CDNS_DSI_J721E_H__
> +
> +#include "cdns-dsi-core.h"
> +
> +extern const struct cdns_dsi_platform_ops dsi_ti_j721e_ops;
> +
> +#endif /* !__CDNS_DSI_J721E_H__ */
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v11 1/5] dt-bindings: display: bridge: Convert cdns,dsi.txt to yaml
2023-01-03 10:19 ` [PATCH v11 1/5] dt-bindings: display: bridge: Convert cdns,dsi.txt to yaml Rahul T R
@ 2023-01-17 11:30 ` Andrzej Hajda
0 siblings, 0 replies; 13+ messages in thread
From: Andrzej Hajda @ 2023-01-17 11:30 UTC (permalink / raw)
To: Rahul T R, dri-devel, robh+dt, krzysztof.kozlowski+dt
Cc: narmstrong, robert.foss, jonas, jernej.skrabec, airlied, daniel,
p.zabel, tomi.valkeinen, laurent.pinchart, linux-kernel, jpawar,
sjakhade, mparab, a-bhatia1, devicetree, vigneshr, lee.jones,
Rob Herring
On 03.01.2023 11:19, Rahul T R wrote:
> Convert cdns,dsi.txt binding to yaml format
>
> Signed-off-by: Rahul T R <r-ravikumar@ti.com>
> Reviewed-by: Rob Herring <robh@kernel.org>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Regards
Andrzej
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v11 2/5] dt-bindings: display: bridge: cdns,dsi: Add compatible for dsi on j721e
2023-01-03 10:19 ` [PATCH v11 2/5] dt-bindings: display: bridge: cdns,dsi: Add compatible for dsi on j721e Rahul T R
@ 2023-01-17 11:31 ` Andrzej Hajda
0 siblings, 0 replies; 13+ messages in thread
From: Andrzej Hajda @ 2023-01-17 11:31 UTC (permalink / raw)
To: Rahul T R, dri-devel, robh+dt, krzysztof.kozlowski+dt
Cc: narmstrong, robert.foss, jonas, jernej.skrabec, airlied, daniel,
p.zabel, tomi.valkeinen, laurent.pinchart, linux-kernel, jpawar,
sjakhade, mparab, a-bhatia1, devicetree, vigneshr, lee.jones,
Rob Herring
On 03.01.2023 11:19, Rahul T R wrote:
> Add compatible to support dsi bridge on j721e
>
> Signed-off-by: Rahul T R <r-ravikumar@ti.com>
> Reviewed-by: Rob Herring <robh@kernel.org>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Regards
Andrzej
> ---
> .../bindings/display/bridge/cdns,dsi.yaml | 25 ++++++++++++++++++-
> 1 file changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml b/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
> index 3161c33093c1..23060324d16e 100644
> --- a/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
> +++ b/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
> @@ -16,9 +16,15 @@ properties:
> compatible:
> enum:
> - cdns,dsi
> + - ti,j721e-dsi
>
> reg:
> - maxItems: 1
> + minItems: 1
> + items:
> + - description:
> + Register block for controller's registers.
> + - description:
> + Register block for wrapper settings registers in case of TI J7 SoCs.
>
> clocks:
> items:
> @@ -67,6 +73,23 @@ properties:
> allOf:
> - $ref: ../dsi-controller.yaml#
>
> + - if:
> + properties:
> + compatible:
> + contains:
> + const: ti,j721e-dsi
> + then:
> + properties:
> + reg:
> + minItems: 2
> + maxItems: 2
> + power-domains:
> + maxItems: 1
> + else:
> + properties:
> + reg:
> + maxItems: 1
> +
> required:
> - compatible
> - reg
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v11 3/5] drm/bridge: cdns-dsi: Move to drm/bridge/cadence
2023-01-03 10:19 ` [PATCH v11 3/5] drm/bridge: cdns-dsi: Move to drm/bridge/cadence Rahul T R
@ 2023-01-17 11:31 ` Andrzej Hajda
0 siblings, 0 replies; 13+ messages in thread
From: Andrzej Hajda @ 2023-01-17 11:31 UTC (permalink / raw)
To: Rahul T R, dri-devel, robh+dt, krzysztof.kozlowski+dt
Cc: narmstrong, robert.foss, jonas, jernej.skrabec, airlied, daniel,
p.zabel, tomi.valkeinen, laurent.pinchart, linux-kernel, jpawar,
sjakhade, mparab, a-bhatia1, devicetree, vigneshr, lee.jones
On 03.01.2023 11:19, Rahul T R wrote:
> Move the cadence dsi bridge under drm/bridge/cadence directory, to
> prepare for adding j721e wrapper support
>
> Signed-off-by: Rahul T R <r-ravikumar@ti.com>
> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Regards
Andrzej
> ---
> drivers/gpu/drm/bridge/Kconfig | 11 -----------
> drivers/gpu/drm/bridge/Makefile | 1 -
> drivers/gpu/drm/bridge/cadence/Kconfig | 11 +++++++++++
> drivers/gpu/drm/bridge/cadence/Makefile | 2 ++
> .../bridge/{cdns-dsi.c => cadence/cdns-dsi-core.c} | 0
> 5 files changed, 13 insertions(+), 12 deletions(-)
> rename drivers/gpu/drm/bridge/{cdns-dsi.c => cadence/cdns-dsi-core.c} (100%)
>
> diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
> index 57946d80b02d..8b2226f72b24 100644
> --- a/drivers/gpu/drm/bridge/Kconfig
> +++ b/drivers/gpu/drm/bridge/Kconfig
> @@ -15,17 +15,6 @@ config DRM_PANEL_BRIDGE
> menu "Display Interface Bridges"
> depends on DRM && DRM_BRIDGE
>
> -config DRM_CDNS_DSI
> - tristate "Cadence DPI/DSI bridge"
> - select DRM_KMS_HELPER
> - select DRM_MIPI_DSI
> - select DRM_PANEL_BRIDGE
> - select GENERIC_PHY_MIPI_DPHY
> - depends on OF
> - help
> - Support Cadence DPI to DSI bridge. This is an internal
> - bridge and is meant to be directly embedded in a SoC.
> -
> config DRM_CHIPONE_ICN6211
> tristate "Chipone ICN6211 MIPI-DSI/RGB Converter bridge"
> depends on OF
> diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
> index 1884803c6860..52f6e8b4a821 100644
> --- a/drivers/gpu/drm/bridge/Makefile
> +++ b/drivers/gpu/drm/bridge/Makefile
> @@ -1,5 +1,4 @@
> # SPDX-License-Identifier: GPL-2.0
> -obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
> obj-$(CONFIG_DRM_CHIPONE_ICN6211) += chipone-icn6211.o
> obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
> obj-$(CONFIG_DRM_CROS_EC_ANX7688) += cros-ec-anx7688.o
> diff --git a/drivers/gpu/drm/bridge/cadence/Kconfig b/drivers/gpu/drm/bridge/cadence/Kconfig
> index 1d06182bea71..5f39859dcfdd 100644
> --- a/drivers/gpu/drm/bridge/cadence/Kconfig
> +++ b/drivers/gpu/drm/bridge/cadence/Kconfig
> @@ -1,4 +1,15 @@
> # SPDX-License-Identifier: GPL-2.0-only
> +config DRM_CDNS_DSI
> + tristate "Cadence DPI/DSI bridge"
> + select DRM_KMS_HELPER
> + select DRM_MIPI_DSI
> + select DRM_PANEL_BRIDGE
> + select GENERIC_PHY_MIPI_DPHY
> + depends on OF
> + help
> + Support Cadence DPI to DSI bridge. This is an internal
> + bridge and is meant to be directly embedded in a SoC.
> +
> config DRM_CDNS_MHDP8546
> tristate "Cadence DPI/DP bridge"
> select DRM_DISPLAY_DP_HELPER
> diff --git a/drivers/gpu/drm/bridge/cadence/Makefile b/drivers/gpu/drm/bridge/cadence/Makefile
> index 4d2db8df1bc6..9e2f34c84480 100644
> --- a/drivers/gpu/drm/bridge/cadence/Makefile
> +++ b/drivers/gpu/drm/bridge/cadence/Makefile
> @@ -1,4 +1,6 @@
> # SPDX-License-Identifier: GPL-2.0-only
> +obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
> +cdns-dsi-y := cdns-dsi-core.o
> obj-$(CONFIG_DRM_CDNS_MHDP8546) += cdns-mhdp8546.o
> cdns-mhdp8546-y := cdns-mhdp8546-core.o cdns-mhdp8546-hdcp.o
> cdns-mhdp8546-$(CONFIG_DRM_CDNS_MHDP8546_J721E) += cdns-mhdp8546-j721e.o
> diff --git a/drivers/gpu/drm/bridge/cdns-dsi.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> similarity index 100%
> rename from drivers/gpu/drm/bridge/cdns-dsi.c
> rename to drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v11 4/5] drm/bridge: cdns-dsi: Create a header file
2023-01-03 10:19 ` [PATCH v11 4/5] drm/bridge: cdns-dsi: Create a header file Rahul T R
@ 2023-01-17 11:34 ` Andrzej Hajda
0 siblings, 0 replies; 13+ messages in thread
From: Andrzej Hajda @ 2023-01-17 11:34 UTC (permalink / raw)
To: Rahul T R, dri-devel, robh+dt, krzysztof.kozlowski+dt
Cc: narmstrong, robert.foss, jonas, jernej.skrabec, airlied, daniel,
p.zabel, tomi.valkeinen, laurent.pinchart, linux-kernel, jpawar,
sjakhade, mparab, a-bhatia1, devicetree, vigneshr, lee.jones
On 03.01.2023 11:19, Rahul T R wrote:
> Create a header file for cdns dsi and move structure definations to
> prepare for adding j721e wrapper support
>
> Signed-off-by: Rahul T R <r-ravikumar@ti.com>
> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Regards
Andrzej
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v11 5/5] drm/bridge: cdns-dsi: Add support for J721E wrapper
2023-01-03 10:19 ` [PATCH v11 5/5] drm/bridge: cdns-dsi: Add support for J721E wrapper Rahul T R
2023-01-17 10:47 ` Laurent Pinchart
@ 2023-01-17 11:35 ` Andrzej Hajda
1 sibling, 0 replies; 13+ messages in thread
From: Andrzej Hajda @ 2023-01-17 11:35 UTC (permalink / raw)
To: Rahul T R, dri-devel, robh+dt, krzysztof.kozlowski+dt
Cc: narmstrong, robert.foss, jonas, jernej.skrabec, airlied, daniel,
p.zabel, tomi.valkeinen, laurent.pinchart, linux-kernel, jpawar,
sjakhade, mparab, a-bhatia1, devicetree, vigneshr, lee.jones
On 03.01.2023 11:19, Rahul T R wrote:
> Add support for wrapper settings for DSI bridge on j721e. Also enable
> DPI0
>
> --------------- -----------------------
> | -------| |------- |
> | DSS | DPI2 |----->| DPI0 | DSI Wrapper |
> | -------| |------- |
> --------------- -----------------------
>
> As shown above DPI2 output of DSS is connected to DPI0 input of DSI
> Wrapper, DSI wrapper gives control wheather to enable/disable DPI0
> input. In j721e above is the only configuration supported
>
> Signed-off-by: Rahul T R <r-ravikumar@ti.com>
> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Regards
Andrzej
> ---
> drivers/gpu/drm/bridge/cadence/Kconfig | 10 ++++
> drivers/gpu/drm/bridge/cadence/Makefile | 1 +
> .../gpu/drm/bridge/cadence/cdns-dsi-core.c | 35 ++++++++++++-
> .../gpu/drm/bridge/cadence/cdns-dsi-core.h | 20 ++++++++
> .../gpu/drm/bridge/cadence/cdns-dsi-j721e.c | 51 +++++++++++++++++++
> .../gpu/drm/bridge/cadence/cdns-dsi-j721e.h | 16 ++++++
> 6 files changed, 132 insertions(+), 1 deletion(-)
> create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.c
> create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.h
>
> diff --git a/drivers/gpu/drm/bridge/cadence/Kconfig b/drivers/gpu/drm/bridge/cadence/Kconfig
> index 5f39859dcfdd..ec35215a2003 100644
> --- a/drivers/gpu/drm/bridge/cadence/Kconfig
> +++ b/drivers/gpu/drm/bridge/cadence/Kconfig
> @@ -10,6 +10,16 @@ config DRM_CDNS_DSI
> Support Cadence DPI to DSI bridge. This is an internal
> bridge and is meant to be directly embedded in a SoC.
>
> +if DRM_CDNS_DSI
> +
> +config DRM_CDNS_DSI_J721E
> + bool "J721E Cadence DSI wrapper support"
> + default y
> + help
> + Support J721E Cadence DSI wrapper. The wrapper manages
> + the routing of the DSS DPI signal to the Cadence DSI.
> +endif
> +
> config DRM_CDNS_MHDP8546
> tristate "Cadence DPI/DP bridge"
> select DRM_DISPLAY_DP_HELPER
> diff --git a/drivers/gpu/drm/bridge/cadence/Makefile b/drivers/gpu/drm/bridge/cadence/Makefile
> index 9e2f34c84480..c95fd5b81d13 100644
> --- a/drivers/gpu/drm/bridge/cadence/Makefile
> +++ b/drivers/gpu/drm/bridge/cadence/Makefile
> @@ -1,6 +1,7 @@
> # SPDX-License-Identifier: GPL-2.0-only
> obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
> cdns-dsi-y := cdns-dsi-core.o
> +cdns-dsi-$(CONFIG_DRM_CDNS_DSI_J721E) += cdns-dsi-j721e.o
> obj-$(CONFIG_DRM_CDNS_MHDP8546) += cdns-mhdp8546.o
> cdns-mhdp8546-y := cdns-mhdp8546-core.o cdns-mhdp8546-hdcp.o
> cdns-mhdp8546-$(CONFIG_DRM_CDNS_MHDP8546_J721E) += cdns-mhdp8546-j721e.o
> diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> index 058349bfeb67..5dbfc7226b31 100644
> --- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> @@ -15,6 +15,7 @@
> #include <linux/iopoll.h>
> #include <linux/module.h>
> #include <linux/of_address.h>
> +#include <linux/of_device.h>
> #include <linux/of_graph.h>
> #include <linux/platform_device.h>
> #include <linux/pm_runtime.h>
> @@ -23,6 +24,9 @@
> #include <linux/phy/phy-mipi-dphy.h>
>
> #include "cdns-dsi-core.h"
> +#ifdef CONFIG_DRM_CDNS_DSI_J721E
> +#include "cdns-dsi-j721e.h"
> +#endif
>
> #define IP_CONF 0x0
> #define SP_HS_FIFO_DEPTH(x) (((x) & GENMASK(30, 26)) >> 26)
> @@ -665,6 +669,10 @@ static void cdns_dsi_bridge_disable(struct drm_bridge *bridge)
>
> val = readl(dsi->regs + MCTL_MAIN_EN) & ~IF_EN(input->id);
> writel(val, dsi->regs + MCTL_MAIN_EN);
> +
> + if (dsi->platform_ops && dsi->platform_ops->disable)
> + dsi->platform_ops->disable(dsi);
> +
> pm_runtime_put(dsi->base.dev);
> }
>
> @@ -760,6 +768,9 @@ static void cdns_dsi_bridge_enable(struct drm_bridge *bridge)
> if (WARN_ON(pm_runtime_get_sync(dsi->base.dev) < 0))
> return;
>
> + if (dsi->platform_ops && dsi->platform_ops->enable)
> + dsi->platform_ops->enable(dsi);
> +
> mode = &bridge->encoder->crtc->state->adjusted_mode;
> nlanes = output->dev->lanes;
>
> @@ -1200,6 +1211,8 @@ static int cdns_dsi_drm_probe(struct platform_device *pdev)
> goto err_disable_pclk;
> }
>
> + dsi->platform_ops = of_device_get_match_data(&pdev->dev);
> +
> val = readl(dsi->regs + IP_CONF);
> dsi->direct_cmd_fifo_depth = 1 << (DIRCMD_FIFO_DEPTH(val) + 2);
> dsi->rx_fifo_depth = RX_FIFO_DEPTH(val);
> @@ -1235,14 +1248,27 @@ static int cdns_dsi_drm_probe(struct platform_device *pdev)
> dsi->base.dev = &pdev->dev;
> dsi->base.ops = &cdns_dsi_ops;
>
> + if (dsi->platform_ops && dsi->platform_ops->init) {
> + ret = dsi->platform_ops->init(dsi);
> + if (ret != 0) {
> + dev_err(&pdev->dev, "platform initialization failed: %d\n",
> + ret);
> + goto err_disable_runtime_pm;
> + }
> + }
> +
> ret = mipi_dsi_host_register(&dsi->base);
> if (ret)
> - goto err_disable_runtime_pm;
> + goto err_deinit_platform;
>
> clk_disable_unprepare(dsi->dsi_p_clk);
>
> return 0;
>
> +err_deinit_platform:
> + if (dsi->platform_ops && dsi->platform_ops->deinit)
> + dsi->platform_ops->deinit(dsi);
> +
> err_disable_runtime_pm:
> pm_runtime_disable(&pdev->dev);
>
> @@ -1257,6 +1283,10 @@ static int cdns_dsi_drm_remove(struct platform_device *pdev)
> struct cdns_dsi *dsi = platform_get_drvdata(pdev);
>
> mipi_dsi_host_unregister(&dsi->base);
> +
> + if (dsi->platform_ops && dsi->platform_ops->deinit)
> + dsi->platform_ops->deinit(dsi);
> +
> pm_runtime_disable(&pdev->dev);
>
> return 0;
> @@ -1264,6 +1294,9 @@ static int cdns_dsi_drm_remove(struct platform_device *pdev)
>
> static const struct of_device_id cdns_dsi_of_match[] = {
> { .compatible = "cdns,dsi" },
> +#ifdef CONFIG_DRM_CDNS_DSI_J721E
> + { .compatible = "ti,j721e-dsi", .data = &dsi_ti_j721e_ops, },
> +#endif
> { },
> };
> MODULE_DEVICE_TABLE(of, cdns_dsi_of_match);
> diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.h b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.h
> index d5bb5caf77b1..dc05f3ad6951 100644
> --- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.h
> +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.h
> @@ -45,9 +45,29 @@ struct cdns_dsi_input {
> struct drm_bridge bridge;
> };
>
> +struct cdns_dsi;
> +
> +/**
> + * struct cdns_dsi_platform_ops - CDNS DSI Platform operations
> + * @init: Called in the CDNS DSI probe
> + * @deinit: Called in the CDNS DSI remove
> + * @enable: Called at the begining of CDNS DSI bridge enable
> + * @disable: Called at the end of CDNS DSI bridge disable
> + */
> +struct cdns_dsi_platform_ops {
> + int (*init)(struct cdns_dsi *dsi);
> + void (*deinit)(struct cdns_dsi *dsi);
> + void (*enable)(struct cdns_dsi *dsi);
> + void (*disable)(struct cdns_dsi *dsi);
> +};
> +
> struct cdns_dsi {
> struct mipi_dsi_host base;
> void __iomem *regs;
> +#ifdef CONFIG_DRM_CDNS_DSI_J721E
> + void __iomem *j721e_regs;
> +#endif
> + const struct cdns_dsi_platform_ops *platform_ops;
> struct cdns_dsi_input input;
> struct cdns_dsi_output output;
> unsigned int direct_cmd_fifo_depth;
> diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.c
> new file mode 100644
> index 000000000000..b654d4b3cb5c
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.c
> @@ -0,0 +1,51 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * TI j721e Cadence DSI wrapper
> + *
> + * Copyright (C) 2022 Texas Instruments Incorporated - http://www.ti.com/
> + * Author: Rahul T R <r-ravikumar@ti.com>
> + */
> +
> +#include <linux/io.h>
> +#include <linux/platform_device.h>
> +
> +#include "cdns-dsi-j721e.h"
> +
> +#define DSI_WRAP_REVISION 0x0
> +#define DSI_WRAP_DPI_CONTROL 0x4
> +#define DSI_WRAP_DSC_CONTROL 0x8
> +#define DSI_WRAP_DPI_SECURE 0xc
> +#define DSI_WRAP_DSI_0_ASF_STATUS 0x10
> +
> +#define DSI_WRAP_DPI_0_EN BIT(0)
> +#define DSI_WRAP_DSI2_MUX_SEL BIT(4)
> +
> +static int cdns_dsi_j721e_init(struct cdns_dsi *dsi)
> +{
> + struct platform_device *pdev = to_platform_device(dsi->base.dev);
> +
> + dsi->j721e_regs = devm_platform_ioremap_resource(pdev, 1);
> + return PTR_ERR_OR_ZERO(dsi->j721e_regs);
> +}
> +
> +static void cdns_dsi_j721e_enable(struct cdns_dsi *dsi)
> +{
> + /*
> + * Enable DPI0 as its input. DSS0 DPI2 is connected
> + * to DSI DPI0. This is the only supported configuration on
> + * J721E.
> + */
> + writel(DSI_WRAP_DPI_0_EN, dsi->j721e_regs + DSI_WRAP_DPI_CONTROL);
> +}
> +
> +static void cdns_dsi_j721e_disable(struct cdns_dsi *dsi)
> +{
> + /* Put everything to defaults */
> + writel(0, dsi->j721e_regs + DSI_WRAP_DPI_CONTROL);
> +}
> +
> +const struct cdns_dsi_platform_ops dsi_ti_j721e_ops = {
> + .init = cdns_dsi_j721e_init,
> + .enable = cdns_dsi_j721e_enable,
> + .disable = cdns_dsi_j721e_disable,
> +};
> diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.h b/drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.h
> new file mode 100644
> index 000000000000..275e5e8e7583
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.h
> @@ -0,0 +1,16 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * TI j721e Cadence DSI wrapper
> + *
> + * Copyright (C) 2022 Texas Instruments Incorporated - http://www.ti.com/
> + * Author: Rahul T R <r-ravikumar@ti.com>
> + */
> +
> +#ifndef __CDNS_DSI_J721E_H__
> +#define __CDNS_DSI_J721E_H__
> +
> +#include "cdns-dsi-core.h"
> +
> +extern const struct cdns_dsi_platform_ops dsi_ti_j721e_ops;
> +
> +#endif /* !__CDNS_DSI_J721E_H__ */
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v11 0/5] Add support for CDNS DSI J721E wrapper
2023-01-03 10:19 [PATCH v11 0/5] Add support for CDNS DSI J721E wrapper Rahul T R
` (4 preceding siblings ...)
2023-01-03 10:19 ` [PATCH v11 5/5] drm/bridge: cdns-dsi: Add support for J721E wrapper Rahul T R
@ 2023-01-17 12:15 ` Tomi Valkeinen
5 siblings, 0 replies; 13+ messages in thread
From: Tomi Valkeinen @ 2023-01-17 12:15 UTC (permalink / raw)
To: Rahul T R, dri-devel, robh+dt, krzysztof.kozlowski+dt
Cc: andrzej.hajda, narmstrong, robert.foss, jonas, jernej.skrabec,
airlied, daniel, p.zabel, laurent.pinchart, linux-kernel, jpawar,
sjakhade, mparab, a-bhatia1, devicetree, vigneshr, lee.jones
Hi,
On 03/01/2023 12:19, Rahul T R wrote:
> Following series of patches adds supports for CDNS DSI
> bridge on j721e.
>
> v11:
> - Wrap commmit messages at 72 chars
> - Fix the order in Kconfig and Makefile
> - Clean up the includes, move macros and some headers to .c file
> - Add missing forward declarations
> - Add __ prefix to header gaurds
> - Change dsi_platform_ops to cdns_dsi_platform_ops
> - Add documentation to struct cdns_dsi_platform_ops
>
> v10:
> - Rebased to v6.2-rc1
> - Accumulated the Reviewed-by acks
>
> v9:
> - Fixed below based on review comments in v8
> - Added more info on wrapper in the commit message
> - Fixed the description in Kconfig
> - Fixed the formatting of of_match table
> - exit -> deinit in platform ops
> - Remove duplicate of struct declaration in cdns-dsi-j721e.h
>
> v8:
> - Rebased to 6.1-rc1
>
> v7:
> - Rebased to next-20220920
> - Accumulated the Reviewed-by acks
>
> v6:
> - Dropped generic definations for properties like reg, resets etc..
> - Fixed the defination for port@0 and port@1
> - removed the ti,sn65dsi86 node from the example, which is not related
>
> v5:
> - Remove power-domain property in the conversion commit
> - Add power-domain only for j721e compatible
> - Fix white space error in one of the commit
>
> v4:
> - split conversion txt to yaml
> - seperate commit for addinig new compatible
> - conditionally limit the items for reg property, based on the compatible
>
> v3:
> - Convert cdns-dsi.txt binding to yaml
> - Move the bridge under display/bridge/cadence
> - Add new compatible to enable the wrapper module
>
> v2:
> - Moved setting DPI0 to bridge_enable, since it
> should be done after pm_runtime_get
>
> Rahul T R (5):
> dt-bindings: display: bridge: Convert cdns,dsi.txt to yaml
> dt-bindings: display: bridge: cdns,dsi: Add compatible for dsi on
> j721e
> drm/bridge: cdns-dsi: Move to drm/bridge/cadence
> drm/bridge: cdns-dsi: Create a header file
> drm/bridge: cdns-dsi: Add support for J721E wrapper
>
> .../bindings/display/bridge/cdns,dsi.txt | 112 -----------
> .../bindings/display/bridge/cdns,dsi.yaml | 180 ++++++++++++++++++
> drivers/gpu/drm/bridge/Kconfig | 11 --
> drivers/gpu/drm/bridge/Makefile | 1 -
> drivers/gpu/drm/bridge/cadence/Kconfig | 21 ++
> drivers/gpu/drm/bridge/cadence/Makefile | 3 +
> .../{cdns-dsi.c => cadence/cdns-dsi-core.c} | 83 ++++----
> .../gpu/drm/bridge/cadence/cdns-dsi-core.h | 84 ++++++++
> .../gpu/drm/bridge/cadence/cdns-dsi-j721e.c | 51 +++++
> .../gpu/drm/bridge/cadence/cdns-dsi-j721e.h | 16 ++
> 10 files changed, 391 insertions(+), 171 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/display/bridge/cdns,dsi.txt
> create mode 100644 Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
> rename drivers/gpu/drm/bridge/{cdns-dsi.c => cadence/cdns-dsi-core.c} (97%)
> create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-core.h
> create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.c
> create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-j721e.h
>
Looks good to me. As Andrzej gave his Rb, I presume it's fine for me to
push this to drm-misc-next. I'll do this a bit later today.
There was a small typo in the 5th patch, about which checkpatch gave a
warning. I'll fix that while applying.
Tomi
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2023-01-17 12:16 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-03 10:19 [PATCH v11 0/5] Add support for CDNS DSI J721E wrapper Rahul T R
2023-01-03 10:19 ` [PATCH v11 1/5] dt-bindings: display: bridge: Convert cdns,dsi.txt to yaml Rahul T R
2023-01-17 11:30 ` Andrzej Hajda
2023-01-03 10:19 ` [PATCH v11 2/5] dt-bindings: display: bridge: cdns,dsi: Add compatible for dsi on j721e Rahul T R
2023-01-17 11:31 ` Andrzej Hajda
2023-01-03 10:19 ` [PATCH v11 3/5] drm/bridge: cdns-dsi: Move to drm/bridge/cadence Rahul T R
2023-01-17 11:31 ` Andrzej Hajda
2023-01-03 10:19 ` [PATCH v11 4/5] drm/bridge: cdns-dsi: Create a header file Rahul T R
2023-01-17 11:34 ` Andrzej Hajda
2023-01-03 10:19 ` [PATCH v11 5/5] drm/bridge: cdns-dsi: Add support for J721E wrapper Rahul T R
2023-01-17 10:47 ` Laurent Pinchart
2023-01-17 11:35 ` Andrzej Hajda
2023-01-17 12:15 ` [PATCH v11 0/5] Add support for CDNS DSI " Tomi Valkeinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).