drivers/net/phy/qcom/qca807x.c
Source file repositories/reference/linux-study-clean/drivers/net/phy/qcom/qca807x.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/phy/qcom/qca807x.c- Extension
.c- Size
- 24198 bytes
- Lines
- 857
- Domain
- Driver Families
- Bucket
- drivers/net
- 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/of.hlinux/phy.hlinux/bitfield.hlinux/gpio/driver.hlinux/phy_port.h../phylib.hqcom.h
Detected Declarations
struct qca807x_shared_privstruct qca807x_gpio_privstruct qca807x_privenum qca807x_global_phyfunction qca807x_cable_test_startfunction qca807x_led_parse_netdevfunction qca807x_led_hw_control_enablefunction qca807x_led_hw_is_supportedfunction qca807x_led_hw_control_setfunction qca807x_led_hw_control_statusfunction qca807x_led_hw_control_getfunction qca807x_led_hw_control_resetfunction qca807x_led_brightness_setfunction qca807x_led_blink_setfunction qca807x_gpio_get_directionfunction qca807x_gpio_getfunction qca807x_gpio_setfunction qca807x_gpio_dir_outfunction qca807x_gpiofunction qca807x_read_fiber_statusfunction qca807x_read_statusfunction qca807x_phy_package_probe_oncefunction qca807x_phy_package_config_init_oncefunction qca807x_configure_serdesfunction qca807x_attach_mii_portfunction qca807x_probefunction qca807x_config_initfunction qca807x_update_statsfunction qca807x_get_phy_stats
Annotated Snippet
struct qca807x_shared_priv {
unsigned int package_mode;
u32 tx_drive_strength;
};
struct qca807x_gpio_priv {
struct phy_device *phy;
};
struct qca807x_priv {
bool dac_full_amplitude;
bool dac_full_bias_current;
bool dac_disable_bias_current_tweak;
struct qcom_phy_hw_stats hw_stats;
};
static int qca807x_cable_test_start(struct phy_device *phydev)
{
/* we do all the (time consuming) work later */
return 0;
}
static int qca807x_led_parse_netdev(struct phy_device *phydev, unsigned long rules,
u16 *offload_trigger)
{
/* Parsing specific to netdev trigger */
switch (phydev->port) {
case PORT_TP:
if (test_bit(TRIGGER_NETDEV_TX, &rules))
*offload_trigger |= QCA808X_LED_TX_BLINK;
if (test_bit(TRIGGER_NETDEV_RX, &rules))
*offload_trigger |= QCA808X_LED_RX_BLINK;
if (test_bit(TRIGGER_NETDEV_LINK_10, &rules))
*offload_trigger |= QCA808X_LED_SPEED10_ON;
if (test_bit(TRIGGER_NETDEV_LINK_100, &rules))
*offload_trigger |= QCA808X_LED_SPEED100_ON;
if (test_bit(TRIGGER_NETDEV_LINK_1000, &rules))
*offload_trigger |= QCA808X_LED_SPEED1000_ON;
if (test_bit(TRIGGER_NETDEV_HALF_DUPLEX, &rules))
*offload_trigger |= QCA808X_LED_HALF_DUPLEX_ON;
if (test_bit(TRIGGER_NETDEV_FULL_DUPLEX, &rules))
*offload_trigger |= QCA808X_LED_FULL_DUPLEX_ON;
break;
case PORT_FIBRE:
if (test_bit(TRIGGER_NETDEV_TX, &rules))
*offload_trigger |= QCA807X_LED_FIBER_TXACT_BLK_EN;
if (test_bit(TRIGGER_NETDEV_RX, &rules))
*offload_trigger |= QCA807X_LED_FIBER_RXACT_BLK_EN;
if (test_bit(TRIGGER_NETDEV_LINK_100, &rules))
*offload_trigger |= QCA807X_LED_FIBER_100FX_ON_EN;
if (test_bit(TRIGGER_NETDEV_LINK_1000, &rules))
*offload_trigger |= QCA807X_LED_FIBER_1000BX_ON_EN;
if (test_bit(TRIGGER_NETDEV_HALF_DUPLEX, &rules))
*offload_trigger |= QCA807X_LED_FIBER_HDX_ON_EN;
if (test_bit(TRIGGER_NETDEV_FULL_DUPLEX, &rules))
*offload_trigger |= QCA807X_LED_FIBER_FDX_ON_EN;
break;
default:
return -EOPNOTSUPP;
}
if (rules && !*offload_trigger)
return -EOPNOTSUPP;
return 0;
}
static int qca807x_led_hw_control_enable(struct phy_device *phydev, u8 index)
{
u16 reg;
if (index > 1)
return -EINVAL;
reg = QCA807X_MMD7_LED_FORCE_CTRL(index);
return qca808x_led_reg_hw_control_enable(phydev, reg);
}
static int qca807x_led_hw_is_supported(struct phy_device *phydev, u8 index,
unsigned long rules)
{
u16 offload_trigger = 0;
if (index > 1)
return -EINVAL;
return qca807x_led_parse_netdev(phydev, rules, &offload_trigger);
}
static int qca807x_led_hw_control_set(struct phy_device *phydev, u8 index,
Annotation
- Immediate include surface: `linux/module.h`, `linux/of.h`, `linux/phy.h`, `linux/bitfield.h`, `linux/gpio/driver.h`, `linux/phy_port.h`, `../phylib.h`, `qcom.h`.
- Detected declarations: `struct qca807x_shared_priv`, `struct qca807x_gpio_priv`, `struct qca807x_priv`, `enum qca807x_global_phy`, `function qca807x_cable_test_start`, `function qca807x_led_parse_netdev`, `function qca807x_led_hw_control_enable`, `function qca807x_led_hw_is_supported`, `function qca807x_led_hw_control_set`, `function qca807x_led_hw_control_status`.
- Atlas domain: Driver Families / drivers/net.
- 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.