hosted: consolidate sysfs-based battery measurement code

Several hosted targets read their battery state from a fixed
sysfs path. Get rid of the duplicated code by handling this
common case in power-linux.c.

Some targets use non-standard units in sysfs instead of the
typical microvolts / microamps, so allow the scale factors
to be overridden by the target.

Change-Id: I31dc4ffc7a2d2c066d00a74070f9f9849c1663d0
This commit is contained in:
Aidan MacDonald 2025-12-01 13:32:26 +00:00
parent 7ffdf50ba5
commit 806b71b2ed
20 changed files with 74 additions and 454 deletions

View file

@ -125,6 +125,14 @@
#define BATTERY_CAPACITY_MAX 1100 /* max. capacity selectable */
#define BATTERY_CAPACITY_INC 0 /* capacity increment */
/* Voltage reported in millivolts */
#define BATTERY_VOLTAGE_SCALE_MUL 1
#define BATTERY_VOLTAGE_SCALE_DIV 1
/* Capacity reported as a value 0-5, 20% increments */
#define BATTERY_LEVEL_SCALE_MUL 20
#define BATTERY_LEVEL_SCALE_DIV 1
/* ROLO */
#define BOOTFILE_EXT "m3k"
#define BOOTFILE "rockbox." BOOTFILE_EXT