linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* OnePlus 6 fixups
@ 2021-05-02  1:42 Caleb Connolly
  2021-05-02  1:42 ` [PATCH 1/4] arm64: dts: qcom: sdm845-oneplus-common: remove panel reset gpio Caleb Connolly
  2021-05-02  1:42 ` [PATCH 2/4] drm: panel: sofef00: remove reset GPIO handling Caleb Connolly
  0 siblings, 2 replies; 5+ messages in thread
From: Caleb Connolly @ 2021-05-02  1:42 UTC (permalink / raw)
  To: caleb; +Cc: ~postmarketos/upstreaming, phone-devel, linux-arm-msm

This series contains a few fixes for the OnePlus 6 and 6T.

The display panel driver for the devices currently implements
support for the reset pin.
This behaviour is fine on the 6 but on the 6T it seems to break the
panel. This suggests an issue with the initialisation sequence however
we haven't been able to find a way to bring up the panel without this.
In the mean time, removing the reset capabilities solves the issues for
us and doesn't introduce any other problems.

We also add a guard around the RMTFS memory region, this is implemented
by the msm_sharedmem driver in the vendor kernel, but not a feature
supported by mainline just yet. This is to workaround limitations in
Qualcomms XPU hardware which can trigger false violations and crash the
device if memory is allocated close to the RMTFS region.

Finally, enable the IPA node, modemmanager is gaining support for QRTR
modems and with that we can have mobile data working on the device!

	^Caleb




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/4] arm64: dts: qcom: sdm845-oneplus-common: remove panel reset gpio
  2021-05-02  1:42 OnePlus 6 fixups Caleb Connolly
@ 2021-05-02  1:42 ` Caleb Connolly
  2021-05-02  1:42 ` [PATCH 2/4] drm: panel: sofef00: remove reset GPIO handling Caleb Connolly
  1 sibling, 0 replies; 5+ messages in thread
From: Caleb Connolly @ 2021-05-02  1:42 UTC (permalink / raw)
  To: caleb, Andy Gross, Bjorn Andersson, Rob Herring
  Cc: ~postmarketos/upstreaming, phone-devel, linux-arm-msm,
	devicetree, linux-kernel

Resetting the panel causes issues on fajita, it is also completely
unnecessary for normal use so lets just not bother.

Signed-off-by: Caleb Connolly <caleb@connolly.tech>
---
 arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
index 8f617f7b6d34..8f3f5c687b4a 100644
--- a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
@@ -314,8 +314,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>;
 
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/4] drm: panel: sofef00: remove reset GPIO handling
  2021-05-02  1:42 OnePlus 6 fixups Caleb Connolly
  2021-05-02  1:42 ` [PATCH 1/4] arm64: dts: qcom: sdm845-oneplus-common: remove panel reset gpio Caleb Connolly
@ 2021-05-02  1:42 ` Caleb Connolly
  2021-05-25 15:36   ` Bjorn Andersson
  2021-06-24 15:32   ` Linus Walleij
  1 sibling, 2 replies; 5+ messages in thread
From: Caleb Connolly @ 2021-05-02  1:42 UTC (permalink / raw)
  To: caleb, Thierry Reding, Sam Ravnborg, David Airlie, Daniel Vetter
  Cc: ~postmarketos/upstreaming, phone-devel, linux-arm-msm, dri-devel,
	linux-kernel

Resetting the panel on fajita causes it to never come back, we aren't
quite sure why this is so for now lets remove reset handling as it is
effectively broken. It is also not needed on enchilada.

Signed-off-by: Caleb Connolly <caleb@connolly.tech>
---
 drivers/gpu/drm/panel/panel-samsung-sofef00.c | 26 +++----------------
 1 file changed, 4 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-samsung-sofef00.c b/drivers/gpu/drm/panel/panel-samsung-sofef00.c
index 8cb1853574bb..cfc8b2a19742 100644
--- a/drivers/gpu/drm/panel/panel-samsung-sofef00.c
+++ b/drivers/gpu/drm/panel/panel-samsung-sofef00.c
@@ -23,7 +23,6 @@ struct sofef00_panel {
 	struct drm_panel panel;
 	struct mipi_dsi_device *dsi;
 	struct regulator *supply;
-	struct gpio_desc *reset_gpio;
 	const struct drm_display_mode *mode;
 	bool prepared;
 };
