Rockbox

Tasklist

FS#11453 - AMSv2: power down fails sometimes when wake-up alarm timer set

Attached to Project: Rockbox
Opened by Bertrik Sikken (bertrik) - Saturday, 03 July 2010, 18:09 GMT
Last edited by Bertrik Sikken (bertrik) - Monday, 01 November 2010, 19:01 GMT
Task Type Bugs
Category Operating System/Drivers
Status Closed
Assigned To No-one
Operating System Another
Severity Low
Priority Normal
Reported Version Release 3.6
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

When using the wake-up alarm on AMSv2 players, the power-off often does not work when an wake-up alarm time has been set. A typical symptom is that on power-down the display shows "shutting down", dims a bit, but never actually shuts down.

I can reliably reproduce this on my sansa clip+ as follows:
* Set an alarm to wake up in 2 minutes after the current time
* Power off the player and wait until players wakes up
* Set back the current time by 2 minutes and set the alarm again.
* Power off the player -> it hangs while showing "shutting down" with the display slightly dimmed.

Attached patch fixes it for me completely (although funman still reports problems even with this patch)
This task depends upon

Closed by  Bertrik Sikken (bertrik)
Monday, 01 November 2010, 19:01 GMT
Reason for closing:  Fixed
Additional comments about closing:  The idea of alarm2.diff has been committed as SVN r28435. Seems to be completely fixed now, please re-open if you see a shutdown-for-wakeup problem.
Comment by Bertrik Sikken (bertrik) - Monday, 05 July 2010, 15:36 GMT
Attached patch is a bit cleaned up. It introduces two local functions wakeup_read and wakeup_write that read/write the wakeup register making sure that the read/write sequence is cannot be interrupted.

This works flawless here on my clip+ so far, I haven't seen any failed power-downs and the player wakes up at the proper time.
Comment by Bertrik Sikken (bertrik) - Wednesday, 07 July 2010, 09:21 GMT
Attached patch cleans it up a little more by moving all of the alarm data into a struct that is encoded/written by the alarm_write function and read/decoded by the alarm_read function.
Comment by Bertrik Sikken (bertrik) - Friday, 16 July 2010, 10:06 GMT
I've committed patch wakeup3.patch as SVN r27447 and I'm leaving this task open for a while in case the problem hasn't been solved completely
Comment by Marek Salaba (salaba) - Tuesday, 20 July 2010, 09:50 GMT
I tested on Fuse2 with SVN > SVN r27447 and work fine. Before always faills me.
Comment by Fabian Vogel (Fabian) - Tuesday, 03 August 2010, 14:55 GMT
I can often reproduce the "shutting down"-symptom on my clip+ r27662 as follows:
* set an alarm time
* record something (5 seconds or longer)
* stop recording and
* power off immediately
Comment by Bertrik Sikken (bertrik) - Tuesday, 03 August 2010, 21:15 GMT
On my clip+ it seems now that either having played back something or having recorded something causes the power-down for wakeup to fail. The AS3543 datasheet shows MCLK as a possible wake-up source, so maybe MCLK is somehow preventing the power-down. MCLK is a clock used in playback and recording.
Comment by Bertrik Sikken (bertrik) - Sunday, 08 August 2010, 20:59 GMT
This proof-of-concept patch seems to fix the case with shutdown after recording for me. It writes to CGU_AUDIO to configure the MCLK just before going into powerdown-for-wakeup, so this supports my suspicion that it's related to MCLK. The value written to CGU_AUDIO is the one that I see on my clip+ before having recorded or played back anything.
Comment by Fabian Vogel (Fabian) - Thursday, 12 August 2010, 16:10 GMT
If you repeat the
* set-alarm-time
* playback something
* stop and
* powerdown-for-wakeup
procedure 3-4 times, it will often fail.
Comment by Fabian Vogel (Fabian) - Tuesday, 07 September 2010, 19:31 GMT
bertrik you are right that MCLK prevent the power-down. But in the CGU_AUDIO Register the disable of I2SO_MCLK (bit 11 = 0) sometimes fails. So I enabled bit 11 and pllb_fout (bit 1) . Then I powered down PLLB in CGU_PLLBSUP by bit 3. Works fine.

Loading...