linux/drivers/rtc
Arnaud Ebalard fd71493d67 drivers/rtc/rtc-isl12057.c: add alarm support to Intersil ISL12057 RTC driver
This patch adds alarm support to Intersil ISL12057 driver.  This allows to
configure the chip to generate an interrupt when the alarm matches current
time value.  Alarm can be programmed up to one month in the future and is
accurate to the second.

The patch was developed to support two different configurations: systems
w/ and w/o RTC chip IRQ line connected to the main CPU.

The latter is the one found on current 3 kernel users of the chip for
which support was initially developed (Netgear ReadyNAS 102, 104 and 2120
NAS).  On those devices, the IRQ#2 pin of the chip is not connected to the
SoC but to a PMIC.  This allows setting an alarm, powering off the device
and have it wake up when the alarm rings.  To support that configuration
the driver does the following:

 1. it has alarm_irq_enable() function returns -ENOTTY when no IRQ
    is passed to the driver.
 2. it marks the device as a wakeup source in all cases (whether an
    IRQ is passed to the driver or not) to have 'wakealarm' sysfs
    entry created.
 3. it marks the device has not supporting UIE mode when no IRQ is
    passed to the driver (see the commmit message of c9f5c7e7a8)

This specific configuration was tested on a ReadyNAS 102 by setting an
alarm, powering off the device and see it reboot as expected when the
alarm rang.

The former configuration was tested on a Netgear ReadyNAS 102 after some
soldering of the IRQ#2 pin of the RTC chip to a MPP line of the SoC (the
one used usually handles the reset button).  The test was performed using
a modified .dts file reflecting this change (see below) and rtc-test.c
program available in Documentation/rtc.txt.  This test program ran as
expected, which validates alarm supports, including interrupt support.

As a side note, the ISL12057 remains in the list of trivial devices, i.e.
no specific DT binding being added by this patch: i2c core automatically
handles extraction of IRQ line info from .dts file.  For instance, if one
wants to reference the interrupt line for the alarm in its .dts file,
adding interrupt and interrupt-parent properties works as expected:

          isl12057: isl12057@68 {
                  compatible =3D "isil,isl12057";
                  interrupt-parent =3D <&gpio0>;
                  interrupts =3D <6 IRQ_TYPE_EDGE_FALLING>;
                  reg =3D <0x68>;
          };

FWIW, if someone is looking for a way to test alarm support on a system on
which the chip IRQ line has the ability to boot the system (e.g.  ReadyNAS
102, 104, etc):

    # echo 0 > /sys/class/rtc/rtc0/wakealarm
    # echo `date '+%s' -d '+ 1 minutes'` > /sys/class/rtc/rtc0/wakealarm
    # shutdown -h now

With the commands above, after a minute, the system comes back to life.

