diff options
| author | Steven Whitehouse <swhiteho@redhat.com> | 2006-10-02 08:45:08 -0400 |
|---|---|---|
| committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-10-02 08:45:08 -0400 |
| commit | 59458f40e25915a355d8b1d701425fe9f4f9ea23 (patch) | |
| tree | f1c9a2934df686e36d75f759ab7313b6f0e0e5f9 /drivers/rtc/rtc-rs5c348.c | |
| parent | 825f9075d74028d11d7f5932f04e1b5db3022b51 (diff) | |
| parent | d834c16516d1ebec4766fc58c059bf01311e6045 (diff) | |
Merge branch 'master' into gfs2
Diffstat (limited to 'drivers/rtc/rtc-rs5c348.c')
| -rw-r--r-- | drivers/rtc/rtc-rs5c348.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-rs5c348.c b/drivers/rtc/rtc-rs5c348.c index 0964d1dba925..f50f3fc353cd 100644 --- a/drivers/rtc/rtc-rs5c348.c +++ b/drivers/rtc/rtc-rs5c348.c | |||
| @@ -23,7 +23,7 @@ | |||
| 23 | #include <linux/workqueue.h> | 23 | #include <linux/workqueue.h> |
| 24 | #include <linux/spi/spi.h> | 24 | #include <linux/spi/spi.h> |
| 25 | 25 | ||
| 26 | #define DRV_VERSION "0.1" | 26 | #define DRV_VERSION "0.2" |
| 27 | 27 | ||
| 28 | #define RS5C348_REG_SECS 0 | 28 | #define RS5C348_REG_SECS 0 |
| 29 | #define RS5C348_REG_MINS 1 | 29 | #define RS5C348_REG_MINS 1 |
| @@ -140,7 +140,7 @@ rs5c348_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
| 140 | return 0; | 140 | return 0; |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | static struct rtc_class_ops rs5c348_rtc_ops = { | 143 | static const struct rtc_class_ops rs5c348_rtc_ops = { |
| 144 | .read_time = rs5c348_rtc_read_time, | 144 | .read_time = rs5c348_rtc_read_time, |
| 145 | .set_time = rs5c348_rtc_set_time, | 145 | .set_time = rs5c348_rtc_set_time, |
| 146 | }; | 146 | }; |
| @@ -175,8 +175,15 @@ static int __devinit rs5c348_probe(struct spi_device *spi) | |||
| 175 | goto kfree_exit; | 175 | goto kfree_exit; |
| 176 | if (ret & (RS5C348_BIT_XSTP | RS5C348_BIT_VDET)) { | 176 | if (ret & (RS5C348_BIT_XSTP | RS5C348_BIT_VDET)) { |
| 177 | u8 buf[2]; | 177 | u8 buf[2]; |
| 178 | struct rtc_time tm; | ||
| 178 | if (ret & RS5C348_BIT_VDET) | 179 | if (ret & RS5C348_BIT_VDET) |
| 179 | dev_warn(&spi->dev, "voltage-low detected.\n"); | 180 | dev_warn(&spi->dev, "voltage-low detected.\n"); |
| 181 | if (ret & RS5C348_BIT_XSTP) | ||
| 182 | dev_warn(&spi->dev, "oscillator-stop detected.\n"); | ||
| 183 | rtc_time_to_tm(0, &tm); /* 1970/1/1 */ | ||
| 184 | ret = rs5c348_rtc_set_time(&spi->dev, &tm); | ||
| 185 | if (ret < 0) | ||
| 186 | goto kfree_exit; | ||
| 180 | buf[0] = RS5C348_CMD_W(RS5C348_REG_CTL2); | 187 | buf[0] = RS5C348_CMD_W(RS5C348_REG_CTL2); |
| 181 | buf[1] = 0; | 188 | buf[1] = 0; |
| 182 | ret = spi_write_then_read(spi, buf, sizeof(buf), NULL, 0); | 189 | ret = spi_write_then_read(spi, buf, sizeof(buf), NULL, 0); |
