Bug 13048

Summary: /sys/class/backlight/acpi_video0/* is gone on vaio laptop with Intel GM45.
Product: ACPI Reporter: Rodrigo L. Batista (rodrigo)
Component: Power-VideoAssignee: ykzhao (yakui.zhao)
Status: CLOSED DUPLICATE    
Severity: normal CC: akpm, eric.valette, lenb, mjg59-kernel, pioto, rjw, rui.zhang, yakui.zhao
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.30-rc1 Subsystem:
Regression: Yes Bisected commit-id:
Bug Depends on:    
Bug Blocks: 13070    
Attachments: lspci -vv
acpidump
[Patch 1/2]: weaken the dependency between acpi video driver and I915 driver
[Patch 2/2]: check whether the acpi video driver is deferrable only when KMS is enabled.
[Patch 1/2]: weaken the dependency between ACPI video driver and i915 driver
patch vs 2.6.30-rc3 as applied to acpi tree

Description Rodrigo L. Batista 2009-04-09 04:57:25 UTC
Laptop: Sony Vaio VGN-FW235J
Graphics: Intel GM45 - 4500MHD

The commit 74a365b3f354fafc537efa5867deb7a9fadbfe27 broken my /sys/class/backlight/acpi_video0/*

commit 74a365b3f354fafc537efa5867deb7a9fadbfe27
Author: Matthew Garrett <mjg59@srcf.ucam.org>
Date:   Thu Mar 19 21:35:39 2009 +0000

    ACPI: Populate DIDL before registering ACPI video device on Intel

    Intel graphics hardware that implements the ACPI IGD OpRegion spec
    requires that the list of display devices be populated before any ACPI
    video methods are called. Detect when this is the case and defer
    registration until the opregion code calls it. Fixes crashes on HP
    laptops.

    http://bugzilla.kernel.org/show_bug.cgi?id=11259

    Signed-off-by: Matthew Garrett <mjg@redhat.com>
    Acked-by: Eric Anholt <eric@anholt.net>
    Signed-off-by: Len Brown <len.brown@intel.com>


Reverting the patch I see the files again (actual_brightness, brightness, max_brightness..)


Note: On boot, I see:

[Firmware Bug]: ACPI: ACPI brightness control misses _BQC function
Comment 1 Rodrigo L. Batista 2009-04-09 05:01:20 UTC
Created attachment 20893 [details]
lspci -vv
Comment 2 ykzhao 2009-04-09 05:05:59 UTC
Will you please attach the output of acpidump?
Will you please confirm whether the i915 driver is loaded when the issue
happens?
If not, please try to load the i915 driver and see whether the
/sys/class/backlight/* will appear.
    Thanks.
Comment 3 Zhang Rui 2009-04-09 05:26:21 UTC
please re-load the ACPI video driver after loading i915 driver and see if it helps.
Comment 4 Rodrigo L. Batista 2009-04-09 13:01:29 UTC
Created attachment 20905 [details]
acpidump
Comment 5 Rodrigo L. Batista 2009-04-09 13:02:10 UTC
I tried to load i915 (video module is loaded automatically) and with no success.

And when I load the video module without i915, I have the same issue.
Comment 6 Zhang Rui 2009-04-10 01:44:34 UTC
(In reply to comment #5)
> I tried to load i915 (video module is loaded automatically) and with no
> success.
> 
what do you mean by no success?
is there any error message when inserting the i915 driver?
then how about build it the drm & i915 driver?

> And when I load the video module without i915, I have the same issue.
right.
Comment 7 ykzhao 2009-04-10 02:08:35 UTC
Hi, Rodrigo
    Will you please enable the "CONFIG_DRM_I915_KMS" in kernel configuration and see whether the issue still exists?
    Thanks.
Comment 8 Rodrigo L. Batista 2009-04-10 02:56:09 UTC
(In reply to comment #6)
> what do you mean by no success?
> is there any error message when inserting the i915 driver?

No errors. I just don't see the brightness files in /sys/class/backlight/

> then how about build it the drm & i915 driver?
> 

All drivers are build as modules.
Comment 9 Rodrigo L. Batista 2009-04-10 02:56:46 UTC
(In reply to comment #7)
> Hi, Rodrigo
>     Will you please enable the "CONFIG_DRM_I915_KMS" in kernel configuration
> and see whether the issue still exists?
>     Thanks.

Hi!

Enable the CONFIG_DRM_I915_KMS works!

So, now I see the brightness files when I loading the i915.

When loading just the video module, the issue still exists.
Comment 10 ykzhao 2009-04-10 03:48:46 UTC
Thanks for the test.
    Now it seems that it will can work well again after enabling the KMS feature.
    
    If only the video driver is loaded, it will be deferred on the laptops on which the ACPI opregion is supported. Only after the I915 driver is loaded, the video driver will be initialized fully. And this will depend on the KMS feature.
    thanks.
Comment 11 ykzhao 2009-04-10 06:21:34 UTC
From the test the issue is gone if KMS feature is enabled in kernel configuration and I915 driver is loaded.
    So IMO this is not a bug. 

Hi, Rui
    How about reject this bug?
Comment 12 Andrew Morton 2009-04-10 22:01:49 UTC
Can we make any Kconfig changes which will protect other
users from encountering this problem?
Comment 13 Rodrigo L. Batista 2009-04-11 13:41:12 UTC
Anyway, it is necessary to make changes in Kconfig to solve build problems.

When i915 is set as builtin and video as module, acpi_video_register() is undefined.

  GEN     .version
  CHK     include/linux/compile.h
  UPD     include/linux/compile.h
  CC      init/version.o
  LD      init/built-in.o
  LD      .tmp_vmlinux1
drivers/built-in.o: In function `intel_opregion_init':
(.text+0x98db7): undefined reference to `acpi_video_register'
make: *** [.tmp_vmlinux1] Error 1
Comment 14 ykzhao 2009-04-13 03:36:45 UTC
Now it seems that there exist two problems about this bug.
   a. whether the backlight I/F is registered is related with the KMS (It is too strict. Maybe when KMS is not set in kernel configuration, the backlight I/F should be registered.)
   
   b. the tight dependency between the ACPI video driver and the I915 driver. If the I915 is compiled as builtin and video is compiled as module, it will fail in the kernel compilation.
   
   Thanks.
Comment 15 ykzhao 2009-04-13 14:27:44 UTC
Created attachment 20958 [details]
[Patch 1/2]: weaken the dependency between acpi video driver and I915 driver
Comment 16 ykzhao 2009-04-13 14:28:43 UTC
Created attachment 20959 [details]
[Patch 2/2]: check whether the acpi video driver is deferrable only when KMS is enabled.
Comment 17 ykzhao 2009-04-13 14:33:00 UTC
Hi, Rodrigo
    Will you please try the attached two patches in comment #15/#16 and see whether the problem can be fixed?
    The patch in comment #15 is to weaken the dependency between acpi video driver and i915 driver. And it is to fix the issue B mentioned in comment #14.
    The patch in comment #16 is to check whether acpi video driver is deferrable only KMS is enabled. It means that if KMS is not enabled in kernel configuration, the acpi video driver won't be deferrable. It is to fix the issue A mentioned in comment #14.
    Thanks.
Comment 18 Matthew Garrett 2009-04-13 14:39:09 UTC
THe second patch looks sufficient. I don't see any benefit in the first patch - if the hardware supports opregion then we have to use the i915 code. The level of dependency between the drivers is entirely fine.
Comment 19 Rodrigo L. Batista 2009-04-13 23:23:32 UTC
Hi Yakui.

The second patch works for me! Now, with and without KMS, I have the directory /sys/class/backlight/*.

With the first patch, I have issues with building:

  LD      drivers/acpi/acpi.o
  CC      drivers/acpi/video.o
drivers/acpi/video.c:91: error: 'ACPI_VIDEO_CLASS' undeclared here (not in a function)
drivers/acpi/video.c: In function 'acpi_video_init':
drivers/acpi/video.c:2280: error: implicit declaration of function 'acpi_video_register'
drivers/acpi/video.c: In function 'acpi_video_exit':
drivers/acpi/video.c:2292: error: implicit declaration of function 'acpi_video_unregister'
make[2]: *** [drivers/acpi/video.o] Error 1
make[1]: *** [drivers/acpi] Error 2
make: *** [drivers] Error 2
Comment 20 Len Brown 2009-04-14 01:38:48 UTC
moving to RESOLVED sincen patch is proposed
Comment 21 ykzhao 2009-04-14 02:13:09 UTC
Created attachment 20967 [details]
[Patch 1/2]: weaken the dependency between ACPI video driver and i915 driver
Comment 22 ykzhao 2009-04-14 02:15:41 UTC
Hi, Rodrigo
    Sorry for my fault. The header file of acpi/video.h is not include.
    Will you please try it again?
    Thanks.
Comment 23 ykzhao 2009-04-14 02:20:26 UTC
Hi, Matthew
    The patch in comment #16 will be enough to fix this issue. 
    But the dependency is too tight. We must assure that both two drivers are compiled as built-in or modules.  When the I915 is compiled as built-in and video is a module, we will fail in kernel compilation. 
    
    The first patch is only to weaken the dependency. In fact it still do what we wanted. And every driver can be loaded independently.
    Thanks.
Comment 24 Matthew Garrett 2009-04-14 03:05:11 UTC
We can express that level of dependency in kbuild. It makes more sense to do so than to add extra code.
Comment 25 Rodrigo L. Batista 2009-04-14 04:11:11 UTC
(In reply to comment #22)
> Hi, Rodrigo
>     Sorry for my fault. The header file of acpi/video.h is not include.
>     Will you please try it again?
>     Thanks.

Hi!

The second version of patch 1/2 works for me. There is no more issues.

Thanks Yakui.
Comment 26 Rafael J. Wysocki 2009-04-15 22:09:51 UTC
Handled-By : "yakui_zhao" <yakui.zhao@intel.com>
Patch : http://bugzilla.kernel.org/attachment.cgi?id=20967
Patch : http://bugzilla.kernel.org/attachment.cgi?id=20959
Comment 27 Rafael J. Wysocki 2009-04-17 21:34:59 UTC
*** Bug 13095 has been marked as a duplicate of this bug. ***
Comment 28 ykzhao 2009-04-20 02:43:30 UTC
The patch from Matthew is better to fix the brightness issue.
   >http://marc.info/?l=linux-kernel&m=123982845406021&w=2
   Thanks.
Comment 29 ykzhao 2009-04-20 05:27:38 UTC
Hi, All
    The main issue of this bug is that ACPI baclight I/F is gone. The patch in comment #16 can fix the issue. But the patch in comment #28 is better to fix this issue. 
    So please ignore the patch in comment #16.

    At the same timer there exists another issue that is related with the commit 74a365b3f354fafc537efa5867deb7a9fadbfe27. 
    >If the i915 is compiled as built-in modules and the acpi video driver is compiled as modules, we will fail in kernel compilation.
    But how to fix it is still under discussion. So please also ignore the patch in comment #15/#21.
    
    Thanks.
Comment 30 Eric Valette 2009-04-22 12:23:02 UTC
I've seen this bug on 2.6.30-rc2-git7 on fujitsu siemens amilo XI 3650. Will test today if the fix in commen 28 resolves the problem also for this hardwareand report.

I also have the message

[Firmware Bug]: ACPI: ACPI brightness control misses _BQC function

Note that with 29.1, during boot the brightness was set to low and stayed that way until somehow acpi brightness capable daemon like kpowersave was launched.
Comment 31 Eric Valette 2009-04-22 16:57:47 UTC
I updated to 30-rc3 and applied the fix in comment #28. It fixes the problem and even better, the brightness is correct during boot. I get brighness again via ACPI and button.

Well done.
Comment 32 Len Brown 2009-04-24 04:44:29 UTC
Created attachment 21101 [details]
patch vs 2.6.30-rc3 as applied to acpi tree
Comment 33 Len Brown 2009-04-30 05:50:52 UTC
shipping in 2.6.30-rc4

closed
Comment 34 Mike Kelly 2009-04-30 13:44:59 UTC
With a plain 2.6.30-rc4, I'm getting this:

drivers/built-in.o: In function `intel_opregion_free':
(.text+0xb78ea): undefined reference to `acpi_video_exit'
drivers/built-in.o: In function `intel_opregion_init':
(.text+0xb7d3c): undefined reference to `acpi_video_register'

So, I'm not sure this is fixed.
Comment 35 Len Brown 2009-04-30 14:58:20 UTC
Mike,
for the build, please try this patch:
http://patchwork.kernel.org/patch/19821
Comment 36 Mike Kelly 2009-04-30 16:43:00 UTC
(In reply to comment #35)
> Mike,
> for the build, please try this patch:
> http://patchwork.kernel.org/patch/19821

Yep, that seems to fix my build. Thanks. (Needed to have CONFIG_ACPI_VIDEO and CONFIG_BACKLIGHT_CLASS_DEVICE built in, not as modules).
Comment 37 Zhang Rui 2009-05-05 02:12:53 UTC

*** This bug has been marked as a duplicate of bug 13165 ***