OpenBIC
OpenSource Bridge-IC
plat_hook.c File Reference
#include <stdio.h>
#include <string.h>
#include "libutil.h"
#include "ast_adc.h"
#include "sensor.h"
#include "hal_i2c.h"
#include "plat_i2c.h"
#include "plat_gpio.h"
#include "plat_sensor_table.h"
#include "plat_hook.h"
#include <logging/log.h>
#include "mp2971.h"
#include "isl69259.h"
#include "raa228249.h"
#include "mp29816a.h"
#include "plat_pldm_sensor.h"
#include "plat_class.h"
#include "pmbus.h"
Include dependency graph for plat_hook.c:

Classes

struct  vr_vout_user_settings
 

Macros

#define VR_PRE_READ_ARG(idx)
 
#define VR_VOUT_USER_SETTINGS_OFFSET   0x8000
 
#define PLAT_VOUT_GET_SET_HANDLER(get_set, min_max)
 

Functions

 LOG_MODULE_REGISTER (plat_hook)
 
void * vr_mutex_get (enum VR_INDEX_E vr_index)
 
bool pre_vr_read (sensor_cfg *cfg, void *args)
 
bool post_vr_read (sensor_cfg *cfg, void *args, int *reading)
 
bool is_mb_dc_on ()
 
void vr_mutex_init (void)
 
bool vr_rail_name_get (uint8_t rail, uint8_t **name)
 
bool vr_status_name_get (uint8_t rail, uint8_t **name)
 
struct vr_vout_user_settings __attribute__ ((packed))
 
bool vr_rail_enum_get (uint8_t *name, uint8_t *num)
 
bool vr_status_enum_get (uint8_t *name, uint8_t *num)
 
bool vr_vout_user_settings_get (void *user_settings)
 
bool vr_vout_user_settings_set (void *user_settings)
 
void user_settings_init (void)
 
bool plat_get_vr_status (uint8_t rail, uint8_t vr_status_rail, uint16_t *vr_status)
 
bool plat_clear_vr_status (uint8_t rail)
 
bool plat_get_vout_command (uint8_t rail, uint16_t *millivolt)
 
bool plat_set_vout_command (uint8_t rail, uint16_t *millivolt, bool is_default, bool is_perm)
 
 PLAT_VOUT_GET_SET_HANDLER (get, min)
 
 PLAT_VOUT_GET_SET_HANDLER (get, max)
 
 PLAT_VOUT_GET_SET_HANDLER (set, min)
 
 PLAT_VOUT_GET_SET_HANDLER (set, max)
 

Variables

vr_pre_proc_arg vr_pre_read_args []
 
mp2971_init_arg mp2971_init_args []
 
isl69259_init_arg isl69259_init_args []
 
vr_mapping_sensor vr_rail_table []
 
vr_mapping_status vr_status_table []
 
uint16_t vout [VR_RAIL_E_MAX]
 
struct vr_vout_user_settings user_settings = { 0 }
 
struct vr_vout_user_settings default_settings = { 0 }
 

Macro Definition Documentation

◆ PLAT_VOUT_GET_SET_HANDLER

#define PLAT_VOUT_GET_SET_HANDLER (   get_set,
  min_max 
)

◆ VR_PRE_READ_ARG

#define VR_PRE_READ_ARG (   idx)
Value:
{ .mutex = vr_mutex + idx, .vr_page = 0x0 }, \
{ \
.mutex = vr_mutex + idx, .vr_page = 0x1 \
}
uint8_t idx
Definition: plat_util.c:39

◆ VR_VOUT_USER_SETTINGS_OFFSET

#define VR_VOUT_USER_SETTINGS_OFFSET   0x8000

Function Documentation

◆ __attribute__()

struct vr_vout_user_settings __attribute__ ( (packed)  )

◆ is_mb_dc_on()

bool is_mb_dc_on ( )
Here is the call graph for this function:

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( plat_hook  )

◆ plat_clear_vr_status()

bool plat_clear_vr_status ( uint8_t  rail)
Here is the call graph for this function:

◆ plat_get_vout_command()

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

◆ plat_get_vr_status()

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

◆ plat_set_vout_command()

bool plat_set_vout_command ( uint8_t  rail,
uint16_t *  millivolt,
bool  is_default,
bool  is_perm 
)
Here is the call graph for this function:

◆ PLAT_VOUT_GET_SET_HANDLER() [1/4]

PLAT_VOUT_GET_SET_HANDLER ( get  ,
max   
)

◆ PLAT_VOUT_GET_SET_HANDLER() [2/4]

PLAT_VOUT_GET_SET_HANDLER ( get  ,
min   
)

◆ PLAT_VOUT_GET_SET_HANDLER() [3/4]

PLAT_VOUT_GET_SET_HANDLER ( set  ,
max   
)

◆ PLAT_VOUT_GET_SET_HANDLER() [4/4]

PLAT_VOUT_GET_SET_HANDLER ( set  ,
min   
)

◆ post_vr_read()

