pwm-backlight driver not being probed in u-boot

Simon Glass sjg at chromium.org
Fri Jan 13 19:00:27 CET 2023


Hi Cheo,

   (please keep the mailing list on this)

On Fri, 13 Jan 2023 at 02:04, Cheo Fusi <fusibrandon13 at gmail.com> wrote:
>
> Hi Simon
>
> I get the same -ENODEV with uclass_first_device_err().
>
> Here are the outputs of 'dm tree' and 'dm uclass'
>
> => dm tree
>  Class     Index  Probed  Driver                Name
> -----------------------------------------------------------
>  root          0  [ + ]   root_driver           root_driver
>  simple_bus    0  [ + ]   simple_bus            |-- soc at 1c00000
>  mmc           0  [ + ]   sunxi_mmc             |   |-- mmc at 1c0f000
>  blk           0  [ + ]   mmc_blk               |   |   `-- mmc at 1c0f000.blk
>  mmc           1  [ + ]   sunxi_mmc             |   |-- mmc at 1c10000
>  blk           1  [   ]   mmc_blk               |   |   `-- mmc at 1c10000.blk
>  mmc           2  [ + ]   sunxi_mmc             |   |-- mmc at 1c11000
>  blk           2  [   ]   mmc_blk               |   |   `-- mmc at 1c11000.blk
>  usb           0  [ + ]   sunxi-musb            |   |-- usb at 1c19000
>  ethernet      0  [ + ]   usb_ether             |   |   `-- usb_ether
>  phy           0  [ + ]   sun4i_usb_phy         |   |-- phy at 1c19400
>  usb           0  [ + ]   ehci_generic          |   |-- usb at 1c1a000
>  usb_hub       0  [ + ]   usb_hub               |   |   `-- usb_hub
>  usb           1  [ + ]   ohci_generic          |   |-- usb at 1c1a400
>  usb_hub       1  [ + ]   usb_hub               |   |   `-- usb_hub
>  clk           0  [ + ]   sun8i_a23_ccu         |   |-- clock at 1c20000
>  reset         0  [ + ]   sunxi_reset           |   |   `-- reset
>  gpio          0  [ + ]   gpio_sunxi            |   |-- pinctrl at 1c20800
>  gpio          1  [ + ]   gpio_sunxi            |   |   |-- PA
>  gpio          2  [ + ]   gpio_sunxi            |   |   |-- PB
>  gpio          3  [ + ]   gpio_sunxi            |   |   |-- PC
>  gpio          4  [ + ]   gpio_sunxi            |   |   |-- PD
>  gpio          5  [ + ]   gpio_sunxi            |   |   |-- PE
>  gpio          6  [ + ]   gpio_sunxi            |   |   |-- PF
>  gpio          7  [ + ]   gpio_sunxi            |   |   |-- PG
>  gpio          8  [ + ]   gpio_sunxi            |   |   |-- PH
>  gpio          9  [ + ]   gpio_sunxi            |   |   `-- PI
>  watchdog      0  [ + ]   sunxi_wdt             |   |-- watchdog at 1c20ca0
>  sysreset      1  [   ]   wdt_reboot            |   |   `-- watchdog at 1c20ca0
>  serial        0  [ + ]   ns16550_serial        |   |-- serial at 1c28000
>  serial        1  [   ]   ns16550_serial        |   |-- serial at 1c28400
>  clk           1  [ + ]   clk_sun6i_rtc         |   |-- rtc at 1f00000
>  gpio         10  [ + ]   gpio_sunxi            |   |-- pinctrl at 1f02c00
>  gpio         11  [ + ]   gpio_sunxi            |   |   `-- PL
>  i2c           0  [ + ]   sun8i_rsb             |   `-- rsb at 1f03400
>  pmic          0  [ + ]   axp_pmic              |       `-- pmic at 3a3
>  sysreset      0  [   ]   axp_sysreset          |           `-- axp_sysreset
>  backlight     0  [   ]   pwm_backlight         |-- backlight
>  clk           2  [ + ]   fixed_clock           |-- osc24M_clk
>  clk           3  [   ]   fixed_clock           `-- ext_osc32k_clk
>
> -------------------------------------------------------------------------------------------------
>
> => dm uclass
> uclass 0: root
> 0   * root_driver @ 5bf62028, seq 0
>
> uclass 22: blk
> 0   * mmc at 1c0f000.blk @ 5bf622f8, seq 0
> 1     mmc at 1c10000.blk @ 5bf62588, seq 1
> 2     mmc at 1c11000.blk @ 5bf62818, seq 2
>
> uclass 26: clk
> 0   * clock at 1c20000 @ 5bf62c20, seq 0
> 1   * rtc at 1f00000 @ 5bf63338, seq 1
> 2   * osc24M_clk @ 5bf63658, seq 2
> 3     ext_osc32k_clk @ 5bf636e0, seq 3
>
> uclass 29: display
> uclass 34: efi
> uclass 36: ethernet
> 0   * usb_ether @ 5bf6ab38, seq 0
>
> uclass 40: gpio
> 0   * pinctrl at 1c20800 @ 5bf62d20, seq 0
> 1   * PA @ 5bf62d98, seq 1
> 2   * PB @ 5bf62e10, seq 2
> 3   * PC @ 5bf62e88, seq 3
> 4   * PD @ 5bf62f00, seq 4
> 5   * PE @ 5bf62f78, seq 5
> 6   * PF @ 5bf62ff0, seq 6
> 7   * PG @ 5bf63068, seq 7
> 8   * PH @ 5bf630e0, seq 8
> 9   * PI @ 5bf63158, seq 9
> 10  * pinctrl at 1f02c00 @ 5bf63390, seq 10
> 11  * PL @ 5bf63408, seq 11
>
> uclass 43: i2c
> 0   * rsb at 1f03400 @ 5bf63480, seq 3
>
> uclass 45: i2c_generic
> uclass 51: keyboard
> uclass 55: usb_mass_storage
> uclass 59: mmc
> 0   * mmc at 1c0f000 @ 5bf62128, seq 0
> 1   * mmc at 1c10000 @ 5bf623d8, seq 2
> 2   * mmc at 1c11000 @ 5bf62668, seq 1
>
> uclass 63: nop
> uclass 67: panel
> uclass 68: backlight
> 0     backlight @ 5bf63600, seq 0
>
> uclass 73: phy
> 0   * phy at 1c19400 @ 5bf629a0, seq 0
>
> uclass 76: pmic
> 0   * pmic at 3a3 @ 5bf634f8, seq 0
>
> uclass 78: pwm
> uclass 83: regulator
> uclass 85: reset
> 0   * reset @ 5bf62c98, seq 0
>
> uclass 90: serial
> 0   * serial at 1c28000 @ 5bf63248, seq 0
> 1     serial at 1c28400 @ 5bf632c0, seq 1
>
> uclass 91: simple_bus
> 0   * soc at 1c00000 @ 5bf620a0, seq 0
>
> uclass 101: sysreset
> 0     axp_sysreset @ 5bf63588, seq 0
> 1     watchdog at 1c20ca0 @ 5bf639d8, seq 1
>
> uclass 107: usb
> 0   * usb at 1c1a000 @ 5bf62b50, seq 0
> 1   * usb at 1c1a400 @ 5bf62ba8, seq 1
>
> uclass 108: usb_dev_generic
> uclass 109: usb_hub
> 0   * usb_hub @ 5bf74528, seq 0
> 1   * usb_hub @ 5bf6bc08, seq 1
>
> uclass 110: usb
> 0   * usb at 1c19000 @ 5bf62918, seq 0
>
> uclass 111: video
> uclass 113: vidconsole0
> uclass 118: watchdog
> 0   * watchdog at 1c20ca0 @ 5bf631d0, seq 0
>

