| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * acpi/internal.h |
|---|
| 3 | 4 | * For use by Linux/ACPI infrastructure, not drivers |
|---|
| 4 | 5 | * |
|---|
| 5 | 6 | * Copyright (c) 2009, Intel Corporation. |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 8 | | - * under the terms and conditions of the GNU General Public License, |
|---|
| 9 | | - * version 2, as published by the Free Software Foundation. |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
|---|
| 12 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 13 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 14 | | - * more details. |
|---|
| 15 | | - * |
|---|
| 16 | 7 | */ |
|---|
| 17 | 8 | |
|---|
| 18 | 9 | #ifndef _ACPI_INTERNAL_H_ |
|---|
| .. | .. |
|---|
| 25 | 16 | int early_acpi_osi_init(void); |
|---|
| 26 | 17 | int acpi_osi_init(void); |
|---|
| 27 | 18 | acpi_status acpi_os_initialize1(void); |
|---|
| 28 | | -void init_acpi_device_notify(void); |
|---|
| 29 | 19 | int acpi_scan_init(void); |
|---|
| 20 | +#ifdef CONFIG_PCI |
|---|
| 30 | 21 | void acpi_pci_root_init(void); |
|---|
| 31 | 22 | void acpi_pci_link_init(void); |
|---|
| 23 | +#else |
|---|
| 24 | +static inline void acpi_pci_root_init(void) {} |
|---|
| 25 | +static inline void acpi_pci_link_init(void) {} |
|---|
| 26 | +#endif |
|---|
| 32 | 27 | void acpi_processor_init(void); |
|---|
| 33 | 28 | void acpi_platform_init(void); |
|---|
| 34 | 29 | void acpi_pnp_init(void); |
|---|
| .. | .. |
|---|
| 79 | 74 | #else |
|---|
| 80 | 75 | static inline void acpi_debugfs_init(void) { return; } |
|---|
| 81 | 76 | #endif |
|---|
| 77 | +#ifdef CONFIG_PCI |
|---|
| 82 | 78 | void acpi_lpss_init(void); |
|---|
| 79 | +#else |
|---|
| 80 | +static inline void acpi_lpss_init(void) {} |
|---|
| 81 | +#endif |
|---|
| 83 | 82 | |
|---|
| 84 | 83 | void acpi_apd_init(void); |
|---|
| 85 | 84 | |
|---|
| .. | .. |
|---|
| 139 | 138 | void acpi_power_add_remove_device(struct acpi_device *adev, bool add); |
|---|
| 140 | 139 | int acpi_power_wakeup_list_init(struct list_head *list, int *system_level); |
|---|
| 141 | 140 | int acpi_device_sleep_wake(struct acpi_device *dev, |
|---|
| 142 | | - int enable, int sleep_state, int dev_state); |
|---|
| 141 | + int enable, int sleep_state, int dev_state); |
|---|
| 143 | 142 | int acpi_power_get_inferred_state(struct acpi_device *device, int *state); |
|---|
| 144 | 143 | int acpi_power_on_resources(struct acpi_device *device, int state); |
|---|
| 145 | 144 | int acpi_power_transition(struct acpi_device *device, int state); |
|---|
| 146 | 145 | |
|---|
| 146 | +/* -------------------------------------------------------------------------- |
|---|
| 147 | + Device Power Management |
|---|
| 148 | + -------------------------------------------------------------------------- */ |
|---|
| 149 | +int acpi_device_get_power(struct acpi_device *device, int *state); |
|---|
| 147 | 150 | int acpi_wakeup_device_init(void); |
|---|
| 148 | 151 | |
|---|
| 152 | +/* -------------------------------------------------------------------------- |
|---|
| 153 | + Processor |
|---|
| 154 | + -------------------------------------------------------------------------- */ |
|---|
| 149 | 155 | #ifdef CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC |
|---|
| 150 | 156 | void acpi_early_processor_set_pdc(void); |
|---|
| 151 | 157 | #else |
|---|
| .. | .. |
|---|
| 163 | 169 | -------------------------------------------------------------------------- */ |
|---|
| 164 | 170 | struct acpi_ec { |
|---|
| 165 | 171 | acpi_handle handle; |
|---|
| 166 | | - u32 gpe; |
|---|
| 172 | + int gpe; |
|---|
| 173 | + int irq; |
|---|
| 167 | 174 | unsigned long command_addr; |
|---|
| 168 | 175 | unsigned long data_addr; |
|---|
| 169 | 176 | bool global_lock; |
|---|
| .. | .. |
|---|
| 177 | 184 | struct work_struct work; |
|---|
| 178 | 185 | unsigned long timestamp; |
|---|
| 179 | 186 | unsigned long nr_pending_queries; |
|---|
| 187 | + unsigned int events_in_progress; |
|---|
| 188 | + unsigned int queries_in_progress; |
|---|
| 180 | 189 | bool busy_polling; |
|---|
| 181 | 190 | unsigned int polling_guard; |
|---|
| 182 | 191 | }; |
|---|
| .. | .. |
|---|
| 187 | 196 | /* External interfaces use first EC only, so remember */ |
|---|
| 188 | 197 | typedef int (*acpi_ec_query_func) (void *data); |
|---|
| 189 | 198 | |
|---|
| 190 | | -int acpi_ec_init(void); |
|---|
| 191 | | -int acpi_ec_ecdt_probe(void); |
|---|
| 192 | | -int acpi_ec_dsdt_probe(void); |
|---|
| 199 | +void acpi_ec_init(void); |
|---|
| 200 | +void acpi_ec_ecdt_probe(void); |
|---|
| 201 | +void acpi_ec_dsdt_probe(void); |
|---|
| 193 | 202 | void acpi_ec_block_transactions(void); |
|---|
| 194 | 203 | void acpi_ec_unblock_transactions(void); |
|---|
| 195 | | -void acpi_ec_mark_gpe_for_wake(void); |
|---|
| 196 | | -void acpi_ec_set_gpe_wake_mask(u8 action); |
|---|
| 197 | | -void acpi_ec_dispatch_gpe(void); |
|---|
| 198 | 204 | int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit, |
|---|
| 199 | 205 | acpi_handle handle, acpi_ec_query_func func, |
|---|
| 200 | 206 | void *data); |
|---|
| .. | .. |
|---|
| 202 | 208 | |
|---|
| 203 | 209 | #ifdef CONFIG_PM_SLEEP |
|---|
| 204 | 210 | void acpi_ec_flush_work(void); |
|---|
| 211 | +bool acpi_ec_dispatch_gpe(void); |
|---|
| 205 | 212 | #endif |
|---|
| 206 | 213 | |
|---|
| 207 | 214 | |
|---|
| .. | .. |
|---|
| 210 | 217 | -------------------------------------------------------------------------- */ |
|---|
| 211 | 218 | #ifdef CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT |
|---|
| 212 | 219 | extern bool acpi_s2idle_wakeup(void); |
|---|
| 213 | | -extern bool acpi_sleep_no_ec_events(void); |
|---|
| 214 | 220 | extern int acpi_sleep_init(void); |
|---|
| 215 | 221 | #else |
|---|
| 216 | 222 | static inline bool acpi_s2idle_wakeup(void) { return false; } |
|---|
| 217 | | -static inline bool acpi_sleep_no_ec_events(void) { return true; } |
|---|
| 218 | 223 | static inline int acpi_sleep_init(void) { return -ENXIO; } |
|---|
| 219 | 224 | #endif |
|---|
| 220 | 225 | |
|---|