* [PATCH 0/4] video: backlight: Backlight for Kobo Clara 2e
@ 2026-11-30 19:08 Andreas Kemnade
2026-11-30 19:08 ` [PATCH 1/4] dt-bindings: leds: backlight: Add Awinic AW99703 backlight Andreas Kemnade
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Andreas Kemnade @ 2026-11-30 19:08 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek,
Griffin Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Helge Deller, Frank Li, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Russell King
Cc: dri-devel, linux-leds, devicetree, linux-kernel, linux-fbdev, imx,
linux-arm-kernel, Andreas Kemnade
Add Backlight for Kobo Clara 2e. It has two backlights with deferent
color temperature. Label them to give userspace a hint what it is and
avoid referencing it by magic numbers. It requires shared
gpio support to be enabled for both backlights to show up,
so if these patches are independently merged, there will be
commits with only one backlight, but I do not consider that as
a regression harming bisecting.
Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
Andreas Kemnade (4):
dt-bindings: leds: backlight: Add Awinic AW99703 backlight
video: backlight: Add Awinic AW99703
ARM: dts: imx: Add backlight for Kobo Clara 2e
arm: mach-imx: enable shared gpios
.../bindings/leds/backlight/awinic,aw99703.yaml | 96 +++++
.../dts/nxp/imx/imx6sll-kobo-clara2e-common.dtsi | 34 +-
arch/arm/mach-imx/Kconfig | 1 +
drivers/video/backlight/Kconfig | 10 +
drivers/video/backlight/Makefile | 1 +
drivers/video/backlight/aw99703.c | 471 +++++++++++++++++++++
6 files changed, 611 insertions(+), 2 deletions(-)
---
base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
change-id: 20261130-bl-aw99703-upstr-163cfacab9cb
Best regards,
--
Andreas Kemnade <andreas@kemnade.info>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/4] dt-bindings: leds: backlight: Add Awinic AW99703 backlight
2026-11-30 19:08 [PATCH 0/4] video: backlight: Backlight for Kobo Clara 2e Andreas Kemnade
@ 2026-11-30 19:08 ` Andreas Kemnade
2026-11-30 19:16 ` sashiko-bot
2026-11-30 19:08 ` [PATCH 2/4] video: backlight: Add Awinic AW99703 Andreas Kemnade
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Andreas Kemnade @ 2026-11-30 19:08 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek,
Griffin Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Helge Deller, Frank Li, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Russell King
Cc: dri-devel, linux-leds, devicetree, linux-kernel, linux-fbdev, imx,
linux-arm-kernel, Andreas Kemnade
Add Awinic AW99703 backlight binding documentation.
Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
.../bindings/leds/backlight/awinic,aw99703.yaml | 96 ++++++++++++++++++++++
1 file changed, 96 insertions(+)
diff --git a/Documentation/devicetree/bindings/leds/backlight/awinic,aw99703.yaml b/Documentation/devicetree/bindings/leds/backlight/awinic,aw99703.yaml
new file mode 100644
index 0000000000000..74214a1760622
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/backlight/awinic,aw99703.yaml
@@ -0,0 +1,96 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/backlight/awinic,aw99703.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Awinic AW99703 3-channel WLED Backlight Driver
+
+maintainers:
+ - Andreas Kemnade <andreas@kemnade.info>
+
+allOf:
+ - $ref: common.yaml#
+
+properties:
+ compatible:
+ const: awinic,aw99703
+
+ reg:
+ maxItems: 1
+
+ label:
+ maxItems: 1
+
+ enable-gpios:
+ description: GPIO to use to enable/disable the backlight (HWEN pin).
+ maxItems: 1
+
+ vin-supply: true
+
+ awinic,ovp-microvolt:
+ enum: [ 17500000, 24000000, 31000000, 38000000, 41500000 ]
+ default: 38000
+
+ awinic,ocp-microamp:
+ enum: [ 900000, 1800000, 2700000, 34000000 ]
+ default: 2700000
+
+ awinic,inductor-nanohenry:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description: Inductor used in nH
+ enum: [ 4700, 10000 ]
+ default: 4700
+
+ awinic,iled-max-microamp:
+ description: Maximum LED current setting in uA.
+ minimum: 4800
+ maximum: 29600
+ multipleOf: 800
+ default: 20000
+
+ awinic,channel-mask:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description: Mask of channels to use
+ minimum: 0
+ maximum: 7
+ default: 7
+
+ awinic,map-type:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description: Map type 0 = exponential, 1 = linear
+ enum: [ 0, 1 ]
+ default: 0
+
+required:
+ - compatible
+ - reg
+ - vin-supply
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/gpio/gpio.h>
+
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ backlight@36 {
+ compatible = "awinic,aw99703";
+ reg = <0x36>;
+ enable-gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
+ vin-supply = <&vin>;
+ default-brightness = <100>;
+ label = "backlight_cold";
+ awinic,map-type = <1>;
+ awinic,ocp-microamp = <1800000>;
+ awinic,ovp-microvolt = <31000000>;
+
+ awinic,iled-max-microamp = <20000>;
+ awinic,channel-mask = <5>;
+ };
+ };
+
+...
--
2.47.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/4] video: backlight: Add Awinic AW99703
2026-11-30 19:08 [PATCH 0/4] video: backlight: Backlight for Kobo Clara 2e Andreas Kemnade
2026-11-30 19:08 ` [PATCH 1/4] dt-bindings: leds: backlight: Add Awinic AW99703 backlight Andreas Kemnade
@ 2026-11-30 19:08 ` Andreas Kemnade
2026-11-30 19:24 ` sashiko-bot
2026-11-30 19:08 ` [PATCH 3/4] ARM: dts: imx: Add backlight for Kobo Clara 2e Andreas Kemnade
2026-11-30 19:08 ` [PATCH 4/4] arm: mach-imx: enable shared gpios Andreas Kemnade
3 siblings, 1 reply; 10+ messages in thread
From: Andreas Kemnade @ 2026-11-30 19:08 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek,
Griffin Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Helge Deller, Frank Li, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Russell King
Cc: dri-devel, linux-leds, devicetree, linux-kernel, linux-fbdev, imx,
linux-arm-kernel, Andreas Kemnade
Add a driver for the Awinic AW99703. It currently only implements
controlling the brightness via I2C. Controlling it
via PWM input is not supported at the moment.
Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
drivers/video/backlight/Kconfig | 10 +
drivers/video/backlight/Makefile | 1 +
drivers/video/backlight/aw99703.c | 471 ++++++++++++++++++++++++++++++++++++++
3 files changed, 482 insertions(+)
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index dbf4ca23a9b6d..2df54994d057e 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -156,6 +156,16 @@ config BACKLIGHT_ATMEL_LCDC
If in doubt, it's safe to enable this option; it doesn't kick
in unless the board's description says it's wired that way.
+config BACKLIGHT_AW99703
+ tristate "Backlight Driver for Awinic AW99703"
+ depends on I2C
+ select REGMAP_I2C
+ help
+ If you have a backlight connected to the Awininc AW99703
+ and want to set the brightness through I2C, say y here.
+ Controlling the brightness through PWM input is not supported
+ by this driver yet.
+
config BACKLIGHT_AW99706
tristate "Backlight Driver for Awinic AW99706"
depends on I2C
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index 34469711c6cd9..09ec9bd71c92a 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -25,6 +25,7 @@ obj-$(CONFIG_BACKLIGHT_ADP8870) += adp8870_bl.o
obj-$(CONFIG_BACKLIGHT_APPLE) += apple_bl.o
obj-$(CONFIG_BACKLIGHT_APPLE_DWI) += apple_dwi_bl.o
obj-$(CONFIG_BACKLIGHT_AS3711) += as3711_bl.o
+obj-$(CONFIG_BACKLIGHT_AW99703) += aw99703.o
obj-$(CONFIG_BACKLIGHT_AW99706) += aw99706.o
obj-$(CONFIG_BACKLIGHT_BD6107) += bd6107.o
obj-$(CONFIG_BACKLIGHT_CGBC) += cgbc_bl.o
diff --git a/drivers/video/backlight/aw99703.c b/drivers/video/backlight/aw99703.c
new file mode 100644
index 0000000000000..3491895e9ac82
--- /dev/null
+++ b/drivers/video/backlight/aw99703.c
@@ -0,0 +1,471 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * aw99703.c aw99703 backlight module
+ *
+ * Copyright (c) 2026 Andreas Kemnade <andreas@kemnade.info>
+ *
+ */
+
+#include <linux/bits.h>
+#include <linux/bitfield.h>
+#include <linux/i2c.h>
+#include <linux/slab.h>
+#include <linux/input.h>
+#include <linux/types.h>
+#include <linux/pm_runtime.h>
+#include <linux/regulator/consumer.h>
+#include <linux/device.h>
+#include <linux/module.h>
+#include <linux/version.h>
+#include <linux/gpio/consumer.h>
+#include <linux/delay.h>
+#include <linux/backlight.h>
+#include <linux/regmap.h>
+
+#define AW99703_REG_MAX 0x10
+#define AW99703_REG_MODE 0x02
+#define AW99703_REG_LEDCUR 0x03
+#define AW99703_REG_BSTCTR1 0x04
+#define AW99703_REG_LEDLSB 0x06
+#define AW99703_REG_LEDMSB 0x07
+#define AW99703_REG_TURNCFG 0x09
+
+/* MODE:0x02 */
+#define AW99703_MODE_PDIS_MASK BIT(4)
+#define AW99703_MODE_MAP_MASK BIT(2)
+#define AW99703_MODE_WORKMODE_MASK GENMASK(1, 0)
+#define AW99703_MODE_WORKMODE_STANDBY 0
+#define AW99703_MODE_WORKMODE_BACKLIGHT BIT(0)
+
+/* LEDCUR:0x03 */
+#define AW99703_LEDCUR_BLFS_MASK GENMASK(7, 3)
+#define AW99703_LEDCUR_CHANNEL_MASK GENMASK(2, 0)
+
+/* BSTCTR1:0x04 */
+#define AW99703_BSTCTR1_OVPSEL_MASK GENMASK(4, 2)
+#define AW99703_BSTCTR1_OCPSEL_MASK GENMASK(1, 0)
+
+/* BSTCTR2:0x05 */
+#define AW99703_BSTCTR2_IDCTSEL_MASK BIT(6)
+#define AW99703_REG_BSTCTR2 0x05
+
+/* TURNCFG:0x09 */
+#define AW99703_TURNCFG_ON_TIM_MASK GENMASK(7, 4)
+#define AW99703_TURNCFG_OFF_TIM_MASK GENMASK(3, 0)
+
+#define MAX_BRIGHTNESS (2047)
+
+struct aw99703_data {
+ struct device *dev;
+ struct regmap *regmap;
+ struct regulator *vin;
+ unsigned int brightness;
+ bool enable;
+ u8 pwm_cfg;
+ u8 full_scale_current;
+ struct gpio_desc *hwen_gpio;
+ const char *label;
+ u8 ovp_level;
+ u8 ocp_level;
+ u8 auto_freq_high;
+ u8 auto_freq_low;
+ u8 full_scale_led;
+ u8 channel_mask;
+ u8 map_type;
+ u8 inductor;
+
+ struct backlight_device *bl_dev;
+};
+
+static int aw99703_set_channel_mask(struct aw99703_data *drvdata)
+{
+ int ret = 0;
+ unsigned int val = FIELD_PREP(AW99703_LEDCUR_CHANNEL_MASK, drvdata->channel_mask);
+
+ ret = regmap_update_bits(drvdata->regmap,
+ AW99703_REG_LEDCUR,
+ AW99703_LEDCUR_CHANNEL_MASK,
+ val);
+
+ return ret;
+}
+
+static int aw99703_i2c_mode_enable(struct aw99703_data *drvdata)
+{
+ unsigned int v = FIELD_PREP(AW99703_MODE_PDIS_MASK, 1);
+
+ return regmap_update_bits(drvdata->regmap, AW99703_REG_MODE,
+ AW99703_MODE_PDIS_MASK,
+ v);
+}
+
+static int aw99703_set_ovp_level(struct aw99703_data *drvdata)
+{
+ unsigned int v;
+
+ v = FIELD_PREP(AW99703_BSTCTR1_OVPSEL_MASK, drvdata->ovp_level);
+
+ return regmap_update_bits(drvdata->regmap,
+ AW99703_REG_BSTCTR1,
+ AW99703_BSTCTR1_OVPSEL_MASK, v);
+}
+
+static int aw99703_set_ocp_level(struct aw99703_data *drvdata)
+{
+ unsigned int v = FIELD_PREP(AW99703_BSTCTR1_OCPSEL_MASK,
+ drvdata->ocp_level);
+
+ return regmap_update_bits(drvdata->regmap,
+ AW99703_REG_BSTCTR1,
+ AW99703_BSTCTR1_OCPSEL_MASK,
+ v);
+}
+
+static int aw99703_set_full_scale_cur(struct aw99703_data *drvdata)
+{
+ unsigned int v = FIELD_PREP(AW99703_LEDCUR_BLFS_MASK,
+ drvdata->full_scale_current);
+
+ return regmap_update_bits(drvdata->regmap,
+ AW99703_REG_LEDCUR,
+ AW99703_LEDCUR_BLFS_MASK,
+ v);
+}
+
+static int aw99703_set_work_mode(struct aw99703_data *drvdata, int work_mode)
+{
+ int v = FIELD_PREP(AW99703_MODE_WORKMODE_MASK,
+ work_mode);
+
+ return regmap_update_bits(drvdata->regmap,
+ AW99703_REG_MODE,
+ AW99703_MODE_WORKMODE_MASK,
+ v);
+}
+
+static int aw99703_set_inductor(struct aw99703_data *drvdata)
+{
+ int v = FIELD_PREP(AW99703_BSTCTR2_IDCTSEL_MASK, drvdata->inductor);
+
+ return regmap_update_bits(drvdata->regmap,
+ AW99703_REG_BSTCTR2,
+ AW99703_BSTCTR2_IDCTSEL_MASK,
+ v);
+}
+
+static int aw99703_set_map_type(struct aw99703_data *drvdata)
+{
+ unsigned int v = FIELD_PREP(AW99703_MODE_MAP_MASK, drvdata->map_type);
+
+ return regmap_update_bits(drvdata->regmap,
+ AW99703_REG_MODE,
+ AW99703_MODE_MAP_MASK,
+ v);
+}
+
+static int aw99703_set_fade(struct aw99703_data *drvdata)
+{
+ /* set 0x200 ms off/on time */
+ unsigned int v = FIELD_PREP(AW99703_TURNCFG_ON_TIM_MASK, 10) |
+ FIELD_PREP(AW99703_TURNCFG_OFF_TIM_MASK, 10);
+
+ return regmap_update_bits(drvdata->regmap, AW99703_REG_TURNCFG,
+ AW99703_TURNCFG_ON_TIM_MASK |
+ AW99703_TURNCFG_OFF_TIM_MASK,
+ v);
+}
+
+static int aw99703_backlight_init(struct aw99703_data *drvdata)
+{
+ int r;
+
+ r = aw99703_set_ovp_level(drvdata);
+ if (r)
+ return r;
+
+ r = aw99703_set_ocp_level(drvdata);
+ if (r)
+ return r;
+
+ r = aw99703_set_full_scale_cur(drvdata);
+ if (r)
+ return r;
+
+ r = aw99703_set_channel_mask(drvdata);
+ if (r)
+ return r;
+
+ r = aw99703_set_inductor(drvdata);
+ if (r)
+ return r;
+
+ r = aw99703_i2c_mode_enable(drvdata);
+ if (r)
+ return r;
+
+ r = aw99703_set_map_type(drvdata);
+ if (r)
+ return r;
+
+ r = aw99703_set_fade(drvdata);
+ return 0;
+}
+
+static int aw99703_set_brightness(struct aw99703_data *drvdata, int brt_val)
+{
+ int ret;
+
+ if (!drvdata->enable && brt_val > 0) {
+ ret = pm_runtime_resume_and_get(drvdata->dev);
+ if (ret < 0)
+ return ret;
+
+ drvdata->enable = true;
+ }
+
+ if (brt_val > 0) {
+ regmap_write(drvdata->regmap,
+ AW99703_REG_LEDLSB,
+ brt_val & 0x07);
+ regmap_write(drvdata->regmap,
+ AW99703_REG_LEDMSB,
+ (brt_val >> 3) & 0xff);
+ regmap_update_bits(drvdata->regmap,
+ AW99703_REG_MODE,
+ AW99703_MODE_WORKMODE_MASK,
+ AW99703_MODE_WORKMODE_BACKLIGHT);
+ } else {
+ regmap_update_bits(drvdata->regmap,
+ AW99703_REG_MODE,
+ AW99703_MODE_WORKMODE_MASK,
+ AW99703_MODE_WORKMODE_STANDBY);
+ }
+
+ drvdata->brightness = brt_val;
+
+ if (drvdata->brightness == 0) {
+ /* Give the fade out mechanism in the chip some time to dim down. */
+ if (drvdata->enable)
+ pm_runtime_put_autosuspend(drvdata->dev);
+
+ drvdata->enable = false;
+ }
+
+ return 0;
+}
+
+static int aw99703_bl_update_status(struct backlight_device *bl_dev)
+{
+ struct aw99703_data *drvdata = bl_get_data(bl_dev);
+ int brt;
+
+ brt = backlight_get_brightness(bl_dev);
+
+ return aw99703_set_brightness(drvdata, brt);
+}
+
+static const struct backlight_ops aw99703_bl_ops = {
+ .update_status = aw99703_bl_update_status,
+};
+
+static const struct regmap_config aw99703_regmap_config = {
+ .reg_bits = 8,
+ .val_bits = 8,
+ .max_register = AW99703_REG_MAX,
+};
+
+static void parse_dt_prop_list(struct device *dev, const char *name, u32 def,
+ const u32 *values, u8 num_values,
+ u8 *dest, int *err)
+{
+ int ret;
+ u32 dt_val;
+ u8 i;
+
+ if (*err)
+ return;
+
+ ret = device_property_read_u32(dev, name, &dt_val);
+ if (ret < 0)
+ dt_val = def;
+
+ for (i = 0; i < num_values; i++)
+ if (values[i] == dt_val) {
+ *dest = i;
+ return;
+ }
+
+ *err = -EINVAL;
+ dev_err_probe(dev, *err, "invalid value for prop %s\n", name);
+}
+
+#define PARSE_DT_LIST(name, def, values, dest, err) \
+ parse_dt_prop_list(dev, name, def, values, ARRAY_SIZE(values), dest, err)
+
+static const u32 ovp_level_vals[] = {17500000, 24000000, 310000000, 38000000, 41500000};
+static const u32 ocp_level_vals[] = {900000, 1800000, 2700000, 3400000};
+/* auto freq high/low */
+static const u32 channel_mask_vals[] = {0, 1, 2, 3, 4, 5, 6, 7};
+static const u32 map_type_vals[] = {0, 1};
+static const u32 henry_vals[] = {4700, 10000};
+
+static int aw99703_get_dt_data(struct aw99703_data *drvdata)
+{
+ int rc = 0;
+ u32 dtval;
+ struct device *dev = drvdata->dev;
+
+ PARSE_DT_LIST("awinic,ovp-microvolt", 38000000, ovp_level_vals, &drvdata->ovp_level, &rc);
+ PARSE_DT_LIST("awinic,ocp-microamp", 2700000, ocp_level_vals, &drvdata->ocp_level, &rc);
+ PARSE_DT_LIST("awinic,inductor-nanohenry", 4700, henry_vals, &drvdata->inductor, &rc);
+
+ if (rc < 0)
+ return rc;
+
+ if (device_property_read_u32(dev, "awinic,iled-max-microamp", &dtval) < 0)
+ dtval = 20000;
+
+ if ((dtval % 800) || dtval < 4800 || dtval > 29600)
+ return dev_err_probe(dev, -EINVAL, "invalid value for max current\n");
+
+ drvdata->full_scale_current = dtval / 800 - 6;
+
+ PARSE_DT_LIST("awinic,channel-mask", 7, channel_mask_vals, &drvdata->channel_mask, &rc);
+ PARSE_DT_LIST("awinic,map-type", 0, map_type_vals, &drvdata->map_type, &rc);
+ if (device_property_read_string(dev, "label", &drvdata->label) < 0)
+ drvdata->label = dev_name(dev);
+
+ return rc;
+}
+
+static int aw99703_probe(struct i2c_client *client)
+{
+ struct aw99703_data *drvdata;
+ struct backlight_device *bl_dev;
+ struct backlight_properties props = {};
+ int ret = 0;
+
+ drvdata = devm_kzalloc(&client->dev, sizeof(struct aw99703_data),
+ GFP_KERNEL);
+ if (!drvdata)
+ return -ENOMEM;
+
+ drvdata->dev = &client->dev;
+ drvdata->brightness = 0;
+ drvdata->enable = false;
+ aw99703_get_dt_data(drvdata);
+ i2c_set_clientdata(client, drvdata);
+
+ drvdata->regmap = devm_regmap_init_i2c(client, &aw99703_regmap_config);
+ if (IS_ERR(drvdata->regmap))
+ return dev_err_probe(&client->dev, PTR_ERR(drvdata->regmap),
+ "Failed to init regmap\n");
+
+ drvdata->hwen_gpio = devm_gpiod_get_optional(&client->dev, "enable",
+ GPIOD_OUT_LOW);
+ if (IS_ERR(drvdata->hwen_gpio))
+ return dev_err_probe(&client->dev,
+ PTR_ERR(drvdata->vin),
+ "Failed to get gpio\n");
+
+ drvdata->vin = devm_regulator_get(&client->dev, "vin");
+ if (IS_ERR(drvdata->vin))
+ return dev_err_probe(&client->dev,
+ PTR_ERR(drvdata->vin),
+ "Failed to get regulator\n");
+
+ props.type = BACKLIGHT_RAW;
+ props.scale = drvdata->map_type ? BACKLIGHT_SCALE_LINEAR :
+ BACKLIGHT_SCALE_NON_LINEAR;
+ props.max_brightness = MAX_BRIGHTNESS;
+
+ pm_runtime_set_autosuspend_delay(&client->dev, 3000);
+ pm_runtime_use_autosuspend(&client->dev);
+ ret = devm_pm_runtime_enable(&client->dev);
+ if (ret)
+ return ret;
+
+ bl_dev = devm_backlight_device_register(&client->dev,
+ drvdata->label,
+ &client->dev, drvdata,
+ &aw99703_bl_ops, &props);
+ if (IS_ERR(bl_dev))
+ return dev_err_probe(&client->dev, PTR_ERR(bl_dev),
+ "Failed to register backlight!\n");
+
+ return 0;
+}
+
+static int aw99703_runtime_suspend(struct device *dev)
+{
+ struct aw99703_data *drvdata = dev_get_drvdata(dev);
+ int ret;
+
+ aw99703_set_work_mode(drvdata, 0);
+
+ ret = gpiod_set_value_cansleep(drvdata->hwen_gpio, 0);
+ if (ret < 0)
+ return ret;
+
+ ret = regulator_disable(drvdata->vin);
+ if (ret < 0) {
+ ret = gpiod_set_value_cansleep(drvdata->hwen_gpio, 1);
+ return ret;
+ }
+
+ return 0;
+}
+
+static int aw99703_runtime_resume(struct device *dev)
+{
+ struct aw99703_data *drvdata = dev_get_drvdata(dev);
+ int ret;
+
+ ret = regulator_enable(drvdata->vin);
+ if (ret < 0)
+ return ret;
+
+ ret = gpiod_set_value_cansleep(drvdata->hwen_gpio, 1);
+ if (ret < 0) {
+ ret = regulator_disable(drvdata->vin);
+ return ret;
+ }
+
+ usleep_range(250, 1000);
+
+ aw99703_backlight_init(drvdata);
+ aw99703_set_brightness(drvdata, drvdata->brightness);
+ return 0;
+}
+
+static const struct dev_pm_ops aw99703_pm_ops = {
+ SET_RUNTIME_PM_OPS(aw99703_runtime_suspend, aw99703_runtime_resume, NULL)
+ SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
+};
+
+static const struct i2c_device_id aw99703_id[] = {
+ { "aw99703", 0},
+ { }
+};
+MODULE_DEVICE_TABLE(i2c, aw99703_id);
+
+static const struct of_device_id match_table[] = {
+ {.compatible = "awinic,aw99703"},
+ { }
+};
+MODULE_DEVICE_TABLE(of, match_table);
+
+static struct i2c_driver aw99703_i2c_driver = {
+ .probe = aw99703_probe,
+ .id_table = aw99703_id,
+ .driver = {
+ .name = "aw99703",
+ .of_match_table = match_table,
+ .pm = &aw99703_pm_ops,
+ },
+};
+
+module_i2c_driver(aw99703_i2c_driver);
+MODULE_DESCRIPTION("Backlight driver for aw99703");
+MODULE_LICENSE("GPL");
+
--
2.47.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/4] ARM: dts: imx: Add backlight for Kobo Clara 2e
2026-11-30 19:08 [PATCH 0/4] video: backlight: Backlight for Kobo Clara 2e Andreas Kemnade
2026-11-30 19:08 ` [PATCH 1/4] dt-bindings: leds: backlight: Add Awinic AW99703 backlight Andreas Kemnade
2026-11-30 19:08 ` [PATCH 2/4] video: backlight: Add Awinic AW99703 Andreas Kemnade
@ 2026-11-30 19:08 ` Andreas Kemnade
2026-11-30 19:32 ` sashiko-bot
2026-11-30 19:08 ` [PATCH 4/4] arm: mach-imx: enable shared gpios Andreas Kemnade
3 siblings, 1 reply; 10+ messages in thread
From: Andreas Kemnade @ 2026-11-30 19:08 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek,
Griffin Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Helge Deller, Frank Li, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Russell King
Cc: dri-devel, linux-leds, devicetree, linux-kernel, linux-fbdev, imx,
linux-arm-kernel, Andreas Kemnade
Describe the backlights for Kobo Clara 2e. The device has two backlights
with different color temperature.
Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
.../dts/nxp/imx/imx6sll-kobo-clara2e-common.dtsi | 34 ++++++++++++++++++++--
1 file changed, 32 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/nxp/imx/imx6sll-kobo-clara2e-common.dtsi b/arch/arm/boot/dts/nxp/imx/imx6sll-kobo-clara2e-common.dtsi
index 6f2deb366e029..6b60c94e21579 100644
--- a/arch/arm/boot/dts/nxp/imx/imx6sll-kobo-clara2e-common.dtsi
+++ b/arch/arm/boot/dts/nxp/imx/imx6sll-kobo-clara2e-common.dtsi
@@ -53,6 +53,14 @@ memory@80000000 {
reg = <0x80000000 0x20000000>;
};
+ reg_bl: regulator-backlight {
+ compatible = "regulator-fixed";
+ regulator-name = "bl_power";
+ gpio = <&gpio5 13 GPIO_ACTIVE_HIGH>;
+ startup-delay-us = <20000>;
+ enable-active-high;
+ };
+
reg_wifi: regulator-wifi {
compatible = "regulator-fixed";
regulator-name = "SD3_SPWR";
@@ -80,7 +88,18 @@ &i2c1 {
clock-frequency = <100000>;
status = "okay";
- /* backlight aw99703 at 0x36 */
+ backlight@36 {
+ compatible = "awinic,aw99703";
+ reg = <0x36>;
+ vin-supply = <®_bl>;
+ enable-gpios = <&gpio2 10 GPIO_ACTIVE_HIGH>;
+ label = "cold";
+
+ awinic,ovp-microvolt = <24000000>;
+ awinic,ocp-microamp = <900000>;
+ awinic,channel-mask = <1>;
+ awinic,inductor-nanohenry = <10000>;
+ };
};
&i2c2 {
@@ -90,7 +109,18 @@ &i2c2 {
clock-frequency = <100000>;
status = "okay";
- /* backlight aw99703 at 0x36 */
+ backlight@36 {
+ compatible = "awinic,aw99703";
+ reg = <0x36>;
+ vin-supply = <®_bl>;
+ enable-gpios = <&gpio2 10 GPIO_ACTIVE_HIGH>;
+ label = "warm";
+
+ awinic,ovp-microvolt = <24000000>;
+ awinic,ocp-microamp = <900000>;
+ awinic,channel-mask = <1>;
+ awinic,inductor-nanohenry = <10000>;
+ };
touchscreen@38 {
compatible = "focaltech,ft5426";
--
2.47.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/4] arm: mach-imx: enable shared gpios
2026-11-30 19:08 [PATCH 0/4] video: backlight: Backlight for Kobo Clara 2e Andreas Kemnade
` (2 preceding siblings ...)
2026-11-30 19:08 ` [PATCH 3/4] ARM: dts: imx: Add backlight for Kobo Clara 2e Andreas Kemnade
@ 2026-11-30 19:08 ` Andreas Kemnade
3 siblings, 0 replies; 10+ messages in thread
From: Andreas Kemnade @ 2026-11-30 19:08 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek,
Griffin Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Helge Deller, Frank Li, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Russell King
Cc: dri-devel, linux-leds, devicetree, linux-kernel, linux-fbdev, imx,
linux-arm-kernel, Andreas Kemnade
Backlights of Kobo Clara 2e use a shared enable.
Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
arch/arm/mach-imx/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 3f0521c652cb0..67b1e9e4dd743 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -10,6 +10,7 @@ menuconfig ARCH_MXC
select PM_OPP if PM
select SOC_BUS
select SRAM
+ select HAVE_SHARED_GPIOS
help
Support for Freescale MXC/iMX-based family of processors
--
2.47.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/4] dt-bindings: leds: backlight: Add Awinic AW99703 backlight
2026-11-30 19:08 ` [PATCH 1/4] dt-bindings: leds: backlight: Add Awinic AW99703 backlight Andreas Kemnade
@ 2026-11-30 19:16 ` sashiko-bot
2026-11-30 20:21 ` Frank Li
0 siblings, 1 reply; 10+ messages in thread
From: sashiko-bot @ 2026-11-30 19:16 UTC (permalink / raw)
To: Andreas Kemnade
Cc: dri-devel, linux-leds, devicetree, imx, robh, conor+dt, Frank.Li,
lee
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] dt-bindings: leds: backlight: aw99703: invalid default for
awinic,ovp-microvolt
- [Medium] dt-bindings: leds: backlight: aw99703: typo 34000000 in
awinic,ocp-microamp enum
--
commit 58bb4029f54ecea50b107838df2d9b077b16d4f3
Author: Andreas Kemnade <andreas@kemnade.info>
dt-bindings: leds: backlight: Add Awinic AW99703 backlight
This commit adds the Device Tree binding schema for the Awinic AW99703
3-channel WLED backlight driver.
> diff --git a/Documentation/devicetree/bindings/leds/backlight/awinic,aw99703.yaml b/Documentation/devicetree/bindings/leds/backlight/awinic,aw99703.yaml
> new file mode 100644
> index 0000000000000..74214a1760622
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/leds/backlight/awinic,aw99703.yaml
> @@ -0,0 +1,96 @@
[ ... ]
> + awinic,ovp-microvolt:
> + enum: [ 17500000, 24000000, 31000000, 38000000, 41500000 ]
> + default: 38000
[Severity: Medium]
Should the default for awinic,ovp-microvolt be 38000000 instead of 38000?
38000 is not in the enum list and causes dt_binding_check to fail. This
vendor property is also missing a description field.
> +
> + awinic,ocp-microamp:
> + enum: [ 900000, 1800000, 2700000, 34000000 ]
> + default: 2700000
[Severity: Medium]
Should the fourth enum value for awinic,ocp-microamp be 3400000 (3.4 A)
instead of 34000000 (34 A)? The driver expects 3400000, so a board DT
using 3.4 A will either fail dtbs_check with 3400000 or fail to probe
with -EINVAL if set to 34000000. This vendor property is also missing a
description field.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261130-bl-aw99703-upstr-v1-0-986a15505ad7@kemnade.info?part=1
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/4] video: backlight: Add Awinic AW99703
2026-11-30 19:08 ` [PATCH 2/4] video: backlight: Add Awinic AW99703 Andreas Kemnade
@ 2026-11-30 19:24 ` sashiko-bot
2026-11-30 20:18 ` Frank Li
0 siblings, 1 reply; 10+ messages in thread
From: sashiko-bot @ 2026-11-30 19:24 UTC (permalink / raw)
To: Andreas Kemnade
Cc: dri-devel, linux-leds, devicetree, imx, robh, conor+dt, Frank.Li,
lee
Thank you for your contribution! Sashiko AI review found 11 potential
issues to consider:
- [High] backlight: aw99703: wrong pointer in PTR_ERR() in
aw99703_probe()
- [Medium] backlight: aw99703: extra zero typo in ovp_level_vals[] table
- [Medium] backlight: aw99703: unchecked aw99703_get_dt_data() in
aw99703_probe()
- [Medium] backlight: aw99703: error code overwritten in runtime PM
rollback paths
- [Medium] backlight: aw99703: ignored error returns in init, resume,
and brightness
- [Medium] backlight: aw99703: I2C access while suspended in
aw99703_set_brightness()
- [Medium] backlight: aw99703: PM state desync and unlocked resume in
aw99703_set_brightness()
- [Medium] backlight: aw99703: leaked PM and vin regulator enable on
active driver unbind
- [Medium] backlight: aw99703: SET_RUNTIME_PM_OPS() without pm_ptr()
breaks !CONFIG_PM
- [Low] backlight: aw99703: recursive standby write in
aw99703_set_brightness() on resume
- [Low] backlight: aw99703: positional i2c_device_id initializer and
dead struct fields
--
commit 51c0fed1822f97f21afb605fb72c99f1142b6097
Author: Andreas Kemnade <andreas@kemnade.info>
video: backlight: Add Awinic AW99703
This commit adds an I2C backlight driver for the Awinic AW99703 LED
controller using regmap and runtime PM.
> diff --git a/drivers/video/backlight/aw99703.c b/drivers/video/backlight/aw99703.c
> new file mode 100644
> index 0000000000000..3491895e9ac82
> --- /dev/null
> +++ b/drivers/video/backlight/aw99703.c
> @@ -0,0 +1,471 @@
[ ... ]
> +static int aw99703_backlight_init(struct aw99703_data *drvdata)
> +{
> + int r;
> +
> + r = aw99703_set_ovp_level(drvdata);
> + if (r)
> + return r;
> +
> + r = aw99703_set_ocp_level(drvdata);
> + if (r)
> + return r;
> +
> + r = aw99703_set_full_scale_cur(drvdata);
> + if (r)
> + return r;
> +
> + r = aw99703_set_channel_mask(drvdata);
> + if (r)
> + return r;
> +
> + r = aw99703_set_inductor(drvdata);
> + if (r)
> + return r;
> +
> + r = aw99703_i2c_mode_enable(drvdata);
> + if (r)
> + return r;
> +
> + r = aw99703_set_map_type(drvdata);
> + if (r)
> + return r;
> +
> + r = aw99703_set_fade(drvdata);
> + return 0;
> +}
[Severity: Medium]
Should aw99703_backlight_init() return r here instead of 0? Also, neither
aw99703_set_brightness() nor aw99703_runtime_resume() checks the return
values of their regmap and helper calls, so I2C errors during resume or
brightness updates are silently dropped while drvdata->brightness and
drvdata->enable are updated as if the writes succeeded.
> +
> +static int aw99703_set_brightness(struct aw99703_data *drvdata, int brt_val)
> +{
> + int ret;
> +
> + if (!drvdata->enable && brt_val > 0) {
> + ret = pm_runtime_resume_and_get(drvdata->dev);
> + if (ret < 0)
> + return ret;
> +
> + drvdata->enable = true;
> + }
[Severity: Low]
Because pm_runtime_resume_and_get() runs before drvdata->brightness is
updated at the bottom of aw99703_set_brightness(),
aw99703_runtime_resume() re-enters aw99703_set_brightness() with the stale
drvdata->brightness == 0. Every resume from brightness 0 therefore writes
AW99703_MODE_WORKMODE_STANDBY to AW99703_REG_MODE right before the outer
call writes LEDLSB, LEDMSB, and AW99703_MODE_WORKMODE_BACKLIGHT.
> +
> + if (brt_val > 0) {
> + regmap_write(drvdata->regmap,
> + AW99703_REG_LEDLSB,
> + brt_val & 0x07);
> + regmap_write(drvdata->regmap,
> + AW99703_REG_LEDMSB,
> + (brt_val >> 3) & 0xff);
> + regmap_update_bits(drvdata->regmap,
> + AW99703_REG_MODE,
> + AW99703_MODE_WORKMODE_MASK,
> + AW99703_MODE_WORKMODE_BACKLIGHT);
> + } else {
> + regmap_update_bits(drvdata->regmap,
> + AW99703_REG_MODE,
> + AW99703_MODE_WORKMODE_MASK,
> + AW99703_MODE_WORKMODE_STANDBY);
> + }
[Severity: Medium]
Does calling aw99703_set_brightness(drvdata, 0) when drvdata->enable is
false perform an I2C transfer to an unpowered chip?
When the backlight is initially off after probe or has autosuspended,
drvdata->enable is false, drvdata->vin is disabled, and drvdata->hwen_gpio
is low. A blanking event or writing 0 to brightness skips
pm_runtime_resume_and_get() and runs regmap_update_bits() on
AW99703_REG_MODE without holding a runtime PM reference.
[ ... ]
> +#define PARSE_DT_LIST(name, def, values, dest, err) \
> + parse_dt_prop_list(dev, name, def, values, ARRAY_SIZE(values), dest, err)
> +
> +static const u32 ovp_level_vals[] = {17500000, 24000000, 310000000, 38000000, 41500000};
[Severity: Medium]
Does ovp_level_vals[2] have an extra zero (310000000 instead of 31000000)?
A device tree setting awinic,ovp-microvolt = <31000000> for the 31 V
threshold will be rejected with -EINVAL by parse_dt_prop_list().
[ ... ]
> +static int aw99703_probe(struct i2c_client *client)
> +{
> + struct aw99703_data *drvdata;
> + struct backlight_device *bl_dev;
> + struct backlight_properties props = {};
> + int ret = 0;
> +
> + drvdata = devm_kzalloc(&client->dev, sizeof(struct aw99703_data),
> + GFP_KERNEL);
> + if (!drvdata)
> + return -ENOMEM;
> +
> + drvdata->dev = &client->dev;
> + drvdata->brightness = 0;
> + drvdata->enable = false;
> + aw99703_get_dt_data(drvdata);
[Severity: Medium]
Should aw99703_probe() check and return the error from
aw99703_get_dt_data()?
If an early property check in aw99703_get_dt_data() fails and returns
-EINVAL, drvdata->channel_mask and drvdata->label are never initialized,
so probe continues with all LED channels masked off and registers the
backlight device with a NULL name.
> + i2c_set_clientdata(client, drvdata);
> +
> + drvdata->regmap = devm_regmap_init_i2c(client, &aw99703_regmap_config);
> + if (IS_ERR(drvdata->regmap))
> + return dev_err_probe(&client->dev, PTR_ERR(drvdata->regmap),
> + "Failed to init regmap\n");
> +
> + drvdata->hwen_gpio = devm_gpiod_get_optional(&client->dev, "enable",
> + GPIOD_OUT_LOW);
> + if (IS_ERR(drvdata->hwen_gpio))
> + return dev_err_probe(&client->dev,
> + PTR_ERR(drvdata->vin),
> + "Failed to get gpio\n");
[Severity: High]
Does this pass PTR_ERR(drvdata->vin) instead of PTR_ERR(drvdata->hwen_gpio)?
Because drvdata->vin is still NULL here, dev_err_probe() returns 0 on GPIO
errors (including -EPROBE_DEFER), leaving the device bound without a
regulator, runtime PM enabled, or a registered backlight device.
> +
> + drvdata->vin = devm_regulator_get(&client->dev, "vin");
> + if (IS_ERR(drvdata->vin))
> + return dev_err_probe(&client->dev,
> + PTR_ERR(drvdata->vin),
> + "Failed to get regulator\n");
> +
> + props.type = BACKLIGHT_RAW;
> + props.scale = drvdata->map_type ? BACKLIGHT_SCALE_LINEAR :
> + BACKLIGHT_SCALE_NON_LINEAR;
> + props.max_brightness = MAX_BRIGHTNESS;
> +
> + pm_runtime_set_autosuspend_delay(&client->dev, 3000);
> + pm_runtime_use_autosuspend(&client->dev);
> + ret = devm_pm_runtime_enable(&client->dev);
[Severity: Medium]
Does unbinding the driver while the device is runtime-active leak the
drvdata->vin enable reference and trigger WARN_ON(regulator->enable_count)
in _regulator_put()?
When brightness > 0 (or during the 3000 ms autosuspend delay after setting
brightness to 0), the device holds an active runtime PM reference and
drvdata->vin is enabled. On unbind, devm_pm_runtime_enable() disables
runtime PM without calling aw99703_runtime_suspend(), and
devm_regulator_get() then releases drvdata->vin while it is still enabled.
[ ... ]
> +static int aw99703_runtime_suspend(struct device *dev)
> +{
> + struct aw99703_data *drvdata = dev_get_drvdata(dev);
> + int ret;
> +
> + aw99703_set_work_mode(drvdata, 0);
> +
> + ret = gpiod_set_value_cansleep(drvdata->hwen_gpio, 0);
> + if (ret < 0)
> + return ret;
> +
> + ret = regulator_disable(drvdata->vin);
> + if (ret < 0) {
> + ret = gpiod_set_value_cansleep(drvdata->hwen_gpio, 1);
> + return ret;
> + }
> +
> + return 0;
> +}
> +
> +static int aw99703_runtime_resume(struct device *dev)
> +{
> + struct aw99703_data *drvdata = dev_get_drvdata(dev);
> + int ret;
> +
> + ret = regulator_enable(drvdata->vin);
> + if (ret < 0)
> + return ret;
> +
> + ret = gpiod_set_value_cansleep(drvdata->hwen_gpio, 1);
> + if (ret < 0) {
> + ret = regulator_disable(drvdata->vin);
> + return ret;
> + }
[Severity: Medium]
Do the error rollback paths in aw99703_runtime_suspend() and
aw99703_runtime_resume() overwrite ret with the rollback call's return
value?
When regulator_disable() fails in aw99703_runtime_suspend() (or
gpiod_set_value_cansleep() fails in aw99703_runtime_resume()) and the
rollback call succeeds, the callback returns 0 to the PM core, leaving the
runtime PM state out of sync with drvdata->vin and skipping
aw99703_backlight_init() on resume.
> +
> + usleep_range(250, 1000);
> +
> + aw99703_backlight_init(drvdata);
> + aw99703_set_brightness(drvdata, drvdata->brightness);
> + return 0;
> +}
> +
> +static const struct dev_pm_ops aw99703_pm_ops = {
> + SET_RUNTIME_PM_OPS(aw99703_runtime_suspend, aw99703_runtime_resume, NULL)
> + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
> +};
[Severity: Medium]
Can system suspend/resume desynchronize drvdata->enable from the hardware
power state, and can aw99703_runtime_resume() race with
aw99703_bl_update_status()?
pm_runtime_force_suspend() runs aw99703_runtime_suspend() and disables
drvdata->vin without clearing drvdata->enable, and the backlight device is
registered without BL_CORE_SUSPENDRESUME. If a display driver updates the
backlight while the I2C device is force-suspended, aw99703_set_brightness()
sees drvdata->enable == true, skips pm_runtime_resume_and_get(), and issues
I2C writes while drvdata->vin is off (or if brt_val == 0, clears
drvdata->enable while dev->power.needs_force_resume remains set).
In addition, aw99703_runtime_resume() reads drvdata->brightness and calls
aw99703_set_brightness() without holding bl_dev->update_lock.
> +
> +static const struct i2c_device_id aw99703_id[] = {
> + { "aw99703", 0},
> + { }
> +};
[Severity: Low]
This isn't a bug, but new struct i2c_device_id entries should use named
initializers (e.g. { .name = "aw99703" }). Also, struct aw99703_data has
several unused members (pwm_cfg, auto_freq_high, auto_freq_low,
full_scale_led, and bl_dev), and <linux/input.h> and <linux/version.h> are
unused.
> +MODULE_DEVICE_TABLE(i2c, aw99703_id);
> +
> +static const struct of_device_id match_table[] = {
> + {.compatible = "awinic,aw99703"},
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, match_table);
> +
> +static struct i2c_driver aw99703_i2c_driver = {
> + .probe = aw99703_probe,
> + .id_table = aw99703_id,
> + .driver = {
> + .name = "aw99703",
> + .of_match_table = match_table,
> + .pm = &aw99703_pm_ops,
> + },
> +};
[Severity: Medium]
Does building with !CONFIG_PM warn on unused aw99703_runtime_suspend() and
aw99703_runtime_resume() and leave the hardware unpowered at runtime?
SET_RUNTIME_PM_OPS() compiles out when CONFIG_PM is disabled, while
.driver.pm is not wrapped with pm_ptr() and aw99703_pm_ops does not use
RUNTIME_PM_OPS() / SYSTEM_SLEEP_PM_OPS(). Also, when !CONFIG_PM,
pm_runtime_resume_and_get() is a no-op returning 0, so
aw99703_runtime_resume() never runs to enable drvdata->vin, assert
drvdata->hwen_gpio, or call aw99703_backlight_init().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261130-bl-aw99703-upstr-v1-0-986a15505ad7@kemnade.info?part=2
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/4] ARM: dts: imx: Add backlight for Kobo Clara 2e
2026-11-30 19:08 ` [PATCH 3/4] ARM: dts: imx: Add backlight for Kobo Clara 2e Andreas Kemnade
@ 2026-11-30 19:32 ` sashiko-bot
0 siblings, 0 replies; 10+ messages in thread
From: sashiko-bot @ 2026-11-30 19:32 UTC (permalink / raw)
To: Andreas Kemnade
Cc: dri-devel, linux-leds, devicetree, imx, robh, conor+dt, Frank.Li,
lee
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] ARM: dts: imx: missing IOMUXC pinmux for Kobo Clara 2E
backlight GPIOs
--
commit ebce1ef7c96a74606867ed907a6a2fdadf34c40a
Author: Andreas Kemnade <andreas@kemnade.info>
ARM: dts: imx: Add backlight for Kobo Clara 2e
This commit adds the fixed power regulator and the two aw99703 backlight
nodes for the Kobo Clara 2e device tree.
> diff --git a/arch/arm/boot/dts/nxp/imx/imx6sll-kobo-clara2e-common.dtsi b/arch/arm/boot/dts/nxp/imx/imx6sll-kobo-clara2e-common.dtsi
> index 6f2deb366e029..6b60c94e21579 100644
> --- a/arch/arm/boot/dts/nxp/imx/imx6sll-kobo-clara2e-common.dtsi
> +++ b/arch/arm/boot/dts/nxp/imx/imx6sll-kobo-clara2e-common.dtsi
> @@ -53,6 +53,14 @@ memory@80000000 {
> reg = <0x80000000 0x20000000>;
> };
>
> + reg_bl: regulator-backlight {
> + compatible = "regulator-fixed";
> + regulator-name = "bl_power";
> + gpio = <&gpio5 13 GPIO_ACTIVE_HIGH>;
> + startup-delay-us = <20000>;
> + enable-active-high;
> + };
> +
> reg_wifi: regulator-wifi {
> compatible = "regulator-fixed";
> regulator-name = "SD3_SPWR";
> @@ -80,7 +88,18 @@ &i2c1 {
> clock-frequency = <100000>;
> status = "okay";
>
> - /* backlight aw99703 at 0x36 */
> + backlight@36 {
> + compatible = "awinic,aw99703";
> + reg = <0x36>;
> + vin-supply = <®_bl>;
> + enable-gpios = <&gpio2 10 GPIO_ACTIVE_HIGH>;
> + label = "cold";
> +
> + awinic,ovp-microvolt = <24000000>;
> + awinic,ocp-microamp = <900000>;
> + awinic,channel-mask = <1>;
> + awinic,inductor-nanohenry = <10000>;
> + };
> };
>
> &i2c2 {
> @@ -90,7 +109,18 @@ &i2c2 {
> clock-frequency = <100000>;
> status = "okay";
>
> - /* backlight aw99703 at 0x36 */
> + backlight@36 {
> + compatible = "awinic,aw99703";
> + reg = <0x36>;
> + vin-supply = <®_bl>;
> + enable-gpios = <&gpio2 10 GPIO_ACTIVE_HIGH>;
> + label = "warm";
[Severity: Medium]
Are pinctrl configurations missing for the backlight GPIOs in reg_bl
(gpio5 13, MX6SLL_PAD_SD1_DATA2__GPIO5_IO13) and the backlight@36 nodes
(gpio2 10, MX6SLL_PAD_EPDC_PWR_CTRL3__GPIO2_IO10)?
On i.MX6SLL, imx_pmx_ops does not implement .gpio_request_enable, so
requesting a GPIO does not switch the IOMUXC pad mux mode to GPIO. Both
pads reset to ALT0 rather than ALT5 GPIO mode, leaving the backlight
power and enable pins unmuxed unless configured by the bootloader.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261130-bl-aw99703-upstr-v1-0-986a15505ad7@kemnade.info?part=3
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/4] video: backlight: Add Awinic AW99703
2026-11-30 19:24 ` sashiko-bot
@ 2026-11-30 20:18 ` Frank Li
0 siblings, 0 replies; 10+ messages in thread
From: Frank Li @ 2026-11-30 20:18 UTC (permalink / raw)
To: sashiko-reviews
Cc: Andreas Kemnade, dri-devel, linux-leds, devicetree, imx, robh,
conor+dt, Frank.Li, lee
On Mon, Nov 30, 2026 at 07:24:56PM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 11 potential
> issues to consider:
> - [High] backlight: aw99703: wrong pointer in PTR_ERR() in
> aw99703_probe()
> - [Medium] backlight: aw99703: extra zero typo in ovp_level_vals[] table
> - [Medium] backlight: aw99703: unchecked aw99703_get_dt_data() in
> aw99703_probe()
> - [Medium] backlight: aw99703: error code overwritten in runtime PM
> rollback paths
> - [Medium] backlight: aw99703: ignored error returns in init, resume,
> and brightness
> - [Medium] backlight: aw99703: I2C access while suspended in
> aw99703_set_brightness()
> - [Medium] backlight: aw99703: PM state desync and unlocked resume in
> aw99703_set_brightness()
> - [Medium] backlight: aw99703: leaked PM and vin regulator enable on
> active driver unbind
> - [Medium] backlight: aw99703: SET_RUNTIME_PM_OPS() without pm_ptr()
> breaks !CONFIG_PM
> - [Low] backlight: aw99703: recursive standby write in
> aw99703_set_brightness() on resume
> - [Low] backlight: aw99703: positional i2c_device_id initializer and
> dead struct fields
> --
Please these issues
Frank
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/4] dt-bindings: leds: backlight: Add Awinic AW99703 backlight
2026-11-30 19:16 ` sashiko-bot
@ 2026-11-30 20:21 ` Frank Li
0 siblings, 0 replies; 10+ messages in thread
From: Frank Li @ 2026-11-30 20:21 UTC (permalink / raw)
To: sashiko-reviews
Cc: Andreas Kemnade, dri-devel, linux-leds, devicetree, imx, robh,
conor+dt, Frank.Li, lee
On Mon, Nov 30, 2026 at 07:16:06PM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential
> issues to consider:
> - [Medium] dt-bindings: leds: backlight: aw99703: invalid default for
> awinic,ovp-microvolt
> - [Medium] dt-bindings: leds: backlight: aw99703: typo 34000000 in
> awinic,ocp-microamp enum
> --
>
> commit 58bb4029f54ecea50b107838df2d9b077b16d4f3
> Author: Andreas Kemnade <andreas@kemnade.info>
>
> dt-bindings: leds: backlight: Add Awinic AW99703 backlight
>
> This commit adds the Device Tree binding schema for the Awinic AW99703
> 3-channel WLED backlight driver.
>
> > diff --git a/Documentation/devicetree/bindings/leds/backlight/awinic,aw99703.yaml b/Documentation/devicetree/bindings/leds/backlight/awinic,aw99703.yaml
> > new file mode 100644
> > index 0000000000000..74214a1760622
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/leds/backlight/awinic,aw99703.yaml
> > @@ -0,0 +1,96 @@
>
> [ ... ]
>
> > + awinic,ovp-microvolt:
> > + enum: [ 17500000, 24000000, 31000000, 38000000, 41500000 ]
> > + default: 38000
>
> [Severity: Medium]
> Should the default for awinic,ovp-microvolt be 38000000 instead of 38000?
> 38000 is not in the enum list and causes dt_binding_check to fail. This
> vendor property is also missing a description field.
Make sense. please fix it.
>
> > +
> > + awinic,ocp-microamp:
> > + enum: [ 900000, 1800000, 2700000, 34000000 ]
> > + default: 2700000
>
> [Severity: Medium]
> Should the fourth enum value for awinic,ocp-microamp be 3400000 (3.4 A)
> instead of 34000000 (34 A)? The driver expects 3400000, so a board DT
make sense
Frank
> using 3.4 A will either fail dtbs_check with 3400000 or fail to probe
> with -EINVAL if set to 34000000. This vendor property is also missing a
> description field.
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20261130-bl-aw99703-upstr-v1-0-986a15505ad7@kemnade.info?part=1
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2026-11-30 20:21 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 19:08 [PATCH 0/4] video: backlight: Backlight for Kobo Clara 2e Andreas Kemnade
2026-11-30 19:08 ` [PATCH 1/4] dt-bindings: leds: backlight: Add Awinic AW99703 backlight Andreas Kemnade
2026-11-30 19:16 ` sashiko-bot
2026-11-30 20:21 ` Frank Li
2026-11-30 19:08 ` [PATCH 2/4] video: backlight: Add Awinic AW99703 Andreas Kemnade
2026-11-30 19:24 ` sashiko-bot
2026-11-30 20:18 ` Frank Li
2026-11-30 19:08 ` [PATCH 3/4] ARM: dts: imx: Add backlight for Kobo Clara 2e Andreas Kemnade
2026-11-30 19:32 ` sashiko-bot
2026-11-30 19:08 ` [PATCH 4/4] arm: mach-imx: enable shared gpios Andreas Kemnade
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox