diff options
Diffstat (limited to 'drivers/rtc')
| -rw-r--r-- | drivers/rtc/rtc-coh901331.c | 11 | ||||
| -rw-r--r-- | drivers/rtc/rtc-pcf50633.c | 7 | ||||
| -rw-r--r-- | drivers/rtc/rtc-v3020.c | 2 | ||||
| -rw-r--r-- | drivers/rtc/rtc-vr41xx.c | 9 |
4 files changed, 20 insertions, 9 deletions
diff --git a/drivers/rtc/rtc-coh901331.c b/drivers/rtc/rtc-coh901331.c index 7fe1fa26c52c..03ea530981d1 100644 --- a/drivers/rtc/rtc-coh901331.c +++ b/drivers/rtc/rtc-coh901331.c | |||
| @@ -58,7 +58,16 @@ static irqreturn_t coh901331_interrupt(int irq, void *data) | |||
| 58 | clk_enable(rtap->clk); | 58 | clk_enable(rtap->clk); |
| 59 | /* Ack IRQ */ | 59 | /* Ack IRQ */ |
| 60 | writel(1, rtap->virtbase + COH901331_IRQ_EVENT); | 60 | writel(1, rtap->virtbase + COH901331_IRQ_EVENT); |
| 61 | /* | ||
| 62 | * Disable the interrupt. This is necessary because | ||
| 63 | * the RTC lives on a lower-clocked line and will | ||
| 64 | * not release the IRQ line until after a few (slower) | ||
| 65 | * clock cycles. The interrupt will be re-enabled when | ||
| 66 | * a new alarm is set anyway. | ||
| 67 | */ | ||
| 68 | writel(0, rtap->virtbase + COH901331_IRQ_MASK); | ||
| 61 | clk_disable(rtap->clk); | 69 | clk_disable(rtap->clk); |
| 70 | |||
| 62 | /* Set alarm flag */ | 71 | /* Set alarm flag */ |
| 63 | rtc_update_irq(rtap->rtc, 1, RTC_AF); | 72 | rtc_update_irq(rtap->rtc, 1, RTC_AF); |
| 64 | 73 | ||
| @@ -128,6 +137,8 @@ static int coh901331_alarm_irq_enable(struct device *dev, unsigned int enabled) | |||
| 128 | else | 137 | else |
| 129 | writel(0, rtap->virtbase + COH901331_IRQ_MASK); | 138 | writel(0, rtap->virtbase + COH901331_IRQ_MASK); |
| 130 | clk_disable(rtap->clk); | 139 | clk_disable(rtap->clk); |
| 140 | |||
| 141 | return 0; | ||
| 131 | } | 142 | } |
| 132 | 143 | ||
| 133 | static struct rtc_class_ops coh901331_ops = { | 144 | static struct rtc_class_ops coh901331_ops = { |
diff --git a/drivers/rtc/rtc-pcf50633.c b/drivers/rtc/rtc-pcf50633.c index f4dd87e29075..33a10c47260e 100644 --- a/drivers/rtc/rtc-pcf50633.c +++ b/drivers/rtc/rtc-pcf50633.c | |||
| @@ -70,7 +70,7 @@ static void pcf2rtc_time(struct rtc_time *rtc, struct pcf50633_time *pcf) | |||
| 70 | rtc->tm_hour = bcd2bin(pcf->time[PCF50633_TI_HOUR]); | 70 | rtc->tm_hour = bcd2bin(pcf->time[PCF50633_TI_HOUR]); |
| 71 | rtc->tm_wday = bcd2bin(pcf->time[PCF50633_TI_WKDAY]); | 71 | rtc->tm_wday = bcd2bin(pcf->time[PCF50633_TI_WKDAY]); |
| 72 | rtc->tm_mday = bcd2bin(pcf->time[PCF50633_TI_DAY]); | 72 | rtc->tm_mday = bcd2bin(pcf->time[PCF50633_TI_DAY]); |
| 73 | rtc->tm_mon = bcd2bin(pcf->time[PCF50633_TI_MONTH]); | 73 | rtc->tm_mon = bcd2bin(pcf->time[PCF50633_TI_MONTH]) - 1; |
| 74 | rtc->tm_year = bcd2bin(pcf->time[PCF50633_TI_YEAR]) + 100; | 74 | rtc->tm_year = bcd2bin(pcf->time[PCF50633_TI_YEAR]) + 100; |
| 75 | } | 75 | } |
| 76 | 76 | ||
| @@ -81,7 +81,7 @@ static void rtc2pcf_time(struct pcf50633_time *pcf, struct rtc_time *rtc) | |||
| 81 | pcf->time[PCF50633_TI_HOUR] = bin2bcd(rtc->tm_hour); | 81 | pcf->time[PCF50633_TI_HOUR] = bin2bcd(rtc->tm_hour); |
| 82 | pcf->time[PCF50633_TI_WKDAY] = bin2bcd(rtc->tm_wday); | 82 | pcf->time[PCF50633_TI_WKDAY] = bin2bcd(rtc->tm_wday); |
| 83 | pcf->time[PCF50633_TI_DAY] = bin2bcd(rtc->tm_mday); | 83 | pcf->time[PCF50633_TI_DAY] = bin2bcd(rtc->tm_mday); |
| 84 | pcf->time[PCF50633_TI_MONTH] = bin2bcd(rtc->tm_mon); | 84 | pcf->time[PCF50633_TI_MONTH] = bin2bcd(rtc->tm_mon + 1); |
| 85 | pcf->time[PCF50633_TI_YEAR] = bin2bcd(rtc->tm_year % 100); | 85 | pcf->time[PCF50633_TI_YEAR] = bin2bcd(rtc->tm_year % 100); |
| 86 | } | 86 | } |
| 87 | 87 | ||
| @@ -245,8 +245,9 @@ static int pcf50633_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
| 245 | ret = pcf50633_write_block(rtc->pcf, PCF50633_REG_RTCSCA, | 245 | ret = pcf50633_write_block(rtc->pcf, PCF50633_REG_RTCSCA, |
| 246 | PCF50633_TI_EXTENT, &pcf_tm.time[0]); | 246 | PCF50633_TI_EXTENT, &pcf_tm.time[0]); |
| 247 | 247 | ||
| 248 | if (!alarm_masked) | 248 | if (!alarm_masked || alrm->enabled) |
| 249 | pcf50633_irq_unmask(rtc->pcf, PCF50633_IRQ_ALARM); | 249 | pcf50633_irq_unmask(rtc->pcf, PCF50633_IRQ_ALARM); |
| 250 | rtc->alarm_enabled = alrm->enabled; | ||
| 250 | 251 | ||
| 251 | return ret; | 252 | return ret; |
| 252 | } | 253 | } |
diff --git a/drivers/rtc/rtc-v3020.c b/drivers/rtc/rtc-v3020.c index ad164056feb6..423cd5a30b10 100644 --- a/drivers/rtc/rtc-v3020.c +++ b/drivers/rtc/rtc-v3020.c | |||
| @@ -96,7 +96,7 @@ static void v3020_mmio_write_bit(struct v3020 *chip, unsigned char bit) | |||
| 96 | 96 | ||
| 97 | static unsigned char v3020_mmio_read_bit(struct v3020 *chip) | 97 | static unsigned char v3020_mmio_read_bit(struct v3020 *chip) |
| 98 | { | 98 | { |
| 99 | return readl(chip->ioaddress) & (1 << chip->leftshift); | 99 | return !!(readl(chip->ioaddress) & (1 << chip->leftshift)); |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | static struct v3020_chip_ops v3020_mmio_ops = { | 102 | static struct v3020_chip_ops v3020_mmio_ops = { |
diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c index 2c839d0d21bd..fadddac1e5a4 100644 --- a/drivers/rtc/rtc-vr41xx.c +++ b/drivers/rtc/rtc-vr41xx.c | |||
| @@ -209,19 +209,18 @@ static int vr41xx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm) | |||
| 209 | 209 | ||
| 210 | static int vr41xx_rtc_irq_set_freq(struct device *dev, int freq) | 210 | static int vr41xx_rtc_irq_set_freq(struct device *dev, int freq) |
| 211 | { | 211 | { |
| 212 | unsigned long count; | 212 | u64 count; |
| 213 | 213 | ||
| 214 | if (!is_power_of_2(freq)) | 214 | if (!is_power_of_2(freq)) |
| 215 | return -EINVAL; | 215 | return -EINVAL; |
| 216 | count = RTC_FREQUENCY; | 216 | count = RTC_FREQUENCY; |
| 217 | do_div(count, freq); | 217 | do_div(count, freq); |
| 218 | 218 | ||
| 219 | periodic_count = count; | ||
| 220 | |||
| 221 | spin_lock_irq(&rtc_lock); | 219 | spin_lock_irq(&rtc_lock); |
| 222 | 220 | ||
| 223 | rtc1_write(RTCL1LREG, count); | 221 | periodic_count = count; |
| 224 | rtc1_write(RTCL1HREG, count >> 16); | 222 | rtc1_write(RTCL1LREG, periodic_count); |
| 223 | rtc1_write(RTCL1HREG, periodic_count >> 16); | ||
| 225 | 224 | ||
| 226 | spin_unlock_irq(&rtc_lock); | 225 | spin_unlock_irq(&rtc_lock); |
| 227 | 226 | ||
