2009-07-28 16:45:54 -04:00
|
|
|
/*
|
|
|
|
|
* acpi/internal.h
|
|
|
|
|
* For use by Linux/ACPI infrastructure, not drivers
|
|
|
|
|
*
|
|
|
|
|
* Copyright (c) 2009, Intel Corporation.
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
|
* more details.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2010-07-16 13:11:31 +02:00
|
|
|
#ifndef _ACPI_INTERNAL_H_
|
|
|
|
|
#define _ACPI_INTERNAL_H_
|
|
|
|
|
|
2009-07-28 16:45:54 -04:00
|
|
|
#define PREFIX "ACPI: "
|
2009-03-13 12:08:26 -06:00
|
|
|
|
2013-07-23 16:11:55 +08:00
|
|
|
acpi_status acpi_os_initialize1(void);
|
2015-09-10 23:48:09 +03:00
|
|
|
void init_acpi_device_notify(void);
|
2009-03-24 16:49:43 -06:00
|
|
|
int acpi_scan_init(void);
|
2013-01-30 14:27:33 +01:00
|
|
|
void acpi_pci_root_init(void);
|
2013-01-30 14:27:37 +01:00
|
|
|
void acpi_pci_link_init(void);
|
2013-05-03 00:26:22 +02:00
|
|
|
void acpi_processor_init(void);
|
2013-01-30 14:27:40 +01:00
|
|
|
void acpi_platform_init(void);
|
2014-05-30 04:23:01 +02:00
|
|
|
void acpi_pnp_init(void);
|
2014-03-14 00:34:05 +08:00
|
|
|
void acpi_int340x_thermal_init(void);
|
2010-07-15 10:46:30 +08:00
|
|
|
int acpi_sysfs_init(void);
|
2013-02-08 23:52:39 +01:00
|
|
|
void acpi_container_init(void);
|
2014-05-30 04:29:14 +02:00
|
|
|
void acpi_memory_hotplug_init(void);
|
2015-02-05 13:44:49 +08:00
|
|
|
#ifdef CONFIG_ACPI_HOTPLUG_IOAPIC
|
|
|
|
|
int acpi_ioapic_add(struct acpi_pci_root *root);
|
|
|
|
|
int acpi_ioapic_remove(struct acpi_pci_root *root);
|
|
|
|
|
#else
|
|
|
|
|
static inline int acpi_ioapic_add(struct acpi_pci_root *root) { return 0; }
|
|
|
|
|
static inline int acpi_ioapic_remove(struct acpi_pci_root *root) { return 0; }
|
|
|
|
|
#endif
|
2013-06-23 00:59:55 +02:00
|
|
|
#ifdef CONFIG_ACPI_DOCK
|
2014-02-16 01:51:01 +01:00
|
|
|
void register_dock_dependent_device(struct acpi_device *adev,
|
|
|
|
|
acpi_handle dshandle);
|
|
|
|
|
int dock_notify(struct acpi_device *adev, u32 event);
|
|
|
|
|
void acpi_dock_add(struct acpi_device *adev);
|
2013-06-23 00:59:55 +02:00
|
|
|
#else
|
2014-02-16 01:51:01 +01:00
|
|
|
static inline void register_dock_dependent_device(struct acpi_device *adev,
|
|
|
|
|
acpi_handle dshandle) {}
|
|
|
|
|
static inline int dock_notify(struct acpi_device *adev, u32 event) { return -ENODEV; }
|
|
|
|
|
static inline void acpi_dock_add(struct acpi_device *adev) {}
|
2013-06-23 00:59:55 +02:00
|
|
|
#endif
|
2013-06-05 02:27:50 +00:00
|
|
|
#ifdef CONFIG_X86
|
|
|
|
|
void acpi_cmos_rtc_init(void);
|
|
|
|
|
#else
|
|
|
|
|
static inline void acpi_cmos_rtc_init(void) {}
|
|
|
|
|
#endif
|
2015-07-03 01:06:00 +02:00
|
|
|
int acpi_rev_override_setup(char *str);
|
2009-03-24 16:49:43 -06:00
|
|
|
|
2013-05-03 00:26:16 +02:00
|
|
|
extern bool acpi_force_hot_remove;
|
|
|
|
|
|
2013-03-03 23:08:16 +01:00
|
|
|
void acpi_sysfs_add_hotplug_profile(struct acpi_hotplug_profile *hotplug,
|
|
|
|
|
const char *name);
|
|
|
|
|
int acpi_scan_add_handler_with_hotplug(struct acpi_scan_handler *handler,
|
|
|
|
|
const char *hotplug_profile_name);
|
|
|
|
|
void acpi_scan_hotplug_enabled(struct acpi_hotplug_profile *hotplug, bool val);
|
|
|
|
|
|
2010-07-15 10:46:15 +08:00
|
|
|
#ifdef CONFIG_DEBUG_FS
|
2011-05-26 12:26:23 +02:00
|
|
|
extern struct dentry *acpi_debugfs_dir;
|
2015-08-01 21:32:17 +08:00
|
|
|
void acpi_debugfs_init(void);
|
2010-07-15 10:46:15 +08:00
|
|
|
#else
|
2011-05-26 12:26:23 +02:00
|
|
|
static inline void acpi_debugfs_init(void) { return; }
|
2010-07-15 10:46:15 +08:00
|
|
|
#endif
|
2013-03-06 23:46:20 +01:00
|
|
|
void acpi_lpss_init(void);
|
2010-07-15 10:46:15 +08:00
|
|
|
|
2015-02-06 08:27:51 +08:00
|
|
|
void acpi_apd_init(void);
|
|
|
|
|
|
2014-03-03 00:40:38 +01:00
|
|
|
acpi_status acpi_hotplug_schedule(struct acpi_device *adev, u32 src);
|
2013-11-22 21:52:12 +01:00
|
|
|
bool acpi_queue_hotplug_work(struct work_struct *work);
|
2014-03-03 00:40:38 +01:00
|
|
|
void acpi_device_hotplug(struct acpi_device *adev, u32 src);
|
2013-12-29 15:25:48 +01:00
|
|
|
bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent);
|
2013-11-22 21:52:12 +01:00
|
|
|
|
2013-01-17 14:11:05 +01:00
|
|
|
/* --------------------------------------------------------------------------
|
|
|
|
|
Device Node Initialization / Removal
|
|
|
|
|
-------------------------------------------------------------------------- */
|
|
|
|
|
#define ACPI_STA_DEFAULT (ACPI_STA_DEVICE_PRESENT | ACPI_STA_DEVICE_ENABLED | \
|
|
|
|
|
ACPI_STA_DEVICE_UI | ACPI_STA_DEVICE_FUNCTIONING)
|
|
|
|
|
|
2015-11-25 21:19:55 +01:00
|
|
|
extern struct list_head acpi_bus_id_list;
|
|
|
|
|
|
2016-01-01 22:52:15 +01:00
|
|
|
struct acpi_device_bus_id {
|
2015-11-25 21:19:55 +01:00
|
|
|
char bus_id[15];
|
|
|
|
|
unsigned int instance_no;
|
|
|
|
|
struct list_head node;
|
|
|
|
|
};
|
|
|
|
|
|
2013-01-24 12:49:49 +01:00
|
|
|
int acpi_device_add(struct acpi_device *device,
|
|
|
|
|
void (*release)(struct device *));
|
2013-01-17 14:11:05 +01:00
|
|
|
void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
|
|
|
|
|
int type, unsigned long long sta);
|
2015-07-17 22:53:43 +02:00
|
|
|
int acpi_device_setup_files(struct acpi_device *dev);
|
|
|
|
|
void acpi_device_remove_files(struct acpi_device *dev);
|
2013-01-24 12:49:49 +01:00
|
|
|
void acpi_device_add_finalize(struct acpi_device *device);
|
2013-03-04 21:30:42 +00:00
|
|
|
void acpi_free_pnp_ids(struct acpi_device_pnp *pnp);
|
2013-11-22 21:54:37 +01:00
|
|
|
bool acpi_device_is_present(struct acpi_device *adev);
|
2014-02-16 00:09:34 +01:00
|
|
|
bool acpi_device_is_battery(struct acpi_device *adev);
|
2015-07-27 18:03:57 +03:00
|
|
|
bool acpi_device_is_first_physical_node(struct acpi_device *adev,
|
|
|
|
|
const struct device *dev);
|
2013-01-17 14:11:05 +01:00
|
|
|
|
2015-07-17 22:53:43 +02:00
|
|
|
/* --------------------------------------------------------------------------
|
|
|
|
|
Device Matching and Notification
|
|
|
|
|
-------------------------------------------------------------------------- */
|
|
|
|
|
struct acpi_device *acpi_companion_match(const struct device *dev);
|
|
|
|
|
int __acpi_device_uevent_modalias(struct acpi_device *adev,
|
|
|
|
|
struct kobj_uevent_env *env);
|
|
|
|
|
|
2009-03-13 12:08:26 -06:00
|
|
|
/* --------------------------------------------------------------------------
|
|
|
|
|
Power Resource
|
|
|
|
|
-------------------------------------------------------------------------- */
|
2009-03-24 16:49:53 -06:00
|
|
|
int acpi_power_init(void);
|
2013-01-17 14:11:06 +01:00
|
|
|
void acpi_power_resources_list_free(struct list_head *list);
|
2013-01-17 14:11:07 +01:00
|
|
|
int acpi_extract_power_resources(union acpi_object *package, unsigned int start,
|
|
|
|
|
struct list_head *list);
|
|
|
|
|
int acpi_add_power_resource(acpi_handle handle);
|
2013-01-17 14:11:05 +01:00
|
|
|
void acpi_power_add_remove_device(struct acpi_device *adev, bool add);
|
2013-02-23 23:15:21 +01:00
|
|
|
int acpi_power_wakeup_list_init(struct list_head *list, int *system_level);
|
2009-03-13 12:08:26 -06:00
|
|
|
int acpi_device_sleep_wake(struct acpi_device *dev,
|
|
|
|
|
int enable, int sleep_state, int dev_state);
|
2010-11-25 00:05:17 +01:00
|
|
|
int acpi_power_get_inferred_state(struct acpi_device *device, int *state);
|
2010-11-25 00:06:55 +01:00
|
|
|
int acpi_power_on_resources(struct acpi_device *device, int state);
|
2009-03-13 12:08:26 -06:00
|
|
|
int acpi_power_transition(struct acpi_device *device, int state);
|
|
|
|
|
|
2009-03-24 16:50:19 -06:00
|
|
|
int acpi_wakeup_device_init(void);
|
2014-07-18 18:02:54 +08:00
|
|
|
|
|
|
|
|
#ifdef CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC
|
2009-12-20 12:19:09 -07:00
|
|
|
void acpi_early_processor_set_pdc(void);
|
2014-07-18 18:02:54 +08:00
|
|
|
#else
|
|
|
|
|
static inline void acpi_early_processor_set_pdc(void) {}
|
|
|
|
|
#endif
|
2009-03-24 16:50:19 -06:00
|
|
|
|
2009-03-13 12:08:26 -06:00
|
|
|
/* --------------------------------------------------------------------------
|
|
|
|
|
Embedded Controller
|
|
|
|
|
-------------------------------------------------------------------------- */
|
2010-07-16 13:11:31 +02:00
|
|
|
struct acpi_ec {
|
|
|
|
|
acpi_handle handle;
|
|
|
|
|
unsigned long gpe;
|
|
|
|
|
unsigned long command_addr;
|
|
|
|
|
unsigned long data_addr;
|
2015-09-26 15:04:07 -07:00
|
|
|
bool global_lock;
|
2010-07-16 13:11:31 +02:00
|
|
|
unsigned long flags;
|
2015-02-06 08:57:59 +08:00
|
|
|
unsigned long reference_count;
|
2012-10-23 01:29:27 +02:00
|
|
|
struct mutex mutex;
|
2010-07-16 13:11:31 +02:00
|
|
|
wait_queue_head_t wait;
|
|
|
|
|
struct list_head list;
|
|
|
|
|
struct transaction *curr;
|
2012-10-23 01:29:27 +02:00
|
|
|
spinlock_t lock;
|
2015-01-14 19:28:47 +08:00
|
|
|
struct work_struct work;
|
2015-05-15 14:16:42 +08:00
|
|
|
unsigned long timestamp;
|
2015-06-11 13:21:32 +08:00
|
|
|
unsigned long nr_pending_queries;
|
2010-07-16 13:11:31 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern struct acpi_ec *first_ec;
|
|
|
|
|
|
2013-12-17 15:02:14 +05:30
|
|
|
/* If we find an EC via the ECDT, we need to keep a ptr to its context */
|
|
|
|
|
/* External interfaces use first EC only, so remember */
|
|
|
|
|
typedef int (*acpi_ec_query_func) (void *data);
|
|
|
|
|
|
2009-03-24 16:49:48 -06:00
|
|
|
int acpi_ec_init(void);
|
2009-03-13 12:08:26 -06:00
|
|
|
int acpi_ec_ecdt_probe(void);
|
|
|
|
|
int acpi_boot_ec_enable(void);
|
2010-04-09 01:40:38 +02:00
|
|
|
void acpi_ec_block_transactions(void);
|
|
|
|
|
void acpi_ec_unblock_transactions(void);
|
|
|
|
|
void acpi_ec_unblock_transactions_early(void);
|
2013-12-17 15:02:14 +05:30
|
|
|
int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit,
|
|
|
|
|
acpi_handle handle, acpi_ec_query_func func,
|
|
|
|
|
void *data);
|
|
|
|
|
void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit);
|
|
|
|
|
|
2009-03-13 12:08:26 -06:00
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------
|
|
|
|
|
Suspend/Resume
|
|
|
|
|
-------------------------------------------------------------------------- */
|
2015-03-24 14:02:39 +00:00
|
|
|
#ifdef CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT
|
2009-03-13 12:08:26 -06:00
|
|
|
extern int acpi_sleep_init(void);
|
2015-03-24 14:02:39 +00:00
|
|
|
#else
|
|
|
|
|
static inline int acpi_sleep_init(void) { return -ENXIO; }
|
|
|
|
|
#endif
|
2009-03-24 16:50:14 -06:00
|
|
|
|
|
|
|
|
#ifdef CONFIG_ACPI_SLEEP
|
2015-09-11 17:49:22 +03:00
|
|
|
void acpi_sleep_proc_init(void);
|
2011-01-07 01:43:44 +01:00
|
|
|
int suspend_nvs_alloc(void);
|
|
|
|
|
void suspend_nvs_free(void);
|
|
|
|
|
int suspend_nvs_save(void);
|
|
|
|
|
void suspend_nvs_restore(void);
|
2009-03-24 16:50:14 -06:00
|
|
|
#else
|
2015-09-11 17:49:22 +03:00
|
|
|
static inline void acpi_sleep_proc_init(void) {}
|
2011-01-07 01:43:44 +01:00
|
|
|
static inline int suspend_nvs_alloc(void) { return 0; }
|
|
|
|
|
static inline void suspend_nvs_free(void) {}
|
2011-01-12 22:03:20 +01:00
|
|
|
static inline int suspend_nvs_save(void) { return 0; }
|
2011-01-07 01:43:44 +01:00
|
|
|
static inline void suspend_nvs_restore(void) {}
|
2009-03-24 16:50:14 -06:00
|
|
|
#endif
|
2010-07-16 13:11:31 +02:00
|
|
|
|
2014-10-21 13:33:55 +02:00
|
|
|
/*--------------------------------------------------------------------------
|
|
|
|
|
Device properties
|
|
|
|
|
-------------------------------------------------------------------------- */
|
2015-05-22 04:24:34 +02:00
|
|
|
#define ACPI_DT_NAMESPACE_HID "PRP0001"
|
|
|
|
|
|
2014-10-21 13:33:55 +02:00
|
|
|
void acpi_init_properties(struct acpi_device *adev);
|
|
|
|
|
void acpi_free_properties(struct acpi_device *adev);
|
|
|
|
|
|
2010-07-16 13:11:31 +02:00
|
|
|
#endif /* _ACPI_INTERNAL_H_ */
|