Rockbox

Tasklist

FS#5651 - X5 LCD Shutoff and Graceful Shutdown

Attached to Project: Rockbox
Opened by Michael Sevakis (MikeS) - Wednesday, 12 July 2006, 01:11 GMT
Task Type Patches
Category Drivers
Status Closed
Assigned To No-one
Operating System iAudio X5
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Patch that puts the X5's LCD chip in standby mode when the backlight turns off and goes through the recommended poweroff sequence on power off. I combined these because implementing one pretty much automatically implements the other.

Note: I don't know why the entire backlight-x5.c is being diff'ed. I didn't change the entire file.

Changes:
- Added LCD shutdown and standby code to lcd-x5.c
- Implemented a new function lcd_shutdown() to lcd.h for shutting down LCD during power off. Called from power_off() power-x5.c
- Added #define BL_X5 12 to config.h since having it defined as BL_IRIVER_H100 causes conflicts. I also needed lcd_enable() declared independently from an H100 build.
_ Added lcd_enable calls to __backlight_on and __backlight_off in backlight-x5.c.
- Added LCD instruction #define's to lcd-x5.c plus two static routines.
This task depends upon

Closed by  Rani Hod (RaeNye)
Tuesday, 08 August 2006, 22:07 GMT
Reason for closing:  Out of Date
Additional comments about closing:  deprecated by #5772, which was committed.
Comment by Rani Hod (RaeNye) - Wednesday, 12 July 2006, 01:28 GMT
Seems nice, I'll try it tomorrow.
Does the LCD enabling introduce a noticable delay?

BTW, in backlight-x5.c you added lcd_enable() calls.
Comment by Michael Sevakis (MikeS) - Wednesday, 12 July 2006, 01:39 GMT
No. The poweron waits only add up to about 18ms.
Comment by Michael Sevakis (MikeS) - Wednesday, 12 July 2006, 01:40 GMT
Drat! I mean 180ms. It's 100ths of a second afterall.
Comment by Michael Sevakis (MikeS) - Wednesday, 12 July 2006, 01:54 GMT
I know I added the calls. Where else should they go to do the job? If there's some gotcha you're talking about feel free to share!
Comment by Rani Hod (RaeNye) - Wednesday, 12 July 2006, 06:15 GMT
I was referring to the line "Note: I don't know why the entire backlight-x5.c is being diff'ed. I didn't change the entire file."
Comment by Rani Hod (RaeNye) - Wednesday, 12 July 2006, 11:53 GMT
OK, I checked it and it works -- i.e., doesn't crash :)

I do notice the 0.2 second delay when enabling the LCD;
IMHO it's better to shutdown LCD only after a period of time (say, 1 min - but configurable in the same way you configure backlight time).

I find the LCD disabling on system shutdown important; it may help to reduce the intermittent "white screen" effect.
Comment by Michael Sevakis (MikeS) - Wednesday, 12 July 2006, 18:01 GMT
The patch is quite rough but can be safely tried out for battery life. This is a prototype!

I didn't really think about the delay till you said something! :) I'm pretty sure that it can't be reduced by much.

A delay and setting would be better but I wanted to keep this patch's purpose well focused. The LCD off time and backlight OFF time can conflict too.

The "white screen" effect can happen even if the LCD chip is off since it is the backlight that does it (chip off/backlight on=white screen-- I tried it). But...something is going about and turning the display ~back on~ (nothing to do with the patch). What is happening is not obvious to me at the moment.

Ok. In other files only the changed lines are being diff'd and I added headers and calls there too.
Comment by Rani Hod (RaeNye) - Monday, 17 July 2006, 00:27 GMT
Umm.. today I got a almost-brick state with backlight-flickering.
Might be connected to the patch, or to the backlight flicker on shutdown you're experiencing.
Comment by Michael Sevakis (MikeS) - Monday, 17 July 2006, 07:51 GMT
I haven't seen the problem you describe and the patch doesn't change anything regarding the backlight behavior when ON. I could make the BL blink if you like :).

