From: sashiko-bot@kernel.org
To: Hefei <3066883572@qq.com>, dri-devel@lists.freedesktop.org
Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v2 6/6] backlight: add VIEWE I2C backlight driver
Date: Wed, 25 Nov 2026 02:19:55 +0000 [thread overview]
Message-ID: <sashiko-outbox-232402@kernel.org> (raw)
In-Reply-To: <tencent_42CFAF0E2AFDF8C8C784D5DCB700E1E65306@qq.com>
Thank you for your contribution! Sashiko AI review found 6 potential
issues to consider:
- [Medium] backlight: viewe_bl_i2c: missing DT brightness parsing in
viewe_bl_probe()
- [Medium] backlight: viewe_bl_i2c: missing backlight_update_status() in
viewe_bl_probe()
- [Low] backlight: viewe_bl_i2c: positional initializer in struct
i2c_device_id table
- [Low] backlight: viewe_bl_i2c: open-coded register write in
viewe_bl_update_status()
- [Low] backlight: viewe_bl_i2c: dead clientdata and missing
suspend/unbind blanking
- [Low] backlight: viewe_bl_i2c: empty commit message body and
non-standard trailer
--
commit c7c0be93ab188af721db0878f1959009280ef433
Author: Hefei <3066883572@qq.com>
> backlight: add VIEWE I2C backlight driver
>
> Signed-off-by: Hefei <3066883572@qq.com>
> Co-authored-by: Cursor <cursoragent@cursor.com>
[Severity: Low]
Could a commit message body be added to describe the hardware and rationale
for the driver? Also, Co-authored-by: is not a standard kernel trailer and is
placed after Signed-off-by:.
> diff --git a/drivers/video/backlight/viewe_bl_i2c.c b/drivers/video/backlight/viewe_bl_i2c.c
> new file mode 100644
> index 0000000000000..53dcf0834dcb2
> --- /dev/null
> +++ b/drivers/video/backlight/viewe_bl_i2c.c
> @@ -0,0 +1,79 @@
[ ... ]
> +static int viewe_bl_update_status(struct backlight_device *bd)
> +{
> + struct i2c_client *client = bl_get_data(bd);
> + u8 buf[2] = { VIEWE_BL_REG, (u8)backlight_get_brightness(bd) };
> + struct i2c_msg msg = {
> + .addr = client->addr,
> + .flags = 0,
> + .len = sizeof(buf),
> + .buf = buf,
> + };
> + int ret;
> +
> + ret = i2c_transfer(client->adapter, &msg, 1);
> + return ret == 1 ? 0 : (ret < 0 ? ret : -EIO);
> +}
[Severity: Low]
Could viewe_bl_update_status() use i2c_smbus_write_byte_data(client,
VIEWE_BL_REG, backlight_get_brightness(bd)) instead of open-coding
i2c_transfer()? Manually building struct i2c_msg drops client->flags and
prevents the driver from working on SMBus-only adapters.
> +
> +static const struct backlight_ops viewe_bl_ops = {
> + .update_status = viewe_bl_update_status,
> +};
> +
> +static int viewe_bl_probe(struct i2c_client *client)
> +{
> + struct backlight_properties props = {
> + .type = BACKLIGHT_RAW,
> + .brightness = VIEWE_BL_DEFAULT,
> + .max_brightness = VIEWE_BL_MAX,
> + };
[Severity: Medium]
Should viewe_bl_probe() parse default-brightness and max-brightness from
client->dev instead of hardcoding VIEWE_BL_DEFAULT and VIEWE_BL_MAX?
The companion DT binding in
Documentation/devicetree/bindings/leds/backlight/viewe,i2c-backlight.yaml
references common.yaml# and uses default-brightness in its example, but
devm_backlight_device_register() does not read firmware properties itself, so
any DT-configured brightness limits or defaults are ignored.
> + struct backlight_device *bd;
> +
> + bd = devm_backlight_device_register(&client->dev, "viewe_bl",
> + &client->dev, client, &viewe_bl_ops,
> + &props);
> + if (IS_ERR(bd))
> + return PTR_ERR(bd);
> +
> + i2c_set_clientdata(client, bd);
[Severity: Low]
i2c_set_clientdata() stores bd, but nothing in the driver ever calls
i2c_get_clientdata(), and neither BL_CORE_SUSPENDRESUME in viewe_bl_ops nor a
.remove callback is set, leaving the backlight illuminated across system
suspend (when used standalone) or driver unbind.
> + return 0;
> +}
[Severity: Medium]
Should viewe_bl_probe() call backlight_update_status(bd) before returning?
devm_backlight_device_register() copies props into bd->props without invoking
ops->update_status(), so register 0x86 is never programmed with the initial
brightness at probe time, sysfs brightness and bl_power state start out of
sync with the hardware, and probe succeeds even if no device responds at
client->addr.
> +
> +static const struct of_device_id viewe_bl_of_match[] = {
> + { .compatible = "viewe,7kf82-backlight" },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, viewe_bl_of_match);
> +
> +static const struct i2c_device_id viewe_bl_id[] = {
> + { "viewe_bl", 0 },
> + { }
> +};
[Severity: Low]
New struct i2c_device_id entries should use named initializers (for example,
{ .name = "7kf82-backlight" }, matching the DT compatible suffix).
--
Sashiko AI review · https://sashiko.dev/#/patchset/tencent_EE81D0ED29E97716D56BDCF1A3C5AAE35B05@qq.com?part=6
prev parent reply other threads:[~2026-11-25 2:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20261125020944.137-1-3066883572@qq.com>
2026-11-25 2:09 ` [PATCH v2 1/6] dt-bindings: display: add VIEWE JD9365TX panel binding Hefei
2026-11-25 2:20 ` sashiko-bot
2026-11-25 2:09 ` [PATCH v2 2/6] dt-bindings: input: add Jadard JD9365TX touchscreen binding Hefei
2026-11-25 2:18 ` sashiko-bot
2026-11-25 2:09 ` [PATCH v2 3/6] dt-bindings: backlight: add VIEWE I2C backlight binding Hefei
2026-11-25 2:17 ` sashiko-bot
2026-11-25 2:09 ` [PATCH v2 4/6] drm/panel: add VIEWE JD9365TX 7 inch DSI panel Hefei
2026-11-25 2:29 ` sashiko-bot
2026-11-25 2:09 ` [PATCH v2 5/6] Input: add Jadard JD9365TX in-cell touchscreen driver Hefei
2026-11-25 2:21 ` sashiko-bot
2026-11-25 2:09 ` [PATCH v2 6/6] backlight: add VIEWE I2C backlight driver Hefei
2026-11-25 2:19 ` sashiko-bot [this message]
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-232402@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=3066883572@qq.com \
--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=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