linux-stable/drivers
Anthony Olech 7c994c08c3 drivers/rtc/rtc-da9052.c: ALARM causes interrupt storm
Setting the alarm to a time not on a minute boundary results in repeated
interrupts being generated by the DA9052/3 PMIC device until the kernel
RTC core sees that the alarm has rung.  Sometimes the number and frequency
of interrupts can cause the kernel to disable the IRQ line used by the
DA9052/3 PMIC with disasterous consequences.  This patch fixes the
problem.

Even though the DA9052/3 PMIC is capable generating periodic interrupts,
ie TICKS, the method used to distinguish RTC_AF from RTC_PF events was
flawed and can not work in conjunction with the regmap_irq kernel core.
Thus that flawed detection has also been removed by the DA9052/3 PMIC RTC
driver's irq handler, so that it no longer reports the wrong type of event
to the kernel RTC core.

The internal static functions within the DA9052/3 PMIC RTC driver have
been changed to pass the 'da9052_rtc' structure instead of the 'da9052'
because there is no backwards pointer from the 'da9052' structure.

This patch fixes the three issues described above.  The first is serious
because usiing the RTC alarm set to a non minute boundary will eventually
cause all component drivers that depend on the interrupt line to fail.
The solution adopted is to round up to alarm time to the next highest
minute.

The second bug, reporting a RTC_PF event instead of an RTC_AF event turns
out to not matter with the current implementation of the kernel RTC core
as it seems to ignore the event type.  However, should that change in the
future it is better to fix the issue now and not have 'problems waiting to
happen'

The third set of changes are to make the da9052_rtc structure available to
all the local internal functions in the driver.  This was done during
testing so that diagnostic data could be stored there.  Should the
solution to the first issue be found not acceptable, then the alternative
of using the TICKS interrupt at the fixed one second interval in order to
step to the exact second of the requested alarm requires an extra (alarm
time) piece of data to be stored.  In devices that use the alarm function
to wake up from sleep, accuracy to the second will result in the device
being awake for up to nearly a minute longer than expected.

