Author Topic: Sl6000 Wake On Alarm  (Read 7834 times)

karlto

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
    • http://
Sl6000 Wake On Alarm
« on: December 15, 2005, 02:44:56 pm »
Hi all

The SL6000 seems to be the only Zaurus that won't wake on alarm in the latest RC12. I am keen to get your opinions and assistance to find the solution to this.

So far, I have managed to compile a kernel with debug options set in the power management section - this is a sample of the dmesg output:

Code: [Select]
tc6393_nand_suspend
queue_event: event=10
suspend:
set_power_state: what=1 state=2
set_power_state: *** go into suspend
pxa_suspend: FCS : CCCR = 241
pxa_suspend: pass_charge_flag = 0
pxa_suspend: check AC-adaptor
pxa_suspend: kick charging
pxa_suspend: ac97&tc6393 down
pxa_suspend: RTAR charge = 401e3317

==== This is where sleep mode is entered ====

If there was a problem with the code after resuming from sleep, we would see messages about going back to sleep/suspend below, but we don't. So, issue must be above in telling processor how to sleep...?

===================================

pxa_suspend: ac97&tc6393 up
ac97_codec: AC97 Audio codec, id: WML18 (Wolfson WM9711/WM9712)
init TC6369 Revision 3
pxa_suspend: back the ALARM Time
sharpsl_wakeup_hook: GPLR0 = 3ef89a
PEDR=00000001
src=800000bf
src_mask=0000009f
PSSR=00000001->00000001
key interrupt on (0001,0000)
FCS : CCCR = 161
send_event: event=3
sleeping to allow SD card to resume...
sleep complete.
w9712_init
wm9712_update_jack_state: HP jack state changed (Jack=0,Mic=0)
tc6393_nand_resume

In theory, hardware wakeups that are correctly set up will resume the kernel power code from sleep at the point noted in the messages above. Things such as unplugging the power etc will also wake it up, so there is some code to send it back to sleep if no need to wake up. albertr's patch (incorporated into RC12) stopped it from going back to sleep if the alarm was set. The SL6000 doesn't actually wake at all though - it's like the hardware wakeup isn't set properly for the alarm. While the corgi (760) has the same processor, there are a number of general purpose registers (GPIO) that are used differently for the tosa, and a lot of tosa-specific code to account for this (e.g. the battery charge indicator appears to be completely opposite). I have the processor specs but not Zaurus specs.

In short, the SL6000 seems to respond to battery/AC/button events when in sleep mode, but not the alarm. This leads me to believe that the alarm isn't quite set correctly (as it is difficult to figure out the correct GPIO settings). Some possibly useful info from registers in the dmesg output above, and I can always modify to get more.

Is it possible to find original/unmodified Sharp code for the SL6000 power routines? Zaurus spec on what/how the GPIO registers are used? Does OZ or anyone else have working suspend/resume on alarm code that we can look at to get the right settings?

BTW, I am working with /arch/arm/mach-pxa/sharpsl_power.c above...

Thanks for any help or suggestions!
SL6000-L, RC12

trichmon

  • Full Member
  • ***
  • Posts: 148
    • View Profile
Sl6000 Wake On Alarm
« Reply #1 on: December 15, 2005, 03:45:18 pm »
Let me just say thanks for trying to get this fixed.  In my opinion this is the biggest problem with the 6000, and non-sharp roms.  I have seen sashz work on this and I think the whole team has worked hard on getting this fixed.  And I have tryed OZ as well with the same results. The only other rom for the 6000 that seem to have this working are sharp based(i think). Right now if I am doing something that requires my Z to resume on its own I have to flash back to the original rom.  

Im not much of a coder at this point but if I can help in any way please PM.  Or ask in this thread.

Todd
SL-6000l running pdaXrom RC12 icewm + rox
Targus keyboard
Trendnet cf 10/100 ethernet
Linksys CF wireless
Sandisk 256mb SD card
Lexar 1gig SD card
SL-5500 running zynergy rom

DrWowe

  • Hero Member
  • *****
  • Posts: 696
    • View Profile
    • http://
Sl6000 Wake On Alarm
« Reply #2 on: December 15, 2005, 05:04:50 pm »
I would also like to see this working.

Trichmon:  Are you certain there is a configuration (Sharp based) which works?  If so, it should be relatively easy to figure out.  Sharp's original kernel sources are available somewhere on their Japanese website.

UPDATE:
It is here:
http://developer.ezaurus.com/sl_j/source/source_dl.htm
« Last Edit: December 15, 2005, 05:06:53 pm by DrWowe »

trichmon

  • Full Member
  • ***
  • Posts: 148
    • View Profile
Sl6000 Wake On Alarm
« Reply #3 on: December 15, 2005, 05:34:57 pm »
DrWowe:  I am sure that the default sharp rom works.  Im not sure how they do it but I use the alarm features all time and I has yet to fail me.  The fine guylhem rom  (which think is based on sharp, but i could be way wrong) has also worked for me.
SL-6000l running pdaXrom RC12 icewm + rox
Targus keyboard
Trendnet cf 10/100 ethernet
Linksys CF wireless
Sandisk 256mb SD card
Lexar 1gig SD card
SL-5500 running zynergy rom

