SyterKit 0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
axp.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0+ */
2
3#ifndef __G_AXP_H__
4#define __G_AXP_H__
5
6#include <io.h>
7#include <stdarg.h>
8#include <stdbool.h>
9#include <stddef.h>
10#include <stdint.h>
11#include <types.h>
12
13#include <sys-i2c.h>
14
15#include "reg-axp.h"
16
17#ifdef __cplusplus
18extern "C" {
19#endif// __cplusplus
20
24typedef struct _axp_step_info {
25 uint32_t step_min_vol;// Minimum voltage level for the step.
26 uint32_t step_max_vol;// Maximum voltage level for the step.
27 uint32_t step_val; // Voltage increment value for the step.
28 uint32_t regation; // Regulator register address.
30
34typedef struct _axp_contrl_info {
35 char name[8]; // Name of the power domain.
36 uint32_t min_vol; // Minimum voltage level for the domain.
37 uint32_t max_vol; // Maximum voltage level for the domain.
38 uint32_t cfg_reg_addr; // Configuration register address.
39 uint32_t cfg_reg_mask; // Configuration register mask.
40 uint32_t ctrl_reg_addr; // Control register address.
41 uint32_t ctrl_bit_ofs; // Bit offset in the control register.
42 uint32_t reg_addr_offset; // Offset of the register address.
43 axp_step_info_t axp_step_tbl[4];// Voltage step table for the domain.
45
46/* Common function */
47
60int axp_set_vol(sunxi_i2c_t *i2c_dev, char *name, int set_vol, int onoff, axp_contrl_info *axp_ctrl_tbl, uint8_t axp_ctrl_tbl_size, uint8_t axp_addr);
61
72int axp_get_vol(sunxi_i2c_t *i2c_dev, char *name, axp_contrl_info *axp_ctrl_tbl, uint8_t axp_ctrl_tbl_size, uint8_t axp_addr);
73
74/* define AXP pmu */
75
100#define DEFINE_AXP_PMU(name) \
101 int pmu_##name##_init(sunxi_i2c_t *i2c_dev); \
102 int pmu_##name##_get_vol(sunxi_i2c_t *i2c_dev, char *name); \
103 int pmu_##name##_set_vol(sunxi_i2c_t *i2c_dev, char *name, int set_vol, int onoff); \
104 void pmu_##name##_dump(sunxi_i2c_t *i2c_dev);
105
106/* AXP PMU defines */
112
113/* Extra */
121
122#ifdef __cplusplus
123}
124#endif// __cplusplus
125
126#endif// __G_AXP_H__
static axp_contrl_info axp_ctrl_tbl[]
Definition axp1530.c:16
struct _axp_contrl_info axp_contrl_info
Structure describing the control information of a power domain.
#define DEFINE_AXP_PMU(name)
Macro to define PMU functions for a specific AXP PMU chip.
Definition axp.h:100
int axp_get_vol(sunxi_i2c_t *i2c_dev, char *name, axp_contrl_info *axp_ctrl_tbl, uint8_t axp_ctrl_tbl_size, uint8_t axp_addr)
Get the voltage value for a specific power domain controlled by AXP.
Definition axp.c:97
int pmu_axp1530_set_dual_phase(sunxi_i2c_t *i2c_dev)
Set the dual phase function on the AXP1530 PMU.
Definition axp1530.c:77
int axp_set_vol(sunxi_i2c_t *i2c_dev, char *name, int set_vol, int onoff, axp_contrl_info *axp_ctrl_tbl, uint8_t axp_ctrl_tbl_size, uint8_t axp_addr)
Set the voltage for a specific power domain controlled by AXP.
Definition axp.c:35
struct _axp_step_info axp_step_info_t
Structure describing a voltage step of the power domain.
char name[ANDR_BOOT_NAME_SIZE]
Definition bimage.c:76
u32_t uint32_t
Definition stdint.h:13
u8_t uint8_t
Definition stdint.h:7
Structure describing the control information of a power domain.
Definition axp.h:34
uint32_t reg_addr_offset
Definition axp.h:42
uint32_t max_vol
Definition axp.h:37
uint32_t ctrl_reg_addr
Definition axp.h:40
char name[8]
Definition axp.h:35
axp_step_info_t axp_step_tbl[4]
Definition axp.h:43
uint32_t min_vol
Definition axp.h:36
uint32_t cfg_reg_mask
Definition axp.h:39
uint32_t cfg_reg_addr
Definition axp.h:38
uint32_t ctrl_bit_ofs
Definition axp.h:41
Structure describing a voltage step of the power domain.
Definition axp.h:24
uint32_t regation
Definition axp.h:28
uint32_t step_max_vol
Definition axp.h:26
uint32_t step_min_vol
Definition axp.h:25
uint32_t step_val
Definition axp.h:27
Structure representing an I2C device configuration.
Definition sys-i2c.h:39