diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-09 13:28:47 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-09 13:28:47 -0400 |
commit | 0415052db4f92b7e272fc15802ad8b8be672deea (patch) | |
tree | 6273d2ecfa56fa21a94e1c8f632e5fefa5f3baa3 /include/linux/property.h | |
parent | 4b4704520d97b74e045154fc3b844b73ae4e7ebd (diff) | |
parent | 33ee09cd59ce154b64f9df942dfa5456db90d5f9 (diff) |
Merge tag 'devprop-5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull device properties framework updates from Rafael Wysocki:
"These add helpers for counting items in a property array and extend
the "software nodes" support to be more convenient for representing
device properties supplied by drivers and make the intel_cht_int33fe
driver use that.
Specifics:
- Add helpers to count items in a property array (Andy Shevchenko).
- Extend "software nodes" support to be more convenient for
representing device properties supplied by drivers (Heikki
Krogerus).
- Add device_find_child_by_name() helper to the driver core (Heikki
Krogerus).
- Extend device connection code to also look for references provided
via fwnode pointers (Heikki Krogerus).
- Start to register proper struct device objects for USB Type-C muxes
and orientation switches (Heikki Krogerus).
- Update the intel_cht_int33fe driver to describe devices in a more
general way with the help of "software nodes" (Heikki Krogerus)"
* tag 'devprop-5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
device property: Add helpers to count items in an array
platform/x86: intel_cht_int33fe: Replacing the old connections with references
platform/x86: intel_cht_int33fe: Supply fwnodes for the external dependencies
platform/x86: intel_cht_int33fe: Provide fwnode for the USB connector
platform/x86: intel_cht_int33fe: Provide software nodes for the devices
platform/x86: intel_cht_int33fe: Remove unused fusb302 device property
platform/x86: intel_cht_int33fe: Register max17047 in its own function
usb: typec: Registering real device entries for the muxes
device connection: Find connections also by checking the references
device property: Introduce fwnode_find_reference()
ACPI / property: Don't limit named child node matching to data nodes
driver core: Add helper device_find_child_by_name()
software node: Add software_node_get_reference_args()
software node: Use kobject name when finding child nodes by name
software node: Add support for static node descriptors
software node: Simplify software_node_release() function
software node: Allow node creation without properties
Diffstat (limited to 'include/linux/property.h')
-rw-r--r-- | include/linux/property.h | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/include/linux/property.h b/include/linux/property.h index e9caa290cda5..5a910ad79591 100644 --- a/include/linux/property.h +++ b/include/linux/property.h | |||
@@ -76,6 +76,10 @@ int fwnode_property_get_reference_args(const struct fwnode_handle *fwnode, | |||
76 | unsigned int nargs, unsigned int index, | 76 | unsigned int nargs, unsigned int index, |
77 | struct fwnode_reference_args *args); | 77 | struct fwnode_reference_args *args); |
78 | 78 | ||
79 | struct fwnode_handle *fwnode_find_reference(const struct fwnode_handle *fwnode, | ||
80 | const char *name, | ||
81 | unsigned int index); | ||
82 | |||
79 | struct fwnode_handle *fwnode_get_parent(const struct fwnode_handle *fwnode); | 83 | struct fwnode_handle *fwnode_get_parent(const struct fwnode_handle *fwnode); |
80 | struct fwnode_handle *fwnode_get_next_parent( | 84 | struct fwnode_handle *fwnode_get_next_parent( |
81 | struct fwnode_handle *fwnode); | 85 | struct fwnode_handle *fwnode); |
@@ -141,6 +145,26 @@ static inline int device_property_read_u64(struct device *dev, | |||
141 | return device_property_read_u64_array(dev, propname, val, 1); | 145 | return device_property_read_u64_array(dev, propname, val, 1); |
142 | } | 146 | } |
143 | 147 | ||
148 | static inline int device_property_count_u8(struct device *dev, const char *propname) | ||
149 | { | ||
150 | return device_property_read_u8_array(dev, propname, NULL, 0); | ||
151 | } | ||
152 | |||
153 | static inline int device_property_count_u16(struct device *dev, const char *propname) | ||
154 | { | ||
155 | return device_property_read_u16_array(dev, propname, NULL, 0); | ||
156 | } | ||
157 | |||
158 | static inline int device_property_count_u32(struct device *dev, const char *propname) | ||
159 | { | ||
160 | return device_property_read_u32_array(dev, propname, NULL, 0); | ||
161 | } | ||
162 | |||
163 | static inline int device_property_count_u64(struct device *dev, const char *propname) | ||
164 | { | ||
165 | return device_property_read_u64_array(dev, propname, NULL, 0); | ||
166 | } | ||
167 | |||
144 | static inline bool fwnode_property_read_bool(const struct fwnode_handle *fwnode, | 168 | static inline bool fwnode_property_read_bool(const struct fwnode_handle *fwnode, |
145 | const char *propname) | 169 | const char *propname) |
146 | { | 170 | { |
@@ -171,6 +195,30 @@ static inline int fwnode_property_read_u64(const struct fwnode_handle *fwnode, | |||
171 | return fwnode_property_read_u64_array(fwnode, propname, val, 1); | 195 | return fwnode_property_read_u64_array(fwnode, propname, val, 1); |
172 | } | 196 | } |
173 | 197 | ||
198 | static inline int fwnode_property_count_u8(const struct fwnode_handle *fwnode, | ||
199 | const char *propname) | ||
200 | { | ||
201 | return fwnode_property_read_u8_array(fwnode, propname, NULL, 0); | ||
202 | } | ||
203 | |||
204 | static inline int fwnode_property_count_u16(const struct fwnode_handle *fwnode, | ||
205 | const char *propname) | ||
206 | { | ||
207 | return fwnode_property_read_u16_array(fwnode, propname, NULL, 0); | ||
208 | } | ||
209 | |||
210 | static inline int fwnode_property_count_u32(const struct fwnode_handle *fwnode, | ||
211 | const char *propname) | ||
212 | { | ||
213 | return fwnode_property_read_u32_array(fwnode, propname, NULL, 0); | ||
214 | } | ||
215 | |||
216 | static inline int fwnode_property_count_u64(const struct fwnode_handle *fwnode, | ||
217 | const char *propname) | ||
218 | { | ||
219 | return fwnode_property_read_u64_array(fwnode, propname, NULL, 0); | ||
220 | } | ||
221 | |||
174 | /** | 222 | /** |
175 | * struct property_entry - "Built-in" device property representation. | 223 | * struct property_entry - "Built-in" device property representation. |
176 | * @name: Name of the property. | 224 | * @name: Name of the property. |
@@ -329,7 +377,54 @@ int fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode, | |||
329 | /* -------------------------------------------------------------------------- */ | 377 | /* -------------------------------------------------------------------------- */ |
330 | /* Software fwnode support - when HW description is incomplete or missing */ | 378 | /* Software fwnode support - when HW description is incomplete or missing */ |
331 | 379 | ||
380 | struct software_node; | ||
381 | |||
382 | /** | ||
383 | * struct software_node_ref_args - Reference with additional arguments | ||
384 | * @node: Reference to a software node | ||
385 | * @nargs: Number of elements in @args array | ||
386 | * @args: Integer arguments | ||
387 | */ | ||
388 | struct software_node_ref_args { | ||
389 | const struct software_node *node; | ||
390 | unsigned int nargs; | ||
391 | u64 args[NR_FWNODE_REFERENCE_ARGS]; | ||
392 | }; | ||
393 | |||
394 | /** | ||
395 | * struct software_node_reference - Named software node reference property | ||
396 | * @name: Name of the property | ||
397 | * @nrefs: Number of elements in @refs array | ||
398 | * @refs: Array of references with optional arguments | ||
399 | */ | ||
400 | struct software_node_reference { | ||
401 | const char *name; | ||
402 | unsigned int nrefs; | ||
403 | const struct software_node_ref_args *refs; | ||
404 | }; | ||
405 | |||
406 | /** | ||
407 | * struct software_node - Software node description | ||
408 | * @name: Name of the software node | ||
409 | * @parent: Parent of the software node | ||
410 | * @properties: Array of device properties | ||
411 | * @references: Array of software node reference properties | ||
412 | */ | ||
413 | struct software_node { | ||
414 | const char *name; | ||
415 | const struct software_node *parent; | ||
416 | const struct property_entry *properties; | ||
417 | const struct software_node_reference *references; | ||
418 | }; | ||
419 | |||
332 | bool is_software_node(const struct fwnode_handle *fwnode); | 420 | bool is_software_node(const struct fwnode_handle *fwnode); |
421 | const struct software_node *to_software_node(struct fwnode_handle *fwnode); | ||
422 | struct fwnode_handle *software_node_fwnode(const struct software_node *node); | ||
423 | |||
424 | int software_node_register_nodes(const struct software_node *nodes); | ||
425 | void software_node_unregister_nodes(const struct software_node *nodes); | ||
426 | |||
427 | int software_node_register(const struct software_node *node); | ||
333 | 428 | ||
334 | int software_node_notify(struct device *dev, unsigned long action); | 429 | int software_node_notify(struct device *dev, unsigned long action); |
335 | 430 | ||