Skip to contentSkip to conversation

BL035-RGB-002 3.5" LCD sunxi DRM support

PATCH Superseded Paul Kocialkowski 3 participants 14 messages Nov 1, 2018 – Nov 7, 2018

Subsystems (6)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover BL035-RGB-002 3.5" LCD sunxi DRM support

The series adds support for the BL035-RGB-002 LCD panel and the required device-tree bindings for using it on the BananaPi M1.

Only the changes related to the DRM driver and the panel are submitted for merge, which does not include the two final commits.

Changes since v1:
* Used the full name of the panel for dt bindings;
* Removed helper to match flags in order to only retrieve the connector once, as it was already done.
* Made the bus flags checking possible without a panel;

Paul Kocialkowski (7):
drm/sun4i: tcon: Pass encoder instead of using panel for RGB setup drm/sun4i: tcon: Support an active-low DE signal with RGB interface
dt-bindings: Add vendor prefix for LeMaker
dt-bindings: Add bindings for the LeMaker BL035-RGB-002 LCD panel drm/panel: simple: Add support for the LeMaker BL035-RGB-002 3.5" LCD
ARM: dts: sun7i: Add pinmux configuration for LCD0 RGB888 pins
ARM: dts: sun7i-a20-bananapi: Add bindings for the LeMaker 3.5" LCD

 .../display/panel/lemaker,bl035-rgb-002.txt   |  7 ++
 .../devicetree/bindings/vendor-prefixes.txt   |  1 +
 arch/arm/boot/dts/sun7i-a20-bananapi.dts      | 89 +++++++++++++++++++
 arch/arm/boot/dts/sun7i-a20.dtsi              | 11 +++
 drivers/gpu/drm/panel/panel-simple.c          | 27 ++++++
 drivers/gpu/drm/sun4i/sun4i_tcon.c            | 29 +++---
 drivers/gpu/drm/sun4i/sun4i_tcon.h            |  1 +
 7 files changed, 151 insertions(+), 14 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/display/panel/lemaker,bl035-rgb-002.txt
Signature · 1 line
2.19.1
#1 lore raw

PATCH v2 1/7 drm/sun4i: tcon: Pass encoder instead of using panel for RGB setup

Features such as dithering and pixel data edge configuration currently rely on the panel registered with the TCON driver. However, bridges are also supported in addition panels.

Instead of retrieving the connector from the panel, pass the encoder from the calling function, as is done for other interfaces.

The connector is then retrieved from the encoder with the dedicated helper. Even in the case of bridges, the connector is registered with the encoder from our driver and is accessible when iterating connectors.

---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)
drivers/gpu/drm/sun4i/sun4i_tcon.c +9 -13
index f949287d926c..262ffb6b0f82 100644
@@ -478,8 +478,11 @@ static void sun4i_tcon0_mode_set_lvds(struct sun4i_tcon *tcon,
 }
 
 static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
