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=7K5fNKJse0Bqwk58iWu0xsX... - 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(-)
Less code and easier probe deferral debugging.
Signed-off-by: Guido Günther agx@sigxcpu.org Reviewed-by: Linus Walleij linus.walleij@linaro.org --- drivers/gpu/drm/panel/panel-sitronix-st7703.c | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c index b30510b1696a..a2c303e5732c 100644 --- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c +++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c @@ -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);
On Wed, Nov 18, 2020 at 09:29:48AM +0100, Guido Günther wrote:
Less code and easier probe deferral debugging.
Signed-off-by: Guido Günther agx@sigxcpu.org Reviewed-by: Linus Walleij linus.walleij@linaro.org
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
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") Signed-off-by: Guido Günther agx@sigxcpu.org Reviewed-by: Linus Walleij linus.walleij@linaro.org --- drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c b/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c index 0c5f22e95c2d..624d17b96a69 100644 --- a/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c +++ b/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c @@ -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; }
This can be used to use different modes for differnt panels via OF device match.
Signed-off-by: Guido Günther agx@sigxcpu.org Reviewed-by: Linus Walleij linus.walleij@linaro.org --- .../gpu/drm/panel/panel-mantix-mlaf057we51.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c b/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c index 624d17b96a69..b057857165b0 100644 --- a/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c +++ b/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c @@ -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);
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.
Signed-off-by: Guido Günther agx@sigxcpu.org Reviewed-by: Linus Walleij linus.walleij@linaro.org --- drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c b/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c index b057857165b0..30f28ad4df6b 100644 --- a/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c +++ b/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c @@ -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);
Add prefix for Shenzhen Yashi Changhua Intelligent Technology Co., Ltd.
Signed-off-by: Guido Günther agx@sigxcpu.org --- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml index e40ee369f808..fbcba08450c5 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml @@ -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,.*":
On Wed, Nov 18, 2020 at 09:29:52AM +0100, Guido Günther wrote:
Add prefix for Shenzhen Yashi Changhua Intelligent Technology Co., Ltd.
Signed-off-by: Guido Günther agx@sigxcpu.org
Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+)
Acked-by: Rob Herring robh@kernel.org
This panel from Shenzhen Yashi Changhua Intelligent Technology Co uses the same driver IC but a different LCD.
Signed-off-by: Guido Günther agx@sigxcpu.org Reviewed-by: Linus Walleij linus.walleij@linaro.org --- .../devicetree/bindings/display/panel/mantix,mlaf057we51-x.yaml | 1 + 1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/display/panel/mantix,mlaf057we51-x.yaml b/Documentation/devicetree/bindings/display/panel/mantix,mlaf057we51-x.yaml index 51f423297ec8..9e78f2e60f99 100644 --- a/Documentation/devicetree/bindings/display/panel/mantix,mlaf057we51-x.yaml +++ b/Documentation/devicetree/bindings/display/panel/mantix,mlaf057we51-x.yaml @@ -20,6 +20,7 @@ properties: compatible: enum: - mantix,mlaf057we51-x + - ys,ys57pss36bh5gq
port: true reg:
On Wed, 18 Nov 2020 09:29:53 +0100, Guido Günther wrote:
This panel from Shenzhen Yashi Changhua Intelligent Technology Co uses the same driver IC but a different LCD.
Signed-off-by: Guido Günther agx@sigxcpu.org Reviewed-by: Linus Walleij linus.walleij@linaro.org
.../devicetree/bindings/display/panel/mantix,mlaf057we51-x.yaml | 1 + 1 file changed, 1 insertion(+)
Acked-by: Rob Herring robh@kernel.org
Hi, On Mon, Dec 07, 2020 at 03:32:06PM -0600, Rob Herring wrote:
On Wed, 18 Nov 2020 09:29:53 +0100, Guido Günther wrote:
This panel from Shenzhen Yashi Changhua Intelligent Technology Co uses the same driver IC but a different LCD.
Signed-off-by: Guido Günther agx@sigxcpu.org Reviewed-by: Linus Walleij linus.walleij@linaro.org
.../devicetree/bindings/display/panel/mantix,mlaf057we51-x.yaml | 1 + 1 file changed, 1 insertion(+)
Acked-by: Rob Herring robh@kernel.org
Thanks! I've appplied the series to drm-misc-next now. Cheers, -- Guido
On Wed, Nov 18, 2020 at 9:29 AM Guido Günther agx@sigxcpu.org wrote:
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=7K5fNKJse0Bqwk58iWu0xsX...
- 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: Reviewed-by: Linus Walleij linus.walleij@linaro.org
If you have time, please review my s6e63m0 series. https://lore.kernel.org/dri-devel/20201117175621.870085-1-linus.walleij@lina... https://lore.kernel.org/dri-devel/20201117175621.870085-2-linus.walleij@lina... https://lore.kernel.org/dri-devel/20201117175621.870085-3-linus.walleij@lina...
Yours, Linus Walleij
Hi Linus, On Thu, Nov 19, 2020 at 09:35:17AM +0100, Linus Walleij wrote:
On Wed, Nov 18, 2020 at 9:29 AM Guido Günther agx@sigxcpu.org wrote:
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=7K5fNKJse0Bqwk58iWu0xsX...
- 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.
I have commit access, so i can push in a couple of days. Thanks!
For all v2 patches: Reviewed-by: Linus Walleij linus.walleij@linaro.org
If you have time, please review my s6e63m0 series. https://lore.kernel.org/dri-devel/20201117175621.870085-1-linus.walleij@lina... https://lore.kernel.org/dri-devel/20201117175621.870085-2-linus.walleij@lina... https://lore.kernel.org/dri-devel/20201117175621.870085-3-linus.walleij@lina...
Done. The panel stuff is always scary with all those magic values. -- Guido
Yours, Linus Walleij
Hi Linus, On Thu, Nov 19, 2020 at 09:35:17AM +0100, Linus Walleij wrote:
On Wed, Nov 18, 2020 at 9:29 AM Guido Günther agx@sigxcpu.org wrote:
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=7K5fNKJse0Bqwk58iWu0xsX...
- 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.
Thanks. Is 2 weeks enough slack? Checking what's the rule of thumb here. Cheers, -- Guido
For all v2 patches: Reviewed-by: Linus Walleij linus.walleij@linaro.org
If you have time, please review my s6e63m0 series. https://lore.kernel.org/dri-devel/20201117175621.870085-1-linus.walleij@lina... https://lore.kernel.org/dri-devel/20201117175621.870085-2-linus.walleij@lina... https://lore.kernel.org/dri-devel/20201117175621.870085-3-linus.walleij@lina...
Yours, Linus Walleij
Hi Guido,
On Wed, Nov 18, 2020 at 09:29:47AM +0100, Guido Günther wrote:
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=7K5fNKJse0Bqwk58iWu0xsX...
- 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
The above are all: Reviewed-by: Sam Ravnborg sam@ravnborg.org
dt-binding: display: mantix: Add compatible for panel from YS
Please fix the subjects to read "dt-bindings" - just to be consistent. With that: Reviewed-by: Sam Ravnborg sam@ravnborg.org
Sam
Hi, On Mon, Nov 23, 2020 at 10:48:26PM +0100, Sam Ravnborg wrote:
Hi Guido,
On Wed, Nov 18, 2020 at 09:29:47AM +0100, Guido Günther wrote:
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=7K5fNKJse0Bqwk58iWu0xsX...
- 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
The above are all: Reviewed-by: Sam Ravnborg sam@ravnborg.org
dt-binding: display: mantix: Add compatible for panel from YS
Please fix the subjects to read "dt-bindings" - just to be consistent. With that: Reviewed-by: Sam Ravnborg sam@ravnborg.org
Fixed locally, thanks! -- Guido
Sam
dri-devel@lists.freedesktop.org