Author Topic: Backlight control ( Mac OS ROM )  (Read 6748 times)

Offline darthnVader

  • Platinum Member
  • *****
  • Posts: 679
  • New Member
Backlight control ( Mac OS ROM )
« on: April 30, 2018, 12:16:34 AM »
I'm having trouble with the backlight on my 14" iBook G4( PowerBook6,5 ).

Here is how iMic described the backlight control hack to the OS ROM:

Quote
Backlight Control
The iBook G4 now has full backlight controller support under Mac OS 9.2. The solution was found in the Open Firmware device tree, at the following branch:
Code: [Select]
/pci@f2000000/mac-io@17/backlight@f300The backlight-control property carried the value 6d6e6361 00, which is the string mnca in hex. I compared this to an iBook G3 Clamshell, which has a backlight-control property with the value 61746900, which is the string ati in hex. Changing mnca in Open Firmware to ati restored the backlight functionality on the iBook G4.
However, Mac OS 9 already has support for backlight controllers of the type mnca in the Mac OS ROM, as evidenced by the presence of this data at data fork offset 0x20D4AD:
Code: [Select]
panel-family DFP,EDID ATY NVDA driver-ref backlight-control ati pmu mnca
All I did was reverse the order of ati and mnca in the ROM:
Code: [Select]
panel-family DFP,EDID ATY NVDA driver-ref backlight-control mnca pmu ati
Now, I can control the internal display brightness with the brightness keys and from within the Monitors control panel. This does require another revision of the Mac OS ROM for the iBook G4. An ideal scenario would be to somehow write the revised backlight driver into an extension (which may not be possible) that is loaded alongside the standard 10.2.1 Generic ROM, but this is still a reasonable solution.

The thing is the value for my backlight-control is the same  6d6e6361, but whenever the loading screen loads, it turns the backlight off. I have a 12" iBook with the R9550, and iMic's hack works just fine on that system.

Reverting the hack makes the backlight stay on on the 14", but I have no control of it.

Also, changing the value to ati( 61746900 ) in Open Firmware, with the unhacked ROM, makes the backlight go off.

Offline darthnVader

  • Platinum Member
  • *****
  • Posts: 679
  • New Member
Re: Backlight control ( Mac OS ROM )
« Reply #1 on: April 30, 2018, 01:13:49 AM »
The trouble seems to be, that the control is inverted on the 14", so the Mac OS thinks it's turning to display to full brightness, and it's really turning it all the way down.

As a work around, we can just use the reduce brightness key to turn up the backlight.

Not sure if this is a 'NDRV' issue, another ATI driver issue, or a Mac OS ROM issue.

ELN?

Offline ELN

  • Gold Member
  • *****
  • Posts: 295
  • new to the forums
Re: Backlight control ( Mac OS ROM )
« Reply #2 on: April 30, 2018, 05:55:25 AM »
Honestly, I'm not at all sure. I haven't had much luck with this sort of subtle hardware problem (a shame, because these gremlins are often the last things making a machine unusable under OS 9). I am especially bad with Open Firmware and Forth -- maybe Daniel can help you out?

But I can offer two observations:
  • The 'backlight' NDRV was one of the only two things to change in the jump from Mac OS ROM 9.6.1 (the last one that really got *used* for anything) to 10.2.1. It is packaged as a "parcel", which the Trampoline bootloader . I have attached these two versions in case anyone is interested.
  • The 68k ROM seems quite interested in the backlight in the early stages of boot. I draw your attention to some code from StartInit.a, which is mostly the product of my reversing efforts.

Code: [Select]
;
;---------  Backlight Driver  ---------
;

        IF hasPwrControls THEN
            BTst.B    #$0, (HWCfgFlags)
            BEQ.B     @noBacklight
            BTst.B    #$6, ($2409)
            BNE.B     @noBacklight
            Move.L    #'only', -(A7)
            LEA.L   BacklightName,A1                ; get the backlight driver's name                       <SM84>
            MOVE.W  #-16511,D2                      ;  and resource ID                                      <SM84>
            BSR     InstallDriver                   ; go install the driver                                 <SM84>
            AddQ      #$4, A7
@noBacklight
   
              MoveA.L   A7, A0
              Clr.B     $1B(A0)
              Bsr       FROVideo
              Lea.L     $32(A7), A7
              BTst.B    #$6, ($2409)
              BEQ.B     @skipALine
              import    InterC_1f40_Backlight
              Bsr.L     InterC_1f40_Backlight
@skipALine

              BTst.B    #$3, ($DD3)
              BEQ       @exitDrivers
        ENDIF

Offline ELN

  • Gold Member
  • *****
  • Posts: 295
  • new to the forums
Re: Backlight control ( Mac OS ROM )
« Reply #3 on: May 05, 2018, 07:11:06 AM »
I had another peek. The attached ROM contains a patched backlight ndrv. It will spew the ParamBlock to the NK log when Control() calls are made to the driver.

First, does this ROM alter the behaviour of the backlight? It is based on 9.6.1, not 10.2.1, and I am not sure of the differences.

Second, please post the NK log messages that it produces, along with some annotations about the actual and "logical" brightness state, and which key is being pressed.

Here's the branch I'll be working in: https://github.com/elliotnunn/newworld-rom/tree/darthnvader-backlight. Commit 28a48a8.

Offline ELN

  • Gold Member
  • *****
  • Posts: 295
  • new to the forums
Re: Backlight control ( Mac OS ROM )
« Reply #4 on: May 05, 2018, 07:13:29 AM »
Just by the way (and partly to remind myself) that ROM contains a System Enabler from iMic's iBook ROM, added using https://github.com/elliotnunn/enablifier. It does not contain his "mnca" patch.

Offline ELN

  • Gold Member
  • *****
  • Posts: 295
  • new to the forums
Re: Backlight control ( Mac OS ROM )
« Reply #5 on: June 29, 2018, 01:03:51 AM »
Bump!

Offline ELN

  • Gold Member
  • *****
  • Posts: 295
  • new to the forums
Re: Backlight control ( Mac OS ROM )
« Reply #6 on: October 07, 2018, 01:04:13 AM »
Vader, never heard back from you. Fixed?

Offline darthnVader

  • Platinum Member
  • *****
  • Posts: 679
  • New Member
Re: Backlight control ( Mac OS ROM )
« Reply #7 on: October 07, 2018, 01:25:18 AM »
Vader, never heard back from you. Fixed?

I used the LCD from this in an iMac conversion, killed a spare 14", so I had to use the one form the iBook.

So I didn't really look into it further.

Offline darthnVader

  • Platinum Member
  • *****
  • Posts: 679
  • New Member
Re: Backlight control ( Mac OS ROM )
« Reply #8 on: March 02, 2021, 01:57:03 AM »
Two and a half years later.........

This ROM fails to boot on the iBook G4( PowerBook6,5) booting halts with:

Code: [Select]
Reset system - Into the 68k fire: 0002d032 6806c9e8
 VMAllocateMemory - creating area at ox69000000 0008000
CreateArea { 69000000 6907ffff } ID 00170001 placed ... created