OpenBIC
OpenSource Bridge-IC
plat_vr_test_mode.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _PLAT_VR_TEST_MODE_H_
18#define _PLAT_VR_TEST_MODE_H_
19
20#define VR_FAST_OCP_REG 0x46
21#define VR_SLOW_OCP_REG 0xEA
22#define VR_UVP_REG 0x44
23#define VR_OVP_REG 0x40
24#define VR_VOUT_MAX_REG 0x24
25#define VR_VOUT_REG 0x21
26#define VR_LOOPCFG_REG 0xF0
27
28#define VR_UVP_0_DMA_ADDR 0xEA3D
29#define VR_UVP_1_DMA_ADDR 0xEABD
30#define VR_OVP_0_DMA_ADDR 0xEA3E
31#define VR_OVP_1_DMA_ADDR 0xEABE
32
33#define NO_USE 0xFF //VR_UVP_THRESHOLD_GAIN_NO_USE
34#define NO_ACTION 0 // ovp2 threshold no action
35#define LATCH_OFF 1 // ovp2 threshold latch off
36#define ENABLE 1 // divider enable
37#define DISABLE 0 // divider disable
38
39typedef struct {
40 uint8_t vr_rail;
41 uint16_t fast_ocp;
42 uint16_t slow_ocp;
43 uint16_t uvp;
44 uint16_t ovp;
45 uint16_t vout_max;
46 uint16_t lcr;
47 uint16_t ucr;
48 uint16_t vout_default;
50
51typedef struct {
52 uint8_t vr_rail;
53 uint16_t total_ocp;
55 uint16_t uvp_threshold;
56 uint16_t lcr;
57 uint16_t ucr;
60 uint16_t ovp2;
61 uint16_t ovp1;
62 uint16_t vout_default;
63 uint16_t vout_max;
64 uint16_t uvp;
66
69extern const uint8_t vr_test_mode_table_size;
70extern const uint8_t vr_test_mode_table_dafault_size;
71
74extern const uint8_t vr_mps_test_mode_table_size;
75extern const uint8_t vr_mps_normal_mode_table_size;
76
77bool get_vr_test_mode_flag(void);
78void vr_test_mode_enable(bool onoff);
80bool dma_write_vr(uint8_t rail, uint16_t reg, uint8_t *data, uint8_t len);
81bool dma_read_vr(uint8_t rail, uint16_t reg, uint8_t *data, uint8_t len);
82bool get_vr_offset_uvp_ovp(uint8_t rail, uint16_t *uvp, uint16_t *ovp);
83bool use_offset_uvp_ovp(uint8_t rail);
84bool get_vr_fixed_uvp_ovp_enable(uint8_t rail);
85bool set_vr_fixed_uvp_ovp_enable(uint8_t rail, uint8_t enable);
86#endif /* _PLAT_VR_TEST_MODE_H_ */
uint8_t data[]
Definition: isl69259.c:2
void init_vr_test_mode_polling(void)
Definition: plat_vr_test_mode.c:524
const vr_test_mode_setting_t vr_test_mode_table[]
Definition: plat_vr_test_mode.c:35
void vr_test_mode_enable(bool onoff)
Definition: plat_vr_test_mode.c:459
bool use_offset_uvp_ovp(uint8_t rail)
Definition: plat_vr_test_mode.c:293
bool get_vr_offset_uvp_ovp(uint8_t rail, uint16_t *uvp, uint16_t *ovp)
Definition: plat_vr_test_mode.c:257
const uint8_t vr_test_mode_table_dafault_size
Definition: plat_vr_test_mode.c:209
bool set_vr_fixed_uvp_ovp_enable(uint8_t rail, uint8_t enable)
Definition: plat_vr_test_mode.c:320
bool dma_read_vr(uint8_t rail, uint16_t reg, uint8_t *data, uint8_t len)
Definition: plat_vr_test_mode.c:242
const mps_vr_test_mode_setting_t vr_mps_normal_mode_table[]
Definition: plat_vr_test_mode.c:146
const uint8_t vr_mps_normal_mode_table_size
Definition: plat_vr_test_mode.c:212
const uint8_t vr_mps_test_mode_table_size
Definition: plat_vr_test_mode.c:211
bool get_vr_test_mode_flag(void)
Definition: plat_vr_test_mode.c:30
bool get_vr_fixed_uvp_ovp_enable(uint8_t rail)
Definition: plat_vr_test_mode.c:303
const uint8_t vr_test_mode_table_size
Definition: plat_vr_test_mode.c:208
bool dma_write_vr(uint8_t rail, uint16_t reg, uint8_t *data, uint8_t len)
Definition: plat_vr_test_mode.c:227
const vr_test_mode_setting_t vr_test_mode_table_default[]
Definition: plat_vr_test_mode.c:60
const mps_vr_test_mode_setting_t vr_mps_test_mode_table[]
Definition: plat_vr_test_mode.c:85
#define enable
Definition: shell_iris_power.c:15
Definition: plat_vr_test_mode.h:51
uint16_t lcr
Definition: plat_vr_test_mode.h:56
uint16_t uvp_threshold
Definition: plat_vr_test_mode.h:55
uint16_t ovp2_threshold
Definition: plat_vr_test_mode.h:58
uint16_t uvp
Definition: plat_vr_test_mode.h:64
uint16_t ovp1_threshold
Definition: plat_vr_test_mode.h:59
uint8_t vr_rail
Definition: plat_vr_test_mode.h:52
uint16_t mp2971_uvp_threshold_gain
Definition: plat_vr_test_mode.h:54
uint16_t vout_default
Definition: plat_vr_test_mode.h:62
uint16_t ucr
Definition: plat_vr_test_mode.h:57
uint16_t ovp2
Definition: plat_vr_test_mode.h:60
uint16_t ovp1
Definition: plat_vr_test_mode.h:61
uint16_t total_ocp
Definition: plat_vr_test_mode.h:53
uint16_t vout_max
Definition: plat_vr_test_mode.h:63
Definition: plat_vr_test_mode.h:39
uint16_t vout_max
Definition: plat_vr_test_mode.h:45
uint16_t fast_ocp
Definition: plat_vr_test_mode.h:41
uint16_t vout_default
Definition: plat_vr_test_mode.h:48
uint8_t vr_rail
Definition: plat_vr_test_mode.h:40
uint16_t uvp
Definition: plat_vr_test_mode.h:43
uint16_t ovp
Definition: plat_vr_test_mode.h:44
uint16_t lcr
Definition: plat_vr_test_mode.h:46
uint16_t ucr
Definition: plat_vr_test_mode.h:47
uint16_t slow_ocp
Definition: plat_vr_test_mode.h:42