• Status Closed
  • Percent Complete
  • Task Type Patches
  • Category Drivers
  • Assigned To No-one
  • Operating System iAudio X5
  • Severity Low
  • Priority Very Low
  • Reported Version
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by MikeS - 2006-07-12

FS#5651 - X5 LCD Shutoff and Graceful Shutdown

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.

- 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.

Closed by  RaeNye
2006-08-08 22:07
Reason for closing:  Out of Date
Additional comments about closing:   Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407

deprecated by #5772, which was committed.

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.

MikeS commented on 2006-07-12 01:39

No. The poweron waits only add up to about 18ms.

MikeS commented on 2006-07-12 01:40

Drat! I mean 180ms. It’s 100ths of a second afterall.

MikeS commented on 2006-07-12 01:54

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!

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.”

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.

MikeS commented on 2006-07-12 18:01

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.

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.

MikeS commented on 2006-07-17 07:51

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_(0×35, )” calls are made.

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.

MikeS commented on 2006-07-17 13:12

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?

Project Manager

I assumed you figured that out by looking at the port pin assignments Wiki page?


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.

MikeS commented on 2006-07-18 00:16

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.

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?

MikeS commented on 2006-07-31 19:50

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.

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)
© [later on] add to this setting “after X seconds” as well

MikeS commented on 2006-08-01 08:27

(a) Done (added HAVE_ defines for port-specific LCD functions just like HAVE_LCD_CONTRAST)
(b) En proceso but sticky issues.
© 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.

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.

MikeS commented on 2006-08-02 19:12

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 :).

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.

MikeS commented on 2006-08-03 04:34

So maybe we’ll have in LCD settings:

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)
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. :)

MikeS commented on 2006-08-05 01:12

Almost done…have to finish testing and check compile on other ports.

MikeS commented on 2006-08-05 08:31



Available keyboard shortcuts


Task Details

Task Editing