Charge日志分析

2019-02-26  本文已影响0人  心简单世界就简单_e383

1 Charge 过程的log

log关键字healthd(android自带关键字 )

healthd: battery l=76 v=4069 t=27.0 h=2 st=2 c=-31 cc=0 ct=8 chg=a

日志解读

<3.3V 灯闪烁,黑屏 ,xbl阶段
3.3V~3.6V 灯闪烁,黑屏且屏幕有电池框和小闪电图标,uefi阶段
3.6V charger only mode

      0度以下 :不充电
      0-5度   :0.3C C可以电池容量
      5-15度  :900mA 电流(温度过低的时候,为了保护电池,软件上我们会对电流做限流
      15-45度 :正常的温度范围
      45-60度 : 限制电流
      60度以上:不充电直接关机

备注: battery l=46 v=0 t=-2.2 h=2 st=3 c=0 chg=a 开机时候的-2.2是因为是默认值,可以不care

     BATTERY_HEALTH_UNKNOWN = 1, 未知
     BATTERY_HEALTH_GOOD = 2, 正常
     BATTERY_HEALTH_OVERHEAT = 3,电池温度过高
     BATTERY_HEALTH_DEAD = 4,电池低电(这个一般是指电池已经需要进入到预充电,或者极极端情况)
     BATTERY_HEALTH_OVER_VOLTAGE = 5,电池过压保护
     BATTERY_HEALTH_UNSPECIFIED_FAILURE = 6,
     BATTERY_HEALTH_COLD = 7,电池温度过低
     BATTERY_HEALTH_COOL = 8,电池温度低
        st=1  unknown
        st=2  充电状态
        st=3  没插充电器
        st=4  插着充电器没充
        st=5  充电充满了
        POWER_SUPPLY_STATUS_UNKNOWN = 0,  //st=1
        POWER_SUPPLY_STATUS_CHARGING,     //st=2
        POWER_SUPPLY_STATUS_DISCHARGING,  //st=3
        POWER_SUPPLY_STATUS_NOT_CHARGING, //st=4
        POWER_SUPPLY_STATUS_FULL,         //st=5

刚插入充电器存在识别的过程
healthd: battery l=22 v=3699 t=25.0 h=2 st=3 c=233 chg=
healthd: battery l=22 v=3699 t=25.0 h=2 st=3 c=233 chg=
healthd: battery l=22 v=3699 t=25.0 h=2 st=4 c=233 chg=a
healthd: battery l=22 v=3699 t=25.0 h=2 st=4 c=233 chg=a
healthd: battery l=22 v=3699 t=25.0 h=2 st=4 c=233 chg=a
healthd: battery l=22 v=3710 t=25.0 h=2 st=4 c=228 chg=a
healthd: battery l=22 v=3710 t=24.7 h=2 st=4 c=228 chg=a
healthd: battery l=22 v=3710 t=24.7 h=2 st=4 c=228 chg=a
healthd: battery l=22 v=3710 t=24.7 h=2 st=4 c=228 chg=a
healthd: battery l=22 v=3710 t=24.7 h=2 st=2 c=228 chg=a
healthd: battery l=22 v=3710 t=24.7 h=2 st=2 c=228 chg=a

       正值放电,负值充电
  • 这个电流值C是个平均值,拔出瞬间为负的,持续一段时间都是可以的
  • 充电电流会进入到电池和系统使用
        ct=8  QC2.0
        ct=0  CDP  
        ct=5  5V1A   
        ct=12 float  
        ct=10 PD
         u表示:usb
         a表示:ac充电
         无表示:没有充电

2 Charge类型的识别

log关键字:smblib_update_usb_type

QC3.0充电器识别过程:先识别成DCP HVDCP2 HVDCP3

PMI: smblib_update_usb_type: APSD=DCP PD=0
PMI: smblib_update_usb_type: APSD=HVDCP2 PD=0
PMI: smblib_update_usb_type: APSD=HVDCP3 PD=0

smblib_update_usb_type: APSD=HVDCP2
smblib_update_usb_type: APSD=CDP
smblib_update_usb_type: APSD=DCP

usb类型识别错误 5: 5:dcp 5v 2A
Line 115784: [ 2.790581] SMBCHG: smbchg_change_usb_supply_type: Type 5: setting mA = 1800

smblib_update_usb_type: APSD=SDP
smblib_update_usb_type: APSD=FLOAT
  • 慢插入或插了一半导致
  • 数据线D+/D- 焊接问题导致;
  • 用户使用是FLOAT充电器;
  • 快充偶现误识别为FLOAT
smblib_update_usb_type: APSD=OCP 
  • 确实是OCP充电器(苹果手机标配充电器)
  • 快充偶现误识别为OCP

3 Charge 限流日志

SMBCHG: smbchg_system_temp_level_set: thermal level is 0, batt temp is 312
  • thermal level :0表示正常
    thermal level :(1,2,3,4,5,6)表示值越大充电越慢,电流越小
  • XO表示的主板的温度,thermal是限制的主板的温度
  ICL VOTERS  谁最小用谁的电流充电

[ 11.464787] smblib_screen_on_work: screen_on set ICL 1600000 mA
[ 11.464892] USB_PSY_VOTER: val: 100000
[ 11.464915] FB_SCREEN_VOTER: val: 1600000
[ 11.464945] USB_ICL: current vote is now 100000 voted by USB_PSY_VOTER,2,previous voted 100000

表示电流设置为100mA 

<6>[ 8.287221] USB_PSY_VOTER: val: 100000
<6>[ 8.287225] USB_ICL: current vote is now 100000 voted by USB_PSY_VOTER,2,previous voted 500000

4 USB识别类型日志

usb类型识别日志 4:usb sdp(500ma)
               6: cdp(1500ma) 
               5: dcp 5v 2A  
               8: QC2.0  
              12:float 
              10: PD   
               9: 标配正常的充电器(QC3.0)

SMBCHG: smbchg_change_usb_supply_type: Type 4: setting mA = 500
SMBCHG: smbchg_change_usb_supply_type: Type 5: setting mA = 1800

手机跟电脑连接相同wifi连
adb tcpip 5555          
adb connect wifiIP地址
/sys/class/power_supply/usb # cat real_type

5 其他异常日志

 当反复触发插拔时,表示充电器坏了。

SMBCHG: src_detect_handler: chip->usb_present = 0 usb_present = 1 src_detect = 1 hvdcp_3_det_ignore_uv=0,表示插入
SMBCHG: src_detect_handler: chip->usb_present = 1 usb_present = 0 src_detect = 0 hvdcp_3_det_ignore_uv=0,表示拔出

<6>[  289.780635] SMBCHG: power_ok_handler: triggered: 0x00
<6>[  289.782017] SMBCHG: src_detect_handler:  chip->usb_present = 1 usb_present = 0 src_detect = 0 hvdcp_3_det_ignore_uv=0
<6>[  289.782039] SMBCHG: usbin_uv_handler:  chip->usb_present = 1 rt_sts = 0x01 hvdcp_3_det_ignore_uv = 0 aicl = 1500
<6>[  289.782076] SMBCHG: hwaicl_disable: 1 voting for 0 - off
<6>[  289.782097] SMBCHG: usb_suspend: 6 voting for 0 - off
<6>[  289.782118] SMBCHG: handle_usb_removal: triggered
<6>[  289.782147] SMBCHG: smbchg_change_usb_supply_type: Type 4: setting mA = 500
<6>[  289.782166] SMBCHG: usb_icl: 0 voting for 500 - on
<6>[  289.782183] SMBCHG: usb_icl: effective vote is now 500 voted by 0
<6>[  289.782201] SMBCHG: smbchg_set_usb_current_max: USB current_ma = 500
<6>[  289.782303] SMBCHG: smbchg_set_usb_current_max: usb type = 4 current set to 500 mA
<6>[  289.783006] SMB1351 smb1351_parallel_set_chg_present: set slave present = 0
<6>[  289.783062] SMBCHG: usb_icl: 4 voting for 0 - off
<6>[  289.783080] SMBCHG: usb_icl: 5 voting for 0 - off
<6>[  289.783097] SMBCHG: hwaicl_short_deglitch: 1 voting for 0 - off
<6>[  289.783257] SMBCHG: hvdcp_enable: 2 voting for 0 - on 

<3>[ 38.646775] usbhs_power_supply_event: enter
<3>[ 38.646781] usbhs_get_typec_mode: Type-C mode is 0
<3>[ 38.646785] usbhs_power_supply_event: typec mode 6 to 0
<6>[ 38.646789] usbpd usbpd0: USB Type-C disconnect

保证main和slave 两个充电charger的芯片充电的时候,
一旦发现温度过高(超过设定的值),一个芯片向另一个芯片转换电流
在两路充电的时候把两路充电的发热温度进行平衡,防止某路充电温度过高

两路充电,就是并联充电(parallel charge),现在8998,845上充电不是一路充电,早期的8996,660是不支持的此功能的

在typeC 的端口,有很多pin脚,手机会去检测typeC 的温度
cool(0),
hot(1),
overheat(2),
0表示正常

每个挡位降200mA ,如果是overheat直接把icl设置成500mA
CTM 功能进一步验证,sys/class/power_supply/parallel/connector_health
echo 2 > sys/class/power_supply/parallel/connector_health
把这个值写成overheat

充电抓取log,查看icl电流 微信图片_20190228190244.png
FG: soc_work_fn: adjust_soc: s 73 r 109130 i -463 v 4036 t 315 cc 0 m 0xbc
FG: soc_work_fn: adjust_soc: s 73 r 119872 i -96 v 4006 t 317 cc 0 m 0xbc

s:电量
r:内阻
i:电流
v:电压
t:温度

typC 插入:
PMI: smblib_handle_typec_cc_state_change: TypeC SOURCE_DEFAULT insertion

 TypeC none是拔出来得log

PMI: smblib_handle_typec_cc_state_change: IRQ: cc-state-change; Type-C NONE detected
PMI: smblib_handle_typec_cc_state_change: IRQ: cc-state-change; Type-C NONE detected

smblib_screen_on_work: screen_on set ICL 1600000 mA

会在usb_icl投票充电电流限制

 CCFloat 是指的是CCPin坏掉了或者悬空了

CC_FLOAT_VOTER: val: 500000
<6>[33646.869298] FB_SCREEN_VOTER: val: 1600000
USB_ICL: current vote is now 500000 voted by CC_FLOAT_VOTER,5,previous voted 500000

检测到CC pin然后进行后面充电类型的识别,充电类型通过后面的D+ D-上的电压来判断,
sink是指device,source是指的的host,充电器充电时,充电器时host,手机时device
CC pin用来探测连接,区分插入的正反面,区分DFP和UFP,即主从
A端Vbus D+ D- GND  C端:有24个pin
充电器识别D+ D-上的电压(手机给予的)主动升压,这里存在一个多次识别多次升压的过程
setprop persist.sys.offlinelog.kernel true
setprop persist.sys.offlinelog.logcat true
日志生成在/data/local/log
ntc异常  ----指的是温敏电阻异常
上一篇下一篇

猜你喜欢

热点阅读