This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LCD backlight and power managemnet

Guru 20755 points

Hello,

We need to put led brughtness (lcd) to minimum when the system gets to idle.
I would like to ask how this can be achieved with OMAP PM ?
Is it done as part of cpuidle ?
Or does it need to be tailored somehow into runtime PM ?
Should it have a wakeup source ? how this should be done ?
The control on led brightness is done as part of dedicated character device, using i2c, which was written for the purpose of brightness control.

Thanks for any idea,

Ran

  • Hi Ran,

    As first step enable the PWM backlight driver as below:

    Device Drivers  --->
         Graphics support --->
              [*]Backlight & LCD device support --->
                <*> Lowlevel Backlight controls;
                       <*> Generic PWM based Backlight Driver

    Then you need to observe the system load and if detect idle put the LCD brightness to minimum by:

    # echo <brightness_value> > /sys/class/backlight/pwm-backlight/brightness

    where <brightness_value> can be varied from 0-250. 0 corresponds to 0% dutycycle (darkest) and 250 corresponds to 100% (brightest).

    BR

    Tsvetolin Shulev

  • Hi Tsvetolin,

    Thanks very much, it is helpful.

    I actually work with character device which uses i2c for the matter of brightness.
    But the real question is how to make it automatic, i.e. Is there some method that when getting to cpuidle that the the routine for setting the minimal brightness will be excuted (automatic). I thought the OMAP Linux PM is capable somehow to achieve this.

    Thanks,

    Ran

  • Hi Ran,

    I'm not sure whether exists some 'automatic' method about cpu idle detection but you can check the cpu load for some various period of time. The most popular way for checking cpu utilization is:

    # cat /proc/loadavg

    Where the first three fields in this file are load average figures giving the number of jobs in the run queue (state R) or waiting for disk I/O (state D) averaged over 1, 5, and 15 minutes. They are the same as the load average numbers given by uptime(1) and other programs.
        The fourth field consists of two numbers separated by a slash (/). The first of these is the number of currently executing kernel scheduling entities (processes, threads); this will be less than or equal to the number of CPUs. The value after the slash is the number of kernel scheduling entities that currently exist on the system.
        The fifth field is the PID of the process that was most recently created on the system.

    You can check the cpu utilization periodically from your source code by reading the /proc/loadavg.

    BR

    Tsvetolin Shulev

  • One more useful article about understanding of Linux CPU measuring tool:

    http://blog.scoutapp.com/articles/2009/07/31/understanding-load-averages

    BR

    Tsvetolin Shulev

  • Hi Tsvetolin,

    Thank you very much for the kind answer.

    The general idea you suggest, as I understand, is to check to see the cpu load and if it is low (meaning, that there is no activity in cpu ?) than reduce brightness for example, right ? I would like some advise on this to see if it really fits our system requirements:

    I am trying to understand now if this idea gets into the full picture of power management capability in Linux, and our requirements. When there is no process with cpu than the cpu should automatic move into idle mode (when using cpuidle for example), so creating some process which periodically checks the cpu load, seems to break this idea.
    Please correct me if I'm wrong.

    Thanks very much,

    Ran 

  • Ran,

    your understanding is right.

    BR

    Tsvetolin Shulev

  • Hi,

    So, Do you mean that that we can't expect to do the backlight reduce automatic (using Linux PM capabilities), but have to use some SW process for this ?

    Thanks,

    Ran

  • Yes, that's right. The reducing of backlight could not be happen automatic but it's needed to made some sw process for this.

    BR

    Tsvetolin Shulev

  • Hi Tsvetolin,

    I thought that runtime PM should handle exactly this issue, to make things automatic, so that there is no need to create periodic tasks for checking if there is no activity, and only then to suspend devices.

    Thanks,

    Ran