drivers/phy/qualcomm/phy-qcom-usb-hs.c
Source file repositories/reference/linux-study-clean/drivers/phy/qualcomm/phy-qcom-usb-hs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/phy/qualcomm/phy-qcom-usb-hs.c- Extension
.c- Size
- 6730 bytes
- Lines
- 291
- Domain
- Driver Families
- Bucket
- drivers/phy
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/ulpi/driver.hlinux/ulpi/regs.hlinux/clk.hlinux/regulator/consumer.hlinux/of.hlinux/phy/phy.hlinux/reset.hlinux/extcon.hlinux/notifier.h
Detected Declarations
struct ulpi_seqstruct qcom_usb_hs_phyfunction qcom_usb_hs_phy_set_modefunction qcom_usb_hs_phy_vbus_notifierfunction qcom_usb_hs_phy_power_onfunction qcom_usb_hs_phy_power_offfunction qcom_usb_hs_phy_probe
Annotated Snippet
struct ulpi_seq {
u8 addr;
u8 val;
};
struct qcom_usb_hs_phy {
struct ulpi *ulpi;
struct phy *phy;
struct clk *ref_clk;
struct clk *sleep_clk;
struct regulator *v1p8;
struct regulator *v3p3;
struct reset_control *reset;
struct ulpi_seq *init_seq;
struct extcon_dev *vbus_edev;
struct notifier_block vbus_notify;
};
static int qcom_usb_hs_phy_set_mode(struct phy *phy,
enum phy_mode mode, int submode)
{
struct qcom_usb_hs_phy *uphy = phy_get_drvdata(phy);
u8 addr;
int ret;
if (!uphy->vbus_edev) {
u8 val = 0;
switch (mode) {
case PHY_MODE_USB_OTG:
case PHY_MODE_USB_HOST:
val |= ULPI_INT_IDGRD;
fallthrough;
case PHY_MODE_USB_DEVICE:
val |= ULPI_INT_SESS_VALID;
break;
default:
break;
}
ret = ulpi_write(uphy->ulpi, ULPI_USB_INT_EN_RISE, val);
if (ret)
return ret;
ret = ulpi_write(uphy->ulpi, ULPI_USB_INT_EN_FALL, val);
} else {
switch (mode) {
case PHY_MODE_USB_OTG:
case PHY_MODE_USB_DEVICE:
addr = ULPI_SET(ULPI_MISC_A);
break;
case PHY_MODE_USB_HOST:
addr = ULPI_CLR(ULPI_MISC_A);
break;
default:
return -EINVAL;
}
ret = ulpi_write(uphy->ulpi, ULPI_SET(ULPI_PWR_CLK_MNG_REG),
ULPI_PWR_OTG_COMP_DISABLE);
if (ret)
return ret;
ret = ulpi_write(uphy->ulpi, addr, ULPI_MISC_A_VBUSVLDEXTSEL);
}
return ret;
}
static int
qcom_usb_hs_phy_vbus_notifier(struct notifier_block *nb, unsigned long event,
void *ptr)
{
struct qcom_usb_hs_phy *uphy;
u8 addr;
uphy = container_of(nb, struct qcom_usb_hs_phy, vbus_notify);
if (event)
addr = ULPI_SET(ULPI_MISC_A);
else
addr = ULPI_CLR(ULPI_MISC_A);
return ulpi_write(uphy->ulpi, addr, ULPI_MISC_A_VBUSVLDEXT);
}
static int qcom_usb_hs_phy_power_on(struct phy *phy)
{
struct qcom_usb_hs_phy *uphy = phy_get_drvdata(phy);
struct ulpi *ulpi = uphy->ulpi;
const struct ulpi_seq *seq;
int ret, state;
Annotation
- Immediate include surface: `linux/module.h`, `linux/ulpi/driver.h`, `linux/ulpi/regs.h`, `linux/clk.h`, `linux/regulator/consumer.h`, `linux/of.h`, `linux/phy/phy.h`, `linux/reset.h`.
- Detected declarations: `struct ulpi_seq`, `struct qcom_usb_hs_phy`, `function qcom_usb_hs_phy_set_mode`, `function qcom_usb_hs_phy_vbus_notifier`, `function qcom_usb_hs_phy_power_on`, `function qcom_usb_hs_phy_power_off`, `function qcom_usb_hs_phy_probe`.
- Atlas domain: Driver Families / drivers/phy.
- 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.