Introduce STM32 LVDS driver
Subsystems (5)
Raphael Gallais-Pou
maintainerv5 cover Introduce STM32 LVDS driver
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 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
---
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: bb3bc3eac316b7c388733e625cc2343131b69dee
change-id: 20240205-lvds-e084ec50e878
Best regards,
Signature · 1 line
Raphael Gallais-Pou <[email protected]>
Raphael Gallais-Pou
maintainerPATCH v5 1/3 dt-bindings: display: add STM32 LVDS device
Add "st,stm32mp25-lvds" compatible.
---
Depends on: "dt-bindings: stm32: add clocks and reset binding for
stm32mp25 platform" by Gabriel Fernandez
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(+)
Documentation/devicetree/bindings/display/st,stm32mp25-lvds.yaml new file +119 -0
@@ -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>; + }; + }; + }; + }; + +...
MAINTAINERS +1 -0
@@ -7231,6 +7231,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
Signature · 1 line
2.25.1
Raphael Gallais-Pou
maintainerPATCH v5 2/3 drm/stm: lvds: add new STM32 LVDS Display Interface Transmitter driver
In reply to Raphael Gallais-PouThe Low-Voltage Differential Signaling (LVDS) Display Interface Transmitter handles the LVDS protocol: it maps the pixels received from the upstream Pixel-DMA LCD-TFT Display Controller (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
---
Changes in v5:
- Align compatible
Changes in v4:
- Explicitly include linux/platform_device.h, dependency introduced by ef175b29a242 of: Stop circularly including of_device.h and of_platform.h
Changes in v3:
- s/regroups/is composed of/ in commit log
- Change the compatible to show SoC specificity
Changes in v2:
- Fixed Camel Case macros
- Removed debug log
--- drivers/gpu/drm/stm/Kconfig | 11 + drivers/gpu/drm/stm/Makefile | 2 + drivers/gpu/drm/stm/lvds.c | 1226 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1239 insertions(+)
drivers/gpu/drm/stm/Kconfig +11 -0
@@ -20,3 +20,14 @@ config DRM_STM_DSI select DRM_DW_MIPI_DSI help Choose this option for MIPI DSI support on STMicroelectronics SoC. + +config DRM_STM_LVDS + tristate "STMicroelectronics LVDS Display Interface Transmitter DRM driver" + depends on DRM_STM + help + Enable support for LVDS encoders on STMicroelectronics SoC. + The STM LVDS is a bridge which serialize pixel stream onto + a LVDS protocol. + + To compile this driver as a module, choose M here: the module will be + called lvds.
drivers/gpu/drm/stm/Makefile +2 -0
@@ -5,4 +5,6 @@ stm-drm-y := \ obj-$(CONFIG_DRM_STM_DSI) += dw_mipi_dsi-stm.o +obj-$(CONFIG_DRM_STM_LVDS) += lvds.o + obj-$(CONFIG_DRM_STM) += stm-drm.o
drivers/gpu/drm/stm/lvds.c new file +1226 -0
1,226 lines not on this page · raw message
Signature · 1 line
2.25.1
kernel test robot
build botRe: [PATCH v5 2/3] drm/stm: lvds: add new STM32 LVDS Display Interface Transmitter driver
kernel test robot noticed the following build warnings:
Hi Raphael,
kernel test robot noticed the following build warnings:
[auto build test WARNING on bb3bc3eac316b7c388733e625cc2343131b69dee]
url: https://github.com/intel-lab-lkp/linux/commits/Raphael-Gallais-Pou/dt-bindings-display-add-STM32-LVDS-device/20240206-194740 base: bb3bc3eac316b7c388733e625cc2343131b69dee patch link: https://lore.kernel.org/r/20240206-lvds-v5-2-bd16797b0f09%40foss.st.com patch subject: [PATCH v5 2/3] drm/stm: lvds: add new STM32 LVDS Display Interface Transmitter driver config: arm-randconfig-r132-20240214 (https://download.01.org/0day-ci/archive/20240216/[email protected]/config) compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project.git 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a) reproduce: (https://download.01.org/0day-ci/archive/20240216/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
sparse warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/stm/lvds.c:318:17: sparse: sparse: symbol 'lvds_bitmap_jeida_rgb888' was not declared. Should it be static? >> drivers/gpu/drm/stm/lvds.c:335:17: sparse: sparse: symbol 'lvds_bitmap_vesa_rgb888' was not declared. Should it be static?
drivers/gpu/drm/stm/lvds.c: note: in included file (through include/linux/mmzone.h, include/linux/gfp.h, include/linux/stackdepot.h, ...):
include/linux/page-flags.h:242:46: sparse: sparse: self-comparison always evaluates to false
vim +/lvds_bitmap_jeida_rgb888 +318 drivers/gpu/drm/stm/lvds.c
308
309 /*
310 * Expected JEIDA-RGB888 data to be sent in LSB format
311 * bit6 ............................bit0
312 * CHAN0 {ONE, ONE, ZERO, ZERO, ZERO, ONE, ONE}
313 * CHAN1 {G2, R7, R6, R5, R4, R3, R2}
314 * CHAN2 {B3, B2, G7, G6, G5, G4, G3}
315 * CHAN3 {DE, VS, HS, B7, B6, B5, B4}
316 * CHAN4 {CE, B1, B0, G1, G0, R1, R0}
317 */
> 318 enum lvds_pixel lvds_bitmap_jeida_rgb888[5][7] = {
319 { PIX_ONE, PIX_ONE, PIX_ZER, PIX_ZER, PIX_ZER, PIX_ONE, PIX_ONE },
320 { PIX_G_2, PIX_R_7, PIX_R_6, PIX_R_5, PIX_R_4, PIX_R_3, PIX_R_2 },
321 { PIX_B_3, PIX_B_2, PIX_G_7, PIX_G_6, PIX_G_5, PIX_G_4, PIX_G_3 },
322 { PIX_D_E, PIX_V_S, PIX_H_S, PIX_B_7, PIX_B_6, PIX_B_5, PIX_B_4 },
323 { PIX_C_E, PIX_B_1, PIX_B_0, PIX_G_1, PIX_G_0, PIX_R_1, PIX_R_0 }
324 };
325
326 /*
327 * Expected VESA-RGB888 data to be sent in LSB format
328 * bit6 ............................bit0
329 * CHAN0 {ONE, ONE, ZERO, ZERO, ZERO, ONE, ONE}
330 * CHAN1 {G0, R5, R4, R3, R2, R1, R0}
331 * CHAN2 {B1, B0, G5, G4, G3, G2, G1}
332 * CHAN3 {DE, VS, HS, B5, B4, B3, B2}
333 * CHAN4 {CE, B7, B6, G7, G6, R7, R6}
334 */
> 335 enum lvds_pixel lvds_bitmap_vesa_rgb888[5][7] = { 336 { PIX_ONE, PIX_ONE, PIX_ZER, PIX_ZER, PIX_ZER, PIX_ONE, PIX_ONE },
337 { PIX_G_0, PIX_R_5, PIX_R_4, PIX_R_3, PIX_R_2, PIX_R_1, PIX_R_0 },
338 { PIX_B_1, PIX_B_0, PIX_G_5, PIX_G_4, PIX_G_3, PIX_G_2, PIX_G_1 },
339 { PIX_D_E, PIX_V_S, PIX_H_S, PIX_B_5, PIX_B_4, PIX_B_3, PIX_B_2 },
340 { PIX_C_E, PIX_B_7, PIX_B_6, PIX_G_7, PIX_G_6, PIX_R_7, PIX_R_6 }
341 };
342
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Raphael Gallais-Pou
maintainerPATCH v5 3/3 drm/stm: ltdc: add lvds pixel clock
In reply to Raphael Gallais-PouThe 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.
---
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(+)
drivers/gpu/drm/stm/ltdc.c +19 -0
@@ -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);
drivers/gpu/drm/stm/ltdc.h +1 -0
@@ -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;
Signature · 1 line
2.25.1
Quoted 9 lines · Raphael Gallais-Pou
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 v5:
- Fixed path inMAINTAINERS
- Fixed compatible in driver
One patchset per day. Allow people to actually review your code...
Best regards,
Krzysztof