[LDWG][FBSD_LDWG] framework kernel module

From: Chris Moerz <freebsd_at_ny-central.org>
Date: Sat, 08 Mar 2025 14:52:23 UTC
Dear LDWG community,

I recently shared on our last call that I had whipped together a kernel
module that helps battery runtime with more aggressive screen dimming; the
code is now on GitHub, if anyone is interested in checking it out.

While usual screen savers and desktop environments blank or dim after a
minute, this module allows dimming after just a second of inactivity.

https://github.com/christian-moerz/framework-kmod

I have yet to create a port for it. It comes with the kernel code and a
man page to support it. So it's rather bare bones in the documentation
department.

Currently, the module provides one key functionality - dynamically dimming
the screen when the computer is not used, and turning up brightness again
once activity by the user is detected.

It keeps track of input signals through evdev(4) and after a set timeout
period, in which no input was detected, reduces screen brightness.
Upon user input, it immediately increases screen brightness back to
previous levels.

Brightness levels for dimmed and bright state, as well as timeout
settings (the length of time that needs to pass without any input signal
before dimming the screen) can be customized through sysctls.

Those values can be set differently for when the laptop runs on power
outlet, or on battery.

I should add, this module only works, if you have drm-kmod loaded (i915kms
on Intel, amdgpu on AMD/Ryzen). I'm making use of their capabilities and
did not re-implement backlight functions.

I also have started work on a dbus client, that catches vlc's playback
hints - I hope to wire that up through a device node, so it suspends
dimming during playback.

There is also code for a Xcc based user space program; I could not yet
reliably make that work - if anyone has pointers, I'd be very interested.

Feedback and input very welcome!

chris