Linux Input/HID development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: rofikkerneldev <rofikcoga@gmail.com>
Cc: devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-input@vger.kernel.org, robh@kernel.org,
	conor+dt@kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v1 05/11] drm/panel: add LG SW43103 panel driver
Date: Tue, 17 Nov 2026 13:04:19 +0000	[thread overview]
Message-ID: <sashiko-outbox-218833@kernel.org> (raw)
In-Reply-To: <20261117123946.668557-6-rofikcoga@gmail.com>

Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [High] drm/panel: username handle used instead of real name in DCO and
  authorship
- [Medium] drm/panel: sw43103_remove() calls sw43103_unprepare()
  unconditionally
- [Medium] drm/panel: sw43103: unsynchronized DSI transfers in
  sw43103_backlight_update_status()
- [Low] drm/panel: sw43103_enable() hardcodes full brightness before
  backlight_enable()
--

commit c8fd387b550027d7b2fde8a05702145f363e56ba
Author: rofikkerneldev <rofikcoga@gmail.com>

> drm/panel: add LG SW43103 panel driver
>
> Add support for the 1080x2460 SW43103 AMOLED panel. Handle power and
> reset sequencing, DCS backlight control, and the DSC configuration
> required by the panel.
>
> Signed-off-by: rofikkerneldev <rofikcoga@gmail.com>

[Severity: High]
Under Documentation/process/submitting-patches.rst and the Developer
Certificate of Origin, patches must use a real human name rather than a
username handle (rofikkerneldev) in the commit author, Signed-off-by tag,
maintainer entry, and module author macro.

> diff --git a/drivers/gpu/drm/panel/panel-lg-sw43103.c b/drivers/gpu/drm/panel/panel-lg-sw43103.c
> new file mode 100644
> index 0000000000000..caab54e0d1153
> --- /dev/null
> +++ b/drivers/gpu/drm/panel/panel-lg-sw43103.c
[ ... ]
> +static int sw43103_enable(struct drm_panel *panel)
> +{
> +	struct sw43103_panel *sw43103 = to_panel_info(panel);
> +	struct mipi_dsi_multi_context ctx = { .dsi = sw43103->link };
> +
> +	/* Display On */
> +	mipi_dsi_dcs_set_display_on_multi(&ctx);
> +	mipi_dsi_msleep(&ctx, 20);
> +
> +	/* Enable display backlight control and full brightness */
> +	mipi_dsi_dcs_write_seq_multi(&ctx, MIPI_DCS_WRITE_CONTROL_DISPLAY, 0x2c);
> +	mipi_dsi_dcs_write_seq_multi(&ctx, MIPI_DCS_SET_DISPLAY_BRIGHTNESS, 0x07, 0xff);
> +
> +	return ctx.accum_err;
> +}

[Severity: Low]
Should sw43103_enable() leave brightness programming to the backlight
device?

drm_panel_enable() calls backlight_enable(panel->backlight) right after
panel->funcs->enable(panel), which invokes sw43103_backlight_update_status()
to write the control display register and the configured brightness
(defaulting to 1024).  Hardcoding 0x07ff (2047) here duplicates those
transfers and briefly flashes the panel at maximum brightness whenever the
display is enabled at a lower brightness level.

[ ... ]

> +static int sw43103_backlight_update_status(struct backlight_device *bl)
> +{
> +	struct mipi_dsi_device *dsi = bl_get_data(bl);
> +	u16 brightness = backlight_get_brightness(bl);
> +	u8 ctrl = 0x2c;
> +	int ret;
> +
> +	dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
> +
> +	ret = mipi_dsi_dcs_write(dsi, MIPI_DCS_WRITE_CONTROL_DISPLAY, &ctrl, sizeof(ctrl));
> +	if (ret < 0)
> +		goto out;
> +
> +	ret = mipi_dsi_dcs_set_display_brightness_large(dsi, brightness);
> +
> +out:
> +	dsi->mode_flags |= MIPI_DSI_MODE_LPM;
> +
> +	return ret < 0 ? ret : 0;
> +}

[Severity: Medium]
Can a sysfs brightness write race with panel preparation or issue transfers
while the panel is powered off?

sw43103_backlight_init() registers the backlight device during probe, and
backlight_device_set_brightness() calls sw43103_backlight_update_status()
under only bd->ops_lock and bd->update_lock.  If userspace writes to sysfs
while the panel is unprepared, mipi_dsi_dcs_write() runs while the panel is
in reset or powered down.  If it writes during sw43103_prepare(), it also
races on dsi->mode_flags:

