Convert CONFIG_SAMSUNG_ONENAND to Kconfig
[platform/kernel/u-boot.git] / include / acpi / acpi_dp.h
index a823308..be02cc3 100644 (file)
@@ -11,6 +11,8 @@
 
 struct acpi_ctx;
 
+#include <acpi/acpi_device.h>
+
 /*
  * Writing Device Properties objects via _DSD
  *
@@ -122,7 +124,7 @@ struct acpi_dp {
  * acpi_dp_new_table() - Start a new Device Property table
  *
  * @ref: ACPI reference (e.g. "_DSD")
- * @return pointer to table, or NULL if out of memory
+ * Return: pointer to table, or NULL if out of memory
  */
 struct acpi_dp *acpi_dp_new_table(const char *ref);
 
@@ -134,7 +136,7 @@ struct acpi_dp *acpi_dp_new_table(const char *ref);
  * @dp: Table to add this property to
  * @name: Name of property, or NULL for none
  * @value: Integer value
- * @return pointer to new node, or NULL if out of memory
+ * Return: pointer to new node, or NULL if out of memory
  */
 struct acpi_dp *acpi_dp_add_integer(struct acpi_dp *dp, const char *name,
                                    u64 value);
@@ -147,7 +149,7 @@ struct acpi_dp *acpi_dp_add_integer(struct acpi_dp *dp, const char *name,
  * @dp: Table to add this property to
  * @name: Name of property, or NULL for none
  * @string: String value
- * @return pointer to new node, or NULL if out of memory
+ * Return: pointer to new node, or NULL if out of memory
  */
 struct acpi_dp *acpi_dp_add_string(struct acpi_dp *dp, const char *name,
                                   const char *string);
@@ -160,7 +162,7 @@ struct acpi_dp *acpi_dp_add_string(struct acpi_dp *dp, const char *name,
  * @dp: Table to add this property to
  * @name: Name of property, or NULL for none
  * @reference: Reference value
- * @return pointer to new node, or NULL if out of memory
+ * Return: pointer to new node, or NULL if out of memory
  */
 struct acpi_dp *acpi_dp_add_reference(struct acpi_dp *dp, const char *name,
                                      const char *reference);
@@ -173,7 +175,7 @@ struct acpi_dp *acpi_dp_add_reference(struct acpi_dp *dp, const char *name,
  *
  * @dp: Table to add this property to
  * @name: Name of property, or NULL for none
- * @return pointer to new node, or NULL if out of memory
+ * Return: pointer to new node, or NULL if out of memory
  */
 struct acpi_dp *acpi_dp_add_array(struct acpi_dp *dp, struct acpi_dp *array);
 
@@ -185,7 +187,7 @@ struct acpi_dp *acpi_dp_add_array(struct acpi_dp *dp, struct acpi_dp *array);
  *
  * @dp: Table to add this property to
  * @name: Name of property, or NULL for none
- * @return pointer to new array node, or NULL if out of memory
+ * Return: pointer to new array node, or NULL if out of memory
  */
 struct acpi_dp *acpi_dp_add_integer_array(struct acpi_dp *dp, const char *name,
                                          u64 *array, int len);
@@ -198,20 +200,88 @@ struct acpi_dp *acpi_dp_add_integer_array(struct acpi_dp *dp, const char *name,
  * @dp: Table to add this child to
  * @name: Name of child, or NULL for none
  * @child: Child node to add
- * @return pointer to new child node, or NULL if out of memory
+ * Return: pointer to new child node, or NULL if out of memory
  */
 struct acpi_dp *acpi_dp_add_child(struct acpi_dp *dp, const char *name,
                                  struct acpi_dp *child);
 
 /**
+ * acpi_dp_add_gpio() - Add a GPIO to a list of Device Properties
+ *
+ * A new node is added to the end of the property list of @dp, with the
+ * GPIO properties added to the the new node
+ *
+ * @dp: Table to add this property to
+ * @name: Name of property
+ * @ref: Reference to device with a _CRS containing GpioIO or GpioInt
+ * @index: Index of the GPIO resource in _CRS starting from zero
+ * @pin: Pin in the GPIO resource, typically zero
+ * @polarity: GPIO polarity. Note that ACPI_IRQ_ACTIVE_BOTH is not supported
+ * Return: pointer to new node, or NULL if out of memory
+ */
+struct acpi_dp *acpi_dp_add_gpio(struct acpi_dp *dp, const char *name,
+                                const char *ref, int index, int pin,
+                                enum acpi_gpio_polarity polarity);
+
+/**
  * acpi_dp_write() - Write Device Property hierarchy and clean up resources
  *
  * This writes the table using acpigen and then frees it
  *
  * @ctx: ACPI context
  * @table: Table to write
- * @return 0 if OK, -ve on error
+ * Return: 0 if OK, -ve on error
  */
 int acpi_dp_write(struct acpi_ctx *ctx, struct acpi_dp *table);
 
+/**
+ * acpi_dp_ofnode_copy_int() - Copy a property from device tree to DP
+ *
+ * This copies an integer property from the device tree to the ACPI DP table.
+ *
+ * @node: Node to copy from
+ * @dp: DP to copy to
+ * @prop: Property name to copy
+ * Return: 0 if OK, -ve on error
+ */
+int acpi_dp_ofnode_copy_int(ofnode node, struct acpi_dp *dp, const char *prop);
+
+/**
+ * acpi_dp_ofnode_copy_str() - Copy a property from device tree to DP
+ *
+ * This copies a string property from the device tree to the ACPI DP table.
+ *
+ * @node: Node to copy from
+ * @dp: DP to copy to
+ * @prop: Property name to copy
+ * Return: 0 if OK, -ve on error
+ */
+int acpi_dp_ofnode_copy_str(ofnode node, struct acpi_dp *dp, const char *prop);
+
+/**
+ * acpi_dp_dev_copy_int() - Copy a property from device tree to DP
+ *
+ * This copies an integer property from the device tree to the ACPI DP table.
+ *
+ * @dev: Device to copy from
+ * @dp: DP to copy to
+ * @prop: Property name to copy
+ * Return: 0 if OK, -ve on error
+ */
+int acpi_dp_dev_copy_int(const struct udevice *dev, struct acpi_dp *dp,
+                        const char *prop);
+
+/**
+ * acpi_dp_dev_copy_str() - Copy a property from device tree to DP
+ *
+ * This copies a string property from the device tree to the ACPI DP table.
+ *
+ * @dev: Device to copy from
+ * @dp: DP to copy to
+ * @prop: Property name to copy
+ * Return: 0 if OK, -ve on error
+ */
+int acpi_dp_dev_copy_str(const struct udevice *dev, struct acpi_dp *dp,
+                        const char *prop);
+
 #endif