Skip to contentSkip to conversation

drm/panel: Add support for Samsung AMS662ZS01 panel

PATCH New Vsevolod Nevorotov 2 participants 5 messages Sep 7

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover drm/panel: Add support for Samsung AMS662ZS01 panel

This series adds Device Tree bindings and a DRM panel driver for the Samsung AMS662ZS01 FHD+ AMOLED panel found in the OnePlus 9RT (martini).

Vsevolod Nevorotov (2):
dt-bindings: display: panel: Add Samsung AMS662ZS01 drm/panel: Add Samsung AMS662ZS01 panel driver

 .../display/panel/samsung,ams662zs01.yaml     |  75 ++++
 drivers/gpu/drm/panel/Kconfig                 |  13 +
 drivers/gpu/drm/panel/Makefile                |   1 +
 .../gpu/drm/panel/panel-samsung-ams662zs01.c  | 398 ++++++++++++++++++
 4 files changed, 487 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/samsung,ams662zs01.yaml
 create mode 100644 drivers/gpu/drm/panel/panel-samsung-ams662zs01.c
Signature · 1 line
2.55.0
#1 lore raw

PATCH 1/2 dt-bindings: display: panel: Add Samsung AMS662ZS01

Add Device Tree binding documentation for the Samsung AMS662ZS01 FHD+ AMOLED DSI panel found in the OnePlus 9RT smartphone.

---
 .../display/panel/samsung,ams662zs01.yaml     | 75 +++++++++++++++++++
 1 file changed, 75 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/samsung,ams662zs01.yaml
Documentation/devicetree/bindings/display/panel/samsung,ams662zs01.yaml new file +75 -0
new file mode 100644
index 00000000000..b2697d140ed
@@ -0,0 +1,75 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/samsung,ams662zs01.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Samsung AMS662ZS01 DSI Display Panel
+
+maintainers:
+  - Vsevolod Nevorotov <[email protected]>
+
+allOf:
+  - $ref: panel-common.yaml#
+
+properties:
+  compatible:
+    const: samsung,ams662zs01
+
+  reg:
+    maxItems: 1
+
+  reset-gpios:
+    maxItems: 1
+
+  vout-gpios:
+    maxItems: 1
+    description: Panel VOUT enable GPIO line
+
+  vddio-supply:
+    description: 1.8V I/O power supply
+
+  vdd-supply:
+    description: 3.0V core power supply
+
+  port: true
+
+required:
+  - compatible
+  - reg
+  - reset-gpios
+  - vddio-supply
+  - vdd-supply
+  - port
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    dsi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        panel@0 {
+            compatible = "samsung,ams662zs01";
+            reg = <0>;
+
+            reset-gpios = <&tlmm 24 GPIO_ACTIVE_LOW>;
+            vout-gpios = <&tlmm 25 GPIO_ACTIVE_HIGH>;
+
+            vddio-supply = <&vreg_l12c_1p8>;
+            vdd-supply = <&vreg_l13c_3p0>;
+
+            pinctrl-names = "default", "sleep";
+            pinctrl-0 = <&mdp_vsync_active>;
+            pinctrl-1 = <&mdp_vsync_active>;
+
+            port {
+                panel_in: endpoint {
+                    remote-endpoint = <&mdss_dsi0_out>;
+                };
+            };
+        };
+    };
Signature · 1 line
2.55.0
#2 lore raw

Re: [PATCH 1/2] dt-bindings: display: panel: Add Samsung AMS662ZS01

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Low] The binding introduces a custom `vout-gpios` property instead of using a standard property or a…

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] The binding introduces a custom vout-gpios property instead of using a standard property or a regulator node.
- [Low] The device tree example assigns the exact same active pinctrl state to both the default and sleep states. --

commit 35f05d4d7ea0faa656ae9f5edd021117b1b534c6
Author: Vsevolod Nevorotov <[email protected]>

dt-bindings: display: panel: Add Samsung AMS662ZS01

Add Device Tree binding documentation for the Samsung AMS662ZS01 FHD+ AMOLED DSI panel found in the OnePlus 9RT smartphone.

Quoted 5 lines
Documentation/devicetree/bindings/display/panel/samsung,ams662zs01.yaml new file +0 -0
new file mode 100644
index 0000000000000..b2697d140edef

[ ... ]

Documentation/devicetree/bindings/display/panel/samsung,ams662zs01.yaml line 27

Quoted 6 lines
Documentation/devicetree/bindings/display/panel/samsung,ams662zs01.yaml new file +6 -0
+  reset-gpios:
+    maxItems: 1
+
+  vout-gpios:
+    maxItems: 1
+    description: Panel VOUT enable GPIO line

[Severity: Low]
Is a custom vout-gpios property required here?

Using custom GPIO properties for standard panel functionality like power enabling fragments the device tree ABI and prevents the use of generic driver infrastructure.

Could this be modeled with standard paradigms instead, such as enable-gpios or a regulator-fixed node?

