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: Tue, 05 May 2026 10:44:01 +1000 [thread overview]
Message-ID: <review-patch2-20260430-topic-sm8650-ayaneo-pocket-s2-sy7758-v2-2-308140640de9@linaro.org> (raw)
In-Reply-To: <20260430-topic-sm8650-ayaneo-pocket-s2-sy7758-v2-2-308140640de9@linaro.org>
Patch Review
**Signed-off-by ordering issue:**
The `From:` header indicates KancyJoe is the original author, but the SOB chain is:
```
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: KancyJoe <kancy2333@outlook.com>
```
The original author's SOB should come first, then the submitter/forwarder's:
```
Signed-off-by: KancyJoe <kancy2333@outlook.com>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
```
**Kconfig typo (line 216):**
```
backlight controller found in Ayaneo Socket S2.
```
Should be "Ayaneo **Pocket** S2".
**Hardcoded board-specific init values (`sy7758_init()`, lines 159-210):**
This is the most significant design concern. The `sy7758_init()` function hardcodes specific current settings, PWM frequency, boost voltage limits, and UVLO thresholds:
```c
ret = regmap_write(sydev->regmap, REG_OTP_CFG5,
FIELD_PREP(MSK_CFG5_PS_MODE, 6) |
FIELD_PREP(MSK_CFG5_PWM_FREQ, 4));
...
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));
```
These are configuration values specific to the Ayaneo Pocket S2 board (LED current limits, PWM mode, etc.) and should come from DT properties or at least be defaults that can be overridden. If this chip is ever used on another board, the driver as-is would apply incorrect current/voltage settings, which could damage the hardware. At minimum, these magic numbers deserve defines or comments explaining what physical values they correspond to.
**Duplicate define with same value (lines 66-67):**
```c
#define BIT_STATUS2_OCP50MS_LATCH BIT(0)
#define BIT_STATUS2_OCP2 BIT(0)
```
Both map to `BIT(0)`. If this is intentional (same physical bit, different semantic names), it's fine but worth a comment. If one of them should be a different bit, it's a bug. Neither is used in the driver so this is low-impact.
**Unnecessary `FIELD_PREP` with full-byte mask (lines 140, 170, 187-188):**
```c
FIELD_PREP(MSK_BRT_12BIT_L, brightness & 0xff)
```
where `MSK_BRT_12BIT_L` is `GENMASK(7, 0)`. `FIELD_PREP` with a mask of all 8 bits is a no-op — it just returns the value unchanged. Not a bug, but misleading — it implies bit-field positioning when there is none. Same applies to `MSK_CFG0_CURRENT_LOW`.
**`MAX_BRIGHTNESS` is 4080, not 4095 (line 21):**
```c
#define MAX_BRIGHTNESS 4080
```
For a 12-bit brightness register, the maximum is 4095 (0xFFF). 4080 = 0xFF0 = 255 * 16. This may be a hardware limitation of this specific chip, but it's not documented. A brief comment explaining why 4080 rather than 4095 would help future readers.
**Unused struct fields:**
- `sydev->client` (line 121, set at line 227): stored but never read after assignment. All I2C access goes through `sydev->regmap`.
- `sydev->gpio` (line 123, set at line 241): stored but never referenced after probe. Since `devm_gpiod_get()` is managed, storing the descriptor is only needed if `remove()`/suspend needs to toggle the GPIO — which this driver doesn't do.
**Unnecessary initialization (line 161):**
```c
int ret = 0;
```
`ret` is always assigned before use; the `= 0` is dead.
**`sy7758_remove()` only calls `backlight_disable()` (lines 278-283):**
The remove function disables the backlight but doesn't de-assert the enable GPIO or do any other hardware shutdown. Since `devm_gpiod_get()` was used with `GPIOD_OUT_HIGH`, the GPIO won't be automatically driven low on remove (devm cleanup frees the descriptor, but doesn't reset the output). Depending on hardware requirements, the chip may continue consuming power after the driver is unloaded.
**No parsing of `default-brightness` / `max-brightness` DT properties:**
The binding inherits these from `common.yaml`, but the driver uses hardcoded `DEFAULT_BRIGHTNESS` (1024) and `MAX_BRIGHTNESS` (4080). A DT user setting `default-brightness = <2048>` would have no effect.
**Large number of unused register/field defines:**
Many defines (e.g., `REG_OTP_CFG98`, `REG_OTP_CFG9E`, `REG_OTP_CFG3`, `REG_OTP_CFG4`, `REG_OTP_CFG6`, `REG_OTP_CFG7`, `REG_OTP_CFGA`, `REG_OTP_CFGE`, and most `BIT_`/`MSK_` macros) are never used. While documenting the register map has value, some reviewers prefer adding defines only when they're needed to reduce noise. This is a style preference.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-05-05 0:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-30 9:47 [PATCH v2 0/2] backlight: Add SY7758 6-channel High Efficiency LED Driver support Neil Armstrong
2026-04-30 9:47 ` [PATCH v2 1/2] dt-bindings: leds: backlight: document the SY7758 6-channel High Efficiency LED Driver Neil Armstrong
2026-05-05 0:44 ` Claude review: " Claude Code Review Bot
2026-04-30 9:47 ` [PATCH v2 2/2] backlight: Add SY7758 6-channel High Efficiency LED Driver support Neil Armstrong
2026-05-05 0:44 ` Claude Code Review Bot [this message]
2026-05-05 0:44 ` Claude review: " 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-20260430-topic-sm8650-ayaneo-pocket-s2-sy7758-v2-2-308140640de9@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