8 #include <linux/export.h>
23 volatile unsigned long cmos_lock;
28 #define CMOS_YEARS_OFFS 2000
45 int real_seconds, real_minutes, cmos_minutes;
46 unsigned char save_control, save_freq_select;
62 cmos_minutes =
bcd2bin(cmos_minutes);
70 real_seconds = nowtime % 60;
71 real_minutes = nowtime / 60;
73 if (((
abs(real_minutes - cmos_minutes) + 15)/30) & 1)
77 if (
abs(real_minutes - cmos_minutes) < 30) {
79 real_seconds =
bin2bcd(real_seconds);
80 real_minutes =
bin2bcd(real_minutes);
86 "set_rtc_mmss: can't update from %d to %d\n",
87 cmos_minutes, real_minutes);
101 spin_unlock_irqrestore(&
rtc_lock, flags);
138 spin_unlock_irqrestore(&
rtc_lock, flags);
151 year += century * 100;
156 return mktime(year, mon, day, hour, min, sec);
200 return __native_read_tsc();
205 static struct resource rtc_resources[] = {
221 .resource = rtc_resources,
225 static __init int add_rtc_cmos(
void)
228 static const char *
const const ids[]
__initconst =
229 {
"PNP0b00",
"PNP0b01",
"PNP0b02", };
235 for (
id = dev->
id;
id;
id = id->
next) {
243 if (of_have_populated_dt())
252 "registered platform RTC device (no PNP device found)\n");