2025cf9e193de (Thomas Gleixner 2019-05-29 07:18:02 -0700 1) /* SPDX-License-Identifier: GPL-2.0-only */
a192a9580bcc4 (Len Brown 2009-07-28 16:45:54 -0400 2) /*
a192a9580bcc4 (Len Brown 2009-07-28 16:45:54 -0400 3) * acpi/internal.h
a192a9580bcc4 (Len Brown 2009-07-28 16:45:54 -0400 4) * For use by Linux/ACPI infrastructure, not drivers
a192a9580bcc4 (Len Brown 2009-07-28 16:45:54 -0400 5) *
a192a9580bcc4 (Len Brown 2009-07-28 16:45:54 -0400 6) * Copyright (c) 2009, Intel Corporation.
a192a9580bcc4 (Len Brown 2009-07-28 16:45:54 -0400 7) */
a192a9580bcc4 (Len Brown 2009-07-28 16:45:54 -0400 8)
1195a098168fc (Thomas Renninger 2010-07-16 13:11:31 +0200 9) #ifndef _ACPI_INTERNAL_H_
1195a098168fc (Thomas Renninger 2010-07-16 13:11:31 +0200 10) #define _ACPI_INTERNAL_H_
1195a098168fc (Thomas Renninger 2010-07-16 13:11:31 +0200 11)
eb50aaf960e3b (Andy Shevchenko 2021-03-22 18:31:00 +0200 12) #include <linux/idr.h>
eb50aaf960e3b (Andy Shevchenko 2021-03-22 18:31:00 +0200 13)
a192a9580bcc4 (Len Brown 2009-07-28 16:45:54 -0400 14) #define PREFIX "ACPI: "
e60cc7a6f0259 (Bjorn Helgaas 2009-03-13 12:08:26 -0600 15)
e5f660ebef68e (Lv Zheng 2016-05-03 16:49:01 +0800 16) int early_acpi_osi_init(void);
e5f660ebef68e (Lv Zheng 2016-05-03 16:49:01 +0800 17) int acpi_osi_init(void);
1129c92faa069 (Lv Zheng 2013-07-23 16:11:55 +0800 18) acpi_status acpi_os_initialize1(void);
e747f27495150 (Bjorn Helgaas 2009-03-24 16:49:43 -0600 19) int acpi_scan_init(void);
5d32a66541c46 (Sinan Kaya 2018-12-19 22:46:56 +0000 20) #ifdef CONFIG_PCI
00c43b9682507 (Rafael J. Wysocki 2013-01-30 14:27:33 +0100 21) void acpi_pci_root_init(void);
4daeaf68379f7 (Rafael J. Wysocki 2013-01-30 14:27:37 +0100 22) void acpi_pci_link_init(void);
5d32a66541c46 (Sinan Kaya 2018-12-19 22:46:56 +0000 23) #else
5d32a66541c46 (Sinan Kaya 2018-12-19 22:46:56 +0000 24) static inline void acpi_pci_root_init(void) {}
5d32a66541c46 (Sinan Kaya 2018-12-19 22:46:56 +0000 25) static inline void acpi_pci_link_init(void) {}
5d32a66541c46 (Sinan Kaya 2018-12-19 22:46:56 +0000 26) #endif
ac212b6980d8d (Rafael J. Wysocki 2013-05-03 00:26:22 +0200 27) void acpi_processor_init(void);
141a297bd02e8 (Rafael J. Wysocki 2013-01-30 14:27:40 +0100 28) void acpi_platform_init(void);
eec15edbb0e14 (Zhang Rui 2014-05-30 04:23:01 +0200 29) void acpi_pnp_init(void);
3230bbfce8a92 (Zhang Rui 2014-03-14 00:34:05 +0800 30) void acpi_int340x_thermal_init(void);
6ce2e188a6ae3 (Graeme Gregory 2016-01-20 20:29:27 +0600 31) #ifdef CONFIG_ARM_AMBA
6ce2e188a6ae3 (Graeme Gregory 2016-01-20 20:29:27 +0600 32) void acpi_amba_init(void);
6ce2e188a6ae3 (Graeme Gregory 2016-01-20 20:29:27 +0600 33) #else
6ce2e188a6ae3 (Graeme Gregory 2016-01-20 20:29:27 +0600 34) static inline void acpi_amba_init(void) {}
6ce2e188a6ae3 (Graeme Gregory 2016-01-20 20:29:27 +0600 35) #endif
1c8fce27e275f (Zhang Rui 2010-07-15 10:46:30 +0800 36) int acpi_sysfs_init(void);
9c4aa1eecb48c (Lv Zheng 2016-12-16 12:07:57 +0800 37) void acpi_gpe_apply_masked_gpes(void);
737f1a9f80828 (Rafael J. Wysocki 2013-02-08 23:52:39 +0100 38) void acpi_container_init(void);
cccd420859a41 (Rafael J. Wysocki 2014-05-30 04:29:14 +0200 39) void acpi_memory_hotplug_init(void);
c183619b63ec9 (Jiang Liu 2015-02-05 13:44:49 +0800 40) #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC
f2ae5da726172 (Rui Wang 2017-02-28 21:34:29 +0800 41) void pci_ioapic_remove(struct acpi_pci_root *root);
c183619b63ec9 (Jiang Liu 2015-02-05 13:44:49 +0800 42) int acpi_ioapic_remove(struct acpi_pci_root *root);
c183619b63ec9 (Jiang Liu 2015-02-05 13:44:49 +0800 43) #else
f2ae5da726172 (Rui Wang 2017-02-28 21:34:29 +0800 44) static inline void pci_ioapic_remove(struct acpi_pci_root *root) { return; }
c183619b63ec9 (Jiang Liu 2015-02-05 13:44:49 +0800 45) static inline int acpi_ioapic_remove(struct acpi_pci_root *root) { return 0; }
c183619b63ec9 (Jiang Liu 2015-02-05 13:44:49 +0800 46) #endif
94add0f82469f (Jiang Liu 2013-06-23 00:59:55 +0200 47) #ifdef CONFIG_ACPI_DOCK
1e2380cd144f6 (Rafael J. Wysocki 2014-02-16 01:51:01 +0100 48) void register_dock_dependent_device(struct acpi_device *adev,
1e2380cd144f6 (Rafael J. Wysocki 2014-02-16 01:51:01 +0100 49) acpi_handle dshandle);
1e2380cd144f6 (Rafael J. Wysocki 2014-02-16 01:51:01 +0100 50) int dock_notify(struct acpi_device *adev, u32 event);
1e2380cd144f6 (Rafael J. Wysocki 2014-02-16 01:51:01 +0100 51) void acpi_dock_add(struct acpi_device *adev);
94add0f82469f (Jiang Liu 2013-06-23 00:59:55 +0200 52) #else
1e2380cd144f6 (Rafael J. Wysocki 2014-02-16 01:51:01 +0100 53) static inline void register_dock_dependent_device(struct acpi_device *adev,
1e2380cd144f6 (Rafael J. Wysocki 2014-02-16 01:51:01 +0100 54) acpi_handle dshandle) {}
1e2380cd144f6 (Rafael J. Wysocki 2014-02-16 01:51:01 +0100 55) static inline int dock_notify(struct acpi_device *adev, u32 event) { return -ENODEV; }
1e2380cd144f6 (Rafael J. Wysocki 2014-02-16 01:51:01 +0100 56) static inline void acpi_dock_add(struct acpi_device *adev) {}
94add0f82469f (Jiang Liu 2013-06-23 00:59:55 +0200 57) #endif
2fa97feb4406c (Lan Tianyu 2013-06-05 02:27:50 +0000 58) #ifdef CONFIG_X86
2fa97feb4406c (Lan Tianyu 2013-06-05 02:27:50 +0000 59) void acpi_cmos_rtc_init(void);
2fa97feb4406c (Lan Tianyu 2013-06-05 02:27:50 +0000 60) #else
2fa97feb4406c (Lan Tianyu 2013-06-05 02:27:50 +0000 61) static inline void acpi_cmos_rtc_init(void) {}
2fa97feb4406c (Lan Tianyu 2013-06-05 02:27:50 +0000 62) #endif
18d78b64fddc1 (Rafael J. Wysocki 2015-07-03 01:06:00 +0200 63) int acpi_rev_override_setup(char *str);
e747f27495150 (Bjorn Helgaas 2009-03-24 16:49:43 -0600 64)
3f8055c358364 (Rafael J. Wysocki 2013-03-03 23:08:16 +0100 65) void acpi_sysfs_add_hotplug_profile(struct acpi_hotplug_profile *hotplug,
3f8055c358364 (Rafael J. Wysocki 2013-03-03 23:08:16 +0100 66) const char *name);
3f8055c358364 (Rafael J. Wysocki 2013-03-03 23:08:16 +0100 67) int acpi_scan_add_handler_with_hotplug(struct acpi_scan_handler *handler,
3f8055c358364 (Rafael J. Wysocki 2013-03-03 23:08:16 +0100 68) const char *hotplug_profile_name);
3f8055c358364 (Rafael J. Wysocki 2013-03-03 23:08:16 +0100 69) void acpi_scan_hotplug_enabled(struct acpi_hotplug_profile *hotplug, bool val);
3f8055c358364 (Rafael J. Wysocki 2013-03-03 23:08:16 +0100 70)
a25ee9200eef0 (Zhang Rui 2010-07-15 10:46:15 +0800 71) #ifdef CONFIG_DEBUG_FS
aecad432fd68d (Thomas Renninger 2011-05-26 12:26:23 +0200 72) extern struct dentry *acpi_debugfs_dir;
10742619ac636 (Nicolas Iooss 2015-08-01 21:32:17 +0800 73) void acpi_debugfs_init(void);
a25ee9200eef0 (Zhang Rui 2010-07-15 10:46:15 +0800 74) #else
aecad432fd68d (Thomas Renninger 2011-05-26 12:26:23 +0200 75) static inline void acpi_debugfs_init(void) { return; }
a25ee9200eef0 (Zhang Rui 2010-07-15 10:46:15 +0800 76) #endif
1622745551db0 (Sinan Kaya 2019-01-05 10:05:56 +0000 77) #ifdef CONFIG_PCI
f58b082aed434 (Rafael J. Wysocki 2013-03-06 23:46:20 +0100 78) void acpi_lpss_init(void);
1622745551db0 (Sinan Kaya 2019-01-05 10:05:56 +0000 79) #else
1622745551db0 (Sinan Kaya 2019-01-05 10:05:56 +0000 80) static inline void acpi_lpss_init(void) {}
1622745551db0 (Sinan Kaya 2019-01-05 10:05:56 +0000 81) #endif
a25ee9200eef0 (Zhang Rui 2010-07-15 10:46:15 +0800 82)
92082a8886f30 (Ken Xue 2015-02-06 08:27:51 +0800 83) void acpi_apd_init(void);
92082a8886f30 (Ken Xue 2015-02-06 08:27:51 +0800 84)
1e3bcb596c6b1 (Rafael J. Wysocki 2014-03-03 00:40:38 +0100 85) acpi_status acpi_hotplug_schedule(struct acpi_device *adev, u32 src);
d783156ea3843 (Rafael J. Wysocki 2013-11-22 21:52:12 +0100 86) bool acpi_queue_hotplug_work(struct work_struct *work);
1e3bcb596c6b1 (Rafael J. Wysocki 2014-03-03 00:40:38 +0100 87) void acpi_device_hotplug(struct acpi_device *adev, u32 src);
caa73ea158de9 (Rafael J. Wysocki 2013-12-29 15:25:48 +0100 88) bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent);
d783156ea3843 (Rafael J. Wysocki 2013-11-22 21:52:12 +0100 89)
68bdb6773289f (Octavian Purdila 2016-07-08 19:13:09 +0300 90) acpi_status acpi_sysfs_table_handler(u32 event, void *table, void *context);
68bdb6773289f (Octavian Purdila 2016-07-08 19:13:09 +0300 91) void acpi_scan_table_handler(u32 event, void *table, void *context);
68bdb6773289f (Octavian Purdila 2016-07-08 19:13:09 +0300 92)
82c7d5efaadf9 (Rafael J. Wysocki 2013-01-17 14:11:05 +0100 93) /* --------------------------------------------------------------------------
82c7d5efaadf9 (Rafael J. Wysocki 2013-01-17 14:11:05 +0100 94) Device Node Initialization / Removal
82c7d5efaadf9 (Rafael J. Wysocki 2013-01-17 14:11:05 +0100 95) -------------------------------------------------------------------------- */
82c7d5efaadf9 (Rafael J. Wysocki 2013-01-17 14:11:05 +0100 96) #define ACPI_STA_DEFAULT (ACPI_STA_DEVICE_PRESENT | ACPI_STA_DEVICE_ENABLED | \
82c7d5efaadf9 (Rafael J. Wysocki 2013-01-17 14:11:05 +0100 97) ACPI_STA_DEVICE_UI | ACPI_STA_DEVICE_FUNCTIONING)
82c7d5efaadf9 (Rafael J. Wysocki 2013-01-17 14:11:05 +0100 98)
2d12b6b381ba0 (Lukas Wunner 2015-11-25 21:19:55 +0100 99) extern struct list_head acpi_bus_id_list;
2d12b6b381ba0 (Lukas Wunner 2015-11-25 21:19:55 +0100 100)
eb50aaf960e3b (Andy Shevchenko 2021-03-22 18:31:00 +0200 101) #define ACPI_MAX_DEVICE_INSTANCES 4096
eb50aaf960e3b (Andy Shevchenko 2021-03-22 18:31:00 +0200 102)
edc345d88462c (Lukas Wunner 2016-01-01 22:52:15 +0100 103) struct acpi_device_bus_id {
a58015d638cd4 (Dexuan Cui 2021-01-07 23:23:48 -0800 104) const char *bus_id;
eb50aaf960e3b (Andy Shevchenko 2021-03-22 18:31:00 +0200 105) struct ida instance_ida;
2d12b6b381ba0 (Lukas Wunner 2015-11-25 21:19:55 +0100 106) struct list_head node;
2d12b6b381ba0 (Lukas Wunner 2015-11-25 21:19:55 +0100 107) };
2d12b6b381ba0 (Lukas Wunner 2015-11-25 21:19:55 +0100 108)
cf860be639d86 (Rafael J. Wysocki 2013-01-24 12:49:49 +0100 109) int acpi_device_add(struct acpi_device *device,
cf860be639d86 (Rafael J. Wysocki 2013-01-24 12:49:49 +0100 110) void (*release)(struct device *));
82c7d5efaadf9 (Rafael J. Wysocki 2013-01-17 14:11:05 +0100 111) void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
c830dbcfccbf7 (Rafael J. Wysocki 2021-04-07 16:33:38 +0200 112) int type);
c2efefb33abfb (Rafael J. Wysocki 2015-07-17 22:53:43 +0200 113) int acpi_device_setup_files(struct acpi_device *dev);
c2efefb33abfb (Rafael J. Wysocki 2015-07-17 22:53:43 +0200 114) void acpi_device_remove_files(struct acpi_device *dev);
cf860be639d86 (Rafael J. Wysocki 2013-01-24 12:49:49 +0100 115) void acpi_device_add_finalize(struct acpi_device *device);
c0af41757f406 (Toshi Kani 2013-03-04 21:30:42 +0000 116) void acpi_free_pnp_ids(struct acpi_device_pnp *pnp);
cde1f95f407a5 (Sakari Ailus 2017-06-06 12:37:36 +0300 117) bool acpi_device_is_present(const struct acpi_device *adev);
b43109fa466e6 (Rafael J. Wysocki 2014-02-16 00:09:34 +0100 118) bool acpi_device_is_battery(struct acpi_device *adev);
712e960f0ee93 (Mika Westerberg 2015-07-27 18:03:57 +0300 119) bool acpi_device_is_first_physical_node(struct acpi_device *adev,
712e960f0ee93 (Mika Westerberg 2015-07-27 18:03:57 +0300 120) const struct device *dev);
a64a62ce9a380 (Lv Zheng 2017-09-26 16:54:09 +0800 121) int acpi_bus_register_early_device(int type);
82c7d5efaadf9 (Rafael J. Wysocki 2013-01-17 14:11:05 +0100 122)
c2efefb33abfb (Rafael J. Wysocki 2015-07-17 22:53:43 +0200 123) /* --------------------------------------------------------------------------
c2efefb33abfb (Rafael J. Wysocki 2015-07-17 22:53:43 +0200 124) Device Matching and Notification
c2efefb33abfb (Rafael J. Wysocki 2015-07-17 22:53:43 +0200 125) -------------------------------------------------------------------------- */
c2efefb33abfb (Rafael J. Wysocki 2015-07-17 22:53:43 +0200 126) struct acpi_device *acpi_companion_match(const struct device *dev);
c2efefb33abfb (Rafael J. Wysocki 2015-07-17 22:53:43 +0200 127) int __acpi_device_uevent_modalias(struct acpi_device *adev,
c2efefb33abfb (Rafael J. Wysocki 2015-07-17 22:53:43 +0200 128) struct kobj_uevent_env *env);
c2efefb33abfb (Rafael J. Wysocki 2015-07-17 22:53:43 +0200 129)
e60cc7a6f0259 (Bjorn Helgaas 2009-03-13 12:08:26 -0600 130) /* --------------------------------------------------------------------------
e60cc7a6f0259 (Bjorn Helgaas 2009-03-13 12:08:26 -0600 131) Power Resource
e60cc7a6f0259 (Bjorn Helgaas 2009-03-13 12:08:26 -0600 132) -------------------------------------------------------------------------- */
44515374cba9e (Bjorn Helgaas 2009-03-24 16:49:53 -0600 133) int acpi_power_init(void);
0b22452732366 (Rafael J. Wysocki 2013-01-17 14:11:06 +0100 134) void acpi_power_resources_list_free(struct list_head *list);
e88c9c603b2ad (Rafael J. Wysocki 2013-01-17 14:11:07 +0100 135) int acpi_extract_power_resources(union acpi_object *package, unsigned int start,
e88c9c603b2ad (Rafael J. Wysocki 2013-01-17 14:11:07 +0100 136) struct list_head *list);
9b7ff25d129df (Rafael J. Wysocki 2021-05-21 15:13:11 +0200 137) struct acpi_device *acpi_add_power_resource(acpi_handle handle);
bc9b6407bd6df (Rafael J. Wysocki 2013-01-17 14:11:05 +0100 138) void acpi_power_add_remove_device(struct acpi_device *adev, bool add);
b5d667eb392ed (Rafael J. Wysocki 2013-02-23 23:15:21 +0100 139) int acpi_power_wakeup_list_init(struct list_head *list, int *system_level);
e60cc7a6f0259 (Bjorn Helgaas 2009-03-13 12:08:26 -0600 140) int acpi_device_sleep_wake(struct acpi_device *dev,
c6237b210ddc4 (Maximilian Luz 2020-11-05 03:06:00 +0100 141) int enable, int sleep_state, int dev_state);
32a00d274e877 (Rafael J. Wysocki 2010-11-25 00:05:17 +0100 142) int acpi_power_get_inferred_state(struct acpi_device *device, int *state);
30d3df41b32b1 (Rafael J. Wysocki 2010-11-25 00:06:55 +0100 143) int acpi_power_on_resources(struct acpi_device *device, int state);
e60cc7a6f0259 (Bjorn Helgaas 2009-03-13 12:08:26 -0600 144) int acpi_power_transition(struct acpi_device *device, int state);
9b7ff25d129df (Rafael J. Wysocki 2021-05-21 15:13:11 +0200 145) void acpi_turn_off_unused_power_resources(bool init);
e60cc7a6f0259 (Bjorn Helgaas 2009-03-13 12:08:26 -0600 146)
9ed411c06dd1c (Rafael J. Wysocki 2019-07-04 01:02:49 +0200 147) /* --------------------------------------------------------------------------
9ed411c06dd1c (Rafael J. Wysocki 2019-07-04 01:02:49 +0200 148) Device Power Management
9ed411c06dd1c (Rafael J. Wysocki 2019-07-04 01:02:49 +0200 149) -------------------------------------------------------------------------- */
9ed411c06dd1c (Rafael J. Wysocki 2019-07-04 01:02:49 +0200 150) int acpi_device_get_power(struct acpi_device *device, int *state);
201b8c655f7a4 (Bjorn Helgaas 2009-03-24 16:50:19 -0600 151) int acpi_wakeup_device_init(void);
46ba51ea8f863 (Hanjun Guo 2014-07-18 18:02:54 +0800 152)
9ed411c06dd1c (Rafael J. Wysocki 2019-07-04 01:02:49 +0200 153) /* --------------------------------------------------------------------------
9ed411c06dd1c (Rafael J. Wysocki 2019-07-04 01:02:49 +0200 154) Processor
9ed411c06dd1c (Rafael J. Wysocki 2019-07-04 01:02:49 +0200 155) -------------------------------------------------------------------------- */
46ba51ea8f863 (Hanjun Guo 2014-07-18 18:02:54 +0800 156) #ifdef CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC
78f1699659963 (Alex Chiang 2009-12-20 12:19:09 -0700 157) void acpi_early_processor_set_pdc(void);
46ba51ea8f863 (Hanjun Guo 2014-07-18 18:02:54 +0800 158) #else
46ba51ea8f863 (Hanjun Guo 2014-07-18 18:02:54 +0800 159) static inline void acpi_early_processor_set_pdc(void) {}
46ba51ea8f863 (Hanjun Guo 2014-07-18 18:02:54 +0800 160) #endif
201b8c655f7a4 (Bjorn Helgaas 2009-03-24 16:50:19 -0600 161)
a21211672c9a1 (Srinivas Pandruvada 2016-03-23 21:07:39 -0700 162) #ifdef CONFIG_X86
a21211672c9a1 (Srinivas Pandruvada 2016-03-23 21:07:39 -0700 163) void acpi_early_processor_osc(void);
a21211672c9a1 (Srinivas Pandruvada 2016-03-23 21:07:39 -0700 164) #else
a21211672c9a1 (Srinivas Pandruvada 2016-03-23 21:07:39 -0700 165) static inline void acpi_early_processor_osc(void) {}
a21211672c9a1 (Srinivas Pandruvada 2016-03-23 21:07:39 -0700 166) #endif
a21211672c9a1 (Srinivas Pandruvada 2016-03-23 21:07:39 -0700 167)
e60cc7a6f0259 (Bjorn Helgaas 2009-03-13 12:08:26 -0600 168) /* --------------------------------------------------------------------------
e60cc7a6f0259 (Bjorn Helgaas 2009-03-13 12:08:26 -0600 169) Embedded Controller
e60cc7a6f0259 (Bjorn Helgaas 2009-03-13 12:08:26 -0600 170) -------------------------------------------------------------------------- */
1195a098168fc (Thomas Renninger 2010-07-16 13:11:31 +0200 171) struct acpi_ec {
1195a098168fc (Thomas Renninger 2010-07-16 13:11:31 +0200 172) acpi_handle handle;
406857f773b08 (Daniel Drake 2019-10-14 16:56:02 +0800 173) int gpe;
406857f773b08 (Daniel Drake 2019-10-14 16:56:02 +0800 174) int irq;
1195a098168fc (Thomas Renninger 2010-07-16 13:11:31 +0200 175) unsigned long command_addr;
1195a098168fc (Thomas Renninger 2010-07-16 13:11:31 +0200 176) unsigned long data_addr;
621a5f7ad9cd1 (Viresh Kumar 2015-09-26 15:04:07 -0700 177) bool global_lock;
1195a098168fc (Thomas Renninger 2010-07-16 13:11:31 +0200 178) unsigned long flags;
9887d22add48f (Lv Zheng 2015-02-06 08:57:59 +0800 179) unsigned long reference_count;
f351d027eea54 (Feng Tang 2012-10-23 01:29:27 +0200 180) struct mutex mutex;
1195a098168fc (Thomas Renninger 2010-07-16 13:11:31 +0200 181) wait_queue_head_t wait;
1195a098168fc (Thomas Renninger 2010-07-16 13:11:31 +0200 182) struct list_head list;
1195a098168fc (Thomas Renninger 2010-07-16 13:11:31 +0200 183) struct transaction *curr;
f351d027eea54 (Feng Tang 2012-10-23 01:29:27 +0200 184) spinlock_t lock;
74443bbed72ab (Lv Zheng 2015-01-14 19:28:47 +0800 185) struct work_struct work;
d8d031a605bff (Lv Zheng 2015-05-15 14:16:42 +0800 186) unsigned long timestamp;
9d8993be2d914 (Lv Zheng 2015-06-11 13:21:32 +0800 187) unsigned long nr_pending_queries;
c3a696b6e8f8f (Lv Zheng 2017-01-20 16:42:48 +0800 188) bool busy_polling;
c3a696b6e8f8f (Lv Zheng 2017-01-20 16:42:48 +0800 189) unsigned int polling_guard;
1195a098168fc (Thomas Renninger 2010-07-16 13:11:31 +0200 190) };
1195a098168fc (Thomas Renninger 2010-07-16 13:11:31 +0200 191)
1195a098168fc (Thomas Renninger 2010-07-16 13:11:31 +0200 192) extern struct acpi_ec *first_ec;
1195a098168fc (Thomas Renninger 2010-07-16 13:11:31 +0200 193)
b8a0b0d199307 (Rashika 2013-12-17 15:02:14 +0530 194) /* If we find an EC via the ECDT, we need to keep a ptr to its context */
b8a0b0d199307 (Rashika 2013-12-17 15:02:14 +0530 195) /* External interfaces use first EC only, so remember */
b8a0b0d199307 (Rashika 2013-12-17 15:02:14 +0530 196) typedef int (*acpi_ec_query_func) (void *data);
b8a0b0d199307 (Rashika 2013-12-17 15:02:14 +0530 197)
98ada3c59d05e (Rafael J. Wysocki 2020-03-06 00:14:35 +0100 198) void acpi_ec_init(void);
fdb3c17765703 (Rafael J. Wysocki 2019-01-21 13:07:50 +0100 199) void acpi_ec_ecdt_probe(void);
fdb3c17765703 (Rafael J. Wysocki 2019-01-21 13:07:50 +0100 200) void acpi_ec_dsdt_probe(void);
fe955682d2153 (Rafael J. Wysocki 2010-04-09 01:40:38 +0200 201) void acpi_ec_block_transactions(void);
fe955682d2153 (Rafael J. Wysocki 2010-04-09 01:40:38 +0200 202) void acpi_ec_unblock_transactions(void);
b8a0b0d199307 (Rashika 2013-12-17 15:02:14 +0530 203) int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit,
b8a0b0d199307 (Rashika 2013-12-17 15:02:14 +0530 204) acpi_handle handle, acpi_ec_query_func func,
b8a0b0d199307 (Rashika 2013-12-17 15:02:14 +0530 205) void *data);
b8a0b0d199307 (Rashika 2013-12-17 15:02:14 +0530 206) void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit);
b8a0b0d199307 (Rashika 2013-12-17 15:02:14 +0530 207)
880a66275ef4d (Rafael J. Wysocki 2017-07-20 03:43:12 +0200 208) #ifdef CONFIG_PM_SLEEP
880a66275ef4d (Rafael J. Wysocki 2017-07-20 03:43:12 +0200 209) void acpi_ec_flush_work(void);
d7589404932be (Rafael J. Wysocki 2019-07-31 11:05:52 +0200 210) bool acpi_ec_dispatch_gpe(void);
880a66275ef4d (Rafael J. Wysocki 2017-07-20 03:43:12 +0200 211) #endif
880a66275ef4d (Rafael J. Wysocki 2017-07-20 03:43:12 +0200 212)
e60cc7a6f0259 (Bjorn Helgaas 2009-03-13 12:08:26 -0600 213)
e60cc7a6f0259 (Bjorn Helgaas 2009-03-13 12:08:26 -0600 214) /*--------------------------------------------------------------------------
e60cc7a6f0259 (Bjorn Helgaas 2009-03-13 12:08:26 -0600 215) Suspend/Resume
e60cc7a6f0259 (Bjorn Helgaas 2009-03-13 12:08:26 -0600 216) -------------------------------------------------------------------------- */
6e0a0ea12962a (Graeme Gregory 2015-03-24 14:02:39 +0000 217) #ifdef CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT
33e4f80ee69b5 (Rafael J. Wysocki 2017-06-12 22:56:34 +0200 218) extern bool acpi_s2idle_wakeup(void);
e60cc7a6f0259 (Bjorn Helgaas 2009-03-13 12:08:26 -0600 219) extern int acpi_sleep_init(void);
6e0a0ea12962a (Graeme Gregory 2015-03-24 14:02:39 +0000 220) #else
33e4f80ee69b5 (Rafael J. Wysocki 2017-06-12 22:56:34 +0200 221) static inline bool acpi_s2idle_wakeup(void) { return false; }
6e0a0ea12962a (Graeme Gregory 2015-03-24 14:02:39 +0000 222) static inline int acpi_sleep_init(void) { return -ENXIO; }
6e0a0ea12962a (Graeme Gregory 2015-03-24 14:02:39 +0000 223) #endif
9cee43e07940b (Bjorn Helgaas 2009-03-24 16:50:14 -0600 224)
9cee43e07940b (Bjorn Helgaas 2009-03-24 16:50:14 -0600 225) #ifdef CONFIG_ACPI_SLEEP
f934c745079ea (Rami Rosen 2015-09-11 17:49:22 +0300 226) void acpi_sleep_proc_init(void);
976513dbfc154 (Rafael J. Wysocki 2011-01-07 01:43:44 +0100 227) int suspend_nvs_alloc(void);
976513dbfc154 (Rafael J. Wysocki 2011-01-07 01:43:44 +0100 228) void suspend_nvs_free(void);
976513dbfc154 (Rafael J. Wysocki 2011-01-07 01:43:44 +0100 229) int suspend_nvs_save(void);
976513dbfc154 (Rafael J. Wysocki 2011-01-07 01:43:44 +0100 230) void suspend_nvs_restore(void);
9cee43e07940b (Bjorn Helgaas 2009-03-24 16:50:14 -0600 231) #else
f934c745079ea (Rami Rosen 2015-09-11 17:49:22 +0300 232) static inline void acpi_sleep_proc_init(void) {}
976513dbfc154 (Rafael J. Wysocki 2011-01-07 01:43:44 +0100 233) static inline int suspend_nvs_alloc(void) { return 0; }
976513dbfc154 (Rafael J. Wysocki 2011-01-07 01:43:44 +0100 234) static inline void suspend_nvs_free(void) {}
6fed05c9c9812 (Rafael J. Wysocki 2011-01-12 22:03:20 +0100 235) static inline int suspend_nvs_save(void) { return 0; }
976513dbfc154 (Rafael J. Wysocki 2011-01-07 01:43:44 +0100 236) static inline void suspend_nvs_restore(void) {}
9cee43e07940b (Bjorn Helgaas 2009-03-24 16:50:14 -0600 237) #endif
1195a098168fc (Thomas Renninger 2010-07-16 13:11:31 +0200 238)
ffdcd955c3078 (Mika Westerberg 2014-10-21 13:33:55 +0200 239) /*--------------------------------------------------------------------------
ffdcd955c3078 (Mika Westerberg 2014-10-21 13:33:55 +0200 240) Device properties
ffdcd955c3078 (Mika Westerberg 2014-10-21 13:33:55 +0200 241) -------------------------------------------------------------------------- */
ee89209402e0b (Rafael J. Wysocki 2015-05-22 04:24:34 +0200 242) #define ACPI_DT_NAMESPACE_HID "PRP0001"
ee89209402e0b (Rafael J. Wysocki 2015-05-22 04:24:34 +0200 243)
ffdcd955c3078 (Mika Westerberg 2014-10-21 13:33:55 +0200 244) void acpi_init_properties(struct acpi_device *adev);
ffdcd955c3078 (Mika Westerberg 2014-10-21 13:33:55 +0200 245) void acpi_free_properties(struct acpi_device *adev);
ffdcd955c3078 (Mika Westerberg 2014-10-21 13:33:55 +0200 246)
899596e090ea2 (Lukas Wunner 2017-08-01 14:10:41 +0200 247) #ifdef CONFIG_X86
899596e090ea2 (Lukas Wunner 2017-08-01 14:10:41 +0200 248) void acpi_extract_apple_properties(struct acpi_device *adev);
899596e090ea2 (Lukas Wunner 2017-08-01 14:10:41 +0200 249) #else
899596e090ea2 (Lukas Wunner 2017-08-01 14:10:41 +0200 250) static inline void acpi_extract_apple_properties(struct acpi_device *adev) {}
899596e090ea2 (Lukas Wunner 2017-08-01 14:10:41 +0200 251) #endif
899596e090ea2 (Lukas Wunner 2017-08-01 14:10:41 +0200 252)
058dfc7670086 (Mika Westerberg 2016-09-20 15:30:51 +0300 253) /*--------------------------------------------------------------------------
058dfc7670086 (Mika Westerberg 2016-09-20 15:30:51 +0300 254) Watchdog
058dfc7670086 (Mika Westerberg 2016-09-20 15:30:51 +0300 255) -------------------------------------------------------------------------- */
058dfc7670086 (Mika Westerberg 2016-09-20 15:30:51 +0300 256)
058dfc7670086 (Mika Westerberg 2016-09-20 15:30:51 +0300 257) #ifdef CONFIG_ACPI_WATCHDOG
058dfc7670086 (Mika Westerberg 2016-09-20 15:30:51 +0300 258) void acpi_watchdog_init(void);
058dfc7670086 (Mika Westerberg 2016-09-20 15:30:51 +0300 259) #else
058dfc7670086 (Mika Westerberg 2016-09-20 15:30:51 +0300 260) static inline void acpi_watchdog_init(void) {}
058dfc7670086 (Mika Westerberg 2016-09-20 15:30:51 +0300 261) #endif
058dfc7670086 (Mika Westerberg 2016-09-20 15:30:51 +0300 262)
eeb2d80d502af (Srinivas Pandruvada 2017-10-05 16:24:03 -0700 263) #ifdef CONFIG_ACPI_LPIT
eeb2d80d502af (Srinivas Pandruvada 2017-10-05 16:24:03 -0700 264) void acpi_init_lpit(void);
eeb2d80d502af (Srinivas Pandruvada 2017-10-05 16:24:03 -0700 265) #else
eeb2d80d502af (Srinivas Pandruvada 2017-10-05 16:24:03 -0700 266) static inline void acpi_init_lpit(void) { }
eeb2d80d502af (Srinivas Pandruvada 2017-10-05 16:24:03 -0700 267) #endif
eeb2d80d502af (Srinivas Pandruvada 2017-10-05 16:24:03 -0700 268)
1195a098168fc (Thomas Renninger 2010-07-16 13:11:31 +0200 269) #endif /* _ACPI_INTERNAL_H_ */