Rockbox

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

Quick links: Bugs · Patches · Rockbox frontpage

Tasklist

FS#6800 - Sansa e200 backlight fade in/out

Attached to Project: Rockbox
Opened by Ivan Zupan (zivan56) - Sunday, 11 March 2007, 23:12 GMT+2
Last edited by Marc Guay (Marc_Guay) - Wednesday, 02 April 2008, 22:22 GMT+2
Task Type Patches
Category LCD
Status Unconfirmed
Assigned To No-one
Player type Sansa e200
Severity Low
Priority Normal
Reported Version current build
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Private No

Details

This adds a fade in/out feature similar to the one used on the iPod instead of just cutting power to the LCD.
The udelay used to leave the LCD in a low power state for a ~2 secs is not ideal, and probably needs to be removed or made non-blocking if possible. It would be useful to have the player in this state for ~5 sec if it didn't adversely affect the response time of the player.

Ivan
This task depends upon

Comment by Ivan Zupan (zivan56) - Sunday, 11 March 2007, 23:21 GMT+2
It seems the udelay interferes with audio, just get rid of it...
Comment by Dagni McPhee (donutman25) - Tuesday, 13 March 2007, 01:38 GMT+2
this significantly slows down my sansa when playing audio
Comment by Ivan Zupan (zivan56) - Tuesday, 13 March 2007, 02:31 GMT+2
e200_lcd2.patch does not affect my e250 in any way in terms of performance (it was quite sluggish before). The first patch does slow the system down when in the low power state.
Comment by Ivan Zupan (zivan56) - Thursday, 03 May 2007, 07:16 GMT+2
Synced to SVN and fixed a bug where it would revert to default brightness when brightness was set to below 3. Also reduced code size.
Comment by Ivan Zupan (zivan56) - Saturday, 12 May 2007, 01:34 GMT+2
Synced to SVN.
Comment by Jeton Aliji (jeton) - Thursday, 14 June 2007, 18:25 GMT+2
Chrisjs, who maintains a cutom build for Sansa e200 series, reported a problem with compiling this patch.
Any idea what might be the reason?
Comment by Jack Suter (chrisjs169) - Saturday, 16 June 2007, 03:34 GMT+2
I am aware of the cause of it not working - It was out of sync and I didn't look through the code carefully enough, and mistakingly skipped a few hunks
Comment by Jack Suter (chrisjs169) - Saturday, 16 June 2007, 05:09 GMT+2
Sync'd to SVN
Comment by Jonathan Gordon (jdgordon) - Sunday, 22 July 2007, 14:33 GMT+2
This is a different way of donig the same thing. atm its not configurable and doesnt disable the lcd when its fading out (dont know why, uncommenting the 2 // comment lines will cause the sansa to crash
Comment by Jonathan Gordon (jdgordon) - Sunday, 22 July 2007, 16:11 GMT+2
final version. this seems to work fine, even if the lcd sleep option is set to always.
does this need to be configurable? I dont think so.
Comment by Michael Sevakis (MikeS) - Sunday, 22 July 2007, 22:44 GMT+2
Big problem here: you cannot call the i2c driver from a tick task. It calls mutex functions and yields. Interrupts can only use queue_post and call code specifically intended for that context.

I also saw some traffic on IRC about this and there seemed to be confusion about lcd_sleep/enable? lcd_enable(false) only shuts down visible display operations, not the chip itself. lcd_sleep_does the full move to standby. lcd_enable(true) of course brings it back from any level of power down. Those functions yield and aren't really multithread safe (yet).
Comment by Jonathan Gordon (jdgordon) - Monday, 23 July 2007, 15:09 GMT+2
here is another try which uses the backlight thread to do it all properly and thread-safely....
it doesnt work though :p
I'm hoping another pair of eyes can figure it out.
currently it only dims once :(
Comment by Anonymous Submitter - Saturday, 08 September 2007, 16:17 GMT+2
Sync please, I think recent SVN changes due to the c200 port broke this patch.
Comment by Anonymous Submitter - Saturday, 15 September 2007, 18:13 GMT+2
Synced it myself.
Comment by Dave Greenidge (Dave G) - Wednesday, 14 November 2007, 12:37 GMT+2
this patch no longer compiles against the current source
Comment by Thomas Martitz (kugel.) - Sunday, 18 November 2007, 02:32 GMT+2
Pretty hard to sync, I'll have a look another day, when I've got time.

Anyway, I did talk to the devs, we need to follow jdgordons approach (for thread-safety, proper coding etc), and we need to make it configurable in order to have a chance to get this committed. I hope someone will help us to do so.
Comment by Thomas Martitz (kugel.) - Thursday, 29 November 2007, 18:32 GMT+2
Can't someone resync please?
Comment by Martin Ritter (MartinR) - Friday, 11 January 2008, 11:19 GMT+2
Resynced against r16053M-080111. Works fine on my e260 so far.
What exactly do we need to get this committed? Maybe the fade should be done in _backlight_on() and _backlight_off() instead of introducing __backlight_dim()? That way it would be compatible to the HAVE_BACKLIGHT_PWM_FADING stuff and backlight.c could be left unchanged. At least, further resyncs would be easier then.
Any suggestions?
Comment by Thomas Martitz (kugel.) - Friday, 11 January 2008, 14:36 GMT+2
We need to do exactly what JdGorden began. Thread-safety. Your suggestion doesn't sound too bad. However, PWM fading isn't proper. The way it acutally works, by settings the backlight brighness down in a intervall is much better, since it's more accurate. I also think it looks better.
Comment by Dave Greenidge (Dave G) - Friday, 11 January 2008, 15:00 GMT+2
Thanx for your work on resyncing this patch Martin. Works fine on my e280
Comment by Martin Ritter (MartinR) - Monday, 14 January 2008, 09:00 GMT+2
Kugel, of course no PWM on the Sansa. I wasn't aware, that jdgordon did something completely different. Simply picked the last patch.

Anyway, I now managed to get jdgordon's approach running, too. It does the fading in the backlight_thread() itself instead of a ticktask, which was considered to be bad. It works quite well, however, I don't like it very much. While fading, the backlight_thread() feeds up itself with tons of BACKLIGHT_FADE_* events. Was it supposed to work this way, or should we rather use a timer to feed the queue?
Comment by Thomas Martitz (kugel.) - Monday, 14 January 2008, 19:51 GMT+2
Thanks a lot for your work, Martin.
Comment by Martin Ritter (MartinR) - Monday, 28 January 2008, 12:12 GMT+2
I did a little rework, trying to gain the best of the 2 different solutions above.

Fading is now controlled by the new variable backlight_fade_state. It is set to 1 or 2 in _backlight_on() or _backlight_off(), indicating that either a fade-up or fade-down is desired. If so, backlight_tick() starts sending BACKLIGHT_FADE events to the backlight_thread() at a rate of HZ/25. Depending on the value of backlight_fade_state, the backlight_thread() then calls either __backlight_fade_up() or __backlight_fade_down() of the target. When fading is fished, backlight_fade_state is set back to 0, and backlight_tick() stops sending fade events.

Also fixed a bug when brightness was set to 1.

It's been tested quite intensely. If further work is needed to get it committed, someone may tell me, please.
Comment by Martin Ritter (MartinR) - Wednesday, 16 April 2008, 09:57 GMT+2
Synchronised against 17138.
Comment by Martin Ritter (MartinR) - Wednesday, 02 July 2008, 16:12 GMT+2
Fixed a bug where the screen sometimes turned white in mpegplayer.
Comment by Thomas Martitz (kugel.) - Monday, 18 August 2008, 16:19 GMT+2
The patch works well, how about committing (generally, not necessarily before 3.0)?

Loading...