aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mfd/max8998-private.h
diff options
context:
space:
mode:
authorJoonyoung Shim <jy0922.shim@samsung.com>2010-08-05 22:28:06 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2010-10-28 18:29:02 -0400
commit676e02d7a2ed9bb02994670a07df533a29a99de6 (patch)
treef429e20f654790895b44aca9193b6082da2a9669 /include/linux/mfd/max8998-private.h
parent1203a1e6424d502e9c12d29512218487af5fdd1c (diff)
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>
Diffstat (limited to 'include/linux/mfd/max8998-private.h')
-rw-r--r--include/linux/mfd/max8998-private.h30
1 files changed, 5 insertions, 25 deletions
diff --git a/include/linux/mfd/max8998-private.h b/include/linux/mfd/max8998-private.h
index 6dc75b3e2d33..f0a20cdc288c 100644
--- a/include/linux/mfd/max8998-private.h
+++ b/include/linux/mfd/max8998-private.h
@@ -75,38 +75,18 @@ enum {
75/** 75/**
76 * struct max8998_dev - max8998 master device for sub-drivers 76 * struct max8998_dev - max8998 master device for sub-drivers
77 * @dev: master device of the chip (can be used to access platform data) 77 * @dev: master device of the chip (can be used to access platform data)
78 * @i2c_client: i2c client private data 78 * @i2c: i2c client private data
79 * @dev_read(): chip register read function
80 * @dev_write(): chip register write function
81 * @dev_update(): chip register update function
82 * @iolock: mutex for serializing io access 79 * @iolock: mutex for serializing io access
83 */ 80 */
84 81
85struct max8998_dev { 82struct max8998_dev {
86 struct device *dev; 83 struct device *dev;
87 struct i2c_client *i2c_client; 84 struct i2c_client *i2c;
88 int (*dev_read)(struct max8998_dev *max8998, u8 reg, u8 *dest);
89 int (*dev_write)(struct max8998_dev *max8998, u8 reg, u8 val);
90 int (*dev_update)(struct max8998_dev *max8998, u8 reg, u8 val, u8 mask);
91 struct mutex iolock; 85 struct mutex iolock;
92}; 86};
93 87
94static inline int max8998_read_reg(struct max8998_dev *max8998, u8 reg, 88extern int max8998_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest);
95 u8 *value) 89extern int max8998_write_reg(struct i2c_client *i2c, u8 reg, u8 value);
96{ 90extern int max8998_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask);
97 return max8998->dev_read(max8998, reg, value);
98}
99
100static inline int max8998_write_reg(struct max8998_dev *max8998, u8 reg,
101 u8 value)
102{
103 return max8998->dev_write(max8998, reg, value);
104}
105
106static inline int max8998_update_reg(struct max8998_dev *max8998, u8 reg,
107 u8 value, u8 mask)
108{
109 return max8998->dev_update(max8998, reg, value, mask);
110}
111 91
112#endif /* __LINUX_MFD_MAX8998_PRIV_H */ 92#endif /* __LINUX_MFD_MAX8998_PRIV_H */