[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251104-attractive-dragonfly-of-perspective-0d52d6@kuoka>
Date: Tue, 4 Nov 2025 08:36:04 +0100
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Junjie Cao <caojunjie650@...il.com>
Cc: Lee Jones <lee@...nel.org>, Daniel Thompson <danielt@...nel.org>,
Jingoo Han <jingoohan1@...il.com>, Pavel Machek <pavel@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, Helge Deller <deller@....de>,
dri-devel@...ts.freedesktop.org, linux-leds@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-fbdev@...r.kernel.org, Pengyu Luo <mitltlatltl@...il.com>
Subject: Re: [PATCH v2 2/2] backlight: aw99706: Add support for Awinic
AW99706 backlight
On Mon, Nov 03, 2025 at 07:06:48PM +0800, Junjie Cao wrote:
> +struct reg_init_data;
> +
> +struct aw99706_device {
> + struct i2c_client *client;
> + struct device *dev;
> + struct regmap *regmap;
> + struct backlight_device *bl_dev;
> + struct gpio_desc *hwen_gpio;
> + struct reg_init_data *init_tbl;
> + int init_tbl_size;
> + bool bl_enable;
> +};
> +
> +enum reg_access {
> + REG_NONE_ACCESS = 0,
> + REG_RD_ACCESS = 1,
> + REG_WR_ACCESS = 2,
> +};
> +
> +const u8 aw99706_regs[AW99706_REG_MAX + 1] = {
Why isn't this static?
> + [AW99706_CFG0_REG] = REG_RD_ACCESS | REG_WR_ACCESS,
> + [AW99706_CFG1_REG] = REG_RD_ACCESS | REG_WR_ACCESS,
> + [AW99706_CFG2_REG] = REG_RD_ACCESS | REG_WR_ACCESS,
> + [AW99706_CFG3_REG] = REG_RD_ACCESS | REG_WR_ACCESS,
> + [AW99706_CFG4_REG] = REG_RD_ACCESS | REG_WR_ACCESS,
> + [AW99706_CFG5_REG] = REG_RD_ACCESS | REG_WR_ACCESS,
> + [AW99706_CFG6_REG] = REG_RD_ACCESS | REG_WR_ACCESS,
> + [AW99706_CFG7_REG] = REG_RD_ACCESS | REG_WR_ACCESS,
> + [AW99706_CFG8_REG] = REG_RD_ACCESS | REG_WR_ACCESS,
> + [AW99706_CFG9_REG] = REG_RD_ACCESS | REG_WR_ACCESS,
> + [AW99706_CFGA_REG] = REG_RD_ACCESS | REG_WR_ACCESS,
> + [AW99706_CFGB_REG] = REG_RD_ACCESS | REG_WR_ACCESS,
> + [AW99706_CFGC_REG] = REG_RD_ACCESS | REG_WR_ACCESS,
> + [AW99706_CFGD_REG] = REG_RD_ACCESS | REG_WR_ACCESS,
> + [AW99706_FLAG_REG] = REG_RD_ACCESS,
> + [AW99706_CHIPID_REG] = REG_RD_ACCESS,
> + [AW99706_LED_OPEN_FLAG_REG] = REG_RD_ACCESS,
> + [AW99706_LED_SHORT_FLAG_REG] = REG_RD_ACCESS,
> +
> + /*
> + * Write bit is dropped here, writing BIT(0) to MTPLDOSEL will unlock
> + * Multi-time Programmable (MTP).
> + */
> + [AW99706_MTPLDOSEL_REG] = REG_RD_ACCESS,
> + [AW99706_MTPRUN_REG] = REG_NONE_ACCESS,
> +};
> +
...
> + aw = devm_kzalloc(dev, sizeof(*aw), GFP_KERNEL);
> + if (!aw)
> + return -ENOMEM;
> +
> + aw->client = client;
> + aw->dev = dev;
> + i2c_set_clientdata(client, aw);
> +
> + aw->regmap = devm_regmap_init_i2c(client, &aw99706_regmap_config);
> + if (IS_ERR(aw->regmap))
> + return dev_err_probe(dev, PTR_ERR(aw->regmap),
> + "Failed to init regmap\n");
> +
> + ret = aw99706_chip_id_read(aw);
> + if (ret != AW99706_ID)
> + return dev_err_probe(dev, ret,
> + "Failed to validate chip id\n")
Why are you exiting the probe with a positive value like 4 or 8? This
makes no sense. Registers do not coontain Linux return codes.
Best regards,
Krzysztof
Powered by blists - more mailing lists