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