1 /* SPDX-License-Identifier: GPL-2.0 */ 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _ACPI_PMTMR_H_ 2 #ifndef _ACPI_PMTMR_H_ 3 #define _ACPI_PMTMR_H_ 3 #define _ACPI_PMTMR_H_ 4 4 5 #include <linux/clocksource.h> 5 #include <linux/clocksource.h> 6 6 7 /* Number of PMTMR ticks expected during calib 7 /* Number of PMTMR ticks expected during calibration run */ 8 #define PMTMR_TICKS_PER_SEC 3579545 8 #define PMTMR_TICKS_PER_SEC 3579545 9 9 10 /* limit it to 24 bits */ 10 /* limit it to 24 bits */ 11 #define ACPI_PM_MASK CLOCKSOURCE_MASK(24) 11 #define ACPI_PM_MASK CLOCKSOURCE_MASK(24) 12 12 13 /* Overrun value */ 13 /* Overrun value */ 14 #define ACPI_PM_OVRRUN (1<<24) 14 #define ACPI_PM_OVRRUN (1<<24) 15 15 16 #ifdef CONFIG_X86_PM_TIMER 16 #ifdef CONFIG_X86_PM_TIMER 17 17 18 extern u32 acpi_pm_read_verified(void); 18 extern u32 acpi_pm_read_verified(void); 19 extern u32 pmtmr_ioport; 19 extern u32 pmtmr_ioport; 20 20 21 static inline u32 acpi_pm_read_early(void) 21 static inline u32 acpi_pm_read_early(void) 22 { 22 { 23 if (!pmtmr_ioport) 23 if (!pmtmr_ioport) 24 return 0; 24 return 0; 25 /* mask the output to 24 bits */ 25 /* mask the output to 24 bits */ 26 return acpi_pm_read_verified() & ACPI_ 26 return acpi_pm_read_verified() & ACPI_PM_MASK; 27 } 27 } 28 28 29 /** 29 /** 30 * Register callback for suspend and resume ev 30 * Register callback for suspend and resume event 31 * 31 * 32 * @cb Callback triggered on suspend and resum 32 * @cb Callback triggered on suspend and resume 33 * @data Data passed with the callback 33 * @data Data passed with the callback 34 */ 34 */ 35 void acpi_pmtmr_register_suspend_resume_callba 35 void acpi_pmtmr_register_suspend_resume_callback(void (*cb)(void *data, bool suspend), void *data); 36 36 37 /** 37 /** 38 * Remove registered callback for suspend and 38 * Remove registered callback for suspend and resume event 39 */ 39 */ 40 void acpi_pmtmr_unregister_suspend_resume_call 40 void acpi_pmtmr_unregister_suspend_resume_callback(void); 41 41 42 #else 42 #else 43 43 44 static inline u32 acpi_pm_read_early(void) 44 static inline u32 acpi_pm_read_early(void) 45 { 45 { 46 return 0; 46 return 0; 47 } 47 } 48 48 49 #endif 49 #endif 50 50 51 #endif 51 #endif 52 52 53 53
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.