From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot 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 Message-ID: In-Reply-To: <20260529-topic-sm8650-ayaneo-pocket-s2-sy7758-v5-2-03aacd49747c@linaro.org> References: <20260529-topic-sm8650-ayaneo-pocket-s2-sy7758-v5-0-03aacd49747c@linaro.org> <20260529-topic-sm8650-ayaneo-pocket-s2-sy7758-v5-2-03aacd49747c@linaro.org> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review **Issue 1 (medium) =E2=80=94 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 *backligh= t_dev) { struct sy7758 *sydev =3D bl_get_data(backlight_dev); unsigned int brightness =3D backlight_get_brightness(backlight_dev); int ret; ret =3D regmap_write(sydev->regmap, REG_BRT_12BIT_L, FIELD_PREP(MSK_BRT_12BIT_L, brightness & 0xff)); ... ret =3D 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 co= nsumption during suspend (the backlight core sets brightness=3D0 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 writ= es brightness=3D0 =E2=80=94 without toggling `BIT_CFG2_BL_ON`, the chip may= still be driving the LEDs at minimum current. **Issue 2 (minor) =E2=80=94 Hardcoded hardware configuration limits reusabi= lity:** `sy7758_init()` writes board-specific values directly: ```c ret =3D regmap_write(sydev->regmap, REG_OTP_CFG0, FIELD_PREP(MSK_CFG0_CURRENT_LOW, 85)); ... ret =3D 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 =3D 2645 in whatever unit), PWM frequency (mode= 4), boost voltage max (mode 4), UVLO enable, etc. are all hardcoded for th= e 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 singl= e board, but worth a comment acknowledging the limitation, or better yet, r= eading `default-brightness` and `max-brightness` from the DT as `common.yam= l` provides them. **Issue 3 (nit) =E2=80=94 Redundant masking with FIELD_PREP:** ```c ret =3D regmap_write(sydev->regmap, REG_BRT_12BIT_L, FIELD_PREP(MSK_BRT_12BIT_L, brightness & 0xff)); ``` `MSK_BRT_12BIT_L` is `GENMASK(7, 0)` =3D 0xFF, starting at bit 0. `FIELD_PR= EP` already masks the value to fit the field, so the explicit `& 0xff` is r= edundant. Same for `(brightness >> 8) & 0xf` with `MSK_BRT_12BIT_H` =3D `GE= NMASK(3, 0)`. This appears in both `update_status` and `sy7758_init`. Not a= bug, just noise. **Issue 4 (nit) =E2=80=94 Unnecessary initialization of `ret`:** ```c static int sy7758_init(struct sy7758 *sydev) { int ret =3D 0; ret =3D regmap_write(sydev->regmap, REG_DEV_CTL, ...); ``` `ret` is initialized to 0 then immediately overwritten. Should be just `int= ret;`. **Issue 5 (nit) =E2=80=94 Last return in `sy7758_init` could be simplified:= ** ```c ret =3D 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 reso= urce 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 attempt= ing I2C communication is reasonable and was already iterated upon in earlie= r versions. - Kconfig correctly uses `select REGMAP_I2C` and `depends on I2C`. - Makefile entry maintains alphabetical order. --- Generated by Claude Code Patch Reviewer