diff options
author | Ćukasz Majewski <l.majewski@samsung.com> | 2012-11-13 03:21:55 +0000 |
---|---|---|
committer | Anatolij Gustschin <agust@denx.de> | 2012-11-14 11:21:09 +0100 |
commit | c7336815078ff3745e3130aeff35991e3e98e61e (patch) | |
tree | 8ace1a85705cbd5b6484a45fefd093161a7a5b05 /include | |
parent | 452329f1d57fe7cbc54e65617e84d5bb1f93f631 (diff) |
pmic: Extend PMIC framework to support multiple instances of PMIC devices
The PMIC framework has been extended to support multiple instances of
the variety of devices responsible for power management.
This change allows supporting of e.g. fuel gauge, charger, MUIC (Micro USB
Interface Circuit).
Power related includes have been moved to ./include/power directory.
This is a first of a series of patches - in the future "pmic" will be
replaced with "power".
Two important issues:
1. The PMIC needs to be initialized just after malloc is configured
2. It uses list to hold information about available PMIC devices
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/power/max8997_pmic.h (renamed from include/max8997_pmic.h) | 15 | ||||
-rw-r--r-- | include/power/max8998_pmic.h (renamed from include/max8998_pmic.h) | 0 | ||||
-rw-r--r-- | include/power/pmic.h (renamed from include/pmic.h) | 19 |
3 files changed, 27 insertions, 7 deletions
diff --git a/include/max8997_pmic.h b/include/power/max8997_pmic.h index 17ae24ea6a0..1db7deb3beb 100644 --- a/include/max8997_pmic.h +++ b/include/power/max8997_pmic.h @@ -111,7 +111,7 @@ enum { MAX8997_REG_MBCCTRL6 = 0x55, MAX8997_REG_OTPCGHCVS = 0x56, - MAX8997_REG_SAFEOUTCTRL = 0x5a, + MAX8997_REG_SAFEOUTCTRL = 0x5a, MAX8997_REG_LBCNFG1 = 0x5e, MAX8997_REG_LBCNFG2 = 0x5f, @@ -171,9 +171,22 @@ enum { PMIC_NUM_OF_REGS = 0x9b, }; +#define ACTDISSAFEO1 (1 << 4) +#define ACTDISSAFEO2 (1 << 5) #define ENSAFEOUT1 (1 << 6) #define ENSAFEOUT2 (1 << 7) +/* Charger */ +enum {CHARGER_ENABLE, CHARGER_DISABLE}; +#define DETBAT (1 << 2) +#define MBCICHFCSET (1 << 4) +#define MBCHOSTEN (1 << 6) +#define VCHGR_FC (1 << 7) + +#define CHARGER_MIN_CURRENT 200 +#define CHARGER_MAX_CURRENT 950 +#define CHARGER_CURRENT_RESOLUTION 50 + #define MAX8997_I2C_ADDR (0xCC >> 1) #define MAX8997_RTC_ADDR (0x0C >> 1) #define MAX8997_MUIC_ADDR (0x4A >> 1) diff --git a/include/max8998_pmic.h b/include/power/max8998_pmic.h index ca21f882c29..ca21f882c29 100644 --- a/include/max8998_pmic.h +++ b/include/power/max8998_pmic.h diff --git a/include/pmic.h b/include/power/pmic.h index 1a2db051109..e9affc8dd60 100644 --- a/include/pmic.h +++ b/include/power/pmic.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Samsung Electronics + * Copyright (C) 2011-2012 Samsung Electronics * Lukasz Majewski <l.majewski@samsung.com> * * See file CREDITS for list of people who contributed to this @@ -24,6 +24,10 @@ #ifndef __CORE_PMIC_H_ #define __CORE_PMIC_H_ +#include <common.h> +#include <linux/list.h> +#include <i2c.h> + enum { PMIC_I2C, PMIC_SPI, }; enum { I2C_PMIC, I2C_NUM, }; enum { PMIC_READ, PMIC_WRITE, }; @@ -49,17 +53,20 @@ struct pmic { unsigned char bus; unsigned char interface; unsigned char sensor_byte_order; - unsigned char number_of_regs; + unsigned int number_of_regs; union hw { struct p_i2c i2c; struct p_spi spi; } hw; + + struct list_head list; }; -int pmic_init(void); -int pmic_dialog_init(void); -int check_reg(u32 reg); -struct pmic *get_pmic(void); +int pmic_init(unsigned char bus); +int pmic_dialog_init(unsigned char bus); +int check_reg(struct pmic *p, u32 reg); +struct pmic *pmic_alloc(void); +struct pmic *pmic_get(const char *s); int pmic_probe(struct pmic *p); int pmic_reg_read(struct pmic *p, u32 reg, u32 *val); int pmic_reg_write(struct pmic *p, u32 reg, u32 val); |