History

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

Linus Torvalds committed 7 years ago

Commit 04150522 parents 4b47045 33ee09c14 files · +947 −249Browse files

Showing the changes to include/linux (3 of 14 files). Show all

Unified · Split

3 files
  1. include/linux/device.h +2 −0
  2. include/linux/property.h +95 −0
  3. include/linux/usb/typec_mux.h +28 −34
include/linux/device.h+2−0
@@ -1255,6 +1255,8 @@ extern int device_for_each_child_reverse(struct device *dev, void *data, · 1254 unmodified lines
12551255 int (*fn)(struct device *dev, void *data));
12561256 extern struct device *device_find_child(struct device *dev, void *data,
12571257 int (*match)(struct device *dev, void *data));
1258+extern struct device *device_find_child_by_name(struct device *parent,
1259+ const char *name);
12581260 extern int device_rename(struct device *dev, const char *new_name);
12591261 extern int device_move(struct device *dev, struct device *new_parent,
12601262 enum dpm_order dpm_order);
include/linux/property.h+95−0
@@ -76,6 +76,10 @@ int fwnode_property_get_reference_args(const struct fwnode_handle *fwnode, · 75 unmodified lines
7676 unsigned int nargs, unsigned int index,
7777 struct fwnode_reference_args *args);
7878
79+struct fwnode_handle *fwnode_find_reference(const struct fwnode_handle *fwnode,
80+ const char *name,
81+ unsigned int index);
82+
7983 struct fwnode_handle *fwnode_get_parent(const struct fwnode_handle *fwnode);
8084 struct fwnode_handle *fwnode_get_next_parent(
8185 struct fwnode_handle *fwnode);
@@ -141,6 +145,26 @@ static inline int device_property_read_u64(struct device *dev, · 59 unmodified lines
141145 return device_property_read_u64_array(dev, propname, val, 1);
142146 }
143147
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+
144168 static inline bool fwnode_property_read_bool(const struct fwnode_handle *fwnode,
145169 const char *propname)
146170 {
@@ -171,6 +195,30 @@ static inline int fwnode_property_read_u64(const struct fwnode_handle *fwnode, · 24 unmodified lines
171195 return fwnode_property_read_u64_array(fwnode, propname, val, 1);
172196 }
173197
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+
174222 /**
175223 * struct property_entry - "Built-in" device property representation.
176224 * @name: Name of the property.
@@ -329,7 +377,54 @@ int fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode, · 152 unmodified lines
329377 /* -------------------------------------------------------------------------- */
330378 /* Software fwnode support - when HW description is incomplete or missing */
331379
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+
332420 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);
333428
334429 int software_node_notify(struct device *dev, unsigned long action);
335430
include/linux/usb/typec_mux.h+28−34
@@ -3,54 +3,48 @@ · 2 unmodified lines
33 #ifndef __USB_TYPEC_MUX
44 #define __USB_TYPEC_MUX
55
6−#include <linux/list.h>
76 #include <linux/usb/typec.h>
87
98 struct device;
9+struct typec_mux;
10+struct typec_switch;
11+struct fwnode_handle;
1012
11−/**
12− * struct typec_switch - USB Type-C cable orientation switch
13− * @dev: Switch device
14− * @entry: List entry
15− * @set: Callback to the driver for setting the orientation
16− *
17− * USB Type-C pin flipper switch routing the correct data pairs from the
18− * connector to the USB controller depending on the orientation of the cable
19− * plug.
20− */
21−struct typec_switch {
22− struct device *dev;
23− struct list_head entry;
24−
25− int (*set)(struct typec_switch *sw, enum typec_orientation orientation);
26−};
13+typedef int (*typec_switch_set_fn_t)(struct typec_switch *sw,
14+ enum typec_orientation orientation);
2715
28−/**
29− * struct typec_switch - USB Type-C connector pin mux
30− * @dev: Mux device
31− * @entry: List entry
32− * @set: Callback to the driver for setting the state of the mux
33− *
34− * Pin Multiplexer/DeMultiplexer switch routing the USB Type-C connector pins to
35− * different components depending on the requested mode of operation. Used with
36− * Accessory/Alternate modes.
37− */
38−struct typec_mux {
39− struct device *dev;
40− struct list_head entry;
41−
42− int (*set)(struct typec_mux *mux, int state);
16+struct typec_switch_desc {
17+ struct fwnode_handle *fwnode;
18+ typec_switch_set_fn_t set;
19+ void *drvdata;
4320 };
4421
4522 struct typec_switch *typec_switch_get(struct device *dev);
4623 void typec_switch_put(struct typec_switch *sw);
47−int typec_switch_register(struct typec_switch *sw);
24+struct typec_switch *
25+typec_switch_register(struct device *parent,
26+ const struct typec_switch_desc *desc);
4827 void typec_switch_unregister(struct typec_switch *sw);
4928
29+void typec_switch_set_drvdata(struct typec_switch *sw, void *data);
30+void *typec_switch_get_drvdata(struct typec_switch *sw);
31+
32+typedef int (*typec_mux_set_fn_t)(struct typec_mux *mux, int state);
33+
34+struct typec_mux_desc {
35+ struct fwnode_handle *fwnode;
36+ typec_mux_set_fn_t set;
37+ void *drvdata;
38+};
39+
5040 struct typec_mux *
5141 typec_mux_get(struct device *dev, const struct typec_altmode_desc *desc);
5242 void typec_mux_put(struct typec_mux *mux);
53−int typec_mux_register(struct typec_mux *mux);
43+struct typec_mux *
44+typec_mux_register(struct device *parent, const struct typec_mux_desc *desc);
5445 void typec_mux_unregister(struct typec_mux *mux);
5546
47+void typec_mux_set_drvdata(struct typec_mux *mux, void *data);
48+void *typec_mux_get_drvdata(struct typec_mux *mux);
49+
5650 #endif /* __USB_TYPEC_MUX */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t