Rockbox

This is the bug/patch tracker for Rockbox. Click here for more information.

Quick links: Bugs · Patches · Rockbox frontpage

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, 20:09 GMT+1
Last edited by Bertrik Sikken (bertrik) - Monday, 01 November 2010, 20:01 GMT+1
Task Type Bugs
Category Operating System/Drivers
Status Closed
Assigned To No-one
Player Type Another
Severity Low
Priority Normal
Reported Version Release 3.6
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
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)
   wakeup.patch (0.6 KiB)
 firmware/drivers/rtc/rtc_as3514.c |    8 ++++++++
 1 file changed, 8 insertions(+)

This task depends upon

Closed by  Bertrik Sikken (bertrik)
Monday, 01 November 2010, 20:01 GMT+1
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, 17:36 GMT+1
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.
   wakeup2.patch (3.1 KiB)
 firmware/drivers/rtc/rtc_as3514.c |   77 ++++++++++++++++++++++++--------------
 1 file changed, 50 insertions(+), 27 deletions(-)

Comment by Bertrik Sikken (bertrik) - Wednesday, 07 July 2010, 11:21 GMT+1
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.
   wakeup3.patch (4.5 KiB)
 firmware/drivers/rtc/rtc_as3514.c |  116 ++++++++++++++++++++++++--------------
 1 file changed, 75 insertions(+), 41 deletions(-)

Comment by Bertrik Sikken (bertrik) - Friday, 16 July 2010, 12:06 GMT+1
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, 11:50 GMT+1
I tested on Fuse2 with SVN > SVN r27447 and work fine. Before always faills me.
Comment by Fabian Vogel (Fabian) - Tuesday, 03 August 2010, 16:55 GMT+1
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, 23:15 GMT+1
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, 22:59 GMT+1
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.
   alarm.diff (0.4 KiB)
 firmware/drivers/rtc/rtc_as3514.c |    1 +
 1 file changed, 1 insertion(+)

Comment by Fabian Vogel (Fabian) - Thursday, 12 August 2010, 18:10 GMT+1
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, 21:31 GMT+1
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.
   alarm2.diff (0.4 KiB)
 firmware/drivers/rtc/rtc_as3514.c |    2 ++
 1 file changed, 2 insertions(+)

Loading...