2010-02-11 20:38:50

by Soeren Sonnenburg

[permalink] [raw]
Subject: Brightness control for MacBook Pro - Nvidia 9400

Dear all,

I am booting a MacBookPro5,3 using elilo and efifb. Now I'd like to use
pommed to control display brightness (which won't work). Digging around
in mbp_nvidia_bl.c I figured out that tries to control the geforce 9600M
instead of the currently active geforece 9400m

02:00.0 VGA compatible controller: nVidia Corporation G96 [GeForce 9600M GT] (rev a1)
03:00.0 VGA compatible controller: nVidia Corporation C79 [GeForce 9400M] (rev b1)

Does anyone have an idea which bytes to tweak to change brightness
levels for the 9400? Seems like 0x52f does not work - at least
setpci -s 03:00.0 0x52f.B=10 fails...

Thanks!
Soeren
--
For the one fact about the future of which we can be certain is that it
will be utterly fantastic. -- Arthur C. Clarke, 1962


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part

2010-02-11 20:44:51

by Matthew Garrett

[permalink] [raw]
Subject: Re: Brightness control for MacBook Pro - Nvidia 9400

On Thu, Feb 11, 2010 at 09:38:45PM +0100, Soeren Sonnenburg wrote:
> Dear all,
>
> I am booting a MacBookPro5,3 using elilo and efifb. Now I'd like to use
> pommed to control display brightness (which won't work). Digging around
> in mbp_nvidia_bl.c I figured out that tries to control the geforce 9600M
> instead of the currently active geforece 9400m

So, first of all, use nouveau instead. But moving on...

> 02:00.0 VGA compatible controller: nVidia Corporation G96 [GeForce 9600M GT] (rev a1)
> 03:00.0 VGA compatible controller: nVidia Corporation C79 [GeForce 9400M] (rev b1)
>
> Does anyone have an idea which bytes to tweak to change brightness
> levels for the 9400? Seems like 0x52f does not work - at least
> setpci -s 03:00.0 0x52f.B=10 fails...

Those are mmio registers, not PCI config ones. You won't be able to
change them with setpci.

--
Matthew Garrett | [email protected]

2010-02-11 23:13:37

by Soeren Sonnenburg

[permalink] [raw]
Subject: Re: Brightness control for MacBook Pro - Nvidia 9400

On Thu, 2010-02-11 at 20:44 +0000, Matthew Garrett wrote:
> On Thu, Feb 11, 2010 at 09:38:45PM +0100, Soeren Sonnenburg wrote:
> > Dear all,

Hi Matthew,

thanks for the quick answer.

> > I am booting a MacBookPro5,3 using elilo and efifb. Now I'd like to use
> > pommed to control display brightness (which won't work). Digging around
> > in mbp_nvidia_bl.c I figured out that tries to control the geforce 9600M
> > instead of the currently active geforece 9400m
>
> So, first of all, use nouveau instead. But moving on...

Unfortunately nouveau (from kernel 2.6.33-rc7) just hangs after loading
firmware and initialising fifo 1...

> > 02:00.0 VGA compatible controller: nVidia Corporation G96 [GeForce 9600M GT] (rev a1)
> > 03:00.0 VGA compatible controller: nVidia Corporation C79 [GeForce 9400M] (rev b1)
> >
> > Does anyone have an idea which bytes to tweak to change brightness
> > levels for the 9400? Seems like 0x52f does not work - at least
> > setpci -s 03:00.0 0x52f.B=10 fails...
>
> Those are mmio registers, not PCI config ones. You won't be able to
> change them with setpci.

I see...

Soeren
--
For the one fact about the future of which we can be certain is that it
will be utterly fantastic. -- Arthur C. Clarke, 1962


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part

2010-02-12 11:24:42

by Julien BLACHE

[permalink] [raw]
Subject: Re: Brightness control for MacBook Pro - Nvidia 9400

Soeren Sonnenburg <[email protected]> wrote:

Hi,

> I am booting a MacBookPro5,3 using elilo and efifb. Now I'd like to use
> pommed to control display brightness (which won't work). Digging around
> in mbp_nvidia_bl.c I figured out that tries to control the geforce 9600M
> instead of the currently active geforece 9400m

If you know how one can determine which GPU is active, let me know. I
don't have this information at the moment.

> Does anyone have an idea which bytes to tweak to change brightness
> levels for the 9400? Seems like 0x52f does not work - at least
> setpci -s 03:00.0 0x52f.B=10 fails...

I'm not sure this method actually works without the legacy BIOS. IIRC
that method was determined by reverse engineering the Windows drivers,
which means the legacy BIOS was in use.

JB.

--
Julien BLACHE <http://www.jblache.org>
<[email protected]> GPG KeyID 0xF5D65169

2010-02-12 14:15:06

by Matthew Garrett

[permalink] [raw]
Subject: Re: Brightness control for MacBook Pro - Nvidia 9400

On Fri, Feb 12, 2010 at 12:18:28PM +0100, Julien BLACHE wrote:
> Soeren Sonnenburg <[email protected]> wrote:
>
> Hi,
>
> > I am booting a MacBookPro5,3 using elilo and efifb. Now I'd like to use
> > pommed to control display brightness (which won't work). Digging around
> > in mbp_nvidia_bl.c I figured out that tries to control the geforce 9600M
> > instead of the currently active geforece 9400m
>
> If you know how one can determine which GPU is active, let me know. I
> don't have this information at the moment.

There's a _DSM method in the ACPI tables that you need to execute.

> I'm not sure this method actually works without the legacy BIOS. IIRC
> that method was determined by reverse engineering the Windows drivers,
> which means the legacy BIOS was in use.

Ah, yes - sorry, I'd forgotten that this used the smi horror. nouveau
should drive the chip brightness natively, so it's probably better to
figure out why it's breaking rather than worry about this...

--
Matthew Garrett | [email protected]

2010-02-12 16:25:28

by Julien BLACHE

[permalink] [raw]
Subject: Re: Brightness control for MacBook Pro - Nvidia 9400

Matthew Garrett <[email protected]> wrote:

Hi,

>> If you know how one can determine which GPU is active, let me know. I
>> don't have this information at the moment.
>
> There's a _DSM method in the ACPI tables that you need to execute.

Is it exposed to userspace in any way? Or, better yet, could we have an
MBP backlight driver which would hide all of this from userspace?

JB.

--
Julien BLACHE <http://www.jblache.org>
<[email protected]> GPG KeyID 0xF5D65169

2010-02-12 16:28:18

by Matthew Garrett

[permalink] [raw]
Subject: Re: Brightness control for MacBook Pro - Nvidia 9400

On Fri, Feb 12, 2010 at 05:25:22PM +0100, Julien BLACHE wrote:

> Is it exposed to userspace in any way? Or, better yet, could we have an
> MBP backlight driver which would hide all of this from userspace?

Sure, in nouveau.

--
Matthew Garrett | [email protected]

2010-02-12 16:42:18

by Soeren Sonnenburg

[permalink] [raw]
Subject: Re: Brightness control for MacBook Pro - Nvidia 9400

On Fri, 2010-02-12 at 16:28 +0000, Matthew Garrett wrote:
> On Fri, Feb 12, 2010 at 05:25:22PM +0100, Julien BLACHE wrote:
>
> > Is it exposed to userspace in any way? Or, better yet, could we have an
> > MBP backlight driver which would hide all of this from userspace?
>
> Sure, in nouveau.

OK, great convinced. Any suggestions on where to add printk's to figure
out the cause of the hang? The only thing I noticed was the fans turning
on so the machine is either stuck in a busy loop or ???

Soeren
--
For the one fact about the future of which we can be certain is that it
will be utterly fantastic. -- Arthur C. Clarke, 1962


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part

2010-02-12 16:44:18

by Matthew Garrett

[permalink] [raw]
Subject: Re: Brightness control for MacBook Pro - Nvidia 9400

On Fri, Feb 12, 2010 at 05:42:17PM +0100, Soeren Sonnenburg wrote:
> On Fri, 2010-02-12 at 16:28 +0000, Matthew Garrett wrote:
> > On Fri, Feb 12, 2010 at 05:25:22PM +0100, Julien BLACHE wrote:
> >
> > > Is it exposed to userspace in any way? Or, better yet, could we have an
> > > MBP backlight driver which would hide all of this from userspace?
> >
> > Sure, in nouveau.
>
> OK, great convinced. Any suggestions on where to add printk's to figure
> out the cause of the hang? The only thing I noticed was the fans turning
> on so the machine is either stuck in a busy loop or ???

Best bet is probably to file a bug on bugs.freedesktop.org - I'm afraid
I'm not too hot on the GPU bringup side of the driver.

--
Matthew Garrett | [email protected]

2010-02-12 16:55:57

by Soeren Sonnenburg

[permalink] [raw]
Subject: Re: Brightness control for MacBook Pro - Nvidia 9400

On Fri, 2010-02-12 at 16:44 +0000, Matthew Garrett wrote:
> On Fri, Feb 12, 2010 at 05:42:17PM +0100, Soeren Sonnenburg wrote:
> > On Fri, 2010-02-12 at 16:28 +0000, Matthew Garrett wrote:
> > > On Fri, Feb 12, 2010 at 05:25:22PM +0100, Julien BLACHE wrote:
> > >
> > > > Is it exposed to userspace in any way? Or, better yet, could we have an
> > > > MBP backlight driver which would hide all of this from userspace?
> > >
> > > Sure, in nouveau.
> >
> > OK, great convinced. Any suggestions on where to add printk's to figure
> > out the cause of the hang? The only thing I noticed was the fans turning
> > on so the machine is either stuck in a busy loop or ???
>
> Best bet is probably to file a bug on bugs.freedesktop.org - I'm afraid
> I'm not too hot on the GPU bringup side of the driver.

OK, it is here
http://bugs.freedesktop.org/show_bug.cgi?id=26546

Soeren
--
For the one fact about the future of which we can be certain is that it
will be utterly fantastic. -- Arthur C. Clarke, 1962


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part