Skip to contentSkip to conversation

fix hdmi video setup for khadas vim3x boards

PATCH New Artem Lapkin 2 participants 6 messages Jan 15, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover fix hdmi video setup for khadas vim3x boards

next patches add missed parts

Artem Lapkin (2):
gpio: gpio-uclass: add OPEN_DRAIN flag parsing
arm64: dts: meson: fix meson-khadas-vim3-u-boot.dtsi

 arch/arm/dts/meson-khadas-vim3-u-boot.dtsi |  2 ++
 drivers/gpio/gpio-uclass.c                 | 10 ++++++++++
 2 files changed, 12 insertions(+)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 gpio: gpio-uclass: add OPEN_DRAIN flag parsing

add GPIOD_OPEN_DRAIN flag which cant parsed properly

Problem: for example cant power video system for sm1 g12a socs because OPEN_DRAIN flag cant parsed

DTS examples:

```
$ grep GPIO_OPEN_DRAIN\>  arch/arm/dts/meson-*.dt*
arch/arm/dts/meson-g12a-sei510.dts:		gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
arch/arm/dts/meson-g12a-u200.dts:		gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
arch/arm/dts/meson-gx-libretech-pc.dtsi:	gpio = <&gpio GPIOH_3 GPIO_OPEN_DRAIN>;
arch/arm/dts/meson-khadas-vim3.dtsi:		gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
arch/arm/dts/meson-sm1-sei610.dts:		gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
```
---
 drivers/gpio/gpio-uclass.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpio/gpio-uclass.c +9 -0
index bad6b71e0c..6225f32457 100644
@@ -574,6 +574,15 @@ int dm_gpio_set_value(const struct gpio_desc *desc, int value)
 	if (ret)
 		return ret;
 
+	if (desc->flags & GPIOD_OPEN_DRAIN) {
+		if (value)
+			gpio_get_ops(desc->dev)->direction_input(desc->dev, desc->offset);
+		else
+			gpio_get_ops(desc->dev)->direction_output(desc->dev, desc->offset, 0);
+
+		return 0;
+	}
+
 	if (desc->flags & GPIOD_ACTIVE_LOW)
 		value = !value;
 
Signature · 1 line
2.25.1
#2 lore raw

PATCH 1/2 gpio: gpio-uclass: add OPEN_DRAIN flag parsing

Hi,

This has already been pushed on u-boot master:
https://patchwork.ozlabs.org/project/uboot/patch/20200505084318.15307-2-narmstrong at baylibre.com/

Commit: 47bd533e9dd0f967ff7b62f3edfd6c97131e1501
Author: Neil Armstrong <[email protected]>
Date:   Tue May 5 10:43:17 2020 +0200

gpio: emulate open drain & open source in dm_gpio_set_value()

Handle the GPIOD_OPEN_DRAIN & GPIOD_OPEN_SOURCE flags to emulate open drain and open source by setting the GPIO line as input depending on the requested value.

The behaviour is taken from the Linux gpiolib.

Neil

Quoted 42 lines · Artem Lapkin

add GPIOD_OPEN_DRAIN flag which cant parsed properly

Problem: for example cant power video system for sm1 g12a socs because OPEN_DRAIN flag cant parsed

DTS examples:

```
$ grep GPIO_OPEN_DRAIN\>  arch/arm/dts/meson-*.dt*
arch/arm/dts/meson-g12a-sei510.dts:		gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
arch/arm/dts/meson-g12a-u200.dts:		gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
arch/arm/dts/meson-gx-libretech-pc.dtsi:	gpio = <&gpio GPIOH_3 GPIO_OPEN_DRAIN>;
arch/arm/dts/meson-khadas-vim3.dtsi:		gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
arch/arm/dts/meson-sm1-sei610.dts:		gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
```
---
 drivers/gpio/gpio-uclass.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpio/gpio-uclass.c +9 -0
index bad6b71e0c..6225f32457 100644
@@ -574,6 +574,15 @@ int dm_gpio_set_value(const struct gpio_desc *desc, int value)
 	if (ret)
 		return ret;
 