*However*, the backlight flash IS related to turning off the LCD chip. There's no flash if the LCD is left powered on and all is okay if the only the display is turned off. I'm *guessing* the LCD chip normally drains some caps if left on (schematics would help :). Theory: If the LCD chip if off, the caps are left charged and when the GPO1 pin on the PCF50606 goes low after PCF50606 shutdown(default state) it briefly turns on the D305A and drains the caps causing the flash. I could be totally out in left field but will put it to the test. I'm working on it and learning in the process and want to go and ask some *good* questions.

BTW: I also note that the supposed backlight dimming/LCD contrast patch actually does nothing at all to set backlight brightness since it doesn't set the duty cycle of PWMC1 of the 50606, ie. no "pcf50606_(0x35, )" calls are made.
Comment by Rani Hod (RaeNye) - Monday, 17 July 2006, 09:55 GMT
Just happened again, now it just shutdown in the middle of playback.

regarding your BTW: backlight brightness is modified exactly as you said (PWM), I think the code is in lcd-x5.c.
Comment by Michael Sevakis (MikeS) - Monday, 17 July 2006, 13:12 GMT
I don't know what's going on there. No problems have cropped-up for me. I'll definitely try to let it play for awhile LCD off.

There's no code for backlight control in lcd-x5.c from any of the aformentioned patches nor in the original file. The BL patch sets LCD contrast by adjusting voltages (safe to raise above stock levels??).

If anyone cares: I figured out how to turn the charge indicator LEDs on and off. Maybe a quicky patch for that, eh?
Comment by Linus Nielsen Feltzing (linusnielsen) - Monday, 17 July 2006, 13:46 GMT
I assumed you figured that out by looking at the port pin assignments Wiki page?

http://www.rockbox.org/twiki/bin/view/Main/PortPinAssignments#X5_PCF50606_GPO

:-)
Comment by Rani Hod (RaeNye) - Monday, 17 July 2006, 16:08 GMT
jhmikes,
I must warn you that dealing with PCF50606 might get you in deep trouble with the device.
After I tried to enable these instead of the virtual HDD led, I had to open up mine, disconnect the battery wire and resolder it because it went awfully hot.

But actually it's important for RB to turn the LEDs off on boot, since if you boot from AC mode they're still on.
Comment by Michael Sevakis (MikeS) - Tuesday, 18 July 2006, 00:16 GMT
I wish I hadn't forgotten to look there :). I just took a guess about it a wrote some code to blip (on and back to high-z default) the "unused" outputs and found the correct ones. One line of code can give you a charging light and reset its LED. The other can just be turned off. Also, shouldn't the charging algorithm be handled automatically by the chip? I'll go to IRC to discuss charging issues. We're OT. :)

I mostly want to focus on making LCD driver 100% - 110% at the moment. Then release a patch that adds LCD menu options that depend on it so as to not do the "one huge patch" thing. There was also a small mistake in the original power ON sequence taken from the X5 firmware (not fixed in this patch).

About HWM: The highspeed write mode cannot be used unless the screen buffer is rotated 90deg (entry more horitonal AM=0) or by reading bitmaps in column-major order with the writes done horizontally (ie vert. on screen). Dummy writes are inserted automatically for alignent so it isn't an issue but I don't know if that read order would be "harmful" to the CPU cache or something. I already get 123.5 full-screen frames/sec with CPU boosted but there's nothing wrong with faster if possible. I like to experiment.
Comment by Rani Hod (RaeNye) - Monday, 31 July 2006, 17:16 GMT
I want to combine this patch with  FS#5735  (Use Hold button to switch off the backlight in X5)
so that LCD off will occur only when the user forces it.
What do you think?

Could you please sync to current CVS?
Comment by Michael Sevakis (MikeS) - Monday, 31 July 2006, 19:50 GMT
This patch is deprecated. It's not well written. Give me some time (a day), let me download the  FS#5735  so I have a copy and I'll submit something of higher quality that can be easily added to it. This works like the OF BL flick?

