rtc: qpnp-rtc: Sets RTC time correctly

Currently RTC driver is not setting the RTC time
correctly. RTC H/w needs to be disabled before the
writes, and then re-enabled after the writes are completed.

Change-Id: I4f66a2ea5b8ba52a5e9dcf21da7a09c36b1c9074
CRs-Fixed: 610221
Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
rtc: qpnp-rtc: Set alarm control register properly

RTC Alarm enable bit does not get conserved during
RTC probe function. This patch fixes that issue.

CRs-Fixed: 636652
Change-Id: I28203b8e301510d34d2e726c0bd25e78737f7524
Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
qpnp-rtc: clear alarm register when rtc irq is disabled

The rtc alarm register should be cleared when the rtc irq is
disabled

Change-Id: I97a8bf989ff610093240a6b308a297702da6cb89
Signed-off-by: Xiaocheng Li <lix@codeaurora.org>
kernel: alarm: setup the RTC immediately for poweroff alarm

Currently we setup the RTC for poweroff alarm when the system
performs shutdown. But if the phone is shut down unexpectedly
before that, the poweroff alarm can't work. So we can do that
immediately.

CR-fixed: 532743
Change-Id: Ib26a56fba8cd64efe94f2f07ee232482228429dc
Signed-off-by: Figo Wang <figow@codeaurora.org>
rtc: alarm: Proper handling of spinlock

In alarm_shutdown hook, taking interruptible mutex
lock in interrupt disabled context. This patch fixes
alarm_shutdown function to call rtc_read_time and
rtc_set_alarm APIs in interrupt enabled context.

Change-Id: I9392d8908c19365993dccc22504f4b6f83ae8f72
CRs-Fixed: 619657
Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
rtc: alarm: update power_on alarm setting logic

The previous power_on alarm value should be checked to avoid
cancelling the alarm by mistake.

CRs-fixed: 551966
Change-Id: I4de12265416fab41a9c591d09961c9fef0d25917
Signed-off-by: Xiaocheng Li <lix@codeaurora.org>