Home | History | Annotate | Download | only in acpi
History log of /src/sys/dev/acpi/acpi_display.c
RevisionDateAuthorComments
 1.25  18-Aug-2024  riastradh acpi_display.c: Nix trailing whitespace.

No functional change intended.

Followup to fix for:

PR kern/57825: Malfunctioning screen brightness keys and sysctl
 1.24  10-May-2024  maya branches: 1.24.2;
Add quirk for machines were the getting the brightness value always
returns the same result by keeping a local copy of the last set value.

This makes the brightness buttons work on my Thinkpad T450s, and will
probably fix PR kern/57825 as well.
 1.23  17-Mar-2023  andvar s/Brigthness/Brightness/ in comment.
 1.22  27-Feb-2022  riastradh branches: 1.22.4;
acpivga(4): Provide hooks for ACPI display notifications.

The Intel i915 graphics driver needs to receive ACPI VGA 0x80
notifications, but with NetBSD's ACPI API, each ACPI node -- such as
the VGA node -- can only have one notifier attached, and acpivga(4)
already uses it.
 1.21  30-Dec-2021  riastradh acpiout(4): Work around firmware that doesn't like some brightnesses.

Instead of just asking for cur - 5 or cur + 5, repeatedly ask for
that increment, check whether we actually made progress in that
direction, and if not keep going with another increment, until we hit
the bounds of brightness levels.

I can't find anything in the ACPI spec about this, but my laptop
seems to have trouble with certain levels: 15, 75, 85, 95. It goes
in all other increments of 5 from 5 to 100, just not those ones --
acts as if the change just never happened, so with the old logic the
brightness up/down would get stuck unable to move in either
direction.

This should have no impact on machines where the first increment
actually takes.
 1.20  07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.19  24-Apr-2021  thorpej branches: 1.19.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.18  30-Jun-2020  sborrill branches: 1.18.4;
Only need to set brightness if reading the initial state fails
to sync firmware and the driver. Avoids black screen at boot time.
Thanks to jmcneill@
 1.17  28-Apr-2020  jmcneill Demote "unknown output device" message from error to debug, and change
the wording to reflect what is really happening -- the display output is
not connected.
 1.16  01-Jun-2017  chs branches: 1.16.2; 1.16.16;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.15  03-Apr-2016  mlelstv Add comments.
 1.14  18-Feb-2016  riastradh Avoid reading one byte past end of array.

Fixes