+				     const struct drm_encoder *encoder,
 				     const struct drm_display_mode *mode)
 {
+	struct drm_connector *connector = sun4i_tcon_get_connector(encoder);
+	struct drm_display_info display_info = connector->display_info;
 	unsigned int bp, hsync, vsync;
 	u8 clk_delay;
 	u32 val = 0;
@@ -491,8 +494,7 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
 	sun4i_tcon0_mode_set_common(tcon, mode);
 
 	/* Set dithering if needed */
-	if (tcon->panel)
-		sun4i_tcon0_mode_set_dithering(tcon, tcon->panel->connector);
+	sun4i_tcon0_mode_set_dithering(tcon, connector);
 
 	/* Adjust clock delay */
 	clk_delay = sun4i_tcon_get_clk_delay(mode, 0);
@@ -556,17 +558,11 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
 	 * Following code is a way to avoid quirks all around TCON
 	 * and DOTCLOCK drivers.
 	 */
-	if (tcon->panel) {
-		struct drm_panel *panel = tcon->panel;
-		struct drm_connector *connector = panel->connector;
-		struct drm_display_info display_info = connector->display_info;
-
-		if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
-			clk_set_phase(tcon->dclk, 240);
+	if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
+		clk_set_phase(tcon->dclk, 240);
 
-		if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
-			clk_set_phase(tcon->dclk, 0);
-	}
+	if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
+		clk_set_phase(tcon->dclk, 0);
 
 	regmap_update_bits(tcon->regs, SUN4I_TCON0_IO_POL_REG,
 			   SUN4I_TCON0_IO_POL_HSYNC_POSITIVE | SUN4I_TCON0_IO_POL_VSYNC_POSITIVE,
@@ -684,7 +680,7 @@ void sun4i_tcon_mode_set(struct sun4i_tcon *tcon,
 		sun4i_tcon0_mode_set_lvds(tcon, encoder, mode);
 		break;
 	case DRM_MODE_ENCODER_NONE:
-		sun4i_tcon0_mode_set_rgb(tcon, mode);
+		sun4i_tcon0_mode_set_rgb(tcon, encoder, mode);
 		sun4i_tcon_set_mux(tcon, 0, encoder);
 		break;
 	case DRM_MODE_ENCODER_TVDAC:
Signature · 1 line
2.19.1
#2 lore raw

Re: [PATCH v2 1/7] drm/sun4i: tcon: Pass encoder instead of using panel for RGB setup

Hi,

Quoted 51 lines · Paul Kocialkowski

Features such as dithering and pixel data edge configuration currently rely on the panel registered with the TCON driver. However, bridges are also supported in addition panels.

Instead of retrieving the connector from the panel, pass the encoder from the calling function, as is done for other interfaces.

The connector is then retrieved from the encoder with the dedicated helper. Even in the case of bridges, the connector is registered with the encoder from our driver and is accessible when iterating connectors.

---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)
drivers/gpu/drm/sun4i/sun4i_tcon.c +4 -7
index f949287d926c..262ffb6b0f82 100644
@@ -478,8 +478,11 @@ static void sun4i_tcon0_mode_set_lvds(struct sun4i_tcon *tcon,
 }
 
 static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
+				     const struct drm_encoder *encoder,
 				     const struct drm_display_mode *mode)
 {
+	struct drm_connector *connector = sun4i_tcon_get_connector(encoder);
+	struct drm_display_info display_info = connector->display_info;
 	unsigned int bp, hsync, vsync;
 	u8 clk_delay;
 	u32 val = 0;
@@ -491,8 +494,7 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
 	sun4i_tcon0_mode_set_common(tcon, mode);
 
 	/* Set dithering if needed */
-	if (tcon->panel)
-		sun4i_tcon0_mode_set_dithering(tcon, tcon->panel->connector);
+	sun4i_tcon0_mode_set_dithering(tcon, connector);
 
 	/* Adjust clock delay */
 	clk_delay = sun4i_tcon_get_clk_delay(mode, 0);
@@ -556,17 +558,11 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
 	 * Following code is a way to avoid quirks all around TCON
 	 * and DOTCLOCK drivers.
 	 */
-	if (tcon->panel) {
-		struct drm_panel *panel = tcon->panel;
-		struct drm_connector *connector = panel->connector;
-		struct drm_display_info display_info = connector->display_info;
-

drivers/gpu/drm/sun4i/sun4i_tcon.c static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon, · line 565

Quoted 10 lines
drivers/gpu/drm/sun4i/sun4i_tcon.c +4 -5
-		if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
-			clk_set_phase(tcon->dclk, 240);
+	if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
+		clk_set_phase(tcon->dclk, 240);
 
-		if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
-			clk_set_phase(tcon->dclk, 0);
-	}
+	if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
+		clk_set_phase(tcon->dclk, 0);

You're doing multiple things here: you're changing the function API, and then moving the display info checks outside of the tcon->panel condition.

You should do two separate patches for that.

Maxime

Signature · 3 lines
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

Re: [PATCH v2 1/7] drm/sun4i: tcon: Pass encoder instead of using panel for RGB setup

Hi,

Quoted 69 lines · Maxime Ripard

Hi,

Quoted 51 lines · Paul Kocialkowski

Features such as dithering and pixel data edge configuration currently rely on the panel registered with the TCON driver. However, bridges are also supported in addition panels.

Instead of retrieving the connector from the panel, pass the encoder from the calling function, as is done for other interfaces.

The connector is then retrieved from the encoder with the dedicated helper. Even in the case of bridges, the connector is registered with the encoder from our driver and is accessible when iterating connectors.

---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)
drivers/gpu/drm/sun4i/sun4i_tcon.c +4 -7
index f949287d926c..262ffb6b0f82 100644
@@ -478,8 +478,11 @@ static void sun4i_tcon0_mode_set_lvds(struct sun4i_tcon *tcon,
 }
 
 static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
+				     const struct drm_encoder *encoder,
 				     const struct drm_display_mode *mode)
 {
+	struct drm_connector *connector = sun4i_tcon_get_connector(encoder);
+	struct drm_display_info display_info = connector->display_info;
 	unsigned int bp, hsync, vsync;
 	u8 clk_delay;
 	u32 val = 0;
@@ -491,8 +494,7 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
 	sun4i_tcon0_mode_set_common(tcon, mode);
 
 	/* Set dithering if needed */
-	if (tcon->panel)
-		sun4i_tcon0_mode_set_dithering(tcon, tcon->panel->connector);
+	sun4i_tcon0_mode_set_dithering(tcon, connector);
 
 	/* Adjust clock delay */
 	clk_delay = sun4i_tcon_get_clk_delay(mode, 0);
@@ -556,17 +558,11 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
 	 * Following code is a way to avoid quirks all around TCON
 	 * and DOTCLOCK drivers.
 	 */
-	if (tcon->panel) {
-		struct drm_panel *panel = tcon->panel;
-		struct drm_connector *connector = panel->connector;
-		struct drm_display_info display_info = connector->display_info;
-

drivers/gpu/drm/sun4i/sun4i_tcon.c static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon, · line 565

Quoted 10 lines
drivers/gpu/drm/sun4i/sun4i_tcon.c +4 -5
-		if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
-			clk_set_phase(tcon->dclk, 240);
+	if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE)
+		clk_set_phase(tcon->dclk, 240);
 
-		if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
-			clk_set_phase(tcon->dclk, 0);
-	}
+	if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
+		clk_set_phase(tcon->dclk, 0);

