Skip to contentSkip to conversation

drm/panel: mantix and st7703 fixes and additions

PATCH In review Guido Günther 4 participants 16 messages Nov 18, 2020 – Dec 8, 2020

Subsystems (6)
lore
Share & tools
lore

Guido Günther

author maintainer
#0 lore raw

v2 cover drm/panel: mantix and st7703 fixes and additions

This adds new panel type to the mantix driver as found on the Librem 5 and fixes a glitch in the init sequence (affecting both panels). The fix is at the start of the series to make backporting simpler.
It also adds a patch to make st7703 use dev_err_probe().

changes from v1
- as per review comments by Linus Walleij
- fix alphabetical ordering in Documentation/devicetree/bindings/vendor-prefixes.yaml

    https://lore.kernel.org/dri-devel/CACRpkdao_TMcpRsdK=7K5fNKJse0Bqwk58iWu0xsXdDNdcffVA@mail.gmail.com/

- add reviewed by to all except 5/6, thanks

Guido Günther (6):
drm/panel: st7703: Use dev_err_probe
drm/panel: mantix: Tweak init sequence
drm/panel: mantix: Allow to specify default mode for different panels drm/panel: mantix: Support panel from Shenzhen Yashi Changhua
Intelligent Technology Co
dt-bindings: vendor-prefixes: Add ys vendor prefix
dt-binding: display: mantix: Add compatible for panel from YS

 .../display/panel/mantix,mlaf057we51-x.yaml   |  1 +
 .../devicetree/bindings/vendor-prefixes.yaml  |  2 +
 .../gpu/drm/panel/panel-mantix-mlaf057we51.c  | 39 +++++++++++++++----
 drivers/gpu/drm/panel/panel-sitronix-st7703.c | 24 ++++--------
 4 files changed, 43 insertions(+), 23 deletions(-)
Signature · 6 lines
2.29.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author maintainer
#1 lore raw

PATCH v2 1/6 drm/panel: st7703: Use dev_err_probe

Less code and easier probe deferral debugging.

---
 drivers/gpu/drm/panel/panel-sitronix-st7703.c | 24 +++++++------------
 1 file changed, 8 insertions(+), 16 deletions(-)
drivers/gpu/drm/panel/panel-sitronix-st7703.c +8 -16
index b30510b1696a..a2c303e5732c 100644
@@ -530,10 +530,8 @@ static int st7703_probe(struct mipi_dsi_device *dsi)
 		return -ENOMEM;
 
 	ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
-	if (IS_ERR(ctx->reset_gpio)) {
-		dev_err(dev, "cannot get reset gpio\n");
-		return PTR_ERR(ctx->reset_gpio);
-	}
+	if (IS_ERR(ctx->reset_gpio))
+		return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio), "Failed to get reset gpio\n");
 
 	mipi_dsi_set_drvdata(dsi, ctx);
 
@@ -545,19 +543,13 @@ static int st7703_probe(struct mipi_dsi_device *dsi)
 	dsi->lanes = ctx->desc->lanes;
 
 	ctx->vcc = devm_regulator_get(dev, "vcc");
-	if (IS_ERR(ctx->vcc)) {
-		ret = PTR_ERR(ctx->vcc);
-		if (ret != -EPROBE_DEFER)
-			dev_err(dev, "Failed to request vcc regulator: %d\n", ret);
-		return ret;
-	}
+	if (IS_ERR(ctx->vcc))
+		return dev_err_probe(dev, PTR_ERR(ctx->vcc), "Failed to request vcc regulator\n");
+
 	ctx->iovcc = devm_regulator_get(dev, "iovcc");
-	if (IS_ERR(ctx->iovcc)) {
-		ret = PTR_ERR(ctx->iovcc);
-		if (ret != -EPROBE_DEFER)
-			dev_err(dev, "Failed to request iovcc regulator: %d\n", ret);
-		return ret;
-	}
+	if (IS_ERR(ctx->iovcc))
+		return dev_err_probe(dev, PTR_ERR(ctx->iovcc),
+				     "Failed to request iovcc regulator\n");
 
 	drm_panel_init(&ctx->panel, dev, &st7703_drm_funcs,
 		       DRM_MODE_CONNECTOR_DSI);