acpiout0: brightness levels: [20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,uvm_fault(0xffffffff8133d200, 0xffff80000c1d8000, 1) -> e
fatal page fault in supervisor mode
trap type 6 code 0 rip ffffffff803b63d7 cs 8 rflags 10212 cr2 ffff80000c1d8000 ilevel 8 rsp ffffffff816a1b00
 1.13  06-Jan-2016  christos PR/50626: Vicente Chaves de Melo: acpi_display.c erroneously sends character
to console during boot
 1.12  14-Oct-2014  christos branches: 1.12.2;
summarize levels instead of printing dozens of them.
 1.11  25-Feb-2014  pooka Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.10  02-Jun-2012  dsl branches: 1.10.2; 1.10.4;
Add some pre-processor magic to verify that the type of the data item
passed to sysctl_createv() actually matches the declared type for
the item itself.
In the places where the caller specifies a function and a structure
address (typically the 'softc') an explicit (void *) cast is now needed.
Fixes bugs in sys/dev/acpi/asus_acpi.c sys/dev/bluetooth/bcsp.c
sys/kern/vfs_bio.c sys/miscfs/syncfs/sync_subr.c and setting
AcpiGbl_EnableAmlDebugObject.
(mostly passing the address of a uint64_t when typed as CTLTYPE_INT).
I've test built quite a few kernels, but there may be some unfixed MD
fallout. Most likely passing &char[] to char *.
Also add CTLFLAG_UNSIGNED for unsiged decimals - not set yet.
 1.9  16-Feb-2011  jruoho branches: 1.9.2; 1.9.6;
Change the preprocessor defines around the module(9)'s modcmd() calls such
that the modules show in modstat(8) even though these are "builtin".
 1.8  10-Jan-2011  jruoho branches: 1.8.2; 1.8.4;
Small clean-up in the match and attach functions. Namely, use the attach
args instead of referencing the global softc. No functional change.
 1.7  07-Nov-2010  gsutre Replace ACPI_UINT64 by ACPICA's ACPI_INTEGER. Remove superfluous casts.
No functional change.
 1.6  04-Nov-2010  jruoho Initialize pointers to NULL to avoid accidentally free(9)'ing garbage.
Should address the panic reported by Alan Bueno in PR # 44042. The root
cause (an empty _DOD) is yet to be determined.
 1.5  29-Oct-2010  gsutre Lock the _DGS values (desired output state) during the display
output switch.

ok jruoho@
 1.4  28-Oct-2010  gsutre Simplify the sysctl variable for BIOS switch policy, and document it
in acpivga(4). The previous hw.acpi.acpivga0.policy variable is
renamed into bios_policy for consistency, and is for ACPI_DEBUG only.

ok jruoho@
 1.3  26-Oct-2010  gsutre An _ADR object is not required for PCI root bridges. To solve
this, the structure acpi_pciinfo now tells whether the ACPI
device node is a PCI bridge, a regular PCI device, or both.

Problem reported by jmcneill@, who also suggested the solution.

ok jmcneill@, jruoho@
 1.2  25-Oct-2010  jruoho Add support for module(9).
 1.1  12-Oct-2010  gsutre branches: 1.1.2;
Merge ACPI display driver. Provides generic support for brightness
control and output switching, through ACPI video extensions.

TODO: use wsconsctl(8) instead of sysctl(8) for brightness control.

ok jruoho@
also discussed with cegger@ and jmcneill@
 1.1.2.3  06-Nov-2010  uebayasi Sync with HEAD.
 1.1.2.2  22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.1.2.1  12-Oct-2010  uebayasi file acpi_display.c was added on branch uebayasi-xip on 2010-10-22 07:21:52 +0000
 1.8.4.1  17-Feb-2011  bouyer Sync with HEAD
 1.8.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.9.6.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.9.6.1  30-Oct-2012  yamt sync with head
 1.9.2.2  05-Mar-2011  rmind sync with head
 1.9.2.1  16-Feb-2011  rmind file acpi_display.c was added on branch rmind-uvmplock on 2011-03-05 20:53:02 +0000
 1.10.4.1  18-May-2014  rmind sync with head
 1.10.2.2  03-Dec-2017  jdolecek update from HEAD
 1.10.2.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.12.2.3  28-Aug-2017  skrll Sync with HEAD
 1.12.2.2  22-Apr-2016  skrll Sync with HEAD
 1.12.2.1  19-Mar-2016  skrll Sync with HEAD
 1.16.16.4  23-Aug-2024  martin Pull up following revision(s) (requested by riastradh in ticket #1869):

sys/dev/acpi/acpi_display.c: revision 1.24

Add quirk for machines were the getting the brightness value always
returns the same result by keeping a local copy of the last set value.

This makes the brightness buttons work on my Thinkpad T450s, and will
probably fix PR kern/57825 as well.
 1.16.16.3  20-Jan-2022  martin Pull up following revision(s) (requested by riastradh in ticket #1399):

sys/dev/acpi/acpi_display.c: revision 1.21

acpiout(4): Work around firmware that doesn't like some brightnesses.

Instead of just asking for cur - 5 or cur + 5, repeatedly ask for
that increment, check whether we actually made progress in that
direction, and if not keep going with another increment, until we hit
the bounds of brightness levels.

I can't find anything in the ACPI spec about this, but my laptop
seems to have trouble with certain levels: 15, 75, 85, 95. It goes
in all other increments of 5 from 5 to 100, just not those ones --
acts as if the change just never happened, so with the old logic the
brightness up/down would get stuck unable to move in either
direction.

This should have no impact on machines where the first increment
actually takes.
 1.16.16.2  30-Jun-2020  martin Pull up following revision(s) (requested by sborrill in ticket #978):

sys/dev/acpi/acpi_display.c: revision 1.18

Only need to set brightness if reading the initial state fails
to sync firmware and the driver. Avoids black screen at boot time.

Thanks to jmcneill@
 1.16.16.1  29-Apr-2020  martin Pull up following revision(s) (requested by jmcneill in ticket #867):

sys/dev/acpi/acpi_display.c: revision 1.17

Demote "unknown output device" message from error to debug, and change
the wording to reflect what is really happening -- the display output is
not connected.
 1.16.2.1  30-Jun-2020  martin Pull up following revision(s) (requested by sborrill in ticket #1563):

sys/dev/acpi/acpi_display.c: revision 1.18

Only need to set brightness if reading the initial state fails
to sync firmware and the driver. Avoids black screen at boot time.

Thanks to jmcneill@
 1.18.4.1  23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.19.8.1  04-Aug-2021  thorpej Adapt to CFARGS().
 1.22.4.1  23-Aug-2024  martin Pull up following revision(s) (requested by riastradh in ticket #791):

sys/dev/acpi/acpi_display.c: revision 1.24

Add quirk for machines were the getting the brightness value always
returns the same result by keeping a local copy of the last set value.

This makes the brightness buttons work on my Thinkpad T450s, and will
probably fix PR kern/57825 as well.
 1.24.2.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed