On Tue, Jan 17, 2023 at 02:04:05PM +0000, Daniel Thompson wrote: > On Tue, Jan 17, 2023 at 09:47:41PM +0800, Jianhua Lu wrote: > > Add support for Kinetic KTZ8866 backlight, which is used in > > Xiaomi tablet, Mi Pad 5 series. This driver lightly based on > > downstream implementation [1]. > > [1] https://github.com/MiCode/Xiaomi_Kernel_OpenSource/blob/elish-r-oss/drivers/video/backlight/ktz8866.c > > > > Signed-off-by: Jianhua Lu <lujianhua000@xxxxxxxxx> > > --- > > Changes in v2: > > - Add missing staitc modifier to ktz8866_write function. > > > > Changes in v3: > > - Add 2022 to Copyright line. > > - Sort headers. > > - Remove meaningless comment. > > - Use definitions instead of hardcoding. > > - Add missing maintainer info. > > > > Changes in v4: > > - Change 2022 to 2023. > > - Remove useless macro and enum. > > - Describe settings by devicetree. > > - Move header file to C file. > > > > MAINTAINERS | 6 + > > drivers/video/backlight/Kconfig | 8 ++ > > drivers/video/backlight/Makefile | 1 + > > drivers/video/backlight/ktz8866.c | 195 ++++++++++++++++++++++++++++++ > > 4 files changed, 210 insertions(+) > > create mode 100644 drivers/video/backlight/ktz8866.c > > > > diff --git a/MAINTAINERS b/MAINTAINERS > > index 42fc47c6edfd..2084e74e1b58 100644 > > --- a/MAINTAINERS > > +++ b/MAINTAINERS > > @@ -11674,6 +11674,12 @@ M: John Hawley <warthog9@xxxxxxxxxxxxxx> > > S: Maintained > > F: tools/testing/ktest > > > > +KTZ8866 BACKLIGHT DRIVER > > +M: Jianhua Lu <lujianhua000@xxxxxxxxx> > > +S: Maintained > > +F: Documentation/devicetree/bindings/leds/backlight/kinetic,ktz8866.yaml > > +F: drivers/video/backlight/ktz8866.c > > + > > L3MDEV > > M: David Ahern <dsahern@xxxxxxxxxx> > > L: netdev@xxxxxxxxxxxxxxx > > diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig > > index 936ba1e4d35e..2845fd7e33ad 100644 > > --- a/drivers/video/backlight/Kconfig > > +++ b/drivers/video/backlight/Kconfig > > @@ -190,6 +190,14 @@ config BACKLIGHT_KTD253 > > which is a 1-wire GPIO-controlled backlight found in some mobile > > phones. > > > > +config BACKLIGHT_KTZ8866 > > + tristate "Backlight Driver for Kinetic KTZ8866" > > + depends on I2C > > + select REGMAP_I2C > > + help > > + Say Y to enabled the backlight driver for the Kinetic KTZ8866 > > + found in Xiaomi Mi Pad 5 series. > > + > > config BACKLIGHT_LM3533 > > tristate "Backlight Driver for LM3533" > > depends on MFD_LM3533 > > diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile > > index e815f3f1deff..f70a819c304c 100644 > > --- a/drivers/video/backlight/Makefile > > +++ b/drivers/video/backlight/Makefile > > @@ -36,6 +36,7 @@ obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o > > obj-$(CONFIG_BACKLIGHT_HP700) += jornada720_bl.o > > obj-$(CONFIG_BACKLIGHT_IPAQ_MICRO) += ipaq_micro_bl.o > > obj-$(CONFIG_BACKLIGHT_KTD253) += ktd253-backlight.o > > +obj-$(CONFIG_BACKLIGHT_KTZ8866) += ktz8866.o > > obj-$(CONFIG_BACKLIGHT_LM3533) += lm3533_bl.o > > obj-$(CONFIG_BACKLIGHT_LM3630A) += lm3630a_bl.o > > obj-$(CONFIG_BACKLIGHT_LM3639) += lm3639_bl.o > > diff --git a/drivers/video/backlight/ktz8866.c b/drivers/video/backlight/ktz8866.c > > new file mode 100644 > > index 000000000000..98916f92d069 > > --- /dev/null > > +++ b/drivers/video/backlight/ktz8866.c > > @@ -0,0 +1,195 @@ > > +// SPDX-License-Identifier: GPL-2.0-only > > +/* > > + * Backlight driver for the Kinetic KTZ8866 > > + * > > + * Copyright (C) 2023 Jianhua Lu <lujianhua000@xxxxxxxxx> > > Shouldn't this be: > Copyright (C) 2022, 2023 Jianhua Lu <lujianhua000@xxxxxxxxx> > > > +static int ktz8866_probe(struct i2c_client *client, > > + const struct i2c_device_id *id) > > +{ > > + struct backlight_device *backlight_dev; > > + struct backlight_properties props; > > + struct ktz8866 *ktz; > > + > > + ktz = devm_kzalloc(&client->dev, sizeof(*ktz), GFP_KERNEL); > > + if (!ktz) > > + return -ENOMEM; > > + > > + ktz->client = client; > > + ktz->regmap = devm_regmap_init_i2c(client, &ktz8866_regmap_config); > > + > > + if (IS_ERR(ktz->regmap)) { > > + dev_err(&client->dev, "failed to init regmap\n"); > > + return PTR_ERR(ktz->regmap); > > + } > > + > > + memset(&props, 0, sizeof(props)); > > + props.type = BACKLIGHT_RAW; > > + props.max_brightness = MAX_BRIGHTNESS; > > + props.brightness = DEFAULT_BRIGHTNESS; > > There is still pending feedback from v3. > > | Please set the scale property correctly. "Unknown" is never correct for > | new drivers. Do you means backlight_properties.backlight_scale? > > Do not ignore feedback. You should either act on it or, if you disagree > or need additional clarification then, reply on the mail thread. > > > Daniel.