rtc-efi.c (2c55d703391acf7e9101da596d0c15ee03b318a3) | rtc-efi.c (101ca8d05913b7d1e6e8b9dd792193d4082fff86) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * rtc-efi: RTC Class Driver for EFI-based systems 4 * 5 * Copyright (C) 2009 Hewlett-Packard Development Company, L.P. 6 * 7 * Author: dann frazier <dannf@dannf.org> 8 * Based on efirtc.c by Stephane Eranian --- 174 unchanged lines hidden (view full) --- 183 184 status = efi.set_time(&eft); 185 186 return status == EFI_SUCCESS ? 0 : -EINVAL; 187} 188 189static int efi_procfs(struct device *dev, struct seq_file *seq) 190{ | 1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * rtc-efi: RTC Class Driver for EFI-based systems 4 * 5 * Copyright (C) 2009 Hewlett-Packard Development Company, L.P. 6 * 7 * Author: dann frazier <dannf@dannf.org> 8 * Based on efirtc.c by Stephane Eranian --- 174 unchanged lines hidden (view full) --- 183 184 status = efi.set_time(&eft); 185 186 return status == EFI_SUCCESS ? 0 : -EINVAL; 187} 188 189static int efi_procfs(struct device *dev, struct seq_file *seq) 190{ |
191 efi_time_t eft, alm; 192 efi_time_cap_t cap; 193 efi_bool_t enabled, pending; | 191 efi_time_t eft, alm; 192 efi_time_cap_t cap; 193 efi_bool_t enabled, pending; 194 struct rtc_device *rtc = dev_get_drvdata(dev); |
194 195 memset(&eft, 0, sizeof(eft)); 196 memset(&alm, 0, sizeof(alm)); 197 memset(&cap, 0, sizeof(cap)); 198 199 efi.get_time(&eft, &cap); 200 efi.get_wakeup_time(&enabled, &pending, &alm); 201 --- 6 unchanged lines hidden (view full) --- 208 eft.daylight); 209 210 if (eft.timezone == EFI_UNSPECIFIED_TIMEZONE) 211 seq_puts(seq, "Timezone\t: unspecified\n"); 212 else 213 /* XXX fixme: convert to string? */ 214 seq_printf(seq, "Timezone\t: %u\n", eft.timezone); 215 | 195 196 memset(&eft, 0, sizeof(eft)); 197 memset(&alm, 0, sizeof(alm)); 198 memset(&cap, 0, sizeof(cap)); 199 200 efi.get_time(&eft, &cap); 201 efi.get_wakeup_time(&enabled, &pending, &alm); 202 --- 6 unchanged lines hidden (view full) --- 209 eft.daylight); 210 211 if (eft.timezone == EFI_UNSPECIFIED_TIMEZONE) 212 seq_puts(seq, "Timezone\t: unspecified\n"); 213 else 214 /* XXX fixme: convert to string? */ 215 seq_printf(seq, "Timezone\t: %u\n", eft.timezone); 216 |
216 seq_printf(seq, 217 "Alarm Time\t: %u:%u:%u.%09u\n" 218 "Alarm Date\t: %u-%u-%u\n" 219 "Alarm Daylight\t: %u\n" 220 "Enabled\t\t: %s\n" 221 "Pending\t\t: %s\n", 222 alm.hour, alm.minute, alm.second, alm.nanosecond, 223 alm.year, alm.month, alm.day, 224 alm.daylight, 225 enabled == 1 ? "yes" : "no", 226 pending == 1 ? "yes" : "no"); | 217 if (test_bit(RTC_FEATURE_ALARM, rtc->features)) { 218 seq_printf(seq, 219 "Alarm Time\t: %u:%u:%u.%09u\n" 220 "Alarm Date\t: %u-%u-%u\n" 221 "Alarm Daylight\t: %u\n" 222 "Enabled\t\t: %s\n" 223 "Pending\t\t: %s\n", 224 alm.hour, alm.minute, alm.second, alm.nanosecond, 225 alm.year, alm.month, alm.day, 226 alm.daylight, 227 enabled == 1 ? "yes" : "no", 228 pending == 1 ? "yes" : "no"); |
227 | 229 |
228 if (eft.timezone == EFI_UNSPECIFIED_TIMEZONE) 229 seq_puts(seq, "Timezone\t: unspecified\n"); 230 else 231 /* XXX fixme: convert to string? */ 232 seq_printf(seq, "Timezone\t: %u\n", alm.timezone); | 230 if (eft.timezone == EFI_UNSPECIFIED_TIMEZONE) 231 seq_puts(seq, "Timezone\t: unspecified\n"); 232 else 233 /* XXX fixme: convert to string? */ 234 seq_printf(seq, "Timezone\t: %u\n", alm.timezone); 235 } |
233 234 /* 235 * now prints the capabilities 236 */ 237 seq_printf(seq, 238 "Resolution\t: %u\n" 239 "Accuracy\t: %u\n" 240 "SetstoZero\t: %u\n", --- 23 unchanged lines hidden (view full) --- 264 rtc = devm_rtc_allocate_device(&dev->dev); 265 if (IS_ERR(rtc)) 266 return PTR_ERR(rtc); 267 268 platform_set_drvdata(dev, rtc); 269 270 rtc->ops = &efi_rtc_ops; 271 clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, rtc->features); | 236 237 /* 238 * now prints the capabilities 239 */ 240 seq_printf(seq, 241 "Resolution\t: %u\n" 242 "Accuracy\t: %u\n" 243 "SetstoZero\t: %u\n", --- 23 unchanged lines hidden (view full) --- 267 rtc = devm_rtc_allocate_device(&dev->dev); 268 if (IS_ERR(rtc)) 269 return PTR_ERR(rtc); 270 271 platform_set_drvdata(dev, rtc); 272 273 rtc->ops = &efi_rtc_ops; 274 clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, rtc->features); |
272 set_bit(RTC_FEATURE_ALARM_WAKEUP_ONLY, rtc->features); | 275 if (efi_rt_services_supported(EFI_RT_SUPPORTED_WAKEUP_SERVICES)) 276 set_bit(RTC_FEATURE_ALARM_WAKEUP_ONLY, rtc->features); 277 else 278 clear_bit(RTC_FEATURE_ALARM, rtc->features); |
273 274 device_init_wakeup(&dev->dev, true); 275 276 return devm_rtc_register_device(rtc); 277} 278 279static struct platform_driver efi_rtc_driver = { 280 .driver = { 281 .name = "rtc-efi", 282 }, 283}; 284 285module_platform_driver_probe(efi_rtc_driver, efi_rtc_probe); 286 287MODULE_AUTHOR("dann frazier <dannf@dannf.org>"); 288MODULE_LICENSE("GPL"); 289MODULE_DESCRIPTION("EFI RTC driver"); 290MODULE_ALIAS("platform:rtc-efi"); | 279 280 device_init_wakeup(&dev->dev, true); 281 282 return devm_rtc_register_device(rtc); 283} 284 285static struct platform_driver efi_rtc_driver = { 286 .driver = { 287 .name = "rtc-efi", 288 }, 289}; 290 291module_platform_driver_probe(efi_rtc_driver, efi_rtc_probe); 292 293MODULE_AUTHOR("dann frazier <dannf@dannf.org>"); 294MODULE_LICENSE("GPL"); 295MODULE_DESCRIPTION("EFI RTC driver"); 296MODULE_ALIAS("platform:rtc-efi"); |