mfd: Use i2c_client as an argument on MAX8998 i2c routines
The MAX8998 chip have regulator and rtc features. The i2c slave address of regulator and rtc is different, so needs each i2c client on i2c operation functions. Also, this patch exports i2c operation functions instead of callback to make easy to read. Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:

committed by
Samuel Ortiz

parent
1203a1e642
commit
676e02d7a2
@@ -75,38 +75,18 @@ enum {
|
||||
/**
|
||||
* struct max8998_dev - max8998 master device for sub-drivers
|
||||
* @dev: master device of the chip (can be used to access platform data)
|
||||
* @i2c_client: i2c client private data
|
||||
* @dev_read(): chip register read function
|
||||
* @dev_write(): chip register write function
|
||||
* @dev_update(): chip register update function
|
||||
* @i2c: i2c client private data
|
||||
* @iolock: mutex for serializing io access
|
||||
*/
|
||||
|
||||
struct max8998_dev {
|
||||
struct device *dev;
|
||||
struct i2c_client *i2c_client;
|
||||
int (*dev_read)(struct max8998_dev *max8998, u8 reg, u8 *dest);
|
||||
int (*dev_write)(struct max8998_dev *max8998, u8 reg, u8 val);
|
||||
int (*dev_update)(struct max8998_dev *max8998, u8 reg, u8 val, u8 mask);
|
||||
struct i2c_client *i2c;
|
||||
struct mutex iolock;
|
||||
};
|
||||
|
||||
static inline int max8998_read_reg(struct max8998_dev *max8998, u8 reg,
|
||||
u8 *value)
|
||||
{
|
||||
return max8998->dev_read(max8998, reg, value);
|
||||
}
|
||||
|
||||
static inline int max8998_write_reg(struct max8998_dev *max8998, u8 reg,
|
||||
u8 value)
|
||||
{
|
||||
return max8998->dev_write(max8998, reg, value);
|
||||
}
|
||||
|
||||
static inline int max8998_update_reg(struct max8998_dev *max8998, u8 reg,
|
||||
u8 value, u8 mask)
|
||||
{
|
||||
return max8998->dev_update(max8998, reg, value, mask);
|
||||
}
|
||||
extern int max8998_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest);
|
||||
extern int max8998_write_reg(struct i2c_client *i2c, u8 reg, u8 value);
|
||||
extern int max8998_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask);
|
||||
|
||||
#endif /* __LINUX_MFD_MAX8998_PRIV_H */
|
||||
|
Reference in New Issue
Block a user