Quoted 3 lines
Documentation/devicetree/bindings/display/panel/samsung,ams662zs01.yaml new file +3 -0
+
+  vddio-supply:
+    description: 1.8V I/O power supply

[ ... ]

Documentation/devicetree/bindings/display/panel/samsung,ams662zs01.yaml line 67

Quoted 6 lines
Documentation/devicetree/bindings/display/panel/samsung,ams662zs01.yaml new file +6 -0
+            vddio-supply = <&vreg_l12c_1p8>;
+            vdd-supply = <&vreg_l13c_3p0>;
+
+            pinctrl-names = "default", "sleep";
+            pinctrl-0 = <&mdp_vsync_active>;
+            pinctrl-1 = <&mdp_vsync_active>;

[Severity: Low]
Should the sleep state use a different pin configuration?

The example assigns the exact same active pinctrl state (&mdp_vsync_active) to both the default and sleep states.

Since device tree examples are frequently copied verbatim into production device trees by developers, using the active pin configuration for the sleep state defeats power management and can lead to increased power leakage during system suspend.

Quoted 8 lines
Documentation/devicetree/bindings/display/panel/samsung,ams662zs01.yaml new file +8 -0
+
+            port {
+                panel_in: endpoint {
+                    remote-endpoint = <&mdss_dsi0_out>;
+                };
+            };
+        };
+    };
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#3 lore raw

PATCH 2/2 drm/panel: Add Samsung AMS662ZS01 panel driver

In reply to Vsevolod Nevorotov

Add support for the Samsung AMS662ZS01 AMOLED display panel used in the OnePlus 9RT (martini) smartphone.

The panel operates in Command Mode with DSC (Display Stream Compression) enabled at 1080x2400 resolution at 60Hz.

---
 drivers/gpu/drm/panel/Kconfig                 |  13 +
 drivers/gpu/drm/panel/Makefile                |   1 +
 .../gpu/drm/panel/panel-samsung-ams662zs01.c  | 398 ++++++++++++++++++
 3 files changed, 412 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-samsung-ams662zs01.c
drivers/gpu/drm/panel/Kconfig +13 -0
index cbdf7b8f7f7..c94116ca42c 100644
@@ -904,6 +904,19 @@ config DRM_PANEL_SAMSUNG_AMS639RQ08
 	  Say Y or M here if you want to enable support for the
 	  Samsung AMS639RQ08 FHD Plus (2340x1080@60Hz) CMD mode panel.
 
+config DRM_PANEL_SAMSUNG_AMS662ZS01
+	tristate "Samsung AMS662ZS01 panel"
+	depends on GPIOLIB && OF && REGULATOR
+	depends on DRM_MIPI_DSI
+	depends on BACKLIGHT_CLASS_DEVICE
+	select DRM_DISPLAY_HELPER
+	select DRM_DISPLAY_DSC_HELPER
+	help
+	  Say Y or M here if you want to enable support for the
+	  Samsung AMS662ZS01 FHD Plus (1080x2400@60Hz) DSC CMD mode panel.
+	  This panel is connected via MIPI DSI interface and is
+	  primarily found in the OnePlus 9RT smartphone.
+
 config DRM_PANEL_SAMSUNG_S6E88A0_AMS427AP24
 	tristate "Samsung AMS427AP24 panel with S6E88A0 controller"
 	depends on GPIOLIB && OF && REGULATOR
drivers/gpu/drm/panel/Makefile +1 -0
index 3b523cf3783..fc5cfc4dd6b 100644
@@ -88,6 +88,7 @@ obj-$(CONFIG_DRM_PANEL_RENESAS_R69328) += panel-renesas-r69328.o
 obj-$(CONFIG_DRM_PANEL_RONBO_RB070D30) += panel-ronbo-rb070d30.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_AMS581VF01) += panel-samsung-ams581vf01.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_AMS639RQ08) += panel-samsung-ams639rq08.o
+obj-$(CONFIG_DRM_PANEL_SAMSUNG_AMS662ZS01) += panel-samsung-ams662zs01.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_ATNA33XC20) += panel-samsung-atna33xc20.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_DB7430) += panel-samsung-db7430.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o
drivers/gpu/drm/panel/panel-samsung-ams662zs01.c new file +398 -0

398 lines not on this page · raw message

Signature · 1 line
2.55.0
#4 lore raw

Re: [PATCH 2/2] drm/panel: Add Samsung AMS662ZS01 panel driver

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: - [High] Panel reset GPIO is initialized to physical HIGH while regulators are off, causing hardware…

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] Panel reset GPIO is initialized to physical HIGH while regulators are off, causing hardware back-powering.
- [Medium] Data race on shared dsi->mode_flags due to non-atomic modification in sysfs backlight update callback.
- [Medium] The backlight sysfs interface issues DSI transfers to an unpowered panel.
--

commit df8bf199977cc597d9cc38caadd2457c9f44d341
Author: Vsevolod Nevorotov <[email protected]>