But you don't have a PWM, so how can the PWM work?

I imagine it is failing this line of pwm_backlight_of_to_plat():

ret = uclass_get_device_by_ofnode(UCLASS_PWM, args.node, &priv->pwm);

Here is an example DT fragment from snow:

backlight: backlight {
   compatible = "pwm-backlight";
   pwms = <&pwm 0 1000000 0>;
   brightness-levels = <0 100 500 1000 1500 2000 2500 2800>;
   default-brightness-level = <7>;
   enable-gpios = <&gpx3 0 GPIO_ACTIVE_HIGH>;
   power-supply = <&fet1>;
};

- Simon


> Sincerely,
> Brandon
>
> On Fri, Jan 13, 2023 at 12:43 AM Simon Glass <sjg at chromium.org> wrote:
>>
>> Hi Cheo,
>>
>> On Thu, 12 Jan 2023 at 02:40, Cheo Fusi <fusibrandon13 at gmail.com> wrote:
>> >
>> > Hi Simon,
>> >
>> > Thank you for your response.
>> >
>> > What I'm trying to do is control a backlight WITHOUT attaching it to a panel in the device tree.
>> >
>> > My approach is to find the top level backlight node in the device tree at some point late in the
>> > init sequence (like board_init_f), grab the first and only backlight device in UCLASS_PANEL_BACKLIGHT,
>> > and call backlight_enable on it. Something like
>> >
>> > struct udevice* backlight;
>> > ret = uclass_get_device(UCLASS_PANEL_BACKLIGHT, 0, &backlight);
>>
>> Can you post the output of 'dm tree' and 'dm uclass'? It is possible
>> that it is not device 0. It would be safer to use
>> uclass_first_device_err() or similar.
>>
>> No device itself should return -ENODEV as an error. It always means
>> that the device cannot be found. Given that you have established that
>> it is bound, that can only mean that you are specifying the wrong
>> device sequence number.
>>
>> [.]
>>
>> Regards,
>> Simon


More information about the U-Boot mailing list