aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/acpi.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/acpi.h')
-rw-r--r--include/linux/acpi.h167
1 files changed, 146 insertions, 21 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 407a12f663eb..6bff83b1f298 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -28,6 +28,7 @@
28#include <linux/errno.h> 28#include <linux/errno.h>
29#include <linux/ioport.h> /* for struct resource */ 29#include <linux/ioport.h> /* for struct resource */
30#include <linux/device.h> 30#include <linux/device.h>
31#include <linux/property.h>
31 32
32#ifndef _LINUX 33#ifndef _LINUX
33#define _LINUX 34#define _LINUX
@@ -123,6 +124,10 @@ int acpi_numa_init (void);
123 124
124int acpi_table_init (void); 125int acpi_table_init (void);
125int acpi_table_parse(char *id, acpi_tbl_table_handler handler); 126int acpi_table_parse(char *id, acpi_tbl_table_handler handler);
127int __init acpi_parse_entries(char *id, unsigned long table_size,
128 acpi_tbl_entry_handler handler,
129 struct acpi_table_header *table_header,
130 int entry_id, unsigned int max_entries);
126int __init acpi_table_parse_entries(char *id, unsigned long table_size, 131int __init acpi_table_parse_entries(char *id, unsigned long table_size,
127 int entry_id, 132 int entry_id,
128 acpi_tbl_entry_handler handler, 133 acpi_tbl_entry_handler handler,
@@ -423,14 +428,11 @@ extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
423const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, 428const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,
424 const struct device *dev); 429 const struct device *dev);
425 430
426static inline bool acpi_driver_match_device(struct device *dev, 431extern bool acpi_driver_match_device(struct device *dev,
427 const struct device_driver *drv) 432 const struct device_driver *drv);
428{
429 return !!acpi_match_device(drv->acpi_match_table, dev);
430}
431
432int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *); 433int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *);
433int acpi_device_modalias(struct device *, char *, int); 434int acpi_device_modalias(struct device *, char *, int);
435void acpi_walk_dep_device_list(acpi_handle handle);
434 436
435struct platform_device *acpi_create_platform_device(struct acpi_device *); 437struct platform_device *acpi_create_platform_device(struct acpi_device *);
436#define ACPI_PTR(_ptr) (_ptr) 438#define ACPI_PTR(_ptr) (_ptr)
@@ -443,6 +445,23 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *);
443#define ACPI_COMPANION_SET(dev, adev) do { } while (0) 445#define ACPI_COMPANION_SET(dev, adev) do { } while (0)
444#define ACPI_HANDLE(dev) (NULL) 446#define ACPI_HANDLE(dev) (NULL)
445 447
448struct fwnode_handle;
449
450static inline bool is_acpi_node(struct fwnode_handle *fwnode)
451{
452 return false;
453}
454
455static inline struct acpi_device *acpi_node(struct fwnode_handle *fwnode)
456{
457 return NULL;
458}
459
460static inline struct fwnode_handle *acpi_fwnode_handle(struct acpi_device *adev)
461{
462 return NULL;
463}
464
446static inline const char *acpi_dev_name(struct acpi_device *adev) 465static inline const char *acpi_dev_name(struct acpi_device *adev)
447{ 466{
448 return NULL; 467 return NULL;
@@ -553,16 +572,26 @@ static inline void arch_reserve_mem_area(acpi_physical_address addr,
553#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0) 572#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
554#endif 573#endif
555 574
556#if defined(CONFIG_ACPI) && defined(CONFIG_PM_RUNTIME) 575#if defined(CONFIG_ACPI) && defined(CONFIG_PM)
557int acpi_dev_runtime_suspend(struct device *dev); 576int acpi_dev_runtime_suspend(struct device *dev);
558int acpi_dev_runtime_resume(struct device *dev); 577int acpi_dev_runtime_resume(struct device *dev);
559int acpi_subsys_runtime_suspend(struct device *dev); 578int acpi_subsys_runtime_suspend(struct device *dev);
560int acpi_subsys_runtime_resume(struct device *dev); 579int acpi_subsys_runtime_resume(struct device *dev);
580struct acpi_device *acpi_dev_pm_get_node(struct device *dev);
581int acpi_dev_pm_attach(struct device *dev, bool power_on);
561#else 582#else
562static inline int acpi_dev_runtime_suspend(struct device *dev) { return 0; } 583static inline int acpi_dev_runtime_suspend(struct device *dev) { return 0; }
563static inline int acpi_dev_runtime_resume(struct device *dev) { return 0; } 584static inline int acpi_dev_runtime_resume(struct device *dev) { return 0; }
564static inline int acpi_subsys_runtime_suspend(struct device *dev) { return 0; } 585static inline int acpi_subsys_runtime_suspend(struct device *dev) { return 0; }
565static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; } 586static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; }
587static inline struct acpi_device *acpi_dev_pm_get_node(struct device *dev)
588{
589 return NULL;
590}
591static inline int acpi_dev_pm_attach(struct device *dev, bool power_on)
592{
593 return -ENODEV;
594}
566#endif 595#endif
567 596
568#if defined(CONFIG_ACPI) && defined(CONFIG_PM_SLEEP) 597#if defined(CONFIG_ACPI) && defined(CONFIG_PM_SLEEP)
@@ -585,20 +614,6 @@ static inline int acpi_subsys_suspend(struct device *dev) { return 0; }
585static inline int acpi_subsys_freeze(struct device *dev) { return 0; } 614static inline int acpi_subsys_freeze(struct device *dev) { return 0; }
586#endif 615#endif
587 616
588#if defined(CONFIG_ACPI) && defined(CONFIG_PM)
589struct acpi_device *acpi_dev_pm_get_node(struct device *dev);
590int acpi_dev_pm_attach(struct device *dev, bool power_on);
591#else
592static inline struct acpi_device *acpi_dev_pm_get_node(struct device *dev)
593{
594 return NULL;
595}
596static inline int acpi_dev_pm_attach(struct device *dev, bool power_on)
597{
598 return -ENODEV;
599}
600#endif
601
602#ifdef CONFIG_ACPI 617#ifdef CONFIG_ACPI
603__printf(3, 4) 618__printf(3, 4)
604void acpi_handle_printk(const char *level, acpi_handle handle, 619void acpi_handle_printk(const char *level, acpi_handle handle,
@@ -659,4 +674,114 @@ do { \
659#endif 674#endif
660#endif 675#endif
661 676
677struct acpi_gpio_params {
678 unsigned int crs_entry_index;
679 unsigned int line_index;
680 bool active_low;
681};
682
683struct acpi_gpio_mapping {
684 const char *name;
685 const struct acpi_gpio_params *data;
686 unsigned int size;
687};
688
689#if defined(CONFIG_ACPI) && defined(CONFIG_GPIOLIB)
690int acpi_dev_add_driver_gpios(struct acpi_device *adev,
691 const struct acpi_gpio_mapping *gpios);
692
693static inline void acpi_dev_remove_driver_gpios(struct acpi_device *adev)
694{
695 if (adev)
696 adev->driver_gpios = NULL;
697}
698#else
699static inline int acpi_dev_add_driver_gpios(struct acpi_device *adev,
700 const struct acpi_gpio_mapping *gpios)
701{
702 return -ENXIO;
703}
704static inline void acpi_dev_remove_driver_gpios(struct acpi_device *adev) {}
705#endif
706
707/* Device properties */
708
709#define MAX_ACPI_REFERENCE_ARGS 8
710struct acpi_reference_args {
711 struct acpi_device *adev;
712 size_t nargs;
713 u64 args[MAX_ACPI_REFERENCE_ARGS];
714};
715
716#ifdef CONFIG_ACPI
717int acpi_dev_get_property(struct acpi_device *adev, const char *name,
718 acpi_object_type type, const union acpi_object **obj);
719int acpi_dev_get_property_array(struct acpi_device *adev, const char *name,
720 acpi_object_type type,
721 const union acpi_object **obj);
722int acpi_dev_get_property_reference(struct acpi_device *adev,
723 const char *name, size_t index,
724 struct acpi_reference_args *args);
725
726int acpi_dev_prop_get(struct acpi_device *adev, const char *propname,
727 void **valptr);
728int acpi_dev_prop_read_single(struct acpi_device *adev, const char *propname,
729 enum dev_prop_type proptype, void *val);
730int acpi_dev_prop_read(struct acpi_device *adev, const char *propname,
731 enum dev_prop_type proptype, void *val, size_t nval);
732
733struct acpi_device *acpi_get_next_child(struct device *dev,
734 struct acpi_device *child);
735#else
736static inline int acpi_dev_get_property(struct acpi_device *adev,
737 const char *name, acpi_object_type type,
738 const union acpi_object **obj)
739{
740 return -ENXIO;
741}
742static inline int acpi_dev_get_property_array(struct acpi_device *adev,
743 const char *name,
744 acpi_object_type type,
745 const union acpi_object **obj)
746{
747 return -ENXIO;
748}
749static inline int acpi_dev_get_property_reference(struct acpi_device *adev,
750 const char *name, const char *cells_name,
751 size_t index, struct acpi_reference_args *args)
752{
753 return -ENXIO;
754}
755
756static inline int acpi_dev_prop_get(struct acpi_device *adev,
757 const char *propname,
758 void **valptr)
759{
760 return -ENXIO;
761}
762
763static inline int acpi_dev_prop_read_single(struct acpi_device *adev,
764 const char *propname,
765 enum dev_prop_type proptype,
766 void *val)
767{
768 return -ENXIO;
769}
770
771static inline int acpi_dev_prop_read(struct acpi_device *adev,
772 const char *propname,
773 enum dev_prop_type proptype,
774 void *val, size_t nval)
775{
776 return -ENXIO;
777}
778
779static inline struct acpi_device *acpi_get_next_child(struct device *dev,
780 struct acpi_device *child)
781{
782 return NULL;
783}
784
785#endif
786
662#endif /*_LINUX_ACPI_H*/ 787#endif /*_LINUX_ACPI_H*/