Ok I have to resynce  FS#5740 . My preference would be to use  FS#5740  first then add power features to it because it assumed the display is never really turned off but it hasn't been approved. Going the other way is a more hairy ordeal.

Are you looking for just something to turn the LCD display OFF or the whole chip?

If you want the LCD off thing forced through now...I'll do it (I'll add the register defines there too). Let me know.
Comment by Rani Hod (RaeNye) - Monday, 31 July 2006, 20:33 GMT
I'll check  FS#5740  soon, so you can rely on it in the next version.
Don't hurry though, I won't have that much time for RB tomorrow :)

What I want to do is:
(a) have lcd_shutdown(), lcd_standby() functions in lcd-x5.c
(b) have a setting for lcd shutdown (never, always, on hold switch)
(c) [later on] add to this setting "after X seconds" as well
Comment by Michael Sevakis (MikeS) - Tuesday, 01 August 2006, 08:27 GMT
(a) Done (added HAVE_ defines for port-specific LCD functions just like HAVE_LCD_CONTRAST)
(b) En proceso but sticky issues.
(c) I'll probably attempt this right off.

Shutdown Display
Always, Never, On Hold Switch, With Backlight (??), ??s-??m <= Should be able to be fairly long

* "On Hold Switch" is X5-centric or this is on other players too?
* "On Hold Switch" as BL option too? I personally don't want BL off with hold automatically.
* Min/Max time setting (??) Me thinks 90s (max BL besides "On")/5min.
* The BL must go off with the LCD. Keep LCD >= BL?
* If BL is "On", never shutdown LCD or force BL off? Another setting maybe? Avoid settings bloat!
* If "Always", then LCD must be turned on just before power off (flash).
* Language/voice files needed.
* This might need a settings version increment, no?

I know you're busy most of the time but I want this done right so I'd like to hear your input about the stickier issues since this setting is initially your idea.
Comment by Rani Hod (RaeNye) - Tuesday, 01 August 2006, 18:17 GMT
On hold switch is prolly relevant for all platforms that /have/ a hold button.

To solve the LCD >= BL issue it might be better to have it as "LCD off ??s after BL off" with always=0, never=infinity.
The hold switch might be in a different setting: on hold switch shutdown: nothing/BL/BL&LCD.

IIRC, CONFIG_BLOCK_VERSION increment is unnecessary when you only add new settings at the end of the settings struct.
Comment by Michael Sevakis (MikeS) - Wednesday, 02 August 2006, 19:12 GMT
Having the hold switch configurable would break the "no configurable keys" guideline which Mmmm (IIRC) pointed out to me has been debated and agreed to be a no-no (for now, hehehe :).
Comment by Rani Hod (RaeNye) - Wednesday, 02 August 2006, 20:43 GMT
I'm not familiar with this guideline, but I'm not sure this counts as a configurable key;
Hold still does its main function, but when hold is active there's a different LCD off/BL off timeout.
IMHO it's rather similar to the BL off timeout *when AC powered* setting.
Comment by Michael Sevakis (MikeS) - Thursday, 03 August 2006, 04:34 GMT
So maybe we'll have in LCD settings:

Backlight
Backlight (While Plugged In)
Backlight (On Hold Key) = Off,On,Normal (default == Normal)
First Keypress Enables Backlight Only
Caption Backlight
Sleep (After Backlight Off) = Always,Never,5s,10s,15s,20s,30s,45s,60s,90s,2m (default == 10s)
Brightness
Contrast
Line Selector
Clear Backdrop
Background Colour
Foreground Colour
Reset Colours

Visible display will just go off with BL on X5 since showing it again is fast enough. LCD Sleep will actually cut internal power/oscillation.

Food for thought:
I'm thinking a backlight submenu would be a good idea now since five of 13 items relate to backlight settings. Can do later.
How bout adding the backlight PWM fading?? Maybe later too. :)
Comment by Michael Sevakis (MikeS) - Saturday, 05 August 2006, 01:12 GMT
Almost done...have to finish testing and check compile on other ports.
Comment by Michael Sevakis (MikeS) - Saturday, 05 August 2006, 08:31 GMT

Loading...