Again on power management RRS feed

  • Question

  • Hi all, iMX51+WEC700.

    I set the PM timeouts to lower the backlight brightness in this way:

    - on the UserIdle timeout, i set the D1 state for bkl1 driver (mid brightness)

    - on the SystemIdle timeout, i set D4 state for bkl1 driver (turned off)

    When the system senses a wakeup event, the state returns to D0 state.

    Now I'd like that the power button pression will cause a suspend/poweroff if the bkl1 is in D0 state but the bkl full light if it is in D1 or D4 state.

    So, i check for that in the power button driver, setting the D0 state and do nothing for the suspend/poweroff:

    // read driver backlight state
    if (ERROR_SUCCESS==GetDevicePower(L"bkl1:", POWER_NAME, &state)) {
    	RETAILMSG( 1, (L"-- backlight state = D%d\r\n", state));
    	if (state==4 || state==1)	// if in D1 o D4 ..
    		SetDevicePower(L"bkl1:", POWER_NAME, 0);	// .. turn on BKL ..
    		goto btn_loop;
    	RETAILMSG( 1, (L"-- GetDevicePower() err=%d\r\n", state, GetLastError()));

    This way works for the first time but, after the first idle timeout and next bkl turned on (D0), the *Idle timeouts do not fire at all!

    Whats wrong?


    Monday, November 19, 2012 9:07 AM

All replies

  • I solved with

    if (state==4 || state==1)	// Se in D1 o D4 ..
    	// SetDevicePower(L"bkl1:", POWER_NAME, 0);	// .. set BKL in D0 .. stops *Idle timeouts ?!?!?
    	SetSystemPowerState( NULL, POWER_STATE_ON, 0);	// .. set BKL in D0 ..
    	goto btn_loop;

    I'm wondering if it is correct .... this is a global device setting ...


    Monday, November 19, 2012 9:48 AM
  • This looks correct to me.

    Earlier what you were doing was forcing the BLK to go to D0 state. where as the system was going to different state based on activity timer.

    I am not sure what is your implementation. And why you choose the BLK driver's state to do so.Do you really need that ?

    GetSystemPowerState and SetSystemPowerState are enough in the Power button driver implementation.

    --- misbah

    Senior Design Engineer T.E.S Electroni Solutions (Bangalore-India)

    Monday, November 19, 2012 10:06 AM