You're doing multiple things here: you're changing the function API, and then moving the display info checks outside of the tcon->panel condition.

Quoted 1 line

You should do two separate patches for that.

Thanks, I'll do that in the next revision then.

Cheers,

Paul

Signature · 5 lines
Developer of free digital technology and hardware support.

Website: https://www.paulk.fr/
Coding blog: https://code.paulk.fr/
Git repositories: https://git.paulk.fr/ https://git.code.paulk.fr/
#4 lore raw

PATCH v2 2/7 drm/sun4i: tcon: Support an active-low DE signal with RGB interface

In reply to Paul Kocialkowski

Some panels need an active-low data enable (DE) signal for the RGB interface. This requires flipping a bit in the TCON0 polarity register when setting up the mode for the RGB interface.

Match the associated bus flag and use it to set the polarity inversion bit for the DE signal when required.

---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 7 ++++++-
 drivers/gpu/drm/sun4i/sun4i_tcon.h | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/sun4i/sun4i_tcon.c +6 -1
index 262ffb6b0f82..0420f5c978b9 100644
@@ -543,6 +543,9 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
 	if (mode->flags & DRM_MODE_FLAG_PVSYNC)
 		val |= SUN4I_TCON0_IO_POL_VSYNC_POSITIVE;
 
+	if (display_info.bus_flags & DRM_BUS_FLAG_DE_LOW)
+		val |= SUN4I_TCON0_IO_POL_DE_NEGATIVE;
+
 	/*
 	 * On A20 and similar SoCs, the only way to achieve Positive Edge
 	 * (Rising Edge), is setting dclk clock phase to 2/3(240°).
@@ -565,7 +568,9 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
 		clk_set_phase(tcon->dclk, 0);
 
 	regmap_update_bits(tcon->regs, SUN4I_TCON0_IO_POL_REG,
-			   SUN4I_TCON0_IO_POL_HSYNC_POSITIVE | SUN4I_TCON0_IO_POL_VSYNC_POSITIVE,
+			   SUN4I_TCON0_IO_POL_HSYNC_POSITIVE |
+			   SUN4I_TCON0_IO_POL_VSYNC_POSITIVE |
+			   SUN4I_TCON0_IO_POL_DE_NEGATIVE,
 			   val);
 
 	/* Map output pins to channel 0 */
