summaryrefslogtreecommitdiffstats
path: root/include/linux/of.h
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-11-03 19:28:56 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-11-04 15:58:21 -0500
commitb31384fa5de37a100507751dfb5c0a49d06cee67 (patch)
treefa0084d464b8cb3873c5e169d61ee3c7e8e5b3e6 /include/linux/of.h
parentffdcd955c3078af3ce117edcfce80fde1a512bed (diff)
Driver core: Unified device properties interface for platform firmware
Add a uniform interface by which device drivers can request device properties from the platform firmware by providing a property name and the corresponding data type. The purpose of it is to help to write portable code that won't depend on any particular platform firmware interface. The following general helper functions are added: device_property_present() device_property_read_u8() device_property_read_u16() device_property_read_u32() device_property_read_u64() device_property_read_string() device_property_read_u8_array() device_property_read_u16_array() device_property_read_u32_array() device_property_read_u64_array() device_property_read_string_array() The first one allows the caller to check if the given property is present. The next 5 of them allow single-valued properties of various types to be retrieved in a uniform way. The remaining 5 are for reading properties with multiple values (arrays of either numbers or strings). The interface covers both ACPI and Device Trees. This change set includes material from Mika Westerberg and Aaron Lu. Signed-off-by: Aaron Lu <aaron.lu@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Grant Likely <grant.likely@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/linux/of.h')
-rw-r--r--include/linux/of.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/of.h b/include/linux/of.h
index 29f0adc5f3e4..ce9f6a2b3532 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -23,6 +23,7 @@
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/topology.h> 24#include <linux/topology.h>
25#include <linux/notifier.h> 25#include <linux/notifier.h>
26#include <linux/property.h>
26 27
27#include <asm/byteorder.h> 28#include <asm/byteorder.h>
28#include <asm/errno.h> 29#include <asm/errno.h>
@@ -263,6 +264,10 @@ extern int of_property_read_u32_array(const struct device_node *np,
263 size_t sz); 264 size_t sz);
264extern int of_property_read_u64(const struct device_node *np, 265extern int of_property_read_u64(const struct device_node *np,
265 const char *propname, u64 *out_value); 266 const char *propname, u64 *out_value);
267extern int of_property_read_u64_array(const struct device_node *np,
268 const char *propname,
269 u64 *out_values,
270 size_t sz);
266 271
267extern int of_property_read_string(struct device_node *np, 272extern int of_property_read_string(struct device_node *np,
268 const char *propname, 273 const char *propname,
@@ -477,6 +482,13 @@ static inline int of_property_read_u32_array(const struct device_node *np,
477 return -ENOSYS; 482 return -ENOSYS;
478} 483}
479 484
485static inline int of_property_read_u64_array(const struct device_node *np,
486 const char *propname,
487 u64 *out_values, size_t sz)
488{
489 return -ENOSYS;
490}
491
480static inline int of_property_read_string(struct device_node *np, 492static inline int of_property_read_string(struct device_node *np,
481 const char *propname, 493 const char *propname,
482 const char **out_string) 494 const char **out_string)