CPU0                              CPU1
sw43103_prepare()
  sw43103_program()
    sw43103_init_sequence()
                                  backlight_device_set_brightness()
                                    sw43103_backlight_update_status()
                                      dsi->mode_flags &= ~...
    mipi_dsi_dcs_write_seq_multi()
      /* sent in high-speed mode instead of low-power mode */

Conversely, restoring the low-power mode flag at the end of
sw43103_backlight_update_status() while sw43103_program() is sending the
picture parameter set forces mipi_dsi_picture_parameter_set_multi() into
low-power mode.

[ ... ]

> +static void sw43103_remove(struct mipi_dsi_device *dsi)
> +{
> +	struct sw43103_panel *ctx = mipi_dsi_get_drvdata(dsi);
> +	int ret;
> +
> +	ret = sw43103_unprepare(&ctx->base);
> +	if (ret < 0)
> +		dev_err(&dsi->dev, "failed to unprepare panel: %d\n", ret);
> +
> +	ret = mipi_dsi_detach(dsi);
> +	if (ret < 0)
> +		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret);
> +
> +	drm_panel_remove(&ctx->base);
> +}

[Severity: Medium]
Does calling sw43103_unprepare() directly in sw43103_remove() underflow the
regulator enable counts?

sw43103_unprepare() unconditionally calls regulator_bulk_disable() without
checking or updating ctx->base.prepared.  If the panel is not prepared when
the driver is unbound, regulator_bulk_disable() triggers an unbalanced
regulator disable warning and returns -EIO; if the panel is prepared,
powering it off before mipi_dsi_detach() and drm_panel_remove() leaves
ctx->base.prepared set, causing modeset teardown to access an unpowered
panel and disable the supplies a second time.  Removing the manual
sw43103_unprepare() call lets the modeset driver tear the panel down
cleanly.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261117123946.668557-1-rofikcoga@gmail.com?part=5

  reply	other threads:[~2026-11-17 13:04 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 12:39 [PATCH v1 00/11] arm64: qcom: Add initial support for LG V60 ThinQ 5G (timelm) rofikkerneldev
2026-11-17 12:39 ` [PATCH v1 01/11] dt-bindings: arm: qcom: add " rofikkerneldev
2026-11-17 12:47   ` sashiko-bot
2026-11-17 12:39 ` [PATCH v1 02/11] arm64: dts: qcom: add LG V60 ThinQ 5G (timelm) support rofikkerneldev
2026-11-17 13:06   ` sashiko-bot
2026-11-17 12:39 ` [PATCH v1 03/11] arm64: dts: qcom: sm8250-lge-timelm: add reserved memory regions rofikkerneldev
2026-11-17 12:57   ` sashiko-bot
2026-11-17 12:39 ` [PATCH v1 04/11] dt-bindings: display: panel: add LG SW43103 rofikkerneldev
2026-11-17 12:51   ` sashiko-bot
2026-11-17 12:39 ` [PATCH v1 05/11] drm/panel: add LG SW43103 panel driver rofikkerneldev
2026-11-17 13:04   ` sashiko-bot [this message]
2026-11-17 12:39 ` [PATCH v1 06/11] dt-bindings: input: touchscreen: add Silicon Works SW42902 rofikkerneldev
2026-11-17 12:51   ` sashiko-bot
2026-11-17 12:39 ` [PATCH v1 07/11] Input: touchscreen: add Silicon Works SW42902 support rofikkerneldev
2026-11-17 13:01   ` sashiko-bot
2026-11-17 12:39 ` [PATCH v1 08/11] arm64: dts: qcom: sm8250-lge-timelm: enable SW43103 panel rofikkerneldev
2026-11-17 13:12   ` sashiko-bot
2026-11-17 12:39 ` [PATCH v1 09/11] arm64: dts: qcom: sm8250-lge-timelm: add SW42902 touchscreen rofikkerneldev
2026-11-17 12:56   ` sashiko-bot
2026-11-17 12:39 ` [PATCH v1 10/11] arm64: dts: qcom: sm8250-lge-timelm: enable USB Type-C rofikkerneldev
2026-11-17 13:12   ` sashiko-bot
2026-11-17 12:39 ` [PATCH v1 11/11] arm64: dts: qcom: sm8250-lge-timelm: add QCA6390 Bluetooth rofikkerneldev
2026-11-17 13:09   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-218833@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-input@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=rofikcoga@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox