* [PATCH v1 0/2] drm/panel: add Novatek NT36525 (Samsung Galaxy XCover5)
@ 2026-11-16 7:02 Adil Hüsrev Tepe
2026-11-16 7:02 ` [PATCH v1 1/2] dt-bindings: display: panel: add Novatek NT36525 Adil Hüsrev Tepe
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Adil Hüsrev Tepe @ 2026-11-16 7:02 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, dri-devel, devicetree, linux-kernel,
Adil Hüsrev Tepe
This series adds a DRM panel driver and its DT binding for MIPI-DSI
video-mode panels based on the Novatek NT36525 controller, as fitted on
the Samsung Galaxy XCover5 (SM-G525F, Exynos850). The panel is 720x1480,
uses an active-high reset (RESX), and a DCS init sequence that mirrors
the stock Samsung bring-up. Backlight goes through drm_panel_of_backlight().
Patch 1 dt-bindings (compatible: "samsung,xcover5-nt36525",
"novatek,nt36525")
Patch 2 the panel driver
Tested on a Samsung Galaxy XCover5 running 7.4-rc1 plus this series: the
panel initialises and displays correctly under phosh. checkpatch.pl and
dt_binding_check are clean (bar the usual new-file MAINTAINERS note; the
files are covered by the DRM PANEL DRIVERS wildcards).
Based on v7.4-rc1.
Tool usage
----------
This series was developed during XCover5 mainline bring-up with the help
of an AI coding assistant (Claude Code, Anthropic). The assistant converted
the vendor init stream to mipi_dsi_dcs_write_seq_multi(), drafted the driver
skeleton and the DT binding, and drafted these changelogs. I reviewed every
line, validated the binding (dt_binding_check, yamllint), tested the driver
on hardware, and take full responsibility for the contribution.
Prompt summary: "convert the XCover5 NT36525 vendor panel init into a
mainline drm_panel driver plus DT binding; keep it checkpatch- and
dt_binding_check-clean; test on the device." Review comments are welcome
and I will answer them myself.
Adil Hüsrev Tepe (2):
dt-bindings: display: panel: add Novatek NT36525
drm/panel: add Novatek NT36525 panel driver
.../display/panel/novatek,nt36525.yaml | 71 +++
drivers/gpu/drm/panel/Kconfig | 13 +
drivers/gpu/drm/panel/Makefile | 1 +
drivers/gpu/drm/panel/panel-novatek-nt36525.c | 486 ++++++++++++++++++
4 files changed, 571 insertions(+)
create mode 100644 Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml
create mode 100644 drivers/gpu/drm/panel/panel-novatek-nt36525.c
--
2.53.0
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH v1 1/2] dt-bindings: display: panel: add Novatek NT36525 2026-11-16 7:02 [PATCH v1 0/2] drm/panel: add Novatek NT36525 (Samsung Galaxy XCover5) Adil Hüsrev Tepe @ 2026-11-16 7:02 ` Adil Hüsrev Tepe 2026-11-16 7:02 ` [PATCH v1 2/2] drm/panel: add Novatek NT36525 panel driver Adil Hüsrev Tepe 2026-11-17 10:43 ` [PATCH v2 1/2] dt-bindings: display: panel: novatek,nt36525: fix v1 review issues Adil Hüsrev Tepe 2 siblings, 0 replies; 6+ messages in thread From: Adil Hüsrev Tepe @ 2026-11-16 7:02 UTC (permalink / raw) To: Neil Armstrong, Jessica Zhang, Rob Herring, Krzysztof Kozlowski, Conor Dooley Cc: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, dri-devel, devicetree, linux-kernel, Adil Hüsrev Tepe Add a binding for MIPI-DSI video-mode panels based on the Novatek NT36525 controller. The first compatible names the specific panel as fitted in a device; the second is the NT36525 controller it is based on. The initial user is the panel in the Samsung Galaxy XCover5 (SM-G525F). The binding was drafted during XCover5 mainline bring-up with the help of an AI coding assistant (Claude Code, Anthropic), from a description of the panel and the stock device tree, and reviewed and validated (dt_binding_check, yamllint) by me. Signed-off-by: Adil Hüsrev Tepe <tadilhusrev@gmail.com> --- .../display/panel/novatek,nt36525.yaml | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml diff --git a/Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml b/Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml new file mode 100644 index 000000000..5c6e7cce0 --- /dev/null +++ b/Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml @@ -0,0 +1,71 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/panel/novatek,nt36525.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Novatek NT36525 MIPI-DSI panel + +maintainers: + - Adil Hüsrev Tepe <tadilhusrev@gmail.com> + +description: + A MIPI-DSI video-mode panel driven by a Novatek NT36525 controller, + 720x1480. The first compatible string names the specific panel as fitted + in a device; the second is the NT36525 controller it is based on. The + panel reset (RESX) is active high in the Samsung Galaxy XCover5 bring-up + sequence. + +allOf: + - $ref: panel-common.yaml# + +properties: + compatible: + items: + - enum: + - samsung,xcover5-nt36525 + - const: novatek,nt36525 + + reg: + maxItems: 1 + description: DSI virtual channel + + reset-gpios: + maxItems: 1 + + vdd-supply: + description: panel power supply + + port: true + +required: + - compatible + - reg + - reset-gpios + - vdd-supply + - port + +additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + dsi { + #address-cells = <1>; + #size-cells = <0>; + + panel@0 { + compatible = "samsung,xcover5-nt36525", "novatek,nt36525"; + reg = <0>; + reset-gpios = <&gpa0 0 GPIO_ACTIVE_HIGH>; + vdd-supply = <&panel_vdd>; + + port { + panel_in: endpoint { + remote-endpoint = <&dsi_out>; + }; + }; + }; + }; +... -- 2.53.0 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v1 2/2] drm/panel: add Novatek NT36525 panel driver 2026-11-16 7:02 [PATCH v1 0/2] drm/panel: add Novatek NT36525 (Samsung Galaxy XCover5) Adil Hüsrev Tepe 2026-11-16 7:02 ` [PATCH v1 1/2] dt-bindings: display: panel: add Novatek NT36525 Adil Hüsrev Tepe @ 2026-11-16 7:02 ` Adil Hüsrev Tepe 2026-11-17 10:43 ` [PATCH v2 1/2] dt-bindings: display: panel: novatek,nt36525: fix v1 review issues Adil Hüsrev Tepe 2 siblings, 0 replies; 6+ messages in thread From: Adil Hüsrev Tepe @ 2026-11-16 7:02 UTC (permalink / raw) To: Neil Armstrong, Jessica Zhang, Rob Herring, Krzysztof Kozlowski, Conor Dooley Cc: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, dri-devel, devicetree, linux-kernel, Adil Hüsrev Tepe Add a DRM panel driver for MIPI-DSI video-mode panels based on the Novatek NT36525 controller, as fitted on the Samsung Galaxy XCover5 (SM-G525F): 720x1480, active-high reset (RESX), and a DCS init sequence that mirrors the stock Samsung bring-up. Backlight is handled through the common drm_panel_of_backlight() path. The driver was developed during XCover5 mainline bring-up with the help of an AI coding assistant (Claude Code, Anthropic), which converted the init sequence to mipi_dsi_dcs_write_seq_multi() and drafted the driver skeleton; I reviewed every line. Tested on a Samsung Galaxy XCover5 running 7.4-rc1 plus this driver: the panel initialises and displays correctly under phosh. Signed-off-by: Adil Hüsrev Tepe <tadilhusrev@gmail.com> --- drivers/gpu/drm/panel/Kconfig | 13 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-novatek-nt36525.c | 486 ++++++++++++++++++ 3 files changed, 500 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-novatek-nt36525.c diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 7a520b4d6..b76b9521f 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -676,6 +676,19 @@ config DRM_PANEL_NOVATEK_NT36523 around the Novatek NT36523 display controller, such as some Boe panels used in Xiaomi Mi Pad 5 and 5 Pro tablets. +config DRM_PANEL_NOVATEK_NT36525 + tristate "Novatek NT36525 DSI panel for Samsung Galaxy XCover5" + depends on GPIOLIB + depends on OF + depends on DRM_MIPI_DSI + depends on BACKLIGHT_CLASS_DEVICE + help + Say Y here if you want to enable support for the Novatek NT36525 + 720x1480 MIPI-DSI video-mode panel, such as the one fitted on the + Samsung Galaxy XCover5 (SM-G525F). The panel uses an active-high + reset and a DCS initialisation sequence that mirrors the stock + Samsung bring-up. + config DRM_PANEL_NOVATEK_NT36532 tristate "Novatek NT36532-based MIPI-DSI panels" depends on OF diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index da5175909..46de72db7 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -65,6 +65,7 @@ obj-$(CONFIG_DRM_PANEL_NOVATEK_NT35532) += panel-novatek-nt35532.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT35560) += panel-novatek-nt35560.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT35950) += panel-novatek-nt35950.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36523) += panel-novatek-nt36523.o +obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36525) += panel-novatek-nt36525.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36532) += panel-novatek-nt36532.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36536) += panel-novatek-nt36536.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672A) += panel-novatek-nt36672a.o diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36525.c b/drivers/gpu/drm/panel/panel-novatek-nt36525.c new file mode 100644 index 000000000..246476af4 --- /dev/null +++ b/drivers/gpu/drm/panel/panel-novatek-nt36525.c @@ -0,0 +1,486 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Novatek NT36525 MIPI DSI panel driver for the Samsung Galaxy XCover5 + * + * Panel timing and the DCS initialisation sequence are taken from the + * Samsung GPL kernel release for the SM-G525F + * (drivers/video/fbdev/exynos/panel/nt36525/nt36525_xcover5_panel.h). + */ + +#include <linux/delay.h> +#include <linux/gpio/consumer.h> +#include <linux/module.h> +#include <linux/mod_devicetable.h> +#include <linux/regulator/consumer.h> + +#include <video/mipi_display.h> + +#include <drm/drm_mipi_dsi.h> +#include <drm/drm_modes.h> +#include <drm/drm_panel.h> + +struct nt36525 { + struct drm_panel panel; + struct mipi_dsi_device *dsi; + struct regulator *vdd; /* vdd_ldo28, 1.8 V */ + struct regulator *vpos; /* LCD positive bias */ + struct regulator *vneg; /* LCD negative bias */ + struct gpio_desc *reset_gpio; /* panel RESX, active-high per Samsung */ +}; + +static inline struct nt36525 *panel_to_nt36525(struct drm_panel *p) +{ + return container_of(p, struct nt36525, panel); +} + +/* XCover5 panel timing, exact from Samsung DTS node. 720x1480@60. */ +static const struct drm_display_mode nt36525_xcover5_mode = { + .clock = (720 + 128 + 20 + 130) * (1480 + 18 + 2 + 232) * 60 / 1000, + .hdisplay = 720, + .hsync_start = 720 + 128, /* HFP */ + .hsync_end = 720 + 128 + 20, /* HSA */ + .htotal = 720 + 128 + 20 + 130, /* +HBP */ + .vdisplay = 1480, + .vsync_start = 1480 + 18, /* VFP */ + .vsync_end = 1480 + 18 + 2, /* VSA */ + .vtotal = 1480 + 18 + 2 + 232, /* +VBP */ + .width_mm = 59, /* from panel size node */ + .height_mm = 121, + .type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED, +}; + +static int nt36525_on(struct nt36525 *p) +{ + struct mipi_dsi_multi_context ctx = { .dsi = p->dsi }; + + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x20); + mipi_dsi_msleep(&ctx, 1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x00, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x01, 0x55); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x03, 0x55); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x05, 0xa9); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x07, 0x73); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x08, 0xc1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x0e, 0x91); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x0f, 0x5f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1f, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x69, 0xa9); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x94, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x95, 0xeb); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x96, 0xeb); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x24); + mipi_dsi_msleep(&ctx, 1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x00, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x04, 0x21); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x06, 0x22); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x07, 0x20); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x08, 0x1d); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x0a, 0x0c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x0b, 0x0d); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x0c, 0x0e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x0d, 0x0f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x0f, 0x04); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x10, 0x05); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x12, 0x1e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x13, 0x1e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x14, 0x1e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x16, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1a, 0x21); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1c, 0x22); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1d, 0x20); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1e, 0x1d); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x20, 0x0c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x21, 0x0d); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x22, 0x0e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x23, 0x0f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x25, 0x04); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x26, 0x05); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x28, 0x1e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x29, 0x1e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x2a, 0x1e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x2f, 0x09); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x30, 0x07); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x33, 0x07); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x34, 0x09); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x37, 0x33); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x39, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x3a, 0x05); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x3b, 0x94); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x3d, 0x92); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x4d, 0x12); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x4e, 0x34); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x51, 0x43); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x52, 0x21); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x55, 0x86); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x56, 0x34); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x5a, 0x05); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x5b, 0x94); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x5c, 0xc0); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x5d, 0x06); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x5e, 0x0c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x5f, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x60, 0x80); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x61, 0x72); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x64, 0x11); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x82, 0x0a); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x83, 0x0c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x85, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x86, 0x51); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x92, 0xba); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x93, 0x12); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x94, 0x0a); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xab, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xac, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xad, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xaf, 0x04); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb0, 0x05); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb1, 0xb5); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x25); + mipi_dsi_msleep(&ctx, 1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x0a, 0x82); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x0b, 0x50); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x0c, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x17, 0x82); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x18, 0x06); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x19, 0x0f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x58, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x59, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x5a, 0x40); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x5b, 0x80); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x5c, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x5d, 0x05); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x5e, 0x94); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x5f, 0x05); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x60, 0x94); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x61, 0x05); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x62, 0x94); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x65, 0x05); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x66, 0xb5); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xc0, 0x03); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xca, 0x1c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xcc, 0x1c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xd3, 0x11); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xd4, 0xc8); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xd5, 0x11); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xd6, 0x1c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xd7, 0x11); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x26); + mipi_dsi_msleep(&ctx, 1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x00, 0xa0); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x27); + mipi_dsi_msleep(&ctx, 1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x13, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x15, 0xb4); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1f, 0x55); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x26, 0x0f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xc0, 0x18); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xc1, 0xe0); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xc2, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xc3, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xc4, 0xe0); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xc5, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xc6, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xc7, 0x03); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x23); + mipi_dsi_msleep(&ctx, 1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x07, 0x20); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x08, 0x10); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x12, 0xa6); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x15, 0xfc); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x16, 0x0b); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x04, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x19, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1a, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1b, 0x08); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1c, 0x0a); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1d, 0x0c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1e, 0x12); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1f, 0x16); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x20, 0x1a); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x21, 0x1c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x22, 0x20); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x23, 0x24); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x24, 0x28); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x25, 0x2c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x26, 0x30); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x27, 0x38); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x28, 0x3c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x29, 0x10); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x30, 0xff); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x31, 0xff); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x32, 0xfe); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x33, 0xfd); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x34, 0xfd); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x35, 0xfc); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x36, 0xfb); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x37, 0xf9); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x38, 0xf7); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x39, 0xf3); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x3a, 0xea); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x3b, 0xe6); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x3d, 0xe0); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x3f, 0xdd); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x40, 0xdb); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x41, 0xd9); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x20); + mipi_dsi_msleep(&ctx, 1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb0, 0x00, 0x08, 0x00, 0x18, 0x00, 0x34, 0x00, 0x4c, + 0x00, 0x61, 0x00, 0x74, 0x00, 0x86, 0x00, 0x96); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb1, 0x00, 0xa5, 0x00, 0xdb, 0x01, 0x02, 0x01, 0x43, + 0x01, 0x71, 0x01, 0xbd, 0x01, 0xf7, 0x01, 0xfa); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb2, 0x02, 0x34, 0x02, 0x6f, 0x02, 0x98, 0x02, 0xcc, + 0x02, 0xf1, 0x03, 0x1d, 0x03, 0x2d, 0x03, 0x3b); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb3, 0x03, 0x4d, 0x03, 0x60, 0x03, 0x7a, 0x03, 0x94, + 0x03, 0xa6, 0x03, 0xa7); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb4, 0x00, 0x08, 0x00, 0x18, 0x00, 0x34, 0x00, 0x4c, + 0x00, 0x61, 0x00, 0x74, 0x00, 0x86, 0x00, 0x96); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb5, 0x00, 0xa5, 0x00, 0xdb, 0x01, 0x02, 0x01, 0x43, + 0x01, 0x71, 0x01, 0xbd, 0x01, 0xf7, 0x01, 0xfa); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb6, 0x02, 0x34, 0x02, 0x6f, 0x02, 0x98, 0x02, 0xcc, + 0x02, 0xf1, 0x03, 0x1d, 0x03, 0x2d, 0x03, 0x3b); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb7, 0x03, 0x4d, 0x03, 0x60, 0x03, 0x7a, 0x03, 0x94, + 0x03, 0xa6, 0x03, 0xa7); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb8, 0x00, 0x08, 0x00, 0x18, 0x00, 0x34, 0x00, 0x4c, + 0x00, 0x61, 0x00, 0x74, 0x00, 0x86, 0x00, 0x96); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb9, 0x00, 0xa5, 0x00, 0xdb, 0x01, 0x02, 0x01, 0x43, + 0x01, 0x71, 0x01, 0xbd, 0x01, 0xf7, 0x01, 0xfa); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xba, 0x02, 0x34, 0x02, 0x6f, 0x02, 0x98, 0x02, 0xcc, + 0x02, 0xf1, 0x03, 0x1d, 0x03, 0x2d, 0x03, 0x3b); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xbb, 0x03, 0x4d, 0x03, 0x60, 0x03, 0x7a, 0x03, 0x94, + 0x03, 0xa6, 0x03, 0xa7); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x21); + mipi_dsi_msleep(&ctx, 1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb0, 0x00, 0x00, 0x00, 0x10, 0x00, 0x2c, 0x00, 0x44, + 0x00, 0x59, 0x00, 0x6c, 0x00, 0x7e, 0x00, 0x8e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb1, 0x00, 0x9d, 0x00, 0xd3, 0x00, 0xfa, 0x01, 0x3b, + 0x01, 0x69, 0x01, 0xb5, 0x01, 0xef, 0x01, 0xf2); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb2, 0x02, 0x2c, 0x02, 0x79, 0x02, 0xaa, 0x02, 0xe6, + 0x03, 0x0f, 0x03, 0x3f, 0x03, 0x4f, 0x03, 0x5f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb3, 0x03, 0x71, 0x03, 0x86, 0x03, 0xa0, 0x03, 0xbc, + 0x03, 0xce, 0x03, 0xd9); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb4, 0x00, 0x00, 0x00, 0x10, 0x00, 0x2c, 0x00, 0x44, + 0x00, 0x59, 0x00, 0x6c, 0x00, 0x7e, 0x00, 0x8e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb5, 0x00, 0x9d, 0x00, 0xd3, 0x00, 0xfa, 0x01, 0x3b, + 0x01, 0x69, 0x01, 0xb5, 0x01, 0xef, 0x01, 0xf2); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb6, 0x02, 0x2c, 0x02, 0x79, 0x02, 0xaa, 0x02, 0xe6, + 0x03, 0x0f, 0x03, 0x3f, 0x03, 0x4f, 0x03, 0x5f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb7, 0x03, 0x71, 0x03, 0x86, 0x03, 0xa0, 0x03, 0xbc, + 0x03, 0xce, 0x03, 0xd9); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb8, 0x00, 0x00, 0x00, 0x10, 0x00, 0x2c, 0x00, 0x44, + 0x00, 0x59, 0x00, 0x6c, 0x00, 0x7e, 0x00, 0x8e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb9, 0x00, 0x9d, 0x00, 0xd3, 0x00, 0xfa, 0x01, 0x3b, + 0x01, 0x69, 0x01, 0xb5, 0x01, 0xef, 0x01, 0xf2); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xba, 0x02, 0x2c, 0x02, 0x79, 0x02, 0xaa, 0x02, 0xe6, + 0x03, 0x0f, 0x03, 0x3f, 0x03, 0x4f, 0x03, 0x5f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xbb, 0x03, 0x71, 0x03, 0x86, 0x03, 0xa0, 0x03, 0xbc, + 0x03, 0xce, 0x03, 0xd9); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0xd0); + mipi_dsi_msleep(&ctx, 1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x25, 0xa9); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x10); + mipi_dsi_msleep(&ctx, 1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xba, 0x02); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x55, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x53, 0x2c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x51, 0x0f, 0xff); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x68, 0x00, 0x01); + mipi_dsi_dcs_exit_sleep_mode_multi(&ctx); + mipi_dsi_msleep(&ctx, 100); + mipi_dsi_dcs_set_display_on_multi(&ctx); + + return ctx.accum_err; +} + +static int nt36525_prepare(struct drm_panel *panel) +{ + struct nt36525 *p = panel_to_nt36525(panel); + int ret; + + /* Power-up sequence from Samsung decon_board_nt36525 panel_power_enable */ + ret = regulator_enable(p->vdd); + if (ret) + return ret; + usleep_range(1000, 1500); + ret = regulator_enable(p->vpos); + if (ret) + goto disable_vdd; + usleep_range(1000, 1500); + ret = regulator_enable(p->vneg); + if (ret) + goto disable_vpos; + usleep_range(1000, 1500); + + /* Reset pulse, Samsung sequence from panel_reset */ + usleep_range(10000, 11000); + gpiod_set_value_cansleep(p->reset_gpio, 1); + usleep_range(1000, 1500); + gpiod_set_value_cansleep(p->reset_gpio, 0); + usleep_range(3500, 4000); + gpiod_set_value_cansleep(p->reset_gpio, 1); + usleep_range(10000, 11000); + + ret = nt36525_on(p); + if (ret) + goto fail; + + return 0; + +fail: + gpiod_set_value_cansleep(p->reset_gpio, 0); + regulator_disable(p->vneg); + usleep_range(1000, 1500); +disable_vpos: + regulator_disable(p->vpos); + usleep_range(5000, 5500); +disable_vdd: + regulator_disable(p->vdd); + return ret; +} + +static int nt36525_unprepare(struct drm_panel *panel) +{ + struct nt36525 *p = panel_to_nt36525(panel); + struct mipi_dsi_multi_context ctx = { .dsi = p->dsi }; + + mipi_dsi_dcs_set_display_off_multi(&ctx); + mipi_dsi_msleep(&ctx, 20); + mipi_dsi_dcs_enter_sleep_mode_multi(&ctx); + mipi_dsi_msleep(&ctx, 60); + + usleep_range(3000, 3500); + regulator_disable(p->vneg); + usleep_range(1000, 1500); + regulator_disable(p->vpos); + usleep_range(5000, 5500); + regulator_disable(p->vdd); + msleep(30); + gpiod_set_value_cansleep(p->reset_gpio, 0); + return 0; +} + +static int nt36525_get_modes(struct drm_panel *panel, struct drm_connector *conn) +{ + struct drm_display_mode *m; + + m = drm_mode_duplicate(conn->dev, &nt36525_xcover5_mode); + if (!m) + return -ENOMEM; + drm_mode_set_name(m); + drm_mode_probed_add(conn, m); + conn->display_info.width_mm = m->width_mm; + conn->display_info.height_mm = m->height_mm; + return 1; +} + +static const struct drm_panel_funcs nt36525_funcs = { + .prepare = nt36525_prepare, + .unprepare = nt36525_unprepare, + .get_modes = nt36525_get_modes, +}; + +static int nt36525_probe(struct mipi_dsi_device *dsi) +{ + struct device *dev = &dsi->dev; + struct nt36525 *p; + int ret; + + p = devm_drm_panel_alloc(dev, struct nt36525, panel, &nt36525_funcs, + DRM_MODE_CONNECTOR_DSI); + if (IS_ERR(p)) + return PTR_ERR(p); + + p->dsi = dsi; + ret = drm_panel_of_backlight(&p->panel); + if (ret) + return ret; + + p->vdd = devm_regulator_get(dev, "vdd"); + if (IS_ERR(p->vdd)) + return dev_err_probe(dev, PTR_ERR(p->vdd), "vdd supply\n"); + + p->vpos = devm_regulator_get(dev, "vpos"); + if (IS_ERR(p->vpos)) + return dev_err_probe(dev, PTR_ERR(p->vpos), "vpos supply\n"); + + p->vneg = devm_regulator_get(dev, "vneg"); + if (IS_ERR(p->vneg)) + return dev_err_probe(dev, PTR_ERR(p->vneg), "vneg supply\n"); + + /* + * Request RESX released (high) rather than asserting it here. At probe the + * TDDI may still be running the image the bootloader (or a kernel that + * kexec'd into this one) left on screen; asserting RESX mid-stream made the + * touch half of the chip raise its interrupt before any driver had mapped it. + * The real fix for that livelock is in pinctrl-exynos (inherited EINTs are + * masked at init); this only avoids resetting a live panel needlessly. + * prepare() still performs the full 1-0-1 reset pulse, and vdd_ldo28 is + * always-on, so driving RESX high never drives an unpowered chip. + */ + p->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(p->reset_gpio)) + return dev_err_probe(dev, PTR_ERR(p->reset_gpio), "reset gpio\n"); + + /* MIPI DSI config from Samsung panel node: 3-lane, video mode, RGB888 */ + dsi->lanes = 3; + dsi->format = MIPI_DSI_FMT_RGB888; + /* + * MIPI_DSI_MODE_LPM is load-bearing: .prepare sends the DCS init sequence + * before the DSIM video stream is running. Without LPM those writes go out + * in HS, which blocks waiting for a stream that does not exist yet, so + * .prepare never returns and the modeset hangs. In LP mode the init goes + * over the low-power escape clock, independent of the video stream. + */ + dsi->mode_flags = MIPI_DSI_MODE_VIDEO /* video (non-burst) */ + | MIPI_DSI_MODE_VIDEO_SYNC_PULSE + | MIPI_DSI_MODE_LPM /* force LP for all transfers */ + | MIPI_DSI_CLOCK_NON_CONTINUOUS; + + drm_panel_add(&p->panel); + + mipi_dsi_set_drvdata(dsi, p); + ret = mipi_dsi_attach(dsi); + if (ret) { + drm_panel_remove(&p->panel); + return dev_err_probe(dev, ret, "failed to attach to DSI host\n"); + } + + return 0; +} + +static void nt36525_remove(struct mipi_dsi_device *dsi) +{ + struct nt36525 *p = mipi_dsi_get_drvdata(dsi); + + mipi_dsi_detach(dsi); + drm_panel_remove(&p->panel); +} + +static const struct of_device_id nt36525_of_match[] = { + { .compatible = "samsung,xcover5-nt36525" }, + { } +}; +MODULE_DEVICE_TABLE(of, nt36525_of_match); + +static struct mipi_dsi_driver nt36525_driver = { + .probe = nt36525_probe, + .remove = nt36525_remove, + .driver = { + .name = "panel-novatek-nt36525", + .of_match_table = nt36525_of_match, + }, +}; +module_mipi_dsi_driver(nt36525_driver); + +MODULE_DESCRIPTION("Novatek NT36525 panel driver for Samsung Galaxy XCover5"); +MODULE_AUTHOR("Adil Hüsrev Tepe <tadilhusrev@gmail.com>"); +MODULE_LICENSE("GPL"); -- 2.53.0 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] dt-bindings: display: panel: novatek,nt36525: fix v1 review issues 2026-11-16 7:02 [PATCH v1 0/2] drm/panel: add Novatek NT36525 (Samsung Galaxy XCover5) Adil Hüsrev Tepe 2026-11-16 7:02 ` [PATCH v1 1/2] dt-bindings: display: panel: add Novatek NT36525 Adil Hüsrev Tepe 2026-11-16 7:02 ` [PATCH v1 2/2] drm/panel: add Novatek NT36525 panel driver Adil Hüsrev Tepe @ 2026-11-17 10:43 ` Adil Hüsrev Tepe 2026-11-17 10:43 ` [PATCH v2 2/2] drm/panel: novatek-nt36525: " Adil Hüsrev Tepe 2 siblings, 1 reply; 6+ messages in thread From: Adil Hüsrev Tepe @ 2026-11-17 10:43 UTC (permalink / raw) To: neil.armstrong, jesszhan0024, robh, krzk+dt, conor+dt Cc: maarten.lankhorst, mripard, tzimmermann, airlied, simona, dri-devel, devicetree, linux-kernel, Adil Hüsrev Tepe Addresses the issues Sashiko AI flagged on v1 (https://sashiko.dev/#/patchset/20261116070212.314228-1-tadilhusrev@gmail.com?part=1): - reset-gpios is the physical RESX pin, which is active-low (asserted low, released high); describe it as such (GPIO_ACTIVE_LOW in the example) instead of GPIO_ACTIVE_HIGH. The matching driver fix is in "drm/panel: add Novatek NT36525 panel driver". - Add vpos-supply and vneg-supply: the driver requests three separate regulators ("vdd", "vpos", "vneg"), but the binding only declared "vdd-supply". - Add backlight: true so dtbs_check accepts the backlight property the driver already parses via drm_panel_of_backlight(), instead of switching additionalProperties to unevaluatedProperties (which would also pull in every other panel-common.yaml property, not just this one). Also fold the compatible string into a single, driver-matching value (novatek,nt36525-xcover5) instead of samsung,xcover5-nt36525, which never matched the driver's of_match_table at all. Signed-off-by: Adil Hüsrev Tepe <tadilhusrev@gmail.com> --- .../display/panel/novatek,nt36525.yaml | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml diff --git a/Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml b/Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml new file mode 100644 index 000000000..9158125c9 --- /dev/null +++ b/Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml @@ -0,0 +1,83 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/panel/novatek,nt36525.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Novatek NT36525 MIPI-DSI panel + +maintainers: + - Adil Hüsrev Tepe <tadilhusrev@gmail.com> + +description: + A MIPI-DSI video-mode panel driven by a Novatek NT36525 controller, + 720x1480. The first compatible string names the specific panel as fitted + in a device; the second is the NT36525 controller it is based on. The + panel reset (RESX) is active low. + +allOf: + - $ref: panel-common.yaml# + +properties: + compatible: + items: + - enum: + - novatek,nt36525-xcover5 + - const: novatek,nt36525 + + reg: + maxItems: 1 + description: DSI virtual channel + + reset-gpios: + maxItems: 1 + + vdd-supply: + description: panel logic power supply (vdd_ldo28, 1.8V) + + vpos-supply: + description: LCD positive bias supply + + vneg-supply: + description: LCD negative bias supply + + backlight: true + + port: true + +required: + - compatible + - reg + - reset-gpios + - vdd-supply + - vpos-supply + - vneg-supply + - port + +additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + dsi { + #address-cells = <1>; + #size-cells = <0>; + + panel@0 { + compatible = "novatek,nt36525-xcover5", "novatek,nt36525"; + reg = <0>; + reset-gpios = <&gpa0 0 GPIO_ACTIVE_LOW>; + vdd-supply = <&panel_vdd>; + vpos-supply = <&panel_vpos>; + vneg-supply = <&panel_vneg>; + backlight = <&panel_backlight>; + + port { + panel_in: endpoint { + remote-endpoint = <&dsi_out>; + }; + }; + }; + }; +... -- 2.53.0 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] drm/panel: novatek-nt36525: fix v1 review issues 2026-11-17 10:43 ` [PATCH v2 1/2] dt-bindings: display: panel: novatek,nt36525: fix v1 review issues Adil Hüsrev Tepe @ 2026-11-17 10:43 ` Adil Hüsrev Tepe 2026-11-17 10:47 ` Krzysztof Kozlowski 0 siblings, 1 reply; 6+ messages in thread From: Adil Hüsrev Tepe @ 2026-11-17 10:43 UTC (permalink / raw) To: neil.armstrong, jesszhan0024, robh, krzk+dt, conor+dt Cc: maarten.lankhorst, mripard, tzimmermann, airlied, simona, dri-devel, devicetree, linux-kernel, Adil Hüsrev Tepe Addresses the issues Sashiko AI flagged on v1 (https://sashiko.dev/#/patchset/20261116070212.314228-1-tadilhusrev@gmail.com?part=2): - Set prepare_prev_first = true before drm_panel_add(). Without it, drm_atomic_bridge_chain_pre_enable()/post_disable() call this panel's prepare()/unprepare() on the wrong side of the DSI host bridge's own enable/disable, which host_transfer() rejects on bridge-based hosts (e.g. samsung-dsim). - Fix the reset_gpio polarity: the driver drove the physical level directly instead of using gpiod logical values, which inverts under the GPIO_ACTIVE_LOW DT flag added in the matching binding patch. RESX is active-low (the 1-0-1 physical pulse the vendor sequence describes); switch the DT flag and all gpiod_set_value_cansleep()/ devm_gpiod_get() calls to logical values with the same physical outcome. - Request the "vpos" and "vneg" regulators the driver already needed (matching the binding fix) so dtbs_check and probe agree. - Use drm_connector_helper_get_modes_fixed() in nt36525_get_modes() instead of open-coding drm_mode_duplicate() + drm_mode_set_name() + manual display_info updates and returning -ENOMEM on failure (which drm_helper_probe_get_modes() logs as an error; the helper returns 0 instead). - Rename the compatible string to novatek,nt36525-xcover5, matching the fixed binding; the old samsung,xcover5-nt36525 never matched this driver's of_match_table. Tested on a Samsung Galaxy XCover5 running 7.4-rc1 plus this driver and the matching DTS/binding fixes: debugfs now reports the reset gpio as ACTIVE LOW, and the DSI panel connector probes and reports "connected". Signed-off-by: Adil Hüsrev Tepe <tadilhusrev@gmail.com> --- drivers/gpu/drm/panel/panel-novatek-nt36525.c | 419 +++++++++++++----- 1 file changed, 306 insertions(+), 113 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36525.c b/drivers/gpu/drm/panel/panel-novatek-nt36525.c index d6d805791..ba3e003e6 100644 --- a/drivers/gpu/drm/panel/panel-novatek-nt36525.c +++ b/drivers/gpu/drm/panel/panel-novatek-nt36525.c @@ -1,21 +1,16 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Novatek NT36525 MIPI DSI panel driver — Samsung Galaxy XCover5 + * Novatek NT36525 MIPI DSI panel driver for the Samsung Galaxy XCover5 * - * Panel timing + DCS init stream from Samsung GPL kernel - * (SM-G525F_EUR_14/kernel/drivers/video/fbdev/exynos/panel/nt36525/ - * nt36525_xcover5_panel.h) — 207 packets, 220 ordered steps. - * - * The DCS table is included from "panel-novatek-nt36525-init.h", which - * is generated from Samsung's header (see scripts/panel/gen-nt36525.py - * in the project tree; the lab tree ships the generated file at - * drivers/gpu/drm/panel/panel-novatek-nt36525-init.h). + * Panel timing and the DCS initialisation sequence are taken from the + * Samsung GPL kernel release for the SM-G525F + * (drivers/video/fbdev/exynos/panel/nt36525/nt36525_xcover5_panel.h). */ #include <linux/delay.h> #include <linux/gpio/consumer.h> #include <linux/module.h> -#include <linux/of.h> +#include <linux/mod_devicetable.h> #include <linux/regulator/consumer.h> #include <video/mipi_display.h> @@ -23,27 +18,7 @@ #include <drm/drm_mipi_dsi.h> #include <drm/drm_modes.h> #include <drm/drm_panel.h> - -enum nt36525_cmd_type { - INIT_DCS, - INIT_DELAY, -}; - -struct nt36525_init_cmd { - enum nt36525_cmd_type type; - union { - struct { const u8 *data; size_t len; }; - unsigned int delay_ms; - }; -}; - -/* Convenience constructors so the generated table reads clean. */ -#define DCS(buf) { .type = INIT_DCS, .data = (buf), .len = ARRAY_SIZE(buf) } -#define DLY(ms) { .type = INIT_DELAY, .delay_ms = (ms) } - -/* 207 packet arrays + 220-step init table. Generated from Samsung GPL - * header. Kept in a separate .h so this .c stays focused on logic. */ -#include "panel-novatek-nt36525-init.h" +#include <drm/drm_probe_helper.h> struct nt36525 { struct drm_panel panel; @@ -51,7 +26,7 @@ struct nt36525 { struct regulator *vdd; /* vdd_ldo28, 1.8 V */ struct regulator *vpos; /* LCD positive bias */ struct regulator *vneg; /* LCD negative bias */ - struct gpio_desc *reset_gpio; /* panel RESX, active-high per Samsung */ + struct gpio_desc *reset_gpio; /* panel RESX, active-low; gpiod value 1 = asserted */ }; static inline struct nt36525 *panel_to_nt36525(struct drm_panel *p) @@ -75,29 +50,263 @@ static const struct drm_display_mode nt36525_xcover5_mode = { .type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED, }; -static int nt36525_send(struct nt36525 *p, const struct nt36525_init_cmd *cmd) +static int nt36525_on(struct nt36525 *p) { - ssize_t ret; - - if (cmd->type == INIT_DELAY) { - msleep(cmd->delay_ms); - return 0; - } - ret = mipi_dsi_dcs_write_buffer(p->dsi, cmd->data, cmd->len); - if (ret < 0) { - dev_err(&p->dsi->dev, "DCS write failed: %zd (first byte 0x%02x)\n", - ret, cmd->data[0]); - return ret; - } - return 0; + struct mipi_dsi_multi_context ctx = { .dsi = p->dsi }; + + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x20); + mipi_dsi_msleep(&ctx, 1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x00, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x01, 0x55); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x03, 0x55); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x05, 0xa9); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x07, 0x73); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x08, 0xc1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x0e, 0x91); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x0f, 0x5f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1f, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x69, 0xa9); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x94, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x95, 0xeb); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x96, 0xeb); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x24); + mipi_dsi_msleep(&ctx, 1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x00, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x04, 0x21); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x06, 0x22); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x07, 0x20); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x08, 0x1d); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x0a, 0x0c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x0b, 0x0d); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x0c, 0x0e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x0d, 0x0f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x0f, 0x04); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x10, 0x05); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x12, 0x1e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x13, 0x1e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x14, 0x1e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x16, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1a, 0x21); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1c, 0x22); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1d, 0x20); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1e, 0x1d); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x20, 0x0c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x21, 0x0d); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x22, 0x0e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x23, 0x0f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x25, 0x04); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x26, 0x05); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x28, 0x1e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x29, 0x1e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x2a, 0x1e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x2f, 0x09); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x30, 0x07); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x33, 0x07); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x34, 0x09); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x37, 0x33); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x39, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x3a, 0x05); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x3b, 0x94); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x3d, 0x92); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x4d, 0x12); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x4e, 0x34); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x51, 0x43); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x52, 0x21); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x55, 0x86); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x56, 0x34); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x5a, 0x05); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x5b, 0x94); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x5c, 0xc0); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x5d, 0x06); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x5e, 0x0c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x5f, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x60, 0x80); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x61, 0x72); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x64, 0x11); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x82, 0x0a); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x83, 0x0c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x85, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x86, 0x51); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x92, 0xba); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x93, 0x12); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x94, 0x0a); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xab, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xac, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xad, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xaf, 0x04); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb0, 0x05); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb1, 0xb5); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x25); + mipi_dsi_msleep(&ctx, 1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x0a, 0x82); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x0b, 0x50); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x0c, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x17, 0x82); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x18, 0x06); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x19, 0x0f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x58, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x59, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x5a, 0x40); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x5b, 0x80); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x5c, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x5d, 0x05); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x5e, 0x94); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x5f, 0x05); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x60, 0x94); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x61, 0x05); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x62, 0x94); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x65, 0x05); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x66, 0xb5); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xc0, 0x03); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xca, 0x1c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xcc, 0x1c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xd3, 0x11); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xd4, 0xc8); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xd5, 0x11); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xd6, 0x1c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xd7, 0x11); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x26); + mipi_dsi_msleep(&ctx, 1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x00, 0xa0); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x27); + mipi_dsi_msleep(&ctx, 1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x13, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x15, 0xb4); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1f, 0x55); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x26, 0x0f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xc0, 0x18); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xc1, 0xe0); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xc2, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xc3, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xc4, 0xe0); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xc5, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xc6, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xc7, 0x03); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x23); + mipi_dsi_msleep(&ctx, 1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x07, 0x20); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x08, 0x10); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x12, 0xa6); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x15, 0xfc); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x16, 0x0b); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x04, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x19, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1a, 0x00); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1b, 0x08); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1c, 0x0a); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1d, 0x0c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1e, 0x12); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x1f, 0x16); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x20, 0x1a); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x21, 0x1c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x22, 0x20); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x23, 0x24); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x24, 0x28); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x25, 0x2c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x26, 0x30); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x27, 0x38); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x28, 0x3c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x29, 0x10); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x30, 0xff); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x31, 0xff); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x32, 0xfe); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x33, 0xfd); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x34, 0xfd); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x35, 0xfc); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x36, 0xfb); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x37, 0xf9); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x38, 0xf7); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x39, 0xf3); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x3a, 0xea); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x3b, 0xe6); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x3d, 0xe0); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x3f, 0xdd); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x40, 0xdb); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x41, 0xd9); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x20); + mipi_dsi_msleep(&ctx, 1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb0, 0x00, 0x08, 0x00, 0x18, 0x00, 0x34, 0x00, 0x4c, + 0x00, 0x61, 0x00, 0x74, 0x00, 0x86, 0x00, 0x96); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb1, 0x00, 0xa5, 0x00, 0xdb, 0x01, 0x02, 0x01, 0x43, + 0x01, 0x71, 0x01, 0xbd, 0x01, 0xf7, 0x01, 0xfa); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb2, 0x02, 0x34, 0x02, 0x6f, 0x02, 0x98, 0x02, 0xcc, + 0x02, 0xf1, 0x03, 0x1d, 0x03, 0x2d, 0x03, 0x3b); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb3, 0x03, 0x4d, 0x03, 0x60, 0x03, 0x7a, 0x03, 0x94, + 0x03, 0xa6, 0x03, 0xa7); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb4, 0x00, 0x08, 0x00, 0x18, 0x00, 0x34, 0x00, 0x4c, + 0x00, 0x61, 0x00, 0x74, 0x00, 0x86, 0x00, 0x96); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb5, 0x00, 0xa5, 0x00, 0xdb, 0x01, 0x02, 0x01, 0x43, + 0x01, 0x71, 0x01, 0xbd, 0x01, 0xf7, 0x01, 0xfa); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb6, 0x02, 0x34, 0x02, 0x6f, 0x02, 0x98, 0x02, 0xcc, + 0x02, 0xf1, 0x03, 0x1d, 0x03, 0x2d, 0x03, 0x3b); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb7, 0x03, 0x4d, 0x03, 0x60, 0x03, 0x7a, 0x03, 0x94, + 0x03, 0xa6, 0x03, 0xa7); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb8, 0x00, 0x08, 0x00, 0x18, 0x00, 0x34, 0x00, 0x4c, + 0x00, 0x61, 0x00, 0x74, 0x00, 0x86, 0x00, 0x96); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb9, 0x00, 0xa5, 0x00, 0xdb, 0x01, 0x02, 0x01, 0x43, + 0x01, 0x71, 0x01, 0xbd, 0x01, 0xf7, 0x01, 0xfa); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xba, 0x02, 0x34, 0x02, 0x6f, 0x02, 0x98, 0x02, 0xcc, + 0x02, 0xf1, 0x03, 0x1d, 0x03, 0x2d, 0x03, 0x3b); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xbb, 0x03, 0x4d, 0x03, 0x60, 0x03, 0x7a, 0x03, 0x94, + 0x03, 0xa6, 0x03, 0xa7); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x21); + mipi_dsi_msleep(&ctx, 1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb0, 0x00, 0x00, 0x00, 0x10, 0x00, 0x2c, 0x00, 0x44, + 0x00, 0x59, 0x00, 0x6c, 0x00, 0x7e, 0x00, 0x8e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb1, 0x00, 0x9d, 0x00, 0xd3, 0x00, 0xfa, 0x01, 0x3b, + 0x01, 0x69, 0x01, 0xb5, 0x01, 0xef, 0x01, 0xf2); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb2, 0x02, 0x2c, 0x02, 0x79, 0x02, 0xaa, 0x02, 0xe6, + 0x03, 0x0f, 0x03, 0x3f, 0x03, 0x4f, 0x03, 0x5f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb3, 0x03, 0x71, 0x03, 0x86, 0x03, 0xa0, 0x03, 0xbc, + 0x03, 0xce, 0x03, 0xd9); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb4, 0x00, 0x00, 0x00, 0x10, 0x00, 0x2c, 0x00, 0x44, + 0x00, 0x59, 0x00, 0x6c, 0x00, 0x7e, 0x00, 0x8e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb5, 0x00, 0x9d, 0x00, 0xd3, 0x00, 0xfa, 0x01, 0x3b, + 0x01, 0x69, 0x01, 0xb5, 0x01, 0xef, 0x01, 0xf2); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb6, 0x02, 0x2c, 0x02, 0x79, 0x02, 0xaa, 0x02, 0xe6, + 0x03, 0x0f, 0x03, 0x3f, 0x03, 0x4f, 0x03, 0x5f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb7, 0x03, 0x71, 0x03, 0x86, 0x03, 0xa0, 0x03, 0xbc, + 0x03, 0xce, 0x03, 0xd9); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb8, 0x00, 0x00, 0x00, 0x10, 0x00, 0x2c, 0x00, 0x44, + 0x00, 0x59, 0x00, 0x6c, 0x00, 0x7e, 0x00, 0x8e); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb9, 0x00, 0x9d, 0x00, 0xd3, 0x00, 0xfa, 0x01, 0x3b, + 0x01, 0x69, 0x01, 0xb5, 0x01, 0xef, 0x01, 0xf2); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xba, 0x02, 0x2c, 0x02, 0x79, 0x02, 0xaa, 0x02, 0xe6, + 0x03, 0x0f, 0x03, 0x3f, 0x03, 0x4f, 0x03, 0x5f); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xbb, 0x03, 0x71, 0x03, 0x86, 0x03, 0xa0, 0x03, 0xbc, + 0x03, 0xce, 0x03, 0xd9); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0xd0); + mipi_dsi_msleep(&ctx, 1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x25, 0xa9); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xff, 0x10); + mipi_dsi_msleep(&ctx, 1); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xfb, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xba, 0x02); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x55, 0x01); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x53, 0x2c); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x51, 0x0f, 0xff); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x68, 0x00, 0x01); + mipi_dsi_dcs_exit_sleep_mode_multi(&ctx); + mipi_dsi_msleep(&ctx, 100); + mipi_dsi_dcs_set_display_on_multi(&ctx); + + return ctx.accum_err; } static int nt36525_prepare(struct drm_panel *panel) { struct nt36525 *p = panel_to_nt36525(panel); - int ret, i; + int ret; - dev_info(&p->dsi->dev, "MODESET panel: prepare enter (power+reset+207 DCS)\n"); /* Power-up sequence from Samsung decon_board_nt36525 panel_power_enable */ ret = regulator_enable(p->vdd); if (ret) @@ -112,35 +321,27 @@ static int nt36525_prepare(struct drm_panel *panel) goto disable_vpos; usleep_range(1000, 1500); - /* Reset pulse — Samsung sequence from panel_reset */ + /* + * Reset pulse, Samsung sequence from panel_reset. Logical values are + * inverted from the physical levels the vendor sequence describes + * (RESX is active-low): deassert, assert, deassert. + */ usleep_range(10000, 11000); - gpiod_set_value_cansleep(p->reset_gpio, 1); - usleep_range(1000, 1500); gpiod_set_value_cansleep(p->reset_gpio, 0); - usleep_range(3500, 4000); + usleep_range(1000, 1500); gpiod_set_value_cansleep(p->reset_gpio, 1); + usleep_range(3500, 4000); + gpiod_set_value_cansleep(p->reset_gpio, 0); usleep_range(10000, 11000); - dev_info(&p->dsi->dev, "MODESET panel: power/reset done, sending %u DCS cmds (LPM)\n", - (unsigned)ARRAY_SIZE(nt36525_init_cmds)); - /* Replay DCS init stream (207 packets + delays) */ - for (i = 0; i < ARRAY_SIZE(nt36525_init_cmds); i++) { - ret = nt36525_send(p, &nt36525_init_cmds[i]); - if (ret) { - dev_err(&p->dsi->dev, - "MODESET panel: DCS stream failed at step %d (ret=%d)\n", - i, ret); - goto fail; - } - } - dev_info(&p->dsi->dev, "MODESET panel: init stream OK (%zu steps)\n", - ARRAY_SIZE(nt36525_init_cmds)); - dev_info(&p->dsi->dev, "MODESET panel: all DCS sent, prepare COMPLETE\n"); + ret = nt36525_on(p); + if (ret) + goto fail; + return 0; fail: - dev_err(&p->dsi->dev, "MODESET panel: DCS #%d FAILED (ret=%d)\n", i, ret); - gpiod_set_value_cansleep(p->reset_gpio, 0); + gpiod_set_value_cansleep(p->reset_gpio, 1); regulator_disable(p->vneg); usleep_range(1000, 1500); disable_vpos: @@ -154,13 +355,12 @@ static int nt36525_prepare(struct drm_panel *panel) static int nt36525_unprepare(struct drm_panel *panel) { struct nt36525 *p = panel_to_nt36525(panel); - static const u8 cmd_display_off[] = { MIPI_DCS_SET_DISPLAY_OFF }; - static const u8 cmd_sleep_in[] = { MIPI_DCS_ENTER_SLEEP_MODE }; + struct mipi_dsi_multi_context ctx = { .dsi = p->dsi }; - mipi_dsi_dcs_write_buffer(p->dsi, cmd_display_off, sizeof(cmd_display_off)); - msleep(20); - mipi_dsi_dcs_write_buffer(p->dsi, cmd_sleep_in, sizeof(cmd_sleep_in)); - msleep(60); + mipi_dsi_dcs_set_display_off_multi(&ctx); + mipi_dsi_msleep(&ctx, 20); + mipi_dsi_dcs_enter_sleep_mode_multi(&ctx); + mipi_dsi_msleep(&ctx, 60); usleep_range(3000, 3500); regulator_disable(p->vneg); @@ -169,30 +369,18 @@ static int nt36525_unprepare(struct drm_panel *panel) usleep_range(5000, 5500); regulator_disable(p->vdd); msleep(30); - gpiod_set_value_cansleep(p->reset_gpio, 0); + gpiod_set_value_cansleep(p->reset_gpio, 1); return 0; } -static int nt36525_enable(struct drm_panel *panel) { return 0; } -static int nt36525_disable(struct drm_panel *panel) { return 0; } - static int nt36525_get_modes(struct drm_panel *panel, struct drm_connector *conn) { - struct drm_display_mode *m = drm_mode_duplicate(conn->dev, - &nt36525_xcover5_mode); - if (!m) return -ENOMEM; - drm_mode_set_name(m); - drm_mode_probed_add(conn, m); - conn->display_info.width_mm = m->width_mm; - conn->display_info.height_mm = m->height_mm; - return 1; + return drm_connector_helper_get_modes_fixed(conn, &nt36525_xcover5_mode); } static const struct drm_panel_funcs nt36525_funcs = { .prepare = nt36525_prepare, .unprepare = nt36525_unprepare, - .enable = nt36525_enable, - .disable = nt36525_disable, .get_modes = nt36525_get_modes, }; @@ -202,7 +390,6 @@ static int nt36525_probe(struct mipi_dsi_device *dsi) struct nt36525 *p; int ret; - dev_info(dev, "NT36525: probe entry\n"); p = devm_drm_panel_alloc(dev, struct nt36525, panel, &nt36525_funcs, DRM_MODE_CONNECTOR_DSI); if (IS_ERR(p)) @@ -226,46 +413,52 @@ static int nt36525_probe(struct mipi_dsi_device *dsi) return dev_err_probe(dev, PTR_ERR(p->vneg), "vneg supply\n"); /* - * Request RESX released (high) rather than asserting it here. At probe the - * TDDI may still be running the image the bootloader (or a kernel that - * kexec'd into this one) left on screen; asserting RESX mid-stream made the - * touch half of the chip raise its interrupt before any driver had mapped it. - * The real fix for that livelock is in pinctrl-exynos (inherited EINTs are - * masked at init); this only avoids resetting a live panel needlessly. - * prepare() still performs the full 1-0-1 reset pulse, and vdd_ldo28 is - * always-on, so driving RESX high never drives an unpowered chip. + * Request RESX deasserted (logical 0, active-low) rather than asserting it + * here. At probe the TDDI may still be running the image the bootloader (or + * a kernel that kexec'd into this one) left on screen; asserting RESX + * mid-stream made the touch half of the chip raise its interrupt before any + * driver had mapped it. The real fix for that livelock is in pinctrl-exynos + * (inherited EINTs are masked at init); this only avoids resetting a live + * panel needlessly. prepare() still performs the full deassert-assert- + * deassert reset pulse, and vdd_ldo28 is always-on, so leaving RESX + * deasserted here never drives an unpowered chip. */ - p->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); + p->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(p->reset_gpio)) return dev_err_probe(dev, PTR_ERR(p->reset_gpio), "reset gpio\n"); /* MIPI DSI config from Samsung panel node: 3-lane, video mode, RGB888 */ dsi->lanes = 3; dsi->format = MIPI_DSI_FMT_RGB888; + /* + * MIPI_DSI_MODE_LPM is load-bearing: .prepare sends the DCS init sequence + * before the DSIM video stream is running. Without LPM those writes go out + * in HS, which blocks waiting for a stream that does not exist yet, so + * .prepare never returns and the modeset hangs. In LP mode the init goes + * over the low-power escape clock, independent of the video stream. + */ dsi->mode_flags = MIPI_DSI_MODE_VIDEO /* video (non-burst) */ | MIPI_DSI_MODE_VIDEO_SYNC_PULSE | MIPI_DSI_MODE_LPM /* force LP for all transfers */ | MIPI_DSI_CLOCK_NON_CONTINUOUS; + /* - * MIPI_DSI_MODE_LPM is load-bearing: .prepare sends the 207-packet DCS init - * BEFORE the DSIM video stream is running. Without LPM those DCS writes go out - * in HS, which blocks waiting for a stream that doesn't exist yet -> .prepare - * never returns -> the fbdev modeset commit (and the whole boot) hangs. In LP - * mode the init goes over the low-power escape clock, independent of the video - * stream, so it completes and the stream starts cleanly afterwards. - * ponytail: `display_mode[7]=0x12` in Samsung dts hints MIPI_DSI_MODE_VIDEO_HSE; - * add only if tearing shows up — simplest common config first. */ - - dev_info(dev, "NT36525: regulator+gpio ok, drm_panel_add + mipi_dsi_attach...\n"); + * This panel's DCS init sequence runs in .prepare(), before the DSI host + * bridge's own atomic_pre_enable(). On bridge-based hosts (e.g. + * samsung-dsim) that ordering matters: without this, host_transfer() + * rejects the LP writes because the host bridge isn't enabled yet. + */ + p->panel.prepare_prev_first = true; + drm_panel_add(&p->panel); mipi_dsi_set_drvdata(dsi, p); ret = mipi_dsi_attach(dsi); if (ret) { drm_panel_remove(&p->panel); - return ret; + return dev_err_probe(dev, ret, "failed to attach to DSI host\n"); } - dev_info(dev, "NT36525: probe COMPLETE\n"); + return 0; } @@ -294,5 +487,5 @@ static struct mipi_dsi_driver nt36525_driver = { module_mipi_dsi_driver(nt36525_driver); MODULE_DESCRIPTION("Novatek NT36525 panel driver for Samsung Galaxy XCover5"); -MODULE_AUTHOR("Adil Hüsrev Tepe"); -MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Adil Hüsrev Tepe <tadilhusrev@gmail.com>"); +MODULE_LICENSE("GPL"); -- 2.53.0 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] drm/panel: novatek-nt36525: fix v1 review issues 2026-11-17 10:43 ` [PATCH v2 2/2] drm/panel: novatek-nt36525: " Adil Hüsrev Tepe @ 2026-11-17 10:47 ` Krzysztof Kozlowski 0 siblings, 0 replies; 6+ messages in thread From: Krzysztof Kozlowski @ 2026-11-17 10:47 UTC (permalink / raw) To: Adil Hüsrev Tepe, neil.armstrong, jesszhan0024, robh, krzk+dt, conor+dt Cc: maarten.lankhorst, mripard, tzimmermann, airlied, simona, dri-devel, devicetree, linux-kernel On 17/11/2026 11:43, Adil Hüsrev Tepe wrote: > Addresses the issues Sashiko AI flagged on v1 > (https://sashiko.dev/#/patchset/20261116070212.314228-1-tadilhusrev@gmail.com?part=2): > > - Set prepare_prev_first = true before drm_panel_add(). Without it, > drm_atomic_bridge_chain_pre_enable()/post_disable() call this panel's > prepare()/unprepare() on the wrong side of the DSI host bridge's own > enable/disable, which host_transfer() rejects on bridge-based hosts > (e.g. samsung-dsim). v2 is the next version of patchset, not patch on top of v1. Please use git to manage your work correctly and b4 to send it, which also would solve it. Linaro had excellent guide, so please read it to avoid trivial mistakes like this one: https://www.linaro.org/blog/becoming-a-kernel-developer-part1-posting-your-first-patch/ Best regards, Krzysztof ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-17 10:47 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2026-11-16 7:02 [PATCH v1 0/2] drm/panel: add Novatek NT36525 (Samsung Galaxy XCover5) Adil Hüsrev Tepe 2026-11-16 7:02 ` [PATCH v1 1/2] dt-bindings: display: panel: add Novatek NT36525 Adil Hüsrev Tepe 2026-11-16 7:02 ` [PATCH v1 2/2] drm/panel: add Novatek NT36525 panel driver Adil Hüsrev Tepe 2026-11-17 10:43 ` [PATCH v2 1/2] dt-bindings: display: panel: novatek,nt36525: fix v1 review issues Adil Hüsrev Tepe 2026-11-17 10:43 ` [PATCH v2 2/2] drm/panel: novatek-nt36525: " Adil Hüsrev Tepe 2026-11-17 10:47 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®