Lines Matching defs:phy
3 * phy.c -- USB phy handling
15 #include <linux/usb/phy.h>
33 struct usb_phy *phy;
54 struct usb_phy *phy = NULL;
56 list_for_each_entry(phy, list, head) {
57 if (phy->type != type)
60 return phy;
68 struct usb_phy *phy;
73 list_for_each_entry(phy, &phy_list, head) {
74 if (node != phy->dev->of_node)
77 return phy;
120 * subsystem, the usb phy driver should issue usb_phy_set_charger_state()
219 * @usb_phy: the USB phy to be used
272 * @usb_phy: the USB phy to be used
310 * @usb_phy: the USB phy to be used
313 * The usb phy driver can issue this function when the usb phy driver
335 struct usb_phy *phy = *(struct usb_phy **)res;
337 usb_put_phy(phy);
345 usb_unregister_notifier(res->phy, res->nb);
346 usb_put_phy(res->phy);
351 struct usb_phy **phy = res;
353 return *phy == match_data;
455 * @dev: device that requests this phy
456 * @type: the type of the phy the controller requires
458 * Gets the phy using usb_get_phy(), and associates a device with it using
466 struct usb_phy **ptr, *phy;
472 phy = usb_get_phy(type);
473 if (!IS_ERR(phy)) {
474 *ptr = phy;
479 return phy;
485 * @type: the type of the phy the controller requires
487 * Returns the phy driver, after getting a refcount to it; or
488 * -ENODEV if there is no such phy. The caller is responsible for
495 struct usb_phy *phy = NULL;
500 phy = __usb_find_phy(&phy_list, type);
501 if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) {
504 if (!IS_ERR(phy))
505 phy = ERR_PTR(-ENODEV);
510 get_device(phy->dev);
515 return phy;
521 * @dev: device that requests this phy
522 * @node: the device_node for the phy device.
523 * @nb: a notifier_block to register with the phy.
525 * Returns the phy driver associated with the given device_node,
526 * after getting a refcount to it, -ENODEV if there is no such phy or
529 * the phy using devres. On driver detach, release function is invoked
532 * For use by peripheral drivers for devices related to a phy,
539 struct usb_phy *phy = ERR_PTR(-ENOMEM);
551 phy = __of_usb_find_phy(node);
552 if (IS_ERR(phy)) {
557 if (!try_module_get(phy->dev->driver->owner)) {
558 phy = ERR_PTR(-ENODEV);
563 usb_register_notifier(phy, nb);
564 ptr->phy = phy;
568 get_device(phy->dev);
575 return phy;
581 * @dev: device that requests this phy
582 * @phandle: name of the property holding the phy phandle value
583 * @index: the index of the phy
585 * Returns the phy driver associated with the given phandle value,
586 * after getting a refcount to it, -ENODEV if there is no such phy or
587 * -EPROBE_DEFER if there is a phandle to the phy, but the device is
589 * the phy using devres. On driver detach, release function is invoked
598 struct usb_phy *phy;
611 phy = devm_usb_get_phy_by_node(dev, node, NULL);
613 return phy;
619 * @dev: device that wants to release this phy
620 * @phy: the phy returned by devm_usb_get_phy()
622 * destroys the devres associated with this phy and invokes usb_put_phy
623 * to release the phy.
627 void devm_usb_put_phy(struct device *dev, struct usb_phy *phy)
631 r = devres_destroy(dev, devm_usb_phy_release, devm_usb_phy_match, phy);
638 * @x: the phy returned by usb_get_phy()
657 * @x: the USB phy to be used; or NULL
660 * This call is exclusively for use by phy drivers, which
668 struct usb_phy *phy;
684 list_for_each_entry(phy, &phy_list, head) {
685 if (phy->type == type) {
709 * @x: the USB phy to be used; or NULL
711 * This call is exclusively for use by phy drivers, which
760 * usb_phy_set_event - set event to phy event
761 * @x: the phy returned by usb_get_phy();
764 * This sets event to phy event