@@ -42,16 +41,6 @@ struct sofef00_panel *to_sofef00_panel(struct drm_panel *panel)
 			return ret;					\
 	} while (0)
 
-static void sofef00_panel_reset(struct sofef00_panel *ctx)
-{
-	gpiod_set_value_cansleep(ctx->reset_gpio, 0);
-	usleep_range(5000, 6000);
-	gpiod_set_value_cansleep(ctx->reset_gpio, 1);
-	usleep_range(2000, 3000);
-	gpiod_set_value_cansleep(ctx->reset_gpio, 0);
-	usleep_range(12000, 13000);
-}
-
 static int sofef00_panel_on(struct sofef00_panel *ctx)
 {
 	struct mipi_dsi_device *dsi = ctx->dsi;
@@ -132,12 +121,9 @@ static int sofef00_panel_prepare(struct drm_panel *panel)
 		return ret;
 	}
 
-	sofef00_panel_reset(ctx);
-
 	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);
 		return ret;
 	}
 
@@ -155,8 +141,11 @@ static int sofef00_panel_unprepare(struct drm_panel *panel)
 		return 0;
 
 	ret = sofef00_panel_off(ctx);
-	if (ret < 0)
+
+	if (ret < 0) {
 		dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
+		return ret;
+	}
 
 	regulator_disable(ctx->supply);
 
@@ -276,13 +265,6 @@ static int sofef00_panel_probe(struct mipi_dsi_device *dsi)
 		return ret;
 	}
 
-	ctx->reset_gpio = devm_gpiod_get(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);
-		return ret;
-	}
-
 	ctx->dsi = dsi;
 	mipi_dsi_set_drvdata(dsi, ctx);
 
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/4] drm: panel: sofef00: remove reset GPIO handling
  2021-05-02  1:42 ` [PATCH 2/4] drm: panel: sofef00: remove reset GPIO handling Caleb Connolly
@ 2021-05-25 15:36   ` Bjorn Andersson
  2021-06-24 15:32   ` Linus Walleij
  1 sibling, 0 replies; 5+ messages in thread
From: Bjorn Andersson @ 2021-05-25 15:36 UTC (permalink / raw)
  To: Caleb Connolly
  Cc: Thierry Reding, Sam Ravnborg, David Airlie, Daniel Vetter,
	~postmarketos/upstreaming, phone-devel, linux-arm-msm, dri-devel,
	linux-kernel

On Sat 01 May 20:42 CDT 2021, Caleb Connolly wrote:

> Resetting the panel on fajita causes it to never come back, we aren't
> quite sure why this is so for now lets remove reset handling as it is
> effectively broken. It is also not needed on enchilada.
> 
> Signed-off-by: Caleb Connolly <caleb@connolly.tech>
> ---
>  drivers/gpu/drm/panel/panel-samsung-sofef00.c | 26 +++----------------
>  1 file changed, 4 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-samsung-sofef00.c b/drivers/gpu/drm/panel/panel-samsung-sofef00.c
> index 8cb1853574bb..cfc8b2a19742 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-sofef00.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-sofef00.c
> @@ -23,7 +23,6 @@ struct sofef00_panel {
>  	struct drm_panel panel;
>  	struct mipi_dsi_device *dsi;
>  	struct regulator *supply;
> -	struct gpio_desc *reset_gpio;
>  	const struct drm_display_mode *mode;
>  	bool prepared;
>  };
> @@ -42,16 +41,6 @@ struct sofef00_panel *to_sofef00_panel(struct drm_panel *panel)
>  			return ret;					\
>  	} while (0)
>  
> -static void sofef00_panel_reset(struct sofef00_panel *ctx)
> -{
> -	gpiod_set_value_cansleep(ctx->reset_gpio, 0);
> -	usleep_range(5000, 6000);
> -	gpiod_set_value_cansleep(ctx->reset_gpio, 1);
> -	usleep_range(2000, 3000);
> -	gpiod_set_value_cansleep(ctx->reset_gpio, 0);
> -	usleep_range(12000, 13000);
> -}
> -
>  static int sofef00_panel_on(struct sofef00_panel *ctx)
>  {
>  	struct mipi_dsi_device *dsi = ctx->dsi;
> @@ -132,12 +121,9 @@ static int sofef00_panel_prepare(struct drm_panel *panel)
>  		return ret;
>  	}
>  
> -	sofef00_panel_reset(ctx);
> -
>  	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);
>  		return ret;
>  	}
>  
> @@ -155,8 +141,11 @@ static int sofef00_panel_unprepare(struct drm_panel *panel)
>  		return 0;
>  
>  	ret = sofef00_panel_off(ctx);
> -	if (ret < 0)
> +
> +	if (ret < 0) {
>  		dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
> +		return ret;

This early return seems unrelated to what's described in the commit
message.

Also as a general comment, what do you expect the software should do if
you return an error in the unprepare path? Can we if this happens just
continue to display stuff on the display?

> +	}
>  
>  	regulator_disable(ctx->supply);
>  
> @@ -276,13 +265,6 @@ static int sofef00_panel_probe(struct mipi_dsi_device *dsi)
>  		return ret;
>  	}
>  
> -	ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);

If I understand your description in the cover letter this works for one
of the devices using the panel, but not the other.

So how about using devm_gpiod_get_optional() instead. That will give you
NULL back if the property isn't defined and make all the gpiod
operations nops.

Regards,
Bjorn

> -	if (IS_ERR(ctx->reset_gpio)) {
> -		ret = PTR_ERR(ctx->reset_gpio);
> -		dev_warn(dev, "Failed to get reset-gpios: %d\n", ret);
> -		return ret;
> -	}
> -
>  	ctx->dsi = dsi;
>  	mipi_dsi_set_drvdata(dsi, ctx);
>  
> -- 
> 2.30.2
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/4] drm: panel: sofef00: remove reset GPIO handling
  2021-05-02  1:42 ` [PATCH 2/4] drm: panel: sofef00: remove reset GPIO handling Caleb Connolly
  2021-05-25 15:36   ` Bjorn Andersson
@ 2021-06-24 15:32   ` Linus Walleij
  1 sibling, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2021-06-24 15:32 UTC (permalink / raw)
  To: Caleb Connolly
  Cc: Thierry Reding, Sam Ravnborg, David Airlie, Daniel Vetter,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS
	<devicetree@vger.kernel.org>,
	Hans de Goede <hdegoede@redhat.com>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,,
	phone-devel, MSM, open list:DRM PANEL DRIVERS, linux-kernel

