From: Daniel Thompson <daniel@riscstar.com>
To: Pengyu Luo <mitltlatltl@gmail.com>
Cc: Jianhua Lu <lujianhua000@gmail.com>, Lee Jones <lee@kernel.org>,
Daniel Thompson <danielt@kernel.org>,
Jingoo Han <jingoohan1@gmail.com>,
Pavel Machek <pavel@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>, Helge Deller <deller@gmx.de>,
dri-devel@lists.freedesktop.org, linux-leds@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-fbdev@vger.kernel.org
Subject: Re: [PATCH 3/4] backlight: ktz8866: improve current sinks setting
Date: Mon, 7 Apr 2025 17:13:44 +0100 [thread overview]
Message-ID: <Z_P5uLrGiQWez0jv@aspen.lan> (raw)
In-Reply-To: <20250407095119.588920-4-mitltlatltl@gmail.com>
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@gmail.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.
next prev parent reply other threads:[~2025-04-07 16:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-07 9:51 [PATCH 0/4] backlight: ktz8866: improve it and support slave Pengyu Luo
2025-04-07 9:51 ` [PATCH 1/4] dt-bindings: backlight: kinetic,ktz8866: add ktz8866 slave compatible Pengyu Luo
2025-04-07 9:57 ` Krzysztof Kozlowski
2025-04-07 9:51 ` [PATCH 2/4] backlight: ktz8866: add slave handler Pengyu Luo
2025-04-07 10:00 ` Krzysztof Kozlowski
2025-04-18 18:14 ` Pengyu Luo
2025-04-18 18:17 ` Pengyu Luo
2025-04-07 16:27 ` Daniel Thompson
2025-04-18 18:19 ` Pengyu Luo
2025-04-07 9:51 ` [PATCH 3/4] backlight: ktz8866: improve current sinks setting Pengyu Luo
2025-04-07 16:13 ` Daniel Thompson [this message]
2025-04-08 3:45 ` kernel test robot
2025-04-08 3:55 ` kernel test robot
2025-04-07 9:51 ` [PATCH 4/4] backlight: ktz8866: add definitions to make it more readable Pengyu Luo
2025-04-07 16:18 ` Daniel Thompson
2025-04-08 5:19 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z_P5uLrGiQWez0jv@aspen.lan \
--to=daniel@riscstar.com \
--cc=conor+dt@kernel.org \
--cc=danielt@kernel.org \
--cc=deller@gmx.de \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jingoohan1@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=lee@kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=lujianhua000@gmail.com \
--cc=mitltlatltl@gmail.com \
--cc=pavel@kernel.org \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox