diff options
author | Haojian Zhuang <haojian.zhuang@marvell.com> | 2010-01-08 06:01:24 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-03-07 22:17:01 +0100 |
commit | 53dbab7af9ca13fa95605e9a5c31bb803dcba363 (patch) | |
tree | 652214fb5b3cee8195e253e56314b913ed78cf88 /include/linux/mfd | |
parent | bbd51b1ff1bf57b9ed7f062486a415509968d4d9 (diff) |
mfd: Support 88pm8606 in 860x driver
88PM8606 and 88PM8607 are two discrete chips used for power management.
Hardware designer can use them together or only one of them according to
requirement.
There's some logic tightly linked between these two chips. For example, USB
charger driver needs to access both chips by I2C interface.
Now share one driver to these two devices. Only one I2C client is identified
in platform init data. If another chip is also used, user should mark it in
companion_addr field of platform init data. Then driver could create another
I2C client for the companion chip.
All I2C operations are accessed by 860x-i2c driver. In order to support both
I2C client address, the read/write API is changed in below.
reg_read(client, offset)
reg_write(client, offset, data)
The benefit is that client drivers only need one kind of read/write API. I2C
and MFD driver can be shared in both 8606 and 8607.
Since API is changed, update API in 8607 regulator driver.
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'include/linux/mfd')
-rw-r--r-- | include/linux/mfd/88pm860x.h (renamed from include/linux/mfd/88pm8607.h) | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/include/linux/mfd/88pm8607.h b/include/linux/mfd/88pm860x.h index 6e4dcdca02a..5845ae47df3 100644 --- a/include/linux/mfd/88pm8607.h +++ b/include/linux/mfd/88pm860x.h @@ -1,5 +1,5 @@ /* - * Marvell 88PM8607 Interface + * Marvell 88PM860x Interface * * Copyright (C) 2009 Marvell International Ltd. * Haojian Zhuang <haojian.zhuang@marvell.com> @@ -9,8 +9,15 @@ * published by the Free Software Foundation. */ -#ifndef __LINUX_MFD_88PM8607_H -#define __LINUX_MFD_88PM8607_H +#ifndef __LINUX_MFD_88PM860X_H +#define __LINUX_MFD_88PM860X_H + +enum { + CHIP_INVALID = 0, + CHIP_PM8606, + CHIP_PM8607, + CHIP_MAX, +}; enum { PM8607_ID_BUCK1 = 0, @@ -33,8 +40,8 @@ enum { PM8607_ID_RG_MAX, }; -#define PM8607_ID (0x40) /* 8607 chip ID */ -#define PM8607_ID_MASK (0xF8) /* 8607 chip ID mask */ +#define PM8607_VERSION (0x40) /* 8607 chip ID */ +#define PM8607_VERSION_MASK (0xF0) /* 8607 chip ID mask */ /* Interrupt Registers */ #define PM8607_STATUS_1 (0x01) @@ -180,18 +187,16 @@ enum { PM8607_CHIP_B0 = 0x48, }; - -struct pm8607_chip { +struct pm860x_chip { struct device *dev; struct mutex io_lock; struct i2c_client *client; - struct i2c_device_id id; - - int (*read)(struct pm8607_chip *chip, int reg, int bytes, void *dest); - int (*write)(struct pm8607_chip *chip, int reg, int bytes, void *src); + struct i2c_client *companion; /* companion chip client */ int buck3_double; /* DVC ramp slope double */ - unsigned char chip_id; + unsigned short companion_addr; + int id; + unsigned char chip_version; }; @@ -202,22 +207,21 @@ enum { PI2C_PORT, }; -struct pm8607_platform_data { - int i2c_port; /* Controlled by GI2C or PI2C */ +struct pm860x_platform_data { + unsigned short companion_addr; /* I2C address of companion chip */ + int i2c_port; /* Controlled by GI2C or PI2C */ struct regulator_init_data *regulator[PM8607_MAX_REGULATOR]; }; -extern int pm8607_reg_read(struct pm8607_chip *, int); -extern int pm8607_reg_write(struct pm8607_chip *, int, unsigned char); -extern int pm8607_bulk_read(struct pm8607_chip *, int, int, - unsigned char *); -extern int pm8607_bulk_write(struct pm8607_chip *, int, int, - unsigned char *); -extern int pm8607_set_bits(struct pm8607_chip *, int, unsigned char, +extern int pm860x_reg_read(struct i2c_client *, int); +extern int pm860x_reg_write(struct i2c_client *, int, unsigned char); +extern int pm860x_bulk_read(struct i2c_client *, int, int, unsigned char *); +extern int pm860x_bulk_write(struct i2c_client *, int, int, unsigned char *); +extern int pm860x_set_bits(struct i2c_client *, int, unsigned char, unsigned char); -extern int pm860x_device_init(struct pm8607_chip *chip, - struct pm8607_platform_data *pdata); -extern void pm860x_device_exit(struct pm8607_chip *chip); +extern int pm860x_device_init(struct pm860x_chip *chip, + struct pm860x_platform_data *pdata); +extern void pm860x_device_exit(struct pm860x_chip *chip); #endif /* __LINUX_MFD_88PM860X_H */ |