drm/panel: add Novatek NT36525 (Samsung Galaxy XCover5)
Subsystems (4)
cover drm/panel: add Novatek NT36525 (Samsung Galaxy XCover5)
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
Signature · 1 line
2.53.0
PATCH 1/2 dt-bindings: display: panel: add Novatek NT36525
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.
--- .../display/panel/novatek,nt36525.yaml | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml
Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml new file +71 -0
@@ -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 <[email protected]> + +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>; + }; + }; + }; + }; +...
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH v1 1/2] dt-bindings: display: panel: add Novatek NT36525
Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Medium] dt-bindings: display: panel: novatek,nt36525: inverted RESX reset-gpios polarity - [Medium]…
Thank you for your contribution! Sashiko AI review found 3 potential issues to consider:
- [Medium] dt-bindings: display: panel: novatek,nt36525: inverted RESX reset-gpios polarity
- [Medium] dt-bindings: display: panel: novatek,nt36525: missing vpos-supply and vneg-supply properties
- [Medium] dt-bindings: display: novatek,nt36525: additionalProperties blocks backlight
--
commit ff4d190494305111a5c1b07276dbb75205cedb54
Author: Adil Hüsrev Tepe <[email protected]>
dt-bindings: display: panel: add Novatek NT36525
This commit adds a Device Tree binding schema for MIPI-DSI video-mode panels based on the Novatek NT36525 controller.
Quoted 6 lines
Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml new file +0
-0@@ -0,0 +1,71 @@
[ ... ]
Quoted 16 lines
Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml new file +16
-0+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
Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml line 37
Quoted 10 lines
Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml new file +10
-0+ + reg: + maxItems: 1 + description: DSI virtual channel + + reset-gpios: + maxItems: 1 + + vdd-supply: + description: panel power supply
[Severity: Medium]
Should this binding also declare vpos-supply and vneg-supply?
In commit "drm/panel: add Novatek NT36525 panel driver", nt36525_probe() requests three separate regulators ("vdd", "vpos", and "vneg") and nt36525_prepare() sequences all three rails. Without vpos-supply and vneg-supply in the schema, device tree nodes that provide the positive and negative analog bias supplies consumed by the driver will fail dtbs_check validation.
Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml line 48
Quoted 11 lines
Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml new file +11
-0+ + port: true + +required: + - compatible + - reg + - reset-gpios + - vdd-supply + - port + +additionalProperties: false
[Severity: Medium]
Does additionalProperties: false reject the backlight property and other common properties inherited from panel-common.yaml#?
Because additionalProperties: false forbids any property from a referenced schema that is not re-listed locally, standard properties from panel-common.yaml# such as backlight cause dtbs_check errors, even though nt36525_probe() in commit "drm/panel: add Novatek NT36525 panel driver" parses backlight via drm_panel_of_backlight(). Using
unevaluatedProperties: false instead allows the inherited properties from panel-common.yaml# and avoids needing to duplicate reset-gpios and port.
Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml line 61
Quoted 13 lines
Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml new file +13
-0+ +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>;
[Severity: Medium]
Is the reset-gpios polarity inverted in the description and example?
Under panel-common.yaml#, reset-gpios is logically active when asserting reset. The RESX pin on the NT36525 is physically active-low (asserted low to reset and driven high to release reset, as shown by the 1-0-1 pulse in nt36525_prepare() in commit "drm/panel: add Novatek NT36525 panel driver"), so it should be described as active-low and use GPIO_ACTIVE_LOW.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
PATCH 2/2 drm/panel: add Novatek NT36525 panel driver
In reply to Adil Hüsrev TepeAdd 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.
--- 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
drivers/gpu/drm/panel/Kconfig +13 -0
@@ -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
drivers/gpu/drm/panel/Makefile +1 -0
@@ -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
drivers/gpu/drm/panel/panel-novatek-nt36525.c new file +486 -0
486 lines not on this page · raw message
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH v1 2/2] drm/panel: add Novatek NT36525 panel driver
Thank you for your contribution! Sashiko AI review found 4 potential issues to consider: - [High] drm/panel: missing prepare_prev_first = true in nt36525_probe() - [Medium] drm/panel: vpos, vneg…
Thank you for your contribution! Sashiko AI review found 4 potential issues to consider:
- [High] drm/panel: missing prepare_prev_first = true in nt36525_probe()
- [Medium] drm/panel: vpos, vneg, and backlight in nt36525_probe() mismatch DT binding
- [Medium] drm/panel: inverted gpiod logical polarity for reset_gpio in nt36525
- [Low] drm/panel: negative return and open-coded helper in nt36525_get_modes()
--
commit bba87e5acae9fff577a4366212e7273dead1f8e4
Author: Adil Hüsrev Tepe <[email protected]>
drm/panel: add Novatek NT36525 panel driver
This commit adds a DRM panel driver for Novatek NT36525-based MIPI-DSI video-mode panels used in the Samsung Galaxy XCover5.
Quoted 5 lines
drivers/gpu/drm/panel/panel-novatek-nt36525.c new file +0
-0
[ ... ]
Quoted 56 lines
drivers/gpu/drm/panel/panel-novatek-nt36525.c new file +56
-0+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 ); +
drivers/gpu/drm/panel/panel-novatek-nt36525.c line 369
Quoted 10 lines
drivers/gpu/drm/panel/panel-novatek-nt36525.c new file +10
-0+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 ; +}
[Severity: Medium]
Are the gpiod logical states for p->reset_gpio inverted across nt36525_prepare(), nt36525_unprepare(), and nt36525_probe()?
As noted in the comment in nt36525_probe() ("Request RESX released (high) rather than asserting it here"), the hardware RESX pin is active-low (physical 0 asserts reset, physical 1 releases it). Under the gpiod API and panel-common.yaml, logical 1 (GPIOD_OUT_HIGH) means reset asserted and logical 0 (GPIOD_OUT_LOW) means reset deasserted, with the physical inversion described via GPIO_ACTIVE_LOW in Device Tree.
Passing physical levels directly means a Device Tree using standard GPIO_ACTIVE_LOW polarity holds the panel in reset during nt36525_on() and releases reset when powering off, or else has to misdeclare the active-low pin as GPIO_ACTIVE_HIGH.
drivers/gpu/drm/panel/panel-novatek-nt36525.c line 383
Quoted 13 lines
drivers/gpu/drm/panel/panel-novatek-nt36525.c new file +13
-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 ; +}
[Severity: Low]
Can nt36525_get_modes() use drm_connector_helper_get_modes_fixed(conn, &nt36525_xcover5_mode) instead of open-coding mode duplication?
drm_helper_probe_get_modes() expects .get_modes() callbacks to return the number of modes (0 on failure) and logs a drm_err() if a negative error code such as -ENOMEM is returned. drm_connector_helper_get_modes_fixed() handles duplicating the mode, setting its name, updating display_info dimensions, and returning 0 on failure.
[ ... ]
Quoted 17 lines
drivers/gpu/drm/panel/panel-novatek-nt36525.c new file +17
-0+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" );
drivers/gpu/drm/panel/panel-novatek-nt36525.c line 417
Quoted 10 lines
drivers/gpu/drm/panel/panel-novatek-nt36525.c new file +10
-0+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" );
[Severity: Medium]
Do the vpos, vneg, and backlight properties requested here match the DT binding in Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml?
The binding schema only defines compatible, reg, reset-gpios, vdd-supply, and port with additionalProperties: false. A Device Tree conforming to that schema will lack vpos-supply, vneg-supply, and backlight, causing devm_regulator_get() to fall back to dummy regulators with a warning (leaving the positive and negative LCD bias supplies unswitched) and drm_panel_of_backlight() to find no backlight, while a Device Tree that includes them will fail dtbs_check.
[ ... ]
drivers/gpu/drm/panel/panel-novatek-nt36525.c line 448
Quoted 6 lines
drivers/gpu/drm/panel/panel-novatek-nt36525.c new file +6
-0+ 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);
[Severity: High]
Should p->panel.prepare_prev_first = true be set before calling drm_panel_add(&p->panel)?
drm_panel_add() copies panel->prepare_prev_first into panel->bridge.pre_enable_prev_first. Because it is left false, drm_atomic_bridge_chain_pre_enable() calls nt36525_prepare() -> nt36525_on() before the upstream DSI host bridge's atomic_pre_enable() callback, and drm_atomic_bridge_chain_post_disable() disables the upstream DSI host bridge before nt36525_unprepare() sends display-off and sleep-in commands. On bridge-based DSI hosts such as samsung-dsim, transfers sent while DSIM_STATE_ENABLED is cleared are rejected by samsung_dsim_host_transfer() with -EINVAL, causing panel bring-up and power-down to fail.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
PATCH v2 1/2 dt-bindings: display: panel: novatek,nt36525: fix v1 review issues
In reply to Adil Hüsrev TepeAddresses the issues Sashiko AI flagged on v1
(https://sashiko.dev/#/patchset/[email protected]?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.
--- .../display/panel/novatek,nt36525.yaml | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml
Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml new file +83 -0
@@ -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 <[email protected]> + +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>; + }; + }; + }; + }; +...
Signature · 1 line
2.53.0
PATCH v2 2/2 drm/panel: novatek-nt36525: fix v1 review issues
Addresses the issues Sashiko AI flagged on v1
(https://sashiko.dev/#/patchset/[email protected]?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".
--- drivers/gpu/drm/panel/panel-novatek-nt36525.c | 419 +++++++++++++----- 1 file changed, 306 insertions(+), 113 deletions(-)
drivers/gpu/drm/panel/panel-novatek-nt36525.c +306 -113
@@ -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 <[email protected]>" ); +MODULE_LICENSE ("GPL" );
Signature · 1 line
2.53.0
Re: [PATCH v2 2/2] drm/panel: novatek-nt36525: fix v1 review issues
Quoted 8 lines · Adil Hüsrev Tepe
Addresses the issues Sashiko AI flagged on v1
(https://sashiko.dev/#/patchset/[email protected]?part=2):- Set
prepare_prev_first= true beforedrm_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, whichhost_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
Re: [PATCH v2 2/2] drm/panel: novatek-nt36525: fix v1 review issues
You're right, and I'm sorry - that was a git-management mistake on my part, not a deliberate choice. v2 should have been a complete, standalone patch against mainline; instead I sent a diff on top of v1's own (unmerged) patch, which is exactly the kind of thing git and b4 are supposed to prevent when used properly.
I've just sent v3 as a proper, self-contained two-patch series (cover letter + binding + driver), each patch applying cleanly to v7.4-rc1 on its own, with the full v1->v2->v3 changelog moved below the "---" line per your and Andy Shevchenko's feedback instead of in the commit message body. Thanks for catching it - I'll pay closer attention to this going forward.
Adil
v3 cover drm/panel: add Novatek NT36525 (Samsung Galaxy XCover5)
In reply to Adil Hüsrev TepeThis 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-low 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: "novatek,nt36525-xcover5",
"novatek,nt36525")
Patch 2 the panel driver
Apologies to Krzysztof for v2: I sent it as a diff on top of v1's own (unmerged) patch instead of a complete, standalone patch against mainline, which is exactly the git-management mistake you flagged. v3 resends both patches as full, self-contained patches that apply directly to v7.4-rc1, with the v1 -> v2 -> v3 changelog moved below each patch's "---" line instead of the commit message body (also flagged by Andy Shevchenko on the related grip-sensor series, and just as applicable here). No behavioural change from v2.
Tested on a Samsung Galaxy XCover5 running 7.4-rc1 plus this series (re-confirmed 2026-11-17, kernel 7.4.0-rc1-00023-gdcb8b91fb779+ #30):
the DSI panel connector probes and reports "connected", debugfs reports the reset gpio as ACTIVE LOW, and /sys/class/backlight/ is present. 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 | 83 +++ drivers/gpu/drm/panel/Kconfig | 13 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-novatek-nt36525.c | 491 ++++++++++++++++++ 4 files changed, 588 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
PATCH v3 1/2 dt-bindings: display: panel: add Novatek NT36525
Add a 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 reset (RESX) is active-low, and the panel needs three separate supplies (vdd/vpos/vneg) plus an optional backlight.
---
v2 -> v3: no content change. Resent as a fresh, standalone patch (previously v2 1/2 was a diff on top of v1's own patch instead of a complete patch against mainline, which Krzysztof Kozlowski correctly flagged as a git-management mistake on my part; see the cover letter).
v1 -> v2 (addressing Sashiko AI's review of v1,
https://sashiko.dev/#/patchset/[email protected]?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).
- 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.
--- .../display/panel/novatek,nt36525.yaml | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml
Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml new file +83 -0
@@ -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 <[email protected]> + +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
PATCH v3 2/2 drm/panel: add Novatek NT36525 panel driver
In reply to Adil Hüsrev TepeAdd 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-low 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.
Tested on a Samsung Galaxy XCover5 running 7.4-rc1 plus this driver and the matching DTS/binding: debugfs reports the reset gpio as ACTIVE LOW, and the DSI panel connector probes and reports "connected", with /sys/class/backlight/ present (re-confirmed 2026-11-17, kernel 7.4.0-rc1-00023-gdcb8b91fb779+ #30).
---
v2 -> v3: no functional change. v2 was mistakenly sent as a diff on top of v1's own (unmerged) patch instead of a complete, standalone patch against mainline, which Krzysztof Kozlowski correctly flagged as a git-management mistake on my part (see the cover letter). This resends the full driver as a single patch, folding in every v1 -> v2 fix below, and fixes a Kconfig help-text typo ("active-high" -> "active-low") left over from v1 that v2 never corrected.
v1 -> v2 (addressing Sashiko AI's review of v1,
https://sashiko.dev/#/patchset/[email protected]?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.
--- drivers/gpu/drm/panel/Kconfig | 13 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-novatek-nt36525.c | 491 +++++++++++++++++++++++++ 3 files changed, 505 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-novatek-nt36525.c
drivers/gpu/drm/panel/Kconfig +13 -0
@@ -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-low + reset (RESX) 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
drivers/gpu/drm/panel/Makefile +1 -0
@@ -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
drivers/gpu/drm/panel/panel-novatek-nt36525.c new file +491 -0
491 lines not on this page · raw message
Signature · 1 line
2.53.0
Re: [PATCH v3 2/2] drm/panel: add Novatek NT36525 panel driver
Hello,
drivers/gpu/drm/panel/panel-novatek-nt36525.c line 21
Quoted 12 lines · Adil Hüsrev Tepe
drivers/gpu/drm/panel/panel-novatek-nt36525.c new file +12
-0+#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> +#include <drm/drm_probe_helper.h>
<linux/mod_devicetable.h> doens't only give you a definition of of_device_id, but also pulls in a lot of unneeded stuff and thus introduces useless build dependencies.
<drm/drm_mipi_dsi.h> already provides of_device_id, so just drop <linux/mod_devicetable.h>.
Hi Adil,
I've been working on the Moto G10, which uses a DJN NT36525B panel. I have a local driver, but it'd be good to share yours where possible.
My panel is 720x1600 with four DSI lanes, a different init/reset sequence, and DCS backlight control. Would you be happy with follow-up patches adding panel-specific configuration and G10 support on top of your series? I can prepare and test those.
Quoted 7 lines · Michael McAllister
I've been working on the Moto G10, which uses a DJN NT36525B panel. I have a local driver, but it'd be good to share yours where possible.
My panel is 720x1600 with four DSI lanes, a different init/reset sequence, and DCS backlight control. Would you be happy with follow-up patches adding panel-specific configuration and G10 support on top of your series? I can prepare and test those.
Hi Michael,
Sorry for the slow reply. I said in the v4 cover letter that I'd answer you separately, and then didn't.
Yes, very happy to share the driver. Your panel is also relevant to Krzysztof's review of the v4 binding: he asked for the compatible to name the actual panel maker (ours is a CSOT panel), and whether this belongs in an existing Novatek binding. With two panels on the same controller, I'd rather structure v5 around per-panel data from the
start: mode, lane count, init and reset sequence, and backlight source (external or DCS). The XCover5 CSOT panel would be the first entry, so the G10 can come in as a second one without reworking the core.
If you can share your mode and init sequence, or a WIP branch, I'll check the per-panel struct against it before sending v5 and Cc you on it, so your G10 patch can go on top. v5 won't go out before Nov 27.
Thanks,
Adil
v4 cover drm/panel: add Novatek NT36525 (Samsung Galaxy XCover5)
In reply to Adil Hüsrev TepeThis 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-low 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 (no change since v3)
Patch 2 the panel driver
v4 addresses Uwe Kleine-König's v3 review comment: drop the unneeded <linux/mod_devicetable.h> include (it is pulled in transitively; this driver's of_device_id/MODULE_DEVICE_TABLE(of, ...) still build clean without it).
Adding [email protected] to Cc per Ivon Argel's suggestion on the v3 thread, so the relevant ecosystem developers see it (not adding Ivon's own address; he asked not to be personally Cc'd).
On Michael McAllister's offer to add Moto G10 (DJN NT36525B) support on top of this series: happy to see a follow-up patch once this base driver lands; I'll reply on-list separately rather than hold this series on it.
Tested on a Samsung Galaxy XCover5 running 7.4-rc3 plus this series (re-confirmed 2026-11-20, kernel 7.4.0-rc3-00023-gdcb8b91fb779+ #32, after rebasing our local tree from 7.4.0-rc1 to the real 7.4-rc3 tag):
the DSI panel connector probes and reports "connected", debugfs reports the reset gpio as ACTIVE LOW, and /sys/class/backlight/ is present and readable. 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-rc3.
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 | 83 +++ drivers/gpu/drm/panel/Kconfig | 13 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-novatek-nt36525.c | 490 ++++++++++++++++++ 4 files changed, 587 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
PATCH v4 1/2 dt-bindings: display: panel: add Novatek NT36525
Add a 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 reset (RESX) is active-low, and the panel needs three separate supplies (vdd/vpos/vneg) plus an optional backlight.
---
v3 -> v4: no changes to this binding.
v2 -> v3: no content change. Resent as a fresh, standalone patch (previously v2 1/2 was a diff on top of v1's own patch instead of a complete patch against mainline, which Krzysztof Kozlowski correctly flagged as a git-management mistake on my part; see the cover letter).
v1 -> v2 (addressing Sashiko AI's review of v1,
https://sashiko.dev/#/patchset/[email protected]?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).
- 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.
--- .../display/panel/novatek,nt36525.yaml | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml
Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml new file +83 -0
@@ -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 <[email protected]> + +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
Re: [PATCH v4 1/2] dt-bindings: display: panel: add Novatek NT36525
Quoted 6 lines · Adil Hüsrev Tepe
Add a 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 reset (RESX) is active-low, and the panel needs three separate supplies (vdd/vpos/vneg) plus an optional backlight.
Signed-off-by Adil Hüsrev Tepe <[email protected]>
Still incorrectly threaded.
I asked to use b4 for a reason. If you insist on not to, then at least follow standard process and standard guides of upstreaming work.
Quoted 51 lines
---
v3 -> v4: no changes to this binding.v2 -> v3: no content change. Resent as a fresh, standalone patch (previously v2 1/2 was a diff on top of v1's own patch instead of a complete patch against mainline, which Krzysztof Kozlowski correctly flagged as a git-management mistake on my part; see the cover letter).
v1 -> v2 (addressing Sashiko AI's review of v1,
https://sashiko.dev/#/patchset/[email protected]?part=1):
- reset-gpios is the physical RESX pin, which is active-low (asserted low, released high); describe it as such (GPIO_ACTIVE_LOWin the example) instead ofGPIO_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 sodtbs_checkaccepts the backlight property the driver already parses viadrm_panel_of_backlight(), instead of switching additionalProperties to unevaluatedProperties (which would also pull in every otherpanel-common.yamlproperty, not just this one).
- Fold the compatible string into a single, driver-matching value (novatek,nt36525-xcover5) instead of samsung,xcover5-nt36525, which never matched the driver'sof_match_tableat all.--- .../display/panel/novatek,nt36525.yaml | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/novatek,nt36525.yamlDocumentation/devicetree/bindings/display/panel/novatek,nt36525.yaml new file +15
-0@@ -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 <[email protected]> + +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
Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml line 25
Quoted 10 lines
Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml new file +10
-0+ panel reset (RESX) is active low. + +allOf: + - $ref: panel-common.yaml# + +properties: + compatible: + items: + - enum: + - novatek,nt36525-xcover5
I don't get it, what is xcover5? This claims it is Novatek device. Why isn't this actual panel manufacturer?
Quoted 11 lines
Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml new file +11
-0+ - 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)
Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml line 46
Quoted 10 lines
Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml new file +10
-0+ + vpos-supply: + description: LCD positive bias supply + + vneg-supply: + description: LCD negative bias supply + + backlight: true + + port: true
I don't understand why this cannot be part of other bindings... looks exactly like nt36536 or nt36672a
Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml line 55
Quoted 9 lines
Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml new file +9
-0+ +required: + - compatible + - reg + - reset-gpios + - vdd-supply + - vpos-supply + - vneg-supply + - port
Drop port
Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml line 57
Quoted 2 lines
Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml new file +2
-0+ +additionalProperties: false
Best regards,
Krzysztof
Re: [PATCH v4 1/2] dt-bindings: display: panel: add Novatek NT36525
Quoted 4 lines · Krzysztof Kozlowski
Still incorrectly threaded.
I asked to use b4 for a reason. If you insist on not to, then at least follow standard process and standard guides of upstreaming work.
Understood, and sorry. I was sending each new version with --in-reply-to pointing at v1, which is exactly what buried it. The next version will be prepared and sent with b4, as a new thread.
Quoted 5 lines
Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml line 25
Quoted 2 lines
Documentation/devicetree/bindings/display/panel/novatek,nt36525.yaml new file +2
-0+ - enum: + - novatek,nt36525-xcover5I don't get it, what is xcover5? This claims it is Novatek device. Why isn't this actual panel manufacturer?
You're right, Novatek only makes the controller. Samsung's vendor kernel names the panel vendor as CSOT ("CSO" in its panel table), but it doesn't give a part number, and I haven't found one in any public source. I'll try to read it off the panel itself. If that fails, what name would you accept for a CSOT panel whose part number isn't known?
Quoted 2 lines
I don't understand why this cannot be part of other bindings... looks exactly like nt36536 or nt36672a
Agreed, it's the same shape as novatek,nt36536.yaml (three supplies, reset, backlight), which already carries a CSOT panel. Would you prefer the NT36525 panel added to that file, as a second compatible item with a novatek,nt36525 fallback, or a separate file modelled on it?
Michael McAllister (Cc'd) has a DJN NT36525B panel on the Moto G10 that would use the same driver, so I'd like to get the structure right before his panel is added too.
Quoted 3 lines
Quoted 1 line
+ - port
Drop port
Will do.
Thanks,
Adil
PATCH v4 2/2 drm/panel: add Novatek NT36525 panel driver
In reply to Adil Hüsrev TepeAdd 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-low 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.
Tested on a Samsung Galaxy XCover5 running 7.4-rc3 plus this driver and the matching DTS/binding: debugfs reports the reset gpio as ACTIVE LOW, and the DSI panel connector probes and reports "connected", with /sys/class/backlight/ present and readable (re-confirmed 2026-11-20, kernel 7.4.0-rc3-00023-gdcb8b91fb779+ #32, after rebasing our local tree from 7.4.0-rc1 to the real 7.4-rc3 tag).
---
v3 -> v4 (addressing Uwe Kleine-König's review of v3,
https://lore.kernel.org/all/[email protected]/):
- Drop <linux/mod_devicetable.h> (pulled in transitively; of_device_id and MODULE_DEVICE_TABLE(of, ...) still build clean without it).
v2 -> v3: no functional change. v2 was mistakenly sent as a diff on top of v1's own (unmerged) patch instead of a complete, standalone patch against mainline, which Krzysztof Kozlowski correctly flagged as a git-management mistake on my part (see the cover letter). This resends the full driver as a single patch, folding in every v1 -> v2 fix below, and fixes a Kconfig help-text typo ("active-high" -> "active-low") left over from v1 that v2 never corrected.
v1 -> v2 (addressing Sashiko AI's review of v1,
https://sashiko.dev/#/patchset/[email protected]?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.
--- drivers/gpu/drm/panel/Kconfig | 13 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-novatek-nt36525.c | 490 +++++++++++++++++++++ 3 files changed, 504 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-novatek-nt36525.c
drivers/gpu/drm/panel/Kconfig +13 -0
@@ -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-low + reset (RESX) 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
drivers/gpu/drm/panel/Makefile +1 -0
@@ -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
drivers/gpu/drm/panel/panel-novatek-nt36525.c new file +490 -0
490 lines not on this page · raw message
Signature · 1 line
2.53.0