Signature · 6 lines
2.29.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

Re: [PATCH v2 1/6] drm/panel: st7703: Use dev_err_probe

Quoted 4 lines · Guido Günther

Less code and easier probe deferral debugging.

Nice.

I hope someone comes around and update all panel drivers to use dev_err_probe. It is simpler and better than the current code. And it will fix a lot of drivers that are noisy during deferral.

Sam
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author maintainer
#3 lore raw

PATCH v2 2/6 drm/panel: mantix: Tweak init sequence

In reply to Guido Günther

We've seen some (non permanent) burn in and bad white balance on some of the panels. Adding this bit from a vendor supplied sequence fixes it.

Fixes 72967d5616d3 ("drm/panel: Add panel driver for the Mantix MLAF057WE51-X DSI panel")
---
 drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c +5 -0
index 0c5f22e95c2d..624d17b96a69 100644
@@ -22,6 +22,7 @@
 /* Manufacturer specific Commands send via DSI */
 #define MANTIX_CMD_OTP_STOP_RELOAD_MIPI 0x41
 #define MANTIX_CMD_INT_CANCEL           0x4C
+#define MANTIX_CMD_SPI_FINISH           0x90
 
 struct mantix {
 	struct device *dev;
@@ -66,6 +67,10 @@ static int mantix_init_sequence(struct mantix *ctx)
 	dsi_generic_write_seq(dsi, 0x80, 0x64, 0x00, 0x64, 0x00, 0x00);
 	msleep(20);
 
+	dsi_generic_write_seq(dsi, MANTIX_CMD_SPI_FINISH, 0xA5);
+	dsi_generic_write_seq(dsi, MANTIX_CMD_OTP_STOP_RELOAD_MIPI, 0x00, 0x2F);
+	msleep(20);
+
 	dev_dbg(dev, "Panel init sequence done\n");
 	return 0;
 }
Signature · 6 lines
2.29.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author maintainer
#4 lore raw

PATCH v2 3/6 drm/panel: mantix: Allow to specify default mode for different panels

In reply to Guido Günther

This can be used to use different modes for differnt panels via OF device match.

---
 .../gpu/drm/panel/panel-mantix-mlaf057we51.c   | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c +11 -7
index 624d17b96a69..b057857165b0 100644
@@ -9,6 +9,7 @@
 #include <linux/delay.h>
 #include <linux/gpio/consumer.h>
 #include <linux/module.h>
+#include <linux/of_device.h>
 #include <linux/regulator/consumer.h>
 
 #include <video/mipi_display.h>
@@ -34,6 +35,8 @@ struct mantix {
 	struct regulator *avdd;
 	struct regulator *avee;
 	struct regulator *vddi;
+
+	const struct drm_display_mode *default_mode;
 };
 
 static inline struct mantix *panel_to_mantix(struct drm_panel *panel)
@@ -187,7 +190,7 @@ static int mantix_prepare(struct drm_panel *panel)
 	return 0;
 }
 
