Bug 73252 - [Baytrail-M] brightness can't be adjusted: no ASLE interrupt code
Summary: [Baytrail-M] brightness can't be adjusted: no ASLE interrupt code
Status: CLOSED INVALID
Alias: None
Product: DRI
Classification: Unclassified
Component: DRM/Intel (show other bugs)
Version: XOrg git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Antti Koskipaa
QA Contact: Intel GFX Bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-03 09:45 UTC by EvaWang
Modified: 2017-07-24 22:56 UTC (History)
8 users (show)

See Also:
i915 platform:
i915 features:


Attachments
dmesg_0520.log (144.44 KB, text/plain)
2014-05-21 05:28 UTC, EvaWang
no flags Details
dmesg with drm.debug=0xe and removed loglevel=0 (61.19 KB, text/plain)
2014-05-27 09:06 UTC, EvaWang
no flags Details
dmesg with drm.debug=0xe and removed loglevel=0 0528 (246.68 KB, text/plain)
2014-05-28 01:23 UTC, EvaWang
no flags Details

Description EvaWang 2014-01-03 09:45:14 UTC
brightness can't be adjusted on Baytrail-M.

We will call ACPI _BCM method to notify BIOS and BIOS generate ASLE interrupt to VGA controller offset 0xE4. but there is no method to receive and handle this interrupt in i915. this only happens on Baytrail-M platform. please help to check. Thanks!

kernel: 3.13-RC6
Comment 1 Chris Wilson 2014-01-03 09:49:49 UTC
Did you compile in support for acpi and opregion?
Comment 2 EvaWang 2014-01-03 10:19:29 UTC
Yes, but we didn't find any handle for ASLE interrupt in i915_irq.c and i915_opregion.c. could you help to check it? Thanks!
Comment 3 Paulo Zanoni 2014-01-03 19:54:50 UTC
I couldn't find it either. Looks like we need to implement it.
Comment 4 Chris Wilson 2014-01-03 21:18:27 UTC
See intel_opregion_asle_intr(). However, the asle interrupt is no longer within pipestat and it is not clear which spec the display engine interrupts actually follow. It could be as simple as

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index e95ec8d..69996ca 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1499,6 +1499,9 @@ static irqreturn_t valleyview_irq_handler(int irq, void *arg)
                if (pm_iir)
                        gen6_rps_irq_handler(dev_priv, pm_iir);
 
+               if (iir & DE_GSE_IVB)
+                       intel_opregion_asle_intr(dev);
+
                I915_WRITE(GTIIR, gt_iir);
                I915_WRITE(GEN6_PMIIR, pm_iir);
                I915_WRITE(VLV_IIR, iir);

but it probably requires the guilty party to come forward with the actual information.
Comment 5 Paulo Zanoni 2014-01-06 11:34:29 UTC
Adding Todd since he's on a quest to find the correct BYT interrupt specs.
Comment 6 Daniel Vetter 2014-01-08 17:05:40 UTC
Or this:

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 1d44c793bdf4..b27878784ebf 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1479,6 +1479,9 @@ static irqreturn_t valleyview_irq_handler(int irq, void *arg)
                        I915_READ(PORT_HOTPLUG_STAT);
                }
 
+               if (iir & I915_ASLE_INTERRUPT)
+                       intel_opregion_asle_intr(dev);
+
                if (pipe_stats[0] & PIPE_GMBUS_INTERRUPT_STATUS)
                        gmbus_irq_handler(dev);
 

Please test both Chris' and my batch and see what happens.
Comment 7 Jani Nikula 2014-01-09 07:00:33 UTC
Side note, the world is moving towards backlight buttons generating input events (via ACPI or otherwise) to userspace, and userspace using kernel interfaces to adjust brightness. Eventually there will be no short circuit from BIOS back to the kernel for backlight; indeed this is already non-functional on some machines targeted at Windows 8.
Comment 8 Daniel Vetter 2014-01-10 07:59:39 UTC
Afaik we need this at least on some machines since the ACPI backlight uses OpRegion request to adjust the real hw backlight. So the flow on these machines is:

