diff options
Diffstat (limited to 'include/linux/acpi.h')
-rw-r--r-- | include/linux/acpi.h | 167 |
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 | ||
124 | int acpi_table_init (void); | 125 | int acpi_table_init (void); |
125 | int acpi_table_parse(char *id, acpi_tbl_table_handler handler); | 126 | int acpi_table_parse(char *id, acpi_tbl_table_handler handler); |
127 | int __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); | ||
126 | int __init acpi_table_parse_entries(char *id, unsigned long table_size, | 131 | int __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 *), | |||
423 | const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, | 428 | const 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 | ||
426 | static inline bool acpi_driver_match_device(struct device *dev, | 431 | extern 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 | |||
432 | int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *); | 433 | int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *); |
433 | int acpi_device_modalias(struct device *, char *, int); | 434 | int acpi_device_modalias(struct device *, char *, int); |
435 | void acpi_walk_dep_device_list(acpi_handle handle); | ||
434 | 436 | ||
435 | struct platform_device *acpi_create_platform_device(struct acpi_device *); | 437 | struct 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 | ||
448 | struct fwnode_handle; | ||
449 | |||
450 | static inline bool is_acpi_node(struct fwnode_handle *fwnode) | ||
451 | { | ||
452 | return false; | ||
453 | } | ||
454 | |||
455 | static inline struct acpi_device *acpi_node(struct fwnode_handle *fwnode) | ||
456 | { | ||
457 | return NULL; | ||
458 | } | ||
459 | |||
460 | static inline struct fwnode_handle *acpi_fwnode_handle(struct acpi_device *adev) | ||
461 | { | ||
462 | return NULL; | ||
463 | } | ||
464 | |||
446 | static inline const char *acpi_dev_name(struct acpi_device *adev) | 465 | static 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) |
557 | int acpi_dev_runtime_suspend(struct device *dev); | 576 | int acpi_dev_runtime_suspend(struct device *dev); |
558 | int acpi_dev_runtime_resume(struct device *dev); | 577 | int acpi_dev_runtime_resume(struct device *dev); |
559 | int acpi_subsys_runtime_suspend(struct device *dev); | 578 | int acpi_subsys_runtime_suspend(struct device *dev); |
560 | int acpi_subsys_runtime_resume(struct device *dev); | 579 | int acpi_subsys_runtime_resume(struct device *dev); |
580 | struct acpi_device *acpi_dev_pm_get_node(struct device *dev); | ||
581 | int acpi_dev_pm_attach(struct device *dev, bool power_on); | ||
561 | #else | 582 | #else |
562 | static inline int acpi_dev_runtime_suspend(struct device *dev) { return 0; } | 583 | static inline int acpi_dev_runtime_suspend(struct device *dev) { return 0; } |
563 | static inline int acpi_dev_runtime_resume(struct device *dev) { return 0; } | 584 | static inline int acpi_dev_runtime_resume(struct device *dev) { return 0; } |
564 | static inline int acpi_subsys_runtime_suspend(struct device *dev) { return 0; } | 585 | static inline int acpi_subsys_runtime_suspend(struct device *dev) { return 0; } |
565 | static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; } | 586 | static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; } |
587 | static inline struct acpi_device *acpi_dev_pm_get_node(struct device *dev) | ||
588 | { | ||
589 | return NULL; | ||
590 | } | ||
591 | static 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; } | |||
585 | static inline int acpi_subsys_freeze(struct device *dev) { return 0; } | 614 | static inline int acpi_subsys_freeze(struct device *dev) { return 0; } |
586 | #endif | 615 | #endif |
587 | 616 | ||
588 | #if defined(CONFIG_ACPI) && defined(CONFIG_PM) | ||
589 | struct acpi_device *acpi_dev_pm_get_node(struct device *dev); | ||
590 | int acpi_dev_pm_attach(struct device *dev, bool power_on); | ||
591 | #else | ||
592 | static inline struct acpi_device *acpi_dev_pm_get_node(struct device *dev) | ||
593 | { | ||
594 | return NULL; | ||
595 | } | ||
596 | static 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) |
604 | void acpi_handle_printk(const char *level, acpi_handle handle, | 619 | void acpi_handle_printk(const char *level, acpi_handle handle, |
@@ -659,4 +674,114 @@ do { \ | |||
659 | #endif | 674 | #endif |
660 | #endif | 675 | #endif |
661 | 676 | ||
677 | struct acpi_gpio_params { | ||
678 | unsigned int crs_entry_index; | ||
679 | unsigned int line_index; | ||
680 | bool active_low; | ||
681 | }; | ||
682 | |||
683 | struct 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) | ||
690 | int acpi_dev_add_driver_gpios(struct acpi_device *adev, | ||
691 | const struct acpi_gpio_mapping *gpios); | ||
692 | |||
693 | static inline void acpi_dev_remove_driver_gpios(struct acpi_device *adev) | ||
694 | { | ||
695 | if (adev) | ||
696 | adev->driver_gpios = NULL; | ||
697 | } | ||
698 | #else | ||
699 | static inline int acpi_dev_add_driver_gpios(struct acpi_device *adev, | ||
700 | const struct acpi_gpio_mapping *gpios) | ||
701 | { | ||
702 | return -ENXIO; | ||
703 | } | ||
704 | static 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 | ||
710 | struct 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 | ||
717 | int acpi_dev_get_property(struct acpi_device *adev, const char *name, | ||
718 | acpi_object_type type, const union acpi_object **obj); | ||
719 | int acpi_dev_get_property_array(struct acpi_device *adev, const char *name, | ||
720 | acpi_object_type type, | ||
721 | const union acpi_object **obj); | ||
722 | int acpi_dev_get_property_reference(struct acpi_device *adev, | ||
723 | const char *name, size_t index, | ||
724 | struct acpi_reference_args *args); | ||
725 | |||
726 | int acpi_dev_prop_get(struct acpi_device *adev, const char *propname, | ||
727 | void **valptr); | ||
728 | int acpi_dev_prop_read_single(struct acpi_device *adev, const char *propname, | ||
729 | enum dev_prop_type proptype, void *val); | ||
730 | int acpi_dev_prop_read(struct acpi_device *adev, const char *propname, | ||
731 | enum dev_prop_type proptype, void *val, size_t nval); | ||
732 | |||
733 | struct acpi_device *acpi_get_next_child(struct device *dev, | ||
734 | struct acpi_device *child); | ||
735 | #else | ||
736 | static 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 | } | ||
742 | static 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 | } | ||
749 | static 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 | |||
756 | static inline int acpi_dev_prop_get(struct acpi_device *adev, | ||
757 | const char *propname, | ||
758 | void **valptr) | ||
759 | { | ||
760 | return -ENXIO; | ||
761 | } | ||
762 | |||
763 | static 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 | |||
771 | static 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 | |||
779 | static 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*/ |