-static const struct drm_display_mode default_mode = {
+static const struct drm_display_mode default_mode_mantix = {
 	.hdisplay    = 720,
 	.hsync_start = 720 + 45,
 	.hsync_end   = 720 + 45 + 14,
@@ -208,11 +211,11 @@ static int mantix_get_modes(struct drm_panel *panel,
 	struct mantix *ctx = panel_to_mantix(panel);
 	struct drm_display_mode *mode;
 
-	mode = drm_mode_duplicate(connector->dev, &default_mode);
+	mode = drm_mode_duplicate(connector->dev, ctx->default_mode);
 	if (!mode) {
 		dev_err(ctx->dev, "Failed to add mode %ux%u@%u\n",
-			default_mode.hdisplay, default_mode.vdisplay,
-			drm_mode_vrefresh(&default_mode));
+			ctx->default_mode->hdisplay, ctx->default_mode->vdisplay,
+			drm_mode_vrefresh(ctx->default_mode));
 		return -ENOMEM;
 	}
 
@@ -243,6 +246,7 @@ static int mantix_probe(struct mipi_dsi_device *dsi)
 	ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
 	if (!ctx)
 		return -ENOMEM;
+	ctx->default_mode = of_device_get_match_data(dev);
 
 	ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
 	if (IS_ERR(ctx->reset_gpio)) {
@@ -293,8 +297,8 @@ static int mantix_probe(struct mipi_dsi_device *dsi)
 	}
 
 	dev_info(dev, "%ux%u@%u %ubpp dsi %udl - ready\n",
-		 default_mode.hdisplay, default_mode.vdisplay,
-		 drm_mode_vrefresh(&default_mode),
+		 ctx->default_mode->hdisplay, ctx->default_mode->vdisplay,
+		 drm_mode_vrefresh(ctx->default_mode),
 		 mipi_dsi_pixel_format_to_bpp(dsi->format), dsi->lanes);
 
 	return 0;
@@ -321,7 +325,7 @@ static int mantix_remove(struct mipi_dsi_device *dsi)
 }
 
 static const struct of_device_id mantix_of_match[] = {
-	{ .compatible = "mantix,mlaf057we51-x" },
+	{ .compatible = "mantix,mlaf057we51-x", .data = &default_mode_mantix },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, mantix_of_match);
Signature · 6 lines
2.29.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author maintainer
#5 lore raw

PATCH v2 4/6 drm/panel: mantix: Support panel from Shenzhen Yashi Changhua Intelligent Technology Co

In reply to Guido Günther

The panel uses the same driver IC and has the same resolution but a slightly different default mode. It seems it can work with the same init sequence.

---
 drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c +16 -0
index b057857165b0..30f28ad4df6b 100644
@@ -205,6 +205,21 @@ static const struct drm_display_mode default_mode_mantix = {
 	.height_mm   = 130,
 };
 
+static const struct drm_display_mode default_mode_ys = {
+	.hdisplay    = 720,
+	.hsync_start = 720 + 45,
+	.hsync_end   = 720 + 45 + 14,
+	.htotal	     = 720 + 45 + 14 + 25,
+	.vdisplay    = 1440,
+	.vsync_start = 1440 + 175,
+	.vsync_end   = 1440 + 175 + 8,
+	.vtotal	     = 1440 + 175 + 8 + 50,
+	.clock	     = 85298,
+	.flags	     = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
+	.width_mm    = 65,
+	.height_mm   = 130,
+};
+
 static int mantix_get_modes(struct drm_panel *panel,
 			    struct drm_connector *connector)
 {
@@ -326,6 +341,7 @@ static int mantix_remove(struct mipi_dsi_device *dsi)
 
 static const struct of_device_id mantix_of_match[] = {
 	{ .compatible = "mantix,mlaf057we51-x", .data = &default_mode_mantix },
+	{ .compatible = "ys,ys57pss36bh5gq", .data = &default_mode_ys },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, mantix_of_match);
Signature · 6 lines
2.29.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author maintainer
#6 lore raw

PATCH v2 5/6 dt-bindings: vendor-prefixes: Add ys vendor prefix

In reply to Guido Günther

Add prefix for Shenzhen Yashi Changhua Intelligent Technology Co., Ltd.

---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index e40ee369f808..fbcba08450c5 100644
@@ -1222,6 +1222,8 @@ patternProperties:
     description: YSH & ATIL
   "^yones-toptech,.*":
     description: Yones Toptech Co., Ltd.
+  "^ys,.*":
+    description: Shenzhen Yashi Changhua Intelligent Technology Co., Ltd.
   "^ysoft,.*":
     description: Y Soft Corporation a.s.
   "^zealz,.*":
Signature · 1 line
2.29.2
maintainer Acked-by on v2 5/6
#7 lore raw

Re: [PATCH v2 5/6] dt-bindings: vendor-prefixes: Add ys vendor prefix

Quoted 6 lines · Guido Günther

Add prefix for Shenzhen Yashi Changhua Intelligent Technology Co., Ltd.

---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author maintainer
#8 lore raw

PATCH v2 6/6 dt-binding: display: mantix: Add compatible for panel from YS

In reply to Guido Günther

This panel from Shenzhen Yashi Changhua Intelligent Technology Co uses the same driver IC but a different LCD.

---
 .../devicetree/bindings/display/panel/mantix,mlaf057we51-x.yaml  | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/display/panel/mantix,mlaf057we51-x.yaml +1 -0
index 51f423297ec8..9e78f2e60f99 100644
@@ -20,6 +20,7 @@ properties:
   compatible:
     enum:
       - mantix,mlaf057we51-x
+      - ys,ys57pss36bh5gq
 
   port: true
   reg:
Signature · 1 line
2.29.2
maintainer Acked-by on v2 6/6
#9 lore raw

Re: [PATCH v2 6/6] dt-binding: display: mantix: Add compatible for panel from YS

Quoted 9 lines · Guido Günther

This panel from Shenzhen Yashi Changhua Intelligent Technology Co uses the same driver IC but a different LCD.

---
 .../devicetree/bindings/display/panel/mantix,mlaf057we51-x.yaml  | 1 +
 1 file changed, 1 insertion(+)

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author maintainer
#10 lore raw

Re: [PATCH v2 6/6] dt-binding: display: mantix: Add compatible for panel from YS

Hi,

Quoted 4 lines · Rob Herring
Quoted 3 lines · Guido Günther

This panel from Shenzhen Yashi Changhua Intelligent Technology Co uses the same driver IC but a different LCD.

Quoted 9 lines
Quoted 6 lines
---
 .../devicetree/bindings/display/panel/mantix,mlaf057we51-x.yaml  | 1 +
 1 file changed, 1 insertion(+)

Thanks! I've appplied the series to drm-misc-next now. Cheers,
-- Guido
_______________________________________________
dri-devel mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by on the v2 series
#11 lore raw
In reply to Guido Günther
Quoted 10 lines · Guido Günther

This adds new panel type to the mantix driver as found on the Librem 5 and fixes a glitch in the init sequence (affecting both panels). The fix is at the start of the series to make backporting simpler.
It also adds a patch to make st7703 use dev_err_probe().

changes from v1
- as per review comments by Linus Walleij
- fix alphabetical ordering in Documentation/devicetree/bindings/vendor-prefixes.yaml

    https://lore.kernel.org/dri-devel/CACRpkdao_TMcpRsdK=7K5fNKJse0Bqwk58iWu0xsXdDNdcffVA@mail.gmail.com/

- add reviewed by to all except 5/6, thanks

The whole v2 looks fine to me, I'd give the devicetree maintainers some slack to review the DT patches then I can apply the whole series unless you have commit access yourself, just tell me.

For all v2 patches:

If you have time, please review my s6e63m0 series.
https://lore.kernel.org/dri-devel/[email protected]/
https://lore.kernel.org/dri-devel/[email protected]/
https://lore.kernel.org/dri-devel/[email protected]/

Yours,
Linus Walleij

author maintainer
#12 lore raw

Hi Linus,

Quoted 13 lines · Linus Walleij
Quoted 10 lines · Guido Günther

This adds new panel type to the mantix driver as found on the Librem 5 and fixes a glitch in the init sequence (affecting both panels). The fix is at the start of the series to make backporting simpler.
It also adds a patch to make st7703 use dev_err_probe().

changes from v1
- as per review comments by Linus Walleij
- fix alphabetical ordering in Documentation/devicetree/bindings/vendor-prefixes.yaml

    https://lore.kernel.org/dri-devel/CACRpkdao_TMcpRsdK=7K5fNKJse0Bqwk58iWu0xsXdDNdcffVA@mail.gmail.com/

- add reviewed by to all except 5/6, thanks

Quoted 4 lines

The whole v2 looks fine to me, I'd give the devicetree maintainers some slack to review the DT patches then I can apply the whole series unless you have commit access yourself, just tell me.

I have commit access, so i can push in a couple of days. Thanks!

Quoted 8 lines

For all v2 patches:

If you have time, please review my s6e63m0 series.
https://lore.kernel.org/dri-devel/[email protected]/
https://lore.kernel.org/dri-devel/[email protected]/
https://lore.kernel.org/dri-devel/[email protected]/

Done. The panel stuff is always scary with all those magic values.
-- Guido

Quoted 4 lines

Yours,
Linus Walleij

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author maintainer
#13 lore raw
In reply to Linus Walleij

Hi Linus,

Quoted 13 lines · Linus Walleij
Quoted 10 lines · Guido Günther

This adds new panel type to the mantix driver as found on the Librem 5 and fixes a glitch in the init sequence (affecting both panels). The fix is at the start of the series to make backporting simpler.
It also adds a patch to make st7703 use dev_err_probe().

changes from v1
- as per review comments by Linus Walleij
- fix alphabetical ordering in Documentation/devicetree/bindings/vendor-prefixes.yaml

    https://lore.kernel.org/dri-devel/CACRpkdao_TMcpRsdK=7K5fNKJse0Bqwk58iWu0xsXdDNdcffVA@mail.gmail.com/

- add reviewed by to all except 5/6, thanks

Quoted 4 lines

The whole v2 looks fine to me, I'd give the devicetree maintainers some slack to review the DT patches then I can apply the whole series unless you have commit access yourself, just tell me.

Thanks. Is 2 weeks enough slack? Checking what's the rule of thumb here. Cheers,
-- Guido

Quoted 4 lines

For all v2 patches:

Quoted 8 lines

If you have time, please review my s6e63m0 series.
https://lore.kernel.org/dri-devel/[email protected]/
https://lore.kernel.org/dri-devel/[email protected]/
https://lore.kernel.org/dri-devel/[email protected]/

Yours,
Linus Walleij

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by Reviewed-by on the v2 series
#14 lore raw
In reply to Guido Günther

Hi Guido,

Quoted 11 lines · Guido Günther

This adds new panel type to the mantix driver as found on the Librem 5 and fixes a glitch in the init sequence (affecting both panels). The fix is at the start of the series to make backporting simpler.
It also adds a patch to make st7703 use dev_err_probe().

changes from v1
- as per review comments by Linus Walleij
- fix alphabetical ordering in Documentation/devicetree/bindings/vendor-prefixes.yaml

    https://lore.kernel.org/dri-devel/CACRpkdao_TMcpRsdK=7K5fNKJse0Bqwk58iWu0xsXdDNdcffVA@mail.gmail.com/

- add reviewed by to all except 5/6, thanks

Quoted 7 lines

Guido Günther (6):
drm/panel: st7703: Use dev_err_probe
drm/panel: mantix: Tweak init sequence
drm/panel: mantix: Allow to specify default mode for different panels drm/panel: mantix: Support panel from Shenzhen Yashi Changhua
Intelligent Technology Co
dt-bindings: vendor-prefixes: Add ys vendor prefix

The above are all:

Quoted 1 line

dt-binding: display: mantix: Add compatible for panel from YS

Please fix the subjects to read "dt-bindings" - just to be consistent. With that:

Sam
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author maintainer
#15 lore raw

Hi,

Quoted 21 lines · Sam Ravnborg

Hi Guido,

Quoted 11 lines · Guido Günther

This adds new panel type to the mantix driver as found on the Librem 5 and fixes a glitch in the init sequence (affecting both panels). The fix is at the start of the series to make backporting simpler.
It also adds a patch to make st7703 use dev_err_probe().

changes from v1
- as per review comments by Linus Walleij
- fix alphabetical ordering in Documentation/devicetree/bindings/vendor-prefixes.yaml

    https://lore.kernel.org/dri-devel/CACRpkdao_TMcpRsdK=7K5fNKJse0Bqwk58iWu0xsXdDNdcffVA@mail.gmail.com/

- add reviewed by to all except 5/6, thanks

Quoted 7 lines

Guido Günther (6):
drm/panel: st7703: Use dev_err_probe
drm/panel: mantix: Tweak init sequence
drm/panel: mantix: Allow to specify default mode for different panels drm/panel: mantix: Support panel from Shenzhen Yashi Changhua
Intelligent Technology Co
dt-bindings: vendor-prefixes: Add ys vendor prefix

Quoted 7 lines

The above are all:

Quoted 1 line

dt-binding: display: mantix: Add compatible for panel from YS

Please fix the subjects to read "dt-bindings" - just to be consistent. With that:

Fixed locally, thanks!
-- Guido

Quoted 4 lines

Sam