Signed-off-by: Arnaud Ebalard <arno@natisbad.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Peter Huewe <peter.huewe@infineon.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Thierry Reding <treding@nvidia.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-02-13 21:21:42 -08:00
..
class.c rtc: Update suspend/resume timing to use 64bit time 2014-11-21 12:00:00 -08:00
hctosys.c rtc: Remove redundant rtc_valid_tm() from rtc_hctosys() 2015-01-23 17:21:57 -08:00
interface.c rtc: Update interface.c to use y2038-safe time interfaces 2015-01-23 17:21:55 -08:00
Kconfig powerpc updates for 3.19 2014-12-11 17:48:14 -08:00
Makefile rtc/tpo: Driver to support rtc and wakeup on PowerNV platform 2014-11-17 18:04:01 +11:00
rtc-88pm80x.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-88pm860x.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-ab3100.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-ab8500.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
rtc-as3722.c drivers/rtc/rtc-as3722.c: use SIMPLE_DEV_PM_OPS macro 2014-04-03 16:21:22 -07:00
rtc-at32ap700x.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-at91rm9200.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-at91rm9200.h
rtc-at91sam9.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
rtc-au1xxx.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-bfin.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-bq32k.c drivers/rtc/rtc-bq32k.c: fix register value 2014-10-29 16:33:14 -07:00
rtc-bq4802.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-cmos.c rtc-cmos: fix wakeup from S5 without CONFIG_PM_SLEEP 2014-10-14 02:18:19 +02:00
rtc-coh901331.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-core.h
rtc-da9052.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-da9055.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-da9063.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-davinci.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-dev.c rtc: Update rtc-dev to use y2038-safe time interfaces 2015-01-23 17:21:56 -08:00
rtc-dm355evm.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-ds1216.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-ds1286.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-ds1302.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-ds1305.c rtc: fix potential race condition 2014-04-03 16:21:16 -07:00
rtc-ds1307.c rtc: ds1307: add support for mcp7940x chips 2014-12-10 17:41:15 -08:00
rtc-ds1343.c drivers/rtc/rtc-ds1343.c: add support of nvram for maxim dallas rtc ds1343 2014-08-08 15:57:19 -07:00
rtc-ds1347.c rtc: add support for maxim dallas rtc ds1347 2014-04-03 16:21:23 -07:00
rtc-ds1374.c drivers/rtc/rtc-ds1374.c: add watchdog support 2014-12-10 17:41:15 -08:00
rtc-ds1390.c rtc: rtc-ds1390: remove unnecessary OOM messages 2014-04-03 16:21:17 -07:00
rtc-ds1511.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-ds1553.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-ds1672.c rtc: fix potential race condition 2014-04-03 16:21:16 -07:00
rtc-ds1742.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-ds2404.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-ds3232.c drivers/rtc/rtc-ds3232.c: enable ds3232 to work as wakeup source 2014-04-03 16:21:22 -07:00
rtc-ds3234.c drivers/rtc/rtc-ds3234.c: remove empty function 2013-07-03 16:07:56 -07:00
rtc-efi-platform.c rtc: ia64: allow other architectures to use EFI RTC 2014-08-08 15:57:19 -07:00
rtc-efi.c * Move efivarfs from the misc filesystem section to pseudo filesystem, 2015-01-29 19:16:40 +01:00
rtc-em3027.c drivers/rtc/rtc-em3027.c: remove empty function 2013-07-03 16:07:56 -07:00
rtc-ep93xx.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-fm3130.c drivers/rtc/rtc-fm3130.c: remove empty function 2013-07-03 16:07:56 -07:00
rtc-generic.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-hid-sensor-time.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-hym8563.c drivers/rtc/rtc-hym8563.c: add optional clock-output-names property 2014-06-06 16:08:08 -07:00
rtc-imxdi.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-isl1208.c drivers/rtc/rtc-isl1208.c: use devm_* APIs 2013-11-13 12:09:27 +09:00
rtc-isl12022.c rtc: make of_device_ids const 2014-10-14 02:18:17 +02:00
rtc-isl12057.c drivers/rtc/rtc-isl12057.c: add alarm support to Intersil ISL12057 RTC driver 2015-02-13 21:21:42 -08:00
rtc-jz4740.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-lib.c rtc/lib: Provide y2038 safe rtc_tm_to_time()/rtc_time_to_tm() replacement 2014-11-21 12:00:00 -08:00
rtc-lp8788.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-lpc32xx.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-ls1x.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-m41t80.c drivers/rtc/rtc-m41t80.c: add support for MicroCrystal rv4162 2014-06-06 16:08:07 -07:00
rtc-m41t93.c drivers/rtc/rtc-m41t93.c: remove empty function 2013-07-03 16:07:56 -07:00
rtc-m41t94.c drivers/rtc/rtc-m41t94.c: remove empty function 2013-07-03 16:07:57 -07:00
rtc-m48t35.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-m48t59.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-m48t86.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-max6900.c drivers/rtc/rtc-max6900.c: remove redundant checks 2013-11-13 12:09:27 +09:00
rtc-max6902.c drivers/rtc/rtc-max6902.c: remove empty function 2013-07-03 16:07:57 -07:00
rtc-max8907.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-max8925.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-max8997.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-max8998.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-max77686.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-max77802.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-mc13xxx.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-mcp795.c drivers/rtc: add support for Microchip MCP795 2014-06-06 16:08:08 -07:00
rtc-moxart.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-mpc5121.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-mrst.c drivers/rtc/rtc-mrst.c: remove redundant dev_set_drvdata 2013-11-13 12:09:27 +09:00
rtc-msm6242.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-mv.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-mxc.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-nuc900.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-omap.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
rtc-opal.c rtc/tpo: Driver to support rtc and wakeup on PowerNV platform 2014-11-17 18:04:01 +11:00
rtc-palmas.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-pcap.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-pcf2123.c drivers/rtc/rtc-pcf2123.c: add support for devicetree 2015-02-13 21:21:42 -08:00
rtc-pcf2127.c drivers/rtc/rtc-pcf2127.c: replace IS_ERR and PTR_ERR with PTR_ERR_OR_ZERO 2014-01-23 16:37:00 -08:00
rtc-pcf8523.c drivers/rtc/rtc-pcf8523.c: fix month definition 2014-05-06 13:04:58 -07:00
rtc-pcf8563.c rtc: pcf8563: clear expired alarm at boot time 2014-12-10 17:41:15 -08:00
rtc-pcf8583.c rtc: use c99 initializers in structures 2014-10-14 02:18:17 +02:00
rtc-pcf50633.c
rtc-pcf85063.c rtc: add pcf85063 support 2014-08-08 15:57:20 -07:00
rtc-pl030.c drivers/rtc/rtc-pl030.c: use devm_kzalloc() instead of kmalloc() 2013-11-13 12:09:31 +09:00
rtc-pl031.c drivers/rtc/rtc-pl03x.c: remove unnecessary amba_set_drvdata() 2013-11-13 12:09:31 +09:00
rtc-pm8xxx.c Merge branch 'platform/remove_owner' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux into driver-core-next 2014-11-03 19:53:56 -08:00
rtc-proc.c
rtc-ps3.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-puv3.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-pxa.c drivers/rtc/rtc-pxa.c: make of_device_id array const 2014-06-06 16:08:09 -07:00
rtc-r9701.c
rtc-rc5t583.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-rk808.c RTC: RK808: add RTC driver for RK808 2014-10-14 02:18:18 +02:00
rtc-rp5c01.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-rs5c313.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-rs5c348.c drivers/rtc/rtc-rs5c348.c: use dev_get_platdata() 2013-11-13 12:09:29 +09:00
rtc-rs5c372.c drivers/rtc/rtc-rs5c372.c: use %*ph to dump small buffers 2014-10-14 02:18:19 +02:00
rtc-rv3029c2.c drivers/rtc/rtc-rv3029c2.c: fix potential race condition 2014-04-03 16:21:24 -07:00
rtc-rx4581.c drivers/rtc/rtc-rx4581.c: remove empty function 2013-07-03 16:07:58 -07:00
rtc-rx8025.c rtc: rtc-rx8025: remove unnecessary OOM messages 2014-04-03 16:21:18 -07:00
rtc-rx8581.c drivers/rtc/rtc-rx8581.c: add SMBus-only adapters support 2014-01-23 16:37:00 -08:00
rtc-s3c.c Merge branch 'platform/remove_owner' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux into driver-core-next 2014-11-03 19:53:56 -08:00
rtc-s3c.h
rtc-s5m.c drivers/rtc/rtc-s5m.c: terminate s5m_rtc_id array with empty element 2015-01-26 13:37:19 -08:00
rtc-s35390a.c
rtc-sa1100.c drivers/rtc/rtc-sa1100.c: make of_device_id array const 2014-06-06 16:08:09 -07:00
rtc-sh.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-sirfsoc.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
rtc-snvs.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
rtc-spear.c rtc: rtc-spear: remove unnecessary OOM messages 2014-04-03 16:21:18 -07:00
rtc-starfire.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-stk17ta8.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-stmp3xxx.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-sun4v.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-sun6i.c rtc: sun6i: Add sun6i RTC driver 2014-09-19 12:39:19 +02:00
rtc-sunxi.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-sysfs.c rtc: convert class code to use dev_groups 2013-07-29 13:10:58 -07:00
rtc-tegra.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-test.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-tile.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-tps6586x.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-tps65910.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-tps80031.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-twl.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-tx4939.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-v3020.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-vr41xx.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-vt8500.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
rtc-wm831x.c drivers/rtc/rtc-wm831x.c: remove empty function 2013-07-03 16:07:59 -07:00
rtc-wm8350.c
rtc-x1205.c rtc: fix potential race condition 2014-04-03 16:21:16 -07:00
rtc-xgene.c rtc: drop owner assignment from platform_drivers 2014-10-20 16:21:31 +02:00
systohc.c rtc: Convert rtc_set_ntp_time() to use timespec64 2015-01-23 17:21:57 -08:00