int per_irq = platform_get_irq_byname(pdev, "PER");
int alm_irq = platform_get_irq_byname(pdev, "ALM");
int ret = 0;
+ struct rtc_time tm;
+ //printk("wm831x_rtc_probe\n");
wm831x_rtc = kzalloc(sizeof(*wm831x_rtc), GFP_KERNEL);
if (wm831x_rtc == NULL)
return -ENOMEM;
if (ret & WM831X_RTC_ALM_ENA)
wm831x_rtc->alarm_enabled = 1;
+ ret = wm831x_rtc_readtime(&pdev->dev, &tm);
+ if (ret < 0 || tm.tm_year < 111) {
+ if (ret)
+ dev_err(&pdev->dev, "Failed to read RTC time\n");
+ else
+ dev_err(&pdev->dev, "Invalid RTC date/time %4d-%02d-%02d(%d) %02d:%02d:%02d\n",
+ 1900 + tm.tm_year, tm.tm_mon + 1, tm.tm_mday, tm.tm_wday,
+ tm.tm_hour, tm.tm_min, tm.tm_sec);
+ wm831x_rtc_set_mmss(&pdev->dev, 1293883200); // 2011-01-01 12:00:00
+ }
+
device_init_wakeup(&pdev->dev, 1);
wm831x_rtc->rtc = rtc_device_register("wm831x", &pdev->dev,