2008-06-09 11:14:36     power management

Document created by Aaronwu Employee on Aug 6, 2013
Version 1Show Document
  • View in full screen mode

2008-06-09 11:14:36     power management

Bastien Briec (FRANCE)

Message: 56872   

 

Hello,

 

I enable power management like describes in docs so I use GPIO 30 which is the pfbutton pg14 on the cm-bf537e:

 

Linux Kernel Configuration ->

Power management options ->

 

[*] Power Management support

[*] Legacy Power Management API

[ ] Power Management Debug Support Select PM Wakeup Event Source (Cause Wakeup Event by GPIO) --->

(30) Wakeup GPIO number Select BF537/6/4 PM Wakeup GPIO PORTx (Wakeup GPIO PORT-F) --->

GPIO Polarity (Active Low) --->

 

and I try a test program

 

static void suspend_system(const char *suspend){

   char buf[20];

   int f = open("/sys/power/state", O_WRONLY);

   int len; ssize_t n;

   if (f < 0) { perror("open /sys/power/state"); return; }

   len = sprintf(buf, "%s\n", suspend) - 1;

   len = strlen(buf); n = write(f, buf, len);

   /* this executes after wake from suspend */

   if (n < 0) perror("write /sys/power/state");

   else if (n != len) fprintf(stderr, "short write to %s\n", "/sys/power/state");

   close(f);

}

 

int main(int argc, char **argv){

   static char *suspend = "standby";

   printf("Going into %s ...\n",suspend);

   suspend_system(suspend);

   printf("Awakeing from %s ...\n",suspend);

return 0;

}

 

but when running my program i get:

 

root:~> suspend

Going into standby ...

Stopping tasks: ========|

Suspending console(s)

write /sys/power/state: Operation not permitted

Awakeing from standby ...

root:~>

TranslateQuoteReplyEditDelete

 

 

2008-06-11 11:17:02     Re: power management

Robin Getz (UNITED STATES)

Message: 57006   

 

Bastien:

 

Sorry - the person most familiar with this is travelling, and will be back on Friday.

 

-Robin

QuoteReplyEditDelete

 

 

2008-06-13 14:46:35     Re: power management

Michael Hennerich (GERMANY)

Message: 57254   

 

What kernel release version are you using?

 

Looks you use something pretty old! Can you update?

 

You said you use a PORT_G pin. So why do you select "Wakeup GPIO PORT-F"?

 

It might also be the case that you need to select 14. Don't know from top of my head without looking into the code.

 

The preferred way today is to use the gpio-keys driver and enable the gpio in the board resource file as wakeup capable.

 

-Michael

QuoteReplyEditDelete

 

 

2008-06-16 03:35:52     Re: power management

Bastien Briec (FRANCE)

Message: 57323   

 

I found the problem was using mmc/sd driver in the same time, when the mmc/sd driver is not loaded it works well.

Attachments

    Outcomes