Bug 11105 - an index reference is returned instead of an integer when evaluating _BQC - FSC Amilo Pi 2515
Summary: an index reference is returned instead of an integer when evaluating _BQC - F...
Status: CLOSED CODE_FIX
Alias: None
Product: ACPI
Classification: Unclassified
Component: ACPICA-Core (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Lin Ming
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-16 15:41 UTC by Erik Boritsch
Modified: 2008-10-24 22:55 UTC (History)
3 users (show)

See Also:
Kernel Version: 2.6.26
Tree: Mainline
Regression: ---


Attachments
acpidump output (126.51 KB, text/plain)
2008-07-16 22:59 UTC, Erik Boritsch
Details
dmesg output (25.87 KB, text/plain)
2008-07-16 23:04 UTC, Erik Boritsch
Details
debug patch (742 bytes, patch)
2008-07-17 23:39 UTC, Lin Ming
Details | Diff

Description Erik Boritsch 2008-07-16 15:41:24 UTC
Distribution: Gentoo
Hardware Environment: FSC Amilo Pi 2515
Software Environment: x86_64
Problem Description: After certain events, e.g. display off, switch desktop modes via xrand, resume from hibernate and on start monitor brightness drops to minimum (or sometimes raises to maximum). I get following dmesg output after such events (after this one the brightness minimizes):
ACPI Error (utobject-0502): Unsupported Reference opcode=88 in object ffff81007ea75XX0 [20070126]
and this happens before the brightness maximizes:
ACPI Error (utobject-0502): Unsupported Reference opcode=88 in object ffff81007eb14XX0 [20070126]

XX change each time. The kernel has opregion patch from http://bugzilla.kernel.org/show_bug.cgi?id=9995 applied and I boot with acpi_osi="!Windows 2006" as a workaround to make brightness keys work as described in http://bugzilla.kernel.org/show_bug.cgi?id=9902
This might be a BIOS bug, but I thought I'll report it nonetheless just in case it isn't :)

Steps to reproduce:turn the display on/off or switch modes.
Comment 1 Andrew Morton 2008-07-16 15:52:49 UTC
Reassigned to acpi_power-video@kernel-bugs.osdl.org
Comment 2 Zhang Rui 2008-07-16 19:03:25 UTC
Please attach the acpidump and dmesg output.
Comment 3 Erik Boritsch 2008-07-16 22:59:49 UTC
Created attachment 16854 [details]
acpidump output
Comment 4 Erik Boritsch 2008-07-16 23:04:17 UTC
Created attachment 16855 [details]
dmesg output
Comment 5 Zhang Rui 2008-07-16 23:11:11 UTC
First, please try a later kernel, say 2.6.26 which has a lot of ACPICA updates.

As all the events you described may trigger drm driver actions, could you please try again without drm driver (i915) loaded?
Comment 6 Erik Boritsch 2008-07-17 00:12:00 UTC
I don't experience the bug without i915 driver. Both framebuffer and vesa driver in X behave correctly and restore the previous value e.g. after hibernate.
Comment 7 Zhang Rui 2008-07-17 00:21:38 UTC
And I assumes that the problem can not be reproduced if you revert the opregion patch, is it true?
Comment 8 Erik Boritsch 2008-07-17 11:48:42 UTC
The headline was a bit misleading, my bad. The behavior it there even without opregion patch. 

As for kernel 2.6.26 - the initial bug was posted using this kernel, I reverted for previous version for testing.
Comment 9 Zhang Rui 2008-07-17 18:31:43 UTC
can you reproduce the problem with X and drm but without acpi video driver?

cc Zhenyu, who is an X expert. :)
Comment 10 Erik Boritsch 2008-07-17 20:26:59 UTC
Negative, this problem happens only with video module. In fact, brightness switches to minimum after I load the video module. Here is what I get in dmesg after modprobe video:
ACPI Error (utobject-0502): Unsupported Reference opcode=88 in object ffff81007eb0e4a0 [20070126]
ACPI: device:05 is registered as cooling_device2
input: Video Bus as /class/input/input12
ACPI: Video Device [GFX0] (multi-head: yes  rom: no  post: no)
Comment 11 Zhang Rui 2008-07-17 22:21:07 UTC
seems like a ACPICA/BIOS bug.
cc Ming.
Comment 12 Lin Ming 2008-07-17 23:03:31 UTC
_BQC method at SSDT2.dsl should return an integer, but it returns an index reference now.

Method (_BQC, 0, NotSerialized)
{
         -Return (Index (BTBL, \_SB.PCI0.LPCB.EC0.BKLG))
         +Return (DeRefOf(Index (BTBL, \_SB.PCI0.LPCB.EC0.BKLG)))
}
Comment 13 Lin Ming 2008-07-17 23:39:52 UTC
Created attachment 16872 [details]
debug patch

Erik,

Would you please have a try this debug patch? It should fix the issue.
Comment 14 Erik Boritsch 2008-07-18 02:02:10 UTC
This patch fixes the issue mostly. First of all /sys/class/backlight/acpi_video0/actual_brightness now does show actual brightness. /sys/class/backlight/acpi_video0/brightness shows only real and actual brightness, i.e. works as intended.

The only issue remaining is that the brightness resets to maximum if initial brightness is 0 (minimum), after e.g. xset -display :0 dpms force off.
Other values - from 1 to 7 - work as intended, the level is restored properly.
Comment 15 Erik Boritsch 2008-07-18 02:08:25 UTC
Just an observation - brightness level 0 not only indicates minimum brightness, cat /sys/class/backlight/acpi_video0/brightness returns 0 if the LVDS is completely turned off. This might be a bit confusing for the system (just a guess).
Comment 16 Zhang Rui 2008-07-20 20:09:43 UTC
So there are two bugs here:
1. an index reference is returned instead of an integer when evaluating _BQC.
   This bug is fix by Lin Ming's patch in comment #13.
2. the brightness resets to maximum if initial brightness is 0 (minimum).
   It seems like a X bug.
   Please verify if this is a duplicate of
   https://bugs.freedesktop.org/show_bug.cgi?id=16680
   If not, please file a new bug report at https://bugs.freedesktop.org/

This entry is used to track issue 1, so mark it RESOVLED.

Ming, please talk with Bob to decide if this patch should go to ACPICA first or ship in Linux directly, and then please update here. :)
Comment 17 Erik Boritsch 2008-07-20 21:41:28 UTC
Yes, you are right - issue 2 isn't reproducible without X running hence it must be the same X bug. 
Thanks for the info, good work!
Comment 18 Lin Ming 2008-07-21 17:47:29 UTC
The patch at comment #13 is not the final fix.
I'll attach an upstream ACPICA patch when available.
Comment 19 Robert Moore 2008-07-30 14:27:28 UTC
Change to ACPICA was released in version 20080729
Comment 20 Len Brown 2008-09-22 14:50:22 UTC
patch is in acpi test tree
Comment 21 Len Brown 2008-10-24 22:55:12 UTC
shipped in linux-2.6.28-rc1
closed

commit bbc241340681557a16982f4d1840f00963bc05b4
Author: Lin Ming <ming.m.lin@intel.com>
Date:   Mon Aug 4 13:22:10 2008 +0800

    ACPICA: Add function to dereference returned reference objects

    Examines the return object from a call to acpi_evaluate_object.
    Any Index or RefOf references are automatically dereferenced in
    an attempt to return something useful (these reference types
    cannot be converted into an external ACPI_OBJECT.)
    Lin Ming, Bob Moore.

Note You need to log in before you can comment on or make changes to this bug.