drm/panel: Add Samsung AMS662ZS01 panel driver

Add support for the Samsung AMS662ZS01 AMOLED display panel used in the OnePlus 9RT (martini) smartphone.

The panel operates in Command Mode with DSC (Display Stream Compression) enabled at 1080x2400 resolution at 60Hz.

Quoted 7 lines
drivers/gpu/drm/panel/panel-samsung-ams662zs01.c new file +0 -0
new file mode 100644
index 0000000000000..52e7e75c08b13
[ ... ]

drivers/gpu/drm/panel/panel-samsung-ams662zs01.c static int ams662zs01_bl_update_status(struct backlight_device *bl) · line 274

Quoted 8 lines
drivers/gpu/drm/panel/panel-samsung-ams662zs01.c new file +0 -0
@@ -267,11 +267,10 @@ static int ams662zs01_bl_update_status(struct backlight_device *bl)
 {
 	struct mipi_dsi_device *dsi = bl_get_data(bl);
 	u16 brightness = backlight_get_brightness(bl);
 	int ret;
 
 	dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
 	ret = mipi_dsi_dcs_set_display_brightness_large(dsi, brightness);
 	dsi->mode_flags |= MIPI_DSI_MODE_LPM;

[Severity: Medium]
Could this create a data race on dsi->mode_flags?

The backlight subsystem uses bl->update_lock while DRM uses drm_modeset_lock, providing no mutual exclusion between these paths. A concurrent sysfs write to the backlight brightness node during ams662zs01_prepare() could race on dsi->mode_flags. This might cause display initialization commands to be sent in the wrong power mode.

[Severity: Medium]
Does this function lack a check to ensure the panel is prepared and powered on before attempting DSI communication?

If userspace writes to the backlight sysfs node while the panel is unprepared (screen off or system suspended), this unconditionally sends DCS commands. Attempting a DSI transfer while the panel's regulators are disabled could cause hardware timeouts, bus errors, or host driver failures.

Quoted 5 lines
drivers/gpu/drm/panel/panel-samsung-ams662zs01.c new file +0 -0
 	return ret;
 }
[ ... ]

drivers/gpu/drm/panel/panel-samsung-ams662zs01.c static int ams662zs01_probe(struct mipi_dsi_device *dsi) · line 318

Quoted 9 lines
drivers/gpu/drm/panel/panel-samsung-ams662zs01.c new file +0 -0
@@ -311,9 +310,10 @@ static int ams662zs01_probe(struct mipi_dsi_device *dsi)
 	if (IS_ERR(ctx))
 		return PTR_ERR(ctx);
 
 	ret = devm_regulator_bulk_get_const(dev, ARRAY_SIZE(ams662zs01_supplies),
 					    ams662zs01_supplies, &ctx->supplies);
 	if (ret < 0)
 		return ret;
 
 	ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);

[Severity: High]
Does this initialize the active-low reset GPIO to physical HIGH before the panel's regulators are turned on?

Calling devm_gpiod_get() with GPIOD_OUT_LOW on an active-low GPIO immediately drives the pin physically HIGH. Driving the reset GPIO high while the panel's main power rails (VDDIO/VDD) are off could forward-bias the ESD protection diodes inside the panel driver IC. This back-powers the IC logic domain, which might cause permanent hardware damage or latch-up preventing panel initialization.

Quoted 6 lines
drivers/gpu/drm/panel/panel-samsung-ams662zs01.c new file +0 -0
 	if (IS_ERR(ctx->reset_gpio))
 		return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio),
 				     "Failed to get reset-gpios\n");
[ ... ]
@@ -330,9 +330,10 @@ static int ams662zs01_probe(struct mipi_dsi_device *dsi)
 	dsi->format = MIPI_DSI_FMT_RGB888;

drivers/gpu/drm/panel/panel-samsung-ams662zs01.c static int ams662zs01_probe(struct mipi_dsi_device *dsi)

Quoted 10 lines
drivers/gpu/drm/panel/panel-samsung-ams662zs01.c new file +0 -0
 	dsi->mode_flags = MIPI_DSI_MODE_NO_EOT_PACKET |
 			  MIPI_DSI_CLOCK_NON_CONTINUOUS |
 			  MIPI_DSI_MODE_LPM;
 
 	ctx->panel.prepare_prev_first = true;
 
 	ctx->panel.backlight = ams662zs01_create_backlight(dsi);
 	if (IS_ERR(ctx->panel.backlight))
 		return dev_err_probe(dev, PTR_ERR(ctx->panel.backlight),
 				     "Failed to create backlight\n");

[Severity: Medium]
Is it safe to expose the backlight sysfs interface here before the DSI device is attached to the host?

Because the backlight device is registered here, it is exposed to userspace while the panel is unprepared and before mipi_dsi_attach() is called. This makes the unprotected DSI transfers in ams662zs01_bl_update_status() reachable immediately, even while the panel is suspended.

Quoted 2 lines

drm_panel_add(&ctx->panel);

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2