#7525 closed bug (fixed)
Setting backlight brightness doesn't work.
Reported by: | pulkomandy | Owned by: | tqh |
---|---|---|---|
Priority: | normal | Milestone: | R1 |
Component: | Drivers/ACPI | Version: | R1/Development |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | All |
Description
The shortcut (function key + home/end) used to work fine, now they don't. My BIOS defaults to low brightness so it's quite annoying.
I think this went in in r41xxx. Will try to affine that if I get some time.
Anything I can do to help with it ?
Attachments (6)
Change History (33)
comment:1 by , 14 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
follow-up: 25 comment:2 by , 14 years ago
Not an IO-APIC problem. It just means now that the system is in real ACPI mode, it'll require ACPI brightness controls. I think we have some kind of driver concerning that already, don't know in what state it is though.
comment:3 by , 14 years ago
Owner: | changed from | to
---|
comment:4 by , 14 years ago
Was ACPI-module loaded fine and backlight working before? If it was it sounds like ACPI or its embedded controller handler are not setup correctly. A guess would be that something is not right when it is setup before the ioapic int controller. I'll provide a patch that is a big hack (only apply if you can run with ioapic atm) to see if setting up ACPI with the ioapic controller works better. Please test.
by , 14 years ago
Attachment: | acpi_init_as_ioapic_int.patch added |
---|
A crude patch that sets arch_int_set_interrupt_controller(ioapicController) before acpi is initialised.
comment:5 by , 14 years ago
patch: | 0 → 1 |
---|
comment:6 by , 14 years ago
Not sure how I'd check for a successfully loaded ACPI module, but yes, backlight adjustment worked fine before and with your patch it does so again.
comment:8 by , 14 years ago
This patch can't possibly work correctly. What happens now is that the SCI is installed incorrectly and/or not enabled anymore as the interrupt setup will run into the void (i.e. non-setup IO-APIC). I've implemented legacy PIC to IO-APIC handover as well as interrupt source overrides, so the SCI should be routed and enabled in all cases. Maybe that's actually the "problem" here, that with a working SCI the OS is now responsible for these brightness settings (which is likely not implemented).
comment:9 by , 14 years ago
Please try the KDL "ints" command after pushing the brightness controls both with and without this patch. If they are implemented through the SCI then you might see that in the handled/unhandled count of the corresponding handler (if it is set up correctly in either case).
follow-up: 11 comment:10 by , 14 years ago
Perhaps a patch with just _PIC = 1 before installing the int handlers works just as well.
I think the issue here is that _PIC = 0 and _PIC = 1 can be completly different configurations in the vendors ACPI impl, so migrating the interrupt handlers over isn't enough, you probably need to reinit the handlers or modify how ACPI and embedded controller init or install their handlers so that they do that with _PIC set correctly.
comment:11 by , 14 years ago
Replying to tqh:
Perhaps a patch with just _PIC = 1 before installing the int handlers works just as well.
I think the issue here is that _PIC = 0 and _PIC = 1 can be completly different configurations in the vendors ACPI impl, so migrating the interrupt handlers over isn't enough, you probably need to reinit the handlers or modify how ACPI and embedded controller init or install their handlers so that they do that with _PIC set correctly.
The problem is that if this was the case we wouldn't be able to fall back to the other PIC model, we either go full on IO-APIC or we don't, only depending on the IO-APIC presence and IO-APIC safemode setting.
Referencing FreeBSD though, that can't really be it. Their acpi_attach method...
http://fxr.watson.org/fxr/source/dev/acpica/acpi.c#L431
... has both, the call to AcpiEnableSubsystem() ...
http://fxr.watson.org/fxr/source/dev/acpica/acpi.c#L521
... which in turn installs the SCI interrupt handler ...
http://fxr.watson.org/fxr/source/contrib/dev/acpica/utilities/utxface.c#L244
... and the _PIC setting through the call to acpi_machdep_init() ...
http://fxr.watson.org/fxr/source/dev/acpica/acpi.c#L661
... which in turn calls acpi_SetIntrModel() ...
http://fxr.watson.org/fxr/source/dev/acpica/acpi.c#L2322
... with the "default" interrupt model set up on MADT parsing. But if you look at the sequence of things here, the AcpiEnableSubsystem() (called with flags 0, so really installing the interrupt handler) happens far earlier than setting the _PIC model. The model to be used may be decided earlier, but it really only is set after the installation of the SCI.
The more likely scenario IMO is that the interrupts are simply broken due to either the override mechanism not working correctly (I was only able to test it using the PIT, so quite possibly there's a bug in the SCI case), or the source override that configures the SCI is bogus (seems to happen according to other implementations). FreeBSD forces the SCI to a level low interrupt (as described in the ACPI specs) whereas we currently rely on the interrupt soruce override. If the source override is simply broken, that'd explain things for example. So can the affected people please add a syslog to this ticket to see what configuration the SCI would result in and what routing table is in effect. Maybe forcing the SCI to level low would be enough. It's ugly in either case, since the code configuring the interrupts doesn't actually know the SCI, but the kernel and acpi module can work that out by the acpi module explicitly configuring the interrupt line after some kind of "interrupt config done"-callback.
follow-ups: 13 15 comment:12 by , 14 years ago
Observing the output of the "ints" command didn't yield much in my case, too many numbers fluctuating with or without the patch to make any sense to me. Attaching syslog from hrev41667 (without patch).
by , 14 years ago
Attachment: | r41667_syslog.txt added |
---|
comment:13 by , 14 years ago
Replying to luroh:
Observing the output of the "ints" command didn't yield much in my case, too many numbers fluctuating with or without the patch to make any sense to me. Attaching syslog from hrev41667 (without patch).
The source override in that syslog looks fine, so no non-standard config there. Can you get a syslog with this patch applied or just with IO-APICs disabled? I wonder if this error is there in that case as well:
ACPI Error: Method parse/execution failed [\_SB_.PCI0.LPC_.EC__._INI] (Node 0x82193648), AE_NOT_EXIST (20101013/psparse-633)
by , 14 years ago
Attachment: | r41682_syslog_IO-APIC_disabled.txt added |
---|
comment:15 by , 14 years ago
So the error is there in either case...
Replying to luroh:
Observing the output of the "ints" command didn't yield much in my case, too many numbers fluctuating with or without the patch to make any sense to me.
The only thing I'm interested in is whether or not there are any handled and/or unhandled interrupts on int 9, where the ACPI interrupt handler should be installed. The thing is that the polarity and trigger mode were previously unset when only using the PIC (and when applying this patch, as the info will get lost because there's no IO-APIC structure to hold it). It's therefore possible that ACPI SCIs simply didn't work before and therefore SMIs were generated that the BIOS then handled (adjusting the brigthness for example). With IO-APIC support on and with the source override in place that, in your case, specifies the SCI interrupt to 9, active high, level triggered it might actually work now, shutting out the BIOS and therefore leaving the buttons to the OS.
What you could try to see if the source override is the "problem" would be to comment out the line:
acpi_configure_source_overrides(madt);
In browser:haiku/trunk/src/system/kernel/arch/x86/ioapic.cpp#L743 and see if that changes things.
I have checked FreeBSD again and they only force the SCI to level/low if there is no interrupt source override or if the user explicitly demanded it via settings. So I don't think doing the configuration this way is wrong per se.
comment:16 by , 14 years ago
Attaching photos of "ints", having pressed the brightness buttons a few times, with and without IO-APIC. I'll comment out that line next as suggested and revert.
by , 14 years ago
Attachment: | r41684_ints_with_IO-APIC.jpg added |
---|
by , 14 years ago
Attachment: | r41684_ints_without_IO-APIC.jpg added |
---|
follow-up: 18 comment:17 by , 14 years ago
Sorry, need more directions, getting a build failure:
src/system/kernel/arch/x86/ioapic.cpp:509: warning: `void acpi_configure_source_overrides(acpi_table_madt *)' defined but not used
comment:18 by , 14 years ago
Replying to luroh:
Sorry, need more directions, getting a build failure:
src/system/kernel/arch/x86/ioapic.cpp:509: warning: `void acpi_configure_source_overrides(acpi_table_madt *)' defined but not used
Wrap the whole acpi_configure_source_overrides() function into an #if 0 block. To do that put #if 0
at line 506 and an #endif
at line 605. Alternatively you could just delete the whole function.
follow-up: 20 comment:19 by , 14 years ago
Thanks, now I'm getting: src/system/kernel/arch/x86/ioapic.cpp:387: warning: `int32 ioapic_source_override_handler(void *)' defined but not used
comment:20 by , 14 years ago
Replying to luroh:
Thanks, now I'm getting:
src/system/kernel/arch/x86/ioapic.cpp:387: warning: `int32 ioapic_source_override_handler(void *)' defined but not used
Then remove that function as well. It starts at line 385.
comment:21 by , 14 years ago
Ok, it now built successfully but the removed lines had seemingly no effect on the brightness adjustments or the handled/unhandled interrupts of int 9, with or without IO-APIC.
comment:22 by , 14 years ago
Can you please retry with hrev41685? It most probably fixes this. The ACPI SCI was simply not enabled because I messed up the handover.
comment:23 by , 14 years ago
Indeed, that seems to have fixed it. Attaching syslog. Again, nice work!
by , 14 years ago
Attachment: | r41685_syslog.txt added |
---|
comment:24 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Great. Thanks for the testing effort! Fixed in hrev41685.
comment:25 by , 13 years ago
In addition to mmlr's right comment regarding ACPI mode, one should remember that there are some vendors which produce laptops without support of generic ACPI methods, using instead proprietary ones. In such case you'll need to write platform-specific driver, like i did for Fujitsu-Siemens notebooks: https://github.com/druga/haiku-stuff/tree/master/acpi_fujitsu_laptop .
follow-up: 27 comment:26 by , 13 years ago
dukzcry, nice stuff. I'm happy someone else does a driver using ACPI and it also shows that it is quite simple. Well done. If I get the time I will take a closer look and move it over to Haiku if you don't mind.
comment:27 by , 13 years ago
Great to hear that, tqh. But it's a draft in it's current form. Things to do, in descending priority order: 1) figure out what's wrong with HID names reading; 2) extend it to support alternative methods (SBL2 vs. SBLL, GBLS vs. GBLL) to cover more FS machines; 3) do general code cleanup (remove hacks at first) and formatting, adjust it to follow HCG.
I confirm, disabling IO-APIC makes the brightness buttons work again on my T60 laptop.