Skip to contentSkip to conversation

OnePlus 6 fixes

PATCH In review Caleb Connolly 2 participants 8 messages Jul 20, 2021

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

cover OnePlus 6 fixes

This series is another collection of small fixes for the OnePlus 6 and 6T. Notably we finally have finally tracked down and fixed the reserved memory related crashes!
We also enable UART as well as take Bjorns approach to working around the panel reset GPIO issue making the reset GPIO optional in the panel driver. Lastly we fix up the ipa firmware path now that firmware-names is supported for it in 5.14.

The patch ("drm/panel/samsung-sofef00: make gpio optional") is a reworked version of a patch from a previous series which was not accepted: ("drm: panel:
sofef00: remove reset GPIO handling")
https://lore.kernel.org/linux-arm-msm/[email protected]/

Caleb Connolly (5):
arm64: dts: qcom: sdm845-oneplus: fix reserved-mem
dts: arm64: sdm845-oneplus-common: enable debug UART drm/panel/samsung-sofef00: make gpio optional
arm64: dts: qcom: sdm845-oneplus-fajita: remove panel reset gpio
arm64: dts: qcom: sdm845-oneplus: add ipa firmware names

 .../boot/dts/qcom/sdm845-oneplus-common.dtsi  | 19 ++++++++++++++-----
 .../dts/qcom/sdm845-oneplus-enchilada.dts     |  2 ++
 drivers/gpu/drm/panel/panel-samsung-sofef00.c |  7 +++++--
 3 files changed, 21 insertions(+), 7 deletions(-)

--
2.32.0

#1 lore raw

PATCH 1/5 arm64: dts: qcom: sdm845-oneplus: fix reserved-mem

Fix the upper guard and the "removed_region", this fixes the random crashes which used to occur in memory intensive loads. I'm not sure WHY the upper guard being 0x2000 instead of 0x1000 doesn't fix this, but it HAS to be 0x1000.

Fixes e60fd5ac1f68 ("arm64: dts: qcom: sdm845-oneplus-common: guard

rmtfs-mem")

---
 arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi +2 -2
index 4d052e39b348..eb6b1d15293d 100644
@@ -69,7 +69,7 @@ rmtfs_mem: memory@f5b01000 {
 		};
 		rmtfs_upper_guard: memory@f5d01000 {
 			no-map;
-			reg = <0 0xf5d01000 0 0x2000>;
+			reg = <0 0xf5d01000 0 0x1000>;
 		};
 
 		/*
@@ -78,7 +78,7 @@ rmtfs_upper_guard: memory@f5d01000 {
 		 */
 		removed_region: memory@88f00000 {
 			no-map;
-			reg = <0 0x88f00000 0 0x200000>;
+			reg = <0 0x88f00000 0 0x1c00000>;
 		};
 
 		ramoops: ramoops@ac300000 {

--
2.32.0

#2 lore raw

PATCH 2/5 dts: arm64: sdm845-oneplus-common: enable debug UART

In reply to Caleb Connolly

A labelled diagram showing the location of the Rx and Tx testpoints for the OnePlus 6 is available on the postmarketOS wiki:

https://wiki.postmarketos.org/wiki/Serial_debugging:Cable_schematics

The device uses 1.8v UART at a baud rate of 115200, bootloader output is also available here.

---
 arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi +10 -0
index eb6b1d15293d..e81f5cc9f26d 100644
@@ -19,9 +19,14 @@
 
 / {
 	aliases {
+		serial0 = &uart9;
 		hsuart0 = &uart6;
 	};
 
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
 	gpio-keys {
 		compatible = "gpio-keys";
 		label = "Volume keys";
@@ -526,6 +531,11 @@ bluetooth {
 	};
 };
 
+&uart9 {
+	label = "LS-UART1";
+	status = "okay";
+};
+
 &ufs_mem_hc {
 	status = "okay";
 

--
2.32.0

#3 lore raw

PATCH 3/5 drm/panel/samsung-sofef00: make gpio optional

In reply to Caleb Connolly

The OnePlus 6T panel fails to initialise if it has been reset, workaround this by allowing panels to not specify a reset GPIO.

---
 drivers/gpu/drm/panel/panel-samsung-sofef00.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/panel/panel-samsung-sofef00.c +5 -2
index 8cb1853574bb..a20a5af14653 100644
@@ -44,6 +44,8 @@ struct sofef00_panel *to_sofef00_panel(struct drm_panel *panel)
 
 static void sofef00_panel_reset(struct sofef00_panel *ctx)
 {
+	if (!ctx->reset_gpio)
+		return;
 	gpiod_set_value_cansleep(ctx->reset_gpio, 0);
 	usleep_range(5000, 6000);
 	gpiod_set_value_cansleep(ctx->reset_gpio, 1);
@@ -137,7 +139,8 @@ static int sofef00_panel_prepare(struct drm_panel *panel)
 	ret = sofef00_panel_on(ctx);
 	if (ret < 0) {
 		dev_err(dev, "Failed to initialize panel: %d\n", ret);
-		gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+		if (ctx->reset_gpio)
+			gpiod_set_value_cansleep(ctx->reset_gpio, 1);
 		return ret;
 	}
 
@@ -276,7 +279,7 @@ static int sofef00_panel_probe(struct mipi_dsi_device *dsi)
 		return ret;
 	}
 
-	ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
+	ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
 	if (IS_ERR(ctx->reset_gpio)) {
 		ret = PTR_ERR(ctx->reset_gpio);
 		dev_warn(dev, "Failed to get reset-gpios: %d\n", ret);

--
2.32.0

#4 lore raw

Re: [PATCH 3/5] drm/panel/samsung-sofef00: make gpio optional

Quoted 13 lines · Caleb Connolly

The OnePlus 6T panel fails to initialise if it has been reset, workaround this by allowing panels to not specify a reset GPIO.

---
 drivers/gpu/drm/panel/panel-samsung-sofef00.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/panel/panel-samsung-sofef00.c +0 -0
index 8cb1853574bb..a20a5af14653 100644

drivers/gpu/drm/panel/panel-samsung-sofef00.c struct sofef00_panel *to_sofef00_panel(struct drm_panel *panel) · line 47

Quoted 4 lines
drivers/gpu/drm/panel/panel-samsung-sofef00.c +1 -0
@@ -44,6 +44,8 @@ struct sofef00_panel *to_sofef00_panel(struct drm_panel *panel)
 
 static void sofef00_panel_reset(struct sofef00_panel *ctx)
 {
+	if (!ctx->reset_gpio)

gpiod_set_value_cansleep(NULL, 1) is a perfectly valid nop, so I don't think you need to make this conditional.

That said, don't you need this to get the panel out of reset once you apply power after it being powered off?

drivers/gpu/drm/panel/panel-samsung-sofef00.c static int sofef00_panel_prepare(struct drm_panel *panel) · line 142

Quoted 10 lines
drivers/gpu/drm/panel/panel-samsung-sofef00.c +2 -1
+		return;
 	gpiod_set_value_cansleep(ctx->reset_gpio, 0);
 	usleep_range(5000, 6000);
 	gpiod_set_value_cansleep(ctx->reset_gpio, 1);
@@ -137,7 +139,8 @@ static int sofef00_panel_prepare(struct drm_panel *panel)
 	ret = sofef00_panel_on(ctx);
 	if (ret < 0) {
 		dev_err(dev, "Failed to initialize panel: %d\n", ret);
-		gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+		if (ctx->reset_gpio)

Ditto.

Regards,
Bjorn

Quoted 17 lines
drivers/gpu/drm/panel/panel-samsung-sofef00.c +2 -2
+			gpiod_set_value_cansleep(ctx->reset_gpio, 1);
 		return ret;
 	}
 
@@ -276,7 +279,7 @@ static int sofef00_panel_probe(struct mipi_dsi_device *dsi)
 		return ret;
 	}
 
-	ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
+	ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
 	if (IS_ERR(ctx->reset_gpio)) {
 		ret = PTR_ERR(ctx->reset_gpio);
 		dev_warn(dev, "Failed to get reset-gpios: %d\n", ret);
--

2.32.0

#5 lore raw

Re: [PATCH 3/5] drm/panel/samsung-sofef00: make gpio optional

Hi Bjorn,

Quoted 16 lines · Bjorn Andersson
Quoted 14 lines · Caleb Connolly

The OnePlus 6T panel fails to initialise if it has been reset, workaround this by allowing panels to not specify a reset GPIO.

---
  drivers/gpu/drm/panel/panel-samsung-sofef00.c | 7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/panel/panel-samsung-sofef00.c +0 -0
index 8cb1853574bb..a20a5af14653 100644
@@ -44,6 +44,8 @@ struct sofef00_panel *to_sofef00_panel(struct drm_panel *panel)
 
Quoted 5 lines

drivers/gpu/drm/panel/panel-samsung-sofef00.c struct sofef00_panel *to_sofef00_panel(struct drm_panel *panel) · line 47

Quoted 3 lines
drivers/gpu/drm/panel/panel-samsung-sofef00.c +1 -0
  static void sofef00_panel_reset(struct sofef00_panel *ctx)
  {
+	if (!ctx->reset_gpio)

gpiod_set_value_cansleep(NULL, 1) is a perfectly valid nop, so I don't think you need to make this conditional.

Ah thanks, will revise.

Quoted 3 lines

That said, don't you need this to get the panel out of reset once you apply power after it being powered off?

It seems like the panel is out of reset by default, my best guess for this whole issue is that the bootloader does some initialisation

of the panel which we aren't able to reproduce, as the panel is left initialised (for cont splash) we're able to just make use of it as is.

With these patches supplied the OnePlus 6T is able to boot and function as expected, in the future it would be good to find a way to

properly set up the panel so that we aren't dependent on the bootloader...

Quoted 25 lines

drivers/gpu/drm/panel/panel-samsung-sofef00.c static int sofef00_panel_prepare(struct drm_panel *panel) · line 142

Quoted 11 lines
drivers/gpu/drm/panel/panel-samsung-sofef00.c +2 -1
+		return;
  	gpiod_set_value_cansleep(ctx->reset_gpio, 0);
  	usleep_range(5000, 6000);
  	gpiod_set_value_cansleep(ctx->reset_gpio, 1);
@@ -137,7 +139,8 @@ static int sofef00_panel_prepare(struct drm_panel *panel)
  	ret = sofef00_panel_on(ctx);
  	if (ret < 0) {
  		dev_err(dev, "Failed to initialize panel: %d\n", ret);
-		gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+		if (ctx->reset_gpio)

Ditto.

Regards,
Bjorn

Quoted 8 lines
drivers/gpu/drm/panel/panel-samsung-sofef00.c +1 -0
+			gpiod_set_value_cansleep(ctx->reset_gpio, 1);
  		return ret;
  	}
 
@@ -276,7 +279,7 @@ static int sofef00_panel_probe(struct mipi_dsi_device *dsi)
  		return ret;
  	}
 
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/panel/panel-samsung-sofef00.c +1 -2
-	ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
+	ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
  	if (IS_ERR(ctx->reset_gpio)) {
  		ret = PTR_ERR(ctx->reset_gpio);
  		dev_warn(dev, "Failed to get reset-gpios: %d\n", ret);
--

2.32.0

Kind Regards,

Caleb

#6 lore raw

PATCH 4/5 arm64: dts: qcom: sdm845-oneplus-fajita: remove panel reset gpio

In reply to Caleb Connolly

Don't specify the reset GPIO for the OnePlus 6T, the panel in the 6T will refuse to initialise if it has been reset so use this as a workaround.

---
 arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi   | 4 +---
 arch/arm64/boot/dts/qcom/sdm845-oneplus-enchilada.dts | 2 ++
 2 files changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi +1 -3
index e81f5cc9f26d..1339bac8afc2 100644
@@ -331,8 +331,6 @@ display_panel: panel@0 {
 
 		vddio-supply = <&vreg_l14a_1p88>;
 
-		reset-gpios = <&tlmm 6 GPIO_ACTIVE_LOW>;
-
 		pinctrl-names = "default";
 		pinctrl-0 = <&panel_reset_pins &panel_te_pin &panel_esd_pin>;
 
@@ -615,7 +613,7 @@ mux {
 			pins = "gpio6", "gpio25", "gpio26";
 			function = "gpio";
 			drive-strength = <8>;
-			bias-disable = <0>;
+			bias-disable;
 		};
 	};
 
arch/arm64/boot/dts/qcom/sdm845-oneplus-enchilada.dts +2 -0
index 72842c887617..5c728c1555f3 100644
@@ -16,4 +16,6 @@ &display_panel {
 	status = "okay";
 
 	compatible = "samsung,sofef00";
+
+	reset-gpios = <&tlmm 6 GPIO_ACTIVE_LOW>;
 };

--
2.32.0

#7 lore raw

PATCH 5/5 arm64: dts: qcom: sdm845-oneplus: add ipa firmware names

In reply to Caleb Connolly

Add the correct patch to the ipa firmware now that custom paths are supported.

---
 arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi +1 -0
index 1339bac8afc2..96304f8688ed 100644
@@ -406,6 +406,7 @@ &ipa {
 	status = "okay";
 
 	memory-region = <&ipa_fw_mem>;
+	firmware-name = "qcom/sdm845/oneplus6/ipa_fws.mbn";
 };
 
 &mdss {

--
2.32.0