drivers/net/pse-pd/si3474.c
Source file repositories/reference/linux-study-clean/drivers/net/pse-pd/si3474.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/pse-pd/si3474.c- Extension
.c- Size
- 15621 bytes
- Lines
- 579
- 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/i2c.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/pse-pd/pse.h
Detected Declarations
struct si3474_pi_descstruct si3474_privfunction si3474_get_channelsfunction si3474_pi_get_admin_statefunction si3474_pi_get_pw_statusfunction si3474_get_of_channelsfunction si3474_setup_pi_matrixfunction si3474_pi_enablefunction si3474_pi_disablefunction si3474_pi_get_chan_currentfunction si3474_pi_get_chan_voltagefunction si3474_pi_get_voltagefunction si3474_pi_get_actual_pwfunction si3474_ancillary_i2c_removefunction si3474_i2c_probe
Annotated Snippet
struct si3474_pi_desc {
u8 chan[2];
bool is_4p;
};
struct si3474_priv {
struct i2c_client *client[2];
struct pse_controller_dev pcdev;
struct device_node *np;
struct si3474_pi_desc pi[SI3474_MAX_CHANS];
};
static struct si3474_priv *to_si3474_priv(struct pse_controller_dev *pcdev)
{
return container_of(pcdev, struct si3474_priv, pcdev);
}
static void si3474_get_channels(struct si3474_priv *priv, int id,
u8 *chan0, u8 *chan1)
{
*chan0 = priv->pi[id].chan[0];
*chan1 = priv->pi[id].chan[1];
}
static struct i2c_client *si3474_get_chan_client(struct si3474_priv *priv,
u8 chan)
{
return (chan < 4) ? priv->client[0] : priv->client[1];
}
static int si3474_pi_get_admin_state(struct pse_controller_dev *pcdev, int id,
struct pse_admin_state *admin_state)
{
struct si3474_priv *priv = to_si3474_priv(pcdev);
struct i2c_client *client;
bool is_enabled;
u8 chan0, chan1;
s32 ret;
si3474_get_channels(priv, id, &chan0, &chan1);
client = si3474_get_chan_client(priv, chan0);
ret = i2c_smbus_read_byte_data(client, PORT_MODE_REG);
if (ret < 0) {
admin_state->c33_admin_state =
ETHTOOL_C33_PSE_ADMIN_STATE_UNKNOWN;
return ret;
}
is_enabled = ret & (CHAN_MASK(chan0) | CHAN_MASK(chan1));
if (is_enabled)
admin_state->c33_admin_state =
ETHTOOL_C33_PSE_ADMIN_STATE_ENABLED;
else
admin_state->c33_admin_state =
ETHTOOL_C33_PSE_ADMIN_STATE_DISABLED;
return 0;
}
static int si3474_pi_get_pw_status(struct pse_controller_dev *pcdev, int id,
struct pse_pw_status *pw_status)
{
struct si3474_priv *priv = to_si3474_priv(pcdev);
struct i2c_client *client;
bool delivering;
u8 chan0, chan1;
s32 ret;
si3474_get_channels(priv, id, &chan0, &chan1);
client = si3474_get_chan_client(priv, chan0);
ret = i2c_smbus_read_byte_data(client, POWER_STATUS_REG);
if (ret < 0) {
pw_status->c33_pw_status = ETHTOOL_C33_PSE_PW_D_STATUS_UNKNOWN;
return ret;
}
delivering = ret & (CHAN_UPPER_BIT(chan0) | CHAN_UPPER_BIT(chan1));
if (delivering)
pw_status->c33_pw_status =
ETHTOOL_C33_PSE_PW_D_STATUS_DELIVERING;
else
pw_status->c33_pw_status = ETHTOOL_C33_PSE_PW_D_STATUS_DISABLED;
return 0;
}
Annotation
- Immediate include surface: `linux/i2c.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/pse-pd/pse.h`.
- Detected declarations: `struct si3474_pi_desc`, `struct si3474_priv`, `function si3474_get_channels`, `function si3474_pi_get_admin_state`, `function si3474_pi_get_pw_status`, `function si3474_get_of_channels`, `function si3474_setup_pi_matrix`, `function si3474_pi_enable`, `function si3474_pi_disable`, `function si3474_pi_get_chan_current`.
- 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.