bool post_vr_read ( sensor_cfg cfg,
void *  args,
int *  reading 
)

◆ pre_vr_read()

bool pre_vr_read ( sensor_cfg cfg,
void *  args 
)
Here is the call graph for this function:

◆ user_settings_init()

void user_settings_init ( void  )

◆ vr_mutex_get()

void * vr_mutex_get ( enum VR_INDEX_E  vr_index)

◆ vr_mutex_init()

void vr_mutex_init ( void  )

◆ vr_rail_enum_get()

bool vr_rail_enum_get ( uint8_t *  name,
uint8_t *  num 
)

◆ vr_rail_name_get()

bool vr_rail_name_get ( uint8_t  rail,
uint8_t **  name 
)

◆ vr_status_enum_get()

bool vr_status_enum_get ( uint8_t *  name,
uint8_t *  num 
)

◆ vr_status_name_get()

bool vr_status_name_get ( uint8_t  rail,
uint8_t **  name 
)

◆ vr_vout_user_settings_get()

bool vr_vout_user_settings_get ( void *  user_settings)
Here is the call graph for this function:

◆ vr_vout_user_settings_set()

bool vr_vout_user_settings_set ( void *  user_settings)
Here is the call graph for this function:

Variable Documentation

◆ default_settings

struct vr_vout_user_settings default_settings = { 0 }

◆ isl69259_init_args

Initial value:
= {
[0] = { .vout_scale_enable = true, .vout_scale = (499 / 798.8) },
}

◆ mp2971_init_args

Initial value:
= {
[0] = { .vout_scale_enable = true },
}

◆ user_settings

struct vr_vout_user_settings user_settings = { 0 }

◆ vout

uint16_t vout[VR_RAIL_E_MAX]

◆ vr_pre_read_args

vr_pre_proc_arg vr_pre_read_args[]
Initial value:
= {
{ .mutex = vr_mutex + 0, .vr_page = 0x0 }, { .mutex = vr_mutex + 0, .vr_page = 0x1 },
{ .mutex = vr_mutex + 1, .vr_page = 0x0 }, { .mutex = vr_mutex + 1, .vr_page = 0x1 },
{ .mutex = vr_mutex + 2, .vr_page = 0x0 }, { .mutex = vr_mutex + 2, .vr_page = 0x1 },
{ .mutex = vr_mutex + 3, .vr_page = 0x0 }, { .mutex = vr_mutex + 3, .vr_page = 0x1 },
{ .mutex = vr_mutex + 4, .vr_page = 0x0 }, { .mutex = vr_mutex + 4, .vr_page = 0x1 },
{ .mutex = vr_mutex + 5, .vr_page = 0x0 }, { .mutex = vr_mutex + 5, .vr_page = 0x1 },
{ .mutex = vr_mutex + 6, .vr_page = 0x0 }, { .mutex = vr_mutex + 6, .vr_page = 0x1 },
{ .mutex = vr_mutex + 7, .vr_page = 0x0 }, { .mutex = vr_mutex + 7, .vr_page = 0x1 },
{ .mutex = vr_mutex + 8, .vr_page = 0x0 }, { .mutex = vr_mutex + 8, .vr_page = 0x1 },
{ .mutex = vr_mutex + 9, .vr_page = 0x0 }, { .mutex = vr_mutex + 9, .vr_page = 0x1 },
{ .mutex = vr_mutex + 10, .vr_page = 0x0 }, { .mutex = vr_mutex + 10, .vr_page = 0x1 }
}

◆ vr_rail_table

vr_mapping_sensor vr_rail_table[]

◆ vr_status_table

vr_mapping_status vr_status_table[]
Initial value:
= {
{ VR_STAUS_E_STATUS_CML, PMBUS_STATUS_CML, "STATUS_CML_PMBUS" },
}
@ VR_STAUS_E_STATUS_INPUT
Definition: plat_hook.h:71
@ VR_STAUS_E_STATUS_IOUT
Definition: plat_hook.h:70
@ VR_STAUS_E_STATUS_CML
Definition: plat_hook.h:73
@ VR_STAUS_E_STATUS_BYTE
Definition: plat_hook.h:67
@ VR_STAUS_E_STATUS_TEMPERATURE
Definition: plat_hook.h:72
@ VR_STAUS_E_STATUS_VOUT
Definition: plat_hook.h:69
@ VR_STAUS_E_STATUS_WORD
Definition: plat_hook.h:68
@ PMBUS_STATUS_WORD
Definition: pmbus.h:102
@ PMBUS_STATUS_IOUT
Definition: pmbus.h:104
@ PMBUS_STATUS_BYTE
Definition: pmbus.h:101
@ PMBUS_STATUS_CML
Definition: pmbus.h:107
@ PMBUS_STATUS_TEMPERATURE
Definition: pmbus.h:106
@ PMBUS_STATUS_VOUT
Definition: pmbus.h:103
@ PMBUS_STATUS_INPUT
Definition: pmbus.h:105