OpenBIC
OpenSource Bridge-IC
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <logging/log.h>
#include "sensor.h"
#include "hal_i2c.h"
#include "pmbus.h"
#include "mp2971.h"
Classes | |
struct | mp2856_data |
struct | mp2856_config |
Macros | |
#define | VR_MPS_PAGE_0 0x00 |
#define | VR_MPS_PAGE_1 0x01 |
#define | VR_MPS_PAGE_2 0x02 |
#define | VR_MPS_PAGE_29 0x29 |
#define | VR_MPS_PAGE_2A 0x2A |
#define | VR_MPS_CMD_STORE_NORMAL_CODE 0xF1 |
#define | VR_MPS_REG_MFR_MTP_PMBUS_CTRL 0x4F |
#define | MFR_RESO_SET 0xC7 |
#define | MP2971_VOUT_SENSE_SET 0x29 |
#define | MP2971_VOUT_SCALE_MASK GENMASK(8, 0) |
#define | VR_MPS_REG_WRITE_PROTECT 0x10 |
#define | VR_MPS_REG_MFR_VR_CONFIG2 0x35 |
#define | VR_MPS_CMD_STORE_MULTI_CODE 0xF3 |
#define | MP2856_DISABLE_WRITE_PROTECT 0x63 |
#define | MP2856_DISABLE_MEM_PROTECT 0x00 |
#define | VR_MPS_REG_MFR_VR_MULTI_CONFIG_R1 0x0D |
#define | VR_MPS_REG_MFR_VR_MULTI_CONFIG_R2 0x1D |
#define | MP2971_VOUT_MAX_REG 0x24 |
#define | MP2971_VOUT_MIN_REG 0x2B |
#define | VR_MPS_REG_CRC_USER 0xFF |
#define | VR_MPS_REG_MULTI_CONFIG 0xBF |
#define | MASK_PWD_MATCH 0x08 |
#define | MASK_WRITE_PROTECT_MODE 0x04 |
#define | MASK_MTP_BYTE_RW_EN 0x20 |
#define | MAX_CMD_LINE 720 |
Enumerations | |
enum | { ATE_CONF_ID = 0 , ATE_PAGE_NUM , ATE_REG_ADDR_HEX , ATE_REG_ADDR_DEC , ATE_REG_NAME , ATE_REG_DATA_HEX , ATE_REG_DATA_DEC , ATE_WRITE_TYPE , ATE_COL_MAX } |
enum | { VR_12 = 1 , VR_13 , IMPV9 } |
Functions | |
LOG_MODULE_REGISTER (mp2971) | |
bool | mp2971_vid_to_direct (sensor_cfg *cfg, uint8_t rail, uint16_t *millivolt) |
bool | mp2971_direct_to_vid (sensor_cfg *cfg, uint8_t rail, uint16_t *millivolt) |
bool | mp2971_i2c_read (uint8_t bus, uint8_t addr, uint8_t reg, uint8_t *data, uint8_t len) |
bool | mp2971_i2c_write (uint8_t bus, uint8_t addr, uint8_t reg, uint8_t *data, uint8_t len) |
bool | mp2971_get_vout_max (sensor_cfg *cfg, uint8_t rail, uint16_t *millivolt) |
bool | mp2971_get_vout_min (sensor_cfg *cfg, uint8_t rail, uint16_t *millivolt) |
bool | mp2971_set_vout_max (sensor_cfg *cfg, uint8_t rail, uint16_t *millivolt) |
bool | mp2971_set_vout_min (sensor_cfg *cfg, uint8_t rail, uint16_t *millivolt) |
bool | mp2971_fwupdate (uint8_t bus, uint8_t addr, uint8_t *img_buff, uint32_t img_size) |
bool | mp2971_get_checksum (uint8_t bus, uint8_t addr, uint32_t *checksum) |
bool | get_vout_scale (sensor_cfg *cfg, float *vout_scale) |
float | get_resolution (sensor_cfg *cfg) |
bool | mp2971_get_vout_command (sensor_cfg *cfg, uint8_t rail, uint16_t *millivolt) |
bool | mp2971_set_vout_command (sensor_cfg *cfg, uint8_t rail, uint16_t *millivolt) |
bool | mp2971_get_vr_status (sensor_cfg *cfg, uint8_t rail, uint8_t vr_status_rail, uint16_t *vr_status) |
bool | mp2971_clear_vr_status (sensor_cfg *cfg, uint8_t rail) |
uint8_t | mp2971_read (sensor_cfg *cfg, int *reading) |
uint8_t | mp2971_init (sensor_cfg *cfg) |
#define MASK_MTP_BYTE_RW_EN 0x20 |
#define MASK_PWD_MATCH 0x08 |
#define MASK_WRITE_PROTECT_MODE 0x04 |
#define MAX_CMD_LINE 720 |
#define MFR_RESO_SET 0xC7 |
#define MP2856_DISABLE_MEM_PROTECT 0x00 |
#define MP2856_DISABLE_WRITE_PROTECT 0x63 |
#define MP2971_VOUT_MAX_REG 0x24 |
#define MP2971_VOUT_MIN_REG 0x2B |
#define MP2971_VOUT_SCALE_MASK GENMASK(8, 0) |
#define MP2971_VOUT_SENSE_SET 0x29 |
#define VR_MPS_CMD_STORE_MULTI_CODE 0xF3 |
#define VR_MPS_CMD_STORE_NORMAL_CODE 0xF1 |
#define VR_MPS_PAGE_0 0x00 |
#define VR_MPS_PAGE_1 0x01 |
#define VR_MPS_PAGE_2 0x02 |
#define VR_MPS_PAGE_29 0x29 |
#define VR_MPS_PAGE_2A 0x2A |
#define VR_MPS_REG_CRC_USER 0xFF |
#define VR_MPS_REG_MFR_MTP_PMBUS_CTRL 0x4F |
#define VR_MPS_REG_MFR_VR_CONFIG2 0x35 |
#define VR_MPS_REG_MFR_VR_MULTI_CONFIG_R1 0x0D |
#define VR_MPS_REG_MFR_VR_MULTI_CONFIG_R2 0x1D |
#define VR_MPS_REG_MULTI_CONFIG 0xBF |
#define VR_MPS_REG_WRITE_PROTECT 0x10 |
anonymous enum |
float get_resolution | ( | sensor_cfg * | cfg | ) |
bool get_vout_scale | ( | sensor_cfg * | cfg, |
float * | vout_scale | ||
) |
LOG_MODULE_REGISTER | ( | mp2971 | ) |
bool mp2971_clear_vr_status | ( | sensor_cfg * | cfg, |
uint8_t | rail | ||
) |
bool mp2971_direct_to_vid | ( | sensor_cfg * | cfg, |
uint8_t | rail, | ||
uint16_t * | millivolt | ||
) |
bool mp2971_fwupdate | ( | uint8_t | bus, |
uint8_t | addr, | ||
uint8_t * | img_buff, | ||
uint32_t | img_size | ||
) |
bool mp2971_get_checksum | ( | uint8_t | bus, |
uint8_t | addr, | ||
uint32_t * | checksum | ||
) |
bool mp2971_get_vout_command | ( | sensor_cfg * | cfg, |
uint8_t | rail, | ||
uint16_t * | millivolt | ||
) |
bool mp2971_get_vout_max | ( | sensor_cfg * | cfg, |
uint8_t | rail, | ||
uint16_t * | millivolt | ||
) |
bool mp2971_get_vout_min | ( | sensor_cfg * | cfg, |
uint8_t | rail, | ||
uint16_t * | millivolt | ||
) |
bool mp2971_get_vr_status | ( | sensor_cfg * | cfg, |
uint8_t | rail, | ||
uint8_t | vr_status_rail, | ||
uint16_t * | vr_status | ||
) |
bool mp2971_i2c_read | ( | uint8_t | bus, |
uint8_t | addr, | ||
uint8_t | reg, | ||
uint8_t * | data, | ||
uint8_t | len | ||
) |
bool mp2971_i2c_write | ( | uint8_t | bus, |
uint8_t | addr, | ||
uint8_t | reg, | ||
uint8_t * | data, | ||
uint8_t | len | ||
) |
uint8_t mp2971_init | ( | sensor_cfg * | cfg | ) |
uint8_t mp2971_read | ( | sensor_cfg * | cfg, |
int * | reading | ||
) |
bool mp2971_set_vout_command | ( | sensor_cfg * | cfg, |
uint8_t | rail, | ||
uint16_t * | millivolt | ||
) |
bool mp2971_set_vout_max | ( | sensor_cfg * | cfg, |
uint8_t | rail, | ||
uint16_t * | millivolt | ||
) |
bool mp2971_set_vout_min | ( | sensor_cfg * | cfg, |
uint8_t | rail, | ||
uint16_t * | millivolt | ||
) |
bool mp2971_vid_to_direct | ( | sensor_cfg * | cfg, |
uint8_t | rail, | ||
uint16_t * | millivolt | ||
) |