From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: backlight: Add SY7758 6-channel High Efficiency LED Driver support
Date: Thu, 04 Jun 2026 16:03:09 +1000 [thread overview]
Message-ID: <review-patch2-20260529-topic-sm8650-ayaneo-pocket-s2-sy7758-v5-2-03aacd49747c@linaro.org> (raw)
In-Reply-To: <20260529-topic-sm8650-ayaneo-pocket-s2-sy7758-v5-2-03aacd49747c@linaro.org>
Patch Review
**Issue 1 (medium) — No backlight off control when brightness is 0:**
`sy7758_backlight_update_status()` only writes the brightness registers:
```c
static int sy7758_backlight_update_status(struct backlight_device *backlight_dev)
{
struct sy7758 *sydev = bl_get_data(backlight_dev);
unsigned int brightness = backlight_get_brightness(backlight_dev);
int ret;
ret = regmap_write(sydev->regmap, REG_BRT_12BIT_L,
FIELD_PREP(MSK_BRT_12BIT_L,
brightness & 0xff));
...
ret = regmap_write(sydev->regmap, REG_BRT_12BIT_H,
FIELD_PREP(MSK_BRT_12BIT_H,
(brightness >> 8) & 0xf));
...
}
```
When brightness reaches 0, the LED channels remain powered (`BIT_CFG2_BL_ON` stays set). Compare with ktz8866 which toggles `BL_EN_BIT` on brightness 0, and aw99706 which toggles `BACKLIGHT_EN_MASK`. This matters for power consumption during suspend (the backlight core sets brightness=0 on suspend due to `BL_CORE_SUSPENDRESUME`). The `update_status` callback should also clear/set `BIT_CFG2_BL_ON` based on whether brightness is zero.
Similarly, `sy7758_remove()` calls `backlight_disable()` but that only writes brightness=0 — without toggling `BIT_CFG2_BL_ON`, the chip may still be driving the LEDs at minimum current.
**Issue 2 (minor) — Hardcoded hardware configuration limits reusability:**
`sy7758_init()` writes board-specific values directly:
```c
ret = regmap_write(sydev->regmap, REG_OTP_CFG0,
FIELD_PREP(MSK_CFG0_CURRENT_LOW, 85));
...
ret = regmap_write(sydev->regmap, REG_OTP_CFG1,
BIT_CFG1_PDET_STDBY |
FIELD_PREP(MSK_CFG1_CURRENT_MAX, 1) |
FIELD_PREP(MSK_CFG1_CURRENT_HIGH, 10));
```
The LED current (85 + 10<<8 = 2645 in whatever unit), PWM frequency (mode 4), boost voltage max (mode 4), UVLO enable, etc. are all hardcoded for the Ayaneo Pocket S2. A second board using SY7758 would need to fork the init or add DT properties. This is acceptable for a v1 driver targeting a single board, but worth a comment acknowledging the limitation, or better yet, reading `default-brightness` and `max-brightness` from the DT as `common.yaml` provides them.
**Issue 3 (nit) — Redundant masking with FIELD_PREP:**
```c
ret = regmap_write(sydev->regmap, REG_BRT_12BIT_L,
FIELD_PREP(MSK_BRT_12BIT_L,
brightness & 0xff));
```
`MSK_BRT_12BIT_L` is `GENMASK(7, 0)` = 0xFF, starting at bit 0. `FIELD_PREP` already masks the value to fit the field, so the explicit `& 0xff` is redundant. Same for `(brightness >> 8) & 0xf` with `MSK_BRT_12BIT_H` = `GENMASK(3, 0)`. This appears in both `update_status` and `sy7758_init`. Not a bug, just noise.
**Issue 4 (nit) — Unnecessary initialization of `ret`:**
```c
static int sy7758_init(struct sy7758 *sydev)
{
int ret = 0;
ret = regmap_write(sydev->regmap, REG_DEV_CTL, ...);
```
`ret` is initialized to 0 then immediately overwritten. Should be just `int ret;`.
**Issue 5 (nit) — Last return in `sy7758_init` could be simplified:**
```c
ret = regmap_write(sydev->regmap, REG_OTP_CFG2,
BIT_CFG2_BL_ON | BIT_CFG2_UVLO_EN);
if (ret)
return ret;
return 0;
```
This could be simply:
```c
return regmap_write(sydev->regmap, REG_OTP_CFG2,
BIT_CFG2_BL_ON | BIT_CFG2_UVLO_EN);
```
**Positive notes:**
- Good use of `devm_regulator_get_enable()` and `devm_gpiod_get()` for resource management.
- Proper `dev_err_probe()` usage throughout.
- Device ID check is solid with a clear error message.
- The `fsleep(10000)` (10ms) after asserting the enable GPIO before attempting I2C communication is reasonable and was already iterated upon in earlier versions.
- Kconfig correctly uses `select REGMAP_I2C` and `depends on I2C`.
- Makefile entry maintains alphabetical order.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-06-04 6:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-29 19:23 [PATCH v5 0/2] backlight: Add SY7758 6-channel High Efficiency LED Driver support Neil Armstrong
2026-05-29 19:23 ` [PATCH v5 1/2] dt-bindings: leds: backlight: document the SY7758 6-channel High Efficiency LED Driver Neil Armstrong
2026-06-04 6:03 ` Claude review: " Claude Code Review Bot
2026-05-29 19:23 ` [PATCH v5 2/2] backlight: Add SY7758 6-channel High Efficiency LED Driver support Neil Armstrong
2026-06-04 6:03 ` Claude Code Review Bot [this message]
2026-06-04 6:03 ` Claude review: " Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-05-21 8:07 [PATCH v4 0/2] " Neil Armstrong
2026-05-21 8:08 ` [PATCH v4 2/2] " Neil Armstrong
2026-05-25 10:43 ` Claude review: " Claude Code Review Bot
2026-05-25 10:43 ` Claude Code Review Bot
2026-04-30 9:47 [PATCH v2 0/2] " Neil Armstrong
2026-04-30 9:47 ` [PATCH v2 2/2] " Neil Armstrong
2026-05-05 0:44 ` Claude review: " Claude Code Review Bot
2026-05-05 0:44 ` Claude Code Review Bot
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=review-patch2-20260529-topic-sm8650-ayaneo-pocket-s2-sy7758-v5-2-03aacd49747c@linaro.org \
--to=claude-review@example.com \
--cc=dri-devel-reviews@example.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox