Thank you for your contribution! Sashiko AI review found 5 potential issues to consider: - [Medium] backlight: viewe_bl_i2c: missing DT property parsing and initial HW sync in viewe_bl_probe() - [Low] backlight: viewe_bl_i2c: positional initializer and mismatched ID in viewe_bl_id - [Low] backlight: viewe_bl_i2c: open-coded byte write in viewe_bl_update_status() - [Low] backlight: viewe_bl_i2c: hardcoded device name in viewe_bl_probe() breaks multi-instance probe - [Low] backlight: viewe_bl_i2c: empty commit message body lacking hardware and driver description --
commit 4e7ef9a994e068f00aa52e87d93462c70437631d Author: Hefei <[email protected]> > backlight: add VIEWE I2C backlight driver > > Signed-off-by: Hefei <[email protected]> [Severity: Low] The commit message has an empty body. Could you add a description of the VIEWE 7KF82 I2C backlight MCU hardware and explain why a dedicated driver is needed? > 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 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright (C) 2026 VIEWE > + * > + * I2C backlight for VIEWE 7KF82 DSI modules (MCU @0x45, register 0x86, > 0..255). > + */ > + > +#include <linux/backlight.h> > +#include <linux/i2c.h> > +#include <linux/module.h> > + > +#define VIEWE_BL_REG 0x86 > +#define VIEWE_BL_MAX 255 > +#define VIEWE_BL_DEFAULT 200 > + > +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 a raw i2c_transfer()? Using the SMBus helper preserves client->flags and works on SMBus-only adapters that do not implement raw I2C master_xfer. > + > +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, > + }; > + 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] Does passing the constant string "viewe_bl" to devm_backlight_device_register() cause probing a second panel instance to fail with -EEXIST when creating /sys/class/backlight/viewe_bl? Passing dev_name(&client->dev) avoids the name collision, and the i2c_set_clientdata() call can be dropped since client data is never read. > + return 0; > +} [Severity: Medium] Does viewe_bl_probe() ignore the default-brightness property from Device Tree and leave the hardware brightness uninitialized at probe? devm_backlight_device_register() neither parses default-brightness (or max-brightness) from device properties nor calls backlight_update_status(). Any default-brightness configured per the viewe,7kf82-backlight binding is silently ignored in favor of VIEWE_BL_DEFAULT, sysfs brightness is out of sync with register 0x86 until userspace writes to it, and probe succeeds even if the MCU at 0x45 does not respond. In addition, viewe_bl_ops omits .options = BL_CORE_SUSPENDRESUME, so the backlight is not blanked and restored across system suspend and resume. > + > +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 (such as { .name = "7kf82-backlight" }), and the ID string should match the vendor-stripped compatible name ("7kf82-backlight" rather than "viewe_bl") so fallback I2C ID matching works with the OF compatible string. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=6
