diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-16 19:40:27 +0100 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-16 19:40:27 +0100 |
commit | d5efccd5b6843c504042735c1e20d9252daefd98 (patch) | |
tree | 87994943963bf2f34b3f1fa982d909fd82f56746 /drivers/rtc/rtc-r9701.c | |
parent | 516541a00c6a6bced133158f0146b602a18dcbe5 (diff) | |
parent | e816b57a337ea3b755de72bec38c10c864f23015 (diff) |
ASoC: Merge tag 'v3.4-rc3' into for-3.5
Linux 3.4-rc3 contains a bunch of Tegra changes which are conflicting
annoyingly with the new development that's going on for Tegra so merge
it up to resolve those conflicts.
Conflicts:
sound/soc/soc-core.c
sound/soc/tegra/tegra_i2s.c
sound/soc/tegra/tegra_spdif.c
Diffstat (limited to 'drivers/rtc/rtc-r9701.c')
-rw-r--r-- | drivers/rtc/rtc-r9701.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-r9701.c b/drivers/rtc/rtc-r9701.c index 7f8e6c24793..33b6ba0afa0 100644 --- a/drivers/rtc/rtc-r9701.c +++ b/drivers/rtc/rtc-r9701.c @@ -122,6 +122,7 @@ static const struct rtc_class_ops r9701_rtc_ops = { static int __devinit r9701_probe(struct spi_device *spi) { struct rtc_device *rtc; + struct rtc_time dt; unsigned char tmp; int res; @@ -132,6 +133,27 @@ static int __devinit r9701_probe(struct spi_device *spi) return -ENODEV; } + /* + * The device seems to be present. Now check if the registers + * contain invalid values. If so, try to write a default date: + * 2000/1/1 00:00:00 + */ + r9701_get_datetime(&spi->dev, &dt); + if (rtc_valid_tm(&dt)) { + dev_info(&spi->dev, "trying to repair invalid date/time\n"); + dt.tm_sec = 0; + dt.tm_min = 0; + dt.tm_hour = 0; + dt.tm_mday = 1; + dt.tm_mon = 0; + dt.tm_year = 100; + + if (r9701_set_datetime(&spi->dev, &dt)) { + dev_err(&spi->dev, "cannot repair RTC register\n"); + return -ENODEV; + } + } + rtc = rtc_device_register("r9701", &spi->dev, &r9701_rtc_ops, THIS_MODULE); if (IS_ERR(rtc)) |