summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJohnny Qiu <joqiu@nvidia.com>2012-02-08 17:11:22 +0800
committerRohan Somvanshi <rsomvanshi@nvidia.com>2012-02-13 22:20:57 -0800
commit476be74024b540aba482b9e7d0d4671995bc133a (patch)
tree94ddb68ff3a2eaf95bb748fe0ca441ef58921954 /drivers
parentf422f8a0f03d4bcdc4af8036010410c8429c5df2 (diff)
mfd: max77663: Add option for RTC I2C slave address
MAX77663 used on Kai has different I2C slave address from the one used on PM298. We should add option in platform data to specifiy the address. Change-Id: Iaec0a09bbd2b7a37741d8a867be203165d098a15 Signed-off-by: Johnny Qiu <joqiu@nvidia.com> Reviewed-on: http://git-master/r/83297 Reviewed-by: Rohan Somvanshi <rsomvanshi@nvidia.com> Tested-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mfd/max77663-core.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/mfd/max77663-core.c b/drivers/mfd/max77663-core.c
index 36688f016df7..aaea2e08292e 100644
--- a/drivers/mfd/max77663-core.c
+++ b/drivers/mfd/max77663-core.c
@@ -3,7 +3,7 @@
* Max77663 mfd driver (I2C bus access)
*
* Copyright 2011 Maxim Integrated Products, Inc.
- * Copyright (C) 2011 NVIDIA Corporation
+ * Copyright (C) 2011-2012 NVIDIA Corporation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -157,6 +157,8 @@ struct max77663_chip {
u8 cache_gpio_pu;
u8 cache_gpio_pd;
u8 cache_gpio_alt;
+
+ u8 rtc_i2c_addr;
};
struct max77663_chip *max77663_chip;
@@ -248,7 +250,7 @@ static inline int max77663_i2c_write(struct i2c_client *client, u8 addr,
dev_dbg(&client->dev, "i2c_write: addr=0x%02x, src=0x%02x, bytes=%u\n",
addr, *((u8 *)src), bytes);
- if (client->addr == MAX77663_RTC_I2C_ADDR) {
+ if (client->addr == max77663_chip->rtc_i2c_addr) {
/* RTC registers support sequential writing */
buf[0] = addr;
memcpy(&buf[1], src, bytes);
@@ -1291,7 +1293,12 @@ static int max77663_probe(struct i2c_client *client,
chip->i2c_power = client;
i2c_set_clientdata(client, chip);
- chip->i2c_rtc = i2c_new_dummy(client->adapter, MAX77663_RTC_I2C_ADDR);
+ if (pdata->rtc_i2c_addr)
+ chip->rtc_i2c_addr = pdata->rtc_i2c_addr;
+ else
+ chip->rtc_i2c_addr = MAX77663_RTC_I2C_ADDR;
+
+ chip->i2c_rtc = i2c_new_dummy(client->adapter, chip->rtc_i2c_addr);
i2c_set_clientdata(chip->i2c_rtc, chip);
chip->dev = &client->dev;