coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
max77686.c File Reference
#include <console/console.h>
#include <device/mmio.h>
#include <device/i2c_simple.h>
#include "max77686.h"
Include dependency graph for max77686.c:

Go to the source code of this file.

Enumerations

enum  { REG_BBAT = 0x7e , BBAT_BBCHOSTEN_MASK = 1 << 0 , BBAT_BBCVS_SHIFT = 3 , BBAT_BBCVS_MASK = 3 << BBAT_BBCVS_SHIFT }
 

Functions

static int max77686_i2c_write (unsigned int bus, unsigned char chip_addr, unsigned int reg, unsigned char val)
 
static int max77686_i2c_read (unsigned int bus, unsigned char chip_addr, unsigned int reg, unsigned char *val)
 
static int max77686_enablereg (unsigned int bus, enum max77686_regnum reg, int enable)
 
int max77686_volsetting (unsigned int bus, enum max77686_regnum reg, unsigned int volt, int enable, int volt_units)
 Set the required voltage level of pmic. More...
 
int max77686_enable_32khz_cp (unsigned int bus)
 This function enables the 32KHz coprocessor clock. More...
 
int max77686_disable_backup_batt (unsigned int bus)
 Disable charging of the RTC backup battery. More...
 

Variables

struct max77686_para max77686_param []
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
REG_BBAT 
BBAT_BBCHOSTEN_MASK 
BBAT_BBCVS_SHIFT 
BBAT_BBCVS_MASK 

Definition at line 10 of file max77686.c.

Function Documentation

◆ max77686_disable_backup_batt()

int max77686_disable_backup_batt ( unsigned int  bus)

Disable charging of the RTC backup battery.

Parameters
busi2c bus
Returns
Return 0 if ok, else -1

Definition at line 190 of file max77686.c.

References BBAT_BBCHOSTEN_MASK, BBAT_BBCVS_MASK, BIOS_DEBUG, MAX77686_I2C_ADDR, max77686_i2c_read(), max77686_i2c_write(), printk, REG_BBAT, and val.

Referenced by setup_power().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ max77686_enable_32khz_cp()

int max77686_enable_32khz_cp ( unsigned int  bus)

This function enables the 32KHz coprocessor clock.

Parameters
busi2c bus

Return 0 if ok, else -1

Definition at line 185 of file max77686.c.

References max77686_enablereg(), PMIC_EN32KHZ_CP, and REG_ENABLE.

Referenced by setup_power().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ max77686_enablereg()

static int max77686_enablereg ( unsigned int  bus,
enum max77686_regnum  reg,
int  enable 
)
static

◆ max77686_i2c_read()

static int max77686_i2c_read ( unsigned int  bus,
unsigned char  chip_addr,
unsigned int  reg,
unsigned char *  val 
)
inlinestatic

Definition at line 86 of file max77686.c.

References i2c_readb(), and val.

Referenced by max77686_disable_backup_batt(), max77686_enablereg(), and max77686_volsetting().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ max77686_i2c_write()

static int max77686_i2c_write ( unsigned int  bus,
unsigned char  chip_addr,
unsigned int  reg,
unsigned char  val 
)
inlinestatic

Definition at line 72 of file max77686.c.

References i2c_writeb(), and val.

Referenced by max77686_disable_backup_batt(), max77686_enablereg(), and max77686_volsetting().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ max77686_volsetting()

int max77686_volsetting ( unsigned int  bus,
enum max77686_regnum  reg,
unsigned int  volt,
int  enable,
int  volt_units 
)

Set the required voltage level of pmic.

Parameters
busi2c bus
regregister number of buck/ldo to be set
voltvoltage level to be set
enableenable or disable bit
volt_unitsMAX77686_MV or MAX77686_UV, unit of the voltage parameters
Returns
Return 0 if ok, else -1

Definition at line 136 of file max77686.c.

References BIOS_DEBUG, clrsetbits8, max77686_enablereg(), MAX77686_I2C_ADDR, max77686_i2c_read(), max77686_i2c_write(), max77686_param, MAX77686_UV, printk, max77686_para::vol_addr, max77686_para::vol_bitmask, max77686_para::vol_bitpos, max77686_para::vol_div, and max77686_para::vol_min.

Referenced by setup_power().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ max77686_param

struct max77686_para max77686_param[]

Definition at line 1 of file max77686.c.

Referenced by max77686_enablereg(), and max77686_volsetting().