diff --git a/firmware/SOURCES b/firmware/SOURCES index 57c58ead83..628e96d428 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -153,21 +153,18 @@ target/hosted/power-linux.c #if defined(AGPTEK_ROCKER) && !defined(SIMULATOR) target/hosted/agptek/button-agptek.c target/hosted/agptek/debug-agptek.c -target/hosted/agptek/power-agptek.c target/hosted/agptek/powermgmt-agptek.c #endif #if defined(SURFANS_F28) && !defined(SIMULATOR) target/hosted/surfans/button-f28.c target/hosted/surfans/debug-f28.c -target/hosted/surfans/power-f28.c target/hosted/surfans/powermgmt-f28.c #endif #if (defined(XDUOO_X3II) || defined(XDUOO_X20)) && !defined(SIMULATOR) target/hosted/xduoo/button-xduoo.c target/hosted/xduoo/debug-xduoo.c -target/hosted/xduoo/power-xduoo.c target/hosted/xduoo/powermgmt-xduoo.c #endif @@ -180,7 +177,6 @@ target/hosted/button-devinput.c target/hosted/fiio/buttonlight-fiio.c target/hosted/fiio/button-fiio.c target/hosted/fiio/debug-fiio.c -target/hosted/fiio/power-fiio.c target/hosted/fiio/powermgmt-fiio.c target/hosted/fiio/system-fiio.c target/hosted/fiio/usb-fiio.c @@ -233,7 +229,6 @@ target/hosted/sysfs.c target/hosted/power-linux.c target/hosted/backlight-unix.c target/hosted/anbernic/instant_play.c -target/hosted/anbernic/power-rgnano.c target/hosted/anbernic/button-rgnano.c target/hosted/anbernic/powermgmt-rgnano.c #endif /* RG_NANO */ diff --git a/firmware/export/config/fiiom3klinux.h b/firmware/export/config/fiiom3klinux.h index 2a8170f32f..3635940e74 100644 --- a/firmware/export/config/fiiom3klinux.h +++ b/firmware/export/config/fiiom3klinux.h @@ -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 diff --git a/firmware/export/config/rgnano.h b/firmware/export/config/rgnano.h index c75b6409e8..37b42ffe34 100644 --- a/firmware/export/config/rgnano.h +++ b/firmware/export/config/rgnano.h @@ -70,6 +70,10 @@ #define BATTERY_CAPACITY_MAX 1050 /* 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 + /* Define this for LCD backlight available */ #define BACKLIGHT_RG_NANO #define HAVE_BACKLIGHT diff --git a/firmware/target/hosted/agptek/power-agptek.c b/firmware/target/hosted/agptek/power-agptek.c deleted file mode 100644 index a327ba6d06..0000000000 --- a/firmware/target/hosted/agptek/power-agptek.c +++ /dev/null @@ -1,41 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * - * Copyright (C) 2017 by Marcin Bukat - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ -#include -#include -#include -#include -#include - -#include "system.h" -#include "power-agptek.h" -#include "power.h" -#include "panic.h" -#include "sysfs.h" - -const char * const sysfs_bat_voltage = - "/sys/class/power_supply/battery/voltage_now"; - -unsigned int agptek_power_get_battery_voltage(void) -{ - int battery_voltage; - sysfs_get_int(sysfs_bat_voltage, &battery_voltage); - - return battery_voltage/1000; -} diff --git a/firmware/target/hosted/agptek/power-agptek.h b/firmware/target/hosted/agptek/power-agptek.h deleted file mode 100644 index c6ca1eb9c9..0000000000 --- a/firmware/target/hosted/agptek/power-agptek.h +++ /dev/null @@ -1,27 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * - * Copyright (C) 2017 by Marcin Bukat - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ -#ifndef _POWER_AGPTEK_H_ -#define _POWER_AGPTEK_H_ - -#include -#include "config.h" - -unsigned int agptek_power_get_battery_voltage(void); -#endif /* _POWER_AGPTEK_H_ */ diff --git a/firmware/target/hosted/agptek/powermgmt-agptek.c b/firmware/target/hosted/agptek/powermgmt-agptek.c index 18786f2732..11728d650d 100644 --- a/firmware/target/hosted/agptek/powermgmt-agptek.c +++ b/firmware/target/hosted/agptek/powermgmt-agptek.c @@ -19,7 +19,6 @@ ****************************************************************************/ #include "powermgmt.h" #include "power.h" -#include "power-agptek.h" unsigned short battery_level_disksafe = 3470; @@ -37,8 +36,3 @@ unsigned short percent_to_volt_charge[11] = { 3485, 3780, 3836, 3857, 3890, 3930, 3986, 4062, 4158, 4185, 4196 }; - -int _battery_voltage(void) -{ - return agptek_power_get_battery_voltage(); -} diff --git a/firmware/target/hosted/anbernic/power-rgnano.c b/firmware/target/hosted/anbernic/power-rgnano.c deleted file mode 100644 index 340dc2de3e..0000000000 --- a/firmware/target/hosted/anbernic/power-rgnano.c +++ /dev/null @@ -1,64 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * - * Copyright (C) 2025 Hairo R. Carela - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ -#include -#include -#include -#include -#include - -#include "system.h" -#include "power-rgnano.h" -#include "power.h" -#include "panic.h" -#include "sysfs.h" - -const char * const sysfs_bat_voltage = - "/sys/class/power_supply/axp20x-battery/voltage_now"; - -const char * const sysfs_bat_current = - "/sys/class/power_supply/axp20x-battery/current_now"; - -const char * const sysfs_bat_level = - "/sys/class/power_supply/axp20x-battery/capacity"; - -unsigned int rgnano_power_get_battery_voltage(void) -{ - int battery_voltage; - sysfs_get_int(sysfs_bat_voltage, &battery_voltage); - - return battery_voltage; -} - -unsigned int rgnano_power_get_battery_current(void) -{ - int battery_current; - sysfs_get_int(sysfs_bat_current, &battery_current); - - /* Current is in microamps */ - return (battery_current / 1000); -} - -unsigned int rgnano_power_get_battery_capacity(void) -{ - int battery_level; - sysfs_get_int(sysfs_bat_level, &battery_level); - - return battery_level; -} diff --git a/firmware/target/hosted/anbernic/power-rgnano.h b/firmware/target/hosted/anbernic/power-rgnano.h deleted file mode 100644 index d8f0098fc1..0000000000 --- a/firmware/target/hosted/anbernic/power-rgnano.h +++ /dev/null @@ -1,29 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * - * Copyright (C) 2025 Hairo R. Carela - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ -#ifndef _POWER_RGNANO_H_ -#define _POWER_RGNANO_H_ - -#include -#include "config.h" - -unsigned int rgnano_power_get_battery_voltage(void); -unsigned int rgnano_power_get_battery_current(void); -unsigned int rgnano_power_get_battery_capacity(void); -#endif /* _POWER_RGNANO_H_ */ diff --git a/firmware/target/hosted/anbernic/powermgmt-rgnano.c b/firmware/target/hosted/anbernic/powermgmt-rgnano.c index 35904f49cb..4655bf77d5 100644 --- a/firmware/target/hosted/anbernic/powermgmt-rgnano.c +++ b/firmware/target/hosted/anbernic/powermgmt-rgnano.c @@ -20,7 +20,6 @@ ****************************************************************************/ #include "powermgmt.h" #include "power.h" -#include "power-rgnano.h" /* System handles powering off at 2% */ unsigned short battery_level_disksafe = 0; @@ -39,18 +38,3 @@ unsigned short percent_to_volt_charge[11] = { 3512, 3729, 3795, 3831, 3865, 3906, 3953, 4010, 4072, 4150, 4186 }; - -int _battery_voltage(void) -{ - return rgnano_power_get_battery_voltage(); -} - -int _battery_current(void) -{ - return rgnano_power_get_battery_current(); -} - -int _battery_level(void) -{ - return rgnano_power_get_battery_capacity(); -} diff --git a/firmware/target/hosted/fiio/power-fiio.c b/firmware/target/hosted/fiio/power-fiio.c deleted file mode 100644 index 086c3bc9cb..0000000000 --- a/firmware/target/hosted/fiio/power-fiio.c +++ /dev/null @@ -1,54 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * - * Copyright (C) 2017 by Marcin Bukat - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ -#include -#include -#include -#include -#include - -#include "system.h" -#include "power.h" -#include "panic.h" -#include "sysfs.h" -#include "usb.h" - -#include "power-fiio.h" - -const char * const sysfs_bat_voltage = - "/sys/class/power_supply/battery/voltage_now"; - -const char * const sysfs_bat_capacity = - "/sys/class/power_supply/battery/capacity"; - -unsigned int fiio_power_get_battery_voltage(void) -{ - int battery_voltage; - sysfs_get_int(sysfs_bat_voltage, &battery_voltage); - - return battery_voltage; -} - -unsigned int fiio_power_get_battery_capacity(void) -{ - int battery_capacity; - sysfs_get_int(sysfs_bat_capacity, &battery_capacity); - - return battery_capacity * 20; -} diff --git a/firmware/target/hosted/fiio/power-fiio.h b/firmware/target/hosted/fiio/power-fiio.h deleted file mode 100644 index 47143a3f67..0000000000 --- a/firmware/target/hosted/fiio/power-fiio.h +++ /dev/null @@ -1,28 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * - * Copyright (C) 2017 by Marcin Bukat - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ -#ifndef _POWER_FIIO_H_ -#define _POWER_FIIO_H_ - -#include -#include "config.h" - -unsigned int fiio_power_get_battery_voltage(void); -unsigned int fiio_power_get_battery_capacity(void); -#endif /* _POWER_FIIO_H_ */ diff --git a/firmware/target/hosted/fiio/powermgmt-fiio.c b/firmware/target/hosted/fiio/powermgmt-fiio.c index 1dac844de7..67ee9abf63 100644 --- a/firmware/target/hosted/fiio/powermgmt-fiio.c +++ b/firmware/target/hosted/fiio/powermgmt-fiio.c @@ -19,7 +19,6 @@ ****************************************************************************/ #include "powermgmt.h" #include "power.h" -#include "power-fiio.h" unsigned short battery_level_disksafe = 3470; @@ -37,15 +36,3 @@ unsigned short percent_to_volt_charge[11] = { 3485, 3780, 3836, 3857, 3890, 3930, 3986, 4062, 4158, 4185, 4196 }; - -int _battery_voltage(void) -{ - return fiio_power_get_battery_voltage(); -} - -#if 0 -int _battery_level(void) -{ - return fiio_power_get_battery_capacity(); -} -#endif diff --git a/firmware/target/hosted/fiio/usb-fiio.c b/firmware/target/hosted/fiio/usb-fiio.c index 3b1a149eea..0de6d5d9e2 100644 --- a/firmware/target/hosted/fiio/usb-fiio.c +++ b/firmware/target/hosted/fiio/usb-fiio.c @@ -26,7 +26,6 @@ #include "usb.h" #include "sysfs.h" #include "power.h" -#include "power-fiio.h" #ifdef HAVE_MULTIDRIVE void cleanup_rbhome(void); diff --git a/firmware/target/hosted/power-linux.c b/firmware/target/hosted/power-linux.c index 8d263eebec..e70e521f97 100644 --- a/firmware/target/hosted/power-linux.c +++ b/firmware/target/hosted/power-linux.c @@ -34,7 +34,38 @@ #endif #ifdef BATTERY_DEV_NAME -#define BATTERY_STATUS_PATH "/sys/class/power_supply/" BATTERY_DEV_NAME "/status" +# define BATTERY_SYSFS_PATH "/sys/class/power_supply/" BATTERY_DEV_NAME +# define BATTERY_STATUS_PATH BATTERY_SYSFS_PATH "/status" +# define BATTERY_VOLTAGE_PATH BATTERY_SYSFS_PATH "/voltage_now" +# define BATTERY_CURRENT_PATH BATTERY_SYSFS_PATH "/current_now" +# define BATTERY_LEVEL_PATH BATTERY_SYSFS_PATH "/capacity" +#endif + +/* Voltage is normally in microvolts */ +#ifndef BATTERY_VOLTAGE_SCALE_MUL +# define BATTERY_VOLTAGE_SCALE_MUL 1 +#endif + +#ifndef BATTERY_VOLTAGE_SCALE_DIV +# define BATTERY_VOLTAGE_SCALE_DIV 1000 +#endif + +/* Current is normally in microamps */ +#ifndef BATTERY_CURRENT_SCALE_MUL +# define BATTERY_CURRENT_SCALE_MUL 1 +#endif + +#ifndef BATTERY_CURRENT_SCALE_DIV +# define BATTERY_CURRENT_SCALE_DIV 1000 +#endif + +/* Level is normally in whole percentage points (0-100) */ +#ifndef BATTERY_LEVEL_SCALE_MUL +# define BATTERY_LEVEL_SCALE_MUL 1 +#endif + +#ifndef BATTERY_LEVEL_SCALE_DIV +# define BATTERY_LEVEL_SCALE_DIV 1 #endif #define POWER_STATUS_PATH "/sys/class/power_supply/" POWER_DEV_NAME "/online" @@ -55,6 +86,36 @@ bool charging_state(void) } return last_power; } + +#if (CONFIG_BATTERY_MEASURE & VOLTAGE_MEASURE) +int _battery_voltage(void) +{ + int voltage = 0; + sysfs_get_int(BATTERY_VOLTAGE_PATH, &voltage); + + return (voltage * BATTERY_VOLTAGE_SCALE_MUL) / BATTERY_VOLTAGE_SCALE_DIV; +} +#endif + +#if (CONFIG_BATTERY_MEASURE & CURRENT_MEASURE) +int _battery_current(void) +{ + int current = 0; + sysfs_get_int(BATTERY_CURRENT_PATH, ¤t); + + return (current * BATTERY_CURRENT_SCALE_MUL) / BATTERY_CURRENT_SCALE_DIV; +} +#endif + +#if (CONFIG_BATTERY_MEASURE & PERCENTAGE_MEASURE) +int _battery_level(void) +{ + int level = 0; + sysfs_get_int(BATTERY_LEVEL_PATH, &level); + + return (level * BATTERY_LEVEL_SCALE_MUL) / BATTERY_LEVEL_SCALE_DIV; +} +#endif #endif unsigned int power_input_status(void) diff --git a/firmware/target/hosted/surfans/power-f28.c b/firmware/target/hosted/surfans/power-f28.c deleted file mode 100644 index 3a52820d0f..0000000000 --- a/firmware/target/hosted/surfans/power-f28.c +++ /dev/null @@ -1,41 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * - * Copyright (C) 2017 by Marcin Bukat - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ -#include -#include -#include -#include -#include - -#include "system.h" -#include "power-f28.h" -#include "power.h" -#include "panic.h" -#include "sysfs.h" - -const char * const sysfs_bat_voltage = - "/sys/class/power_supply/battery/voltage_now"; - -unsigned int f28_power_get_battery_voltage(void) -{ - int battery_voltage; - sysfs_get_int(sysfs_bat_voltage, &battery_voltage); - - return battery_voltage/1000; -} diff --git a/firmware/target/hosted/surfans/power-f28.h b/firmware/target/hosted/surfans/power-f28.h deleted file mode 100644 index ab787f2cf4..0000000000 --- a/firmware/target/hosted/surfans/power-f28.h +++ /dev/null @@ -1,27 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * - * Copyright (C) 2017 by Marcin Bukat - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ -#ifndef _POWER_F28_H_ -#define _POWER_F28_H_ - -#include -#include "config.h" - -unsigned int f28_power_get_battery_voltage(void); -#endif /* _POWER_F28_H_ */ diff --git a/firmware/target/hosted/surfans/powermgmt-f28.c b/firmware/target/hosted/surfans/powermgmt-f28.c index 0cbdb80220..341fe6bf39 100644 --- a/firmware/target/hosted/surfans/powermgmt-f28.c +++ b/firmware/target/hosted/surfans/powermgmt-f28.c @@ -19,7 +19,6 @@ ****************************************************************************/ #include "powermgmt.h" #include "power.h" -#include "power-f28.h" // XXX all of this... blabla // max voltage is 4360 apparently @@ -40,8 +39,3 @@ unsigned short percent_to_volt_charge[11] = { 3485, 3780, 3836, 3857, 3890, 3930, 3986, 4062, 4158, 4185, 4196 }; - -int _battery_voltage(void) -{ - return f28_power_get_battery_voltage(); -} diff --git a/firmware/target/hosted/xduoo/power-xduoo.c b/firmware/target/hosted/xduoo/power-xduoo.c deleted file mode 100644 index 0b1e2f816e..0000000000 --- a/firmware/target/hosted/xduoo/power-xduoo.c +++ /dev/null @@ -1,52 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * - * Copyright (C) 2017 by Marcin Bukat - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ -#include -#include -#include -#include -#include - -#include "system.h" -#include "power-xduoo.h" -#include "power.h" -#include "panic.h" -#include "sysfs.h" - -const char * const sysfs_bat_voltage = - "/sys/class/power_supply/battery/voltage_now"; - -const char * const sysfs_bat_capacity = - "/sys/class/power_supply/battery/capacity"; - -unsigned int xduoo_power_get_battery_voltage(void) -{ - int battery_voltage; - sysfs_get_int(sysfs_bat_voltage, &battery_voltage); - - return battery_voltage/1000; -} - -unsigned int xduoo_power_get_battery_capacity(void) -{ - int battery_capacity; - sysfs_get_int(sysfs_bat_capacity, &battery_capacity); - - return battery_capacity; -} diff --git a/firmware/target/hosted/xduoo/power-xduoo.h b/firmware/target/hosted/xduoo/power-xduoo.h deleted file mode 100644 index ee016bd60b..0000000000 --- a/firmware/target/hosted/xduoo/power-xduoo.h +++ /dev/null @@ -1,28 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * - * Copyright (C) 2017 by Marcin Bukat - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ -#ifndef _POWER_XDUOO_H_ -#define _POWER_XDUOO_H_ - -#include -#include "config.h" - -unsigned int xduoo_power_get_battery_voltage(void); -unsigned int xduoo_power_get_battery_capacity(void); -#endif /* _POWER_XDUOO_H_ */ diff --git a/firmware/target/hosted/xduoo/powermgmt-xduoo.c b/firmware/target/hosted/xduoo/powermgmt-xduoo.c index 3730a8f413..7315ebd3ad 100644 --- a/firmware/target/hosted/xduoo/powermgmt-xduoo.c +++ b/firmware/target/hosted/xduoo/powermgmt-xduoo.c @@ -19,7 +19,6 @@ ****************************************************************************/ #include "powermgmt.h" #include "power.h" -#include "power-xduoo.h" unsigned short battery_level_disksafe = 3443; /* 5% */ @@ -37,17 +36,3 @@ unsigned short percent_to_volt_charge[11] = { 3485, 3780, 3836, 3857, 3890, 3930, 3986, 4062, 4158, 4185, 4196 }; - -#if defined(XDUOO_X3II) -int _battery_voltage(void) -{ - return xduoo_power_get_battery_voltage(); -} -#endif - -#if defined(XDUOO_X20) -int _battery_level(void) -{ - return xduoo_power_get_battery_capacity(); -} -#endif