DRM: add LTDC support for STM32F4
Subsystems (6)
cover DRM: add LTDC support for STM32F4
The purpose of this set of patches is to add a new driver for stm32f429. This driver was developed and tested on evaluation board stm32429i.
Stm32f4 is a MCU platform which don't have MMU so the last patches developed by Benjamin Gaignard regarding "DRM: allow to use mmuless devices" are necessary.
The board stm429i embeds a Ampire AM-480272H3TMQW-T01H screen. A new simple panel am-480272h3tmqw-t01h have been added to support it.
Yannick Fertre (7):
dt-bindings: display: add STM32 LTDC driver
drm/st: Add STM32 LTDC driver
dt-bindings: Add Ampire AM-480272H3TMQW-T01H panel drm/panel: simple: Add support for Ampire AM-480272H3TMQW-T01H
ARM: dts: stm32f429: Add ltdc support
ARM: dts: stm32429i-eval: Enable ltdc & simple panel on Eval board
ARM: configs: Add STM32 LTDC support in STM32 defconfig
.../display/panel/ampire,am-480272h3tmqw-t01h.txt | 7 + .../devicetree/bindings/display/st,ltdc.txt | 57 + arch/arm/boot/dts/stm32429i-eval.dts | 58 + arch/arm/boot/dts/stm32f429.dtsi | 25 +- arch/arm/configs/stm32_defconfig | 5 + drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/panel/panel-simple.c | 29 + drivers/gpu/drm/st/Kconfig | 14 + drivers/gpu/drm/st/Makefile | 7 + drivers/gpu/drm/st/drv.c | 279 ++++ drivers/gpu/drm/st/drv.h | 25 + drivers/gpu/drm/st/ltdc.c | 1438 ++++++++++++++++++++ drivers/gpu/drm/st/ltdc.h | 20 + 14 files changed, 1966 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/display/panel/ampire,am-480272h3tmqw-t01h.txt create mode 100644 Documentation/devicetree/bindings/display/st,ltdc.txt create mode 100644 drivers/gpu/drm/st/Kconfig create mode 100644 drivers/gpu/drm/st/Makefile create mode 100644 drivers/gpu/drm/st/drv.c create mode 100644 drivers/gpu/drm/st/drv.h create mode 100644 drivers/gpu/drm/st/ltdc.c create mode 100644 drivers/gpu/drm/st/ltdc.h
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/7 dt-bindings: display: add STM32 LTDC driver
--- .../devicetree/bindings/display/st,ltdc.txt | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/st,ltdc.txt
Documentation/devicetree/bindings/display/st,ltdc.txt new file +57 -0
@@ -0,0 +1,57 @@ +* STMicroelectronics STM32 lcd-tft display controller + +- st-display-subsystem: Master device for DRM sub-components + This device must be the parent of all the sub-components and is responsible + of bind them. + Required properties: + - compatible: "st,display-subsystem" + - ranges: to allow probing of subdevices + +- ltdc_host: lcd-tft display controller host + must be a sub-node of st-display-subsystem + Required properties: + - compatible: "st,ltdc" + - reg: Physical base address of the IP registers and length of memory mapped region. + - clocks: from common clock binding: handle hardware IP needed clocks, the + number of clocks may depend of the SoC type. + See ../clocks/clock-bindings.txt for details. + - clock-names: names of the clocks listed in clocks property in the same + order. + - resets: resets to be used by the device + See ../reset/reset.txt for details. + - reset-names: names of the resets listed in resets property in the same + order. + Required nodes: + - Video port for RGB output. + +Example: + +/ { + ... + soc { + ... + st-display-subsystem { + compatible = "st,display-subsystem"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + dma-ranges; + + ltdc_host: stm32-ltdc@40016800 { + compatible = "st,ltdc"; + reg = <0x40016800 0x200>; + interrupts = <88>, <89>; + resets = <&rcc 314>; + clocks = <&rcc 1 8>; + clock-names = "clk-lcd"; + status = "disabled"; + + port { + ltdc_out_rgb: endpoint { + }; + }; + }; + }; + ... + }; +};
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/7 drm/st: Add STM32 LTDC driver
In reply to Yannick FertreThis patch adds support for the STM32 LCD-TFT display controller.
--- drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/st/Kconfig | 14 + drivers/gpu/drm/st/Makefile | 7 + drivers/gpu/drm/st/drv.c | 279 +++++++++ drivers/gpu/drm/st/drv.h | 25 + drivers/gpu/drm/st/ltdc.c | 1438 +++++++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/st/ltdc.h | 20 + 8 files changed, 1786 insertions(+) create mode 100644 drivers/gpu/drm/st/Kconfig create mode 100644 drivers/gpu/drm/st/Makefile create mode 100644 drivers/gpu/drm/st/drv.c create mode 100644 drivers/gpu/drm/st/drv.h create mode 100644 drivers/gpu/drm/st/ltdc.c create mode 100644 drivers/gpu/drm/st/ltdc.h
drivers/gpu/drm/Kconfig +2 -0
@@ -237,6 +237,8 @@ source "drivers/gpu/drm/fsl-dcu/Kconfig" source "drivers/gpu/drm/tegra/Kconfig" +source "drivers/gpu/drm/st/Kconfig" + source "drivers/gpu/drm/panel/Kconfig" source "drivers/gpu/drm/bridge/Kconfig"
drivers/gpu/drm/Makefile +1 -0
@@ -81,6 +81,7 @@ obj-$(CONFIG_DRM_BOCHS) += bochs/ obj-$(CONFIG_DRM_VIRTIO_GPU) += virtio/ obj-$(CONFIG_DRM_MSM) += msm/ obj-$(CONFIG_DRM_TEGRA) += tegra/ +obj-$(CONFIG_DRM_ST) += st/ obj-$(CONFIG_DRM_STI) += sti/ obj-$(CONFIG_DRM_IMX) += imx/ obj-$(CONFIG_DRM_MEDIATEK) += mediatek/
drivers/gpu/drm/st/Kconfig new file +14 -0
@@ -0,0 +1,14 @@ +config DRM_ST + tristate "DRM Support for STMicroelectronics SoC Series" + depends on DRM && (ARCH_STM32 || ARCH_MULTIPLATFORM) + select DRM_KMS_HELPER + select DRM_GEM_CMA_HELPER + select DRM_KMS_CMA_HELPER + select DRM_PANEL + select VIDEOMODE_HELPERS + select FB_PROVIDE_GET_FB_UNMAPPED_AREA + help + Choose this option if you have an ST STMicroelectronics SoC. + + To compile this driver as a module, choose M here: the module + will be called st-drm.
drivers/gpu/drm/st/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +ccflags-y := -Iinclude/drm + +st-drm-y := \ + drv.o \ + ltdc.o + +obj-$(CONFIG_DRM_ST) += st-drm.o
drivers/gpu/drm/st/drv.c new file +279 -0
279 lines not on this page · raw message
drivers/gpu/drm/st/drv.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* Copyright (C) STMicroelectronics SA 2017 +* +* Authors: Philippe Cornu <[email protected]> +* Yannick Fertre <[email protected]> +* Fabien Dessenne <[email protected]> +* Mickael Reulier <[email protected]> +* +* License terms: GNU General Public License (GPL), version 2 +*/ + +#ifndef _DRV_H_ +#define _DRV_H_ + +#include <drm/drmP.h> + +struct st_private { +struct ltdc *ltdc; +struct drm_device *ddev; +struct drm_fbdev_cma *fbdev; +}; + +extern struct platform_driver ltdc_driver; + +#endif
drivers/gpu/drm/st/ltdc.c new file +1438 -0
1,438 lines not on this page · raw message
drivers/gpu/drm/st/ltdc.h new file +20 -0
@@ -0,0 +1,20 @@ +/* +* Copyright (C) STMicroelectronics SA 2017 +* +* Authors: Philippe Cornu <[email protected]> +* Yannick Fertre <[email protected]> +* Fabien Dessenne <[email protected]> +* Mickael Reulier <[email protected]> +* +* License terms: GNU General Public License (GPL), version 2 +*/ + +#ifndef _LTDC_H_ +#define _LTDC_H_ + +#include <drm/drmP.h> + +int ltdc_crtc_enable_vblank (struct drm_device *dev,unsigned int pipe); +void ltdc_crtc_disable_vblank (struct drm_device *dev,unsigned int pipe); + +#endif
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/7 dt-bindings: Add Ampire AM-480272H3TMQW-T01H panel
In reply to Yannick Fertre--- .../bindings/display/panel/ampire,am-480272h3tmqw-t01h.txt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/ampire,am-480272h3tmqw-t01h.txt
Documentation/devicetree/bindings/display/panel/ampire,am-480272h3tmqw-t01h.txt new file +7 -0
@@ -0,0 +1,7 @@ +Ampire AM-480272H3TMQW-T01H 4.3" WQVGA TFT LCD panel + +Required properties: +- compatible: should be "ampire,am-480272h3tmqw-t01h" + +This binding is compatible with the simple-panel binding, which is specified +in simple-panel.txt in this directory.
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/7 drm/panel: simple: Add support for Ampire AM-480272H3TMQW-T01H
In reply to Yannick FertreAdd simple-panel support for the Ampire AM-480272H3TMQW-T01H, which is a 4.3" WQVGA panel.
--- drivers/gpu/drm/panel/panel-simple.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
drivers/gpu/drm/panel/panel-simple.c +29 -0
@@ -386,6 +386,32 @@ static void panel_simple_shutdown(struct device *dev)panel_simple_disable (&panel->base); } +static const struct drm_display_mode ampire_am_480272h3tmqw_t01h_mode = { + .clock =9000 , + .hdisplay =480 , + .hsync_start =480 +2 , + .hsync_end =480 +2 +41 , + .htotal =480 +2 +41 +2 , + .vdisplay =272 , + .vsync_start =272 +2 , + .vsync_end =272 +2 +10 , + .vtotal =272 +2 +10 +2 , + .vrefresh =60 , + .flags =DRM_MODE_FLAG_PHSYNC |DRM_MODE_FLAG_PVSYNC , +}; + +static const struct panel_desc ampire_am_480272h3tmqw_t01h = { + .modes = &ire_am_480272h3tmqw_t01h_mode, + .num_modes =1 , + .bpc =8 , + + .size = { + .width =105 , + .height =67 , + }, + .bus_format =MEDIA_BUS_FMT_RGB888_1X24 , +}; +static const struct drm_display_mode ampire_am800480r3tmqwa1h_mode = { .clock =33333 , .hdisplay =800 ,
@@ -1715,6 +1741,9 @@ static void panel_simple_shutdown(struct device *dev)static const struct of_device_id platform_of_match[] = { { + .compatible ="ampire,am-480272h3tmqw-t01h" , + .data = &ire_am_480272h3tmqw_t01h, + }, { .compatible ="ampire,am800480r3tmqwa1h" , .data = &ire_am800480r3tmqwa1h, }, {
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/7 ARM: dts: stm32f429: Add ltdc support
In reply to Yannick FertreAdd LTDC (Lcd-tft Display Controller) support.
--- arch/arm/boot/dts/stm32f429.dtsi | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-)
arch/arm/boot/dts/stm32f429.dtsi +24 -1
@@ -185,7 +185,7 @@ interrupts = <1>, <2>, <3>, <6>, <7>, <8>, <9>, <10>, <23>, <40>, <41>, <42>, <62>, <76>; }; - pin-controller { + pinctrl: pin-controller { #address-cells = <1>; #size-cells = <1>; compatible = "st,stm32f429-pinctrl";
@@ -404,6 +404,29 @@ interrupts = <80>; clocks = <&rcc 0 38>; }; + + st-display-subsystem { + compatible = "st,display-subsystem"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + dma-ranges; + + ltdc_host: stm32-ltdc@40016800 { + compatible = "st,ltdc"; + reg = <0x40016800 0x200>; + interrupts = <88>, <89>; + resets = <&rcc 314>; + clocks = <&rcc 1 8>; + clock-names = "clk-lcd"; + status = "disabled"; + + port { + ltdc_out_rgb: endpoint { + }; + }; + }; + }; }; };
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 6/7 ARM: dts: stm32429i-eval: Enable ltdc & simple panel on Eval board
In reply to Yannick FertreEnable ltdc & enable am-480272h3tmqw-t01h panel.
--- arch/arm/boot/dts/stm32429i-eval.dts | 58 ++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+)
arch/arm/boot/dts/stm32429i-eval.dts +58 -0
@@ -88,6 +88,52 @@ clocks = <&rcc 0 30>; clock-names = "main_clk"; }; + + panel_rgb: panel-rgb { + compatible = "ampire,am-480272h3tmqw-t01h"; + status = "okay"; + port { + panel_in_rgb: endpoint { + remote-endpoint = <<dc_out_rgb>; + }; + }; + }; +}; + +&pinctrl { + pinctrl_ltdc: ltdc@0 { + pins { + pinmux = <STM32F429_PI12_FUNC_LCD_HSYNC>, + <STM32F429_PI13_FUNC_LCD_VSYNC>, + <STM32F429_PI14_FUNC_LCD_CLK>, + <STM32F429_PI15_FUNC_LCD_R0>, + <STM32F429_PJ0_FUNC_LCD_R1>, + <STM32F429_PJ1_FUNC_LCD_R2>, + <STM32F429_PJ2_FUNC_LCD_R3>, + <STM32F429_PJ3_FUNC_LCD_R4>, + <STM32F429_PJ4_FUNC_LCD_R5>, + <STM32F429_PJ5_FUNC_LCD_R6>, + <STM32F429_PJ6_FUNC_LCD_R7>, + <STM32F429_PJ7_FUNC_LCD_G0>, + <STM32F429_PJ8_FUNC_LCD_G1>, + <STM32F429_PJ9_FUNC_LCD_G2>, + <STM32F429_PJ10_FUNC_LCD_G3>, + <STM32F429_PJ11_FUNC_LCD_G4>, + <STM32F429_PJ12_FUNC_LCD_B0>, + <STM32F429_PJ13_FUNC_LCD_B1>, + <STM32F429_PJ14_FUNC_LCD_B2>, + <STM32F429_PJ15_FUNC_LCD_B3>, + <STM32F429_PK0_FUNC_LCD_G5>, + <STM32F429_PK1_FUNC_LCD_G6>, + <STM32F429_PK2_FUNC_LCD_G7>, + <STM32F429_PK3_FUNC_LCD_B4>, + <STM32F429_PK4_FUNC_LCD_B5>, + <STM32F429_PK5_FUNC_LCD_B6>, + <STM32F429_PK6_FUNC_LCD_B7>, + <STM32F429_PK7_FUNC_LCD_DE>; + slew-rate = <2>; + }; + }; }; &clk_hse {
@@ -123,3 +169,15 @@ pinctrl-names = "default"; status = "okay"; }; + +<dc_host{ + status = "okay"; + pinctrl-0 = <&pinctrl_ltdc>; + pinctrl-names = "default"; + + port { + ltdc_out_rgb: endpoint { + remote-endpoint = <&panel_in_rgb>; + }; + }; +};
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 7/7 ARM: configs: Add STM32 LTDC support in STM32 defconfig
In reply to Yannick Fertre--- arch/arm/configs/stm32_defconfig | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/configs/stm32_defconfig +5 -0
@@ -71,3 +71,8 @@ CONFIG_MAGIC_SYSRQ=y # CONFIG_FTRACE is not set CONFIG_CRC_ITU_T=y CONFIG_CRC7=y +CONFIG_DRM=y +CONFIG_DRM_ST=y +CONFIG_DRM_PANEL=y +CONFIG_DRM_PANEL_SIMPLE=y +CONFIG_BACKLIGHT_LCD_SUPPORT=y
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel