All of lore.kernel.org
 help / color / mirror / Atom feed
From: chitranshmandhaniya@gmail.com
To: hansg@kernel.org, ilpo.jarvinen@linux.intel.com
Cc: platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org, Chitransh_Mandhaniya@dell.com
Subject: [PATCH v3 0/2] platform/x86: dell-uart-backlight: stray byte recovery and cleanup
Date: Fri, 16 Oct 2026 15:03:00 +0530	[thread overview]
Message-ID: <20261016093302.55528-1-chitranshmandhaniya@gmail.com> (raw)
In-Reply-To: <20261004110333.5790-1-chitranshmandhaniya@gmail.com>

From: Chitransh Mandhaniya <Chitransh_Mandhaniya@dell.com>

On some Dell AIO machines the EC occasionally inserts a spurious byte
after the cmd-echo in UART backlight response frames, causing checksum
mismatches and -EIO.

Patch 1 extracts the response parsing into a dell_uart_bl_receive_data()
helper that always returns bytes consumed. The caller checks
dell_bl->status to determine the outcome (-EBUSY = incomplete, 0 =
success, -EIO = error).

Patch 2 adds the stray byte recovery: on checksum mismatch for a fully
received frame, drop the byte at the first payload position, shift data
down, and call the helper again to re-fetch the checksum byte. Total
consumed bytes are tracked and returned to serdev exactly.  Also
switches mutex_init() to devm_mutex_init() to fix a missing
mutex_destroy() on the teardown path (noted by Ilpo during v2 review).

v2 -> v3:
  - Helper always returns bytes consumed, caller checks
    dell_bl->status instead (Ilpo)
  - Track total consumed bytes with a separate variable instead of
    returning len, so serdev gets the exact byte count (Ilpo)
  - Guard resync with resp_idx == resp_len to prevent memmove on
    truncated/out-of-range length field (sashiko.dev via Ilpo)
  - Switch mutex_init() to devm_mutex_init() in patch 2 (Ilpo)

v1 -> v2:
  - Extract dell_uart_bl_receive_data() helper instead of using a
    for-loop with pass counter, call it again after resync (Ilpo)
  - Split into two patches: refactor + feature (Ilpo)

Chitransh Mandhaniya (2):
  platform/x86: dell-uart-backlight: extract dell_uart_bl_receive_data()
    helper
  platform/x86: dell-uart-backlight: recover from stray EC response byte

 .../platform/x86/dell/dell-uart-backlight.c   | 71 ++++++++++++++-----
 1 file changed, 55 insertions(+), 16 deletions(-)

-- 
2.43.0


  parent reply	other threads:[~2026-10-16  9:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-04 11:03 [PATCH] platform/x86: dell-uart-backlight: recover from stray EC response byte chitranshmandhaniya
2026-10-14 11:50 ` Ilpo Järvinen
2026-10-15  7:43 ` [PATCH v2 0/2] " chitranshmandhaniya
2026-10-15  7:43   ` [PATCH v2 1/2] platform/x86: dell-uart-backlight: extract dell_uart_bl_receive_data() helper chitranshmandhaniya
2026-10-15  7:43   ` [PATCH v2 2/2] platform/x86: dell-uart-backlight: recover from stray EC response byte chitranshmandhaniya
2026-10-15 10:12     ` Ilpo Järvinen
2026-10-15 10:24     ` Ilpo Järvinen
2026-10-16  9:33 ` chitranshmandhaniya [this message]
2026-10-16  9:33   ` [PATCH v3 1/2] platform/x86: dell-uart-backlight: extract chitranshmandhaniya
2026-10-16  9:33   ` [PATCH v3 2/2] platform/x86: dell-uart-backlight: recover from stray chitranshmandhaniya
2026-10-16 10:07     ` Ilpo Järvinen
2026-10-17  7:37 ` [PATCH v4 0/2] platform/x86: dell-uart-backlight: handle stray EC byte in responses chitranshmandhaniya
2026-10-17  7:37   ` [PATCH v4 1/2] platform/x86: dell-uart-backlight: extract dell_uart_bl_receive_data() helper chitranshmandhaniya
2026-10-17  7:37   ` [PATCH v4 2/2] platform/x86: dell-uart-backlight: recover from stray EC response byte chitranshmandhaniya

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=20261016093302.55528-1-chitranshmandhaniya@gmail.com \
    --to=chitranshmandhaniya@gmail.com \
    --cc=Chitransh_Mandhaniya@dell.com \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.