Merge branches 'acpi-config', 'acpi-osl', 'acpi-utils' and 'acpi-tables'
[linux-drm-fsl-dcu.git] / include / linux / acpi.h
index 3bd0c59..0ccaa09 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/errno.h>
 #include <linux/ioport.h>      /* for struct resource */
 #include <linux/device.h>
+#include <linux/property.h>
 
 #ifndef _LINUX
 #define _LINUX
@@ -427,12 +428,8 @@ extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
 const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,
                                               const struct device *dev);
 
-static inline bool acpi_driver_match_device(struct device *dev,
-                                           const struct device_driver *drv)
-{
-       return !!acpi_match_device(drv->acpi_match_table, dev);
-}
-
+extern bool acpi_driver_match_device(struct device *dev,
+                                    const struct device_driver *drv);
 int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *);
 int acpi_device_modalias(struct device *, char *, int);
 
@@ -447,6 +444,23 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *);
 #define ACPI_COMPANION_SET(dev, adev)  do { } while (0)
 #define ACPI_HANDLE(dev)               (NULL)
 
+struct fwnode_handle;
+
+static inline bool is_acpi_node(struct fwnode_handle *fwnode)
+{
+       return false;
+}
+
+static inline struct acpi_device *acpi_node(struct fwnode_handle *fwnode)
+{
+       return NULL;
+}
+
+static inline struct fwnode_handle *acpi_fwnode_handle(struct acpi_device *adev)
+{
+       return NULL;
+}
+
 static inline const char *acpi_dev_name(struct acpi_device *adev)
 {
        return NULL;
@@ -663,4 +677,114 @@ do {                                                                      \
 #endif
 #endif
 
+struct acpi_gpio_params {
+       unsigned int crs_entry_index;
+       unsigned int line_index;
+       bool active_low;
+};
+
+struct acpi_gpio_mapping {
+       const char *name;
+       const struct acpi_gpio_params *data;
+       unsigned int size;
+};
+
+#if defined(CONFIG_ACPI) && defined(CONFIG_GPIOLIB)
+int acpi_dev_add_driver_gpios(struct acpi_device *adev,
+                             const struct acpi_gpio_mapping *gpios);
+
+static inline void acpi_dev_remove_driver_gpios(struct acpi_device *adev)
+{
+       if (adev)
+               adev->driver_gpios = NULL;
+}
+#else
+static inline int acpi_dev_add_driver_gpios(struct acpi_device *adev,
+                             const struct acpi_gpio_mapping *gpios)
+{
+       return -ENXIO;
+}
+static inline void acpi_dev_remove_driver_gpios(struct acpi_device *adev) {}
+#endif
+
+/* Device properties */
+
+#define MAX_ACPI_REFERENCE_ARGS        8
+struct acpi_reference_args {
+       struct acpi_device *adev;
+       size_t nargs;
+       u64 args[MAX_ACPI_REFERENCE_ARGS];
+};
+
+#ifdef CONFIG_ACPI
+int acpi_dev_get_property(struct acpi_device *adev, const char *name,
+                         acpi_object_type type, const union acpi_object **obj);
+int acpi_dev_get_property_array(struct acpi_device *adev, const char *name,
+                               acpi_object_type type,
+                               const union acpi_object **obj);
+int acpi_dev_get_property_reference(struct acpi_device *adev,
+                                   const char *name, size_t index,
+                                   struct acpi_reference_args *args);
+
+int acpi_dev_prop_get(struct acpi_device *adev, const char *propname,
+                     void **valptr);
+int acpi_dev_prop_read_single(struct acpi_device *adev, const char *propname,
+                             enum dev_prop_type proptype, void *val);
+int acpi_dev_prop_read(struct acpi_device *adev, const char *propname,
+                      enum dev_prop_type proptype, void *val, size_t nval);
+
+struct acpi_device *acpi_get_next_child(struct device *dev,
+                                       struct acpi_device *child);
+#else
+static inline int acpi_dev_get_property(struct acpi_device *adev,
+                                       const char *name, acpi_object_type type,
+                                       const union acpi_object **obj)
+{
+       return -ENXIO;
+}
+static inline int acpi_dev_get_property_array(struct acpi_device *adev,
+                                             const char *name,
+                                             acpi_object_type type,
+                                             const union acpi_object **obj)
+{
+       return -ENXIO;
+}
+static inline int acpi_dev_get_property_reference(struct acpi_device *adev,
+                               const char *name, const char *cells_name,
+                               size_t index, struct acpi_reference_args *args)
+{
+       return -ENXIO;
+}
+
+static inline int acpi_dev_prop_get(struct acpi_device *adev,
+                                   const char *propname,
+                                   void **valptr)
+{
+       return -ENXIO;
+}
+
+static inline int acpi_dev_prop_read_single(struct acpi_device *adev,
+                                           const char *propname,
+                                           enum dev_prop_type proptype,
+                                           void *val)
+{
+       return -ENXIO;
+}
+
+static inline int acpi_dev_prop_read(struct acpi_device *adev,
+                                    const char *propname,
+                                    enum dev_prop_type proptype,
+                                    void *val, size_t nval)
+{
+       return -ENXIO;
+}
+
+static inline struct acpi_device *acpi_get_next_child(struct device *dev,
+                                                     struct acpi_device *child)
+{
+       return NULL;
+}
+
+#endif
+
 #endif /*_LINUX_ACPI_H*/