[PATCH v3 0/2] platform/x86: dell-uart-backlight: stray byte recovery and cleanup
From: chitranshmandhaniya
Date: Fri Oct 16 2026 - 05:41:10 EST
From: Chitransh Mandhaniya <Chitransh_Mandhaniya@xxxxxxxx>
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