diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-14 19:06:58 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-14 19:06:58 -0400 |
| commit | 85082fd7cbe3173198aac0eb5e85ab1edcc6352c (patch) | |
| tree | edbc09b7945994f78668d218fa02e991c3b3b365 /drivers/rtc/rtc-sa1100.c | |
| parent | 666484f0250db2e016948d63b3ef33e202e3b8d0 (diff) | |
| parent | 53ffe3b440aa85af6fc4eda09b2d44bcdd312d4d (diff) | |
Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: (241 commits)
[ARM] 5171/1: ep93xx: fix compilation of modules using clocks
[ARM] 5133/2: at91sam9g20 defconfig file
[ARM] 5130/4: Support for the at91sam9g20
[ARM] 5160/1: IOP3XX: gpio/gpiolib support
[ARM] at91: Fix NAND FLASH timings for at91sam9x evaluation kits.
[ARM] 5084/1: zylonite: Register AC97 device
[ARM] 5085/2: PXA: Move AC97 over to the new central device declaration model
[ARM] 5120/1: pxa: correct platform driver names for PXA25x and PXA27x UDC drivers
[ARM] 5147/1: pxaficp_ir: drop pxa_gpio_mode calls, as pin setting
[ARM] 5145/1: PXA2xx: provide api to control IrDA pins state
[ARM] 5144/1: pxaficp_ir: cleanup includes
[ARM] pxa: remove pxa_set_cken()
[ARM] pxa: allow clk aliases
[ARM] Feroceon: don't disable BPU on boot
[ARM] Orion: LED support for HP mv2120
[ARM] Orion: add RD88F5181L-FXO support
[ARM] Orion: add RD88F5181L-GE support
[ARM] Orion: add Netgear WNR854T support
[ARM] s3c2410_defconfig: update for current build
[ARM] Acer n30: Minor style and indentation fixes.
...
Diffstat (limited to 'drivers/rtc/rtc-sa1100.c')
| -rw-r--r-- | drivers/rtc/rtc-sa1100.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c index 67421b0d3a7b..f47294c60148 100644 --- a/drivers/rtc/rtc-sa1100.c +++ b/drivers/rtc/rtc-sa1100.c | |||
| @@ -33,7 +33,6 @@ | |||
| 33 | 33 | ||
| 34 | #include <asm/hardware.h> | 34 | #include <asm/hardware.h> |
| 35 | #include <asm/irq.h> | 35 | #include <asm/irq.h> |
| 36 | #include <asm/rtc.h> | ||
| 37 | 36 | ||
| 38 | #ifdef CONFIG_ARCH_PXA | 37 | #ifdef CONFIG_ARCH_PXA |
| 39 | #include <asm/arch/pxa-regs.h> | 38 | #include <asm/arch/pxa-regs.h> |
| @@ -47,6 +46,42 @@ static unsigned long rtc_freq = 1024; | |||
| 47 | static struct rtc_time rtc_alarm; | 46 | static struct rtc_time rtc_alarm; |
| 48 | static DEFINE_SPINLOCK(sa1100_rtc_lock); | 47 | static DEFINE_SPINLOCK(sa1100_rtc_lock); |
| 49 | 48 | ||
| 49 | static inline int rtc_periodic_alarm(struct rtc_time *tm) | ||
| 50 | { | ||
| 51 | return (tm->tm_year == -1) || | ||
| 52 | ((unsigned)tm->tm_mon >= 12) || | ||
| 53 | ((unsigned)(tm->tm_mday - 1) >= 31) || | ||
| 54 | ((unsigned)tm->tm_hour > 23) || | ||
| 55 | ((unsigned)tm->tm_min > 59) || | ||
| 56 | ((unsigned)tm->tm_sec > 59); | ||
| 57 | } | ||
| 58 | |||
| 59 | /* | ||
| 60 | * Calculate the next alarm time given the requested alarm time mask | ||
| 61 | * and the current time. | ||
| 62 | */ | ||
| 63 | static void rtc_next_alarm_time(struct rtc_time *next, struct rtc_time *now, struct rtc_time *alrm) | ||
| 64 | { | ||
| 65 | unsigned long next_time; | ||
| 66 | unsigned long now_time; | ||
| 67 | |||
| 68 | next->tm_year = now->tm_year; | ||
| 69 | next->tm_mon = now->tm_mon; | ||
| 70 | next->tm_mday = now->tm_mday; | ||
| 71 | next->tm_hour = alrm->tm_hour; | ||
| 72 | next->tm_min = alrm->tm_min; | ||
| 73 | next->tm_sec = alrm->tm_sec; | ||
| 74 | |||
| 75 | rtc_tm_to_time(now, &now_time); | ||
| 76 | rtc_tm_to_time(next, &next_time); | ||
| 77 | |||
| 78 | if (next_time < now_time) { | ||
| 79 | /* Advance one day */ | ||
| 80 | next_time += 60 * 60 * 24; | ||
| 81 | rtc_time_to_tm(next_time, next); | ||
| 82 | } | ||
| 83 | } | ||
| 84 | |||
| 50 | static int rtc_update_alarm(struct rtc_time *alrm) | 85 | static int rtc_update_alarm(struct rtc_time *alrm) |
| 51 | { | 86 | { |
| 52 | struct rtc_time alarm_tm, now_tm; | 87 | struct rtc_time alarm_tm, now_tm; |
