[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z_P5uLrGiQWez0jv@aspen.lan>
Date: Mon, 7 Apr 2025 17:13:44 +0100
From: Daniel Thompson <daniel@...cstar.com>
To: Pengyu Luo <mitltlatltl@...il.com>
Cc: Jianhua Lu <lujianhua000@...il.com>, 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
Subject: Re: [PATCH 3/4] backlight: ktz8866: improve current sinks setting
On Mon, Apr 07, 2025 at 05:51:18PM +0800, Pengyu Luo wrote:
> I polled all registers when the module was loading, found that
> current sinks have already been configured. Bootloader would set
> when booting. So checking it before setting the all channels.
Can you rephrase this so the problem and solution are more clearly
expressed. Perhaps template Ingo suggests here would be good:
https://www.spinics.net/lists/kernel/msg1633438.html
> Signed-off-by: Pengyu Luo <mitltlatltl@...il.com>
> ---
> drivers/video/backlight/ktz8866.c | 23 +++++++++++++++++++----
> 1 file changed, 19 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/video/backlight/ktz8866.c b/drivers/video/backlight/ktz8866.c
> index 017ad80dd..b67ca136d 100644
> --- a/drivers/video/backlight/ktz8866.c
> +++ b/drivers/video/backlight/ktz8866.c
> @@ -46,6 +46,8 @@
> #define LCD_BIAS_EN 0x9F
> #define PWM_HYST 0x5
>
> +#define CURRENT_SINKS_MASK GENMASK(5, 0)
> +
Call this BL_EN_CURRENT_SINKS_MASK and keep it next to the register it
applies to.
> struct ktz8866_slave {
> struct i2c_client *client;
> struct regmap *regmap;
> @@ -112,11 +120,18 @@ static void ktz8866_init(struct ktz8866 *ktz)
> {
> unsigned int val = 0;
>
> - if (!of_property_read_u32(ktz->client->dev.of_node, "current-num-sinks", &val))
> + if (!of_property_read_u32(ktz->client->dev.of_node, "current-num-sinks", &val)) {
> ktz8866_write(ktz, BL_EN, BIT(val) - 1);
> - else
> - /* Enable all 6 current sinks if the number of current sinks isn't specified. */
> - ktz8866_write(ktz, BL_EN, BIT(6) - 1);
> + } else {
> + /*
> + * Enable all 6 current sinks if the number of current
> + * sinks isn't specified and the bootloader didn't set
> + * the value.
> + */
> + ktz8866_read(ktz, BL_EN, &val);
> + if (!(val && CURRENT_SINKS_MASK))
This is the wrong form of AND.
> + ktz8866_write(ktz, BL_EN, CURRENT_SINKS_MASK);
> + }
Daniel.
Powered by blists - more mailing lists