18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/ */ 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci#ifndef BQ25980_CHARGER_H 58c2ecf20Sopenharmony_ci#define BQ25980_CHARGER_H 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#define BQ25980_MANUFACTURER "Texas Instruments" 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#define BQ25980_BATOVP 0x0 108c2ecf20Sopenharmony_ci#define BQ25980_BATOVP_ALM 0x1 118c2ecf20Sopenharmony_ci#define BQ25980_BATOCP 0x2 128c2ecf20Sopenharmony_ci#define BQ25980_BATOCP_ALM 0x3 138c2ecf20Sopenharmony_ci#define BQ25980_BATUCP_ALM 0x4 148c2ecf20Sopenharmony_ci#define BQ25980_CHRGR_CTRL_1 0x5 158c2ecf20Sopenharmony_ci#define BQ25980_BUSOVP 0x6 168c2ecf20Sopenharmony_ci#define BQ25980_BUSOVP_ALM 0x7 178c2ecf20Sopenharmony_ci#define BQ25980_BUSOCP 0x8 188c2ecf20Sopenharmony_ci#define BQ25980_BUSOCP_ALM 0x9 198c2ecf20Sopenharmony_ci#define BQ25980_TEMP_CONTROL 0xA 208c2ecf20Sopenharmony_ci#define BQ25980_TDIE_ALM 0xB 218c2ecf20Sopenharmony_ci#define BQ25980_TSBUS_FLT 0xC 228c2ecf20Sopenharmony_ci#define BQ25980_TSBAT_FLG 0xD 238c2ecf20Sopenharmony_ci#define BQ25980_VAC_CONTROL 0xE 248c2ecf20Sopenharmony_ci#define BQ25980_CHRGR_CTRL_2 0xF 258c2ecf20Sopenharmony_ci#define BQ25980_CHRGR_CTRL_3 0x10 268c2ecf20Sopenharmony_ci#define BQ25980_CHRGR_CTRL_4 0x11 278c2ecf20Sopenharmony_ci#define BQ25980_CHRGR_CTRL_5 0x12 288c2ecf20Sopenharmony_ci#define BQ25980_STAT1 0x13 298c2ecf20Sopenharmony_ci#define BQ25980_STAT2 0x14 308c2ecf20Sopenharmony_ci#define BQ25980_STAT3 0x15 318c2ecf20Sopenharmony_ci#define BQ25980_STAT4 0x16 328c2ecf20Sopenharmony_ci#define BQ25980_STAT5 0x17 338c2ecf20Sopenharmony_ci#define BQ25980_FLAG1 0x18 348c2ecf20Sopenharmony_ci#define BQ25980_FLAG2 0x19 358c2ecf20Sopenharmony_ci#define BQ25980_FLAG3 0x1A 368c2ecf20Sopenharmony_ci#define BQ25980_FLAG4 0x1B 378c2ecf20Sopenharmony_ci#define BQ25980_FLAG5 0x1C 388c2ecf20Sopenharmony_ci#define BQ25980_MASK1 0x1D 398c2ecf20Sopenharmony_ci#define BQ25980_MASK2 0x1E 408c2ecf20Sopenharmony_ci#define BQ25980_MASK3 0x1F 418c2ecf20Sopenharmony_ci#define BQ25980_MASK4 0x20 428c2ecf20Sopenharmony_ci#define BQ25980_MASK5 0x21 438c2ecf20Sopenharmony_ci#define BQ25980_DEVICE_INFO 0x22 448c2ecf20Sopenharmony_ci#define BQ25980_ADC_CONTROL1 0x23 458c2ecf20Sopenharmony_ci#define BQ25980_ADC_CONTROL2 0x24 468c2ecf20Sopenharmony_ci#define BQ25980_IBUS_ADC_MSB 0x25 478c2ecf20Sopenharmony_ci#define BQ25980_IBUS_ADC_LSB 0x26 488c2ecf20Sopenharmony_ci#define BQ25980_VBUS_ADC_MSB 0x27 498c2ecf20Sopenharmony_ci#define BQ25980_VBUS_ADC_LSB 0x28 508c2ecf20Sopenharmony_ci#define BQ25980_VAC1_ADC_MSB 0x29 518c2ecf20Sopenharmony_ci#define BQ25980_VAC1_ADC_LSB 0x2A 528c2ecf20Sopenharmony_ci#define BQ25980_VAC2_ADC_MSB 0x2B 538c2ecf20Sopenharmony_ci#define BQ25980_VAC2_ADC_LSB 0x2C 548c2ecf20Sopenharmony_ci#define BQ25980_VOUT_ADC_MSB 0x2D 558c2ecf20Sopenharmony_ci#define BQ25980_VOUT_ADC_LSB 0x2E 568c2ecf20Sopenharmony_ci#define BQ25980_VBAT_ADC_MSB 0x2F 578c2ecf20Sopenharmony_ci#define BQ25980_VBAT_ADC_LSB 0x30 588c2ecf20Sopenharmony_ci#define BQ25980_IBAT_ADC_MSB 0x31 598c2ecf20Sopenharmony_ci#define BQ25980_IBAT_ADC_LSB 0x32 608c2ecf20Sopenharmony_ci#define BQ25980_TSBUS_ADC_MSB 0x33 618c2ecf20Sopenharmony_ci#define BQ25980_TSBUS_ADC_LSB 0x34 628c2ecf20Sopenharmony_ci#define BQ25980_TSBAT_ADC_MSB 0x35 638c2ecf20Sopenharmony_ci#define BQ25980_TSBAT_ADC_LSB 0x36 648c2ecf20Sopenharmony_ci#define BQ25980_TDIE_ADC_MSB 0x37 658c2ecf20Sopenharmony_ci#define BQ25980_TDIE_ADC_LSB 0x38 668c2ecf20Sopenharmony_ci#define BQ25980_DEGLITCH_TIME 0x39 678c2ecf20Sopenharmony_ci#define BQ25980_CHRGR_CTRL_6 0x3A 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci#define BQ25980_BUSOCP_STEP_uA 250000 708c2ecf20Sopenharmony_ci#define BQ25980_BUSOCP_OFFSET_uA 1000000 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci#define BQ25980_BUSOCP_DFLT_uA 4250000 738c2ecf20Sopenharmony_ci#define BQ25975_BUSOCP_DFLT_uA 4250000 748c2ecf20Sopenharmony_ci#define BQ25960_BUSOCP_DFLT_uA 3250000 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci#define BQ25980_BUSOCP_MIN_uA 1000000 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci#define BQ25980_BUSOCP_SC_MAX_uA 5750000 798c2ecf20Sopenharmony_ci#define BQ25975_BUSOCP_SC_MAX_uA 5750000 808c2ecf20Sopenharmony_ci#define BQ25960_BUSOCP_SC_MAX_uA 3750000 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ci#define BQ25980_BUSOCP_BYP_MAX_uA 8500000 838c2ecf20Sopenharmony_ci#define BQ25975_BUSOCP_BYP_MAX_uA 8500000 848c2ecf20Sopenharmony_ci#define BQ25960_BUSOCP_BYP_MAX_uA 5750000 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci#define BQ25980_BUSOVP_SC_STEP_uV 100000 878c2ecf20Sopenharmony_ci#define BQ25975_BUSOVP_SC_STEP_uV 50000 888c2ecf20Sopenharmony_ci#define BQ25960_BUSOVP_SC_STEP_uV 50000 898c2ecf20Sopenharmony_ci#define BQ25980_BUSOVP_SC_OFFSET_uV 14000000 908c2ecf20Sopenharmony_ci#define BQ25975_BUSOVP_SC_OFFSET_uV 7000000 918c2ecf20Sopenharmony_ci#define BQ25960_BUSOVP_SC_OFFSET_uV 7000000 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_ci#define BQ25980_BUSOVP_BYP_STEP_uV 50000 948c2ecf20Sopenharmony_ci#define BQ25975_BUSOVP_BYP_STEP_uV 25000 958c2ecf20Sopenharmony_ci#define BQ25960_BUSOVP_BYP_STEP_uV 25000 968c2ecf20Sopenharmony_ci#define BQ25980_BUSOVP_BYP_OFFSET_uV 7000000 978c2ecf20Sopenharmony_ci#define BQ25975_BUSOVP_BYP_OFFSET_uV 3500000 988c2ecf20Sopenharmony_ci#define BQ25960_BUSOVP_BYP_OFFSET_uV 3500000 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci#define BQ25980_BUSOVP_DFLT_uV 17800000 1018c2ecf20Sopenharmony_ci#define BQ25980_BUSOVP_BYPASS_DFLT_uV 8900000 1028c2ecf20Sopenharmony_ci#define BQ25975_BUSOVP_DFLT_uV 8900000 1038c2ecf20Sopenharmony_ci#define BQ25975_BUSOVP_BYPASS_DFLT_uV 4450000 1048c2ecf20Sopenharmony_ci#define BQ25960_BUSOVP_DFLT_uV 8900000 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci#define BQ25980_BUSOVP_SC_MIN_uV 14000000 1078c2ecf20Sopenharmony_ci#define BQ25975_BUSOVP_SC_MIN_uV 7000000 1088c2ecf20Sopenharmony_ci#define BQ25960_BUSOVP_SC_MIN_uV 7000000 1098c2ecf20Sopenharmony_ci#define BQ25980_BUSOVP_BYP_MIN_uV 7000000 1108c2ecf20Sopenharmony_ci#define BQ25975_BUSOVP_BYP_MIN_uV 3500000 1118c2ecf20Sopenharmony_ci#define BQ25960_BUSOVP_BYP_MIN_uV 3500000 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci#define BQ25980_BUSOVP_SC_MAX_uV 22000000 1148c2ecf20Sopenharmony_ci#define BQ25975_BUSOVP_SC_MAX_uV 12750000 1158c2ecf20Sopenharmony_ci#define BQ25960_BUSOVP_SC_MAX_uV 12750000 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci#define BQ25980_BUSOVP_BYP_MAX_uV 12750000 1188c2ecf20Sopenharmony_ci#define BQ25975_BUSOVP_BYP_MAX_uV 6500000 1198c2ecf20Sopenharmony_ci#define BQ25960_BUSOVP_BYP_MAX_uV 6500000 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci#define BQ25980_BATOVP_STEP_uV 20000 1228c2ecf20Sopenharmony_ci#define BQ25975_BATOVP_STEP_uV 10000 1238c2ecf20Sopenharmony_ci#define BQ25960_BATOVP_STEP_uV 10000 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci#define BQ25980_BATOVP_OFFSET_uV 7000000 1268c2ecf20Sopenharmony_ci#define BQ25975_BATOVP_OFFSET_uV 3500000 1278c2ecf20Sopenharmony_ci#define BQ25960_BATOVP_OFFSET_uV 3500000 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ci#define BQ25980_BATOVP_DFLT_uV 14000000 1308c2ecf20Sopenharmony_ci#define BQ25975_BATOVP_DFLT_uV 8900000 1318c2ecf20Sopenharmony_ci#define BQ25960_BATOVP_DFLT_uV 8900000 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_ci#define BQ25980_BATOVP_MIN_uV 7000000 1348c2ecf20Sopenharmony_ci#define BQ25975_BATOVP_MIN_uV 3500000 1358c2ecf20Sopenharmony_ci#define BQ25960_BATOVP_MIN_uV 3500000 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ci#define BQ25980_BATOVP_MAX_uV 9540000 1388c2ecf20Sopenharmony_ci#define BQ25975_BATOVP_MAX_uV 4770000 1398c2ecf20Sopenharmony_ci#define BQ25960_BATOVP_MAX_uV 4770000 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci#define BQ25980_BATOCP_STEP_uA 100000 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ci#define BQ25980_BATOCP_MASK GENMASK(6, 0) 1448c2ecf20Sopenharmony_ci 1458c2ecf20Sopenharmony_ci#define BQ25980_BATOCP_DFLT_uA 8100000 1468c2ecf20Sopenharmony_ci#define BQ25960_BATOCP_DFLT_uA 6100000 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ci#define BQ25980_BATOCP_MIN_uA 2000000 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci#define BQ25980_BATOCP_MAX_uA 11000000 1518c2ecf20Sopenharmony_ci#define BQ25975_BATOCP_MAX_uA 11000000 1528c2ecf20Sopenharmony_ci#define BQ25960_BATOCP_MAX_uA 7000000 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci#define BQ25980_ENABLE_HIZ 0xff 1558c2ecf20Sopenharmony_ci#define BQ25980_DISABLE_HIZ 0x0 1568c2ecf20Sopenharmony_ci#define BQ25980_EN_BYPASS BIT(3) 1578c2ecf20Sopenharmony_ci#define BQ25980_STAT1_OVP_MASK (BIT(6) | BIT(5) | BIT(0)) 1588c2ecf20Sopenharmony_ci#define BQ25980_STAT3_OVP_MASK (BIT(7) | BIT(6)) 1598c2ecf20Sopenharmony_ci#define BQ25980_STAT1_OCP_MASK BIT(3) 1608c2ecf20Sopenharmony_ci#define BQ25980_STAT2_OCP_MASK (BIT(6) | BIT(1)) 1618c2ecf20Sopenharmony_ci#define BQ25980_STAT4_TFLT_MASK GENMASK(5, 1) 1628c2ecf20Sopenharmony_ci#define BQ25980_WD_STAT BIT(0) 1638c2ecf20Sopenharmony_ci#define BQ25980_PRESENT_MASK GENMASK(4, 2) 1648c2ecf20Sopenharmony_ci#define BQ25980_CHG_EN BIT(4) 1658c2ecf20Sopenharmony_ci#define BQ25980_EN_HIZ BIT(6) 1668c2ecf20Sopenharmony_ci#define BQ25980_ADC_EN BIT(7) 1678c2ecf20Sopenharmony_ci 1688c2ecf20Sopenharmony_ci#define BQ25980_ADC_VOLT_STEP_uV 1000 1698c2ecf20Sopenharmony_ci#define BQ25980_ADC_CURR_STEP_uA 1000 1708c2ecf20Sopenharmony_ci#define BQ25980_ADC_POLARITY_BIT BIT(7) 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci#define BQ25980_WATCHDOG_MASK GENMASK(4, 3) 1738c2ecf20Sopenharmony_ci#define BQ25980_WATCHDOG_DIS BIT(2) 1748c2ecf20Sopenharmony_ci#define BQ25980_WATCHDOG_MAX 300000 1758c2ecf20Sopenharmony_ci#define BQ25980_WATCHDOG_MIN 0 1768c2ecf20Sopenharmony_ci#define BQ25980_NUM_WD_VAL 4 1778c2ecf20Sopenharmony_ci 1788c2ecf20Sopenharmony_ci#endif /* BQ25980_CHARGER_H */ 179