OpenBIC
OpenSource Bridge-IC
mp29816a.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <logging/log.h>
#include "libutil.h"
#include "sensor.h"
#include "hal_i2c.h"
#include "pmbus.h"
#include "mp29816a.h"
#include "util_pmbus.h"
Include dependency graph for mp29816a.c:

Classes

struct  cfg_data
 

Macros

#define READ_VOUT_MASK   GENMASK(11, 0)
 
#define MFR_VID_RES_MASK   GENMASK(12, 10)
 
#define MFR_VOUT_SCALE_LOOP   0x29
 
#define MFR_VOUT_LOOP_CTRL   0x8D
 
#define MFR_VDIFF_GAIN_HALF_R2_BIT   BIT(10)
 
#define VR_MPS_PAGE_0   0x00
 
#define VR_MPS_PAGE_1   0x01
 
#define MP29816A_VOUT_MAX_REG   0x24
 
#define MP29816A_VOUT_MIN_REG   0x2B
 
#define VR_REG_EXPECTED_USER_CRC   0xED
 
#define MAX_CFG_LEN   1024
 
#define MP29816A_MAX_READ_BYTES   (6 + 1)
 

Enumerations

enum  CFG_PARAM_IDX {
  CFG_PARAM_IDX_PAGE = 1 , CFG_PARAM_IDX_REG_ADDR = 2 , CFG_PARAM_IDX_REG_NAME = 4 , CFG_PARAM_IDX_REG_VAL = 5 ,
  CFG_PARAM_IDX_REG_LEN = 7
}
 

Functions

 LOG_MODULE_REGISTER (mp29816a)
 
float mp29816a_get_vout_min_max_resolution (sensor_cfg *cfg)
 
uint8_t parsing_line (char *str, uint16_t len, struct cfg_data *cfg_data)
 
bool mp29816a_i2c_read (uint8_t bus, uint8_t addr, uint8_t reg, uint8_t *data, uint8_t len)
 
bool mp29816a_i2c_write (uint8_t bus, uint8_t addr, uint8_t reg, uint8_t *data, uint8_t len)
 
bool mp29816a_set_page (uint8_t bus, uint8_t addr, uint8_t page)
 
bool mp29816a_get_vout_max (sensor_cfg *cfg, uint8_t rail, uint16_t *millivolt)
 
bool mp29816a_get_vout_min (sensor_cfg *cfg, uint8_t rail, uint16_t *millivolt)
 
bool mp29816a_set_vout_max (sensor_cfg *cfg, uint8_t rail, uint16_t *millivolt)
 
bool mp29816a_set_vout_min (sensor_cfg *cfg, uint8_t rail, uint16_t *millivolt)
 
bool mp29816a_fwupdate (uint8_t bus, uint8_t addr, uint8_t *img_buff, uint32_t img_size)
 
bool mp29816a_get_fw_version (uint8_t bus, uint8_t addr, uint32_t *rev)
 
float mp29816a_get_resolution (sensor_cfg *cfg)
 
bool mp29816a_get_vout_command (sensor_cfg *cfg, uint8_t rail, uint16_t *millivolt)
 
bool mp29816a_set_vout_command (sensor_cfg *cfg, uint8_t rail, uint16_t *millivolt)
 
bool mp29816a_get_vr_status (sensor_cfg *cfg, uint8_t rail, uint8_t vr_status_rail, uint16_t *vr_status)
 
bool mp29816a_clear_vr_status (sensor_cfg *cfg, uint8_t rail)
 
uint8_t mp29816a_read (sensor_cfg *cfg, int *reading)
 
uint8_t mp29816a_init (sensor_cfg *cfg)
 

Macro Definition Documentation

◆ MAX_CFG_LEN

#define MAX_CFG_LEN   1024

◆ MFR_VDIFF_GAIN_HALF_R2_BIT

#define MFR_VDIFF_GAIN_HALF_R2_BIT   BIT(10)

◆ MFR_VID_RES_MASK

#define MFR_VID_RES_MASK   GENMASK(12, 10)

◆ MFR_VOUT_LOOP_CTRL

#define MFR_VOUT_LOOP_CTRL   0x8D

◆ MFR_VOUT_SCALE_LOOP

#define MFR_VOUT_SCALE_LOOP   0x29

◆ MP29816A_MAX_READ_BYTES

#define MP29816A_MAX_READ_BYTES   (6 + 1)

