From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Gwendal Grignou <gwendal@chromium.org>
Cc: chrome-platform@lists.linux.dev, Gwendal Grignou <gwendal@google.com>
Subject: Re: [PATCH v3 2/2] platform: chrome: lightbar: Add support for large sequence
Date: Wed, 28 Jan 2026 05:10:10 +0000 [thread overview]
Message-ID: <aXmaMhDv5YqVT58s@google.com> (raw)
In-Reply-To: <20260128030259.1703848-2-gwendal@google.com>
On Tue, Jan 27, 2026 at 07:02:59PM -0800, Gwendal Grignou wrote:
> @@ -475,14 +483,22 @@ static ssize_t program_store(struct device *dev, struct device_attribute *attr,
> * and send a program that is too big for the protocol. In order
> * to ensure the latter, we also need to ensure we have extra bytes
> * to represent the rest of the packet.
> + * With V3, larger program can be sent, limited only by the EC.
> + * Only the protocol limit the payload size.
> */
> - extra_bytes = sizeof(*param) - sizeof(param->set_program.data);
> - max_size = min(EC_LB_PROG_LEN, ec->ec_dev->max_request - extra_bytes);
> - if (count > max_size) {
> - dev_err(dev, "Program is %u bytes, too long to send (max: %u)",
> - (unsigned int)count, max_size);
> -
> - return -EINVAL;
> + if (lb_version < 3) {
> + extra_bytes = sizeof(*param) - sizeof(param->set_program.data);
> + max_size = min(EC_LB_PROG_LEN, ec->ec_dev->max_request - extra_bytes);
> + if (count > max_size) {
> + dev_err(dev, "Program is %zu bytes, too long to send (max: %zu)",
> + count, max_size);
> +
> + return -EINVAL;
> + }
> + } else {
> + extra_bytes = sizeof(*param) - sizeof(param->set_program) +
> + sizeof(param->set_program_ex);
> + max_size = ec->ec_dev->max_request - extra_bytes;
Not sure if you read comments from v1 [1]. I still think the calculation of
`extra_bytes` is tricky.
[1] https://lore.kernel.org/chrome-platform/aXhWlV6SyaAAum-Q@google.com/
> diff --git a/include/linux/platform_data/cros_ec_commands.h b/include/linux/platform_data/cros_ec_commands.h
> index 9cbf024f56c3..144243143034 100644
> --- a/include/linux/platform_data/cros_ec_commands.h
> +++ b/include/linux/platform_data/cros_ec_commands.h
> @@ -2020,6 +2020,17 @@ struct lightbar_program {
> uint8_t data[EC_LB_PROG_LEN];
> } __ec_todo_unpacked;
>
> +/*
> + * Lightbar program for large sequences. Sequences are sent in pieces, with
> + * increasing offset. The sequences are still limited by the amount reserved in
> + * EC RAM.
> + */
> +struct lightbar_program_ex {
> + uint16_t offset;
> + uint8_t size;
> + uint8_t data[0];
> +} __ec_todo_unpacked;
Not sure if you read comments from v1 [1]. Please use flexible array member
(i.e., []) and evaluate if it needs any flexible array helpers.
next prev parent reply other threads:[~2026-01-28 5:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-28 3:02 [PATCH v3 1/2] platform: chrome: lightbar: Report number of segments Gwendal Grignou
2026-01-28 3:02 ` [PATCH v3 2/2] platform: chrome: lightbar: Add support for large sequence Gwendal Grignou
2026-01-28 5:10 ` Tzung-Bi Shih [this message]
2026-01-28 5:10 ` [PATCH v3 1/2] platform: chrome: lightbar: Report number of segments Tzung-Bi Shih
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=aXmaMhDv5YqVT58s@google.com \
--to=tzungbi@kernel.org \
--cc=chrome-platform@lists.linux.dev \
--cc=gwendal@chromium.org \
--cc=gwendal@google.com \
/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.