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 || !phy->ops->set_mode) in phy_set_mode_ext()
408 mutex_lock(&phy->mutex); in phy_set_mode_ext()
409 ret = phy->ops->set_mode(phy, mode, submode); in phy_set_mode_ext()
411 phy->attrs.mode = mode; in phy_set_mode_ext()
412 mutex_unlock(&phy->mutex); in phy_set_mode_ext()
418 int phy_set_media(struct phy *phy, enum phy_media media) in phy_set_media() argument
422 if (!phy || !phy->ops->set_media) in phy_set_media()
425 mutex_lock(&phy->mutex); in phy_set_media()
426 ret = phy->ops->set_media(phy, media); in phy_set_media()
427 mutex_unlock(&phy->mutex); in phy_set_media()
433 int phy_set_speed(struct phy *phy, int speed) in phy_set_speed() argument
437 if (!phy || !phy->ops->set_speed) in phy_set_speed()
440 mutex_lock(&phy->mutex); in phy_set_speed()
441 ret = phy->ops->set_speed(phy, speed); in phy_set_speed()
442 mutex_unlock(&phy->mutex); in phy_set_speed()
448 int phy_reset(struct phy *phy) in phy_reset() argument
452 if (!phy || !phy->ops->reset) in phy_reset()
455 ret = phy_pm_runtime_get_sync(phy); in phy_reset()
459 mutex_lock(&phy->mutex); in phy_reset()
460 ret = phy->ops->reset(phy); in phy_reset()
461 mutex_unlock(&phy->mutex); in phy_reset()
463 phy_pm_runtime_put(phy); in phy_reset()
470 * phy_calibrate() - Tunes the phy hw parameters for current configuration
471 * @phy: the phy returned by phy_get()
473 * Used to calibrate phy hardware, typically by adjusting some parameters in
479 int phy_calibrate(struct phy *phy) in phy_calibrate() argument
483 if (!phy || !phy->ops->calibrate) in phy_calibrate()
486 mutex_lock(&phy->mutex); in phy_calibrate()
487 ret = phy->ops->calibrate(phy); in phy_calibrate()
488 mutex_unlock(&phy->mutex); in phy_calibrate()
495 * phy_configure() - Changes the phy parameters
496 * @phy: the phy returned by phy_get()
499 * Used to change the PHY parameters. phy_init() must have been called
500 * on the phy. The configuration will be applied on the current phy
505 int phy_configure(struct phy *phy, union phy_configure_opts *opts) in phy_configure() argument
509 if (!phy) in phy_configure()
512 if (!phy->ops->configure) in phy_configure()
515 mutex_lock(&phy->mutex); in phy_configure()
516 ret = phy->ops->configure(phy, opts); in phy_configure()
517 mutex_unlock(&phy->mutex); in phy_configure()
524 * phy_validate() - Checks the phy parameters
525 * @phy: the phy returned by phy_get()
527 * @submode: PHY submode the configuration is applicable to.
531 * the phy. Implementations are free to tune the parameters passed as
534 * PHY, so calling it as many times as deemed fit will have no side
539 int phy_validate(struct phy *phy, enum phy_mode mode, int submode, in phy_validate() argument
544 if (!phy) in phy_validate()
547 if (!phy->ops->validate) in phy_validate()
550 mutex_lock(&phy->mutex); in phy_validate()
551 ret = phy->ops->validate(phy, mode, submode, opts); in phy_validate()
552 mutex_unlock(&phy->mutex); in phy_validate()
559 * _of_phy_get() - lookup and obtain a reference to a phy by phandle
560 * @np: device_node for which to get the phy
561 * @index: the index of the phy
563 * Returns the phy associated with the given phandle value,
564 * after getting a refcount to it or -ENODEV if there is no such phy or
565 * -EPROBE_DEFER if there is a phandle to the phy, but the device is
567 * while registering the phy_provider to find the phy instance.
569 static struct phy *_of_phy_get(struct device_node *np, int index) in _of_phy_get()
573 struct phy *phy = NULL; in _of_phy_get() local
576 ret = of_parse_phandle_with_args(np, "phys", "#phy-cells", in _of_phy_get()
581 /* This phy type handled by the usb-phy subsystem for now */ in _of_phy_get()
583 phy = ERR_PTR(-ENODEV); in _of_phy_get()
590 phy = ERR_PTR(-EPROBE_DEFER); in _of_phy_get()
595 dev_warn(phy_provider->dev, "Requested PHY is disabled\n"); in _of_phy_get()
596 phy = ERR_PTR(-ENODEV); in _of_phy_get()
600 phy = phy_provider->of_xlate(phy_provider->dev, &args); in _of_phy_get()
610 return phy; in _of_phy_get()
614 * of_phy_get() - lookup and obtain a reference to a phy using a device_node.
615 * @np: device_node for which to get the phy
616 * @con_id: name of the phy from device's point of view
618 * Returns the phy driver, after getting a refcount to it; or
619 * -ENODEV if there is no such phy. The caller is responsible for
622 struct phy *of_phy_get(struct device_node *np, const char *con_id) in of_phy_get()
624 struct phy *phy = NULL; in of_phy_get() local
628 index = of_property_match_string(np, "phy-names", con_id); in of_phy_get()
630 phy = _of_phy_get(np, index); in of_phy_get()
631 if (IS_ERR(phy)) in of_phy_get()
632 return phy; in of_phy_get()
634 if (!try_module_get(phy->ops->owner)) in of_phy_get()
637 get_device(&phy->dev); in of_phy_get()
639 return phy; in of_phy_get()
644 * of_phy_put() - release the PHY
645 * @phy: the phy returned by of_phy_get()
649 void of_phy_put(struct phy *phy) in of_phy_put() argument
651 if (!phy || IS_ERR(phy)) in of_phy_put()
654 mutex_lock(&phy->mutex); in of_phy_put()
655 if (phy->ops->release) in of_phy_put()
656 phy->ops->release(phy); in of_phy_put()
657 mutex_unlock(&phy->mutex); in of_phy_put()
659 module_put(phy->ops->owner); in of_phy_put()
660 put_device(&phy->dev); in of_phy_put()
665 * phy_put() - release the PHY
666 * @dev: device that wants to release this phy
667 * @phy: the phy returned by phy_get()
671 void phy_put(struct device *dev, struct phy *phy) in phy_put() argument
673 device_link_remove(dev, &phy->dev); in phy_put()
674 of_phy_put(phy); in phy_put()
679 * devm_phy_put() - release the PHY
680 * @dev: device that wants to release this phy
681 * @phy: the phy returned by devm_phy_get()
683 * destroys the devres associated with this phy and invokes phy_put
684 * to release the phy.
686 void devm_phy_put(struct device *dev, struct phy *phy) in devm_phy_put() argument
690 if (!phy) in devm_phy_put()
693 r = devres_release(dev, devm_phy_release, devm_phy_match, phy); in devm_phy_put()
694 dev_WARN_ONCE(dev, r, "couldn't find PHY resource\n"); in devm_phy_put()
699 * of_phy_simple_xlate() - returns the phy instance from phy provider
700 * @dev: the PHY provider device
703 * Intended to be used by phy provider for the common case where #phy-cells is
704 * 0. For other cases where #phy-cells is greater than '0', the phy provider
706 * the appropriate phy.
708 struct phy *of_phy_simple_xlate(struct device *dev, struct of_phandle_args in of_phy_simple_xlate()
711 struct phy *phy; in of_phy_simple_xlate() local
716 phy = to_phy(dev); in of_phy_simple_xlate()
717 if (args->np != phy->dev.of_node) in of_phy_simple_xlate()
721 return phy; in of_phy_simple_xlate()
730 * phy_get() - lookup and obtain a reference to a phy.
731 * @dev: device that requests this phy
732 * @string: the phy name as given in the dt data or the name of the controller
735 * Returns the phy driver, after getting a refcount to it; or
736 * -ENODEV if there is no such phy. The caller is responsible for
739 struct phy *phy_get(struct device *dev, const char *string) in phy_get()
742 struct phy *phy; in phy_get() local
747 index = of_property_match_string(dev->of_node, "phy-names", in phy_get()
751 phy = _of_phy_get(dev->of_node, index); in phy_get()
757 phy = phy_find(dev, string); in phy_get()
759 if (IS_ERR(phy)) in phy_get()
760 return phy; in phy_get()
762 if (!try_module_get(phy->ops->owner)) in phy_get()
765 get_device(&phy->dev); in phy_get()
767 link = device_link_add(dev, &phy->dev, DL_FLAG_STATELESS); in phy_get()
770 dev_name(phy->dev.parent)); in phy_get()
772 return phy; in phy_get()
777 * devm_phy_get() - lookup and obtain a reference to a phy.
778 * @dev: device that requests this phy
779 * @string: the phy name as given in the dt data or phy device name
782 * Gets the phy using phy_get(), and associates a device with it using
786 struct phy *devm_phy_get(struct device *dev, const char *string) in devm_phy_get()
788 struct phy **ptr, *phy; in devm_phy_get() local
794 phy = phy_get(dev, string); in devm_phy_get()
795 if (!IS_ERR(phy)) { in devm_phy_get()
796 *ptr = phy; in devm_phy_get()
802 return phy; in devm_phy_get()
807 * devm_phy_optional_get() - lookup and obtain a reference to an optional phy.
808 * @dev: device that requests this phy
809 * @string: the phy name as given in the dt data or phy device name
812 * Gets the phy using phy_get(), and associates a device with it using
815 * that if the phy does not exist, it is not considered an error and
816 * -ENODEV will not be returned. Instead the NULL phy is returned,
817 * which can be passed to all other phy consumer calls.
819 struct phy *devm_phy_optional_get(struct device *dev, const char *string) in devm_phy_optional_get()
821 struct phy *phy = devm_phy_get(dev, string); in devm_phy_optional_get() local
823 if (PTR_ERR(phy) == -ENODEV) in devm_phy_optional_get()
824 phy = NULL; in devm_phy_optional_get()
826 return phy; in devm_phy_optional_get()
831 * devm_of_phy_get() - lookup and obtain a reference to a phy.
832 * @dev: device that requests this phy
833 * @np: node containing the phy
834 * @con_id: name of the phy from device's point of view
836 * Gets the phy using of_phy_get(), and associates a device with it using
840 struct phy *devm_of_phy_get(struct device *dev, struct device_node *np, in devm_of_phy_get()
843 struct phy **ptr, *phy; in devm_of_phy_get() local
850 phy = of_phy_get(np, con_id); in devm_of_phy_get()
851 if (!IS_ERR(phy)) { in devm_of_phy_get()
852 *ptr = phy; in devm_of_phy_get()
856 return phy; in devm_of_phy_get()
859 link = device_link_add(dev, &phy->dev, DL_FLAG_STATELESS); in devm_of_phy_get()
862 dev_name(phy->dev.parent)); in devm_of_phy_get()
864 return phy; in devm_of_phy_get()
870 * phy.
871 * @dev: device that requests this phy
872 * @np: node containing the phy
873 * @con_id: name of the phy from device's point of view
875 * Gets the phy using of_phy_get(), and associates a device with it using
878 * that if the phy does not exist, it is not considered an error and
879 * -ENODEV will not be returned. Instead the NULL phy is returned,
880 * which can be passed to all other phy consumer calls.
882 struct phy *devm_of_phy_optional_get(struct device *dev, struct device_node *np, in devm_of_phy_optional_get()
885 struct phy *phy = devm_of_phy_get(dev, np, con_id); in devm_of_phy_optional_get() local
887 if (PTR_ERR(phy) == -ENODEV) in devm_of_phy_optional_get()
888 phy = NULL; in devm_of_phy_optional_get()
890 if (IS_ERR(phy)) in devm_of_phy_optional_get()
891 dev_err_probe(dev, PTR_ERR(phy), "failed to get PHY %pOF:%s", in devm_of_phy_optional_get()
894 return phy; in devm_of_phy_optional_get()
899 * devm_of_phy_get_by_index() - lookup and obtain a reference to a phy by index.
900 * @dev: device that requests this phy
901 * @np: node containing the phy
902 * @index: index of the phy
904 * Gets the phy using _of_phy_get(), then gets a refcount to it,
910 struct phy *devm_of_phy_get_by_index(struct device *dev, struct device_node *np, in devm_of_phy_get_by_index()
913 struct phy **ptr, *phy; in devm_of_phy_get_by_index() local
920 phy = _of_phy_get(np, index); in devm_of_phy_get_by_index()
921 if (IS_ERR(phy)) { in devm_of_phy_get_by_index()
923 return phy; in devm_of_phy_get_by_index()
926 if (!try_module_get(phy->ops->owner)) { in devm_of_phy_get_by_index()
931 get_device(&phy->dev); in devm_of_phy_get_by_index()
933 *ptr = phy; in devm_of_phy_get_by_index()
936 link = device_link_add(dev, &phy->dev, DL_FLAG_STATELESS); in devm_of_phy_get_by_index()
939 dev_name(phy->dev.parent)); in devm_of_phy_get_by_index()
941 return phy; in devm_of_phy_get_by_index()
946 * phy_create() - create a new phy
947 * @dev: device that is creating the new phy
948 * @node: device node of the phy
949 * @ops: function pointers for performing phy operations
951 * Called to create a phy using phy framework.
953 struct phy *phy_create(struct device *dev, struct device_node *node, in phy_create()
958 struct phy *phy; in phy_create() local
963 phy = kzalloc(sizeof(*phy), GFP_KERNEL); in phy_create()
964 if (!phy) in phy_create()
974 device_initialize(&phy->dev); in phy_create()
975 mutex_init(&phy->mutex); in phy_create()
977 phy->dev.class = phy_class; in phy_create()
978 phy->dev.parent = dev; in phy_create()
979 phy->dev.of_node = node ?: dev->of_node; in phy_create()
980 phy->id = id; in phy_create()
981 phy->ops = ops; in phy_create()
983 ret = dev_set_name(&phy->dev, "phy-%s.%d", dev_name(dev), id); in phy_create()
987 /* phy-supply */ in phy_create()
988 phy->pwr = regulator_get_optional(&phy->dev, "phy"); in phy_create()
989 if (IS_ERR(phy->pwr)) { in phy_create()
990 ret = PTR_ERR(phy->pwr); in phy_create()
994 phy->pwr = NULL; in phy_create()
997 ret = device_add(&phy->dev); in phy_create()
1002 pm_runtime_enable(&phy->dev); in phy_create()
1003 pm_runtime_no_callbacks(&phy->dev); in phy_create()
1006 phy->debugfs = debugfs_create_dir(dev_name(&phy->dev), phy_debugfs_root); in phy_create()
1008 return phy; in phy_create()
1011 put_device(&phy->dev); /* calls phy_release() which frees resources */ in phy_create()
1015 kfree(phy); in phy_create()
1021 * devm_phy_create() - create a new phy
1022 * @dev: device that is creating the new phy
1023 * @node: device node of the phy
1024 * @ops: function pointers for performing phy operations
1026 * Creates a new PHY device adding it to the PHY class.
1027 * While at that, it also associates the device with the phy using devres.
1031 struct phy *devm_phy_create(struct device *dev, struct device_node *node, in devm_phy_create()
1034 struct phy **ptr, *phy; in devm_phy_create() local
1040 phy = phy_create(dev, node, ops); in devm_phy_create()
1041 if (!IS_ERR(phy)) { in devm_phy_create()
1042 *ptr = phy; in devm_phy_create()
1048 return phy; in devm_phy_create()
1053 * phy_destroy() - destroy the phy
1054 * @phy: the phy to be destroyed
1056 * Called to destroy the phy.
1058 void phy_destroy(struct phy *phy) in phy_destroy() argument
1060 pm_runtime_disable(&phy->dev); in phy_destroy()
1061 device_unregister(&phy->dev); in phy_destroy()
1066 * devm_phy_destroy() - destroy the PHY
1067 * @dev: device that wants to release this phy
1068 * @phy: the phy returned by devm_phy_get()
1070 * destroys the devres associated with this phy and invokes phy_destroy
1071 * to destroy the phy.
1073 void devm_phy_destroy(struct device *dev, struct phy *phy) in devm_phy_destroy() argument
1077 r = devres_release(dev, devm_phy_consume, devm_phy_match, phy); in devm_phy_destroy()
1078 dev_WARN_ONCE(dev, r, "couldn't find PHY resource\n"); in devm_phy_destroy()
1083 * __of_phy_provider_register() - create/register phy provider with the framework
1084 * @dev: struct device of the phy provider
1087 * @of_xlate: function pointer to obtain phy instance from phy provider
1090 * This is used in the case of dt boot for finding the phy instance from
1091 * phy provider.
1093 * If the PHY provider doesn't nest children directly but uses a separate
1102 struct phy * (*of_xlate)(struct device *dev, in __of_phy_provider_register()
1150 * __devm_of_phy_provider_register() - create/register phy provider with the
1152 * @dev: struct device of the phy provider
1155 * @of_xlate: function pointer to obtain phy instance from phy provider
1158 * This is used in the case of dt boot for finding the phy instance from
1159 * phy provider. While at that, it also associates the device with the
1160 * phy provider using devres. On driver detach, release function is invoked
1165 struct phy * (*of_xlate)(struct device *dev, in __devm_of_phy_provider_register()
1188 * of_phy_provider_unregister() - unregister phy provider from the framework
1189 * @phy_provider: phy provider returned by of_phy_provider_register()
1207 * devm_of_phy_provider_unregister() - remove phy provider from the framework
1208 * @dev: struct device of the phy provider
1209 * @phy_provider: phy provider returned by of_phy_provider_register()
1211 * destroys the devres associated with this phy provider and invokes
1212 * of_phy_provider_unregister to unregister the phy provider.
1221 dev_WARN_ONCE(dev, r, "couldn't find PHY provider device resource\n"); in devm_of_phy_provider_unregister()
1226 * phy_release() - release the phy
1227 * @dev: the dev member within phy
1234 struct phy *phy; in phy_release() local
1236 phy = to_phy(dev); in phy_release()
1238 debugfs_remove_recursive(phy->debugfs); in phy_release()
1239 regulator_put(phy->pwr); in phy_release()
1240 ida_simple_remove(&phy_ida, phy->id); in phy_release()
1241 kfree(phy); in phy_release()
1246 phy_class = class_create("phy"); in phy_core_init()
1248 pr_err("failed to create phy class --> %ld\n", in phy_core_init()
1255 phy_debugfs_root = debugfs_create_dir("phy", NULL); in phy_core_init()