diff options
author | Philippe Langlais <philippe.langlais@stericsson.com> | 2011-10-14 09:29:10 +0200 |
---|---|---|
committer | Philippe Langlais <philippe.langlais@stericsson.com> | 2012-05-22 10:59:49 +0200 |
commit | 799203e20d7fd3e0ad24ec076a31669a22d30368 (patch) | |
tree | ecfa5d128af343c1ac1bb92572db5f100a1527f6 /drivers/mfd | |
parent | c2c3ab729556898b501c67e5b78a2d2b0369d528 (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')
-rw-r--r-- | drivers/mfd/ab5500-power.c | 33 |
1 files changed, 28 insertions, 5 deletions
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; |