Pixel 3 display fixes
Subsystems (7)
v3 cover Pixel 3 display fixes
1. Update backlight intensity up to what vendor use for production phones.
2. Keep panel power supplies in sync so panel can recover from blanking.
---
Changes in v3:
- Properly fix the panel driver power-on/off cycle.
- Vendor in later downstream kernel commits increased BL limit to 900.
- Link to v2: https://patch.msgid.link/[email protected]
Changes in v2:
- Unintended change 255 -> 256 for default brigtness. Drop it.
- Added R-bs.
- Link to v1: https://patch.msgid.link/[email protected]
---
David Heidelberg (5):
drm/panel: lg-sw43408: use the full DCS brightness range drm/panel: lg-sw43408: skip backlight updates when unprepared drm/panel: lg-sw43408: split enable/disable from prepare/unprepare drm/panel: lg-sw43408: keep VPNL paired with VDDI and reset deasserted
arm64: dts: qcom: sdm845-google: drop panel regulator-always-on
.../arm64/boot/dts/qcom/sdm845-google-blueline.dts | 2 + arch/arm64/boot/dts/qcom/sdm845-google-common.dtsi | 10 -- .../boot/dts/qcom/sdm845-google-crosshatch.dts | 3 + drivers/gpu/drm/panel/panel-lg-sw43408.c | 153 ++++++++++++++++++--- 4 files changed, 138 insertions(+), 30 deletions(-)
---
base-commit: 909ef7a9a30fa139e69e555e3606680f5cca7726
change-id: 20260809-fix-blueline-panel-af2b7c967f2d
Best regards,
Signature · 1 line
David Heidelberg <[email protected]>
PATCH v3 1/5 drm/panel: lg-sw43408: use the full DCS brightness range
The vendor changed the value multiple times. Last value for production devices was 900. HBM can go up to 1023, but keep value safe for now.
--- drivers/gpu/drm/panel/panel-lg-sw43408.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-lg-sw43408.c +2 -1
@@ -197,17 +197,18 @@ static const struct backlight_ops sw43408_backlight_ops = { };static int sw43408_backlight_init (struct sw43408_panel *ctx) {struct device *dev = &ctx->link->dev;const struct backlight_properties props = { .type =BACKLIGHT_PLATFORM , .brightness =255 , - .max_brightness =255 , +/* HBM can go up to 1023, stay safe for now */ + .max_brightness =900 , }; ctx->base.backlight =devm_backlight_device_register (dev,dev_name (dev), dev, ctx->link, &sw43408_backlight_ops, &props);if (IS_ERR (ctx->base.backlight))
Signature · 1 line
2.55.0
Re: [PATCH v3 1/5] drm/panel: lg-sw43408: use the full DCS brightness range
Quoted 26 lines · On 11/25/26 14:08, David Heidelberg via B4 Relay wrote:
From: David Heidelberg <[email protected]>
The vendor changed the value multiple times. Last value for production devices was 900. HBM can go up to 1023, but keep value safe for now.
Fixes 069a6c0e94f9 ("drm: panel: Add LG sw43408 panel driver")Signed-off-by David Heidelberg <[email protected]>--- drivers/gpu/drm/panel/panel-lg-sw43408.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/panel/panel-lg-sw43408.c +0
-1@@ -197,17 +197,18 @@ static const struct backlight_ops sw43408_backlight_ops = { };static int sw43408_backlight_init (struct sw43408_panel *ctx) {struct device *dev = &ctx->link->dev;const struct backlight_properties props = { .type =BACKLIGHT_PLATFORM , .brightness =255 , - .max_brightness =255 ,
drivers/gpu/drm/panel/panel-lg-sw43408.c static const struct backlight_ops sw43408_backlight_ops = { · line 214
Quoted 10 lines
drivers/gpu/drm/panel/panel-lg-sw43408.c +2
-0+/* HBM can go up to 1023, stay safe for now */ + .max_brightness = 900, }; ctx->base.backlight =devm_backlight_device_register (dev,dev_name (dev), dev, ctx->link, &sw43408_backlight_ops, &props);if (IS_ERR (ctx->base.backlight))
Thanks,
Neil
PATCH v3 2/5 drm/panel: lg-sw43408: skip backlight updates when unprepared
In reply to David Heidelbergsw43408_backlight_update_status() unconditionally sends a MIPI DSI DCS brightness command even when the panel is unprepared and the DSI host is powered down, causing sysfs brightness writes while blanked to fail with -EIO.
Pass struct sw43408_panel as the backlight device private data and return early when !ctx->base.prepared, matching other mainline MIPI DSI panel drivers.
--- drivers/gpu/drm/panel/panel-lg-sw43408.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/panel/panel-lg-sw43408.c +6 -3
@@ -181,20 +181,23 @@ static const struct drm_display_mode lh546wf1_ed01_mode = {static int sw43408_get_modes (struct drm_panel *panel,struct drm_connector *connector) {return drm_connector_helper_get_modes_fixed (connector, &lh546wf1_ed01_mode); }static int sw43408_backlight_update_status (struct backlight_device *bl) { -struct mipi_dsi_device *dsi =bl_get_data (bl); +struct sw43408_panel *ctx =bl_get_data (bl);u16 brightness =backlight_get_brightness (bl); -return mipi_dsi_dcs_set_display_brightness_large (dsi, brightness); +if (!ctx->base.prepared) +return 0 ; + +return mipi_dsi_dcs_set_display_brightness_large (ctx->link, brightness); }static const struct backlight_ops sw43408_backlight_ops = { .update_status = sw43408_backlight_update_status, };static int sw43408_backlight_init (struct sw43408_panel *ctx) {
@@ -202,17 +205,17 @@ static int sw43408_backlight_init(struct sw43408_panel *ctx)const struct backlight_properties props = { .type =BACKLIGHT_PLATFORM , .brightness =255 ,/* HBM can go up to 1023, stay safe for now */ .max_brightness =900 , }; ctx->base.backlight =devm_backlight_device_register (dev,dev_name (dev), dev, - ctx->link, + ctx, &sw43408_backlight_ops, &props);if (IS_ERR (ctx->base.backlight))return dev_err_probe (dev,PTR_ERR (ctx->base.backlight),"Failed to create backlight\n" );return 0 ;
Signature · 1 line
2.55.0
Re: [PATCH v3 2/5] drm/panel: lg-sw43408: skip backlight updates when unprepared
Quoted 57 lines · On 11/25/26 14:08, David Heidelberg via B4 Relay wrote:
From: David Heidelberg <[email protected]>
sw43408_backlight_update_status()unconditionally sends a MIPI DSI DCS brightness command even when the panel is unprepared and the DSI host is powered down, causing sysfs brightness writes while blanked to fail with-EIO.Pass struct
sw43408_panelas the backlight device private data and return early when !ctx->base.prepared, matching other mainline MIPI DSI panel drivers.Fixes 069a6c0e94f9 ("drm: panel: Add LG sw43408 panel driver")Signed-off-by David Heidelberg <[email protected]>--- drivers/gpu/drm/panel/panel-lg-sw43408.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)drivers/gpu/drm/panel/panel-lg-sw43408.c +5
-2@@ -181,20 +181,23 @@ static const struct drm_display_mode lh546wf1_ed01_mode = {static int sw43408_get_modes (struct drm_panel *panel,struct drm_connector *connector) {return drm_connector_helper_get_modes_fixed (connector, &lh546wf1_ed01_mode); }static int sw43408_backlight_update_status (struct backlight_device *bl) { -struct mipi_dsi_device *dsi =bl_get_data (bl); +struct sw43408_panel *ctx =bl_get_data (bl);u16 brightness =backlight_get_brightness (bl); -return mipi_dsi_dcs_set_display_brightness_large (dsi, brightness); +if (!ctx->base.prepared) +return 0 ; + +return mipi_dsi_dcs_set_display_brightness_large (ctx->link, brightness); }static const struct backlight_ops sw43408_backlight_ops = { .update_status = sw43408_backlight_update_status, };static int sw43408_backlight_init (struct sw43408_panel *ctx) {@@ -202,17 +205,17 @@ static int sw43408_backlight_init(struct sw43408_panel *ctx)const struct backlight_properties props = { .type =BACKLIGHT_PLATFORM , .brightness =255 ,/* HBM can go up to 1023, stay safe for now */ .max_brightness =900 , }; ctx->base.backlight = devm_backlight_device_register(dev, dev_name(dev), dev,
drivers/gpu/drm/panel/panel-lg-sw43408.c static int sw43408_backlight_init(struct sw43408_panel *ctx) · line 221
Quoted 10 lines
drivers/gpu/drm/panel/panel-lg-sw43408.c +1
-1- ctx->link, + ctx, &sw43408_backlight_ops, &props);if (IS_ERR (ctx->base.backlight))return dev_err_probe (dev,PTR_ERR (ctx->base.backlight),"Failed to create backlight\n" );return 0 ;
Thanks,
Neil
PATCH v3 3/5 drm/panel: lg-sw43408: split enable/disable from prepare/unprepare
In reply to David HeidelbergSeparate display blanking (enable/disable) from panel power sequencing (prepare/unprepare), matching DRM panel conventions and other SDM845 AMOLED panel drivers:
- Move MIPI_DCS_SET_DISPLAY_OFF, MIPI_DCS_ENTER_SLEEP_MODE, and the 100 ms sleep into sw43408_disable(), leaving sw43408_unprepare() to handle panel power-down.
- Move MIPI_DCS_SET_DISPLAY_ON and the 50 ms delay into sw43408_enable().
--- drivers/gpu/drm/panel/panel-lg-sw43408.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-)
drivers/gpu/drm/panel/panel-lg-sw43408.c +23 -9
@@ -38,33 +38,38 @@ struct sw43408_panel {struct drm_dsc_config dsc; };static inline struct sw43408_panel *to_panel_info (struct drm_panel *panel) { return container_of(panel, struct sw43408_panel, base); } -static int sw43408_unprepare (struct drm_panel *panel) +static int sw43408_disable (struct drm_panel *panel) {struct sw43408_panel *sw43408 =to_panel_info (panel);struct mipi_dsi_multi_context ctx = { .dsi = sw43408->link }; -int ret;mipi_dsi_dcs_set_display_off_multi (&ctx);mipi_dsi_dcs_enter_sleep_mode_multi (&ctx);mipi_dsi_msleep (&ctx,100 ); -gpiod_set_value (sw43408->reset_gpio,1 ); +return ctx.accum_err; +} + +static int sw43408_unprepare (struct drm_panel *panel) +{ +struct sw43408_panel *sw43408 =to_panel_info (panel); - ret =regulator_bulk_disable (ARRAY_SIZE (sw43408_supplies), sw43408->supplies); +gpiod_set_value (sw43408->reset_gpio,1 ); -return ret ? : ctx.accum_err; +return regulator_bulk_disable (ARRAY_SIZE (sw43408_supplies), + sw43408->supplies); }static int sw43408_program (struct drm_panel *panel) {struct sw43408_panel *sw43408 =to_panel_info (panel);struct mipi_dsi_multi_context ctx = { .dsi = sw43408->link };struct drm_dsc_picture_parameter_set pps;
@@ -97,20 +102,16 @@ static int sw43408_program(struct drm_panel *panel)0x00 ,0x00 ,0x00 ,0x19 ,0x19 ,0x19 ,0x19 ,0x19 ,0x19 ,0x19 ,0x19 ,0x19 ,0x19 ,0x19 ,0x19 ,0x19 , 0x16, 0x16);mipi_dsi_dcs_write_seq_multi (&ctx,0xcb ,0x80 ,0x5c ,0x07 ,0x03 ,0x28 );mipi_dsi_dcs_write_seq_multi (&ctx,0xc0 ,0x02 ,0x02 ,0x0f );mipi_dsi_dcs_write_seq_multi (&ctx,0x55 ,0x04 ,0x61 ,0xdb ,0x04 ,0x70 ,0xdb );mipi_dsi_dcs_write_seq_multi (&ctx,0xb0 ,0xca ); -mipi_dsi_dcs_set_display_on_multi (&ctx); - -mipi_dsi_msleep (&ctx,50 ); - sw43408->link->mode_flags &= ~MIPI_DSI_MODE_LPM ;drm_dsc_pps_payload_pack (&pps, sw43408->link->dsc);mipi_dsi_picture_parameter_set_multi (&ctx, &pps); sw43408->link->mode_flags |=MIPI_DSI_MODE_LPM ;
@@ -119,16 +120,27 @@ static int sw43408_program(struct drm_panel *panel)* PPS 1 if pps_identifier is 0 * PPS 2 if pps_identifier is 1 */ mipi_dsi_compression_mode_ext_multi (&ctx, true,MIPI_DSI_COMPRESSION_DSC ,1 );return ctx.accum_err; } +static int sw43408_enable (struct drm_panel *panel) +{ +struct sw43408_panel *sw43408 =to_panel_info (panel); +struct mipi_dsi_multi_context ctx = { .dsi = sw43408->link }; + +mipi_dsi_dcs_set_display_on_multi (&ctx); +mipi_dsi_msleep (&ctx,50 ); + +return ctx.accum_err; +} +static void sw43408_reset (struct sw43408_panel *ctx) {gpiod_set_value (ctx->reset_gpio,0 );usleep_range (9000 ,10000 );gpiod_set_value (ctx->reset_gpio,1 );usleep_range (1000 ,2000 );gpiod_set_value (ctx->reset_gpio,0 );usleep_range (9000 ,10000 );
@@ -217,18 +229,20 @@ static int sw43408_backlight_init(struct sw43408_panel *ctx)if (IS_ERR (ctx->base.backlight))return dev_err_probe (dev,PTR_ERR (ctx->base.backlight),"Failed to create backlight\n" );return 0 ; }static const struct drm_panel_funcs sw43408_funcs = { + .disable = sw43408_disable, .unprepare = sw43408_unprepare, .prepare = sw43408_prepare, + .enable = sw43408_enable, .get_modes = sw43408_get_modes, };static const struct of_device_id sw43408_of_match[] = { { .compatible ="lg,sw43408" , },/* legacy */ { .compatible ="lg,sw43408-lh546wf1-ed01" , }, {/* sentinel */ } };
Signature · 1 line
2.55.0
Re: [PATCH v3 3/5] drm/panel: lg-sw43408: split enable/disable from prepare/unprepare
Quoted 125 lines · On 11/25/26 14:08, David Heidelberg via B4 Relay wrote:
From: David Heidelberg <[email protected]>
Separate display blanking (enable/disable) from panel power sequencing (prepare/unprepare), matching DRM panel conventions and other SDM845 AMOLED panel drivers:
- Move
MIPI_DCS_SET_DISPLAY_OFF,MIPI_DCS_ENTER_SLEEP_MODE, and the 100 ms sleep intosw43408_disable(), leavingsw43408_unprepare()to handle panel power-down.
- MoveMIPI_DCS_SET_DISPLAY_ONand the 50 ms delay intosw43408_enable().Signed-off-by David Heidelberg <[email protected]>--- drivers/gpu/drm/panel/panel-lg-sw43408.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-)drivers/gpu/drm/panel/panel-lg-sw43408.c +22
-9@@ -38,33 +38,38 @@ struct sw43408_panel {struct drm_dsc_config dsc; };static inline struct sw43408_panel *to_panel_info (struct drm_panel *panel) { return container_of(panel, struct sw43408_panel, base); } -static int sw43408_unprepare (struct drm_panel *panel) +static int sw43408_disable (struct drm_panel *panel) {struct sw43408_panel *sw43408 =to_panel_info (panel);struct mipi_dsi_multi_context ctx = { .dsi = sw43408->link }; -int ret;mipi_dsi_dcs_set_display_off_multi (&ctx);mipi_dsi_dcs_enter_sleep_mode_multi (&ctx);mipi_dsi_msleep (&ctx,100 ); -gpiod_set_value (sw43408->reset_gpio,1 ); +return ctx.accum_err; +} + +static int sw43408_unprepare (struct drm_panel *panel) +{ +struct sw43408_panel *sw43408 =to_panel_info (panel); - ret =regulator_bulk_disable (ARRAY_SIZE (sw43408_supplies), sw43408->supplies); +gpiod_set_value (sw43408->reset_gpio,1 ); -return ret ? : ctx.accum_err; +return regulator_bulk_disable (ARRAY_SIZE (sw43408_supplies), + sw43408->supplies); }static int sw43408_program (struct drm_panel *panel) {struct sw43408_panel *sw43408 =to_panel_info (panel);struct mipi_dsi_multi_context ctx = { .dsi = sw43408->link };struct drm_dsc_picture_parameter_set pps;@@ -97,20 +102,16 @@ static int sw43408_program(struct drm_panel *panel)0x00 ,0x00 ,0x00 ,0x19 ,0x19 ,0x19 ,0x19 ,0x19 ,0x19 ,0x19 ,0x19 ,0x19 ,0x19 ,0x19 ,0x19 ,0x19 , 0x16, 0x16);mipi_dsi_dcs_write_seq_multi (&ctx,0xcb ,0x80 ,0x5c ,0x07 ,0x03 ,0x28 );mipi_dsi_dcs_write_seq_multi (&ctx,0xc0 ,0x02 ,0x02 ,0x0f );mipi_dsi_dcs_write_seq_multi (&ctx,0x55 ,0x04 ,0x61 ,0xdb ,0x04 ,0x70 ,0xdb );mipi_dsi_dcs_write_seq_multi (&ctx,0xb0 ,0xca ); -mipi_dsi_dcs_set_display_on_multi (&ctx); - -mipi_dsi_msleep (&ctx,50 ); - sw43408->link->mode_flags &= ~MIPI_DSI_MODE_LPM ;drm_dsc_pps_payload_pack (&pps, sw43408->link->dsc);mipi_dsi_picture_parameter_set_multi (&ctx, &pps); sw43408->link->mode_flags |=MIPI_DSI_MODE_LPM ;@@ -119,16 +120,27 @@ static int sw43408_program(struct drm_panel *panel)* PPS 1 if pps_identifier is 0 * PPS 2 if pps_identifier is 1 */ mipi_dsi_compression_mode_ext_multi (&ctx, true,MIPI_DSI_COMPRESSION_DSC ,1 );return ctx.accum_err; } +static int sw43408_enable (struct drm_panel *panel) +{ +struct sw43408_panel *sw43408 =to_panel_info (panel); +struct mipi_dsi_multi_context ctx = { .dsi = sw43408->link }; + +mipi_dsi_dcs_set_display_on_multi (&ctx); +mipi_dsi_msleep (&ctx,50 ); + +return ctx.accum_err; +} +static void sw43408_reset (struct sw43408_panel *ctx) {gpiod_set_value (ctx->reset_gpio,0 );usleep_range (9000 ,10000 );gpiod_set_value (ctx->reset_gpio,1 );usleep_range (1000 ,2000 );gpiod_set_value (ctx->reset_gpio,0 );usleep_range (9000 ,10000 );@@ -217,18 +229,20 @@ static int sw43408_backlight_init(struct sw43408_panel *ctx)if (IS_ERR (ctx->base.backlight))return dev_err_probe (dev,PTR_ERR (ctx->base.backlight),"Failed to create backlight\n" );return 0 ; }static const struct drm_panel_funcs sw43408_funcs = { + .disable = sw43408_disable, .unprepare = sw43408_unprepare,
drivers/gpu/drm/panel/panel-lg-sw43408.c static int sw43408_backlight_init(struct sw43408_panel *ctx) · line 248
Quoted 10 lines
drivers/gpu/drm/panel/panel-lg-sw43408.c +1
-0.prepare = sw43408_prepare, + .enable = sw43408_enable, .get_modes = sw43408_get_modes, };static const struct of_device_id sw43408_of_match[] = { { .compatible ="lg,sw43408" , },/* legacy */ { .compatible ="lg,sw43408-lh546wf1-ed01" , }, {/* sentinel */ } };
Thanks,
Neil
PATCH v3 4/5 drm/panel: lg-sw43408: keep VPNL paired with VDDI and reset deasserted
In reply to David HeidelbergOn Google Pixel 3, VDDI (1.8 V) is shared with the STM FTS5 touchscreen and remains powered while the system is awake or when double-tap wakeup is armed, whereas VPNL (3.0 V) is exclusive to the panel.
Hardware testing on Pixel 3 shows the SW43408 DDIC only recovers cleanly across unprepare/prepare when VDDI and VPNL stay paired and reset is not held asserted while VDDI is powered:
- VDDI ON, VPNL ON, reset HIGH (Sleep-In): recovers cleanly.
- VDDI OFF, VPNL OFF, reset HIGH (cold POR): recovers cleanly.
- VDDI ON, VPNL OFF (with reset either HIGH or LOW): panel stays black on the next prepare even though DCS commands, TE, and LAB/IBB report normal status, until a full VDDI power cycle occurs.
- VDDI ON, VPNL ON, reset LOW: panel stays black on the next prepare.
Stop asserting reset_gpio in sw43408_unprepare() and sw43408_prepare()'s poweroff error path, and disable VDDI first in sw43408_power_off(). Only disable VPNL once VDDI actually powered down, checking both immediately in sw43408_power_off() and from a late system sleep callback in case a shared consumer drops VDDI later during system suspend.
Track whether the driver still holds VPNL enabled so sw43408_prepare() balances the enable count without glitching VPNL, and register a devm cleanup action to release VPNL if the driver is removed while unprepared.
--- drivers/gpu/drm/panel/panel-lg-sw43408.c | 119 +++++++++++++++++++++++++++---- 1 file changed, 107 insertions(+), 12 deletions(-)
drivers/gpu/drm/panel/panel-lg-sw43408.c +107 -12
@@ -15,28 +15,38 @@#include <video/mipi_display.h> #include <drm/drm_mipi_dsi.h> #include <drm/drm_panel.h> #include <drm/drm_probe_helper.h> #include <drm/display/drm_dsc.h> #include <drm/display/drm_dsc_helper.h> +enum { +SW43408_SUPPLY_VDDI , +SW43408_SUPPLY_VPNL , +}; +static const struct regulator_bulk_data sw43408_supplies[] = { - { .supply ="vddi" ,/* 1.8 V */ - .init_load_uA =62000 }, - { .supply ="vpnl" ,/* 3.0 V */ - .init_load_uA =857000 }, + [SW43408_SUPPLY_VDDI ] = { + .supply ="vddi" ,/* 1.8 V */ + .init_load_uA =62000 , + }, + [SW43408_SUPPLY_VPNL ] = { + .supply ="vpnl" ,/* 3.0 V */ + .init_load_uA =857000 , + }, };struct sw43408_panel {struct drm_panel base;struct mipi_dsi_device *link;struct regulator_bulk_data *supplies; +bool vpnl_enabled;struct gpio_desc *reset_gpio;struct drm_dsc_config dsc; };static inline struct sw43408_panel *to_panel_info (struct drm_panel *panel) {
@@ -52,24 +62,90 @@ static int sw43408_disable(struct drm_panel *panel)mipi_dsi_dcs_enter_sleep_mode_multi (&ctx);mipi_dsi_msleep (&ctx,100 );return ctx.accum_err; } -static int sw43408_unprepare (struct drm_panel *panel) +static int sw43408_maybe_disable_vpnl (struct sw43408_panel *ctx) { -struct sw43408_panel *sw43408 =to_panel_info (panel); +struct regulator *vddi = ctx->supplies[SW43408_SUPPLY_VDDI ].consumer; +struct regulator *vpnl = ctx->supplies[SW43408_SUPPLY_VPNL ].consumer; + +/* +* On Pixel 3, vddi is shared with the touchscreen and remains +* powered while awake or when touch wakeup is armed. Dropping vpnl +* (3.0 V) or asserting reset while vddi (1.8 V) stays powered leaves +* the DDIC in a state no init sequence recovers from (until a full +* vddi power cycle): it answers DCS commands and reports display-on, +* but never lights up again. +*/ +if (ctx->vpnl_enabled &®ulator_is_enabled (vddi) ==0 ) { +int ret =regulator_disable (vpnl); -gpiod_set_value (sw43408->reset_gpio,1 ); +if (ret <0 ) +return ret; + + ctx->vpnl_enabled = false; + } -return regulator_bulk_disable (ARRAY_SIZE (sw43408_supplies), - sw43408->supplies); +return 0 ; +} + +static int sw43408_power_off (struct sw43408_panel *ctx) +{ +struct regulator *vddi = ctx->supplies[SW43408_SUPPLY_VDDI ].consumer; +int ret; + + ret =regulator_disable (vddi); +if (ret) +return ret; + + ret =sw43408_maybe_disable_vpnl (ctx); +if (ret) + goto recover_vddi; + +return 0 ; + +recover_vddi: +/* vpnl disable failed, thus we need to re-enable vddi */ + (void )regulator_enable (vddi); +return ret; +} + +static int sw43408_suspend_late (struct device *dev) +{ +struct sw43408_panel *ctx =dev_get_drvdata (dev); +int ret; + +if (ctx->base.prepared) +return 0 ; + + ret =sw43408_maybe_disable_vpnl (ctx); +if (ret) +return ret; + +return 0 ; +} + +static void sw43408_cleanup_vpnl (void *data) +{ +struct sw43408_panel *ctx = data; + +if (ctx->vpnl_enabled) { +regulator_disable (ctx->supplies[SW43408_SUPPLY_VPNL ].consumer); + ctx->vpnl_enabled = false; + } +} + +static int sw43408_unprepare (struct drm_panel *panel) +{ +return sw43408_power_off (to_panel_info (panel)); }static int sw43408_program (struct drm_panel *panel) {struct sw43408_panel *sw43408 =to_panel_info (panel);struct mipi_dsi_multi_context ctx = { .dsi = sw43408->link };struct drm_dsc_picture_parameter_set pps;
@@ -144,35 +220,45 @@ static void sw43408_reset(struct sw43408_panel *ctx)usleep_range (1000 ,2000 );gpiod_set_value (ctx->reset_gpio,0 );usleep_range (9000 ,10000 ); }static int sw43408_prepare (struct drm_panel *panel) {struct sw43408_panel *ctx =to_panel_info (panel); +struct regulator *vddi = ctx->supplies[SW43408_SUPPLY_VDDI ].consumer; +struct regulator *vpnl = ctx->supplies[SW43408_SUPPLY_VPNL ].consumer;int ret; - ret =regulator_bulk_enable (ARRAY_SIZE (sw43408_supplies), ctx->supplies); + ret =regulator_enable (vddi);if (ret <0 )return ret; +if (!ctx->vpnl_enabled) { + ret =regulator_enable (vpnl); +if (ret <0 ) { +regulator_disable (vddi); +return ret; + } + ctx->vpnl_enabled = true; + } +usleep_range (5000 ,6000 );sw43408_reset (ctx); ret =sw43408_program (panel);if (ret) goto poweroff;return 0 ; poweroff: -gpiod_set_value (ctx->reset_gpio,1 ); -regulator_bulk_disable (ARRAY_SIZE (sw43408_supplies), ctx->supplies); +sw43408_power_off (ctx);return ret; }static const struct drm_display_mode lh546wf1_ed01_mode = { .clock = (1080 +20 +32 +20 ) * (2160 +20 +4 +20 ) *60 /1000 , .hdisplay =1080 , .hsync_start =1080 +20 ,
@@ -255,16 +341,20 @@ static int sw43408_add(struct sw43408_panel *ctx) ret =devm_regulator_bulk_get_const (dev,ARRAY_SIZE (sw43408_supplies), sw43408_supplies, &ctx->supplies);if (ret <0 )return ret; + ret =devm_add_action_or_reset (dev, sw43408_cleanup_vpnl, ctx); +if (ret <0 ) +return ret; + ctx->reset_gpio =devm_gpiod_get (dev,"reset" ,GPIOD_OUT_LOW );if (IS_ERR (ctx->reset_gpio)) {return dev_err_probe (dev,PTR_ERR (ctx->reset_gpio),"Failed to get reset-gpios\n" ); } ret =sw43408_backlight_init (ctx);if (ret <0 )
@@ -313,20 +403,25 @@ static int sw43408_probe(struct mipi_dsi_device *dsi) ctx->dsc.bits_per_pixel =8 <<4 ; ctx->dsc.block_pred_enable = true; dsi->dsc = &ctx->dsc;return devm_mipi_dsi_attach (&dsi->dev, dsi); } +static const struct dev_pm_ops sw43408_pm_ops = { +LATE_SYSTEM_SLEEP_PM_OPS (sw43408_suspend_late,NULL ) +}; +static struct mipi_dsi_driver sw43408_driver = { .driver = { .name ="panel-lg-sw43408" , .of_match_table = sw43408_of_match, + .pm =pm_sleep_ptr (&sw43408_pm_ops), }, .probe = sw43408_probe, };module_mipi_dsi_driver (sw43408_driver);MODULE_AUTHOR ("Sumit Semwal <[email protected]>" );MODULE_DESCRIPTION ("LG SW436408 MIPI-DSI LED panel" );MODULE_LICENSE ("GPL" );
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH v3 4/5] drm/panel: lg-sw43408: keep VPNL paired with VDDI and reset deasserted
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] drm/panel: lg-sw43408: missing resume callback in sw43408_pm_ops --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [High] drm/panel: lg-sw43408: missing resume callback in sw43408_pm_ops
--
commit 503ce47692b3c0852447cd397b0dd17406adf4a7
Author: David Heidelberg <[email protected]>
drm/panel: lg-sw43408: keep VPNL paired with VDDI and reset deasserted
This commit leaves reset_gpio deasserted across unprepare and keeps VPNL enabled until VDDI is fully powered down, checking VDDI both in sw43408_power_off() and from a late system sleep callback.
Quoted 4 lines
drivers/gpu/drm/panel/panel-lg-sw43408.c +0
-0
[ ... ]
Quoted 1 line
drivers/gpu/drm/panel/panel-lg-sw43408.c +0
-0@@ -57,14 +67,80 @@ static int sw43408_disable(struct drm_panel *panel)
[ ... ]
Quoted 14 lines
drivers/gpu/drm/panel/panel-lg-sw43408.c +14
-0+static int sw43408_suspend_late (struct device *dev) +{ +struct sw43408_panel *ctx =dev_get_drvdata (dev); +int ret; + +if (ctx->base.prepared) +return 0 ; + + ret =sw43408_maybe_disable_vpnl (ctx); +if (ret) +return ret; + +return 0 ; +}
[ ... ]
drivers/gpu/drm/panel/panel-lg-sw43408.c static int sw43408_probe(struct mipi_dsi_device *dsi) · line 413
Quoted 7 lines
drivers/gpu/drm/panel/panel-lg-sw43408.c +3
-0@@ -318,10 +408,15 @@ static int sw43408_probe(struct mipi_dsi_device *dsi)return devm_mipi_dsi_attach (&dsi->dev, dsi); } +static const struct dev_pm_ops sw43408_pm_ops = { +LATE_SYSTEM_SLEEP_PM_OPS (sw43408_suspend_late,NULL ) +};
[Severity: High]
Does sw43408_pm_ops also need an early resume callback to re-enable vpnl when vddi turns back on during system resume?
During system suspend, DRM unprepares the panel in .prepare (dpu_pm_ops.prepare -> msm_kms_pm_prepare()), stmfts_suspend() drops the touchscreen's vddi vote in .suspend, and sw43408_suspend_late() then sees regulator_is_enabled(vddi) == 0 and disables vpnl.
On resume, stmfts_resume() unconditionally re-enables vddi during the .resume phase, while DRM does not resume the panel until .complete (or not at all during resume if the display was blanked before suspend). That leaves the panel in the vddi-on, vpnl-off state across .resume, and when sw43408_prepare() later runs, vddi is already held enabled by stmfts so regulator_enable(vddi) does not power-cycle vddi to recover the DDIC.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
Re: [PATCH v3 4/5] drm/panel: lg-sw43408: keep VPNL paired with VDDI and reset deasserted
On 25/11/2026 14:19, [email protected] wrote:
[...]
Quoted 13 lines
drivers/gpu/drm/panel/panel-lg-sw43408.c static int sw43408_probe(struct mipi_dsi_device *dsi) · line 413
Quoted 3 lines
drivers/gpu/drm/panel/panel-lg-sw43408.c +3
-0+static const struct dev_pm_ops sw43408_pm_ops = { +LATE_SYSTEM_SLEEP_PM_OPS (sw43408_suspend_late,NULL ) +};[Severity: High]
Doessw43408_pm_opsalso need an early resume callback to re-enable vpnl when vddi turns back on during system resume?During system suspend, DRM unprepares the panel in .prepare (dpu_pm_ops.prepare ->
msm_kms_pm_prepare()),stmfts_suspend()drops the touchscreen's vddi vote in .suspend, andsw43408_suspend_late()then seesregulator_is_enabled(vddi)== 0 and disables vpnl.
Quoted 7 lines
On resume,
stmfts_resume()unconditionally re-enables vddi during the .resume phase, while DRM does not resume the panel until .complete (or not at all during resume if the display was blanked before suspend). That leaves the panel in the vddi-on, vpnl-off state across .resume, and whensw43408_prepare()later runs, vddi is already held enabled by stmfts soregulator_enable(vddi)does not power-cycle vddi to recover the DDIC.
Since I noticed you reviewing this series, I'm looking at the Sashiko right now, it's little bit harder to comprehend, but trying to figure out best solution.
From the actual testing the configuration works well as is, but LLM offers some solutions which I'm not understanding fully yet:
1. Track vddi via devm_regulator_register_notifier() + work_struct
2. Add .complete callback
3. it's harmless, ignore it.
From my testing I don't see any problems, so I would love to easily say it's harmless (e.g. 3.), but I'll try to figure out if 1. or 2. would be more sense.
David
Re: [PATCH v3 4/5] drm/panel: lg-sw43408: keep VPNL paired with VDDI and reset deasserted
In reply to [email protected]On 25/11/2026 14:19, [email protected] wrote:
[...]
Quoted 13 lines
drivers/gpu/drm/panel/panel-lg-sw43408.c static int sw43408_probe(struct mipi_dsi_device *dsi) · line 413
Quoted 3 lines
drivers/gpu/drm/panel/panel-lg-sw43408.c +3
-0+static const struct dev_pm_ops sw43408_pm_ops = { +LATE_SYSTEM_SLEEP_PM_OPS (sw43408_suspend_late,NULL ) +};[Severity: High]
Doessw43408_pm_opsalso need an early resume callback to re-enable vpnl when vddi turns back on during system resume?During system suspend, DRM unprepares the panel in .prepare (dpu_pm_ops.prepare ->
msm_kms_pm_prepare()),stmfts_suspend()drops the touchscreen's vddi vote in .suspend, andsw43408_suspend_late()then seesregulator_is_enabled(vddi)== 0 and disables vpnl.
Quoted 7 lines
On resume,
stmfts_resume()unconditionally re-enables vddi during the .resume phase, while DRM does not resume the panel until .complete (or not at all during resume if the display was blanked before suspend). That leaves the panel in the vddi-on, vpnl-off state across .resume, and whensw43408_prepare()later runs, vddi is already held enabled by stmfts soregulator_enable(vddi)does not power-cycle vddi to recover the DDIC.
I ran automated stress testing for all states, and it seems it's necessary here. Report below the line.
From maintainer point view, if there would be need to make it bulletproof I can explore Option 1/2 to address it, but hardware-wise it seems to be not required.
I can send v4 with more verbose explanation within the commit msg / code, if needed.
David
---
Good catch to check the resume path, but hardware testing on Pixel 3 shows no resume callback is needed here.
The non-recoverable DDIC state occurs when vpnl is dropped while vddi remains powered ((VDDI=ON, VPNL=ON) -> (VDDI=ON, VPNL=OFF)), not when powering up from a cold both-rails-off state with vddi rising ahead of vpnl.
I explicitly tested the exact rail sequence on Pixel 3:
1. Both vddi (ldo14) and vpnl (ldo28) off, reset deasserted (the state left by sw43408_suspend_late()).
2. Re-enabled vddi alone via stmfts while vpnl remained off, and held (VDDI=ON, VPNL=OFF, reset=HIGH) for 6 seconds.
3. Ran sw43408_prepare() with vddi still continuously held on by stmfts (no vddi power cycle).
The panel recovered cleanly and lit up normally.
Also note that an early resume callback (.resume_early) would run before stmfts_resume() re-enables vddi, so enabling vpnl there would either see regulator_is_enabled(vddi) == 0 (no-op) or unconditionally power up 3.0 V vpnl before 1.8 V vddi (reversing the power-on sequence and leaving vpnl enabled when no shared consumer brings vddi up).
PATCH v3 5/5 arm64: dts: qcom: sdm845-google: drop panel regulator-always-on
In reply to David HeidelbergDrop the regulator-always-on workaround from vreg_l14a_1p8 (vddi) and vreg_l28a_3p0 (vpnl/vci) now that the LG SW43408 panel driver keeps vpnl paired with vddi, allowing both rails to power down on Pixel 3 when neither the panel nor the touchscreen requires vddi.
Define the supplies on Pixel 3 XL's framebuffer0 node so simpledrm keeps the panel powered once regulator late cleanup runs, while intentionally leaving them off Pixel 3's framebuffer0 node so simpledrm handover does not drop vpnl independently of vddi.
--- arch/arm64/boot/dts/qcom/sdm845-google-blueline.dts | 2 ++ arch/arm64/boot/dts/qcom/sdm845-google-common.dtsi | 10 ---------- arch/arm64/boot/dts/qcom/sdm845-google-crosshatch.dts | 3 +++ 3 files changed, 5 insertions(+), 10 deletions(-)
arch/arm64/boot/dts/qcom/sdm845-google-blueline.dts +2 -0
@@ -14,16 +14,18 @@ &battery { voltage-min-design-microvolt = <3600000>; voltage-max-design-microvolt = <4400000>; }; &framebuffer0 { width = <1080>; height = <2160>; stride = <(1080 * 4)>; + + /* intentionally no supplies here, see the LG SW43408 driver */ }; &i2c2 { clock-frequency = <1000000>; status = "okay"; /* ST,FTS @ 49 */
arch/arm64/boot/dts/qcom/sdm845-google-common.dtsi +0 -10
@@ -246,21 +246,16 @@ vreg_l13a_2p95: ldo13 { regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; }; vreg_l14a_1p8: ldo14 { regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>; regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; regulator-boot-on; - /* - * We can't properly bring the panel back if it gets turned off - * so keep it's regulators always on for now. - */ - regulator-always-on; }; vreg_l17a_1p3: ldo17 { regulator-min-microvolt = <1304000>; regulator-max-microvolt = <1304000>; regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; };
@@ -308,21 +303,16 @@ vreg_l26a_1p2: ldo26 { regulator-boot-on; }; vreg_l28a_3p0: ldo28 { regulator-min-microvolt = <2856000>; regulator-max-microvolt = <3008000>; regulator-initial-mode = <RPMH_REGULATOR_MODE_LPM>; regulator-boot-on; - /* - * We can't properly bring the panel back if it gets turned off - * so keep it's regulators always on for now. - */ - regulator-always-on; }; }; regulators-1 { compatible = "qcom,pmi8998-rpmh-regulators"; qcom,pmic-id = "b"; vdd-bob-supply = <&vph_pwr>;
arch/arm64/boot/dts/qcom/sdm845-google-crosshatch.dts +3 -0
@@ -19,16 +19,19 @@ &dispcc { /* Disable for now so simple-framebuffer continues working */ status = "disabled"; }; &framebuffer0 { width = <1440>; height = <2960>; stride = <(1440 * 4)>; + + vddi-supply = <&vreg_l14a_1p8>; + vci-supply = <&vreg_l28a_3p0>; }; &mdss { /* Disable for now so simple-framebuffer continues working */ status = "disabled"; }; &wifi {
Signature · 1 line
2.55.0