diff options
author | Rabin Vincent <rabin.vincent@stericsson.com> | 2011-05-13 11:12:06 +0530 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@stericsson.com> | 2011-09-19 15:15:23 +0200 |
commit | d44ebc53c736d7091e36ff6b05df8cf7851cb468 (patch) | |
tree | ea46ba5073e1e2f75050a07aacfb98123081da3e /drivers/mfd | |
parent | d2d5bac34e60313163a6e0f6c03d33b8fe3d7b7c (diff) |
u5500: support RTC_CLK1/2
ST-Ericsson Linux next: -
ST-Ericsson ID: WP257121
ST-Ericsson FOSS-OUT ID: Trivial
Change-Id: I5feb1dea92e5cc5d4ce57120cfbd320fc54629af
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/22993
Reviewed-by: Bibek BASU <bibek.basu@stericsson.com>
Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
Fix to merge with 335a4a "u5500: support RTC_CLK1/2"
Diffstat (limited to 'drivers/mfd')
-rwxr-xr-x | drivers/mfd/ab5500-core.c | 15 | ||||
-rw-r--r-- | drivers/mfd/ab5500-power.c | 33 |
2 files changed, 41 insertions, 7 deletions
diff --git a/drivers/mfd/ab5500-core.c b/drivers/mfd/ab5500-core.c index d471db6c406..b50da3c5a76 100755 --- a/drivers/mfd/ab5500-core.c +++ b/drivers/mfd/ab5500-core.c @@ -529,7 +529,7 @@ static struct ab5500_i2c_banks ab5500_bank_ranges[AB5500_NUM_DEVICES] = { }, }, [AB5500_DEVID_POWER] = { - .nbanks = 1, + .nbanks = 2, .bank = (struct ab5500_i2c_ranges []) { { .bankid = AB5500_BANK_STARTUP, @@ -541,7 +541,18 @@ static struct ab5500_i2c_banks ab5500_bank_ranges[AB5500_NUM_DEVICES] = { .perm = AB5500_PERM_RW, }, }, - } + }, + { + .bankid = AB5500_BANK_VIT_IO_I2C_CLK_TST_OTP, + .nranges = 1, + .range = (struct ab5500_reg_range[]) { + { + .first = 0x01, + .last = 0x01, + .perm = AB5500_PERM_RW, + }, + }, + }, }, }, }; diff --git a/drivers/mfd/ab5500-power.c b/drivers/mfd/ab5500-power.c index 46c2ae8c321..d23960bc976 100644 --- a/drivers/mfd/ab5500-power.c +++ b/drivers/mfd/ab5500-power.c @@ -13,8 +13,29 @@ static struct device *dev; +/* STARTUP */ #define AB5500_SYSPOR_CONTROL 0x30 +/* VINT IO I2C CLOCK */ +#define AB5500_RTC_VINT 0x01 + +int ab5500_clock_rtc_enable(int num, bool enable) +{ + /* RTC_CLK{0,1,2} are bits {4,3,2}, active low */ + u8 mask = BIT(4 - num); + u8 value = enable ? 0 : mask; + + /* Don't allow RTC_CLK0 to be controlled. */ + if (num < 1 || num > 2) + return -EINVAL; + + if (!dev) + return -EAGAIN; + + return abx500_mask_and_set(dev, AB5500_BANK_VIT_IO_I2C_CLK_TST_OTP, + AB5500_RTC_VINT, mask, value); +} + static void ab5500_power_off(void) { sigset_t old; @@ -34,18 +55,20 @@ static int __devinit ab5500_power_probe(struct platform_device *pdev) { struct ab5500_platform_data *plat = dev_get_platdata(pdev->dev.parent); - if (!plat->pm_power_off) - return -ENODEV; - dev = &pdev->dev; - pm_power_off = ab5500_power_off; + + if (plat->pm_power_off) + pm_power_off = ab5500_power_off; return 0; } static int __devexit ab5500_power_remove(struct platform_device *pdev) { - pm_power_off = NULL; + struct ab5500_platform_data *plat = dev_get_platdata(pdev->dev.parent); + + if (plat->pm_power_off) + pm_power_off = NULL; dev = NULL; return 0; |