Lines Matching +full:phy +full:- +full:mode
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * phy.h -- generic phy header file
5 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
19 #include <linux/phy/phy-mipi-dphy.h>
21 struct phy;
45 * union phy_configure_opts - Opaque generic phy configuration
48 * the MIPI_DPHY phy mode.
55 * struct phy_ops - set of function pointers for performing phy operations
56 * @init: operation to be performed for initializing phy
58 * @power_on: powering on the phy
59 * @power_off: powering off the phy
60 * @set_mode: set the mode of the phy
61 * @reset: resetting the phy
62 * @calibrate: calibrate the phy
63 * @release: ops to be performed while the consumer relinquishes the PHY
67 int (*init)(struct phy *phy);
68 int (*exit)(struct phy *phy);
69 int (*power_on)(struct phy *phy);
70 int (*power_off)(struct phy *phy);
71 int (*set_mode)(struct phy *phy, enum phy_mode mode, int submode);
78 * Used to change the PHY parameters. phy_init() must have
79 * been called on the phy.
83 int (*configure)(struct phy *phy, union phy_configure_opts *opts);
91 * handled by the phy. Implementations are free to tune the
94 * any actual configuration of the PHY, so calling it as many
101 int (*validate)(struct phy *phy, enum phy_mode mode, int submode,
103 int (*reset)(struct phy *phy);
104 int (*calibrate)(struct phy *phy);
105 void (*release)(struct phy *phy);
110 * struct phy_attrs - represents phy attributes
111 * @bus_width: Data path width implemented by PHY
112 * @mode: PHY mode
116 enum phy_mode mode; member
120 * struct phy - represents the phy device
121 * @dev: phy device
122 * @id: id of the phy device
123 * @ops: function pointers for performing phy operations
125 * @init_count: used to protect when the PHY is used by multiple consumers
126 * @power_count: used to protect when the PHY is used by multiple consumers
127 * @attrs: used to specify PHY specific attributes
128 * @pwr: power regulator associated with the phy
130 struct phy { struct
142 * struct phy_provider - represents the phy provider argument
143 * @dev: phy provider device
144 * @children: can be used to override the default (dev->of_node) child node
146 * @list: to maintain a linked list of PHY providers
147 * @of_xlate: function pointer to obtain phy instance from phy pointer
154 struct phy * (*of_xlate)(struct device *dev,
159 * struct phy_lookup - PHY association in list of phys managed by the phy driver
163 * @phy: the phy of the association
169 struct phy *phy; member
172 #define to_phy(a) (container_of((a), struct phy, dev))
186 static inline void phy_set_drvdata(struct phy *phy, void *data) in phy_set_drvdata() argument
188 dev_set_drvdata(&phy->dev, data); in phy_set_drvdata()
191 static inline void *phy_get_drvdata(struct phy *phy) in phy_get_drvdata() argument
193 return dev_get_drvdata(&phy->dev); in phy_get_drvdata()
197 int phy_pm_runtime_get(struct phy *phy);
198 int phy_pm_runtime_get_sync(struct phy *phy);
199 int phy_pm_runtime_put(struct phy *phy);
200 int phy_pm_runtime_put_sync(struct phy *phy);
201 void phy_pm_runtime_allow(struct phy *phy);
202 void phy_pm_runtime_forbid(struct phy *phy);
203 int phy_init(struct phy *phy);
204 int phy_exit(struct phy *phy);
205 int phy_power_on(struct phy *phy);
206 int phy_power_off(struct phy *phy);
207 int phy_set_mode_ext(struct phy *phy, enum phy_mode mode, int submode);
208 #define phy_set_mode(phy, mode) \ argument
209 phy_set_mode_ext(phy, mode, 0)
210 int phy_configure(struct phy *phy, union phy_configure_opts *opts);
211 int phy_validate(struct phy *phy, enum phy_mode mode, int submode,
214 static inline enum phy_mode phy_get_mode(struct phy *phy) in phy_get_mode() argument
216 return phy->attrs.mode; in phy_get_mode()
218 int phy_reset(struct phy *phy);
219 int phy_calibrate(struct phy *phy);
220 static inline int phy_get_bus_width(struct phy *phy) in phy_get_bus_width() argument
222 return phy->attrs.bus_width; in phy_get_bus_width()
224 static inline void phy_set_bus_width(struct phy *phy, int bus_width) in phy_set_bus_width() argument
226 phy->attrs.bus_width = bus_width; in phy_set_bus_width()
228 struct phy *phy_get(struct device *dev, const char *string);
229 struct phy *phy_optional_get(struct device *dev, const char *string);
230 struct phy *devm_phy_get(struct device *dev, const char *string);
231 struct phy *devm_phy_optional_get(struct device *dev, const char *string);
232 struct phy *devm_of_phy_get(struct device *dev, struct device_node *np,
234 struct phy *devm_of_phy_get_by_index(struct device *dev, struct device_node *np,
236 void phy_put(struct phy *phy);
237 void devm_phy_put(struct device *dev, struct phy *phy);
238 struct phy *of_phy_get(struct device_node *np, const char *con_id);
239 struct phy *of_phy_simple_xlate(struct device *dev,
241 struct phy *phy_create(struct device *dev, struct device_node *node,
243 struct phy *devm_phy_create(struct device *dev, struct device_node *node,
245 void phy_destroy(struct phy *phy);
246 void devm_phy_destroy(struct device *dev, struct phy *phy);
249 struct phy * (*of_xlate)(struct device *dev,
253 struct phy * (*of_xlate)(struct device *dev,
258 int phy_create_lookup(struct phy *phy, const char *con_id, const char *dev_id);
259 void phy_remove_lookup(struct phy *phy, const char *con_id, const char *dev_id);
261 static inline int phy_pm_runtime_get(struct phy *phy) in phy_pm_runtime_get() argument
263 if (!phy) in phy_pm_runtime_get()
265 return -ENOSYS; in phy_pm_runtime_get()
268 static inline int phy_pm_runtime_get_sync(struct phy *phy) in phy_pm_runtime_get_sync() argument
270 if (!phy) in phy_pm_runtime_get_sync()
272 return -ENOSYS; in phy_pm_runtime_get_sync()
275 static inline int phy_pm_runtime_put(struct phy *phy) in phy_pm_runtime_put() argument
277 if (!phy) in phy_pm_runtime_put()
279 return -ENOSYS; in phy_pm_runtime_put()
282 static inline int phy_pm_runtime_put_sync(struct phy *phy) in phy_pm_runtime_put_sync() argument
284 if (!phy) in phy_pm_runtime_put_sync()
286 return -ENOSYS; in phy_pm_runtime_put_sync()
289 static inline void phy_pm_runtime_allow(struct phy *phy) in phy_pm_runtime_allow() argument
294 static inline void phy_pm_runtime_forbid(struct phy *phy) in phy_pm_runtime_forbid() argument
299 static inline int phy_init(struct phy *phy) in phy_init() argument
301 if (!phy) in phy_init()
303 return -ENOSYS; in phy_init()
306 static inline int phy_exit(struct phy *phy) in phy_exit() argument
308 if (!phy) in phy_exit()
310 return -ENOSYS; in phy_exit()
313 static inline int phy_power_on(struct phy *phy) in phy_power_on() argument
315 if (!phy) in phy_power_on()
317 return -ENOSYS; in phy_power_on()
320 static inline int phy_power_off(struct phy *phy) in phy_power_off() argument
322 if (!phy) in phy_power_off()
324 return -ENOSYS; in phy_power_off()
327 static inline int phy_set_mode_ext(struct phy *phy, enum phy_mode mode, in phy_set_mode_ext() argument
330 if (!phy) in phy_set_mode_ext()
332 return -ENOSYS; in phy_set_mode_ext()
335 #define phy_set_mode(phy, mode) \ argument
336 phy_set_mode_ext(phy, mode, 0)
338 static inline enum phy_mode phy_get_mode(struct phy *phy) in phy_get_mode() argument
343 static inline int phy_reset(struct phy *phy) in phy_reset() argument
345 if (!phy) in phy_reset()
347 return -ENOSYS; in phy_reset()
350 static inline int phy_calibrate(struct phy *phy) in phy_calibrate() argument
352 if (!phy) in phy_calibrate()
354 return -ENOSYS; in phy_calibrate()
357 static inline int phy_configure(struct phy *phy, in phy_configure() argument
360 if (!phy) in phy_configure()
363 return -ENOSYS; in phy_configure()
366 static inline int phy_validate(struct phy *phy, enum phy_mode mode, int submode, in phy_validate() argument
369 if (!phy) in phy_validate()
372 return -ENOSYS; in phy_validate()
375 static inline int phy_get_bus_width(struct phy *phy) in phy_get_bus_width() argument
377 return -ENOSYS; in phy_get_bus_width()
380 static inline void phy_set_bus_width(struct phy *phy, int bus_width) in phy_set_bus_width() argument
385 static inline struct phy *phy_get(struct device *dev, const char *string) in phy_get()
387 return ERR_PTR(-ENOSYS); in phy_get()
390 static inline struct phy *phy_optional_get(struct device *dev, in phy_optional_get()
393 return ERR_PTR(-ENOSYS); in phy_optional_get()
396 static inline struct phy *devm_phy_get(struct device *dev, const char *string) in devm_phy_get()
398 return ERR_PTR(-ENOSYS); in devm_phy_get()
401 static inline struct phy *devm_phy_optional_get(struct device *dev, in devm_phy_optional_get()
407 static inline struct phy *devm_of_phy_get(struct device *dev, in devm_of_phy_get()
411 return ERR_PTR(-ENOSYS); in devm_of_phy_get()
414 static inline struct phy *devm_of_phy_get_by_index(struct device *dev, in devm_of_phy_get_by_index()
418 return ERR_PTR(-ENOSYS); in devm_of_phy_get_by_index()
421 static inline void phy_put(struct phy *phy) in phy_put() argument
425 static inline void devm_phy_put(struct device *dev, struct phy *phy) in devm_phy_put() argument
429 static inline struct phy *of_phy_get(struct device_node *np, const char *con_id) in of_phy_get()
431 return ERR_PTR(-ENOSYS); in of_phy_get()
434 static inline struct phy *of_phy_simple_xlate(struct device *dev, in of_phy_simple_xlate()
437 return ERR_PTR(-ENOSYS); in of_phy_simple_xlate()
440 static inline struct phy *phy_create(struct device *dev, in phy_create()
444 return ERR_PTR(-ENOSYS); in phy_create()
447 static inline struct phy *devm_phy_create(struct device *dev, in devm_phy_create()
451 return ERR_PTR(-ENOSYS); in devm_phy_create()
454 static inline void phy_destroy(struct phy *phy) in phy_destroy() argument
458 static inline void devm_phy_destroy(struct device *dev, struct phy *phy) in devm_phy_destroy() argument
464 struct phy * (*of_xlate)(struct device *dev, in __of_phy_provider_register()
467 return ERR_PTR(-ENOSYS); in __of_phy_provider_register()
472 struct phy * (*of_xlate)(struct device *dev, in __devm_of_phy_provider_register()
475 return ERR_PTR(-ENOSYS); in __devm_of_phy_provider_register()
487 phy_create_lookup(struct phy *phy, const char *con_id, const char *dev_id) in phy_create_lookup() argument
491 static inline void phy_remove_lookup(struct phy *phy, const char *con_id, in phy_remove_lookup() argument