drivers/gpu/drm/sun4i/sun4i_tcon.h +1 -0
index 3d492c8be1fc..b5214d71610f 100644
@@ -116,6 +116,7 @@
 
 #define SUN4I_TCON0_IO_POL_REG			0x88
 #define SUN4I_TCON0_IO_POL_DCLK_PHASE(phase)		((phase & 3) << 28)
+#define SUN4I_TCON0_IO_POL_DE_NEGATIVE			BIT(27)
 #define SUN4I_TCON0_IO_POL_HSYNC_POSITIVE		BIT(25)
 #define SUN4I_TCON0_IO_POL_VSYNC_POSITIVE		BIT(24)
 
Signature · 6 lines
2.19.1

-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
For more options, visit https://groups.google.com/d/optout.
#5 lore raw

PATCH v2 3/7 dt-bindings: Add vendor prefix for LeMaker

In reply to Paul Kocialkowski

This introduces a new device-tree binding vendor prefix for Shenzhen LeMaker Technology Co., Ltd.

---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/vendor-prefixes.txt +1 -0
index 0f5453d1823c..4eecfbf866a4 100644
@@ -206,6 +206,7 @@ laird	Laird PLC
 lantiq	Lantiq Semiconductor
 lattice	Lattice Semiconductor
 lego	LEGO Systems A/S
+lemaker	Shenzhen LeMaker Technology Co., Ltd.
 lenovo	Lenovo Group Ltd.
 lg	LG Corporation
 libretech	Shenzhen Libre Technology Co., Ltd
Signature · 1 line
2.19.1
maintainer Reviewed-by on v2 3/7
#6 lore raw

Re: [PATCH v2 3/7] dt-bindings: Add vendor prefix for LeMaker

Quoted 2 lines · Paul Kocialkowski

This introduces a new device-tree binding vendor prefix for Shenzhen LeMaker Technology Co., Ltd.

Would be nice to say this is already in use, but wasn't documented.

Quoted 5 lines
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

In any case,

#7 lore raw

Re: [PATCH v2 3/7] dt-bindings: Add vendor prefix for LeMaker

Hi,

Quoted 5 lines · Rob Herring
Quoted 2 lines · Paul Kocialkowski

This introduces a new device-tree binding vendor prefix for Shenzhen LeMaker Technology Co., Ltd.

Would be nice to say this is already in use, but wasn't documented.

Oh right, it is indeed already used by a few devices.

Quoted 8 lines
Quoted 4 lines
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

In any case,

I'll change that in v3 and include your Reviewed-by.

Cheers,

Paul

Signature · 5 lines
Developer of free digital technology and hardware support.

Website: https://www.paulk.fr/
Coding blog: https://code.paulk.fr/
Git repositories: https://git.paulk.fr/ https://git.code.paulk.fr/
#8 lore raw

PATCH v2 4/7 dt-bindings: Add bindings for the LeMaker BL035-RGB-002 LCD panel

In reply to Paul Kocialkowski

This adds the device-tree bindings for the LeMaker BL035-RGB-002 3.5" QVGA TFT LCD panel, compatible with simple-panel.

