Backlight PWM not working on B2020.04

  • Dear Support Team,


    I'm still dealing with the non working PWM1 backlight on pin 32 :(. What does the following kernel message mean?


    Code
    1. ldb-bl: disabling

    Here my device tree part:

    Code
    1. /* LVDS backlight PWM on LVDS connector and backlight connector */
    2. backlight_ldb { compatible = "pwm-backlight"; power-supply = <&reg_ldb_bl>; pwms = <&pwm1 0 500000 PWM_POLARITY_INVERTED>; brightness-levels = <1 0 60 63 66 69 73 77 82 87 93 100 107 114 121 128 135 142 149 156 163 170 177 184 191 198 205 215 225 235 245 255>; default-brightness-level = <31>; fb-names = "ldb0", "ldb1";
    3. };

    Is there anybody who can confirm working or not working backlight PWM?

    Thanks in advance.

  • Dear Mr Schubert,


    which SBC are you using? armStoneA9 or armStoneA9r2?


    Your F&S Support Team

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • armstoneA9. PWM in general is working. I can control the PWM period on all other PWM ports/pins by writing the values to the sysfs. That's not possible on PWM0 because it's used/blocked by the backlight control. Writing values to /sys/class/backlight/backlight_ldb/brightness has no effect.

  • So if I am right you just changed in the backlight node pwm3 to pwm1. Is this correct?


    Have you tried to just control pwm1 via sysfs /sys/class/pwm ....


    Does this work?


    Your F&S Support Team

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Yes, I'm using pwm1 (connector pin 32) instead of pwm3. That was working on Buildroot release 3.1.

    I guess pwm1 is on /sys/class/pwm/pwmchicp0. I cannot export channel 0 on pwmchicp0 ("Device or resource busy") because it is used by the backlight.

    I can control pwmchip1 / pwmchip2 / pwmchip3 in sysfs and view the result on oscillator.

    As written before, there is a kernel message while booting.

    Code
    1. ldb-bl: disabling

    Maybe that's the cause of the problem but I don't know what is disabling the ldb-bl.

  • So that´s why ask you to change it back to default configuration and test PWM1 as PWM instead of backlight pwm. Does this work?


    Your F&S Support Team

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • One more thing is that the PWM3 node have an additional flag it´s called "#pwm-cells = <3>;". You have to set this flag in PWM1 node too, if you are using the backlight node in this way.


    Your F&S Support Team

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • If I change backlight control in device tree back to pwm3, I can control pwm1 (pwmchip0) in sysfs. Depending on the values duty_cycle/period I can dim my backlight correctly. But writing values to backlight/brightness in sysfs will not affect an pwm output on pwm3 now (4 pin backlight connector pin 3 to pin 4 always is 3.3V no matter what brightness I set).

  • Have you added the property "#pwm-cells = <3>;" to node "PWM1" like in node "PWM3". Does it work with this change?


    Your F&S Support Team

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • I tried "#pwm-cells = <3>;". The result is that the backlight is off instead on like before. The brightness again cannot be controlled. When using "pwm-cells = <3>;" without the # the ruslt is that the backlight always is on but cannot be controlled.

  • Do you use this backlight with an LVDS display or is the display connected to the RGB-LCD port? In the latter case, you have to change the following line in the backlight_ldb node from

    Code
    1. fb-names = "ldb0", "ldb1";

    to

    Code
    1. fb-names = "lcd";

    And maybe it makes sense to change the node name, too, because otherwise it would be misleading.


    Your F&S Support Team

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • With this device tree I don't even get a sysfs directory for backlight (/sys/class/backlight is empty).

    I'm using the RGB LCD port.


    Code
    1. backlight_lcd {
    2.     compatible = "pwm-backlight";
    3.     power-supply = <&reg_lcd_bl>;
    4.     pwms = <&pwm1 0 500000 PWM_POLARITY_INVERTED>;
    5.     brightness-levels = <1 0 60 63 66 69 73 77 82 87 93 100 107 114 121 128 135 142 149 156 163 170 177 184 191 198 205 215 225 235 245 255>;
    6.     default-brightness-level = <31>;
    7.     fb-names = "lcd";
    8. };
  • Is "reg_lcd_bl" the right regulator for this voltage? Unless you have renamed the regulator, too, I would assume not.


    Your F&S Support Team

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Yes, it's working with the "reg_ldb_bl" now. I can control the pwm backlight on pin 32 now.

    It seems the lbd-backlight will be disabled when no LDB interface is used and lcd-backlight will be disabled when no LCD interface is used.

    That makes sense but seems different to the 3.1 release.


    Thanks for your help.

  • In the past, on the fsimx6 platform, the backlight was only switched on once at start. But is was not switched at all when the display was disabled and/or enabled at runtime. Strictly speaking, this was not correct. But making this work requires a matching name between backlight and display, which is done by the fb-names entry. This entry already existed in the past, but the name(s) given there did not match the internally generated framebuffer names, because the framebuffer names were based on some hardware units of the CPU, namely the IPU number and the display port number on the IPU. In our device tree, you do not have to care about IPU and display port. You just need to set the MXCFB_* macros and everything else is determined automatically. Unfortunately it was not possible to also create an appropriate name for the backlight in this concept, so the name never matched. So actually all backlights were always enabled, which was why it happened to work for you.


    We changed this in the new version. Now the internal framebuffer names are named after their function, so the framebuffer used for LCD is named "lcd", the framebuffer used for HDMI is named "hdmi" and so on. Now, the mapping is rather simple and the switching actually works. But this means that a backlight correctly stays disabled if the corresponding display framebuffer is not active. This is why the backlight was off in your scenario when using the new version.


    Our default device tree maps this backlight to the LVDS display(s), but you use it for the LCD display. This is perfectly OK, but you needed to change this mapping accordingly to make it work.


    Your F&S Support Team

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.