Lines Matching full:phy

3  * phy-core.c  --  Generic Phy framework.
18 #include <linux/phy/phy.h>
25 .name = "phy",
37 struct phy *phy = *(struct phy **)res; in devm_phy_release() local
39 phy_put(dev, phy); in devm_phy_release()
51 struct phy *phy = *(struct phy **)res; in devm_phy_consume() local
53 phy_destroy(phy); in devm_phy_consume()
58 struct phy **phy = res; in devm_phy_match() local
60 return *phy == match_data; in devm_phy_match()
64 * phy_create_lookup() - allocate and register PHY/device association
65 * @phy: the phy of the association
71 int phy_create_lookup(struct phy *phy, const char *con_id, const char *dev_id) in phy_create_lookup() argument
75 if (!phy || !dev_id || !con_id) in phy_create_lookup()
84 pl->phy = phy; in phy_create_lookup()
95 * phy_remove_lookup() - find and remove PHY/device association
96 * @phy: the phy of the association
103 void phy_remove_lookup(struct phy *phy, const char *con_id, const char *dev_id) in phy_remove_lookup() argument
107 if (!phy || !dev_id || !con_id) in phy_remove_lookup()
112 if (pl->phy == phy && !strcmp(pl->dev_id, dev_id) && in phy_remove_lookup()
122 static struct phy *phy_find(struct device *dev, const char *con_id) in phy_find()
135 return pl ? pl->phy : ERR_PTR(-ENODEV); in phy_find()
154 int phy_pm_runtime_get(struct phy *phy) in phy_pm_runtime_get() argument
158 if (!phy) in phy_pm_runtime_get()
161 if (!pm_runtime_enabled(&phy->dev)) in phy_pm_runtime_get()
164 ret = pm_runtime_get(&phy->dev); in phy_pm_runtime_get()
166 pm_runtime_put_noidle(&phy->dev); in phy_pm_runtime_get()
172 int phy_pm_runtime_get_sync(struct phy *phy) in phy_pm_runtime_get_sync() argument
176 if (!phy) in phy_pm_runtime_get_sync()
179 if (!pm_runtime_enabled(&phy->dev)) in phy_pm_runtime_get_sync()
182 ret = pm_runtime_get_sync(&phy->dev); in phy_pm_runtime_get_sync()
184 pm_runtime_put_sync(&phy->dev); in phy_pm_runtime_get_sync()
190 void phy_pm_runtime_put(struct phy *phy) in phy_pm_runtime_put() argument
192 if (!phy) in phy_pm_runtime_put()
195 if (!pm_runtime_enabled(&phy->dev)) in phy_pm_runtime_put()
198 pm_runtime_put(&phy->dev); in phy_pm_runtime_put()
202 int phy_pm_runtime_put_sync(struct phy *phy) in phy_pm_runtime_put_sync() argument
204 if (!phy) in phy_pm_runtime_put_sync()
207 if (!pm_runtime_enabled(&phy->dev)) in phy_pm_runtime_put_sync()
210 return pm_runtime_put_sync(&phy->dev); in phy_pm_runtime_put_sync()
215 * phy_init - phy internal initialization before phy operation
216 * @phy: the phy returned by phy_get()
218 * Used to allow phy's driver to perform phy internal initialization,
220 * is required by the phy to perform the start of operation.
225 int phy_init(struct phy *phy) in phy_init() argument
229 if (!phy) in phy_init()
232 ret = phy_pm_runtime_get_sync(phy); in phy_init()
237 mutex_lock(&phy->mutex); in phy_init()
238 if (phy->power_count > phy->init_count) in phy_init()
239 dev_warn(&phy->dev, "phy_power_on was called before phy_init\n"); in phy_init()
241 if (phy->init_count == 0 && phy->ops->init) { in phy_init()
242 ret = phy->ops->init(phy); in phy_init()
244 dev_err(&phy->dev, "phy init failed --> %d\n", ret); in phy_init()
248 ++phy->init_count; in phy_init()
251 mutex_unlock(&phy->mutex); in phy_init()
252 phy_pm_runtime_put(phy); in phy_init()
258 * phy_exit - Phy internal un-initialization
259 * @phy: the phy returned by phy_get()
265 int phy_exit(struct phy *phy) in phy_exit() argument
269 if (!phy) in phy_exit()
272 ret = phy_pm_runtime_get_sync(phy); in phy_exit()
277 mutex_lock(&phy->mutex); in phy_exit()
278 if (phy->init_count == 1 && phy->ops->exit) { in phy_exit()
279 ret = phy->ops->exit(phy); in phy_exit()
281 dev_err(&phy->dev, "phy exit failed --> %d\n", ret); in phy_exit()
285 --phy->init_count; in phy_exit()
288 mutex_unlock(&phy->mutex); in phy_exit()
289 phy_pm_runtime_put(phy); in phy_exit()
295 * phy_power_on - Enable the phy and enter proper operation
296 * @phy: the phy returned by phy_get()
302 int phy_power_on(struct phy *phy) in phy_power_on() argument
306 if (!phy) in phy_power_on()
309 if (phy->pwr) { in phy_power_on()
310 ret = regulator_enable(phy->pwr); in phy_power_on()
315 ret = phy_pm_runtime_get_sync(phy); in phy_power_on()
321 mutex_lock(&phy->mutex); in phy_power_on()
322 if (phy->power_count == 0 && phy->ops->power_on) { in phy_power_on()
323 ret = phy->ops->power_on(phy); in phy_power_on()
325 dev_err(&phy->dev, "phy poweron failed --> %d\n", ret); in phy_power_on()
329 ++phy->power_count; in phy_power_on()
330 mutex_unlock(&phy->mutex); in phy_power_on()
334 mutex_unlock(&phy->mutex); in phy_power_on()
335 phy_pm_runtime_put_sync(phy); in phy_power_on()
337 if (phy->pwr) in phy_power_on()
338 regulator_disable(phy->pwr); in phy_power_on()
345 * phy_power_off - Disable the phy.
346 * @phy: the phy returned by phy_get()
352 int phy_power_off(struct phy *phy) in phy_power_off() argument
356 if (!phy) in phy_power_off()
359 mutex_lock(&phy->mutex); in phy_power_off()
360 if (phy->power_count == 1 && phy->ops->power_off) { in phy_power_off()
361 ret = phy->ops->power_off(phy); in phy_power_off()
363 dev_err(&phy->dev, "phy poweroff failed --> %d\n", ret); in phy_power_off()
364 mutex_unlock(&phy->mutex); in phy_power_off()
368 --phy->power_count; in phy_power_off()
369 mutex_unlock(&phy->mutex); in phy_power_off()
370 phy_pm_runtime_put(phy); in phy_power_off()
372 if (phy->pwr) in phy_power_off()
373 regulator_disable(phy->pwr); in phy_power_off()
379 int phy_set_mode_ext(struct phy *phy, enum phy_mode mode, int submode) in phy_set_mode_ext() argument
383 if (!phy) in phy_set_mode_ext()
386 mutex_lock(&phy->mutex); in phy_set_mode_ext()
387 if (phy->ops->set_mode) in phy_set_mode_ext()
388 ret = phy->ops->set_mode(phy, mode, submode); in phy_set_mode_ext()
390 phy->attrs.mode = mode; in phy_set_mode_ext()
391 mutex_unlock(&phy->mutex); in phy_set_mode_ext()
397 int phy_set_media(struct phy *phy, enum phy_media media) in phy_set_media() argument
401 if (!phy || !phy->ops->set_media) in phy_set_media()
404 mutex_lock(&phy->mutex); in phy_set_media()
405 ret = phy->ops->set_media(phy, media); in phy_set_media()
406 mutex_unlock(&phy->mutex); in phy_set_media()
412 int phy_set_speed(struct phy *phy, int speed) in phy_set_speed() argument
416 if (!phy || !phy->ops->set_speed) in phy_set_speed()
419 mutex_lock(&phy->mutex); in phy_set_speed()
420 ret = phy->ops->set_speed(phy, speed); in phy_set_speed()
421 mutex_unlock(&phy->mutex); in phy_set_speed()
427 int phy_reset(struct phy *phy) in phy_reset() argument
431 if (!phy || !phy->ops->reset) in phy_reset()
434 ret = phy_pm_runtime_get_sync(phy); in phy_reset()
438 mutex_lock(&phy->mutex); in phy_reset()
439 ret = phy->ops->reset(phy); in phy_reset()
440 mutex_unlock(&phy->mutex); in phy_reset()
442 phy_pm_runtime_put(phy); in phy_reset()
449 * phy_calibrate() - Tunes the phy hw parameters for current configuration
450 * @phy: the phy returned by phy_get()
452 * Used to calibrate phy hardware, typically by adjusting some parameters in
458 int phy_calibrate(struct phy *phy) in phy_calibrate() argument
462 if (!phy || !phy->ops->calibrate) in phy_calibrate()
465 mutex_lock(&phy->mutex); in phy_calibrate()
466 ret = phy->ops->calibrate(phy); in phy_calibrate()
467 mutex_unlock(&phy->mutex); in phy_calibrate()
474 * phy_notify_connect() - phy connect notification
475 * @phy: the phy returned by phy_get()
478 * If the phy needs to get connection status, the callback can be used.
481 int phy_notify_connect(struct phy *phy, int port) in phy_notify_connect() argument
485 if (!phy || !phy->ops->connect) in phy_notify_connect()
488 mutex_lock(&phy->mutex); in phy_notify_connect()
489 ret = phy->ops->connect(phy, port); in phy_notify_connect()
490 mutex_unlock(&phy->mutex); in phy_notify_connect()
497 * phy_notify_disconnect() - phy disconnect notification
498 * @phy: the phy returned by phy_get()
501 * If the phy needs to get connection status, the callback can be used.
505 int phy_notify_disconnect(struct phy *phy, int port) in phy_notify_disconnect() argument
509 if (!phy || !phy->ops->disconnect) in phy_notify_disconnect()
512 mutex_lock(&phy->mutex); in phy_notify_disconnect()
513 ret = phy->ops->disconnect(phy, port); in phy_notify_disconnect()
514 mutex_unlock(&phy->mutex); in phy_notify_disconnect()
521 * phy_notify_state() - phy state notification
522 * @phy: the PHY returned by phy_get()
523 * @state: the PHY state
525 * Notify the PHY of a state transition. Used to notify and
526 * configure the PHY accordingly.
530 int phy_notify_state(struct phy *phy, union phy_notify state) in phy_notify_state() argument
534 if (!phy || !phy->ops->notify_phystate) in phy_notify_state()
537 mutex_lock(&phy->mutex); in phy_notify_state()
538 ret = phy->ops->notify_phystate(phy, state); in phy_notify_state()
539 mutex_unlock(&phy->mutex); in phy_notify_state()
546 * phy_configure() - Changes the phy parameters
547 * @phy: the phy returned by phy_get()
550 * Used to change the PHY parameters. phy_init() must have been called
551 * on the phy. The configuration will be applied on the current phy
556 int phy_configure(struct phy *phy, union phy_configure_opts *opts) in phy_configure() argument
560 if (!phy) in phy_configure()
563 if (!phy->ops->configure) in phy_configure()
566 mutex_lock(&phy->mutex); in phy_configure()
567 ret = phy->ops->configure(phy, opts); in phy_configure()
568 mutex_unlock(&phy->mutex); in phy_configure()
575 * phy_validate() - Checks the phy parameters
576 * @phy: the phy returned by phy_get()
578 * @submode: PHY submode the configuration is applicable to.
582 * the phy. Implementations are free to tune the parameters passed as
585 * PHY, so calling it as many times as deemed fit will have no side
590 int phy_validate(struct phy *phy, enum phy_mode mode, int submode, in phy_validate() argument
595 if (!phy) in phy_validate()
598 if (!phy->ops->validate) in phy_validate()
601 mutex_lock(&phy->mutex); in phy_validate()
602 ret = phy->ops->validate(phy, mode, submode, opts); in phy_validate()
603 mutex_unlock(&phy->mutex); in phy_validate()
610 * _of_phy_get() - lookup and obtain a reference to a phy by phandle
611 * @np: device_node for which to get the phy
612 * @index: the index of the phy
614 * Returns the phy associated with the given phandle value,
615 * after getting a refcount to it or -ENODEV if there is no such phy or
616 * -EPROBE_DEFER if there is a phandle to the phy, but the device is
618 * while registering the phy_provider to find the phy instance.
620 static struct phy *_of_phy_get(struct device_node *np, int index) in _of_phy_get()
624 struct phy *phy = NULL; in _of_phy_get() local
627 ret = of_parse_phandle_with_args(np, "phys", "#phy-cells", in _of_phy_get()
632 /* This phy type handled by the usb-phy subsystem for now */ in _of_phy_get()
634 phy = ERR_PTR(-ENODEV); in _of_phy_get()
641 phy = ERR_PTR(-EPROBE_DEFER); in _of_phy_get()
646 dev_warn(phy_provider->dev, "Requested PHY is disabled\n"); in _of_phy_get()
647 phy = ERR_PTR(-ENODEV); in _of_phy_get()
651 phy = phy_provider->of_xlate(phy_provider->dev, &args); in _of_phy_get()
661 return phy; in _of_phy_get()
665 * of_phy_get() - lookup and obtain a reference to a phy using a device_node.
666 * @np: device_node for which to get the phy
667 * @con_id: name of the phy from device's point of view
669 * Returns the phy driver, after getting a refcount to it; or
670 * -ENODEV if there is no such phy. The caller is responsible for
673 struct phy *of_phy_get(struct device_node *np, const char *con_id) in of_phy_get()
675 struct phy *phy = NULL; in of_phy_get() local
679 index = of_property_match_string(np, "phy-names", con_id); in of_phy_get()
681 phy = _of_phy_get(np, index); in of_phy_get()
682 if (IS_ERR(phy)) in of_phy_get()
683 return phy; in of_phy_get()
685 if (!try_module_get(phy->ops->owner)) in of_phy_get()
688 get_device(&phy->dev); in of_phy_get()
690 return phy; in of_phy_get()
695 * of_phy_put() - release the PHY
696 * @phy: the phy returned by of_phy_get()
700 void of_phy_put(struct phy *phy) in of_phy_put() argument
702 if (!phy || IS_ERR(phy)) in of_phy_put()
705 mutex_lock(&phy->mutex); in of_phy_put()
706 if (phy->ops->release) in of_phy_put()
707 phy->ops->release(phy); in of_phy_put()
708 mutex_unlock(&phy->mutex); in of_phy_put()
710 module_put(phy->ops->owner); in of_phy_put()
711 put_device(&phy->dev); in of_phy_put()
716 * phy_put() - release the PHY
717 * @dev: device that wants to release this phy
718 * @phy: the phy returned by phy_get()
722 void phy_put(struct device *dev, struct phy *phy) in phy_put() argument
724 device_link_remove(dev, &phy->dev); in phy_put()
725 of_phy_put(phy); in phy_put()
730 * devm_phy_put() - release the PHY
731 * @dev: device that wants to release this phy
732 * @phy: the phy returned by devm_phy_get()
734 * destroys the devres associated with this phy and invokes phy_put
735 * to release the phy.
737 void devm_phy_put(struct device *dev, struct phy *phy) in devm_phy_put() argument
741 if (!phy) in devm_phy_put()
744 r = devres_release(dev, devm_phy_release, devm_phy_match, phy); in devm_phy_put()
745 dev_WARN_ONCE(dev, r, "couldn't find PHY resource\n"); in devm_phy_put()
750 * of_phy_simple_xlate() - returns the phy instance from phy provider
751 * @dev: the PHY provider device (not used here)
754 * Intended to be used by phy provider for the common case where #phy-cells is
755 * 0. For other cases where #phy-cells is greater than '0', the phy provider
757 * the appropriate phy.
759 struct phy *of_phy_simple_xlate(struct device *dev, in of_phy_simple_xlate()
774 * phy_get() - lookup and obtain a reference to a phy.
775 * @dev: device that requests this phy
776 * @string: the phy name as given in the dt data or the name of the controller
779 * Returns the phy driver, after getting a refcount to it; or
780 * -ENODEV if there is no such phy. The caller is responsible for
783 struct phy *phy_get(struct device *dev, const char *string) in phy_get()
786 struct phy *phy; in phy_get() local
791 index = of_property_match_string(dev->of_node, "phy-names", in phy_get()
795 phy = _of_phy_get(dev->of_node, index); in phy_get()
801 phy = phy_find(dev, string); in phy_get()
803 if (IS_ERR(phy)) in phy_get()
804 return phy; in phy_get()
806 if (!try_module_get(phy->ops->owner)) in phy_get()
809 get_device(&phy->dev); in phy_get()
811 link = device_link_add(dev, &phy->dev, DL_FLAG_STATELESS); in phy_get()
814 dev_name(phy->dev.parent)); in phy_get()
816 return phy; in phy_get()
821 * devm_phy_get() - lookup and obtain a reference to a phy.
822 * @dev: device that requests this phy
823 * @string: the phy name as given in the dt data or phy device name
826 * Gets the phy using phy_get(), and associates a device with it using
830 struct phy *devm_phy_get(struct device *dev, const char *string) in devm_phy_get()
832 struct phy **ptr, *phy; in devm_phy_get() local
838 phy = phy_get(dev, string); in devm_phy_get()
839 if (!IS_ERR(phy)) { in devm_phy_get()
840 *ptr = phy; in devm_phy_get()
846 return phy; in devm_phy_get()
851 * devm_phy_optional_get() - lookup and obtain a reference to an optional phy.
852 * @dev: device that requests this phy
853 * @string: the phy name as given in the dt data or phy device name
856 * Gets the phy using phy_get(), and associates a device with it using
859 * that if the phy does not exist, it is not considered an error and
860 * -ENODEV will not be returned. Instead the NULL phy is returned,
861 * which can be passed to all other phy consumer calls.
863 struct phy *devm_phy_optional_get(struct device *dev, const char *string) in devm_phy_optional_get()
865 struct phy *phy = devm_phy_get(dev, string); in devm_phy_optional_get() local
867 if (PTR_ERR(phy) == -ENODEV) in devm_phy_optional_get()
868 phy = NULL; in devm_phy_optional_get()
870 return phy; in devm_phy_optional_get()
875 * devm_of_phy_get() - lookup and obtain a reference to a phy.
876 * @dev: device that requests this phy
877 * @np: node containing the phy
878 * @con_id: name of the phy from device's point of view
880 * Gets the phy using of_phy_get(), and associates a device with it using
884 struct phy *devm_of_phy_get(struct device *dev, struct device_node *np, in devm_of_phy_get()
887 struct phy **ptr, *phy; in devm_of_phy_get() local
894 phy = of_phy_get(np, con_id); in devm_of_phy_get()
895 if (!IS_ERR(phy)) { in devm_of_phy_get()
896 *ptr = phy; in devm_of_phy_get()
900 return phy; in devm_of_phy_get()
903 link = device_link_add(dev, &phy->dev, DL_FLAG_STATELESS); in devm_of_phy_get()
906 dev_name(phy->dev.parent)); in devm_of_phy_get()
908 return phy; in devm_of_phy_get()
914 * phy.
915 * @dev: device that requests this phy
916 * @np: node containing the phy
917 * @con_id: name of the phy from device's point of view
919 * Gets the phy using of_phy_get(), and associates a device with it using
922 * that if the phy does not exist, it is not considered an error and
923 * -ENODEV will not be returned. Instead the NULL phy is returned,
924 * which can be passed to all other phy consumer calls.
926 struct phy *devm_of_phy_optional_get(struct device *dev, struct device_node *np, in devm_of_phy_optional_get()
929 struct phy *phy = devm_of_phy_get(dev, np, con_id); in devm_of_phy_optional_get() local
931 if (PTR_ERR(phy) == -ENODEV) in devm_of_phy_optional_get()
932 phy = NULL; in devm_of_phy_optional_get()
934 if (IS_ERR(phy)) in devm_of_phy_optional_get()
935 dev_err_probe(dev, PTR_ERR(phy), "failed to get PHY %pOF:%s", in devm_of_phy_optional_get()
938 return phy; in devm_of_phy_optional_get()
943 * devm_of_phy_get_by_index() - lookup and obtain a reference to a phy by index.
944 * @dev: device that requests this phy
945 * @np: node containing the phy
946 * @index: index of the phy
948 * Gets the phy using _of_phy_get(), then gets a refcount to it,
954 struct phy *devm_of_phy_get_by_index(struct device *dev, struct device_node *np, in devm_of_phy_get_by_index()
957 struct phy **ptr, *phy; in devm_of_phy_get_by_index() local
964 phy = _of_phy_get(np, index); in devm_of_phy_get_by_index()
965 if (IS_ERR(phy)) { in devm_of_phy_get_by_index()
967 return phy; in devm_of_phy_get_by_index()
970 if (!try_module_get(phy->ops->owner)) { in devm_of_phy_get_by_index()
975 get_device(&phy->dev); in devm_of_phy_get_by_index()
977 *ptr = phy; in devm_of_phy_get_by_index()
980 link = device_link_add(dev, &phy->dev, DL_FLAG_STATELESS); in devm_of_phy_get_by_index()
983 dev_name(phy->dev.parent)); in devm_of_phy_get_by_index()
985 return phy; in devm_of_phy_get_by_index()
990 * phy_create() - create a new phy
991 * @dev: device that is creating the new phy
992 * @node: device node of the phy
993 * @ops: function pointers for performing phy operations
995 * Called to create a phy using phy framework.
997 struct phy *phy_create(struct device *dev, struct device_node *node, in phy_create()
1002 struct phy *phy; in phy_create() local
1007 phy = kzalloc_obj(*phy); in phy_create()
1008 if (!phy) in phy_create()
1018 device_initialize(&phy->dev); in phy_create()
1019 lockdep_register_key(&phy->lockdep_key); in phy_create()
1020 mutex_init_with_key(&phy->mutex, &phy->lockdep_key); in phy_create()
1022 phy->dev.class = &phy_class; in phy_create()
1023 phy->dev.parent = dev; in phy_create()
1024 phy->dev.of_node = node ?: dev->of_node; in phy_create()
1025 phy->id = id; in phy_create()
1026 phy->ops = ops; in phy_create()
1028 ret = dev_set_name(&phy->dev, "phy-%s.%d", dev_name(dev), id); in phy_create()
1032 /* phy-supply */ in phy_create()
1033 phy->pwr = regulator_get_optional(&phy->dev, "phy"); in phy_create()
1034 if (IS_ERR(phy->pwr)) { in phy_create()
1035 ret = PTR_ERR(phy->pwr); in phy_create()
1039 phy->pwr = NULL; in phy_create()
1042 ret = device_add(&phy->dev); in phy_create()
1047 pm_runtime_enable(&phy->dev); in phy_create()
1048 pm_runtime_no_callbacks(&phy->dev); in phy_create()
1051 phy->debugfs = debugfs_create_dir(dev_name(&phy->dev), phy_debugfs_root); in phy_create()
1053 return phy; in phy_create()
1056 put_device(&phy->dev); /* calls phy_release() which frees resources */ in phy_create()
1060 kfree(phy); in phy_create()
1066 * devm_phy_create() - create a new phy
1067 * @dev: device that is creating the new phy
1068 * @node: device node of the phy
1069 * @ops: function pointers for performing phy operations
1071 * Creates a new PHY device adding it to the PHY class.
1072 * While at that, it also associates the device with the phy using devres.
1076 struct phy *devm_phy_create(struct device *dev, struct device_node *node, in devm_phy_create()
1079 struct phy **ptr, *phy; in devm_phy_create() local
1085 phy = phy_create(dev, node, ops); in devm_phy_create()
1086 if (!IS_ERR(phy)) { in devm_phy_create()
1087 *ptr = phy; in devm_phy_create()
1093 return phy; in devm_phy_create()
1098 * phy_destroy() - destroy the phy
1099 * @phy: the phy to be destroyed
1101 * Called to destroy the phy.
1103 void phy_destroy(struct phy *phy) in phy_destroy() argument
1105 pm_runtime_disable(&phy->dev); in phy_destroy()
1106 device_unregister(&phy->dev); in phy_destroy()
1111 * devm_phy_destroy() - destroy the PHY
1112 * @dev: device that wants to release this phy
1113 * @phy: the phy returned by devm_phy_get()
1115 * destroys the devres associated with this phy and invokes phy_destroy
1116 * to destroy the phy.
1118 void devm_phy_destroy(struct device *dev, struct phy *phy) in devm_phy_destroy() argument
1122 r = devres_release(dev, devm_phy_consume, devm_phy_match, phy); in devm_phy_destroy()
1123 dev_WARN_ONCE(dev, r, "couldn't find PHY resource\n"); in devm_phy_destroy()
1128 * __of_phy_provider_register() - create/register phy provider with the framework
1129 * @dev: struct device of the phy provider
1132 * @of_xlate: function pointer to obtain phy instance from phy provider
1135 * This is used in the case of dt boot for finding the phy instance from
1136 * phy provider.
1138 * If the PHY provider doesn't nest children directly but uses a separate
1147 struct phy * (*of_xlate)(struct device *dev, in __of_phy_provider_register()
1195 * __devm_of_phy_provider_register() - create/register phy provider with the
1197 * @dev: struct device of the phy provider
1200 * @of_xlate: function pointer to obtain phy instance from phy provider
1203 * This is used in the case of dt boot for finding the phy instance from
1204 * phy provider. While at that, it also associates the device with the
1205 * phy provider using devres. On driver detach, release function is invoked
1210 struct phy * (*of_xlate)(struct device *dev, in __devm_of_phy_provider_register()
1233 * of_phy_provider_unregister() - unregister phy provider from the framework
1234 * @phy_provider: phy provider returned by of_phy_provider_register()
1252 * devm_of_phy_provider_unregister() - remove phy provider from the framework
1253 * @dev: struct device of the phy provider
1254 * @phy_provider: phy provider returned by of_phy_provider_register()
1256 * destroys the devres associated with this phy provider and invokes
1257 * of_phy_provider_unregister to unregister the phy provider.
1266 dev_WARN_ONCE(dev, r, "couldn't find PHY provider device resource\n"); in devm_of_phy_provider_unregister()
1271 * phy_release() - release the phy
1272 * @dev: the dev member within phy
1279 struct phy *phy; in phy_release() local
1281 phy = to_phy(dev); in phy_release()
1283 debugfs_remove_recursive(phy->debugfs); in phy_release()
1284 regulator_put(phy->pwr); in phy_release()
1285 mutex_destroy(&phy->mutex); in phy_release()
1286 lockdep_unregister_key(&phy->lockdep_key); in phy_release()
1287 ida_free(&phy_ida, phy->id); in phy_release()
1288 kfree(phy); in phy_release()
1297 pr_err("failed to register phy class"); in phy_core_init()
1301 phy_debugfs_root = debugfs_create_dir("phy", NULL); in phy_core_init()