![]() |
coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
|
#include <delay.h>
#include <types.h>
#include <console/console.h>
#include <device/i2c_simple.h>
#include "tps65090.h"
Go to the source code of this file.
Enumerations | |
enum | { REG_CG_CTRL0 = 4 , REG_CG_STATUS1 = 0xa } |
enum | { CG_CTRL0_ENC_MASK = 0x01 , MAX_FET_NUM = 7 , MAX_CTRL_READ_TRIES = 5 , FET_CTRL_TOFET = 1 << 7 , FET_CTRL_PGFET = 1 << 4 , FET_CTRL_WAIT = 3 << 2 , FET_CTRL_ADENFET = 1 << 1 , FET_CTRL_ENFET = 1 << 0 } |
Functions | |
static int | tps65090_i2c_write (unsigned int bus, unsigned int reg_addr, unsigned char value) |
static int | tps65090_i2c_read (unsigned int bus, unsigned int reg_addr, unsigned char *value) |
static int | tps65090_fet_set (unsigned int bus, enum fet_id fet_id, int set) |
Set the power state for a FET. More... | |
int | tps65090_fet_enable (unsigned int bus, enum fet_id fet_id) |
Enable FET. More... | |
int | tps65090_fet_disable (unsigned int bus, enum fet_id fet_id) |
Disable FET. More... | |
int | tps65090_fet_is_enabled (unsigned int bus, enum fet_id fet_id) |
Is FET enabled? More... | |
int | tps65090_is_charging (unsigned int bus) |
Check whether we have enabled battery charging. More... | |
int | tps65090_set_charge_enable (unsigned int bus, int enable) |
Enable / disable the battery charger. More... | |
int | tps65090_get_status (unsigned int bus) |
Return the value of the status register. More... | |
anonymous enum |
Enumerator | |
---|---|
CG_CTRL0_ENC_MASK | |
MAX_FET_NUM | |
MAX_CTRL_READ_TRIES | |
FET_CTRL_TOFET | |
FET_CTRL_PGFET | |
FET_CTRL_WAIT | |
FET_CTRL_ADENFET | |
FET_CTRL_ENFET |
Definition at line 15 of file tps65090.c.
anonymous enum |
Enumerator | |
---|---|
REG_CG_CTRL0 | |
REG_CG_STATUS1 |
Definition at line 10 of file tps65090.c.
Disable FET.
bus | I2C bus number the TPS65090 is on |
fet_id | FET ID, value between 1 and 7 |
Definition at line 129 of file tps65090.c.
References tps65090_fet_set().
Enable FET.
bus | I2C bus number the TPS65090 is on |
fet_id | FET ID, value between 1 and 7 return 0 on success, non-0 on failure |
Definition at line 95 of file tps65090.c.
References BIOS_DEBUG, FET_ERR_NOT_READY, printk, tps65090_fet_set(), and udelay().
Referenced by backlight_vdd(), lcd_vdd(), and sdmmc_vdd().
Is FET enabled?
bus | I2C bus number the TPS65090 is on |
fet_id | FET ID, value between 1 and 7 |
Definition at line 134 of file tps65090.c.
References BIOS_DEBUG, FET_CTRL_ENFET, printk, and tps65090_i2c_read().
Set the power state for a FET.
bus | |
fet_id | Fet number to set (1..MAX_FET_NUM) |
set | 1 to power on FET, 0 to power off |
Definition at line 63 of file tps65090.c.
References BIOS_DEBUG, FET_CTRL_ADENFET, FET_CTRL_ENFET, FET_CTRL_PGFET, FET_CTRL_TOFET, FET_CTRL_WAIT, FET_ERR_COMMS, FET_ERR_NOT_READY, MAX_CTRL_READ_TRIES, printk, retry, tps65090_i2c_read(), tps65090_i2c_write(), udelay(), and value.
Referenced by tps65090_fet_disable(), and tps65090_fet_enable().
int tps65090_get_status | ( | unsigned int | bus | ) |
Return the value of the status register.
bus | I2C bus number the TPS65090 is on |
Definition at line 179 of file tps65090.c.
References REG_CG_STATUS1, tps65090_i2c_read(), and val.
|
static |
Definition at line 40 of file tps65090.c.
References BIOS_DEBUG, i2c_readb(), printk, TPS65090_I2C_ADDR, and value.
Referenced by tps65090_fet_is_enabled(), tps65090_fet_set(), tps65090_get_status(), tps65090_is_charging(), and tps65090_set_charge_enable().
|
static |
Definition at line 29 of file tps65090.c.
References BIOS_DEBUG, i2c_writeb(), printk, TPS65090_I2C_ADDR, and value.
Referenced by tps65090_fet_set(), and tps65090_set_charge_enable().
int tps65090_is_charging | ( | unsigned int | bus | ) |
Check whether we have enabled battery charging.
bus | I2C bus number the TPS65090 is on |
Definition at line 148 of file tps65090.c.
References CG_CTRL0_ENC_MASK, REG_CG_CTRL0, tps65090_i2c_read(), and val.
int tps65090_set_charge_enable | ( | unsigned int | bus, |
int | enable | ||
) |
Enable / disable the battery charger.
bus | I2C bus number the TPS65090 is on |
enable | 0 to disable charging, non-zero to enable |
Definition at line 159 of file tps65090.c.
References BIOS_DEBUG, CG_CTRL0_ENC_MASK, printk, REG_CG_CTRL0, tps65090_i2c_read(), tps65090_i2c_write(), and val.