Signed-off-by: Anthony Olech <anthony.olech.opensource@diasemi.com>
Cc: David Dajun Chen <dchen@diasemi.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-06-06 16:08:07 -07:00
..
accessibility
acpi ACPI and power management updates for 3.16-rc1 2014-06-04 08:57:16 -07:00
amba
ata
atm
auxdisplay
base cma: increase CMA_ALIGNMENT upper limit to 12 2014-06-04 16:54:08 -07:00
bcma
block Merge branch 'akpm' (patchbomb from Andrew) into next 2014-06-04 16:55:13 -07:00
bluetooth TTY/Serial driver patches for 3.16-rc1 2014-06-03 09:01:02 -07:00
bus ARM: SoC driver changes 2014-06-02 16:35:49 -07:00
cdrom
char ACPI and power management updates for 3.16-rc1 2014-06-04 08:57:16 -07:00
clk DeviceTree for 3.16: 2014-06-04 10:02:38 -07:00
clocksource Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into next 2014-06-04 15:57:20 -07:00
connector Char / misc driver patches for 3.16-rc1 2014-06-03 08:06:56 -07:00
cpufreq ACPI and power management updates for 3.16-rc1 2014-06-04 08:57:16 -07:00
cpuidle ACPI and power management updates for 3.16-rc1 2014-06-04 08:57:16 -07:00
crypto crypto/nx/nx-842: dev_set_drvdata can no longer fail 2014-05-28 13:39:51 -07:00
dca
devfreq
dio
dma ARM: SoC driver changes 2014-06-02 16:35:49 -07:00
edac PCI changes for the v3.16 merge window: 2014-06-02 12:15:19 -07:00
eisa
extcon
firewire sound updates for 3.16-rc1 2014-06-04 09:08:25 -07:00
firmware Merge branch 'arm64-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into next 2014-06-05 13:15:32 -07:00
fmc
gpio This is the bulk of GPIO changes for the v3.16 series: 2014-06-02 08:46:03 -07:00
gpu drm/exynos: call find_vma with the mmap_sem held 2014-06-04 16:54:00 -07:00
hid Merge branches 'for-3.16/i2c-hid', 'for-3.16/rmi4', 'for-3.16/sony' and 'for-3.16/thingm' into for-linus 2014-06-04 13:09:43 +02:00
hsi
hv hv: use correct order when freeing monitor_pages 2014-05-28 13:45:15 -07:00
hwmon New driver for NCT6683D 2014-06-03 11:09:43 -07:00
hwspinlock
i2c
ide
idle
iio Staging driver patches for 3.16-rc1 2014-06-03 08:34:00 -07:00
infiniband
input ARM: SoC updates for 3.16 (part 1) 2014-06-02 16:15:12 -07:00
iommu Merge branch 'akpm' (patchbomb from Andrew) into next 2014-06-04 16:55:13 -07:00
ipack
irqchip Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into next 2014-06-04 15:59:13 -07:00
isdn
leds Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid into next 2014-06-04 08:52:36 -07:00
lguest
macintosh
mailbox
mcb mcb: Add support for shared PCI IRQs 2014-05-27 17:38:11 -07:00
md Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into next 2014-06-03 12:57:53 -07:00
media Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media into next 2014-06-04 14:24:30 -07:00
memory
memstick
message
mfd sound updates for 3.16-rc1 2014-06-04 09:08:25 -07:00
misc Merge branch 'x86-uv-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into next 2014-06-03 15:48:23 -07:00
mmc Updates for mmci driver: 2014-06-02 09:22:24 -07:00
mtd Merge branch 'for-3.16/core' of git://git.kernel.dk/linux-block into next 2014-06-02 09:29:34 -07:00
net Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into next 2014-06-04 15:59:13 -07:00
nfc
ntb
nubus kernel/printk: use symbolic defines for console loglevels 2014-06-04 16:54:17 -07:00
of Microblaze patches for 3.16-rc1 2014-06-05 16:15:33 -07:00
oprofile
parisc
parport parport: Add support for the WCH353 1S/1P multi-IO card 2014-05-28 12:30:48 -07:00
pci Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into next 2014-06-04 15:59:13 -07:00
pcmcia pcmcia: Use pci_is_bridge() to simplify code 2014-05-27 14:58:24 -06:00
phy
pinctrl This is the bulk of pin control changes for the v3.16 2014-06-03 11:20:32 -07:00
platform ACPI and power management updates for 3.16-rc1 2014-06-04 08:57:16 -07:00
pnp Merge branches 'pnp', 'powercap', 'pm-runtime' and 'pm-opp' 2014-06-03 23:13:00 +02:00
power ACPI and power management updates for 3.16-rc1 2014-06-04 08:57:16 -07:00
powercap
pps
ps3
ptp
pwm
rapidio
regulator regulator: Updates for v3.16 2014-06-03 11:44:48 -07:00
remoteproc
reset ARM: SoC driver changes 2014-06-02 16:35:49 -07:00
rpmsg
rtc drivers/rtc/rtc-da9052.c: ALARM causes interrupt storm 2014-06-06 16:08:07 -07:00
s390 At over 200 commits, covering almost all supported architectures, this 2014-06-04 08:47:12 -07:00
sbus
scsi Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial into next 2014-06-04 08:50:34 -07:00
sfi
sh Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into next 2014-06-04 15:59:13 -07:00
sn
soc soc: qcom: fix of_device_id table 2014-05-26 21:27:09 +02:00
spi Merge remote-tracking branch 'spi/topic/workqueue' into spi-next 2014-06-02 17:08:43 +01:00
spmi
ssb
staging Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media into next 2014-06-04 14:24:30 -07:00
target Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into next 2014-06-03 12:57:53 -07:00
tc
thermal
tty Merge branch 'akpm' (patchbomb from Andrew) into next 2014-06-04 16:55:13 -07:00
uio uio: fix vma io range check in mmap 2014-05-27 14:11:06 -07:00
usb Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into next 2014-06-04 15:59:13 -07:00
uwb uwb: fix variable set but not used warnings 2014-05-27 15:18:48 -07:00
vfio driver core: dev_set_drvdata can no longer fail 2014-05-27 13:40:51 -07:00
vhost
video fbdev changes for 3.16 (omap) 2014-06-04 09:07:08 -07:00
virt
virtio
vlynq
vme
w1 Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into next 2014-06-03 12:57:53 -07:00
watchdog
xen Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into next 2014-06-04 15:59:13 -07:00
zorro
Kconfig
Makefile Char / misc driver patches for 3.16-rc1 2014-06-03 08:06:56 -07:00