◆ MP29816A_VOUT_MAX_REG

#define MP29816A_VOUT_MAX_REG   0x24

◆ MP29816A_VOUT_MIN_REG

#define MP29816A_VOUT_MIN_REG   0x2B

◆ READ_VOUT_MASK

#define READ_VOUT_MASK   GENMASK(11, 0)

◆ VR_MPS_PAGE_0

#define VR_MPS_PAGE_0   0x00

◆ VR_MPS_PAGE_1

#define VR_MPS_PAGE_1   0x01

◆ VR_REG_EXPECTED_USER_CRC

#define VR_REG_EXPECTED_USER_CRC   0xED

Enumeration Type Documentation

◆ CFG_PARAM_IDX

Enumerator
CFG_PARAM_IDX_PAGE 
CFG_PARAM_IDX_REG_ADDR 
CFG_PARAM_IDX_REG_NAME 
CFG_PARAM_IDX_REG_VAL 
CFG_PARAM_IDX_REG_LEN 

Function Documentation

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( mp29816a  )

◆ mp29816a_clear_vr_status()

bool mp29816a_clear_vr_status ( sensor_cfg cfg,
uint8_t  rail 
)
Here is the call graph for this function:

◆ mp29816a_fwupdate()

bool mp29816a_fwupdate ( uint8_t  bus,
uint8_t  addr,
uint8_t *  img_buff,
uint32_t  img_size 
)

◆ mp29816a_get_fw_version()

bool mp29816a_get_fw_version ( uint8_t  bus,
uint8_t  addr,
uint32_t *  rev 
)
Here is the call graph for this function:

◆ mp29816a_get_resolution()

float mp29816a_get_resolution ( sensor_cfg cfg)
Here is the call graph for this function:

◆ mp29816a_get_vout_command()

bool mp29816a_get_vout_command ( sensor_cfg cfg,
uint8_t  rail,
uint16_t *  millivolt 
)
Here is the call graph for this function:

◆ mp29816a_get_vout_max()

bool mp29816a_get_vout_max ( sensor_cfg cfg,
uint8_t  rail,
uint16_t *  millivolt 
)
Here is the call graph for this function:

◆ mp29816a_get_vout_min()

bool mp29816a_get_vout_min ( sensor_cfg cfg,
uint8_t  rail,
uint16_t *  millivolt 
)
Here is the call graph for this function:

◆ mp29816a_get_vout_min_max_resolution()

float mp29816a_get_vout_min_max_resolution ( sensor_cfg cfg)

◆ mp29816a_get_vr_status()

bool mp29816a_get_vr_status ( sensor_cfg cfg,
uint8_t  rail,
uint8_t  vr_status_rail,
uint16_t *  vr_status 
)
Here is the call graph for this function:

◆ mp29816a_i2c_read()

bool mp29816a_i2c_read ( uint8_t  bus,
uint8_t  addr,
uint8_t  reg,
uint8_t *  data,
uint8_t  len 
)
Here is the call graph for this function:

◆ mp29816a_i2c_write()

bool mp29816a_i2c_write ( uint8_t  bus,
uint8_t  addr,
uint8_t  reg,
uint8_t *  data,
uint8_t  len 
)
Here is the call graph for this function:

◆ mp29816a_init()

uint8_t mp29816a_init ( sensor_cfg cfg)
Here is the call graph for this function:

◆ mp29816a_read()

uint8_t mp29816a_read ( sensor_cfg cfg,
int *  reading 
)
Here is the call graph for this function:

◆ mp29816a_set_page()

bool mp29816a_set_page ( uint8_t  bus,
uint8_t  addr,
uint8_t  page 
)
Here is the call graph for this function:

◆ mp29816a_set_vout_command()

bool mp29816a_set_vout_command ( sensor_cfg cfg,
uint8_t  rail,
uint16_t *  millivolt 
)
Here is the call graph for this function:

◆ mp29816a_set_vout_max()

bool mp29816a_set_vout_max ( sensor_cfg cfg,
uint8_t  rail,
uint16_t *  millivolt 
)
Here is the call graph for this function:

◆ mp29816a_set_vout_min()

bool mp29816a_set_vout_min ( sensor_cfg cfg,
uint8_t  rail,
uint16_t *  millivolt 
)
Here is the call graph for this function:

◆ parsing_line()

uint8_t parsing_line ( char *  str,
uint16_t  len,
struct cfg_data cfg_data 
)