40#define LT8491_TELE_TBAT_REG 0x0
41#define LT8491_TELE_POUT_REG 0x2
42#define LT8491_TELE_PIN_REG 0x4
43#define LT8491_TELE_EFF_REG 0x6
44#define LT8491_TELE_IOUT_REG 0x8
45#define LT8491_TELE_IIN_REG 0xA
46#define LT8491_TELE_VBAT_REG 0xC
47#define LT8491_TELE_VIN_REG 0xE
48#define LT8491_TELE_VINR_REG 0x10
50#define LT8491_STAT_CHARGER_REG 0x12
51#define LT8491_STAT_SUPPLY_REG 0x14
53#define LT8491_CTRL_CHRG_EN_REG 0x23
54#define LT8491_CTRL_RESTART_CHIP_REG 0x24
55#define LT8491_CTRL_UPDATE_TELEM 0x26
57#define LT8491_CFG_RSENSE1_REG 0x28
58#define LT8491_CFG_RIMON_OUT_REG 0x2A
59#define LT8491_CFG_RSENSE2_REG 0x2C
60#define LT8491_CFG_RDACO_REG 0x2E
61#define LT8491_CFG_RFBOUT1_REG 0x30
62#define LT8491_CFG_RFBOUT2_REG 0x32
63#define LT8491_CFG_RDACI_REG 0x34
64#define LT8491_CFG_RFBIN2_REG 0x36
65#define LT8491_CFG_RFBIN1_REG 0x38
66#define LT8491_CFG_TBAT_MIN_REG 0x40
67#define LT8491_CFG_TBAT_MAX_REG 0x41
68#define LT8491_CFG_CHRG_MISC_REG 0x4D
70#define LT8491_CFG_USER_CODE 0x5A
71#define LT8491_MFR_DATA1_REG 0x5C
72#define LT8491_MFR_DATA2_REG 0x5E
73#define LT8491_MFR_DATA3_REG 0x60
75#define LT8491_CHRG_STAGE_MASK NO_OS_GENMASK(5, 3)
76#define LT8491_CHARGING_MASK NO_OS_BIT(2)
78#define LT8491_PS_OR_SOLAR_MASK NO_OS_BIT(3)
struct ad7616_init_param init_param
Definition ad7616_sdz.c:107
int lt8491_read_serial_id(struct lt8491_desc *dev, uint32_t *val)
Read the serial ID.
Definition lt8491.c:543
int lt8491_read_charging_stage(struct lt8491_desc *dev, uint32_t *uval)
Read the telemetry battery charging stage.
Definition lt8491.c:423
int lt8491_reg_write(struct lt8491_desc *dev, uint8_t addr, uint16_t val, bool is_word)
Write a register value.
Definition lt8491.c:85
int lt8491_restart_chip(struct lt8491_desc *dev)
Restart the chip.
Definition lt8491.c:493
int lt8491_read_charging_status(struct lt8491_desc *dev, uint32_t *charging)
Read the telemetry battery charging status.
Definition lt8491.c:443
lt8491_charging_stage
LT8491 charging stage.
Definition lt8491.h:83
@ LT8491_DONE_CHARGING
Definition lt8491.h:88
@ LT8491_STAGE2
Definition lt8491.h:86
@ LT8491_STAGE1
Definition lt8491.h:85
@ LT8491_STAGE0
Definition lt8491.h:84
@ LT8491_STAGE3
Definition lt8491.h:87
int lt8491_read_iin(struct lt8491_desc *dev, uint32_t *val)
Read the telemetry battery input current.
Definition lt8491.c:344
int lt8491_configure_telemetry(struct lt8491_desc *dev, struct lt8491_init_param *init_param)
Device and comm init function.
Definition lt8491.c:160
int lt8491_read_iout(struct lt8491_desc *dev, uint32_t *val)
Read the telemetry battery output current.
Definition lt8491.c:320
int lt8491_read_efficiency(struct lt8491_desc *dev, uint32_t *val)
Read the telemetry battery efficiency.
Definition lt8491.c:296
int lt8491_write_enable(struct lt8491_desc *dev, uint32_t enable)
Write the telemetry battery charging enable.
Definition lt8491.c:483
int lt8491_read_vin(struct lt8491_desc *dev, uint32_t *val)
Read the telemetry input voltage.
Definition lt8491.c:392
int lt8491_read_enable(struct lt8491_desc *dev, uint32_t *enable)
Read the telemetry battery charging enable.
Definition lt8491.c:463
int lt8491_write_scratch(struct lt8491_desc *dev, uint32_t val)
Write the scratch register.
Definition lt8491.c:530
int lt8491_read_vbat(struct lt8491_desc *dev, uint32_t *val)
Read the telemetry battery voltage.
Definition lt8491.c:368
int lt8491_remove(struct lt8491_desc *dev)
Free resources allocated by the init function.
Definition lt8491.c:138
int lt8491_reg_read(struct lt8491_desc *dev, uint8_t addr, uint16_t *val, bool is_word)
Read a register value.
Definition lt8491.c:50
int lt8491_init(struct lt8491_desc **dev, struct lt8491_init_param *init_param)
Device and comm init function.
Definition lt8491.c:109
int lt8491_read_scratch(struct lt8491_desc *dev, uint32_t *val)
Read the scratch register.
Definition lt8491.c:510
int lt8491_read_pin(struct lt8491_desc *dev, uint32_t *val)
Read the telemetry battery input power.
Definition lt8491.c:272
int lt8491_read_pout(struct lt8491_desc *dev, uint32_t *val)
Read the telemetry battery output power.
Definition lt8491.c:248
int lt8491_read_tbat(struct lt8491_desc *dev, int32_t *val)
Read the telemetry battery temperature.
Definition lt8491.c:224
Header file of I2C Interface.
Header file of utility functions.
LT8491 descriptor.
Definition lt8491.h:94
struct no_os_i2c_desc * i2c_desc
Definition lt8491.h:96
LT8491 init param.
Definition lt8491.h:102
unsigned int rsense1_micro_ohms
Definition lt8491.h:106
unsigned int rfbin2_ohms
Definition lt8491.h:120
unsigned int rdaco_ohms
Definition lt8491.h:112
unsigned int rfbout2_ohms
Definition lt8491.h:116
unsigned int rfbout1_ohms
Definition lt8491.h:114
struct no_os_i2c_init_param i2c_init_param
Definition lt8491.h:104
unsigned int rdaci_ohms
Definition lt8491.h:118
unsigned int rfbin1_ohms
Definition lt8491.h:122
unsigned int rsense2_micro_ohms
Definition lt8491.h:110
unsigned int rimon_out_ohms
Definition lt8491.h:108
Structure holding I2C address descriptor.
Definition no_os_i2c.h:89
Structure holding the parameters for I2C initialization.
Definition no_os_i2c.h:52