|
TT Zephyr Platforms 19.5.0-rc1
Tenstorrent Firmware
|
#include "avs.h"#include "dw_apb_i2c.h"#include "regulator.h"#include "regulator_config.h"#include "status_reg.h"#include "timer.h"#include <math.h>#include <float.h>#include <stdint.h>#include <tenstorrent/smc_msg.h>#include <tenstorrent/msgqueue.h>#include <tenstorrent/post_code.h>#include <tenstorrent/sys_init_defines.h>#include <zephyr/init.h>#include <zephyr/kernel.h>#include <zephyr/logging/log.h>#include <zephyr/drivers/misc/bh_fwtable.h>Data Structures | |
| struct | OperationBits |
Macros | |
| #define | LINEAR_FORMAT_CONSTANT (1 << 9) |
| #define | SCALE_LOOP 0.335f |
| #define | PMBUS_MST_ID 1 |
| #define | MFR_CTRL_OPS 0xD2 |
| #define | MFR_CTRL_OPS_DATA_BYTE_SIZE 1 |
| #define | VOUT_COMMAND 0x21 |
| #define | VOUT_COMMAND_DATA_BYTE_SIZE 2 |
| #define | VOUT_SCALE_LOOP 0x29 |
| #define | VOUT_SCALE_LOOP_DATA_BYTE_SIZE 2 |
| #define | READ_VOUT 0x8B |
| #define | READ_VOUT_DATA_BYTE_SIZE 2 |
| #define | READ_IOUT 0x8C |
| #define | READ_IOUT_DATA_BYTE_SIZE 2 |
| #define | READ_POUT 0x96 |
| #define | READ_POUT_DATA_BYTE_SIZE 2 |
| #define | OPERATION 0x1 |
| #define | OPERATION_DATA_BYTE_SIZE 1 |
| #define | PMBUS_CMD_BYTE_SIZE 1 |
| #define | PMBUS_FLIP_BYTES 0 |
| #define | GDDR_VDDR_FB1 0.422 |
| #define | GDDR_VDDR_FB2 1.0 |
| #define | CB_GDDR_VDDR_FB1 1.37 |
| #define | CB_GDDR_VDDR_FB2 4.32 |
| #define | SCRAPPY_GDDR_VDDR_FB1 1.07 |
| #define | SCRAPPY_GDDR_VDDR_FB2 3.48 |
Variables | |
| static uint8_t | vout_cmd_source = VoutCommand |
| static const struct device *const | fwtable_dev = DEVICE_DT_GET(DT_NODELABEL(fwtable)) |
| #define CB_GDDR_VDDR_FB1 1.37 |
| #define CB_GDDR_VDDR_FB2 4.32 |
| #define GDDR_VDDR_FB1 0.422 |
| #define GDDR_VDDR_FB2 1.0 |
| #define LINEAR_FORMAT_CONSTANT (1 << 9) |
| #define MFR_CTRL_OPS 0xD2 |
| #define MFR_CTRL_OPS_DATA_BYTE_SIZE 1 |
| #define OPERATION 0x1 |
| #define OPERATION_DATA_BYTE_SIZE 1 |
| #define PMBUS_CMD_BYTE_SIZE 1 |
| #define PMBUS_FLIP_BYTES 0 |
| #define PMBUS_MST_ID 1 |
| #define READ_IOUT 0x8C |
| #define READ_IOUT_DATA_BYTE_SIZE 2 |
| #define READ_POUT 0x96 |
| #define READ_POUT_DATA_BYTE_SIZE 2 |
| #define READ_VOUT 0x8B |
| #define READ_VOUT_DATA_BYTE_SIZE 2 |
| #define SCALE_LOOP 0.335f |
| #define SCRAPPY_GDDR_VDDR_FB1 1.07 |
| #define SCRAPPY_GDDR_VDDR_FB2 3.48 |
| #define VOUT_COMMAND 0x21 |
| #define VOUT_COMMAND_DATA_BYTE_SIZE 2 |
| #define VOUT_SCALE_LOOP 0x29 |
| #define VOUT_SCALE_LOOP_DATA_BYTE_SIZE 2 |
|
static |
| uint32_t get_vcore | ( | void | ) |
| uint32_t get_vcorem | ( | void | ) |
Handler for TT_SMC_MSG_GET_VOLTAGE messages.
Reads the current voltage from the specified regulator via I2C and returns it in the response message.
| request | Pointer to the host request message, use request->get_voltage for structured access |
| response | Pointer to the response message to be sent back to host, will contain:
|
| float GetVcoreCurrent | ( | void | ) |
| float GetVcorePower | ( | void | ) |
|
static |
| LOG_MODULE_REGISTER | ( | regulator | ) |
| REGISTER_MESSAGE | ( | TT_SMC_MSG_GET_VOLTAGE | , |
| get_voltage_handler | ) |
| REGISTER_MESSAGE | ( | TT_SMC_MSG_SET_VOLTAGE | , |
| set_voltage_handler | ) |
| REGISTER_MESSAGE | ( | TT_SMC_MSG_SWITCH_VOUT_CONTROL | , |
| switch_vout_control_handler | ) |
|
static |
| void set_vcore | ( | uint32_t | voltage_in_mv | ) |
| void set_vcorem | ( | uint32_t | voltage_in_mv | ) |
Handler for TT_SMC_MSG_SET_VOLTAGE messages.
Sets the voltage on the specified regulator via I2C. The request should contain the I2C slave address and the voltage value in millivolts.
| request | Pointer to the host request message, use request->set_voltage for structured access |
| response | Pointer to the response message to be sent back to host |
|
static |
Handler for TT_SMC_MSG_SWITCH_VOUT_CONTROL messages.
Switches the VOUT control source for voltage regulators. This allows switching between different control methods.
| request | Pointer to the host request message, use request->switch_vout_control for structured access |
| response | Pointer to the response message to be sent back to host |
| void SwitchVoutControl | ( | VoltageCmdSource | source | ) |
| SYS_INIT_APP | ( | regulator_init | ) |
|
static |
|
static |