SyterKit 0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions
axp.h File Reference
#include <io.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <types.h>
#include <sys-i2c.h>
#include "reg-axp.h"
Include dependency graph for axp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _axp_step_info
 Structure describing a voltage step of the power domain. More...
 
struct  _axp_contrl_info
 Structure describing the control information of a power domain. More...
 

Macros

#define DEFINE_AXP_PMU(name)
 Macro to define PMU functions for a specific AXP PMU chip.
 

Typedefs

typedef struct _axp_step_info axp_step_info_t
 Structure describing a voltage step of the power domain.
 
typedef struct _axp_contrl_info axp_contrl_info
 Structure describing the control information of a power domain.
 

Functions

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.
 
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.
 
 DEFINE_AXP_PMU (axp1530)
 
 DEFINE_AXP_PMU (axp2202)
 
 DEFINE_AXP_PMU (axp2101)
 
 DEFINE_AXP_PMU (axp8191)
 
 DEFINE_AXP_PMU (axp333)
 
int pmu_axp1530_set_dual_phase (sunxi_i2c_t *i2c_dev)
 Set the dual phase function on the AXP1530 PMU.
 

Macro Definition Documentation

◆ DEFINE_AXP_PMU

#define DEFINE_AXP_PMU (   name)
Value:
int pmu_##name##_init(sunxi_i2c_t *i2c_dev); \
int pmu_##name##_get_vol(sunxi_i2c_t *i2c_dev, char *name); \
int pmu_##name##_set_vol(sunxi_i2c_t *i2c_dev, char *name, int set_vol, int onoff); \
void pmu_##name##_dump(sunxi_i2c_t *i2c_dev);
char name[ANDR_BOOT_NAME_SIZE]
Definition bimage.c:76
Structure representing an I2C device configuration.
Definition sys-i2c.h:39

Macro to define PMU functions for a specific AXP PMU chip.

This macro generates a set of function prototypes for controlling and interacting with a specified AXP Power Management Unit (PMU) chip.

The generated functions are:

  • pmu_<name>_init: Initializes the PMU for the specified device.
  • pmu_<name>_get_vol: Retrieves the voltage of a specified power rail.
  • pmu_<name>_set_vol: Sets the voltage of a specified power rail.
  • pmu_<name>_dump: Dumps the internal registers and status of the PMU.

Example usage:

DEFINE_AXP_PMU(axp2202);
#define DEFINE_AXP_PMU(name)
Macro to define PMU functions for a specific AXP PMU chip.
Definition axp.h:100

This will generate the following function prototypes:

Parameters
nameThe name of the PMU chip (e.g., axp2202, axp221, etc.).

Typedef Documentation

◆ axp_contrl_info

Structure describing the control information of a power domain.

◆ axp_step_info_t

Structure describing a voltage step of the power domain.

Function Documentation

◆ axp_get_vol()

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.

Parameters
i2c_devPointer to the I2C device structure.
nameName of the power domain.
axp_ctrl_tblPointer to the AXP control information table.
axp_ctrl_tbl_sizeSize of the AXP control information table.
axp_addrAXP device address.
Returns
The voltage value of the specified power domain.

◆ axp_set_vol()

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.

Parameters
i2c_devPointer to the I2C device structure.
nameName of the power domain.
set_volVoltage value to set.
onoffWhether to turn on or off the power domain (1 for on, 0 for off).
axp_ctrl_tblPointer to the AXP control information table.
axp_ctrl_tbl_sizeSize of the AXP control information table.
axp_addrAXP device address.
Returns
Integer indicating the success status of the operation.

◆ DEFINE_AXP_PMU() [1/5]

DEFINE_AXP_PMU ( axp1530  )

◆ DEFINE_AXP_PMU() [2/5]

DEFINE_AXP_PMU ( axp2101  )

◆ DEFINE_AXP_PMU() [3/5]

DEFINE_AXP_PMU ( axp2202  )

◆ DEFINE_AXP_PMU() [4/5]

DEFINE_AXP_PMU ( axp333  )

◆ DEFINE_AXP_PMU() [5/5]

DEFINE_AXP_PMU ( axp8191  )

◆ pmu_axp1530_set_dual_phase()

int pmu_axp1530_set_dual_phase ( sunxi_i2c_t i2c_dev)

Set the dual phase function on the AXP1530 PMU.

Parameters
i2c_devPointer to the I2C device structure.
Returns
0 if successful, -1 if an error occurred.