主题中讨论的其他器件: BQ25620、
工具与软件:
在我们的 Linux 电池驱动程序(从 TI 获取但我们为 BQ25629进行了修改的 BQ25620/2驱动程序)中、我已将以下代码添加到中断处理程序:
// clear flags ret = regmap_read(bq->regmap, BQ2562X_CHRG_FLAG_0, &val); if (ret) { dev_err(bq->dev, "Error reading chrg_flag_0: %d", ret); } else if (val) { dev_dbg(bq->dev, "Charger flag 0 0x%x", val); } ret = regmap_read(bq->regmap, BQ2562X_CHRG_FLAG_1, &val); if (ret) { dev_err(bq->dev, "Error reading chrg_flag_1: %d", ret); } else if (val) { dev_dbg(bq->dev, "Charger flag 1 0x%x", val); } ret = regmap_read(bq->regmap, BQ2562X_FAULT_FLAG_0, &val); if (ret) { dev_err(bq->dev, "Error reading fault_flag_0: %d", ret); } else if (val) { dev_dbg(bq->dev, "Fault flag 0x%x", val); }
00: ff 01: ff 02: 40 03: 06 04: a0 05: 0d 06: 00 07: 0a 08: e0 09: 0e 0a: 20 0b: 03 0c: c0 0d: 0f 0e: 00 0f: 0b 10: 80 11: 00 12: 20 13: 00 14: 04 15: 1c 16: a0 17: 4f 18: 04 19: c0 1a: 3d 1b: 25 1c: 3f 1d: 40 1e: 00 1f: 04 20: 04 21: 00 22: 00 23: 40 24: 00 25: 00 26: 70 27: 00 28: 68 29: 01 2a: 00 2b: 00 2c: f8 2d: 12 2e: e4 2f: 12 30: 9e 31: 10 32: 9a 33: 10 34: cd 35: 01 36: 49 37: 00 38: 32
0x2: Charge Current Limit: 2000mA 0x4: Charge Voltage Limit: 4360mV 0x6: Input Current Limit: 3200mA 0x8: Input Voltage Limit: 4760mV 0xc: VOTG Regulation: 5040mV 0xe: Minimal System Voltage: 0xb00: 3520mV 0x10: Precharge Current Regulation: 160mA - TODO if q4_fullon=1 min is 80mA 0x12: Termination Current Threshold: 40mA - TODO if q4_fullon=1 min is 60mA 0x14: Charge Control: (0x4) Q1_FULLON: 0 Q4_FULLON: 0 ITRICKLE: 10mA top-off timer: disabled Enable Termination: 1 VINDPM_BAT_TRACK: VBAT+400mV Recharge Threshold offset: 200mV 0x15: Charge Timer Control: (0x1c) disable stat pin: 0 Auto D+/D- detect: 0 Force D+/D- detect: 0 Enable DCP Bias: 1 2x timer en: 1 en safety timers: 1 precharge safety timer: 0.62 hrs fast charge safety timer: 28 hrs 0x16: Charge Control 0: (0xa0) Auto OVP discharge: 1 Force Discharge: 0 Charge Enable: 1 En HiZ: 0 Force PMID discharge : 0 wd timer reset: 0 watchdog timer: disable 0x17: Charge Control 1: (0x4f) Reset: 0 Therm Reg threshold: 120C Converter switching freq: 1.5Mhz (default) Converter drive stength: strong (default) VBus OVP: 18.5V 0x18: Charge Control 2: (0x4) Boost Bypass: 0 OTG enable: 0 Disable PFM in Boost Mode: 0 Disable PFM in Forward buck mode: 0 BATFET ctrl wvbus: 0 BATFET ctrl delay time: 10s BATFET ctrl: normal 0x19: Charge Control 3: (0xc0) Peak discharge current protection: 12A VBat UVLO, Short: UVLO=2.2V Short=2.05V VBat OTG Min: 3V rising 2.8V falling Charge Rate: 1C 0x1a: NTC Control 0: (0x3d) TS Ignore: 0 TS Hot Thresh: 60C TS Cold Thresh: -10C TS Warm ICHG: Unchanged TS Cool ICHG: 20% 0x1b: NTC Control 1: (0x25) Falling TH1,2,3 Thres: (0, 10, 15)C Rising TH4,5,6: (35, 45, 60)C TS warm voltage: VREG-200mV 0x1c: NTC Control 2: (0x3f) TS_VSET_SYM: 0 TS_VSET_PREWARM: unchanged Prewarm Current (TH4,5): unchanged Precool Current (TH2,3): unchanged 0x1d: Charger Status 0: 0x40) ADC Conversion Status: 1 Device in thermal regulation: 0 VSys regulation: BAT > VSYSMIN IINDPM_STAT: Normal VINDPM_STAT: Normal Safety Timer Expired: 0 Watchdog Timer Expired: 0 0x1e: Charger Status 1: Charge Status: Not charging VBus Status: No qualified adapter or EN_AUTO_INDET=0 0x1f: Fault Status 0: (0x4) VBUS Fault: Normal Batt Fault: Normal VSys Stat: Normal OTG Fault Stat: 0 Thermal Shutdown: 0 TS Zone: Warm 0x20: Charger Flag 0: 0x4 ADC Done: 0 Thermal Regulation: 0 VSYS Min Regulation: 0 IINDPM: 0 VINDPM: 1 Safety Timer: 0 Watchdog: 0 0x21: Charger Flag 1: 0x0 Charge Status Changed: 0 VBus Changed: 0 0x22: Fault Flag 0: 0x0 VBus OVP or Sleep: 0 VBat OCP or OVP: 0 VSYS Over voltage or SYS short: 0 OTG Over voltage or fault: 0 TS Shutdown: 0 TS Status Change: 0 0x23: Charger Mask 0: 0x40 0x24: Charger Mask 1: 0x0 0x25: Fault Mask 0: 0x0 0x26: ADC Control: (0x70) ADC En: 0 ADC Rate: One Shot ADC Speed: 9 bit ADC Avg ctl: Single ADC Avg initial: Existing value 0x27: ADC Disables: 0x0 0x28: IBUS ADC: 360mA 0x2a: IBAT ADC: 0mA 0x2c: VBUS ADC: 4819.58mV 0x2e: VMMID ADC: 4799.7300000000005mV 0x30: VBAT ADC: 4232.73mV 0x32: VSYS ADC: 4228.75mV 0x34: TS ADC: 44.3021% 0x36: TDIE ADC: 36.5C 0x38: Part Info: Part Number BQ25629 Revision: 2