mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: chitranshmandhaniya@gmail.com
Cc: hansg@kernel.org, ilpo.jarvinen@linux.intel.com,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org, Chitransh_Mandhaniya@dell.com
Subject: Re: [PATCH v4 2/2] platform/x86: dell-uart-backlight: recover from stray EC response byte
Date: Wed, 11 Nov 2026 11:22:27 +0100	[thread overview]
Message-ID: <avRB4-aNxPc8cRJk@black.igk.intel.com> (raw)
In-Reply-To: <20261017073704.606497-3-chitranshmandhaniya@gmail.com>

On Sat, Oct 17, 2026 at 01:07:04PM +0530, chitranshmandhaniya@gmail.com wrote:
> 
> On some Dell All-in-One machines the EC occasionally inserts a spurious
> byte after the command echo in UART backlight response frames. For
> example a get-brightness reply that should be "04 0c 0a e5" arrives as
> "04 0c 0d 0a e5". The length field still reflects the original frame
> size, so the parser treats the stray byte as payload and the real
> payload as the checksum, producing a spurious -EIO.

This is very good example of the "bad" data. The character I believe is not
spurious at all. This is an UART communication which may be raw or line-based.
If you think of the UART line discipline, then the inserted character makes
a lot of sense, id est \n is replaced by \r\n.

Can you confirm that the only problematic one is 0x0a when we get 0x0d before?
If so, I think the issue can be addressed in a better way.

> Add single-attempt recovery inside dell_uart_bl_receive_data(): on a
> checksum mismatch for a frame longer than the minimum size, drop the
> byte at the first payload offset, shift the remaining data down by one,
> and decrement resp_idx so serdev re-delivers the real checksum byte on
> the next callback. Status remains -EBUSY, so no special handling is
> needed in the caller.
> 
> A per-transaction resync_used flag, cleared at the start of each
> command, limits recovery to one attempt. A second mismatch is a hard
> -EIO. Well-formed frames never enter the recovery path.
> 
> Tested on Dell OptiPlex AIO 7410 65W (board 0TKWC4) where the EC
> inserts a stray byte on every get-brightness response.


-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-11-11 10:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-04 11:03 [PATCH] " 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 ` [PATCH v3 0/2] platform/x86: dell-uart-backlight: stray byte recovery and cleanup chitranshmandhaniya
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
2026-11-11 10:22     ` Andy Shevchenko [this message]
2026-11-09 19:39   ` [PATCH v4 0/2] platform/x86: dell-uart-backlight: handle stray EC byte in responses Ilpo Järvinen

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=avRB4-aNxPc8cRJk@black.igk.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=Chitransh_Mandhaniya@dell.com \
    --cc=chitranshmandhaniya@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®