pwm-backlight driver not being probed in u-boot

Simon Glass sjg at chromium.org
Mon Jan 9 20:47:26 CET 2023


+Anatolij Gustschin

Hi Cheo,

On Mon, 9 Jan 2023 at 07:47, Cheo Fusi <fusibrandon13 at gmail.com> wrote:
>
> Hi everyone,
>
> I've been trying to turn on my lcd backlight at the u-boot stage to no
> avail. The device tree has a top level node whose compatible is

What board is this?

> 'pwm-backlight'. That driver never seems to get probed. The same problem is
> described here
> <https://stackoverflow.com/questions/62461096/pwm-backlight-driver-not-being-probed-in-u-boot>
>
> I'm new to u-boot so please bear with me. From what I can gather from the
> docs a device gets activated/probed when *uclass_get_device *and friends

You can use 'dm tree' to see devices and 'dm uclass' to see their
sequence number. Probably you want uclass_first_device() if you don't
know the sequence number.

> are called. However I keep getting NULL, while

If you are getting NULL you are calling something strange. You should
get an integer error code which indicates what is wrong.

> *uclass_id_count(UCLASS_PANEL_BACKLIGHT)
> *correctly reports 1 device. A *dm_dump_all* at this stage shows the
> backlight is probed. All these calls are made in *board_late_init.*

This should be done automatically when your video driver is set up,
not in board_late_init(). With driver model, everything should be
handled automatically.

>
> Does this have to do with the backlight being a top level device in the
> devicetree ?? Or is the a wrong assumption I'm making ? Any help would be
> greatly appreciated.

If stdout contains 'vidconsole' it will probe the first UCLASS_VIDEO
device. You might find the simple-panel driver helpful as it handles
backlight, regulators, etc. Or, depending on your SoC perhaps you need
code in your video driver to decode the device tree and do the right
thing, like [1] ?

In general, if you are putting init code in your board.c file then you
should look at how to do things using device tree and existing
drivers. Some examples are rockchip and x86.

Regards,
Simon

[1] drivers/video/rockchip/rk_edp.c


More information about the U-Boot mailing list