---
 .../bindings/display/panel/lemaker,bl035-rgb-002.txt       | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/lemaker,bl035-rgb-002.txt
Documentation/devicetree/bindings/display/panel/lemaker,bl035-rgb-002.txt new file +7 -0
new file mode 100644
index 000000000000..22cff3eb1b8f
@@ -0,0 +1,7 @@
+LeMaker BL035-RGB-002 3.5" QVGA TFT LCD panel
+
+Required properties:
+- compatible: should be "lemaker,bl035-rgb-002"
+
+This binding is compatible with the simple-panel binding, which is specified
+in simple-panel.txt in this directory.
Signature · 1 line
2.19.1
maintainer
#9 lore raw

Re: [PATCH v2 4/7] dt-bindings: Add bindings for the LeMaker BL035-RGB-002 LCD panel

Quoted 15 lines · Paul Kocialkowski

This adds the device-tree bindings for the LeMaker BL035-RGB-002 3.5" QVGA TFT LCD panel, compatible with simple-panel.

---
 .../bindings/display/panel/lemaker,bl035-rgb-002.txt       | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/lemaker,bl035-rgb-002.txt
Documentation/devicetree/bindings/display/panel/lemaker,bl035-rgb-002.txt new file +0 -0
new file mode 100644
index 000000000000..22cff3eb1b8f

Documentation/devicetree/bindings/display/panel/lemaker,bl035-rgb-002.txt line 4

Quoted 4 lines
Documentation/devicetree/bindings/display/panel/lemaker,bl035-rgb-002.txt new file +4 -0
@@ -0,0 +1,7 @@
+LeMaker BL035-RGB-002 3.5" QVGA TFT LCD panel
+
+Required properties:
+- compatible: should be "lemaker,bl035-rgb-002"

No power supply or backlight? You need to enumerate exactly which properties you are using.

Quoted 6 lines
Documentation/devicetree/bindings/display/panel/lemaker,bl035-rgb-002.txt new file +3 -0
+
+This binding is compatible with the simple-panel binding, which is specified
+in simple-panel.txt in this directory.
Signature · 1 line
2.19.1
#10 lore raw

PATCH v2 5/7 drm/panel: simple: Add support for the LeMaker BL035-RGB-002 3.5" LCD

In reply to Paul Kocialkowski

This adds support for the 3.5" LCD panel from LeMaker, sold for use with BananaPi boards. It comes with a 24-bit RGB888 parallel interface and requires an active-low DE signal

---
 drivers/gpu/drm/panel/panel-simple.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
drivers/gpu/drm/panel/panel-simple.c +27 -0
index 90296090340e..8e147cfa7b88 100644
@@ -1562,6 +1562,30 @@ static const struct panel_desc kyo_tcg121xglp = {
 	.bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
 };
 
