include/linux/phy/phy.h
Source file repositories/reference/linux-study-clean/include/linux/phy/phy.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/phy/phy.h- Extension
.h- Size
- 14774 bytes
- Lines
- 575
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/err.hlinux/of.hlinux/device.hlinux/pm_runtime.hlinux/regulator/consumer.hlinux/phy/phy-dp.hlinux/phy/phy-hdmi.hlinux/phy/phy-lvds.hlinux/phy/phy-mipi-dphy.h
Detected Declarations
struct phystruct phy_opsstruct phy_attrsstruct phystruct phy_providerstruct phy_lookupenum phy_modeenum phy_mediaenum phy_ufs_statefunction phy_set_drvdatafunction phy_get_modefunction phy_get_bus_widthfunction phy_set_bus_widthfunction phy_pm_runtime_getfunction phy_pm_runtime_get_syncfunction phy_pm_runtime_putfunction phy_initfunction phy_exitfunction phy_power_onfunction phy_power_offfunction phy_set_mode_extfunction phy_set_mediafunction phy_set_speedfunction phy_get_modefunction phy_resetfunction phy_calibratefunction phy_notify_connectfunction phy_notify_disconnectfunction phy_notify_statefunction phy_configurefunction phy_validatefunction phy_get_bus_widthfunction phy_set_bus_widthfunction of_phy_putfunction phy_destroyfunction of_phy_provider_unregisterfunction phy_remove_lookup
Annotated Snippet
struct phy_ops {
int (*init)(struct phy *phy);
int (*exit)(struct phy *phy);
int (*power_on)(struct phy *phy);
int (*power_off)(struct phy *phy);
int (*set_mode)(struct phy *phy, enum phy_mode mode, int submode);
int (*set_media)(struct phy *phy, enum phy_media media);
int (*set_speed)(struct phy *phy, int speed);
/**
* @configure:
*
* Optional.
*
* Used to change the PHY parameters. phy_init() must have
* been called on the phy.
*
* Returns: 0 if successful, an negative error code otherwise
*/
int (*configure)(struct phy *phy, union phy_configure_opts *opts);
/**
* @validate:
*
* Optional.
*
* Used to check that the current set of parameters can be
* handled by the phy. Implementations are free to tune the
* parameters passed as arguments if needed by some
* implementation detail or constraints. It must not change
* any actual configuration of the PHY, so calling it as many
* times as deemed fit by the consumer must have no side
* effect.
*
* Returns: 0 if the configuration can be applied, an negative
* error code otherwise
*/
int (*validate)(struct phy *phy, enum phy_mode mode, int submode,
union phy_configure_opts *opts);
int (*reset)(struct phy *phy);
int (*calibrate)(struct phy *phy);
/* notify phy connect status change */
int (*connect)(struct phy *phy, int port);
int (*disconnect)(struct phy *phy, int port);
int (*notify_phystate)(struct phy *phy, union phy_notify state);
void (*release)(struct phy *phy);
struct module *owner;
};
/**
* struct phy_attrs - represents phy attributes
* @bus_width: Data path width implemented by PHY
* @max_link_rate: Maximum link rate supported by PHY (units to be decided by producer and consumer)
* @mode: PHY mode
*/
struct phy_attrs {
u32 bus_width;
u32 max_link_rate;
enum phy_mode mode;
};
/**
* struct phy - represents the phy device
* @dev: phy device
* @id: id of the phy device
* @ops: function pointers for performing phy operations
* @mutex: mutex to protect phy_ops
* @lockdep_key: lockdep information for this mutex
* @init_count: used to protect when the PHY is used by multiple consumers
* @power_count: used to protect when the PHY is used by multiple consumers
* @attrs: used to specify PHY specific attributes
* @pwr: power regulator associated with the phy
* @debugfs: debugfs directory
*/
struct phy {
struct device dev;
int id;
const struct phy_ops *ops;
struct mutex mutex;
struct lock_class_key lockdep_key;
int init_count;
int power_count;
struct phy_attrs attrs;
struct regulator *pwr;
struct dentry *debugfs;
};
/**
Annotation
- Immediate include surface: `linux/err.h`, `linux/of.h`, `linux/device.h`, `linux/pm_runtime.h`, `linux/regulator/consumer.h`, `linux/phy/phy-dp.h`, `linux/phy/phy-hdmi.h`, `linux/phy/phy-lvds.h`.
- Detected declarations: `struct phy`, `struct phy_ops`, `struct phy_attrs`, `struct phy`, `struct phy_provider`, `struct phy_lookup`, `enum phy_mode`, `enum phy_media`, `enum phy_ufs_state`, `function phy_set_drvdata`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.