Squashed backup commit (no shallow-clone history issues) of xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2 branch, upstream commit 9eece662e) plus all fixes applied to get everpal_defconfig building clean against a modern (GCC 15.2.0) toolchain -- see the previous commit message on the lineage-23.2 branch (also in this repo history is not available here since this is a squashed snapshot; full incremental history lives in the local DL380 checkout and the upstream GitHub remote). Upstream: https://github.com/xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2)
60 lines
1.4 KiB
C
60 lines
1.4 KiB
C
#ifndef __AW87XXX_MONITOR_H__
|
|
#define __AW87XXX_MONITOR_H__
|
|
|
|
/********************************************
|
|
*
|
|
* vmax of matching about capacity
|
|
*
|
|
*********************************************/
|
|
|
|
#define AW87XXX_MONITOR_DEFAULT_FLAG 0
|
|
#define AW87XXX_MONITOR_DEFAULT_TIMER_VAL 30000
|
|
#define AW87XXX_MONITOR_DEFAULT_TIMER_COUNT 2
|
|
|
|
#define AW87XXX_VBAT_CAPACITY_MIN 0
|
|
#define AW87XXX_VBAT_CAPACITY_MAX 100
|
|
#define AW_VMAX_INIT_VAL (0xFFFFFFFF)
|
|
|
|
|
|
enum aw_monitor_first_enter {
|
|
AW_FIRST_ENTRY = 0,
|
|
AW_NOT_FIRST_ENTRY = 1,
|
|
};
|
|
|
|
struct vmax_single_config {
|
|
uint32_t min_thr;
|
|
uint32_t vmax;
|
|
};
|
|
|
|
struct vmax_config {
|
|
int vmax_cfg_num;
|
|
struct vmax_single_config vmax_cfg_total[];
|
|
};
|
|
|
|
struct aw87xxx_monitor {
|
|
uint8_t first_entry;
|
|
uint8_t timer_cnt;
|
|
uint8_t cfg_update_flag;
|
|
uint8_t update_num;
|
|
uint32_t monitor_flag;
|
|
uint32_t timer_cnt_max;
|
|
uint32_t timer_val;
|
|
uint32_t vbat_sum;
|
|
uint32_t custom_capacity;
|
|
uint32_t pre_vmax;
|
|
|
|
struct delayed_work work;
|
|
struct vmax_config *vmax_cfg;
|
|
};
|
|
|
|
/**********************************************************
|
|
* aw87xxx monitor function
|
|
***********************************************************/
|
|
void aw87xxx_monitor_start(struct aw87xxx_monitor *monitor);
|
|
void aw87xxx_monitor_stop(struct aw87xxx_monitor *monitor);
|
|
void aw87xxx_monitor_init(struct aw87xxx_monitor *monitor);
|
|
void aw87xxx_parse_monitor_dt(struct aw87xxx_monitor *monitor);
|
|
|
|
|
|
#endif
|