diff options
author | Joonyoung Shim <jy0922.shim@samsung.com> | 2010-08-05 22:28:08 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-10-28 18:29:06 -0400 |
commit | 9b16c0a43b74393cc18666a7748293812c61af1f (patch) | |
tree | f75874e30996e6d6b1dc5a975d19f7455c3e44d6 /drivers/mfd/max8998.c | |
parent | 2c7e6f5797140b33ec2b967ff28941e1c7eff4b2 (diff) |
rtc: Add MAX8998 rtc driver
This adds support for the RTC provided by the Maxim 8998 chip. This
driver was tested on a GONI board by using the rtc-test application from
the Documentation/rtc.txt.
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/max8998.c')
-rw-r--r-- | drivers/mfd/max8998.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/mfd/max8998.c b/drivers/mfd/max8998.c index 49c140a78ba9..310fd8054f35 100644 --- a/drivers/mfd/max8998.c +++ b/drivers/mfd/max8998.c | |||
@@ -30,10 +30,14 @@ | |||
30 | #include <linux/mfd/max8998.h> | 30 | #include <linux/mfd/max8998.h> |
31 | #include <linux/mfd/max8998-private.h> | 31 | #include <linux/mfd/max8998-private.h> |
32 | 32 | ||
33 | #define RTC_I2C_ADDR (0x0c >> 1) | ||
34 | |||
33 | static struct mfd_cell max8998_devs[] = { | 35 | static struct mfd_cell max8998_devs[] = { |
34 | { | 36 | { |
35 | .name = "max8998-pmic", | 37 | .name = "max8998-pmic", |
36 | } | 38 | }, { |
39 | .name = "max8998-rtc", | ||
40 | }, | ||
37 | }; | 41 | }; |
38 | 42 | ||
39 | int max8998_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest) | 43 | int max8998_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest) |
@@ -80,6 +84,21 @@ int max8998_write_reg(struct i2c_client *i2c, u8 reg, u8 value) | |||
80 | } | 84 | } |
81 | EXPORT_SYMBOL(max8998_write_reg); | 85 | EXPORT_SYMBOL(max8998_write_reg); |
82 | 86 | ||
87 | int max8998_bulk_write(struct i2c_client *i2c, u8 reg, int count, u8 *buf) | ||
88 | { | ||
89 | struct max8998_dev *max8998 = i2c_get_clientdata(i2c); | ||
90 | int ret; | ||
91 | |||
92 | mutex_lock(&max8998->iolock); | ||
93 | ret = i2c_smbus_write_i2c_block_data(i2c, reg, count, buf); | ||
94 | mutex_unlock(&max8998->iolock); | ||
95 | if (ret < 0) | ||
96 | return ret; | ||
97 | |||
98 | return 0; | ||
99 | } | ||
100 | EXPORT_SYMBOL(max8998_bulk_write); | ||
101 | |||
83 | int max8998_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask) | 102 | int max8998_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask) |
84 | { | 103 | { |
85 | struct max8998_dev *max8998 = i2c_get_clientdata(i2c); | 104 | struct max8998_dev *max8998 = i2c_get_clientdata(i2c); |
@@ -120,6 +139,9 @@ static int max8998_i2c_probe(struct i2c_client *i2c, | |||
120 | } | 139 | } |
121 | mutex_init(&max8998->iolock); | 140 | mutex_init(&max8998->iolock); |
122 | 141 | ||
142 | max8998->rtc = i2c_new_dummy(i2c->adapter, RTC_I2C_ADDR); | ||
143 | i2c_set_clientdata(max8998->rtc, max8998); | ||
144 | |||
123 | max8998_irq_init(max8998); | 145 | max8998_irq_init(max8998); |
124 | 146 | ||
125 | ret = mfd_add_devices(max8998->dev, -1, | 147 | ret = mfd_add_devices(max8998->dev, -1, |