[processor-sdk/performance-audio-sr.git] / psdk_cust / pdk_k2g_1_0_1_1_eng / packages / ti / board / src / idkAM572x / device / pmic_device.h
1 /**
2 * \file pmic_device.h
3 *
4 * \brief The file contains the declaration for pmic data structure.
5 *
6 */
8 /*
9 * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 *
18 * Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the
21 * distribution.
22 *
23 * Neither the name of Texas Instruments Incorporated nor the names of
24 * its contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 *
39 */
41 #ifndef __PMIC_DEVICE_H
42 #define __PMIC_DEVICE_H
44 /* ========================================================================== */
45 /* Include Files */
46 /* ========================================================================== */
47 #include <stdint.h>
49 #include <ti/drv/i2c/I2C.h>
50 #include <ti/drv/i2c/soc/I2C_v1.h>
52 #ifdef __cplusplus /* If this is a C++ compiler, use C linkage */
53 extern "C"
54 {
55 #endif
57 /* ========================================================================== */
58 /* Macros & Typedefs */
59 /* ========================================================================== */
61 /* TPS659039 */
62 #define TPS659039_I2C_SLAVE_ADDR 0x58
63 #define TPS659039_REG_ADDR_SMPS12 0x23
64 #define TPS659039_REG_ADDR_SMPS45 0x2B
65 #define TPS659039_REG_ADDR_SMPS6 0x2F
66 #define TPS659039_REG_ADDR_SMPS7 0x33
67 #define TPS659039_REG_ADDR_SMPS8 0x37
69 typedef struct pmic_data {
70 uint32_t base_offset;
71 uint32_t step;
72 uint32_t start_code;
73 uint32_t slave_addr;
74 uint32_t dev_instance;
75 void (*pmic_device_open)(uint32_t instance);
76 bool (*pmic_write)(uint32_t slaveAddr, uint8_t reg_addr, uint8_t value);
77 uint32_t (*pmic_get_offset)(uint32_t volt_offset, struct pmic_data *pmic);
78 void (*pmic_device_close)();
79 }pmic_data_t;
81 /**
82 * \brief This API returns the pointer to the structure holding PMIC data.
83 *
84 * \param pPmicData Pointer to the PMIC data structure.
85 */
86 pmic_data_t* Board_GetPmicData();
88 #ifdef __cplusplus /* If this is a C++ compiler, end C linkage */
89 }
90 #endif
92 #endif /*__PMIC_DEVICE_H*/