diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2024-10-10 13:25:47 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2024-11-01 14:12:31 -0400 |
commit | 51ba8b3eee2ccfede2c766494b38b1b3404b95e4 (patch) | |
tree | 9045030858488e25e1241f289a7d732ee2a509f5 /firmware/target/hosted/aigo | |
parent | 1c28cb439b0f2838a8132bb951787207bd0fe0f6 (diff) | |
download | rockbox-51ba8b3eee2ccfede2c766494b38b1b3404b95e4.tar.gz rockbox-51ba8b3eee2ccfede2c766494b38b1b3404b95e4.zip |
erosqhosted: Support HW volume control on rev2+ hardware
This also adds hwrev info to the debug output.
Change-Id: Ia75218cacb8f756a23a77334ea6ab69ac3b20d10
Diffstat (limited to 'firmware/target/hosted/aigo')
-rw-r--r-- | firmware/target/hosted/aigo/power-erosq.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/firmware/target/hosted/aigo/power-erosq.c b/firmware/target/hosted/aigo/power-erosq.c index 664ee144af..7c4515f616 100644 --- a/firmware/target/hosted/aigo/power-erosq.c +++ b/firmware/target/hosted/aigo/power-erosq.c | |||
@@ -45,16 +45,16 @@ const char * const sysfs_bat_status[2] = { | |||
45 | "/sys/class/power_supply/axp_battery/status", | 45 | "/sys/class/power_supply/axp_battery/status", |
46 | }; | 46 | }; |
47 | 47 | ||
48 | static int hwver = 0; | 48 | int hwver = 1; /* Exported */ |
49 | 49 | ||
50 | unsigned int erosq_power_get_battery_voltage(void) | 50 | unsigned int erosq_power_get_battery_voltage(void) |
51 | { | 51 | { |
52 | int battery_voltage; | 52 | int battery_voltage; |
53 | int x = sysfs_get_int(sysfs_bat_voltage[hwver], &battery_voltage); | 53 | int x = sysfs_get_int(sysfs_bat_voltage[hwver == 4], &battery_voltage); |
54 | 54 | ||
55 | if (!x) { | 55 | if (!x && hwver != 4) { |
56 | hwver ^= 1; | 56 | hwver = 4; |
57 | sysfs_get_int(sysfs_bat_voltage[hwver], &battery_voltage); | 57 | sysfs_get_int(sysfs_bat_voltage[hwver == 4], &battery_voltage); |
58 | } | 58 | } |
59 | 59 | ||
60 | return battery_voltage/1000; | 60 | return battery_voltage/1000; |
@@ -63,11 +63,11 @@ unsigned int erosq_power_get_battery_voltage(void) | |||
63 | unsigned int erosq_power_get_battery_capacity(void) | 63 | unsigned int erosq_power_get_battery_capacity(void) |
64 | { | 64 | { |
65 | int battery_capacity; | 65 | int battery_capacity; |
66 | int x = sysfs_get_int(sysfs_bat_capacity[hwver], &battery_capacity); | 66 | int x = sysfs_get_int(sysfs_bat_capacity[hwver == 4], &battery_capacity); |
67 | 67 | ||
68 | if (!x) { | 68 | if (!x && hwver != 4) { |
69 | hwver ^= 1; | 69 | hwver = 4; |
70 | sysfs_get_int(sysfs_bat_capacity[hwver], &battery_capacity); | 70 | sysfs_get_int(sysfs_bat_capacity[hwver == 4], &battery_capacity); |
71 | } | 71 | } |
72 | 72 | ||
73 | return battery_capacity; | 73 | return battery_capacity; |
@@ -81,11 +81,11 @@ bool charging_state(void) | |||
81 | { | 81 | { |
82 | if ((current_tick - last_tick) > HZ/2 ) { | 82 | if ((current_tick - last_tick) > HZ/2 ) { |
83 | char buf[12] = {0}; | 83 | char buf[12] = {0}; |
84 | int x = sysfs_get_string(sysfs_bat_status[hwver], buf, sizeof(buf)); | 84 | int x = sysfs_get_string(sysfs_bat_status[hwver == 4], buf, sizeof(buf)); |
85 | 85 | ||
86 | if (!x) { | 86 | if (!x && hwver != 4) { |
87 | hwver ^= 1; | 87 | hwver = 4; |
88 | sysfs_get_string(sysfs_bat_status[hwver], buf, sizeof(buf)); | 88 | sysfs_get_string(sysfs_bat_status[hwver == 4], buf, sizeof(buf)); |
89 | } | 89 | } |
90 | 90 | ||
91 | last_tick = current_tick; | 91 | last_tick = current_tick; |