karlto

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
    • http://
Sl6000 Wake On Alarm
« Reply #4 on: December 15, 2005, 06:23:15 pm »
Neat - I will have a look at the Sharp kernel source. I can't seem to find any source for the guylhem one though; only compiled images ready to go...

They all seem to be based on the original Sharp one, but I think that possibly one of the changes has broken SL6000 alarms (not the most common Zaurus).

Thanks for your help
SL6000-L, RC12

DrWowe

  • Hero Member
  • *****
  • Posts: 696
    • View Profile
    • http://
Sl6000 Wake On Alarm
« Reply #5 on: December 15, 2005, 07:04:13 pm »

karlto

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
    • http://
Sl6000 Wake On Alarm
« Reply #6 on: December 15, 2005, 09:49:40 pm »
Excellent news!

I found it - a simple line at the top of the file that turned off wakeups for RTC alarms on the tosa only! I have successfully tested it using apmsleep (not exhaustive by any means, but I am pretty sure this is it, as it lines up with the corgi etc code.)

UPDATE
---------
Here it is:

- kernel patch for those who compile and for future use
- standard sl6000 rc12 tools.tar ready to flash for lazy people like me
« Last Edit: December 15, 2005, 10:41:43 pm by karlto »
SL6000-L, RC12

sashz

  • Sr. Member
  • ****
  • Posts: 388
    • View Profile
    • http://
Sl6000 Wake On Alarm
« Reply #7 on: December 15, 2005, 11:53:01 pm »
Quote
Excellent news!

I found it - a simple line at the top of the file that turned off wakeups for RTC alarms on the tosa only! I have successfully tested it using apmsleep (not exhaustive by any means, but I am pretty sure this is it, as it lines up with the corgi etc code.)

UPDATE
---------
Here it is:

- kernel patch for those who compile and for future use
- standard sl6000 rc12 tools.tar ready to flash for lazy people like me
[div align=\"right\"][a href=\"index.php?act=findpost&pid=107264\"][{POST_SNAPBACK}][/a][/div]

nice work! i'll add patch to build system now)

trichmon

  • Full Member
  • ***
  • Posts: 148
    • View Profile
Sl6000 Wake On Alarm
« Reply #8 on: December 16, 2005, 01:14:08 am »
karlto: your the man! Works like a charm on my Z.  pdaxrom is now my daily rom.  Thanks so much.

Todd
SL-6000l running pdaXrom RC12 icewm + rox
Targus keyboard
Trendnet cf 10/100 ethernet
Linksys CF wireless
Sandisk 256mb SD card
Lexar 1gig SD card
SL-5500 running zynergy rom

trichmon

  • Full Member
  • ***
  • Posts: 148
    • View Profile
Sl6000 Wake On Alarm
« Reply #9 on: December 17, 2005, 12:54:33 am »
karlto: so have you tested your new kernel with either of the kopi alarm setups mentioned in these forums?

Todd
SL-6000l running pdaXrom RC12 icewm + rox
Targus keyboard
Trendnet cf 10/100 ethernet
Linksys CF wireless
Sandisk 256mb SD card
Lexar 1gig SD card
SL-5500 running zynergy rom

karlto

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
    • http://
Sl6000 Wake On Alarm
« Reply #10 on: December 18, 2005, 01:44:36 pm »
Quote
karlto: so have you tested your new kernel with either of the kopi alarm setups mentioned in these forums?

Todd
[div align=\"right\"][{POST_SNAPBACK}][/a][/div]

I tried this one:

[a href=\"https://www.oesf.org/forums/index.php?showtopic=16455]Alarms With Kdepim/pi For Rc12 Sl-c3100[/url]

(which uses apmsleep) and it works, but a bit rough - it seems to wake up one minute before an alarm is due, and with the minute rounding it can be quite early. However it is all scripted so it can be changed, and kopi will still raise an alarm even if it is a few seconds after the due time...

Note - I found that the kdepim attached to the post above didn't play sound properly, as it uses the 'playwave' command, which seems to need more parameters. I just moved it and made /usr/bin/playwave a symlink to /usr/bin/play...

I haven't tried atd, but I am sure it would work on the SL6000 if it does on others. It's all just a matter of using the two hidden files in the home directory made by kopi (that have the next alarm and next suspended alarm date/time in them) and setting the wakeup time.

Karl
SL6000-L, RC12

karlto

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
    • http://
Sl6000 Wake On Alarm
« Reply #11 on: December 19, 2005, 10:29:16 pm »
Hi Todd

If you are still interested in the kopi wakeup, I have found a slightly more robust/accurate solution (still requires it to be running though).

Install atd as sashz recommended in the other thread, and copy the attached wrapper script in place of the existing one at /usr/bin/apm (back up the old one...). It still executes the apm suspend, resume and wakeup scripts, only using at instead of apmsleep. It also checks the ~/.kopi_next_alarm and ~/.kopi_suspend_alarm files and sets a wakeup time to the second for these (instead of nearest minute).

The only catch is that the sltime script that executes on suspend and resume fails because it can't access the hardware clock (atd has it open). I can't see any real need to set the clock so often though anyway...

Karl
SL6000-L, RC12