可以通过dts设定battery相关信息,比如容量,内阻,不同温度的补偿策略等。
bat: battery 节点
bat: battery {
compatible = "simple-battery";
charge-full-design-microamp-hours = <3690000>; //电池容量μAh
charge-term-current-microamp = <120000>; //截止充电电流μA
constant_charge_voltage_max_microvolt = <4400000>; //截止充电电压μV
factory-internal-resistance-micro-ohms = <125000>; //电池内阻μΩ
voltage-min-design-microvolt = <3450000>; //电池alarm电压μV
ocv-capacity-celsius = <20>; // ocv-capacity-table-0代表是在哪个温度下测量
ocv-capacity-table-0 = <4380000 100>, <4317000 95>, <4258000 90>, //OCV到电量映射表
<4200000 85>, <4145000 80>, <4092000 75>,
<4047000 70>, <3990000 65>, <3955000 60>,
<3900000 55>, <3861000 50>, <3834000 45>,
<3813000 40>, <3796000 35>, <3783000 30>,
<3770000 25>, <3752000 20>, <3730000 15>,
<3698000 10>, <3687000 5>, <3400000 0>;
voltage-temp-table = <1095000 800>, <986000 850>, <878000 900>, //内阻-电压映射表
<775000 950>, <678000 1000>, <590000 1050>,
<510000 1100>, <440000 1150>, <378000 1200>,
<324000 1250>, <278000 1300>, <238000 1350>,
<204000 1400>, <175000 1450>, <150000 1500>,
<129000 1550>, <111000 1600>, <96000 1650>;
//电池容量 – 温度补偿表
capacity-temp-table = <45 100>, <25 100>, <10 97>, <0 95>, <(-10) 82>, <(-20) 62>;
//电池内阻值 – 温度补偿表
resistance-temp-table = <45 100>, <25 100>, <10 483>, <0 680>, <(-10) 789>, <(-20) 816>;
//不同充电器类型充电限流值
charge-sdp-current-microamp = <500000 500000>;
charge-dcp-current-microamp = <2000000 3000000>;
charge-cdp-current-microamp = <1150000 1150000>;
charge-unknown-current-microamp = <500000 500000>;
charge-fchg-current-microamp = <3250000 3000000>;
};
kernel log:
sc27xx_fgu_get_vbat_ocv cur = -703, volt = 4216, resistance = 125
healthd: battery l=88 v=4220 t=22.6 h=2 st=3 c=-705 fc=5930000 chg=
项目开发过程,务必根据电池特性等各参数去设定,不然可能会出现电量不准,续航等问题,比如:
内阻设定过小,就会影响亮屏播视频测试直接关机,或者续航时间跟理论值相差有点大等问题。