diff options
author | Álvaro Fernández Rojas <noltari@gmail.com> | 2016-12-02 11:50:26 +0100 |
---|---|---|
committer | Álvaro Fernández Rojas <noltari@gmail.com> | 2016-12-04 12:32:04 +0100 |
commit | 011f2c26f1b62e309f2eac6a3101bfe0a3c76c7e (patch) | |
tree | be53d4f11f7625508ee3aea9889e854ab5b5f263 /target/linux/brcm2708/patches-4.4/0352-rtc-ds1307-ensure-that-any-pending-alarm-is-cleared-.patch | |
parent | 4257f6548b9480cdb436115b63d5c134c5e91303 (diff) | |
download | upstream-011f2c26f1b62e309f2eac6a3101bfe0a3c76c7e.tar.gz upstream-011f2c26f1b62e309f2eac6a3101bfe0a3c76c7e.tar.bz2 upstream-011f2c26f1b62e309f2eac6a3101bfe0a3c76c7e.zip |
brcm2708: update linux 4.4 patches to latest version
As usual these patches were extracted and rebased from the raspberry pi repo:
https://github.com/raspberrypi/linux/tree/rpi-4.4.y
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux/brcm2708/patches-4.4/0352-rtc-ds1307-ensure-that-any-pending-alarm-is-cleared-.patch')
-rw-r--r-- | target/linux/brcm2708/patches-4.4/0352-rtc-ds1307-ensure-that-any-pending-alarm-is-cleared-.patch | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/target/linux/brcm2708/patches-4.4/0352-rtc-ds1307-ensure-that-any-pending-alarm-is-cleared-.patch b/target/linux/brcm2708/patches-4.4/0352-rtc-ds1307-ensure-that-any-pending-alarm-is-cleared-.patch new file mode 100644 index 0000000000..aed0d2866c --- /dev/null +++ b/target/linux/brcm2708/patches-4.4/0352-rtc-ds1307-ensure-that-any-pending-alarm-is-cleared-.patch @@ -0,0 +1,58 @@ +From e7628e85cf049383e17688b1d4ed8e9e13980b0b Mon Sep 17 00:00:00 2001 +From: Nicolas Boullis <nboullis@debian.org> +Date: Sun, 10 Apr 2016 13:23:05 +0200 +Subject: [PATCH] rtc: ds1307: ensure that any pending alarm is cleared before + a new alarm is enabled +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If a previously-set alarm was disabled and then triggered, it may still +be pending when a new alarm is configured. + +Then, if the alarm is enabled before the pending alarm is cleared, then +an interrupt is immediately raised. + +Unfortunately, when the alarm is cleared and enabled during the same I²C +block write, the chip (at least the DS1339 I have) considers that the +alarm is enabled before it is cleared, and raises an interrupt. + +This patch ensures that the pending alarm is cleared before the alarm is +enabled. + +Signed-off-by: Nicolas Boullis <nboullis@debian.org> +Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> +--- + drivers/rtc/rtc-ds1307.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +--- a/drivers/rtc/rtc-ds1307.c ++++ b/drivers/rtc/rtc-ds1307.c +@@ -540,12 +540,8 @@ static int ds1337_set_alarm(struct devic + buf[5] = 0; + buf[6] = 0; + +- /* optionally enable ALARM1 */ ++ /* disable alarms */ + buf[7] = control & ~(DS1337_BIT_A1IE | DS1337_BIT_A2IE); +- if (t->enabled) { +- dev_dbg(dev, "alarm IRQ armed\n"); +- buf[7] |= DS1337_BIT_A1IE; /* only ALARM1 is used */ +- } + buf[8] = status & ~(DS1337_BIT_A1I | DS1337_BIT_A2I); + + ret = ds1307->write_block_data(client, +@@ -555,6 +551,13 @@ static int ds1337_set_alarm(struct devic + return ret; + } + ++ /* optionally enable ALARM1 */ ++ if (t->enabled) { ++ dev_dbg(dev, "alarm IRQ armed\n"); ++ buf[7] |= DS1337_BIT_A1IE; /* only ALARM1 is used */ ++ i2c_smbus_write_byte_data(client, DS1337_REG_CONTROL, buf[7]); ++ } ++ + return 0; + } + |