1. button press
2. ACPI button converted to input key event
3. Userspace calculates new backlight and frobs the ACPI backlight
4. ACPI stores request value in OpRegion and generates the special OpRegeion interrupt.
5. drm/i915 updates the backlight.
6. User is happy

Do not ask, won't tell.
Comment 9 Anthony Wong 2014-02-26 16:02:57 UTC
Tested patches in comment 4 and 6 separately but they still can't fix the issue.
Comment 10 roberth 2014-02-27 03:41:01 UTC
Any other ideas on this one besides comment #4 and comment #6? I sprinkled some DRM_DEBUG_DRIVER in there and neither one ever gets hit.
Comment 11 Antti Koskipaa 2014-04-23 12:21:33 UTC
Which device was this originally tested on? I tested with a Baytrail-M based Chromebook and the brightness adjustment buttons work.
Comment 12 Daniel Vetter 2014-05-19 14:02:49 UTC
Presumed fixed on latest -nightly. Please reopen if that's not the case.
Comment 13 EvaWang 2014-05-20 01:42:54 UTC
OK, we will try.

BTW, Whether the solution only related to the file drivers/gpu/drm/i915/i915_irq.c ?
If yes, we will make a patch to 3.14 kernel, if not, could you help to provide the patch? due to we can't use latest nightly for the project.
Comment 14 EvaWang 2014-05-21 05:28:48 UTC
Created attachment 99466 [details]
dmesg_0520.log