+	if (desc->flags & GPIOD_OPEN_DRAIN) {
+		if (value)
+			gpio_get_ops(desc->dev)->direction_input(desc->dev, desc->offset);
+		else
+			gpio_get_ops(desc->dev)->direction_output(desc->dev, desc->offset, 0);
+
+		return 0;
+	}
+
 	if (desc->flags & GPIOD_ACTIVE_LOW)
 		value = !value;
 
#3 lore raw

PATCH 2/2 arm64: dts: meson: fix meson-khadas-vim3-u-boot.dtsi

In reply to Artem Lapkin

Add missed include meson-g12-common-u-boot.dtsi

PROBLEM: missed hdmi video setup for VIM3 and VIM3L boards

---
 arch/arm/dts/meson-khadas-vim3-u-boot.dtsi | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/dts/meson-khadas-vim3-u-boot.dtsi +2 -0
index 81fd5be378..5d6444cbac 100644
@@ -10,6 +10,8 @@
 	};
 };
 
+#include "meson-g12-common-u-boot.dtsi"
+
 &sd_emmc_c {
 	status = "okay";
 	pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_4b_pins>, <&emmc_ds_pins>;
Signature · 1 line
2.25.1
#4 lore raw

PATCH 2/2 arm64: dts: meson: fix meson-khadas-vim3-u-boot.dtsi

Hi,

Quoted 14 lines · Artem Lapkin

Add missed include meson-g12-common-u-boot.dtsi

PROBLEM: missed hdmi video setup for VIM3 and VIM3L boards

---
 arch/arm/dts/meson-khadas-vim3-u-boot.dtsi | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/dts/meson-khadas-vim3-u-boot.dtsi +0 -0
index 81fd5be378..5d6444cbac 100644

arch/arm/dts/meson-khadas-vim3-u-boot.dtsi line 14

Quoted 5 lines
arch/arm/dts/meson-khadas-vim3-u-boot.dtsi +2 -0
@@ -10,6 +10,8 @@
 	};
 };
 
+#include "meson-g12-common-u-boot.dtsi"
+ 

It's not necessary since already included in:
arch/arm/dts/meson-g12b-a311d-khadas-vim3-u-boot.dtsi:#include "meson-g12-common-u-boot.dtsi" and
arch/arm/dts/meson-sm1-u-boot.dtsi:#include "meson-g12-common-u-boot.dtsi"

What u-boot version are you using ?
Please check u-boot-master and my u-boot-amlogic and u-boot-amlogic-next branches on https://gitlab.denx.de/u-boot/custodians/u-boot-amlogic before posting !

Thanks,
Neil

author
#5 lore raw

PATCH 2/2 arm64: dts: meson: fix meson-khadas-vim3-u-boot.dtsi

Quoted 1 line

It's not necessary since already included in:

Yes u right ! Sorry !

Quoted 39 lines · Neil Armstrong

Hi,

Review

Quoted 10 lines · Artem Lapkin

Add missed include meson-g12-common-u-boot.dtsi

PROBLEM: missed hdmi video setup for VIM3 and VIM3L boards

---
 arch/arm/dts/meson-khadas-vim3-u-boot.dtsi | 2 ++
 1 file changed, 2 insertions(+)
(quoted diff) +0 -0

b/arch/arm/dts/meson-khadas-vim3-u-boot.dtsi

arch/arm/dts/meson-khadas-vim3-u-boot.dtsi line 14

Quoted 9 lines

index 81fd5be378..5d6444cbac 100644

arch/arm/dts/meson-khadas-vim3-u-boot.dtsi +2 -0
@@ -10,6 +10,8 @@
      };
 };
 
+#include "meson-g12-common-u-boot.dtsi"
+

It's not necessary since already included in:
arch/arm/dts/meson-g12b-a311d-khadas-vim3-u-boot.dtsi:#include "meson-g12-common-u-boot.dtsi"
and
arch/arm/dts/meson-sm1-u-boot.dtsi:#include "meson-g12-common-u-boot.dtsi"

What u-boot version are you using ?
Please check u-boot-master and my u-boot-amlogic and u-boot-amlogic-next branches on https://gitlab.denx.de/u-boot/custodians/u-boot-amlogic
before posting !

Thanks,
Neil