+static const struct drm_display_mode lemaker_bl035_rgb_002_mode = {
+	.clock = 7000,
+	.hdisplay = 320,
+	.hsync_start = 320 + 20,
+	.hsync_end = 320 + 20 + 30,
+	.htotal = 320 + 20 + 30 + 38,
+	.vdisplay = 240,
+	.vsync_start = 240 + 4,
+	.vsync_end = 240 + 4 + 3,
+	.vtotal = 240 + 4 + 3 + 15,
+	.vrefresh = 60,
+};
+
+static const struct panel_desc lemaker_bl035_rgb_002 = {
+	.modes = &lemaker_bl035_rgb_002_mode,
+	.num_modes = 1,
+	.size = {
+		.width = 70,
+		.height = 52,
+	},
+	.bus_format = MEDIA_BUS_FMT_RGB888_1X24,
+	.bus_flags = DRM_BUS_FLAG_DE_LOW,
+};
+
 static const struct drm_display_mode lg_lb070wv8_mode = {
 	.clock = 33246,
 	.hdisplay = 800,
@@ -2569,6 +2593,9 @@ static const struct of_device_id platform_of_match[] = {
 	}, {
 		.compatible = "kyo,tcg121xglp",
 		.data = &kyo_tcg121xglp,
+	}, {
+		.compatible = "lemaker,bl035-rgb-002",
+		.data = &lemaker_bl035_rgb_002,
 	}, {
 		.compatible = "lg,lb070wv8",
 		.data = &lg_lb070wv8,
Signature · 1 line
2.19.1
#11 lore raw

PATCH v2 6/7 ARM: dts: sun7i: Add pinmux configuration for LCD0 RGB888 pins

In reply to Paul Kocialkowski

This adds the pin muxing definition for configuring the PD pins in LCD0 mode for a RGB888 format to the sun7i device-tree.

---
 arch/arm/boot/dts/sun7i-a20.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/boot/dts/sun7i-a20.dtsi +11 -0
index 9c52712af241..26f3714eaad0 100644
@@ -811,6 +811,17 @@
 				function = "ir1";
 			};
 
+			lcd0_rgb888_pins: lcd0-rgb888 {
+				pins = "PD0", "PD1", "PD2", "PD3",
+				       "PD4", "PD5", "PD6", "PD7",
+				       "PD8", "PD9", "PD10", "PD11",
+				       "PD12", "PD13", "PD14", "PD15",
+				       "PD16", "PD17", "PD18", "PD19",
+				       "PD20", "PD21", "PD22", "PD23",
+				       "PD24", "PD25", "PD26", "PD27";
+				function = "lcd0";
+			};
+
 			mmc0_pins_a: mmc0@0 {
 				pins = "PF0", "PF1", "PF2",
 				       "PF3", "PF4", "PF5";
Signature · 1 line
2.19.1
#12 lore raw

PATCH v2 7/7 ARM: dts: sun7i-a20-bananapi: Add bindings for the LeMaker 3.5" LCD

In reply to Paul Kocialkowski

This adds the backlight panel, power, pwm and tcon0 device-tree bindings required for supporting the 3.5" LCD from LeMaker on the BananaPi M1.

---
 arch/arm/boot/dts/sun7i-a20-bananapi.dts | 89 ++++++++++++++++++++++++
 1 file changed, 89 insertions(+)
arch/arm/boot/dts/sun7i-a20-bananapi.dts +89 -0
index 70dfc4ac0bb5..dd2f8bc41fae 100644
@@ -48,6 +48,7 @@
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/pwm/pwm.h>
 
 / {
 	model = "LeMaker Banana Pi";
@@ -63,6 +64,75 @@
 		stdout-path = "serial0:115200n8";
 	};
 
+
+	backlight: backlight {
+		compatible = "pwm-backlight";
+		pwms = <&pwm 0 50000 0>;
+		brightness-levels = <  0   1   1   1   1   2   2   2
+				       2   3   3   3   3   4   4   4
+				       5   5   5   6   6   6   7   7
+				       8   8   8   9   9   9  10  10
+				      10  11  11  12  12  12  13  13
+				      14  14  14  15  15  16  16  17
+				      17  17  18  18  19  19  20  20
+				      21  21  21  22  22  23  23  24
+				      24  25  25  26  26  27  27  28
+				      28  29  30  30  31  31  32  32
+				      33  33  34  35  35  36  36  37
+				      38  38  39  39  40  41  41  42
+				      43  43  44  44  45  46  47  47
+				      48  49  49  50  51  51  52  53
+				      54  54  55  56  57  57  58  59
+				      60  61  61  62  63  64  65  65
+				      66  67  68  69  70  71  71  72
+				      73  74  75  76  77  78  79  80
+				      81  82  83  84  85  86  87  88
+				      89  90  91  92  93  94  95  96
+				      97  98  99 101 102 103 104 105
+				     106 108 109 110 111 112 114 115
+				     116 117 119 120 121 123 124 125
+				     127 128 129 131 132 133 135 136
+				     138 139 141 142 144 145 147 148
+				     150 151 153 154 156 157 159 161
+				     162 164 166 167 169 171 173 174
+				     176 178 180 181 183 185 187 189
+				     191 192 194 196 198 200 202 204
+				     206 208 210 212 214 216 219 221
+				     223 225 227 229 232 234 236 238
+				     241 242 244 246 248 250 253 255>;
+		default-brightness-level = <128>;
+		enable-gpios = <&pio 7 8 GPIO_ACTIVE_HIGH>; /* PH8 */
+	};
+
+	panel: panel {
+		compatible = "lemaker,bl035";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		power-supply = <&panel_power>;
+		backlight = <&backlight>;
+
+		port@0 {
+			reg = <0>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			panel_input: endpoint@0 {
+				reg = <0>;
+				remote-endpoint = <&tcon0_out_panel>;
+			};
+		};
+	};
+
+	panel_power: panel_power {
+		compatible = "regulator-fixed";
+		regulator-name = "panel-power";
+		regulator-min-microvolt = <10400000>;
+		regulator-max-microvolt = <10400000>;
+		gpio = <&pio 7 12 GPIO_ACTIVE_HIGH>; /* PH12 */
+		enable-active-high;
+		regulator-boot-on;
+	};
+
 	hdmi-connector {
 		compatible = "hdmi-connector";
 		type = "a";
@@ -275,6 +345,12 @@
 	};
 };
 
+&pwm {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pwm0_pins_a>;
+	status = "okay";
+};
+
 #include "axp209.dtsi"
 
 &reg_dcdc2 {
@@ -322,6 +398,19 @@
 	status = "okay";
 };
 
+&tcon0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&lcd0_rgb888_pins>;
+	status = "okay";
+};
+
+&tcon0_out {
+	tcon0_out_panel: endpoint@0 {
+		reg = <0>;
+		remote-endpoint = <&panel_input>;
+	};
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins_a>;
Signature · 1 line
2.19.1
#13 lore raw
In reply to Paul Kocialkowski

Hi,

Quoted 11 lines · Paul Kocialkowski

The series adds support for the BL035-RGB-002 LCD panel and the required device-tree bindings for using it on the BananaPi M1.

Only the changes related to the DRM driver and the panel are submitted for merge, which does not include the two final commits.

Changes since v1:
* Used the full name of the panel for dt bindings;
* Removed helper to match flags in order to only retrieve the connector once, as it was already done.
* Made the bus flags checking possible without a panel;

I forgot to mention that the last patch (not for merge) was untested.

Quoted 19 lines

Paul Kocialkowski (7):
drm/sun4i: tcon: Pass encoder instead of using panel for RGB setup drm/sun4i: tcon: Support an active-low DE signal with RGB interface
dt-bindings: Add vendor prefix for LeMaker
dt-bindings: Add bindings for the LeMaker BL035-RGB-002 LCD panel drm/panel: simple: Add support for the LeMaker BL035-RGB-002 3.5" LCD
ARM: dts: sun7i: Add pinmux configuration for LCD0 RGB888 pins
ARM: dts: sun7i-a20-bananapi: Add bindings for the LeMaker 3.5" LCD

 .../display/panel/lemaker,bl035-rgb-002.txt   |  7 ++
 .../devicetree/bindings/vendor-prefixes.txt   |  1 +
 arch/arm/boot/dts/sun7i-a20-bananapi.dts      | 89 +++++++++++++++++++
 arch/arm/boot/dts/sun7i-a20.dtsi              | 11 +++
 drivers/gpu/drm/panel/panel-simple.c          | 27 ++++++
 drivers/gpu/drm/sun4i/sun4i_tcon.c            | 29 +++---
 drivers/gpu/drm/sun4i/sun4i_tcon.h            |  1 +
 7 files changed, 151 insertions(+), 14 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/display/panel/lemaker,bl035-rgb-002.txt
Signature · 5 lines
Developer of free digital technology and hardware support.

Website: https://www.paulk.fr/
Coding blog: https://code.paulk.fr/
Git repositories: https://git.paulk.fr/ https://git.code.paulk.fr/