Need help controlling laptom display brightness via sysctl

From: Anton Shepelev <anton.txt_at_gmail.com>
Date: Wed, 03 Jul 2024 22:00:29 UTC
Hello, all.

I need your help in setting up the brightness control on my
HP 15-b0xx laptop via sysctl.  Upon perusal of the following
materials:

   https://docs.freebsd.org/en/books/handbook/config/#acpi-config
   https://forums.freebsd.org/threads/laptop-setting-display-brightness.80524/

I added

   kld_list="i915kms acpi_hp acpi_video"

to rc.conf, activated the `intel' interface modes in sysctl
variables, in loader.conf:

   hw.i915kms.enable_dpcd_backlight=3
   compat.linuxkpi.i915_enable_dpcd_backlight=3

(standard interface (=1) does not work either).  Made sure
that the modules are loaded with kldstat:

    2    1 0xffffffff82c18000   1b3920 i915kms.ko
    9    1 0xffffffff82e67000     3288 acpi_hp.ko
   11    1 0xffffffff82e6f000     4388 acpi_video.ko

And listed the relevant sysctl variables:

   hw.i915kms.enable_dpcd_backlight: 3
   hw.i915kms.invert_brightness: 0
   hw.acpi.video.lcd0.levels: 80 50 0 1 <...> 100
   hw.acpi.video.lcd0.economy: 50
   hw.acpi.video.lcd0.fullpower: 80
   hw.acpi.video.lcd0.brightness: 50
   hw.acpi.video.lcd0.active: 0
   compat.linuxkpi.i915_enable_dpcd_backlight: 3
   compat.linuxkpi.i915_invert_brightness: 0

First, I noticed that .lcd0.active above is 0, which
probably means that sysctl thinks my display inactive.
Trying to set it to unity, however, has no effect:

   hw.acpi.video.lcd0.active: 0 -> 0

with nothing new in dmesg. [Perhaps] consequentyly,

   sysctl hw.acpi.video.lcd0.brightness=70

is obeyed, but the actuall visible brightness is not
affected.  On the other hand,

   backlight 70

has the takes visible effect, but the sysctl values stay the
same.

This is my pciconf output for the display device:

   vgapci0@pci0:0:2:0: class=0x030000 rev=0x07 hdr=0x00 vendor=0x8086 device=0x1916 subvendor=0x103c subdevice=0x8328
       vendor     = 'Intel Corporation'
       device     = 'Skylake GT2 [HD Graphics 520]'
       class      = display
       subclass   = VGA

I have found nothing interesting in dmesg outoput, so here
it is in full:

   <https://pastebin.com/raw/HGitnppx>

I have FreeBSD 14.1 (stable).