aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/property.h
AgeCommit message (Collapse)Author
2016-03-22device property: add spaces to PROPERTY_ENTRY_STRING macroAndy Shevchenko
Just a style fix, no functional changes. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> (cherry picked from commit aace7367bf83aef7baa021c7bcc9d2e331b040aa) Signed-off-by: Voon, Weifeng <weifeng.voon@intel.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
2016-03-22include/linux/property.h: fix build issues with gcc-4.4.4Andrew Morton
gcc-4.4.4 has problems with initialization of anonymous unions: drivers/mfd/intel-lpss-acpi.c:30: error: unknown field 'value' specified in initializer work around this by crafting the initializers in a manner which the compiler can handle. Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> (cherry picked from commit d76eebfa175e86383324ad2bbaf472866950398b) Signed-off-by: Voon, Weifeng <weifeng.voon@intel.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
2016-03-22device property: Take a copy of the property setMika Westerberg
It is convenient if the property set associated with the device secondary firmware node is a copy of the original. This allows passing property set from a stack for example for devices created dynamically. This also ties the property set lifetime to the associated device. Because of that we provide new function device_remove_property_set() that is used to disassociate and release memory allocated for the property set. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> (cherry picked from commit 13141e1cb842ad6286c1cfa9a6b7c1577478d03b) Signed-off-by: Voon, Weifeng <weifeng.voon@intel.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
2016-03-22device property: improve readability of macrosAndy Shevchenko
There is no functional change. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> (cherry picked from commit 1d656fb757c17e48a8a01bd576d14918701ba55c) Signed-off-by: Voon, Weifeng <weifeng.voon@intel.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
2016-03-22device property: Add fwnode_property_match_string()Mika Westerberg
Sometimes it is useful to be able to extract an index of certain string value from an array of strings. A typical use case is to give a name to a DMA channel, PWM, clock and so on. Provide an implementation using unified device property accessors that follows of_property_match_string() but works for all supported fwnodes. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> (cherry picked from commit 3f5c8d3187852b1cbed8546169e6293d6d421751) Signed-off-by: Voon, Weifeng <weifeng.voon@intel.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
2016-03-22device property: helper macros for property entry creationHeikki Krogerus
Marcos for easier creation of build-in property entries. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> (cherry picked from commit a85f420475334caed12b057ddcaa0b58e0b1ebb7) Signed-off-by: Voon, Weifeng <weifeng.voon@intel.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
2016-03-22device property: keep single value inplaceAndy Shevchenko
We may save a lot of lines of code and space by keeping single values inside the struct property_entry. Refactor the implementation to do so. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> (cherry picked from commit 66586baba56679baa2da1a10a96ccf15b1e96b95) Signed-off-by: Voon, Weifeng <weifeng.voon@intel.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
2016-03-22device property: refactor built-in properties supportAndy Shevchenko
Instead of using the type and nval fields we will use length (in bytes) of the value. The sanity check is done in the accessors. The built-in property accessors are split in the same way such as device tree. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> (cherry picked from commit 318a1971826103ecf560875b17236dd4a93e8c88) Signed-off-by: Voon, Weifeng <weifeng.voon@intel.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
2015-04-03device property: Introduce firmware node type for platform dataRafael J. Wysocki
Introduce data structures and code allowing "built-in" properties to be associated with devices in such a way that they will be used by the device_property_* API if no proper firmware node (neither DT nor ACPI) is present for the given device. Each property is to be represented by a property_entry structure. An array of property_entry structures (terminated with a null entry) can be pointed to by the properties field of struct property_set that can be added as a firmware node to a struct device using device_add_property_set(). That will cause the device_property_* API to use that property_set as the source of properties if the given device does not have a DT node or an ACPI companion device object associated with it. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Tested-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-16driver core / ACPI: Represent ACPI companions using fwnode_handleRafael J. Wysocki
Now that we have struct fwnode_handle, we can use that to point to ACPI companions from struct device objects instead of pointing to struct acpi_device directly. There are two benefits from that. First, the somewhat ugly and hackish struct acpi_dev_node can be dropped and, second, the same struct fwnode_handle pointer can be used in the future to point to other (non-ACPI) firmware device node types. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Grant Likely <grant.likely@linaro.org>
2014-11-04Driver core: Unified interface for firmware node propertiesRafael J. Wysocki
Add new generic routines are provided for retrieving properties from device description objects in the platform firmware in case there are no struct device objects for them (either those objects have not been created yet or they do not exist at all). The following functions are provided: fwnode_property_present() fwnode_property_read_u8() fwnode_property_read_u16() fwnode_property_read_u32() fwnode_property_read_u64() fwnode_property_read_string() fwnode_property_read_u8_array() fwnode_property_read_u16_array() fwnode_property_read_u32_array() fwnode_property_read_u64_array() fwnode_property_read_string_array() in analogy with the corresponding functions for struct device added previously. For all of them, the first argument is a pointer to struct fwnode_handle (new type) that allows a device description object (depending on what platform firmware interface is in use) to be obtained. Add a new macro device_for_each_child_node() for iterating over the children of the device description object associated with a given device and a new function device_get_child_node_count() returning the number of a given device's child nodes. The interface covers both ACPI and Device Trees. Suggested-by: Grant Likely <grant.likely@linaro.org> 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>
2014-11-04Driver core: Unified device properties interface for platform firmwareRafael J. Wysocki
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>