no-OS
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
adp5055.h
Go to the documentation of this file.
1/***************************************************************************/
33#ifndef __ADP_5055_H__
34#define __ADP_5055_H__
35
36#include <stdint.h>
37#include <stdbool.h>
38#include <stdio.h>
39#include "no_os_gpio.h"
40#include "no_os_i2c.h"
41#include "no_os_pwm.h"
42#include "no_os_util.h"
43#include "no_os_units.h"
44
45#define ADP5055_CAPABILITY 0x19
46#define ADP5055_STATUS_CML 0x7E
47#define ADP5055_MODEL_ID 0xD0
48#define ADP5055_CTRL123 0xD1
49#define ADP5055_VID_GO 0xD2
50#define ADP5055_CTRL_MODE1 0xD3
51#define ADP5055_CTRL_MODE2 0xD4
52#define ADP5055_DLY1 0xD5
53#define ADP5055_DLY2 0xD6
54#define ADP5055_DLY3 0xD7
55#define ADP5055_VID1 0xD8
56#define ADP5055_VID2 0xD9
57#define ADP5055_VID3 0xDA
58#define ADP5055_DVS_CFG 0xDB
59#define ADP5055_DVS_LIM1 0xDC
60#define ADP5055_DVS_LIM2 0xDD
61#define ADP5055_DVS_LIM3 0xDE
62#define ADP5055_FT_CFG 0xDF
63#define ADP5055_PG_CFG 0xE0
64#define ADP5055_PG_READ 0xE1
65#define ADP5055_STATUS_LCH 0xE2
66
67#define ADP5055_CH1_ON NO_OS_BIT(0)
68#define ADP5055_CH2_ON NO_OS_BIT(1)
69#define ADP5055_CH3_ON NO_OS_BIT(2)
70
71#define ADP5055_VID1_GO NO_OS_BIT(0)
72#define ADP5055_VID2_GO NO_OS_BIT(1)
73#define ADP5055_VID3_GO NO_OS_BIT(2)
74
75#define ADP5055_EN_MODE_MASK NO_OS_GENMASK(1, 0)
76#define ADP5055_DVS_AUTO NO_OS_BIT(4)
77
78#define ADP5055_DSCG1_ON NO_OS_BIT(0)
79#define ADP5055_DSCG2_ON NO_OS_BIT(1)
80#define ADP5055_DSCG3_ON NO_OS_BIT(2)
81#define ADP5055_PSM1_ON NO_OS_BIT(4)
82#define ADP5055_PSM2_ON NO_OS_BIT(5)
83#define ADP5055_PSM3_ON NO_OS_BIT(6)
84#define ADP5055_OCP_BLANKING NO_OS_BIT(7)
85
86#define ADP5055_EN_DLY_MASK NO_OS_GENMASK(2, 0)
87#define ADP5055_DIS_DLY_MASK NO_OS_GENMASK(6, 4)
88
89#define ADP5055_DVS_INTVAL1 NO_OS_GENMASK(1, 0)
90#define ADP5055_DVS_INTVAL2 NO_OS_GENMASK(3, 2)
91#define ADP5055_DVS_INTVAL3 NO_OS_GENMASK(5, 4)
92
93#define ADP5055_VIDX_LOW_MASK NO_OS_GENMASK(3, 0)
94#define ADP5055_VIDX_HIGH_MASK NO_OS_GENMASK(7, 4)
95
96#define ADP5055_FT1_TH NO_OS_GENMASK(1, 0)
97#define ADP5055_FT2_TH NO_OS_GENMASK(3, 2)
98#define ADP5055_FT3_TH NO_OS_GENMASK(5, 4)
99
100#define ADP5055_PG1_MASK NO_OS_BIT(0)
101#define ADP5055_PG2_MASK NO_OS_BIT(1)
102#define ADP5055_PG3_MASK NO_OS_BIT(2)
103#define ADP5055_PWRGD_DLY NO_OS_BIT(4)
104
105#define ADP5055_PWRGD1 NO_OS_BIT(0)
106#define ADP5055_PWRGD2 NO_OS_BIT(1)
107#define ADP5055_PWRGD3 NO_OS_BIT(2)
108
109#define ADP5055_PG1_LCH NO_OS_BIT(0)
110#define ADP5055_PG2_LCH NO_OS_BIT(1)
111#define ADP5055_PG3_LCH NO_OS_BIT(2)
112#define ADP5055_TSD_LCH NO_OS_BIT(3)
113#define ADP5055_OCP1_LCH NO_OS_BIT(4)
114#define ADP5055_OCP2_LCH NO_OS_BIT(5)
115#define ADP5055_OCP3_LCH NO_OS_BIT(6)
116#define ADP5055_INT_LCH NO_OS_BIT(7)
117
118/* PMBus Addresses */
119#define ADP5055_PMBUS_OPEN_ADDRESS 0x70
120#define ADP5055_PMBUS_0OHM_ADDRESS 0x70
121#define ADP5055_PMBUS_14KOHM_ADDRESS 0x71
122#define ADP5055_PMBUS_16KOHM_ADDRESS 0x72
123#define ADP5055_PMBUS_20KOHM_ADDRESS 0x73
124#define ADP5055_PMBUS_23KOHM_ADDRESS 0x70
125#define ADP5055_PMBUS_32KOHM_ADDRESS 0x71
126#define ADP5055_PMBUS_39KOHM_ADDRESS 0x73
127#define ADP5055_PMBUS_47KOHM_ADDRESS 0x71
128#define ADP5055_PMBUS_57KOHM_ADDRESS 0x72
129#define ADP5055_PMBUS_71KOHM_ADDRESS 0x73
130#define ADP5055_PMBUS_90KOHM_ADDRESS 0x70
131#define ADP5055_PMBUS_127KOHM_ADDRESS 0x71
132#define ADP5055_PMBUS_200KOHM_ADDRESS 0x72
133#define ADP5055_PMBUS_511KOHM_ADDRESS 0x73
134
141
148
153
156 ADP5055_FT_1_5WINDOW_3G, // 1.5% window with 3xGm, Gm=350uA/V
157 ADP5055_FT_1_5WINDOW_5G, // 1.5% window with 5xGm, Gm=350uA/V
158 ADP5055_FT_2_5WINDOW_5G // 2.5% window with 5xGm, Gm=350uA/V
159};
160
162 ADP5055_DVS_INTVAL_125US, // 125uS at 12mV/ms slew rate
163 ADP5055_DVS_INTVAL_62US, // 62.5uS at 24mV/ms slew rate
164 ADP5055_DVS_INTVAL_31US, // 31.2uS at 48mV/ms slew rate
165 ADP5055_DVS_INTVAL_15US, // 15.6uS at 96mV/ms slew rate
166};
167
178
189
195
202
209
211int adp5055_read(struct adp5055_desc *desc, uint8_t address, uint8_t *data);
212
214int adp5055_write(struct adp5055_desc *desc, uint8_t address, uint8_t data);
215
217int adp5055_read_status(struct adp5055_desc *desc, uint8_t *status_val);
218
221 enum adp5055_en_mode mode);
222
224int adp5055_set_dvs_auto(struct adp5055_desc *desc, bool en);
225
227int adp5055_set_ocp_blanking(struct adp5055_desc *desc, bool en);
228
231 bool en);
232
235 enum adp5055_channel ch, bool en);
236
239 enum adp5055_channel ch, enum adp5055_en_dly en_dly,
240 enum adp5055_dis_dly dis_dly);
241
243int adp5055_set_vid_code(struct adp5055_desc *desc, enum adp5055_channel ch,
244 uint8_t val);
245
247int adp5055_start_vout(struct adp5055_desc *desc, enum adp5055_channel ch);
248
250int adp5055_enable_channel(struct adp5055_desc *desc, enum adp5055_channel ch,
251 bool en);
252
255 enum adp5055_dvs_intval intval);
256
258int adp5055_set_vidx_lim(struct adp5055_desc *desc, enum adp5055_channel ch,
259 enum adp5055_vidx_limit lim_type, uint8_t lim_val);
260
263 enum adp5055_channel ch, enum adp5055_ft_th ft);
264
267 enum adp5055_channel ch, bool en);
268
270int adp5055_set_pg_hw_delay(struct adp5055_desc *desc, bool en);
271
273int adp5055_read_pg(struct adp5055_desc *desc, enum adp5055_channel ch,
274 uint8_t *pg_val);
275
278 enum adp5055_channel ch, enum adp5055_latch_status lch_status_type,
279 uint8_t *lch_status_val);
280
282int adp5055_init(struct adp5055_desc **desc,
284
286int adp5055_remove(struct adp5055_desc *desc);
287
288#endif
struct ad7616_init_param init_param
Definition ad7616_sdz.c:107
int adp5055_remove(struct adp5055_desc *desc)
Free the resources allocated by the adp5055_init()
Definition adp5055.c:498
int adp5055_set_vidx_lim(struct adp5055_desc *desc, enum adp5055_channel ch, enum adp5055_vidx_limit lim_type, uint8_t lim_val)
Sets high or low limit for output voltage reference.
Definition adp5055.c:312
adp5055_dvs_intval
Definition adp5055.h:161
@ ADP5055_DVS_INTVAL_15US
Definition adp5055.h:165
@ ADP5055_DVS_INTVAL_31US
Definition adp5055.h:164
@ ADP5055_DVS_INTVAL_125US
Definition adp5055.h:162
@ ADP5055_DVS_INTVAL_62US
Definition adp5055.h:163
adp5055_ft_th
Definition adp5055.h:154
@ ADP5055_FT_1_5WINDOW_5G
Definition adp5055.h:157
@ ADP5055_FT_1_5WINDOW_3G
Definition adp5055.h:156
@ ADP5055_FT_2_5WINDOW_5G
Definition adp5055.h:158
@ ADP5055_FT_NONE
Definition adp5055.h:155
adp5055_dis_dly
Definition adp5055.h:179
@ ADP5055_DIS_4TSET
Definition adp5055.h:182
@ ADP5055_DIS_12TSET
Definition adp5055.h:186
@ ADP5055_DIS_14TSET
Definition adp5055.h:187
@ ADP5055_DIS_8TSET
Definition adp5055.h:184
@ ADP5055_DIS_2TSET
Definition adp5055.h:181
@ ADP5055_DIS_10TSET
Definition adp5055.h:185
@ ADP5055_DIS_NO_DELAY
Definition adp5055.h:180
@ ADP5055_DIS_6TSET
Definition adp5055.h:183
int adp5055_set_dvs_interval(struct adp5055_desc *desc, enum adp5055_channel ch, enum adp5055_dvs_intval intval)
Sets dynamic voltage scaling interval for each channel.
Definition adp5055.c:291
int adp5055_read_status(struct adp5055_desc *desc, uint8_t *status_val)
Read statuses.
Definition adp5055.c:111
int adp5055_set_dvs_auto(struct adp5055_desc *desc, bool en)
Enables or disables dynamic voltage scaling across all channels.
Definition adp5055.c:135
int adp5055_set_vid_code(struct adp5055_desc *desc, enum adp5055_channel ch, uint8_t val)
Sets 8-bit code of output voltage reference of a channel.
Definition adp5055.c:233
int adp5055_set_pg_hw_delay(struct adp5055_desc *desc, bool en)
Enables a delay in the PWRGD hardware pin.
Definition adp5055.c:383
int adp5055_set_enable_disable_delay(struct adp5055_desc *desc, enum adp5055_channel ch, enum adp5055_en_dly en_dly, enum adp5055_dis_dly dis_dly)
Sets both enable and disable delay per channel.
Definition adp5055.c:201
adp5055_en_dly
Definition adp5055.h:168
@ ADP5055_EN_5TSET
Definition adp5055.h:174
@ ADP5055_EN_4TSET
Definition adp5055.h:173
@ ADP5055_EN_2TSET
Definition adp5055.h:171
@ ADP5055_EN_NO_DELAY
Definition adp5055.h:169
@ ADP5055_EN_6TSET
Definition adp5055.h:175
@ ADP5055_EN_1TSET
Definition adp5055.h:170
@ ADP5055_EN_7TSET
Definition adp5055.h:176
@ ADP5055_EN_3TSET
Definition adp5055.h:172
int adp5055_set_output_discharge(struct adp5055_desc *desc, enum adp5055_channel ch, bool en)
Enables or disables output discharge per channel.
Definition adp5055.c:180
int adp5055_start_vout(struct adp5055_desc *desc, enum adp5055_channel ch)
Initiates output voltage transition on specified channel when dynamic voltage scaling is enabled.
Definition adp5055.c:252
int adp5055_read_pg(struct adp5055_desc *desc, enum adp5055_channel ch, uint8_t *pg_val)
Reads real-time power good status of specified channel.
Definition adp5055.c:396
int adp5055_set_pg_channel_output(struct adp5055_desc *desc, enum adp5055_channel ch, bool en)
Enables power good signal to external PWRGD hardware pin.
Definition adp5055.c:364
int adp5055_set_fast_transient(struct adp5055_desc *desc, enum adp5055_channel ch, enum adp5055_ft_th ft)
Configures fast transient sensitivity per channel.
Definition adp5055.c:344
adp5055_channel
Definition adp5055.h:190
@ ADP5055_VOUT3
Definition adp5055.h:193
@ ADP5055_VOUT1
Definition adp5055.h:191
@ ADP5055_VOUT2
Definition adp5055.h:192
int adp5055_set_auto_pwm_psm(struct adp5055_desc *desc, enum adp5055_channel ch, bool en)
Enables or disables automatic PWM/PSM per channel.
Definition adp5055.c:160
adp5055_en_mode
Definition adp5055.h:142
@ ADP5055_EN_MODE_SW_ONLY
Definition adp5055.h:144
@ ADP5055_EN_MODE_HW_AND_SW
Definition adp5055.h:145
@ ADP5055_EN_MODE_HW_OR_SW
Definition adp5055.h:146
@ ADP5055_EN_MODE_HW_ONLY
Definition adp5055.h:143
int adp5055_enable_channel(struct adp5055_desc *desc, enum adp5055_channel ch, bool en)
Enables output voltage channel in software.
Definition adp5055.c:271
int adp5055_read_latched_status(struct adp5055_desc *desc, enum adp5055_channel ch, enum adp5055_latch_status lch_status_type, uint8_t *lch_status_val)
Reads the latched status of a specified channel.
Definition adp5055.c:425
int adp5055_write(struct adp5055_desc *desc, uint8_t address, uint8_t data)
Write data to ADP5055.
Definition adp5055.c:92
adp5055_vidx_limit
Definition adp5055.h:149
@ ADP5055_VIDX_LOW
Definition adp5055.h:150
@ ADP5055_VIDX_HIGH
Definition adp5055.h:151
int adp5055_set_ocp_blanking(struct adp5055_desc *desc, bool en)
Enables or disables overcurrent protection (OCP) blanking for all channels.
Definition adp5055.c:147
int adp5055_init(struct adp5055_desc **desc, struct adp5055_init_param *init_param)
Initialize the ADP5055 device.
Definition adp5055.c:469
int adp5055_read(struct adp5055_desc *desc, uint8_t address, uint8_t *data)
Read data from ADP5055.
Definition adp5055.c:71
adp5055_latch_status
Definition adp5055.h:135
@ ADP5055_LCH_INIT_FAIL
Definition adp5055.h:136
@ ADP5055_LCH_PG_FAIL
Definition adp5055.h:139
@ ADP5055_LCH_THERMAL_SHUTDOWN
Definition adp5055.h:138
@ ADP5055_LCH_OVERCURRENT_HICCUP
Definition adp5055.h:137
int adp5055_set_enable_mode(struct adp5055_desc *desc, enum adp5055_en_mode mode)
Configures enabling for all individual channels by hardware and/or software.
Definition adp5055.c:122
Header file of GPIO Interface.
Header file of I2C Interface.
Header file of PWM Interface.
Header file of Units.
Header file of utility functions.
Device descriptor for ADP5055.
Definition adp5055.h:206
struct no_os_i2c_desc * i2c_desc
Definition adp5055.h:207
Initialization parameter for the ADP5055 device.
Definition adp5055.h:199
struct no_os_i2c_init_param * i2c_param
Definition adp5055.h:200
Structure holding I2C address descriptor.
Definition no_os_i2c.h:89
Structure holding the parameters for I2C initialization.
Definition no_os_i2c.h:52