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.h141
1 files changed, 135 insertions, 6 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 407a12f663eb..d7a5fcf9ef0f 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;
@@ -659,4 +678,114 @@ do { \
659#endif 678#endif
660#endif 679#endif
661 680
681struct acpi_gpio_params {
682 unsigned int crs_entry_index;
683 unsigned int line_index;
684 bool active_low;
685};
686
687struct acpi_gpio_mapping {
688 const char *name;
689 const struct acpi_gpio_params *data;
690 unsigned int size;
691};
692
693#if defined(CONFIG_ACPI) && defined(CONFIG_GPIOLIB)
694int acpi_dev_add_driver_gpios(struct acpi_device *adev,
695 const struct acpi_gpio_mapping *gpios);
696
697static inline void acpi_dev_remove_driver_gpios(struct acpi_device *adev)
698{
699 if (adev)
700 adev->driver_gpios = NULL;
701}
702#else
703static inline int acpi_dev_add_driver_gpios(struct acpi_device *adev,
704 const struct acpi_gpio_mapping *gpios)
705{
706 return -ENXIO;
707}
708static inline void acpi_dev_remove_driver_gpios(struct acpi_device *adev) {}
709#endif
710
711/* Device properties */
712
713#define MAX_ACPI_REFERENCE_ARGS 8
714struct acpi_reference_args {
715 struct acpi_device *adev;
716 size_t nargs;
717 u64 args[MAX_ACPI_REFERENCE_ARGS];
718};
719
720#ifdef CONFIG_ACPI
721int acpi_dev_get_property(struct acpi_device *adev, const char *name,
722 acpi_object_type type, const union acpi_object **obj);
723int acpi_dev_get_property_array(struct acpi_device *adev, const char *name,
724 acpi_object_type type,
725 const union acpi_object **obj);
726int acpi_dev_get_property_reference(struct acpi_device *adev,
727 const char *name, size_t index,
728 struct acpi_reference_args *args);
729
730int acpi_dev_prop_get(struct acpi_device *adev, const char *propname,
731 void **valptr);
732int acpi_dev_prop_read_single(struct acpi_device *adev, const char *propname,
733 enum dev_prop_type proptype, void *val);
734int acpi_dev_prop_read(struct acpi_device *adev, const char *propname,
735 enum dev_prop_type proptype, void *val, size_t nval);
736
737struct acpi_device *acpi_get_next_child(struct device *dev,
738 struct acpi_device *child);
739#else
740static inline int acpi_dev_get_property(struct acpi_device *adev,
741 const char *name, acpi_object_type type,
742 const union acpi_object **obj)
743{
744 return -ENXIO;
745}
746static inline int acpi_dev_get_property_array(struct acpi_device *adev,
747 const char *name,
748 acpi_object_type type,
749 const union acpi_object **obj)
750{
751 return -ENXIO;
752}
753static inline int acpi_dev_get_property_reference(struct acpi_device *adev,
754 const char *name, const char *cells_name,
755 size_t index, struct acpi_reference_args *args)
756{
757 return -ENXIO;
758}
759
760static inline int acpi_dev_prop_get(struct acpi_device *adev,
761 const char *propname,
762 void **valptr)
763{
764 return -ENXIO;
765}
766
767static inline int acpi_dev_prop_read_single(struct acpi_device *adev,
768 const char *propname,
769 enum dev_prop_type proptype,
770 void *val)
771{
772 return -ENXIO;
773}
774
775static inline int acpi_dev_prop_read(struct acpi_device *adev,
776 const char *propname,
777 enum dev_prop_type proptype,
778 void *val, size_t nval)
779{
780 return -ENXIO;
781}
782
783static inline struct acpi_device *acpi_get_next_child(struct device *dev,
784 struct acpi_device *child)
785{
786 return NULL;
787}
788
789#endif
790
662#endif /*_LINUX_ACPI_H*/ 791#endif /*_LINUX_ACPI_H*/