Bug 207086

Summary: unable to change LCD brightness on Lenovo Thinkpad Edge E145
Product: Base System Reporter: aeuii
Component: kernAssignee: Andriy Gapon <avg>
Status: Closed FIXED    
Severity: Affects Some People CC: Scoobi_doo, avg
Priority: --- Keywords: feature, needs-qa
Version: 10.2-STABLE   
Hardware: amd64   
OS: Any   
Attachments:
Description Flags
Store brightness value in static variable; don't complain if _BQC method is missing.
none
Add rudimentary backlight support to Radeon chipsets. none

Description aeuii 2016-02-10 17:28:05 UTC
I'm unable to change LCD brightness on Lenovo Thinkpad Edge E145 using ☼+ and ☼- buttons. To be more specific, the brightness can be changed only until an early system boot.  It works in the loader menu, and right after kernel is loaded, but stops working soon after that (perhaps when acpi0 is loaded: “acpi0: <LENOVO TP-HS> on motherboard”).

I tested multiple FreeBSD version:

Affected FreeBSD versions:
  - 11.0: FreeBSD-11.0-CURRENT-amd64-20160206-r295345-memstick.img
  - 10.3: FreeBSD-10.3-PRERELEASE-amd64-20160127-r294913-memstick.img
  - 10.2: 10.2-RELEASE-p12
  - 10.1: FreeBSD-10.1-RELEASE-amd64-memstick.img

Working version:
  - 9.3: FreeBSD-9.3-RELEASE-amd64-memstick.img (with “CPU0: local
    ACPI error 0x80”)

As you can see, the problem occurred between 9.3 and 10.1.
 

I also tried different methods to change the brightness on 10.2:

acpi_call
=========

acpi_call -v -p '\VBRU'

Path: \VBRU
Number of arguments: 0
ioctl: Device not configured

# no effect


acpi_ibm
========

sysctl dev.acpi_ibm.0.lcd_brightness=7

# value changes, but it no effect on the brightness


acpi_video
==========

sysctl hw.acpi.video.lcd0.brightness=50
hw.acpi.video.lcd0.brightness: 50 -> #

# no effect

pressing Fn+☼+- buttons has no effect, but logs:

can't evaluate \134_SB_.PCI0.VGA_.LCD_._BQC - AE_NOT_FOUND
Comment 1 Anthony Jenkins 2017-10-31 00:57:24 UTC
A missing _BQC method was one of my problems; I modified my DSDT to add a _BQC method, but later I patched the kernel to not complain if it was missing. The other problem was the backlight code in the kernel for Radeon chipsets.  I'll stick both patches here (git-based).
Comment 2 Anthony Jenkins 2017-10-31 00:59:25 UTC
Created attachment 187601 [details]
Store brightness value in static variable; don't complain if _BQC method is missing.
Comment 3 Anthony Jenkins 2017-10-31 01:02:08 UTC
Created attachment 187602 [details]
Add rudimentary backlight support to Radeon chipsets.
Comment 4 Kubilay Kocak freebsd_committer freebsd_triage 2019-03-11 02:04:20 UTC
If this is still an issue (not resolved already in drm-kmod), should the Radeon bits (in attachment 187602 [details]) be sent to drm-kmod upstream since drm was removed from base?
Comment 5 aeuii 2019-03-11 09:03:44 UTC
(In reply to Kubilay Kocak from comment #4)

I'm not able to test this any more.  So I'm unable to confirm if this is still an issue or not.
Comment 6 commit-hook freebsd_committer freebsd_triage 2020-05-05 12:14:31 UTC
A commit references this bug:

Author: avg
Date: Tue May  5 12:14:12 UTC 2020
New revision: 360657
URL: https://svnweb.freebsd.org/changeset/base/360657

Log:
  acpi_video: try our best to work on systems without non-essential methods

  Only _BCL and _BCM methods seem to be essential to the driver's
  operation.  If _BQC is missing then we can assume that the current
  brightness is whatever we set by the last _BCM invocation.  If _DCS or
  _DGS is missing the we can make assumptions as well.

  The change is based on a patch suggested by Anthony Jenkins
  <Scoobi_doo@yahoo.com> in PR 207086.

  PR:		207086
  Submitted by:	Anthony Jenkins <Scoobi_doo@yahoo.com (earlier version)
  Reviewed by:	manu
  MFC after:	3 weeks
  Differential Revision: https://reviews.freebsd.org/D24653

Changes:
  head/sys/dev/acpica/acpi_video.c
Comment 7 Andriy Gapon freebsd_committer freebsd_triage 2020-05-05 13:32:48 UTC
I think that the second patch from Anthony is obsolete now because drm has been removed from the FreeBSD source tree.
Comment 8 Anthony Jenkins 2020-05-05 15:36:49 UTC
(In reply to Andriy Gapon from comment #7)

I agree; I'd have to port my patch to graphics/drm-*-kmod. I've been tinkering with an ACPI backlight driver implementation similar to Linux', but I'm not happy with my port from Linux.  I think their implementation got spackled with patches for all the backlight variations (as avg@ noted in code review).

Thanks everyone for your work on this!
Comment 9 commit-hook freebsd_committer freebsd_triage 2020-05-26 05:54:04 UTC
A commit references this bug:

Author: avg
Date: Tue May 26 05:54:00 UTC 2020
New revision: 361495
URL: https://svnweb.freebsd.org/changeset/base/361495

Log:
  MFC r360657: acpi_video: support systems without non-essential methods

  Only _BCL and _BCM methods seem to be essential to the driver's
  operation.  If _BQC is missing then we can assume that the current
  brightness is whatever we set by the last _BCM invocation.  If _DCS or
  _DGS is missing then we can make assumptions as well.

  The change is based on a patch suggested by Anthony Jenkins
  <Scoobi_doo@yahoo.com> in PR 207086.

  PR:		207086

Changes:
_U  stable/12/
  stable/12/sys/dev/acpica/acpi_video.c