include/linux/usb/phy.h
Source file repositories/reference/linux-study-clean/include/linux/usb/phy.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/usb/phy.h- Extension
.h- Size
- 8286 bytes
- Lines
- 357
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/extcon.hlinux/notifier.hlinux/usb.huapi/linux/usb/charger.h
Detected Declarations
struct usb_phystruct usb_otgstruct usb_phy_io_opsstruct usb_charger_currentstruct usb_phyenum usb_phy_interfaceenum usb_phy_eventsenum usb_phy_typeenum usb_otg_statefunction usb_phy_io_readfunction usb_phy_io_writefunction usb_phy_initfunction usb_phy_shutdownfunction usb_phy_vbus_onfunction usb_phy_vbus_offfunction usb_put_phyfunction usb_phy_set_suspendfunction usb_phy_set_wakeupfunction usb_phy_notify_connectfunction usb_phy_notify_disconnectfunction usb_register_notifierfunction usb_unregister_notifier
Annotated Snippet
struct usb_phy_io_ops {
int (*read)(struct usb_phy *x, u32 reg);
int (*write)(struct usb_phy *x, u32 val, u32 reg);
};
struct usb_charger_current {
unsigned int sdp_min;
unsigned int sdp_max;
unsigned int dcp_min;
unsigned int dcp_max;
unsigned int cdp_min;
unsigned int cdp_max;
unsigned int aca_min;
unsigned int aca_max;
};
struct usb_phy {
struct device *dev;
const char *label;
unsigned int flags;
enum usb_phy_type type;
enum usb_phy_events last_event;
struct usb_otg *otg;
struct device *io_dev;
struct usb_phy_io_ops *io_ops;
void __iomem *io_priv;
/* to support extcon device */
struct extcon_dev *edev;
struct extcon_dev *id_edev;
struct notifier_block vbus_nb;
struct notifier_block id_nb;
struct notifier_block type_nb;
/* Support USB charger */
enum usb_charger_type chg_type;
enum usb_charger_state chg_state;
struct usb_charger_current chg_cur;
struct work_struct chg_work;
/* for notification of usb_phy_events */
struct atomic_notifier_head notifier;
/* to pass extra port status to the root hub */
u16 port_status;
u16 port_change;
/* to support controllers that have multiple phys */
struct list_head head;
/* initialize/shutdown the phy */
int (*init)(struct usb_phy *x);
void (*shutdown)(struct usb_phy *x);
/* enable/disable VBUS */
int (*set_vbus)(struct usb_phy *x, int on);
/* effective for B devices, ignored for A-peripheral */
int (*set_power)(struct usb_phy *x,
unsigned mA);
/* Set phy into suspend mode */
int (*set_suspend)(struct usb_phy *x,
int suspend);
/*
* Set wakeup enable for PHY, in that case, the PHY can be
* woken up from suspend status due to external events,
* like vbus change, dp/dm change and id.
*/
int (*set_wakeup)(struct usb_phy *x, bool enabled);
/* notify phy connect status change */
int (*notify_connect)(struct usb_phy *x,
enum usb_device_speed speed);
int (*notify_disconnect)(struct usb_phy *x,
enum usb_device_speed speed);
/*
* Charger detection method can be implemented if you need to
* manually detect the charger type.
*/
enum usb_charger_type (*charger_detect)(struct usb_phy *x);
};
/* for board-specific init logic */
extern int usb_add_phy(struct usb_phy *, enum usb_phy_type type);
Annotation
- Immediate include surface: `linux/extcon.h`, `linux/notifier.h`, `linux/usb.h`, `uapi/linux/usb/charger.h`.
- Detected declarations: `struct usb_phy`, `struct usb_otg`, `struct usb_phy_io_ops`, `struct usb_charger_current`, `struct usb_phy`, `enum usb_phy_interface`, `enum usb_phy_events`, `enum usb_phy_type`, `enum usb_otg_state`, `function usb_phy_io_read`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.