Lines Matching full:component
5 * This is work in progress. We gather up the component devices into a list,
10 #include <linux/component.h>
21 * The component helper allows drivers to collect a pile of sub-devices,
24 * of_clk_get_by_name(). The component helper can be used when such a
25 * subsystem-specific way to find a device is not available: The component
32 * The component helper also doesn't solve runtime dependencies, e.g. for system
38 * Aggregate drivers first assemble a component match list of what they need
44 struct component;
51 struct component *component; member
71 struct component { struct
104 struct component *component = match->compare[i].component; in component_devices_show() local
107 component ? dev_name(component->dev) : "(unknown)", in component_devices_show()
108 component ? (component->bound ? "bound" : "not bound") : "not registered"); in component_devices_show()
161 static struct component *find_component(struct master *master, in find_component()
164 struct component *c; in find_component()
193 struct component *c; in find_components()
195 dev_dbg(master->dev, "Looking for component %zu\n", i); in find_components()
197 if (match->compare[i].component) in find_components()
206 dev_dbg(master->dev, "found component %s, duplicate %u\n", dev_name(c->dev), !!c->master); in find_components()
208 /* Attach this component to the master */ in find_components()
210 match->compare[i].component = c; in find_components()
216 /* Detach component from associated master */
217 static void remove_component(struct master *master, struct component *c) in remove_component()
221 /* Detach the component from this master. */ in remove_component()
223 if (master->match->compare[i].component == c) in remove_component()
224 master->match->compare[i].component = NULL; in remove_component()
228 * Try to bring up a master. If component is NULL, we're interested in
229 * this master, otherwise it's a component which must be present to try
235 struct component *component) in try_to_bring_up_master() argument
246 if (component && component->master != master) { in try_to_bring_up_master()
247 dev_dbg(master->dev, "master is not for this component (%s)\n", in try_to_bring_up_master()
248 dev_name(component->dev)); in try_to_bring_up_master()
268 static int try_to_bring_up_masters(struct component *component) in try_to_bring_up_masters() argument
275 ret = try_to_bring_up_master(m, component); in try_to_bring_up_masters()
376 match->compare[match->num].component = NULL; in __component_match_add()
381 * component_match_add_release - add a component match entry with release callback
383 * @matchptr: pointer to the list of component matches
388 * Adds a new component match to the list stored in @matchptr, which the @master
389 * aggregate driver needs to function. The list of component matches pointed to
411 * component_match_add_typed - add a component match entry for a typed component
413 * @matchptr: pointer to the list of component matches
417 * Adds a new component match to the list stored in @matchptr, which the @master
418 * aggregate driver needs to function. The list of component matches pointed to
446 struct component *c = match->compare[i].component; in free_master()
459 * @match: component match list for the aggregate driver
527 static void component_unbind(struct component *component, in component_unbind() argument
530 WARN_ON(!component->bound); in component_unbind()
532 if (component->ops && component->ops->unbind) in component_unbind()
533 component->ops->unbind(component->dev, master->dev, data); in component_unbind()
534 component->bound = false; in component_unbind()
536 /* Release all resources claimed in the binding of this component */ in component_unbind()
537 devres_release_group(component->dev, component); in component_unbind()
552 struct component *c; in component_unbind_all()
564 c = master->match->compare[i].component; in component_unbind_all()
570 static int component_bind(struct component *component, struct master *master, in component_bind() argument
576 * Each component initialises inside its own devres group. in component_bind()
577 * This allows us to roll-back a failed component without in component_bind()
588 if (!devres_open_group(component->dev, component, GFP_KERNEL)) { in component_bind()
594 dev_name(component->dev), component->ops); in component_bind()
596 ret = component->ops->bind(component->dev, master->dev, data); in component_bind()
598 component->bound = true; in component_bind()
601 * Close the component device's group so that resources in component_bind()
606 devres_close_group(component->dev, NULL); in component_bind()
610 dev_name(component->dev), component->ops); in component_bind()
612 devres_release_group(component->dev, NULL); in component_bind()
617 dev_name(component->dev), component->ops, ret); in component_bind()
635 struct component *c; in component_bind_all()
648 c = master->match->compare[i].component; in component_bind_all()
657 c = master->match->compare[i - 1].component; in component_bind_all()
669 struct component *component; in __component_add() local
672 component = kzalloc(sizeof(*component), GFP_KERNEL); in __component_add()
673 if (!component) in __component_add()
676 component->ops = ops; in __component_add()
677 component->dev = dev; in __component_add()
678 component->subcomponent = subcomponent; in __component_add()
680 dev_dbg(dev, "adding component (ops %ps)\n", ops); in __component_add()
683 list_add_tail(&component->node, &component_list); in __component_add()
685 ret = try_to_bring_up_masters(component); in __component_add()
687 if (component->master) in __component_add()
688 remove_component(component->master, component); in __component_add()
689 list_del(&component->node); in __component_add()
691 kfree(component); in __component_add()
699 * component_add_typed - register a component
700 * @dev: component device
701 * @ops: component callbacks
704 * Register a new component for @dev. Functions in @ops will be call when the
712 * The component needs to be unregistered at driver unload/disconnect by
728 * component_add - register a component
729 * @dev: component device
730 * @ops: component callbacks
732 * Register a new component for @dev. Functions in @ops will be called when the
736 * The component needs to be unregistered at driver unload/disconnect by
749 * component_del - unregister a component
750 * @dev: component device
751 * @ops: component callbacks
753 * Unregister a component added with component_add(). If the component is bound
759 struct component *c, *component = NULL; in component_del() local
765 component = c; in component_del()
769 if (component && component->master) { in component_del()
770 take_down_master(component->master); in component_del()
771 remove_component(component->master, component); in component_del()
776 WARN_ON(!component); in component_del()
777 kfree(component); in component_del()