From: Thorsten Maerz <info@netztorte.de>
To: dri-devel@lists.freedesktop.org
Subject: [Question] gpio-backlight: Is initial power state derived correctly?
Date: Tue, 18 Feb 2025 14:28:43 +0100 [thread overview]
Message-ID: <20250218142843.00002393@netztorte.de> (raw)
I am struggling with the gpio-backlight module, it starts up
with a black screen, though the devicetree states "default-on":
backlight {
compatible = "gpio-backlight";
gpios = <0x31 0x05 0x00>;
default-on;
};
After bootup, the content of "/sys/class/backlight/backlight/bl_power"
is "4", meaning BACKLIGHT_POWER_OFF. The screen is black.
(The backlight devicetree section is working, I can switch on
backlight by writing "0" (BACKLIGHT_POWER_ON) to bl_power.)
It looks to me as if the logic for detecting the devicetree
is reversed:
See drivers/video/backlight/gpio_backlight.c :
---8<--- start
def_value = device_property_read_bool(dev, "default-on");
[...]
/* Set the initial power state */
if (!of_node || !of_node->phandle)
/* Not booted with device tree or no phandle link to the node */
bl->props.power = def_value ? BACKLIGHT_POWER_ON
: BACKLIGHT_POWER_OFF;
else if (gpiod_get_value_cansleep(gbl->gpiod) == 0)
bl->props.power = BACKLIGHT_POWER_OFF;
else
bl->props.power = BACKLIGHT_POWER_ON;
--->8--- end
1. "def_value" is read from the devicetree.
2. "def_value" is evaluated after "if (!of_node || !of_node->phandle)"
Shouldn't the logic be the other way round?
if (of_node && of_node->phandle)
/* booted with device tree */
bl->props.power = def_value ? BACKLIGHT_POWER_ON
: BACKLIGHT_POWER_OFF;
else [...]
/* Not booted with device tree or no phandle link to the node */
--
Best regards,
Thorsten
reply other threads:[~2025-02-18 13:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20250218142843.00002393@netztorte.de \
--to=info@netztorte.de \
--cc=dri-devel@lists.freedesktop.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.