From 9b16c0a43b74393cc18666a7748293812c61af1f Mon Sep 17 00:00:00 2001 From: Joonyoung Shim Date: Fri, 6 Aug 2010 11:28:08 +0900 Subject: 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 Signed-off-by: Kyungmin Park Acked-by: Alessandro Zummo Signed-off-by: Samuel Ortiz --- drivers/mfd/max8998.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'drivers/mfd/max8998.c') diff --git a/drivers/mfd/max8998.c b/drivers/mfd/max8998.c index 49c140a..310fd805 100644 --- a/drivers/mfd/max8998.c +++ b/drivers/mfd/max8998.c @@ -30,10 +30,14 @@ #include #include +#define RTC_I2C_ADDR (0x0c >> 1) + static struct mfd_cell max8998_devs[] = { { .name = "max8998-pmic", - } + }, { + .name = "max8998-rtc", + }, }; 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) } EXPORT_SYMBOL(max8998_write_reg); +int max8998_bulk_write(struct i2c_client *i2c, u8 reg, int count, u8 *buf) +{ + struct max8998_dev *max8998 = i2c_get_clientdata(i2c); + int ret; + + mutex_lock(&max8998->iolock); + ret = i2c_smbus_write_i2c_block_data(i2c, reg, count, buf); + mutex_unlock(&max8998->iolock); + if (ret < 0) + return ret; + + return 0; +} +EXPORT_SYMBOL(max8998_bulk_write); + int max8998_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask) { struct max8998_dev *max8998 = i2c_get_clientdata(i2c); @@ -120,6 +139,9 @@ static int max8998_i2c_probe(struct i2c_client *i2c, } mutex_init(&max8998->iolock); + max8998->rtc = i2c_new_dummy(i2c->adapter, RTC_I2C_ADDR); + i2c_set_clientdata(max8998->rtc, max8998); + max8998_irq_init(max8998); ret = mfd_add_devices(max8998->dev, -1, -- cgit v1.1