The brightness still can't be adjusted with 5/20 drm-intel nightly
attached dmesg_0520.log
Comment 15 Jani Nikula 2014-05-27 08:10:44 UTC
(In reply to comment #14)
> Created attachment 99466 [details]
> dmesg_0520.log

Please add drm.debug=0xe and drop loglevel=0.

> The brightness still can't be adjusted with 5/20 drm-intel nightly
> attached dmesg_0520.log

Is this what you keep getting in dmesg when you hit the hotkeys?

[   52.186865] ideapad_laptop: Unknown event: 15

Are you supposed to be using ideapad-laptop.c? For some reason it doesn't recognize your the events being generated.

What do you have under /sys/class/backlight? Do the backlight interfaces work by echoing values to the brightness files?
Comment 16 Jani Nikula 2014-05-27 08:13:41 UTC
(In reply to comment #15)
> Is this what you keep getting in dmesg when you hit the hotkeys?
> 
> [   52.186865] ideapad_laptop: Unknown event: 15

CC David, perhaps he has ideas what ideapad-laptop is good for.
Comment 17 EvaWang 2014-05-27 09:06:41 UTC
Created attachment 99939 [details]
dmesg with drm.debug=0xe and removed loglevel=0

when press the brightness hotkey, it shows ideapad_laptop: Unkown event:15
ls /sys/class/backlight
> acpi_video0  intel_backlight

echo value to acpi_video0/brightness, brightness no change.(this is used for OS.)
echo value to intel_backlight/brightness, brightness can be modified.
Comment 18 Jani Nikula 2014-05-27 11:02:16 UTC
(In reply to comment #17)
> Created attachment 99939 [details]
> dmesg with drm.debug=0xe and removed loglevel=0

I don't see drm.debug=0xe nor debug messages.

> when press the brightness hotkey, it shows ideapad_laptop: Unkown event:15

That's a problem, and one I can't help with.

> ls /sys/class/backlight
> > acpi_video0  intel_backlight
> 
> echo value to acpi_video0/brightness, brightness no change.(this is used for
> OS.)

This is another problem. Aaron (CC), how does the asle irq get triggered? Can you debug this part please?

> echo value to intel_backlight/brightness, brightness can be modified.
Comment 19 EvaWang 2014-05-28 01:23:56 UTC
Created attachment 99991 [details]
dmesg with drm.debug=0xe and removed loglevel=0  0528

Sorry, attached dmesg with drm.debug=0xe and removed loglevel=0  0528
Comment 20 EvaWang 2014-05-28 01:24:37 UTC
We will check "when press the brightness hotkey, it shows ideapad_laptop: Unkown event:15" Thanks!
Comment 21 Aaron Lu 2014-05-28 02:12:15 UTC
(In reply to comment #18)
> (In reply to comment #17)
> > Created attachment 99939 [details]
> > dmesg with drm.debug=0xe and removed loglevel=0
> 
> I don't see drm.debug=0xe nor debug messages.
> 
> > when press the brightness hotkey, it shows ideapad_laptop: Unkown event:15
> 
> That's a problem, and one I can't help with.
> 
> > ls /sys/class/backlight
> > > acpi_video0  intel_backlight
> > 
> > echo value to acpi_video0/brightness, brightness no change.(this is used for
> > OS.)
> 
> This is another problem. Aaron (CC), how does the asle irq get triggered?
> Can you debug this part please?

By firmware ASL code to write 1 to the PCI ASLE register(0xe4) I suppose, which is done after firmware has set some appropriate value in some operation region registers(so that the i915 irq handler knows what service the firmware has requested). The problem is, firmware may not use operation region to control backlight in this system(acpidump should tell us this) and if i915 irq will handle that or not(I don't know much about this).

Another problem for this system is that if it could receive any event on backlight hotkey press, the 'Unknown event: 15' looks problematic and should be taken care by the platform driver ideapad_laptop or udev's keymapping.

Eva, if you run acpi_listen on cmdline and then press the backlight hotkey, did you see any output?
Comment 22 EvaWang 2014-05-28 02:41:26 UTC
apci_listen result:

video/brightnessdown BRTDN 00000087 00000000
video/brightnessdown BRTDN 00000087 00000000 K
video/brightnessup BRTUP 00000086 00000000
video/brightnessup BRTUP 00000086 00000000 K
Comment 23 Aaron Lu 2014-05-28 03:01:01 UTC
(In reply to comment #22)
> apci_listen result:
> 
> video/brightnessdown BRTDN 00000087 00000000
> video/brightnessdown BRTDN 00000087 00000000 K
> video/brightnessup BRTUP 00000086 00000000
> video/brightnessup BRTUP 00000086 00000000 K

OK, you get the event. I think the only thing you need is to add: video.use_native_backlight=1 to kernel cmdline and then your hotkey should work.

But of course, if the i915 irq handler can be modified to handle opregion requests, the acpi video interface could probably also work.
Comment 24 EvaWang 2014-05-28 03:46:45 UTC
Added video.use_native_backlight=1 to kernel cmdline, hotkey still can't adjust brightness.

There is only intel_backlight in /sys/class/backlight
Comment 25 Aaron Lu 2014-05-28 04:16:49 UTC
(In reply to comment #24)
> Added video.use_native_backlight=1 to kernel cmdline, hotkey still can't
> adjust brightness.
> 
> There is only intel_backlight in /sys/class/backlight

The working interface is there and events are sent out, I don't get why hotkey doesn't work. Which GUI environment are you using?
Comment 26 EvaWang 2014-05-28 05:26:52 UTC
Gnome based on Fedora 17
Comment 27 Aaron Lu 2014-05-28 05:40:22 UTC
(In reply to comment #26)
> Gnome based on Fedora 17

Please turn on backlight debug messages by:
# cd /sys/kernel/debug/dynamic_debug
# echo 'module backlight +fpc' > control

And then run acpi_listen and press hotkey, see if any events are printed out and check dmesg for any brightness related messages.
Comment 28 EvaWang 2014-05-28 07:05:18 UTC
when run the command: echo 'module backlight +fpc' > control
It shows: bash: echo: write error: Invalid argument
Comment 29 Aaron Lu 2014-05-28 07:16:55 UTC
(In reply to comment #28)
> when run the command: echo 'module backlight +fpc' > control

Sorry, should be +fpt, not +fpc

> It shows: bash: echo: write error: Invalid argument
Comment 30 EvaWang 2014-05-28 08:05:21 UTC
apci_listen result is the same as before:

video/brightnessdown BRTDN 00000087 00000000
video/brightnessdown BRTDN 00000087 00000000 K
video/brightnessup BRTUP 00000086 00000000
video/brightnessup BRTUP 00000086 00000000 K
Comment 31 Aaron Lu 2014-05-28 08:38:52 UTC
(In reply to comment #30)
> apci_listen result is the same as before:
> 
> video/brightnessdown BRTDN 00000087 00000000
> video/brightnessdown BRTDN 00000087 00000000 K
> video/brightnessup BRTUP 00000086 00000000
> video/brightnessup BRTUP 00000086 00000000 K

And what about the dmesg, any new lines related to brightness appeared?
Comment 32 EvaWang 2014-05-28 08:55:35 UTC
(In reply to comment #31)
> (In reply to comment #30)
> > apci_listen result is the same as before:
> > 
> > video/brightnessdown BRTDN 00000087 00000000
> > video/brightnessdown BRTDN 00000087 00000000 K
> > video/brightnessup BRTUP 00000086 00000000
> > video/brightnessup BRTUP 00000086 00000000 K
> 
> And what about the dmesg, any new lines related to brightness appeared?

[20123.114901] [drm:valleyview_set_rps] GPU freq request from 844 MHz (221) to 844 MHz (221)
[20123.118474] [drm:valleyview_set_rps] GPU freq request from 844 MHz (221) to 844 MHz (221)
[20123.122418] [drm:drm_mode_addfb] [FB:31]
[20123.174964] [drm:drm_mode_addfb] [FB:32]
[20123.277038] ideapad_laptop: Unknown event: 15
[20123.693979] [drm:valleyview_set_rps] GPU freq request from 844 MHz (221) to 844 MHz (221)
[20124.294834] [drm:valleyview_set_rps] GPU freq request from 844 MHz (221) to 844 MHz (221)
[20124.902229] [drm:valleyview_set_rps] GPU freq request from 844 MHz (221) to 844 MHz (221)
[20125.496200] [drm:valleyview_set_rps] GPU freq request from 844 MHz (221) to 844 MHz (221)
[20127.231195] [drm:valleyview_set_rps] GPU freq request from 844 MHz (221) to 400 MHz (201)
[20127.236489] [drm:valleyview_set_rps] GPU freq request from 400 MHz (201) to 844 MHz (221)
[20127.765270] [drm:drm_mode_addfb] [FB:31]
[20128.297023] ideapad_laptop: Unknown event: 15
[20128.338821] [drm:valleyview_set_rps] GPU freq request from 844 MHz (221) to 844 MHz (221)
[20128.714335] [drm:drm_mode_addfb] [FB:32]
[20129.288751] [drm:valleyview_set_rps] GPU freq request from 844 MHz (221) to 844 MHz (221)
[20129.889476] [drm:valleyview_set_rps] GPU freq request from 844 MHz (221) to 844 MHz (221)
[20130.225780] [drm:drm_mode_addfb] [FB:31]
[20130.378385] [drm:drm_mode_addfb] [FB:32]
[20130.515744] [drm:drm_mode_addfb] [FB:31]
[20130.522115] [drm:valleyview_set_rps] GPU freq request from 844 MHz (221) to 844 MHz (221)
Comment 33 Aaron Lu 2014-05-28 09:05:02 UTC
OK, no any messages about brightness appeared. I think this is a GUI bug(user space).
Comment 34 Daniel Vetter 2014-06-18 15:24:36 UTC
(In reply to comment #33)
> OK, no any messages about brightness appeared. I think this is a GUI
> bug(user space).

Closing accordingly.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.