On Sun, May 2, 2021 at 3:43 AM Caleb Connolly <caleb@connolly.tech> wrote:

> Resetting the panel on fajita causes it to never come back, we aren't
> quite sure why this is so for now lets remove reset handling as it is
> effectively broken. It is also not needed on enchilada.

Where are the device trees for these platforms?

Are there schematics so we/someone with access to the schematics
can figure it out?

It's not something trivial like forgotten to put GPIO_ACTIVE_LOW
on the gpio phandle?

> -static void sofef00_panel_reset(struct sofef00_panel *ctx)
> -{
> -       gpiod_set_value_cansleep(ctx->reset_gpio, 0);
> -       usleep_range(5000, 6000);
> -       gpiod_set_value_cansleep(ctx->reset_gpio, 1);
> -       usleep_range(2000, 3000);
> -       gpiod_set_value_cansleep(ctx->reset_gpio, 0);
> -       usleep_range(12000, 13000);
> -}

This code looks a bit weird to begin with, I don't see the point
with the first setting the gpiod low, either it was low already or
high already neither matters, driving it asserted will assert it
either way.

No big deal though.

> -       ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);

As Bjorn says: just use *_optional and comment the line out in the
device tree if there is a problem.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-24 15:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-02  1:42 OnePlus 6 fixups Caleb Connolly
2021-05-02  1:42 ` [PATCH 1/4] arm64: dts: qcom: sdm845-oneplus-common: remove panel reset gpio Caleb Connolly
2021-05-02  1:42 ` [PATCH 2/4] drm: panel: sofef00: remove reset GPIO handling Caleb Connolly
2021-05-25 15:36   ` Bjorn Andersson
2021-06-24 15:32   ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).