Page MenuHomeFreeBSD

Add an AC line monitor so power_profile can work
ClosedPublic

Authored by jhibbits on Oct 12 2014, 3:53 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 10 2024, 6:54 AM
Unknown Object (File)
Jan 14 2024, 5:35 AM
Unknown Object (File)
Jan 10 2024, 7:14 AM
Unknown Object (File)
Jan 10 2024, 7:14 AM
Unknown Object (File)
Jan 10 2024, 7:14 AM
Unknown Object (File)
Jan 10 2024, 7:02 AM
Unknown Object (File)
Dec 27 2023, 11:30 AM
Unknown Object (File)
Sep 6 2023, 8:34 AM
Subscribers

Details

Summary

Add a polling loop (1Hz) to monitor the battery and AC status, to notify devd
like ACPI does for power monitoring. This allows /etc/rc.d/power_profile to
work on PowerPC laptops

Test Plan

Tested on a Titanium PowerBook, configuring economy_cpu_freq and
performance_cpu_freq, disabling powerd.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

jhibbits retitled this revision from to Add an AC line monitor so power_profile can work.
jhibbits updated this object.
jhibbits edited the test plan for this revision. (Show Details)
jhibbits added reviewers: PowerPC, nwhitehorn.
nwhitehorn edited edge metadata.

Nice work! I do wonder (this is out of scope, however) whether it is worth standardizing some of these interfaces. Hopefully various ARM hardwares (Chromebooks, for example) will acquire the same features.

This revision is now accepted and ready to land.Oct 12 2014, 4:06 PM

What happens if you remove the battery? Shouldn't the thread have some condition variable to let it terminate?

In D937#6, @rpaulo wrote:

What happens if you remove the battery? Shouldn't the thread have some condition variable to let it terminate?

There is one enhancement I want to make, to both this and the pmac_thermal thread, and that is to suspend the thread via a sysctl, instead of, in the case of pmac_thermal, just idling every second.

If you remove the battery, you would still depend on the AC line, so this wouldn't matter. I tested just now, that if you boot with no battery, it still detects that a battery is allowed, so the thread starts up.

What happens on systems with no battery? For example, desktops?

On systems where a battery will never be found, the thread doesn't start up. It's the same logic as adding the sysctls.

jhibbits updated this revision to Diff 1968.

Closed by commit rS273009 (authored by @jhibbits).