This serie introduces a new DRM bridge driver for STM32MP257 platforms
based on Arm Cortex-35. It also adds an instance in the device-tree and
handle the inclusion of the driver within the DRM framework. First patch
adds a new panel compatible in the panel-lvds driver, which is used by
default on the STM32MP257.
Changes in v6:
- [1/3] Added Conor's Reviewed-by
- [2/3] Fixed kernel test robot warnings
- Rebased on latest drm-misc-next
Changes in v5:
- Fixed path in MAINTAINERS
- Fixed compatible in driver
Changes in v4:
- Align dt-bindings filename and compatible
- Remove redundant word in [1/6] subject
- Fix example on typo
- Some minor fixes on YAML syntax
- Explicitly include linux/platform_device.h
- Drop device-tree related patch after internal discussions
- Rebase on latest drm-misc-next
Changes in v3:
- Changed the compatible to show SoC specificity
- Fixed includes in dt-binding example
- Added "#clock-cells" description in dt-binding example
- Some minor fixes on typo
Changes in v2:
- Dropped [1/8] because already merged
- Dropped [4/8] since not mandatory for this serie
- [1/6]: Switch compatible and clock-cells related areas
- [1/6]: Remove faulty #include in the example.
- [1/6]: Add missing entry in MAINTAINERS
- [2/6]: Removed CamelCase macros
- [2/6]: Removed hard to read debug log
- [3/6]: Fixed my address
- [3/6]: Fixed smatch warning
- [5/6]: Move changes to stm32mp255.dtsi
Signed-off-by: Raphael Gallais-Pou <[email protected]>
---
Raphael Gallais-Pou (3):
dt-bindings: display: add STM32 LVDS device
drm/stm: lvds: add new STM32 LVDS Display Interface Transmitter driver
drm/stm: ltdc: add lvds pixel clock
.../bindings/display/st,stm32mp25-lvds.yaml | 119 ++
MAINTAINERS | 1 +
drivers/gpu/drm/stm/Kconfig | 11 +
drivers/gpu/drm/stm/Makefile | 2 +
drivers/gpu/drm/stm/ltdc.c | 19 +
drivers/gpu/drm/stm/ltdc.h | 1 +
drivers/gpu/drm/stm/lvds.c | 1226 ++++++++++++++++++++
7 files changed, 1379 insertions(+)
---
base-commit: de8de2c8acb931ce6197a04376a7078ccf50e821
change-id: 20240205-lvds-e084ec50e878
Best regards,
--
Raphael Gallais-Pou <[email protected]>
The STM32MP25x display subsystem presents a mux which feeds the loopback
pixel clock of the current bridge in use into the LTDC. This mux is only
accessible through sysconfig registers which is not yet available in the
STM32MP25x common clock framework.
While waiting for a complete update of the clock framework, this would
allow to use the LVDS.
Signed-off-by: Raphael Gallais-Pou <[email protected]>
Signed-off-by: Yannick Fertre <[email protected]>
---
Changes in v2:
- Fixed my address
- Fixed smatch warning
---
drivers/gpu/drm/stm/ltdc.c | 19 +++++++++++++++++++
drivers/gpu/drm/stm/ltdc.h | 1 +
2 files changed, 20 insertions(+)
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 5576fdae4962..23011a8913bd 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -838,6 +838,12 @@ ltdc_crtc_mode_valid(struct drm_crtc *crtc,
int target_max = target + CLK_TOLERANCE_HZ;
int result;
+ if (ldev->lvds_clk) {
+ result = clk_round_rate(ldev->lvds_clk, target);
+ DRM_DEBUG_DRIVER("lvds pixclk rate target %d, available %d\n",
+ target, result);
+ }
+
result = clk_round_rate(ldev->pixel_clk, target);
DRM_DEBUG_DRIVER("clk rate target %d, available %d\n", target, result);
@@ -1896,6 +1902,8 @@ void ltdc_suspend(struct drm_device *ddev)
DRM_DEBUG_DRIVER("\n");
clk_disable_unprepare(ldev->pixel_clk);
+ if (ldev->lvds_clk)
+ clk_disable_unprepare(ldev->lvds_clk);
}
int ltdc_resume(struct drm_device *ddev)
@@ -1910,6 +1918,13 @@ int ltdc_resume(struct drm_device *ddev)
DRM_ERROR("failed to enable pixel clock (%d)\n", ret);
return ret;
}
+ if (ldev->lvds_clk) {
+ if (clk_prepare_enable(ldev->lvds_clk)) {
+ clk_disable_unprepare(ldev->pixel_clk);
+ DRM_ERROR("Unable to prepare lvds clock\n");
+ return -ENODEV;
+ }
+ }
return 0;
}
@@ -1981,6 +1996,10 @@ int ltdc_load(struct drm_device *ddev)
}
}
+ ldev->lvds_clk = devm_clk_get(dev, "lvds");
+ if (IS_ERR(ldev->lvds_clk))
+ ldev->lvds_clk = NULL;
+
rstc = devm_reset_control_get_exclusive(dev, NULL);
mutex_init(&ldev->err_lock);
diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h
index 9d488043ffdb..4a60ce5b610c 100644
--- a/drivers/gpu/drm/stm/ltdc.h
+++ b/drivers/gpu/drm/stm/ltdc.h
@@ -44,6 +44,7 @@ struct ltdc_device {
void __iomem *regs;
struct regmap *regmap;
struct clk *pixel_clk; /* lcd pixel clock */
+ struct clk *lvds_clk; /* lvds pixel clock */
struct mutex err_lock; /* protecting error_status */
struct ltdc_caps caps;
u32 irq_status;
--
2.25.1
Add "st,stm32mp25-lvds" compatible.
Signed-off-by: Raphael Gallais-Pou <[email protected]>
Reviewed-by: Conor Dooley <[email protected]>
---
Depends on: "dt-bindings: stm32: add clocks and reset binding for
stm32mp25 platform" by Gabriel Fernandez
Changes in v6:
- Added Conor's Reviewed-by
Changes in v5:
- Fixed path in MAINTAINERS
Changes in v4:
- Align filename to compatible
- Fix compatible in the example
- Remove redundant word in the subject
Changes in v3:
- Clarify commit dependency
- Fix includes in the example
- Fix YAML
- Add "clock-cells" description
- s/regroups/is composed of/
- Changed compatible to show SoC specificity
Changes in v2:
- Switch compatible and clock-cells related areas
- Remove faulty #include in the example.
- Add entry in MAINTAINERS
---
.../bindings/display/st,stm32mp25-lvds.yaml | 119 +++++++++++++++++++++
MAINTAINERS | 1 +
2 files changed, 120 insertions(+)
diff --git a/Documentation/devicetree/bindings/display/st,stm32mp25-lvds.yaml b/Documentation/devicetree/bindings/display/st,stm32mp25-lvds.yaml
new file mode 100644
index 000000000000..6736f93256b5
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/st,stm32mp25-lvds.yaml
@@ -0,0 +1,119 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/st,stm32mp25-lvds.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: STMicroelectronics STM32 LVDS Display Interface Transmitter
+
+maintainers:
+ - Raphael Gallais-Pou <[email protected]>
+ - Yannick Fertre <[email protected]>
+
+description: |
+ The STMicroelectronics STM32 LVDS Display Interface Transmitter handles the
+ LVDS protocol: it maps the pixels received from the upstream Pixel-DMA (LTDC)
+ onto the LVDS PHY.
+
+ It is composed of three sub blocks:
+ - LVDS host: handles the LVDS protocol (FPD / OpenLDI) and maps its input
+ pixels onto the data lanes of the PHY
+ - LVDS PHY: parallelize the data and drives the LVDS data lanes
+ - LVDS wrapper: handles top-level settings
+
+ The LVDS controller driver supports the following high-level features:
+ - FDP-Link-I and OpenLDI (v0.95) protocols
+ - Single-Link or Dual-Link operation
+ - Single-Display or Double-Display (with the same content duplicated on both)
+ - Flexible Bit-Mapping, including JEIDA and VESA
+ - RGB888 or RGB666 output
+ - Synchronous design, with one input pixel per clock cycle
+
+properties:
+ compatible:
+ const: st,stm32mp25-lvds
+
+ "#clock-cells":
+ const: 0
+ description:
+ Provides the internal LVDS PHY clock to the framework.
+
+ reg:
+ maxItems: 1
+
+ clocks:
+ items:
+ - description: APB peripheral clock
+ - description: Reference clock for the internal PLL
+
+ clock-names:
+ items:
+ - const: pclk
+ - const: ref
+
+ resets:
+ maxItems: 1
+
+ ports:
+ $ref: /schemas/graph.yaml#/properties/ports
+
+ properties:
+ port@0:
+ $ref: /schemas/graph.yaml#/properties/port
+ description:
+ LVDS input port node, connected to the LTDC RGB output port.
+
+ port@1:
+ $ref: /schemas/graph.yaml#/properties/port
+ description:
+ LVDS output port node, connected to a panel or bridge input port.
+
+ required:
+ - port@0
+ - port@1
+
+required:
+ - compatible
+ - "#clock-cells"
+ - reg
+ - clocks
+ - clock-names
+ - resets
+ - ports
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/clock/st,stm32mp25-rcc.h>
+ #include <dt-bindings/reset/st,stm32mp25-rcc.h>
+
+ lvds: lvds@48060000 {
+ compatible = "st,stm32mp25-lvds";
+ reg = <0x48060000 0x2000>;
+ #clock-cells = <0>;
+ clocks = <&rcc CK_BUS_LVDS>, <&rcc CK_KER_LVDSPHY>;
+ clock-names = "pclk", "ref";
+ resets = <&rcc LVDS_R>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+ lvds_in: endpoint {
+ remote-endpoint = <<dc_ep1_out>;
+ };
+ };
+
+ port@1 {
+ reg = <1>;
+ lvds_out0: endpoint {
+ remote-endpoint = <&lvds_panel_in>;
+ };
+ };
+ };
+ };
+
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 3527a2ece6cd..ff5c945f206e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7240,6 +7240,7 @@ L: [email protected]
S: Maintained
T: git git://anongit.freedesktop.org/drm/drm-misc
F: Documentation/devicetree/bindings/display/st,stm32-ltdc.yaml
+F: Documentation/devicetree/bindings/display/st,stm32mp25-lvds.yaml
F: drivers/gpu/drm/stm
DRM DRIVERS FOR TI KEYSTONE
--
2.25.1
Hi Raphael,
thanks for the patch.
Acked-by: Yannick Fertre <[email protected]>
Best regards
On 2/26/24 11:48, Raphael Gallais-Pou wrote:
> Add "st,stm32mp25-lvds" compatible.
>
> Signed-off-by: Raphael Gallais-Pou <[email protected]>
> Reviewed-by: Conor Dooley <[email protected]>
> ---
> Depends on: "dt-bindings: stm32: add clocks and reset binding for
> stm32mp25 platform" by Gabriel Fernandez
>
> Changes in v6:
> - Added Conor's Reviewed-by
>
> Changes in v5:
> - Fixed path in MAINTAINERS
>
> Changes in v4:
> - Align filename to compatible
> - Fix compatible in the example
> - Remove redundant word in the subject
>
> Changes in v3:
> - Clarify commit dependency
> - Fix includes in the example
> - Fix YAML
> - Add "clock-cells" description
> - s/regroups/is composed of/
> - Changed compatible to show SoC specificity
>
> Changes in v2:
> - Switch compatible and clock-cells related areas
> - Remove faulty #include in the example.
> - Add entry in MAINTAINERS
> ---
> .../bindings/display/st,stm32mp25-lvds.yaml | 119 +++++++++++++++++++++
> MAINTAINERS | 1 +
> 2 files changed, 120 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/display/st,stm32mp25-lvds.yaml b/Documentation/devicetree/bindings/display/st,stm32mp25-lvds.yaml
> new file mode 100644
> index 000000000000..6736f93256b5
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/st,stm32mp25-lvds.yaml
> @@ -0,0 +1,119 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/display/st,stm32mp25-lvds.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: STMicroelectronics STM32 LVDS Display Interface Transmitter
> +
> +maintainers:
> + - Raphael Gallais-Pou <[email protected]>
> + - Yannick Fertre <[email protected]>
> +
> +description: |
> + The STMicroelectronics STM32 LVDS Display Interface Transmitter handles the
> + LVDS protocol: it maps the pixels received from the upstream Pixel-DMA (LTDC)
> + onto the LVDS PHY.
> +
> + It is composed of three sub blocks:
> + - LVDS host: handles the LVDS protocol (FPD / OpenLDI) and maps its input
> + pixels onto the data lanes of the PHY
> + - LVDS PHY: parallelize the data and drives the LVDS data lanes
> + - LVDS wrapper: handles top-level settings
> +
> + The LVDS controller driver supports the following high-level features:
> + - FDP-Link-I and OpenLDI (v0.95) protocols
> + - Single-Link or Dual-Link operation
> + - Single-Display or Double-Display (with the same content duplicated on both)
> + - Flexible Bit-Mapping, including JEIDA and VESA
> + - RGB888 or RGB666 output
> + - Synchronous design, with one input pixel per clock cycle
> +
> +properties:
> + compatible:
> + const: st,stm32mp25-lvds
> +
> + "#clock-cells":
> + const: 0
> + description:
> + Provides the internal LVDS PHY clock to the framework.
> +
> + reg:
> + maxItems: 1
> +
> + clocks:
> + items:
> + - description: APB peripheral clock
> + - description: Reference clock for the internal PLL
> +
> + clock-names:
> + items:
> + - const: pclk
> + - const: ref
> +
> + resets:
> + maxItems: 1
> +
> + ports:
> + $ref: /schemas/graph.yaml#/properties/ports
> +
> + properties:
> + port@0:
> + $ref: /schemas/graph.yaml#/properties/port
> + description:
> + LVDS input port node, connected to the LTDC RGB output port.
> +
> + port@1:
> + $ref: /schemas/graph.yaml#/properties/port
> + description:
> + LVDS output port node, connected to a panel or bridge input port.
> +
> + required:
> + - port@0
> + - port@1
> +
> +required:
> + - compatible
> + - "#clock-cells"
> + - reg
> + - clocks
> + - clock-names
> + - resets
> + - ports
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/clock/st,stm32mp25-rcc.h>
> + #include <dt-bindings/reset/st,stm32mp25-rcc.h>
> +
> + lvds: lvds@48060000 {
> + compatible = "st,stm32mp25-lvds";
> + reg = <0x48060000 0x2000>;
> + #clock-cells = <0>;
> + clocks = <&rcc CK_BUS_LVDS>, <&rcc CK_KER_LVDSPHY>;
> + clock-names = "pclk", "ref";
> + resets = <&rcc LVDS_R>;
> +
> + ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + port@0 {
> + reg = <0>;
> + lvds_in: endpoint {
> + remote-endpoint = <<dc_ep1_out>;
> + };
> + };
> +
> + port@1 {
> + reg = <1>;
> + lvds_out0: endpoint {
> + remote-endpoint = <&lvds_panel_in>;
> + };
> + };
> + };
> + };
> +
> +...
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 3527a2ece6cd..ff5c945f206e 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -7240,6 +7240,7 @@ L: [email protected]
> S: Maintained
> T: git git://anongit.freedesktop.org/drm/drm-misc
> F: Documentation/devicetree/bindings/display/st,stm32-ltdc.yaml
> +F: Documentation/devicetree/bindings/display/st,stm32mp25-lvds.yaml
> F: drivers/gpu/drm/stm
>
> DRM DRIVERS FOR TI KEYSTONE
>