Lines Matching full:phy
3 * phy-core.c -- Generic Phy framework.
18 #include <linux/phy/phy.h>
32 struct phy *phy = *(struct phy **)res; in devm_phy_release() local
34 phy_put(dev, phy); in devm_phy_release()
46 struct phy *phy = *(struct phy **)res; in devm_phy_consume() local
48 phy_destroy(phy); in devm_phy_consume()
53 struct phy **phy = res; in devm_phy_match() local
55 return *phy == match_data; in devm_phy_match()
59 * phy_create_lookup() - allocate and register PHY/device association
60 * @phy: the phy of the association
66 int phy_create_lookup(struct phy *phy, const char *con_id, const char *dev_id) in phy_create_lookup() argument
70 if (!phy || !dev_id || !con_id) in phy_create_lookup()
79 pl->phy = phy; in phy_create_lookup()
90 * phy_remove_lookup() - find and remove PHY/device association
91 * @phy: the phy of the association
98 void phy_remove_lookup(struct phy *phy, const char *con_id, const char *dev_id) in phy_remove_lookup() argument
102 if (!phy || !dev_id || !con_id) in phy_remove_lookup()
107 if (pl->phy == phy && !strcmp(pl->dev_id, dev_id) && in phy_remove_lookup()
117 static struct phy *phy_find(struct device *dev, const char *con_id) in phy_find()
130 return pl ? pl->phy : ERR_PTR(-ENODEV); in phy_find()
152 int phy_pm_runtime_get(struct phy *phy) in phy_pm_runtime_get() argument
156 if (!phy) in phy_pm_runtime_get()
159 if (!pm_runtime_enabled(&phy->dev)) in phy_pm_runtime_get()
162 ret = pm_runtime_get(&phy->dev); in phy_pm_runtime_get()
164 pm_runtime_put_noidle(&phy->dev); in phy_pm_runtime_get()
170 int phy_pm_runtime_get_sync(struct phy *phy) in phy_pm_runtime_get_sync() argument
174 if (!phy) in phy_pm_runtime_get_sync()
177 if (!pm_runtime_enabled(&phy->dev)) in phy_pm_runtime_get_sync()
180 ret = pm_runtime_get_sync(&phy->dev); in phy_pm_runtime_get_sync()
182 pm_runtime_put_sync(&phy->dev); in phy_pm_runtime_get_sync()
188 int phy_pm_runtime_put(struct phy *phy) in phy_pm_runtime_put() argument
190 if (!phy) in phy_pm_runtime_put()
193 if (!pm_runtime_enabled(&phy->dev)) in phy_pm_runtime_put()
196 return pm_runtime_put(&phy->dev); in phy_pm_runtime_put()
200 int phy_pm_runtime_put_sync(struct phy *phy) in phy_pm_runtime_put_sync() argument
202 if (!phy) in phy_pm_runtime_put_sync()
205 if (!pm_runtime_enabled(&phy->dev)) in phy_pm_runtime_put_sync()
208 return pm_runtime_put_sync(&phy->dev); in phy_pm_runtime_put_sync()
212 void phy_pm_runtime_allow(struct phy *phy) in phy_pm_runtime_allow() argument
214 if (!phy) in phy_pm_runtime_allow()
217 if (!pm_runtime_enabled(&phy->dev)) in phy_pm_runtime_allow()
220 pm_runtime_allow(&phy->dev); in phy_pm_runtime_allow()
224 void phy_pm_runtime_forbid(struct phy *phy) in phy_pm_runtime_forbid() argument
226 if (!phy) in phy_pm_runtime_forbid()
229 if (!pm_runtime_enabled(&phy->dev)) in phy_pm_runtime_forbid()
232 pm_runtime_forbid(&phy->dev); in phy_pm_runtime_forbid()
237 * phy_init - phy internal initialization before phy operation
238 * @phy: the phy returned by phy_get()
240 * Used to allow phy's driver to perform phy internal initialization,
242 * is required by the phy to perform the start of operation.
247 int phy_init(struct phy *phy) in phy_init() argument
251 if (!phy) in phy_init()
254 ret = phy_pm_runtime_get_sync(phy); in phy_init()
259 mutex_lock(&phy->mutex); in phy_init()
260 if (phy->power_count > phy->init_count) in phy_init()
261 dev_warn(&phy->dev, "phy_power_on was called before phy_init\n"); in phy_init()
263 if (phy->init_count == 0 && phy->ops->init) { in phy_init()
264 ret = phy->ops->init(phy); in phy_init()
266 dev_err(&phy->dev, "phy init failed --> %d\n", ret); in phy_init()
270 ++phy->init_count; in phy_init()
273 mutex_unlock(&phy->mutex); in phy_init()
274 phy_pm_runtime_put(phy); in phy_init()
280 * phy_exit - Phy internal un-initialization
281 * @phy: the phy returned by phy_get()
287 int phy_exit(struct phy *phy) in phy_exit() argument
291 if (!phy) in phy_exit()
294 ret = phy_pm_runtime_get_sync(phy); in phy_exit()
299 mutex_lock(&phy->mutex); in phy_exit()
300 if (phy->init_count == 1 && phy->ops->exit) { in phy_exit()
301 ret = phy->ops->exit(phy); in phy_exit()
303 dev_err(&phy->dev, "phy exit failed --> %d\n", ret); in phy_exit()
307 --phy->init_count; in phy_exit()
310 mutex_unlock(&phy->mutex); in phy_exit()
311 phy_pm_runtime_put(phy); in phy_exit()
317 * phy_power_on - Enable the phy and enter proper operation
318 * @phy: the phy returned by phy_get()
324 int phy_power_on(struct phy *phy) in phy_power_on() argument
328 if (!phy) in phy_power_on()
331 if (phy->pwr) { in phy_power_on()
332 ret = regulator_enable(phy->pwr); in phy_power_on()
337 ret = phy_pm_runtime_get_sync(phy); in phy_power_on()
343 mutex_lock(&phy->mutex); in phy_power_on()
344 if (phy->power_count == 0 && phy->ops->power_on) { in phy_power_on()
345 ret = phy->ops->power_on(phy); in phy_power_on()
347 dev_err(&phy->dev, "phy poweron failed --> %d\n", ret); in phy_power_on()
351 ++phy->power_count; in phy_power_on()
352 mutex_unlock(&phy->mutex); in phy_power_on()
356 mutex_unlock(&phy->mutex); in phy_power_on()
357 phy_pm_runtime_put_sync(phy); in phy_power_on()
359 if (phy->pwr) in phy_power_on()
360 regulator_disable(phy->pwr); in phy_power_on()
367 * phy_power_off - Disable the phy.
368 * @phy: the phy returned by phy_get()
374 int phy_power_off(struct phy *phy) in phy_power_off() argument
378 if (!phy) in phy_power_off()
381 mutex_lock(&phy->mutex); in phy_power_off()
382 if (phy->power_count == 1 && phy->ops->power_off) { in phy_power_off()
383 ret = phy->ops->power_off(phy); in phy_power_off()
385 dev_err(&phy->dev, "phy poweroff failed --> %d\n", ret); in phy_power_off()
386 mutex_unlock(&phy->mutex); in phy_power_off()
390 --phy->power_count; in phy_power_off()
391 mutex_unlock(&phy->mutex); in phy_power_off()
392 phy_pm_runtime_put(phy); in phy_power_off()
394 if (phy->pwr) in phy_power_off()
395 regulator_disable(phy->pwr); in phy_power_off()
401 int phy_set_mode_ext(struct phy *phy, enum phy_mode mode, int submode) in phy_set_mode_ext() argument
405 if (!phy) in phy_set_mode_ext()
408 mutex_lock(&phy->mutex); in phy_set_mode_ext()
409 if (phy->ops->set_mode) in phy_set_mode_ext()
410 ret = phy->ops->set_mode(phy, mode, submode); in phy_set_mode_ext()
412 phy->attrs.mode = mode; in phy_set_mode_ext()
413 mutex_unlock(&phy->mutex); in phy_set_mode_ext()
419 int phy_set_media(struct phy *phy, enum phy_media media) in phy_set_media() argument
423 if (!phy || !phy->ops->set_media) in phy_set_media()
426 mutex_lock(&phy->mutex); in phy_set_media()
427 ret = phy->ops->set_media(phy, media); in phy_set_media()
428 mutex_unlock(&phy->mutex); in phy_set_media()
434 int phy_set_speed(struct phy *phy, int speed) in phy_set_speed() argument
438 if (!phy || !phy->ops->set_speed) in phy_set_speed()
441 mutex_lock(&phy->mutex); in phy_set_speed()
442 ret = phy->ops->set_speed(phy, speed); in phy_set_speed()
443 mutex_unlock(&phy->mutex); in phy_set_speed()
449 int phy_reset(struct phy *phy) in phy_reset() argument
453 if (!phy || !phy->ops->reset) in phy_reset()
456 ret = phy_pm_runtime_get_sync(phy); in phy_reset()
460 mutex_lock(&phy->mutex); in phy_reset()
461 ret = phy->ops->reset(phy); in phy_reset()
462 mutex_unlock(&phy->mutex); in phy_reset()
464 phy_pm_runtime_put(phy); in phy_reset()
471 * phy_calibrate() - Tunes the phy hw parameters for current configuration
472 * @phy: the phy returned by phy_get()
474 * Used to calibrate phy hardware, typically by adjusting some parameters in
480 int phy_calibrate(struct phy *phy) in phy_calibrate() argument
484 if (!phy || !phy->ops->calibrate) in phy_calibrate()
487 mutex_lock(&phy->mutex); in phy_calibrate()
488 ret = phy->ops->calibrate(phy); in phy_calibrate()
489 mutex_unlock(&phy->mutex); in phy_calibrate()
496 * phy_configure() - Changes the phy parameters
497 * @phy: the phy returned by phy_get()
500 * Used to change the PHY parameters. phy_init() must have been called
501 * on the phy. The configuration will be applied on the current phy
506 int phy_configure(struct phy *phy, union phy_configure_opts *opts) in phy_configure() argument
510 if (!phy) in phy_configure()
513 if (!phy->ops->configure) in phy_configure()
516 mutex_lock(&phy->mutex); in phy_configure()
517 ret = phy->ops->configure(phy, opts); in phy_configure()
518 mutex_unlock(&phy->mutex); in phy_configure()
525 * phy_validate() - Checks the phy parameters
526 * @phy: the phy returned by phy_get()
528 * @submode: PHY submode the configuration is applicable to.
532 * the phy. Implementations are free to tune the parameters passed as
535 * PHY, so calling it as many times as deemed fit will have no side
540 int phy_validate(struct phy *phy, enum phy_mode mode, int submode, in phy_validate() argument
545 if (!phy) in phy_validate()
548 if (!phy->ops->validate) in phy_validate()
551 mutex_lock(&phy->mutex); in phy_validate()
552 ret = phy->ops->validate(phy, mode, submode, opts); in phy_validate()
553 mutex_unlock(&phy->mutex); in phy_validate()
560 * _of_phy_get() - lookup and obtain a reference to a phy by phandle
561 * @np: device_node for which to get the phy
562 * @index: the index of the phy
564 * Returns the phy associated with the given phandle value,
565 * after getting a refcount to it or -ENODEV if there is no such phy or
566 * -EPROBE_DEFER if there is a phandle to the phy, but the device is
568 * while registering the phy_provider to find the phy instance.
570 static struct phy *_of_phy_get(struct device_node *np, int index) in _of_phy_get()
574 struct phy *phy = NULL; in _of_phy_get() local
577 ret = of_parse_phandle_with_args(np, "phys", "#phy-cells", in _of_phy_get()
582 /* This phy type handled by the usb-phy subsystem for now */ in _of_phy_get()
584 phy = ERR_PTR(-ENODEV); in _of_phy_get()
591 phy = ERR_PTR(-EPROBE_DEFER); in _of_phy_get()
596 dev_warn(phy_provider->dev, "Requested PHY is disabled\n"); in _of_phy_get()
597 phy = ERR_PTR(-ENODEV); in _of_phy_get()
601 phy = phy_provider->of_xlate(phy_provider->dev, &args); in _of_phy_get()
611 return phy; in _of_phy_get()
615 * of_phy_get() - lookup and obtain a reference to a phy using a device_node.
616 * @np: device_node for which to get the phy
617 * @con_id: name of the phy from device's point of view
619 * Returns the phy driver, after getting a refcount to it; or
620 * -ENODEV if there is no such phy. The caller is responsible for
623 struct phy *of_phy_get(struct device_node *np, const char *con_id) in of_phy_get()
625 struct phy *phy = NULL; in of_phy_get() local
629 index = of_property_match_string(np, "phy-names", con_id); in of_phy_get()
631 phy = _of_phy_get(np, index); in of_phy_get()
632 if (IS_ERR(phy)) in of_phy_get()
633 return phy; in of_phy_get()
635 if (!try_module_get(phy->ops->owner)) in of_phy_get()
638 get_device(&phy->dev); in of_phy_get()
640 return phy; in of_phy_get()
645 * of_phy_put() - release the PHY
646 * @phy: the phy returned by of_phy_get()
650 void of_phy_put(struct phy *phy) in of_phy_put() argument
652 if (!phy || IS_ERR(phy)) in of_phy_put()
655 mutex_lock(&phy->mutex); in of_phy_put()
656 if (phy->ops->release) in of_phy_put()
657 phy->ops->release(phy); in of_phy_put()
658 mutex_unlock(&phy->mutex); in of_phy_put()
660 module_put(phy->ops->owner); in of_phy_put()
661 put_device(&phy->dev); in of_phy_put()
666 * phy_put() - release the PHY
667 * @dev: device that wants to release this phy
668 * @phy: the phy returned by phy_get()
672 void phy_put(struct device *dev, struct phy *phy) in phy_put() argument
674 device_link_remove(dev, &phy->dev); in phy_put()
675 of_phy_put(phy); in phy_put()
680 * devm_phy_put() - release the PHY
681 * @dev: device that wants to release this phy
682 * @phy: the phy returned by devm_phy_get()
684 * destroys the devres associated with this phy and invokes phy_put
685 * to release the phy.
687 void devm_phy_put(struct device *dev, struct phy *phy) in devm_phy_put() argument
691 if (!phy) in devm_phy_put()
694 r = devres_release(dev, devm_phy_release, devm_phy_match, phy); in devm_phy_put()
695 dev_WARN_ONCE(dev, r, "couldn't find PHY resource\n"); in devm_phy_put()
700 * of_phy_simple_xlate() - returns the phy instance from phy provider
701 * @dev: the PHY provider device
704 * Intended to be used by phy provider for the common case where #phy-cells is
705 * 0. For other cases where #phy-cells is greater than '0', the phy provider
707 * the appropriate phy.
709 struct phy *of_phy_simple_xlate(struct device *dev, struct of_phandle_args in of_phy_simple_xlate()
712 struct phy *phy; in of_phy_simple_xlate() local
717 phy = to_phy(dev); in of_phy_simple_xlate()
718 if (args->np != phy->dev.of_node) in of_phy_simple_xlate()
722 return phy; in of_phy_simple_xlate()
731 * phy_get() - lookup and obtain a reference to a phy.
732 * @dev: device that requests this phy
733 * @string: the phy name as given in the dt data or the name of the controller
736 * Returns the phy driver, after getting a refcount to it; or
737 * -ENODEV if there is no such phy. The caller is responsible for
740 struct phy *phy_get(struct device *dev, const char *string) in phy_get()
743 struct phy *phy; in phy_get() local
748 index = of_property_match_string(dev->of_node, "phy-names", in phy_get()
752 phy = _of_phy_get(dev->of_node, index); in phy_get()
758 phy = phy_find(dev, string); in phy_get()
760 if (IS_ERR(phy)) in phy_get()
761 return phy; in phy_get()
763 if (!try_module_get(phy->ops->owner)) in phy_get()
766 get_device(&phy->dev); in phy_get()
768 link = device_link_add(dev, &phy->dev, DL_FLAG_STATELESS); in phy_get()
771 dev_name(phy->dev.parent)); in phy_get()
773 return phy; in phy_get()
778 * devm_phy_get() - lookup and obtain a reference to a phy.
779 * @dev: device that requests this phy
780 * @string: the phy name as given in the dt data or phy device name
783 * Gets the phy using phy_get(), and associates a device with it using
787 struct phy *devm_phy_get(struct device *dev, const char *string) in devm_phy_get()
789 struct phy **ptr, *phy; in devm_phy_get() local
795 phy = phy_get(dev, string); in devm_phy_get()
796 if (!IS_ERR(phy)) { in devm_phy_get()
797 *ptr = phy; in devm_phy_get()
803 return phy; in devm_phy_get()
808 * devm_phy_optional_get() - lookup and obtain a reference to an optional phy.
809 * @dev: device that requests this phy
810 * @string: the phy name as given in the dt data or phy device name
813 * Gets the phy using phy_get(), and associates a device with it using
816 * that if the phy does not exist, it is not considered an error and
817 * -ENODEV will not be returned. Instead the NULL phy is returned,
818 * which can be passed to all other phy consumer calls.
820 struct phy *devm_phy_optional_get(struct device *dev, const char *string) in devm_phy_optional_get()
822 struct phy *phy = devm_phy_get(dev, string); in devm_phy_optional_get() local
824 if (PTR_ERR(phy) == -ENODEV) in devm_phy_optional_get()
825 phy = NULL; in devm_phy_optional_get()
827 return phy; in devm_phy_optional_get()
832 * devm_of_phy_get() - lookup and obtain a reference to a phy.
833 * @dev: device that requests this phy
834 * @np: node containing the phy
835 * @con_id: name of the phy from device's point of view
837 * Gets the phy using of_phy_get(), and associates a device with it using
841 struct phy *devm_of_phy_get(struct device *dev, struct device_node *np, in devm_of_phy_get()
844 struct phy **ptr, *phy; in devm_of_phy_get() local
851 phy = of_phy_get(np, con_id); in devm_of_phy_get()
852 if (!IS_ERR(phy)) { in devm_of_phy_get()
853 *ptr = phy; in devm_of_phy_get()
857 return phy; in devm_of_phy_get()
860 link = device_link_add(dev, &phy->dev, DL_FLAG_STATELESS); in devm_of_phy_get()
863 dev_name(phy->dev.parent)); in devm_of_phy_get()
865 return phy; in devm_of_phy_get()
871 * phy.
872 * @dev: device that requests this phy
873 * @np: node containing the phy
874 * @con_id: name of the phy from device's point of view
876 * Gets the phy using of_phy_get(), and associates a device with it using
879 * that if the phy does not exist, it is not considered an error and
880 * -ENODEV will not be returned. Instead the NULL phy is returned,
881 * which can be passed to all other phy consumer calls.
883 struct phy *devm_of_phy_optional_get(struct device *dev, struct device_node *np, in devm_of_phy_optional_get()
886 struct phy *phy = devm_of_phy_get(dev, np, con_id); in devm_of_phy_optional_get() local
888 if (PTR_ERR(phy) == -ENODEV) in devm_of_phy_optional_get()
889 phy = NULL; in devm_of_phy_optional_get()
891 if (IS_ERR(phy)) in devm_of_phy_optional_get()
892 dev_err_probe(dev, PTR_ERR(phy), "failed to get PHY %pOF:%s", in devm_of_phy_optional_get()
895 return phy; in devm_of_phy_optional_get()
900 * devm_of_phy_get_by_index() - lookup and obtain a reference to a phy by index.
901 * @dev: device that requests this phy
902 * @np: node containing the phy
903 * @index: index of the phy
905 * Gets the phy using _of_phy_get(), then gets a refcount to it,
911 struct phy *devm_of_phy_get_by_index(struct device *dev, struct device_node *np, in devm_of_phy_get_by_index()
914 struct phy **ptr, *phy; in devm_of_phy_get_by_index() local
921 phy = _of_phy_get(np, index); in devm_of_phy_get_by_index()
922 if (IS_ERR(phy)) { in devm_of_phy_get_by_index()
924 return phy; in devm_of_phy_get_by_index()
927 if (!try_module_get(phy->ops->owner)) { in devm_of_phy_get_by_index()
932 get_device(&phy->dev); in devm_of_phy_get_by_index()
934 *ptr = phy; in devm_of_phy_get_by_index()
937 link = device_link_add(dev, &phy->dev, DL_FLAG_STATELESS); in devm_of_phy_get_by_index()
940 dev_name(phy->dev.parent)); in devm_of_phy_get_by_index()
942 return phy; in devm_of_phy_get_by_index()
947 * phy_create() - create a new phy
948 * @dev: device that is creating the new phy
949 * @node: device node of the phy
950 * @ops: function pointers for performing phy operations
952 * Called to create a phy using phy framework.
954 struct phy *phy_create(struct device *dev, struct device_node *node, in phy_create()
959 struct phy *phy; in phy_create() local
964 phy = kzalloc(sizeof(*phy), GFP_KERNEL); in phy_create()
965 if (!phy) in phy_create()
975 device_initialize(&phy->dev); in phy_create()
976 mutex_init(&phy->mutex); in phy_create()
978 phy->dev.class = phy_class; in phy_create()
979 phy->dev.parent = dev; in phy_create()
980 phy->dev.of_node = node ?: dev->of_node; in phy_create()
981 phy->id = id; in phy_create()
982 phy->ops = ops; in phy_create()
984 ret = dev_set_name(&phy->dev, "phy-%s.%d", dev_name(dev), id); in phy_create()
988 /* phy-supply */ in phy_create()
989 phy->pwr = regulator_get_optional(&phy->dev, "phy"); in phy_create()
990 if (IS_ERR(phy->pwr)) { in phy_create()
991 ret = PTR_ERR(phy->pwr); in phy_create()
995 phy->pwr = NULL; in phy_create()
998 ret = device_add(&phy->dev); in phy_create()
1003 pm_runtime_enable(&phy->dev); in phy_create()
1004 pm_runtime_no_callbacks(&phy->dev); in phy_create()
1007 phy->debugfs = debugfs_create_dir(dev_name(&phy->dev), phy_debugfs_root); in phy_create()
1009 return phy; in phy_create()
1012 put_device(&phy->dev); /* calls phy_release() which frees resources */ in phy_create()
1016 kfree(phy); in phy_create()
1022 * devm_phy_create() - create a new phy
1023 * @dev: device that is creating the new phy
1024 * @node: device node of the phy
1025 * @ops: function pointers for performing phy operations
1027 * Creates a new PHY device adding it to the PHY class.
1028 * While at that, it also associates the device with the phy using devres.
1032 struct phy *devm_phy_create(struct device *dev, struct device_node *node, in devm_phy_create()
1035 struct phy **ptr, *phy; in devm_phy_create() local
1041 phy = phy_create(dev, node, ops); in devm_phy_create()
1042 if (!IS_ERR(phy)) { in devm_phy_create()
1043 *ptr = phy; in devm_phy_create()
1049 return phy; in devm_phy_create()
1054 * phy_destroy() - destroy the phy
1055 * @phy: the phy to be destroyed
1057 * Called to destroy the phy.
1059 void phy_destroy(struct phy *phy) in phy_destroy() argument
1061 pm_runtime_disable(&phy->dev); in phy_destroy()
1062 device_unregister(&phy->dev); in phy_destroy()
1067 * devm_phy_destroy() - destroy the PHY
1068 * @dev: device that wants to release this phy
1069 * @phy: the phy returned by devm_phy_get()
1071 * destroys the devres associated with this phy and invokes phy_destroy
1072 * to destroy the phy.
1074 void devm_phy_destroy(struct device *dev, struct phy *phy) in devm_phy_destroy() argument
1078 r = devres_release(dev, devm_phy_consume, devm_phy_match, phy); in devm_phy_destroy()
1079 dev_WARN_ONCE(dev, r, "couldn't find PHY resource\n"); in devm_phy_destroy()
1084 * __of_phy_provider_register() - create/register phy provider with the framework
1085 * @dev: struct device of the phy provider
1088 * @of_xlate: function pointer to obtain phy instance from phy provider
1091 * This is used in the case of dt boot for finding the phy instance from
1092 * phy provider.
1094 * If the PHY provider doesn't nest children directly but uses a separate
1103 struct phy * (*of_xlate)(struct device *dev, in __of_phy_provider_register()
1151 * __devm_of_phy_provider_register() - create/register phy provider with the
1153 * @dev: struct device of the phy provider
1156 * @of_xlate: function pointer to obtain phy instance from phy provider
1159 * This is used in the case of dt boot for finding the phy instance from
1160 * phy provider. While at that, it also associates the device with the
1161 * phy provider using devres. On driver detach, release function is invoked
1166 struct phy * (*of_xlate)(struct device *dev, in __devm_of_phy_provider_register()
1189 * of_phy_provider_unregister() - unregister phy provider from the framework
1190 * @phy_provider: phy provider returned by of_phy_provider_register()
1208 * devm_of_phy_provider_unregister() - remove phy provider from the framework
1209 * @dev: struct device of the phy provider
1210 * @phy_provider: phy provider returned by of_phy_provider_register()
1212 * destroys the devres associated with this phy provider and invokes
1213 * of_phy_provider_unregister to unregister the phy provider.
1222 dev_WARN_ONCE(dev, r, "couldn't find PHY provider device resource\n"); in devm_of_phy_provider_unregister()
1227 * phy_release() - release the phy
1228 * @dev: the dev member within phy
1235 struct phy *phy; in phy_release() local
1237 phy = to_phy(dev); in phy_release()
1239 debugfs_remove_recursive(phy->debugfs); in phy_release()
1240 regulator_put(phy->pwr); in phy_release()
1241 ida_simple_remove(&phy_ida, phy->id); in phy_release()
1242 kfree(phy); in phy_release()
1247 phy_class = class_create("phy"); in phy_core_init()
1249 pr_err("failed to create phy class --> %ld\n", in phy_core_init()
1256 phy_debugfs_root = debugfs_create_dir("phy", NULL); in phy_core_init()