create firmware image for the Ubiquiti LS-SR71 board
[openwrt/openwrt.git] / target / linux / s3c24xx / patches-2.6.26 / 1089-add-pcf50633-06-RTC_AIE-ioctl.patch
1 From d35cdd3761e8b030937e463ccc64938104f1d773 Mon Sep 17 00:00:00 2001
2 From: Holger Hans Peter Freyther <zecke@openmoko.org>
3 Date: Fri, 25 Jul 2008 23:06:02 +0100
4 Subject: [PATCH] add-pcf50633-06-RTC_AIE-ioctl
5
6 Hey,
7
8 the legacy application 'atd' from Russ Nelson/Nils Faerber, used by Qtopia, to
9 schedule alarms currently fails to start as the the above ioctl is failing.
10 The other drivers in drivers/rtc implement the above ioctl and we can
11 implement it too.
12
13 The code to mask/unmask the RTC alarm is copied from the set_alarm routine and
14 adapted to use the reg_set_bit_mask and reg_set_clear_mask.
15
16 It is compiling, so it must work. Please welcome me the lkml way ;)
17
18
19 Signed-Off-by: Holger Hans Peter Freyther <zecke@openmoko.org>
20 ---
21 drivers/i2c/chips/pcf50606.c | 10 ++++++++++
22 drivers/i2c/chips/pcf50633.c | 10 ++++++++++
23 2 files changed, 20 insertions(+), 0 deletions(-)
24
25 diff --git a/drivers/i2c/chips/pcf50606.c b/drivers/i2c/chips/pcf50606.c
26 index aaec6e8..03805be 100644
27 --- a/drivers/i2c/chips/pcf50606.c
28 +++ b/drivers/i2c/chips/pcf50606.c
29 @@ -1191,7 +1191,17 @@ static int pcf50606_rtc_ioctl(struct device *dev, unsigned int cmd,
30 {
31 struct i2c_client *client = to_i2c_client(dev);
32 struct pcf50606_data *pcf = i2c_get_clientdata(client);
33 +
34 switch (cmd) {
35 + case RTC_AIE_OFF:
36 + /* disable the alarm interrupt */
37 + reg_set_bit_mask(pcf, PCF50606_REG_INT1M,
38 + PCF50606_INT1_ALARM, PCF50606_INT1_ALARM);
39 + return 0;
40 + case RTC_AIE_ON:
41 + /* enable the alarm interrupt */
42 + reg_clear_bits(pcf, PCF50606_REG_INT1M, PCF50606_INT1_ALARM);
43 + return 0;
44 case RTC_PIE_OFF:
45 /* disable periodic interrupt (hz tick) */
46 pcf->flags &= ~PCF50606_F_RTC_SECOND;
47 diff --git a/drivers/i2c/chips/pcf50633.c b/drivers/i2c/chips/pcf50633.c
48 index c14fad0..b5cd2cb 100644
49 --- a/drivers/i2c/chips/pcf50633.c
50 +++ b/drivers/i2c/chips/pcf50633.c
51 @@ -1297,7 +1297,17 @@ static int pcf50633_rtc_ioctl(struct device *dev, unsigned int cmd,
52 {
53 struct i2c_client *client = to_i2c_client(dev);
54 struct pcf50633_data *pcf = i2c_get_clientdata(client);
55 +
56 switch (cmd) {
57 + case RTC_AIE_OFF:
58 + /* disable the alarm interrupt */
59 + reg_set_bit_mask(pcf, PCF50633_REG_INT1M,
60 + PCF50633_INT1_ALARM, PCF50633_INT1_ALARM);
61 + return 0;
62 + case RTC_AIE_ON:
63 + /* enable the alarm interrupt */
64 + reg_clear_bits(pcf, PCF50633_REG_INT1M, PCF50633_INT1_ALARM);
65 + return 0;
66 case RTC_PIE_OFF:
67 /* disable periodic interrupt (hz tick) */
68 pcf->flags &= ~PCF50633_F_RTC_SECOND;
69 --
70 1.5.6.3
71