* [PATCH 0/2] drm/panel: Add Novatek NT36536 panel driver
@ 2026-06-30 2:34 Pengyu Luo
2026-06-30 2:34 ` [PATCH 1/2] dt-bindings: display: panel: Add Novatek NT36536 Pengyu Luo
2026-06-30 2:34 ` [PATCH 2/2] drm/panel: Add Novatek NT36536 panel driver Pengyu Luo
0 siblings, 2 replies; 6+ messages in thread
From: Pengyu Luo @ 2026-06-30 2:34 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: dri-devel, devicetree, linux-kernel, Pengyu Luo
Add a driver for panels using the Novatek NT36536 Display Driver IC,
including support for the CSOT PP8807HB1-1, a 10-bit panel found in
LENOVO Legion Y700 Gen4.
Signed-off-by: Pengyu Luo <mitltlatltl@gmail.com>
---
Pengyu Luo (2):
dt-bindings: display: panel: Add Novatek NT36536
drm/panel: Add Novatek NT36536 panel driver
.../display/panel/novatek,nt36536.yaml | 90 ++++
drivers/gpu/drm/panel/Kconfig | 11 +
drivers/gpu/drm/panel/Makefile | 1 +
drivers/gpu/drm/panel/panel-novatek-nt36536.c | 494 ++++++++++++++++++
4 files changed, 596 insertions(+)
create mode 100644 Documentation/devicetree/bindings/display/panel/novatek,nt36536.yaml
create mode 100644 drivers/gpu/drm/panel/panel-novatek-nt36536.c
--
2.54.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] dt-bindings: display: panel: Add Novatek NT36536
2026-06-30 2:34 [PATCH 0/2] drm/panel: Add Novatek NT36536 panel driver Pengyu Luo
@ 2026-06-30 2:34 ` Pengyu Luo
2026-06-30 2:45 ` sashiko-bot
2026-06-30 7:46 ` Krzysztof Kozlowski
2026-06-30 2:34 ` [PATCH 2/2] drm/panel: Add Novatek NT36536 panel driver Pengyu Luo
1 sibling, 2 replies; 6+ messages in thread
From: Pengyu Luo @ 2026-06-30 2:34 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: dri-devel, devicetree, linux-kernel, Pengyu Luo
NT36536 is a driver IC used to drive MIPI-DSI panels. It is found in
LENOVO Legion Y700 Gen4 with a 10-bit CSOT panel.
Signed-off-by: Pengyu Luo <mitltlatltl@gmail.com>
---
.../display/panel/novatek,nt36536.yaml | 90 +++++++++++++++++++
1 file changed, 90 insertions(+)
create mode 100644 Documentation/devicetree/bindings/display/panel/novatek,nt36536.yaml
diff --git a/Documentation/devicetree/bindings/display/panel/novatek,nt36536.yaml b/Documentation/devicetree/bindings/display/panel/novatek,nt36536.yaml
new file mode 100644
index 000000000000..f854fc99ba81
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/novatek,nt36536.yaml
@@ -0,0 +1,90 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/novatek,nt36536.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Novatek NT36536 based DSI display Panels
+
+maintainers:
+ - Pengyu Luo <mitltlatltl@gmail.com>
+
+description:
+ The Novatek NT36536 is a generic DSI Panel IC used to drive dsi
+ panels. Support video mode panels from China Star Optoelectronics
+ Technology (CSOT).
+
+allOf:
+ - $ref: panel-common-dual.yaml#
+
+properties:
+ compatible:
+ items:
+ - enum:
+ - csot,pp8807hb1-1
+ - const: novatek,nt36536
+
+ reg:
+ maxItems: 1
+
+ reset-gpios:
+ maxItems: 1
+
+ vddio-supply:
+ description: I/O source voltage rail
+
+ vsp-supply:
+ description: Positive source voltage rail
+
+ vsn-supply:
+ description: Negative source voltage rail
+
+ backlight: true
+ ports: true
+
+required:
+ - compatible
+ - reg
+ - vddio-supply
+ - reset-gpios
+ - ports
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/gpio/gpio.h>
+
+ dsi {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ panel@0 {
+ compatible = "csot,pp8807hb1-1", "novatek,nt36536";
+ reg = <0>;
+
+ vddio-supply = <&vreg_iovdd_1p8>;
+ reset-gpios = <&tlmm 98 GPIO_ACTIVE_LOW>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+ panel_in_0: endpoint {
+ remote-endpoint = <&dsi0_out>;
+ };
+ };
+
+ port@1{
+ reg = <1>;
+ panel_in_1: endpoint {
+ remote-endpoint = <&dsi1_out>;
+ };
+ };
+ };
+ };
+ };
+
+...
--
2.54.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] drm/panel: Add Novatek NT36536 panel driver
2026-06-30 2:34 [PATCH 0/2] drm/panel: Add Novatek NT36536 panel driver Pengyu Luo
2026-06-30 2:34 ` [PATCH 1/2] dt-bindings: display: panel: Add Novatek NT36536 Pengyu Luo
@ 2026-06-30 2:34 ` Pengyu Luo
2026-06-30 2:47 ` sashiko-bot
1 sibling, 1 reply; 6+ messages in thread
From: Pengyu Luo @ 2026-06-30 2:34 UTC (permalink / raw)
To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: dri-devel, devicetree, linux-kernel, Pengyu Luo
Add a driver for panels using the Novatek NT36536 Display Driver IC,
including support for the CSOT PP8807HB1-1, a 10-bit panel found in
LENOVO Legion Y700 Gen4.
Signed-off-by: Pengyu Luo <mitltlatltl@gmail.com>
---
drivers/gpu/drm/panel/Kconfig | 11 +
drivers/gpu/drm/panel/Makefile | 1 +
drivers/gpu/drm/panel/panel-novatek-nt36536.c | 494 ++++++++++++++++++
3 files changed, 506 insertions(+)
create mode 100644 drivers/gpu/drm/panel/panel-novatek-nt36536.c
diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 7450b27622a2..3912b79a2ebb 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -620,6 +620,17 @@ 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_NT36536
+ tristate "Novatek NT36536 panel driver"
+ depends on OF
+ depends on DRM_MIPI_DSI
+ depends on BACKLIGHT_CLASS_DEVICE
+ select DRM_KMS_HELPER
+ help
+ Say Y here if you want to enable support for Novatek NT36536-based
+ display panels, such as the one found in the LENOVO Legion Y700
+ Gen4.
+
config DRM_PANEL_NOVATEK_NT36672A
tristate "Novatek NT36672A DSI panel"
depends on GPIOLIB
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index c2c5cf817116..21a5bdca988a 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -60,6 +60,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_NT36536) += panel-novatek-nt36536.o
obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672A) += panel-novatek-nt36672a.o
obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672E) += panel-novatek-nt36672e.o
obj-$(CONFIG_DRM_PANEL_NOVATEK_NT37700F) += panel-novatek-nt37700f.o
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36536.c b/drivers/gpu/drm/panel/panel-novatek-nt36536.c
new file mode 100644
index 000000000000..3ad21fcdf9f0
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-novatek-nt36536.c
@@ -0,0 +1,494 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Novatek NT36536 DriverIC panels driver
+ * Copyright (c) 2026 Pengyu Luo <mitltlatltl@gmail.com>
+ *
+ * Based on the sample code which is generated with
+ * linux-mdss-dsi-panel-driver-generator
+ */
+
+#include <linux/backlight.h>
+#include <linux/delay.h>
+#include <linux/gpio/consumer.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_graph.h>
+#include <linux/regulator/consumer.h>
+
+#include <drm/display/drm_dsc.h>
+#include <drm/display/drm_dsc_helper.h>
+#include <drm/drm_mipi_dsi.h>
+#include <drm/drm_modes.h>
+#include <drm/drm_panel.h>
+#include <drm/drm_probe_helper.h>
+
+#include <video/mipi_display.h>
+
+struct novatek {
+ struct drm_panel panel;
+ struct mipi_dsi_device *dsi[2];
+ const struct panel_desc *desc;
+ struct drm_dsc_config dsc;
+ struct gpio_desc *reset_gpio;
+ struct regulator_bulk_data *supplies;
+ struct backlight_device *backlight;
+};
+
+struct panel_desc {
+ unsigned int width_mm;
+ unsigned int height_mm;
+ unsigned int bpc;
+ unsigned int lanes;
+ enum mipi_dsi_pixel_format format;
+ unsigned long mode_flags;
+ const struct drm_dsc_config *dsc_cfg;
+ const struct drm_display_mode *modes;
+ unsigned int num_modes;
+
+ int (*init_sequence)(struct mipi_dsi_multi_context *dsi_ctx);
+
+ bool is_dual_dsi;
+ bool has_dcs_backlight;
+};
+
+static const struct regulator_bulk_data novatek_supplies[] = {
+ { .supply = "vddio" },
+ { .supply = "vsp" },
+ { .supply = "vsn" },
+};
+
+static inline struct novatek *to_novatek(struct drm_panel *panel)
+{
+ return container_of(panel, struct novatek, panel);
+}
+
+static inline struct mipi_dsi_device *to_primary_dsi(struct novatek *ctx)
+{
+ /* Sync on DSI1 for dual dsi */
+ return ctx->desc->is_dual_dsi ? ctx->dsi[1] : ctx->dsi[0];
+}
+
+static void novatek_reset(struct novatek *ctx)
+{
+ gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+ usleep_range(11000, 12000);
+ gpiod_set_value_cansleep(ctx->reset_gpio, 0);
+ usleep_range(1000, 2000);
+ gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+ usleep_range(3000, 4000);
+ gpiod_set_value_cansleep(ctx->reset_gpio, 0);
+ usleep_range(10000, 11000);
+}
+
+static int novatek_prepare(struct drm_panel *panel)
+{
+ struct novatek *ctx = to_novatek(panel);
+ struct mipi_dsi_device *dsi = to_primary_dsi(ctx);
+ struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi };
+ struct drm_dsc_picture_parameter_set pps;
+ struct device *dev = &dsi->dev;
+ int ret;
+
+ ret = regulator_bulk_enable(ARRAY_SIZE(novatek_supplies),
+ ctx->supplies);
+ if (ret < 0)
+ return ret;
+
+ novatek_reset(ctx);
+
+ ret = ctx->desc->init_sequence(&dsi_ctx);
+ if (ret < 0) {
+ dev_err(dev, "Failed to initialize panel: %d\n", ret);
+ gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+ regulator_bulk_disable(ARRAY_SIZE(novatek_supplies),
+ ctx->supplies);
+ return ret;
+ }
+
+ drm_dsc_pps_payload_pack(&pps, &ctx->dsc);
+ mipi_dsi_picture_parameter_set_multi(&dsi_ctx, &pps);
+ mipi_dsi_compression_mode_multi(&dsi_ctx, true);
+ mipi_dsi_msleep(&dsi_ctx, 28);
+
+ return backlight_enable(ctx->backlight);
+}
+
+static int novatek_off(struct mipi_dsi_multi_context *dsi_ctx)
+{
+ mipi_dsi_dcs_set_display_off_multi(dsi_ctx);
+ mipi_dsi_dcs_enter_sleep_mode_multi(dsi_ctx);
+
+ return dsi_ctx->accum_err;
+}
+
+static int novatek_unprepare(struct drm_panel *panel)
+{
+ struct novatek *ctx = to_novatek(panel);
+ struct mipi_dsi_device *dsi = to_primary_dsi(ctx);
+ struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi };
+ struct device *dev = &dsi->dev;
+ int ret;
+
+ backlight_disable(ctx->backlight);
+
+ ret = novatek_off(&dsi_ctx);
+ if (ret < 0)
+ dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
+
+ gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+ regulator_bulk_disable(ARRAY_SIZE(novatek_supplies), ctx->supplies);
+
+ return 0;
+}
+
+static int novatek_get_modes(struct drm_panel *panel,
+ struct drm_connector *connector)
+{
+ struct novatek *ctx = to_novatek(panel);
+ const struct panel_desc *desc = ctx->desc;
+ int i;
+
+ for (i = 0; i < desc->num_modes; i++) {
+ const struct drm_display_mode *m = &desc->modes[i];
+ struct drm_display_mode *mode;
+
+ mode = drm_mode_duplicate(connector->dev, m);
+ if (!mode) {
+ dev_err(panel->dev, "failed to add mode %ux%u@%u\n",
+ m->hdisplay, m->vdisplay, drm_mode_vrefresh(m));
+ return -ENOMEM;
+ }
+
+ mode->type = DRM_MODE_TYPE_DRIVER;
+ if (i == 0)
+ mode->type |= DRM_MODE_TYPE_PREFERRED;
+
+ drm_mode_set_name(mode);
+ drm_mode_probed_add(connector, mode);
+ }
+
+ connector->display_info.width_mm = desc->width_mm;
+ connector->display_info.height_mm = desc->height_mm;
+ connector->display_info.bpc = desc->bpc;
+
+ return desc->num_modes;
+}
+
+static const struct drm_panel_funcs novatek_panel_funcs = {
+ .prepare = novatek_prepare,
+ .unprepare = novatek_unprepare,
+ .get_modes = novatek_get_modes,
+};
+
+static int novatek_bl_update_status(struct backlight_device *bl)
+{
+ struct novatek *ctx = bl_get_data(bl);
+ u16 brightness = backlight_get_brightness(bl);
+
+ return mipi_dsi_dcs_set_display_brightness_large(to_primary_dsi(ctx),
+ brightness);
+}
+
+static const struct backlight_ops novatek_bl_ops = {
+ .update_status = novatek_bl_update_status,
+};
+
+static struct backlight_device *novatek_create_backlight(struct novatek *ctx)
+{
+ struct mipi_dsi_device *dsi = to_primary_dsi(ctx);
+ struct device *dev = &dsi->dev;
+ const struct backlight_properties props = {
+ .type = BACKLIGHT_RAW,
+ .brightness = 512,
+ .max_brightness = 4095,
+ .scale = BACKLIGHT_SCALE_NON_LINEAR,
+ };
+
+ return devm_backlight_device_register(dev, dev_name(dev), dev, ctx,
+ &novatek_bl_ops, &props);
+}
+
+static int csot_pp8807hb1_1_init_seq(struct mipi_dsi_multi_context *dsi_ctx)
+{
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xff, 0x20);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xfb, 0x01);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, MIPI_DCS_SET_PARTIAL_ROWS, 0x50);
+
+ /* cabc */
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xff, 0x23);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xfb, 0x01);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0x89, 0xa4);
+
+ /* pen code */
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xff, 0x26);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xfb, 0x01);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xcd, 0x8f, 0xa9, 0x00);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xce, 0x8c, 0xa9, 0x00);
+
+ /* esd init */
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xff, 0x27);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xfb, 0x01);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0x79, 0x22);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xd0, 0x31);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xd1, 0x08, 0x08);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xd2, 0x08);
+
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xff, 0xd0);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xfb, 0x01);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0x00, 0x31);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0x09, 0xee);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0x1c, 0x77);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0x1d, 0x07);
+
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xff, 0xe0);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xfb, 0x01);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xbb, 0x00);
+
+ /* IC transfer */
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xff, 0xf0);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xfb, 0x01);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xe6, 0x02);
+
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xff, 0x10);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xfb, 0x01);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0x3b,
+ 0x03, 0x4e, 0x1a, 0x04, 0x04, 0x01, 0x80,
+ 0x36, 0x36);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0x60, 0x00);
+ /* enable DSC */
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0x90, 0x03, 0x00);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0x91,
+ 0xab, 0xa8, 0x00, 0x14, 0xd2, 0x00, 0x00,
+ 0x00, 0x01, 0xb9, 0x00, 0x06, 0x05, 0x7a,
+ 0x05, 0xb8);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0x92, 0x10, 0xe0);
+ /* frame ctl */
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xb2, 0x91, 0x80);
+ mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xb3, 0x40);
+ mipi_dsi_dcs_exit_sleep_mode_multi(dsi_ctx);
+ mipi_dsi_msleep(dsi_ctx, 105);
+ mipi_dsi_dcs_set_display_on_multi(dsi_ctx);
+ mipi_dsi_msleep(dsi_ctx, 40);
+
+ return dsi_ctx->accum_err;
+}
+
+static struct drm_dsc_config csot_pp8807hb1_1_dsc_cfg = {
+ .dsc_version_major = 1,
+ .dsc_version_minor = 2,
+ .slice_height = 20,
+ .slice_width = 476,
+ .slice_count = 2,
+ .bits_per_component = 10,
+ .bits_per_pixel = 8 << 4,
+ .block_pred_enable = true,
+};
+
+static const struct drm_display_mode csot_pp8807hb1_1_modes[] = {
+ /* 915552 KHz */
+ {
+ .clock = (952 + 138 + 16 + 16) * 2 * (3040 + 26 + 4 + 330) * 120 / 1000,
+ .hdisplay = 952 * 2,
+ .hsync_start = (952 + 138) * 2,
+ .hsync_end = (952 + 138 + 16) * 2,
+ .htotal = (952 + 138 + 16 + 16) * 2,
+ .vdisplay = 3040,
+ .vsync_start = 3040 + 26,
+ .vsync_end = 3040 + 26 + 4,
+ .vtotal = 3040 + 26 + 4 + 330,
+ },
+ {
+ .clock = (952 + 138 + 16 + 16) * 2 * (3040 + 3426 + 4 + 330) * 60 / 1000,
+ .hdisplay = 952 * 2,
+ .hsync_start = (952 + 138) * 2,
+ .hsync_end = (952 + 138 + 16) * 2,
+ .htotal = (952 + 138 + 16 + 16) * 2,
+ .vdisplay = 3040,
+ .vsync_start = 3040 + 3426,
+ .vsync_end = 3040 + 3426 + 4,
+ .vtotal = 3040 + 3426 + 4 + 330,
+ },
+ {
+ .clock = (952 + 138 + 16 + 16) * 2 * (3040 + 10226 + 4 + 330) * 30 / 1000,
+ .hdisplay = 952 * 2,
+ .hsync_start = (952 + 138) * 2,
+ .hsync_end = (952 + 138 + 16) * 2,
+ .htotal = (952 + 138 + 16 + 16) * 2,
+ .vdisplay = 3040,
+ .vsync_start = 3040 + 10226,
+ .vsync_end = 3040 + 10226 + 4,
+ .vtotal = 3040 + 10226 + 4 + 330,
+ },
+ /* 1064606.4 KHz */
+ {
+ .clock = (952 + 50 + 16 + 16) * 2 * (3040 + 26 + 4 + 50) * 165 / 1000,
+ .hdisplay = 952 * 2,
+ .hsync_start = (952 + 50) * 2,
+ .hsync_end = (952 + 50 + 16) * 2,
+ .htotal = (952 + 50 + 16 + 16) * 2,
+ .vdisplay = 3040,
+ .vsync_start = 3040 + 26,
+ .vsync_end = 3040 + 26 + 4,
+ .vtotal = 3040 + 26 + 4 + 50,
+ },
+ {
+ .clock = (952 + 50 + 16 + 16) * 2 * (3040 + 481 + 4 + 50) * 144 / 1000,
+ .hdisplay = 952 * 2,
+ .hsync_start = (952 + 50) * 2,
+ .hsync_end = (952 + 50 + 16) * 2,
+ .htotal = (952 + 50 + 16 + 16) * 2,
+ .vdisplay = 3040,
+ .vsync_start = 3040 + 481,
+ .vsync_end = 3040 + 481 + 4,
+ .vtotal = 3040 + 481 + 4 + 50,
+ },
+ /* 737942.4 KHz */
+ {
+ .clock = (952 + 330 + 16 + 16) * 2 * (3040 + 26 + 4 + 50) * 90 / 1000,
+ .hdisplay = 952 * 2,
+ .hsync_start = (952 + 330) * 2,
+ .hsync_end = (952 + 330 + 16) * 2,
+ .htotal = (952 + 330 + 16 + 16) * 2,
+ .vdisplay = 3040,
+ .vsync_start = 3040 + 26,
+ .vsync_end = 3040 + 26 + 4,
+ .vtotal = 3040 + 26 + 4 + 50,
+ },
+};
+
+static int novatek_probe(struct mipi_dsi_device *dsi)
+{
+ struct mipi_dsi_device_info dsi_info = {"dsi-secondary", 0, NULL};
+ struct mipi_dsi_host *dsi1_host;
+ struct device *dev = &dsi->dev;
+ const struct panel_desc *desc;
+ struct device_node *dsi1;
+ struct novatek *ctx;
+ int num_dsi = 1;
+ int ret, i;
+
+ ctx = devm_drm_panel_alloc(dev, struct novatek, panel,
+ &novatek_panel_funcs,
+ DRM_MODE_CONNECTOR_DSI);
+ if (IS_ERR(ctx))
+ return PTR_ERR(ctx);
+
+ ret = devm_regulator_bulk_get_const(dev, ARRAY_SIZE(novatek_supplies),
+ novatek_supplies, &ctx->supplies);
+ if (ret < 0)
+ return ret;
+
+ ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
+ if (IS_ERR(ctx->reset_gpio))
+ return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio),
+ "Failed to get reset-gpios\n");
+
+ desc = of_device_get_match_data(dev);
+ if (!desc)
+ return -ENODEV;
+ ctx->desc = desc;
+ ctx->dsc = *desc->dsc_cfg;
+
+ if (desc->is_dual_dsi) {
+ num_dsi = 2;
+ dsi1 = of_graph_get_remote_node(dsi->dev.of_node, 1, -1);
+ if (!dsi1) {
+ dev_err(dev, "cannot get secondary DSI node.\n");
+ return -ENODEV;
+ }
+
+ dsi1_host = of_find_mipi_dsi_host_by_node(dsi1);
+ of_node_put(dsi1);
+ if (!dsi1_host)
+ return dev_err_probe(dev, -EPROBE_DEFER,
+ "cannot get secondary DSI host\n");
+
+ ctx->dsi[1] = devm_mipi_dsi_device_register_full(dev, dsi1_host,
+ &dsi_info);
+ if (IS_ERR(ctx->dsi[1])) {
+ dev_err(dev, "cannot get secondary DSI device\n");
+ return PTR_ERR(ctx->dsi[1]);
+ }
+
+ mipi_dsi_set_drvdata(ctx->dsi[1], ctx);
+ }
+
+ ctx->dsi[0] = dsi;
+ mipi_dsi_set_drvdata(dsi, ctx);
+
+ ctx->panel.prepare_prev_first = true;
+
+ drm_panel_add(&ctx->panel);
+
+ for (i = 0; i < num_dsi; i++) {
+ ctx->dsi[i]->lanes = desc->lanes;
+ ctx->dsi[i]->format = desc->format;
+ ctx->dsi[i]->mode_flags = desc->mode_flags;
+ ctx->dsi[i]->dsc = &ctx->dsc;
+ ret = devm_mipi_dsi_attach(dev, ctx->dsi[i]);
+ if (ret < 0) {
+ drm_panel_remove(&ctx->panel);
+ return dev_err_probe(dev, ret,
+ "Failed to attach to DSI host\n");
+ }
+ }
+
+ if (desc->has_dcs_backlight) {
+ ctx->backlight = novatek_create_backlight(ctx);
+ if (IS_ERR(ctx->backlight))
+ return dev_err_probe(dev, PTR_ERR(ctx->backlight),
+ "Failed to create backlight\n");
+ } else {
+ ret = drm_panel_of_backlight(&ctx->panel);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to get backlight\n");
+ }
+
+ return 0;
+}
+
+static void novatek_remove(struct mipi_dsi_device *dsi)
+{
+ struct novatek *ctx = mipi_dsi_get_drvdata(dsi);
+
+ drm_panel_remove(&ctx->panel);
+}
+
+/* Model name: CSOT PP8807HB1-1 */
+static const struct panel_desc csot_pp8807hb1_1_desc = {
+ .width_mm = 118,
+ .height_mm = 190,
+ .bpc = 10, /* set this to 8 with RGB888 format to support 8-bit mode */
+ .lanes = 3,
+ .format = MIPI_DSI_FMT_RGB101010,
+ .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS |
+ MIPI_DSI_MODE_NO_EOT_PACKET | MIPI_DSI_MODE_VIDEO_BURST |
+ MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_DSC_ALL_SLICES_IN_PKT,
+ .dsc_cfg = &csot_pp8807hb1_1_dsc_cfg,
+ .modes = csot_pp8807hb1_1_modes,
+ .num_modes = ARRAY_SIZE(csot_pp8807hb1_1_modes),
+ .init_sequence = csot_pp8807hb1_1_init_seq,
+ .is_dual_dsi = true,
+ .has_dcs_backlight = false,
+};
+
+static const struct of_device_id novatek_of_match[] = {
+ { .compatible = "csot,pp8807hb1-1", .data = &csot_pp8807hb1_1_desc },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, novatek_of_match);
+
+static struct mipi_dsi_driver novatek_driver = {
+ .probe = novatek_probe,
+ .remove = novatek_remove,
+ .driver = {
+ .name = "panel-novatek-nt36536",
+ .of_match_table = novatek_of_match,
+ },
+};
+module_mipi_dsi_driver(novatek_driver);
+
+MODULE_AUTHOR("Pengyu Luo <mitltlatltl@gmail.com>");
+MODULE_DESCRIPTION("Novatek NT36536 DriverIC panels driver");
+MODULE_LICENSE("GPL");
--
2.54.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] dt-bindings: display: panel: Add Novatek NT36536
2026-06-30 2:34 ` [PATCH 1/2] dt-bindings: display: panel: Add Novatek NT36536 Pengyu Luo
@ 2026-06-30 2:45 ` sashiko-bot
2026-06-30 7:46 ` Krzysztof Kozlowski
1 sibling, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-06-30 2:45 UTC (permalink / raw)
To: Pengyu Luo; +Cc: devicetree, robh, dri-devel, conor+dt
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] Use of `additionalProperties: false` breaks inheritance of common panel properties.
- [Low] Missing space before brace in the device tree example.
--
commit a15a27453070f4b1a8c8e896b7b599f3e42a0e6c
Author: Pengyu Luo <mitltlatltl@gmail.com>
dt-bindings: display: panel: Add Novatek NT36536
This commit adds a new device tree binding for the Novatek NT36536 DSI
display panel used in the LENOVO Legion Y700 Gen4.
> diff --git a/Documentation/devicetree/bindings/display/panel/novatek,nt36536.yaml b/Documentation/devicetree/bindings/display/panel/novatek,nt36536.yaml
> new file mode 100644
> index 0000000000000..06f4d1e0ee4a0
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/panel/novatek,nt36536.yaml
> @@ -0,0 +1,90 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/display/panel/novatek,nt36536.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Novatek NT36536 based DSI display Panels
[ ... ]
> +allOf:
> + - $ref: panel-common-dual.yaml#
> +
> +properties:
[ ... ]
> +required:
> + - compatible
> + - reg
> + - vddio-supply
> + - reset-gpios
> + - ports
> +
> +additionalProperties: false
[Severity: Low]
Does using additionalProperties: false here break the inheritance of properties
from panel-common-dual.yaml#?
The schema validator might reject standard panel properties since
additionalProperties: false only considers properties explicitly defined in the
local file's properties block. Should this be unevaluatedProperties: false
instead?
> +
> +examples:
> + - |
> + #include <dt-bindings/gpio/gpio.h>
> +
> + dsi {
[ ... ]
> + ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + port@0 {
> + reg = <0>;
> + panel_in_0: endpoint {
> + remote-endpoint = <&dsi0_out>;
> + };
> + };
> +
> + port@1{
[Severity: Low]
This isn't a bug, but there is a missing space before the brace here.
> + reg = <1>;
> + panel_in_1: endpoint {
> + remote-endpoint = <&dsi1_out>;
> + };
> + };
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260630023439.248861-1-mitltlatltl@gmail.com?part=1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] drm/panel: Add Novatek NT36536 panel driver
2026-06-30 2:34 ` [PATCH 2/2] drm/panel: Add Novatek NT36536 panel driver Pengyu Luo
@ 2026-06-30 2:47 ` sashiko-bot
0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-06-30 2:47 UTC (permalink / raw)
To: Pengyu Luo; +Cc: dri-devel, robh, conor+dt, devicetree
Thank you for your contribution! Sashiko AI review found 7 potential issue(s) to consider:
- [High] Missing drm_panel_remove() in the probe error paths for backlight initialization leads to a use-after-free on the global panel list.
- [High] The panel is registered and exposed to the system via `drm_panel_add()` before its initialization is complete, causing a race condition.
- [High] Incomplete `drm_dsc_config` static definition leaves critical parameters like `pic_width`, `pic_height`, and rate-control values as 0, breaking DSC.
- [Medium] Unchecked DSI multi-context accumulated error in `novatek_prepare()` during DSC configuration masks transmission failures.
- [Medium] Missing rollback of hardware state and regulators when `backlight_enable()` fails in `novatek_prepare()`.
- [Medium] DCS backlight commands issued in `novatek_bl_update_status()` without verifying the panel power state.
- [Low] Missing Kconfig dependency on `DRM_DISPLAY_DSC_HELPER`.
--
commit 86b2b70476faa9f551d7227512ce180811421366
Author: Pengyu Luo <mitltlatltl@gmail.com>
drm/panel: Add Novatek NT36536 panel driver
Add a driver for panels using the Novatek NT36536 Display Driver IC,
including support for the CSOT PP8807HB1-1, a 10-bit panel found in
LENOVO Legion Y700 Gen4.
> diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
> index 7450b27622a23..3912b79a2ebb2 100644
> --- a/drivers/gpu/drm/panel/Kconfig
> +++ b/drivers/gpu/drm/panel/Kconfig
> @@ -620,6 +620,17 @@ 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_NT36536
> + tristate "Novatek NT36536 panel driver"
> + depends on OF
> + depends on DRM_MIPI_DSI
> + depends on BACKLIGHT_CLASS_DEVICE
> + select DRM_KMS_HELPER
[Severity: Low]
Does this config also need to select DRM_DISPLAY_DSC_HELPER? The driver
utilizes DSC helper functions like drm_dsc_pps_payload_pack(), which could
cause a linker error if DRM_DISPLAY_DSC_HELPER is not selected by another
module.
> + help
> + Say Y here if you want to enable support for Novatek NT36536-based
> + display panels, such as the one found in the LENOVO Legion Y700
> + Gen4.
> +
> config DRM_PANEL_NOVATEK_NT36672A
[ ... ]
> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36536.c b/drivers/gpu/drm/panel/panel-novatek-nt36536.c
> new file mode 100644
> index 0000000000000..3ad21fcdf9f02
> --- /dev/null
> +++ b/drivers/gpu/drm/panel/panel-novatek-nt36536.c
[ ... ]
> +static int novatek_prepare(struct drm_panel *panel)
> +{
> + struct novatek *ctx = to_novatek(panel);
> + struct mipi_dsi_device *dsi = to_primary_dsi(ctx);
> + struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi };
> + struct drm_dsc_picture_parameter_set pps;
> + struct device *dev = &dsi->dev;
> + int ret;
> +
> + ret = regulator_bulk_enable(ARRAY_SIZE(novatek_supplies),
> + ctx->supplies);
> + if (ret < 0)
> + return ret;
> +
> + novatek_reset(ctx);
> +
> + ret = ctx->desc->init_sequence(&dsi_ctx);
> + if (ret < 0) {
> + dev_err(dev, "Failed to initialize panel: %d\n", ret);
> + gpiod_set_value_cansleep(ctx->reset_gpio, 1);
> + regulator_bulk_disable(ARRAY_SIZE(novatek_supplies),
> + ctx->supplies);
> + return ret;
> + }
> +
> + drm_dsc_pps_payload_pack(&pps, &ctx->dsc);
> + mipi_dsi_picture_parameter_set_multi(&dsi_ctx, &pps);
> + mipi_dsi_compression_mode_multi(&dsi_ctx, true);
> + mipi_dsi_msleep(&dsi_ctx, 28);
> +
> + return backlight_enable(ctx->backlight);
[Severity: Medium]
Will the DSI command failures accumulated in dsi_ctx.accum_err be silently
ignored here? The mipi_dsi_*_multi() macros capture errors in the context,
but the function returns the result of backlight_enable() without checking
the accumulated error state.
[Severity: Medium]
If backlight_enable() returns an error, will the hardware state leak? The
function exits without rolling back the regulators or the reset GPIO state
that were enabled earlier in the function, and the DRM core will not call
novatek_unprepare() on a prepare failure.
> +}
[ ... ]
> +static int novatek_bl_update_status(struct backlight_device *bl)
> +{
> + struct novatek *ctx = bl_get_data(bl);
> + u16 brightness = backlight_get_brightness(bl);
> +
> + return mipi_dsi_dcs_set_display_brightness_large(to_primary_dsi(ctx),
> + brightness);
[Severity: Medium]
Could this send DCS commands over a disabled DSI bus? If userspace modifies
the backlight brightness via sysfs while the panel is off (such as after
novatek_unprepare() has run), it looks like the commands are sent without
verifying if the panel is currently prepared and powered.
> +}
[ ... ]
> +static struct drm_dsc_config csot_pp8807hb1_1_dsc_cfg = {
> + .dsc_version_major = 1,
> + .dsc_version_minor = 2,
> + .slice_height = 20,
> + .slice_width = 476,
> + .slice_count = 2,
> + .bits_per_component = 10,
> + .bits_per_pixel = 8 << 4,
> + .block_pred_enable = true,
> +};
[Severity: High]
Is this DSC configuration missing dynamic parameters? Fields like pic_width,
pic_height, and rate-control parameters default to 0 and don't appear to be
dynamically populated by the driver via drm_dsc_compute_rc_parameters()
before being packed in novatek_prepare().
[ ... ]
> +static int novatek_probe(struct mipi_dsi_device *dsi)
> +{
[ ... ]
> + ctx->panel.prepare_prev_first = true;
> +
> + drm_panel_add(&ctx->panel);
> +
> + for (i = 0; i < num_dsi; i++) {
> + ctx->dsi[i]->lanes = desc->lanes;
[Severity: High]
Is it safe to expose the panel via drm_panel_add() before its initialization
is complete? Calling this early allows consumers like DRM bridges to access
the panel before ctx->dsi[i]->lanes is configured, devm_mipi_dsi_attach() is
executed, or the backlight is set up.
> + ctx->dsi[i]->format = desc->format;
> + ctx->dsi[i]->mode_flags = desc->mode_flags;
> + ctx->dsi[i]->dsc = &ctx->dsc;
> + ret = devm_mipi_dsi_attach(dev, ctx->dsi[i]);
> + if (ret < 0) {
> + drm_panel_remove(&ctx->panel);
> + return dev_err_probe(dev, ret,
> + "Failed to attach to DSI host\n");
> + }
> + }
> +
> + if (desc->has_dcs_backlight) {
> + ctx->backlight = novatek_create_backlight(ctx);
> + if (IS_ERR(ctx->backlight))
> + return dev_err_probe(dev, PTR_ERR(ctx->backlight),
> + "Failed to create backlight\n");
[Severity: High]
Does this leak the panel registration on error? The function returns
directly without calling drm_panel_remove(&ctx->panel), leaving a dangling
pointer in the global panel_list.
> + } else {
> + ret = drm_panel_of_backlight(&ctx->panel);
> + if (ret)
> + return dev_err_probe(dev, ret, "Failed to get backlight\n");
[Severity: High]
Similarly, does this alternative error path also need to remove the panel
from the global list to prevent a use-after-free?
> + }
> +
> + return 0;
> +}
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260630023439.248861-1-mitltlatltl@gmail.com?part=2
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] dt-bindings: display: panel: Add Novatek NT36536
2026-06-30 2:34 ` [PATCH 1/2] dt-bindings: display: panel: Add Novatek NT36536 Pengyu Luo
2026-06-30 2:45 ` sashiko-bot
@ 2026-06-30 7:46 ` Krzysztof Kozlowski
1 sibling, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2026-06-30 7:46 UTC (permalink / raw)
To: Pengyu Luo
Cc: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, dri-devel, devicetree,
linux-kernel
On Tue, Jun 30, 2026 at 10:34:38AM +0800, Pengyu Luo wrote:
> NT36536 is a driver IC used to drive MIPI-DSI panels. It is found in
> LENOVO Legion Y700 Gen4 with a 10-bit CSOT panel.
>
> Signed-off-by: Pengyu Luo <mitltlatltl@gmail.com>
> ---
> .../display/panel/novatek,nt36536.yaml | 90 +++++++++++++++++++
> 1 file changed, 90 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/display/panel/novatek,nt36536.yaml
>
> diff --git a/Documentation/devicetree/bindings/display/panel/novatek,nt36536.yaml b/Documentation/devicetree/bindings/display/panel/novatek,nt36536.yaml
> new file mode 100644
> index 000000000000..f854fc99ba81
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/panel/novatek,nt36536.yaml
> @@ -0,0 +1,90 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/display/panel/novatek,nt36536.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Novatek NT36536 based DSI display Panels
> +
> +maintainers:
> + - Pengyu Luo <mitltlatltl@gmail.com>
> +
> +description:
> + The Novatek NT36536 is a generic DSI Panel IC used to drive dsi
> + panels. Support video mode panels from China Star Optoelectronics
> + Technology (CSOT).
> +
> +allOf:
> + - $ref: panel-common-dual.yaml#
Nothing in commit msg or description explains why is this a dual-link?
Judging by example this was intentional, so it should be mentioned
somewhere.
With this improved:
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-06-30 7:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-30 2:34 [PATCH 0/2] drm/panel: Add Novatek NT36536 panel driver Pengyu Luo
2026-06-30 2:34 ` [PATCH 1/2] dt-bindings: display: panel: Add Novatek NT36536 Pengyu Luo
2026-06-30 2:45 ` sashiko-bot
2026-06-30 7:46 ` Krzysztof Kozlowski
2026-06-30 2:34 ` [PATCH 2/2] drm/panel: Add Novatek NT36536 panel driver Pengyu Luo
2026-06-30 2:47 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox