xref: /btstack/port/max32630-fthr/board/max14690n.h (revision 49a45ad9fdd8e9904c01b63e1d7d6091211e6efb)
1*49a45ad9SMatthias Ringwald /*******************************************************************************
2*49a45ad9SMatthias Ringwald  * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
3*49a45ad9SMatthias Ringwald  *
4*49a45ad9SMatthias Ringwald  * Permission is hereby granted, free of charge, to any person obtaining a
5*49a45ad9SMatthias Ringwald  * copy of this software and associated documentation files (the "Software"),
6*49a45ad9SMatthias Ringwald  * to deal in the Software without restriction, including without limitation
7*49a45ad9SMatthias Ringwald  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*49a45ad9SMatthias Ringwald  * and/or sell copies of the Software, and to permit persons to whom the
9*49a45ad9SMatthias Ringwald  * Software is furnished to do so, subject to the following conditions:
10*49a45ad9SMatthias Ringwald  *
11*49a45ad9SMatthias Ringwald  * The above copyright notice and this permission notice shall be included
12*49a45ad9SMatthias Ringwald  * in all copies or substantial portions of the Software.
13*49a45ad9SMatthias Ringwald  *
14*49a45ad9SMatthias Ringwald  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15*49a45ad9SMatthias Ringwald  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16*49a45ad9SMatthias Ringwald  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17*49a45ad9SMatthias Ringwald  * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
18*49a45ad9SMatthias Ringwald  * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19*49a45ad9SMatthias Ringwald  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20*49a45ad9SMatthias Ringwald  * OTHER DEALINGS IN THE SOFTWARE.
21*49a45ad9SMatthias Ringwald  *
22*49a45ad9SMatthias Ringwald  * Except as contained in this notice, the name of Maxim Integrated
23*49a45ad9SMatthias Ringwald  * Products, Inc. shall not be used except as stated in the Maxim Integrated
24*49a45ad9SMatthias Ringwald  * Products, Inc. Branding Policy.
25*49a45ad9SMatthias Ringwald  *
26*49a45ad9SMatthias Ringwald  * The mere transfer of this software does not imply any licenses
27*49a45ad9SMatthias Ringwald  * of trade secrets, proprietary technology, copyrights, patents,
28*49a45ad9SMatthias Ringwald  * trademarks, maskwork rights, or any other form of intellectual
29*49a45ad9SMatthias Ringwald  * property whatsoever. Maxim Integrated Products, Inc. retains all
30*49a45ad9SMatthias Ringwald  * ownership rights.
31*49a45ad9SMatthias Ringwald  *
32*49a45ad9SMatthias Ringwald  * $Date: 2016-03-11 10:46:37 -0700 (Fri, 11 Mar 2016) $
33*49a45ad9SMatthias Ringwald  * $Revision: 21839 $
34*49a45ad9SMatthias Ringwald  *
35*49a45ad9SMatthias Ringwald  ******************************************************************************/
36*49a45ad9SMatthias Ringwald 
37*49a45ad9SMatthias Ringwald /**
38*49a45ad9SMatthias Ringwald  * @file    max14690n.h
39*49a45ad9SMatthias Ringwald  * @brief   MAX14690 PMIC driver API.
40*49a45ad9SMatthias Ringwald  */
41*49a45ad9SMatthias Ringwald 
42*49a45ad9SMatthias Ringwald #ifndef _MAX14690_H_
43*49a45ad9SMatthias Ringwald #define _MAX14690_H_
44*49a45ad9SMatthias Ringwald 
45*49a45ad9SMatthias Ringwald #ifdef __cplusplus
46*49a45ad9SMatthias Ringwald extern "C" {
47*49a45ad9SMatthias Ringwald #endif
48*49a45ad9SMatthias Ringwald 
49*49a45ad9SMatthias Ringwald 
50*49a45ad9SMatthias Ringwald /***** Definitions *****/
51*49a45ad9SMatthias Ringwald 
52*49a45ad9SMatthias Ringwald typedef enum {  // I2C Register Addresses
53*49a45ad9SMatthias Ringwald     MAX14690_REG_CHIP_ID,
54*49a45ad9SMatthias Ringwald     MAX14690_REG_CHIP_REV,
55*49a45ad9SMatthias Ringwald     MAX14690_REG_STATUS_A,
56*49a45ad9SMatthias Ringwald     MAX14690_REG_STATUS_B,
57*49a45ad9SMatthias Ringwald     MAX14690_REG_STATUS_C,
58*49a45ad9SMatthias Ringwald     MAX14690_REG_INT_A,
59*49a45ad9SMatthias Ringwald     MAX14690_REG_INT_B,
60*49a45ad9SMatthias Ringwald     MAX14690_REG_INT_MASK_A,
61*49a45ad9SMatthias Ringwald     MAX14690_REG_INT_MASK_B,
62*49a45ad9SMatthias Ringwald     MAX14690_REG_ILIM_CNTL,
63*49a45ad9SMatthias Ringwald     MAX14690_REG_CHG_CNTL_A,
64*49a45ad9SMatthias Ringwald     MAX14690_REG_CHG_CNTL_B,
65*49a45ad9SMatthias Ringwald     MAX14690_REG_CHG_TMR,
66*49a45ad9SMatthias Ringwald     MAX14690_REG_BUCK1_CFG,
67*49a45ad9SMatthias Ringwald     MAX14690_REG_BUCK1_VSET,
68*49a45ad9SMatthias Ringwald     MAX14690_REG_BUCK2_CFG,
69*49a45ad9SMatthias Ringwald     MAX14690_REG_BUCK2_VSET,
70*49a45ad9SMatthias Ringwald     MAX14690_REG_RSVD_11,
71*49a45ad9SMatthias Ringwald     MAX14690_REG_LDO1_CFG,
72*49a45ad9SMatthias Ringwald     MAX14690_REG_LDO1_VSET,
73*49a45ad9SMatthias Ringwald     MAX14690_REG_LDO2_CFG,
74*49a45ad9SMatthias Ringwald     MAX14690_REG_LDO2_VSET,
75*49a45ad9SMatthias Ringwald     MAX14690_REG_LDO3_CFG,
76*49a45ad9SMatthias Ringwald     MAX14690_REG_LDO3_VSET,
77*49a45ad9SMatthias Ringwald     MAX14690_REG_THRM_CFG,
78*49a45ad9SMatthias Ringwald     MAX14690_REG_MON_CFG,
79*49a45ad9SMatthias Ringwald     MAX14690_REG_BOOT_CFG,
80*49a45ad9SMatthias Ringwald     MAX14690_REG_PIN_STAT,
81*49a45ad9SMatthias Ringwald     MAX14690_REG_BUCK_EXTRA,
82*49a45ad9SMatthias Ringwald     MAX14690_REG_PWR_CFG,
83*49a45ad9SMatthias Ringwald     MAX14690_REG_RSVD_1E,
84*49a45ad9SMatthias Ringwald     MAX14690_REG_PWR_OFF,
85*49a45ad9SMatthias Ringwald } max14690_reg_map_t;
86*49a45ad9SMatthias Ringwald 
87*49a45ad9SMatthias Ringwald typedef enum {
88*49a45ad9SMatthias Ringwald 	LDO_OUTPUT_DISABLED,
89*49a45ad9SMatthias Ringwald 	SW_OUTPUT_DISABLED,
90*49a45ad9SMatthias Ringwald 	LDO_OUTPUT_ENABLED,
91*49a45ad9SMatthias Ringwald 	SW_OUTPUT_ENABLED,
92*49a45ad9SMatthias Ringwald 	LDO_OUTPUT_MPC0,
93*49a45ad9SMatthias Ringwald 	SW_OUTPUT_MPC0,
94*49a45ad9SMatthias Ringwald 	LDO_OUTPUT_MPC1,
95*49a45ad9SMatthias Ringwald 	SW_OUTPUT_MPC1,
96*49a45ad9SMatthias Ringwald 	LDO_OUTPUT_DISABLED_ACT_DIS,
97*49a45ad9SMatthias Ringwald 	SW_OUTPUT_DISABLED_ACT_DIS,
98*49a45ad9SMatthias Ringwald 	LDO_OUTPUT_ENABLED_ACT_DIS,
99*49a45ad9SMatthias Ringwald 	SW_OUTPUT_ENABLED_ACT_DIS,
100*49a45ad9SMatthias Ringwald 	LDO_OUTPUT_MPC0_ACT_DIS,
101*49a45ad9SMatthias Ringwald 	SW_OUTPUT_MPC0_ACT_DIS,
102*49a45ad9SMatthias Ringwald 	LDO_OUTPUT_MPC1_ACT_DIS,
103*49a45ad9SMatthias Ringwald 	SW_OUTPUT_MPC1_ACT_DIS,
104*49a45ad9SMatthias Ringwald } ldo_enable_mode_t;
105*49a45ad9SMatthias Ringwald 
106*49a45ad9SMatthias Ringwald typedef enum {
107*49a45ad9SMatthias Ringwald 	MAX14690_MUX_SEL_PULLDOWN,
108*49a45ad9SMatthias Ringwald 	MAX14690_MUX_SEL_BAT,
109*49a45ad9SMatthias Ringwald 	MAX14690_MUX_SEL_SYS,
110*49a45ad9SMatthias Ringwald 	MAX14690_MUX_SEL_BUCK1,
111*49a45ad9SMatthias Ringwald 	MAX14690_MUX_SEL_BUCK2,
112*49a45ad9SMatthias Ringwald 	MAX14690_MUX_SEL_LDO1,
113*49a45ad9SMatthias Ringwald 	MAX14690_MUX_SEL_LDO2,
114*49a45ad9SMatthias Ringwald 	MAX14690_MUX_SEL_LDO3,
115*49a45ad9SMatthias Ringwald 	MAX14690_MUX_SEL_HIZ,
116*49a45ad9SMatthias Ringwald } max14690_mux_ch_t;
117*49a45ad9SMatthias Ringwald 
118*49a45ad9SMatthias Ringwald typedef enum {
119*49a45ad9SMatthias Ringwald 	MAX14690_MUX_DIV_4,
120*49a45ad9SMatthias Ringwald 	MAX14690_MUX_DIV_3,
121*49a45ad9SMatthias Ringwald 	MAX14690_MUX_DIV_2,
122*49a45ad9SMatthias Ringwald 	MAX14690_MUX_DIV_1,
123*49a45ad9SMatthias Ringwald } max14690_mux_div_t;
124*49a45ad9SMatthias Ringwald 
125*49a45ad9SMatthias Ringwald /***** Function Prototypes *****/
126*49a45ad9SMatthias Ringwald 
127*49a45ad9SMatthias Ringwald /**
128*49a45ad9SMatthias Ringwald  * @brief   Initialize the MAX14690.
129*49a45ad9SMatthias Ringwald  * @returns #E_NO_ERROR if everything is successful, error if unsuccessful.
130*49a45ad9SMatthias Ringwald  */
131*49a45ad9SMatthias Ringwald int MAX14690N_Init(float ldo2v, ldo_enable_mode_t ldo2en, float ldo3v, ldo_enable_mode_t ldo3en);
132*49a45ad9SMatthias Ringwald 
133*49a45ad9SMatthias Ringwald /**
134*49a45ad9SMatthias Ringwald  * @brief   Enable or disable LDO2.
135*49a45ad9SMatthias Ringwald  * @param   enable  1 to enable, 0 to disable LDO2.
136*49a45ad9SMatthias Ringwald  * @returns #E_NO_ERROR if everything is successful, error if unsuccessful.
137*49a45ad9SMatthias Ringwald  */
138*49a45ad9SMatthias Ringwald int MAX14690_LDO2setMode(ldo_enable_mode_t mode);
139*49a45ad9SMatthias Ringwald int MAX14690_LDO2setV(float voltage);
140*49a45ad9SMatthias Ringwald int MAX14690_LDO3setMode(ldo_enable_mode_t mode);
141*49a45ad9SMatthias Ringwald int MAX14690_LDO3setV(float voltage);
142*49a45ad9SMatthias Ringwald int MAX14690_MuxSet(max14690_mux_ch_t ch, max14690_mux_div_t div);
143*49a45ad9SMatthias Ringwald 
144*49a45ad9SMatthias Ringwald #ifdef __cplusplus
145*49a45ad9SMatthias Ringwald }
146*49a45ad9SMatthias Ringwald #endif
147*49a45ad9SMatthias Ringwald 
148*49a45ad9SMatthias Ringwald #endif /* _MAX14690_H_ */
149