drivers/net/wan/framer/pef2256/pef2256.c
Source file repositories/reference/linux-study-clean/drivers/net/wan/framer/pef2256/pef2256.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wan/framer/pef2256/pef2256.c- Extension
.c- Size
- 24603 bytes
- Lines
- 894
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/framer/pef2256.hlinux/clk.hlinux/framer/framer-provider.hlinux/gpio/consumer.hlinux/interrupt.hlinux/io.hlinux/mfd/core.hlinux/module.hlinux/notifier.hlinux/of.hlinux/of_platform.hlinux/platform_device.hlinux/regmap.hlinux/slab.hpef2256-regs.h
Detected Declarations
struct pef2256struct pef2256_gcm_configenum pef2256_frame_typeenum pef2256_gcm_config_itemfunction pef2256_read8function pef2256_write8function pef2256_clrbits8function pef2256_setbits8function pef2256_clrsetbits8function pef2256_get_versionfunction version_showfunction pef2256_setup_gcmfunction pef2256_setup_e1_linefunction pef2256_setup_e1_losfunction pef2256_setup_e1_systemfunction pef2256_setup_e1_signalingfunction pef2256_setup_e1_errorsfunction pef2256_setup_e1function pef2256_isr_default_handlerfunction pef2256_is_carrier_onfunction pef2256_isr2_handlerfunction pef2256_irq_handlerfunction pef2256_check_ratesfunction pef2556_of_parsefunction pef2256_add_audio_devicesfunction for_each_available_child_of_nodefunction pef2256_framer_get_statusfunction pef2256_framer_set_configfunction pef2256_framer_get_configfunction pef2256_probefunction pef2256_removeexport pef2256_get_versionexport pef2256_get_regmap
Annotated Snippet
struct pef2256 {
struct device *dev;
struct regmap *regmap;
enum pef2256_version version;
const char *version_txt;
struct clk *mclk;
struct clk *sclkr;
struct clk *sclkx;
struct gpio_desc *reset_gpio;
unsigned long sysclk_rate;
u32 data_rate;
bool is_tx_falling_edge;
bool is_subordinate;
enum pef2256_frame_type frame_type;
u8 channel_phase;
atomic_t carrier;
struct framer *framer;
};
static u8 pef2256_read8(struct pef2256 *pef2256, int offset)
{
int val;
regmap_read(pef2256->regmap, offset, &val);
return val;
}
static void pef2256_write8(struct pef2256 *pef2256, int offset, u8 val)
{
regmap_write(pef2256->regmap, offset, val);
}
static void pef2256_clrbits8(struct pef2256 *pef2256, int offset, u8 clr)
{
regmap_clear_bits(pef2256->regmap, offset, clr);
}
static void pef2256_setbits8(struct pef2256 *pef2256, int offset, u8 set)
{
regmap_set_bits(pef2256->regmap, offset, set);
}
static void pef2256_clrsetbits8(struct pef2256 *pef2256, int offset, u8 clr, u8 set)
{
regmap_update_bits(pef2256->regmap, offset, clr | set, set);
}
enum pef2256_version pef2256_get_version(struct pef2256 *pef2256)
{
enum pef2256_version version = PEF2256_VERSION_UNKNOWN;
u8 vstr, wid;
vstr = pef2256_read8(pef2256, PEF2256_VSTR);
wid = pef2256_read8(pef2256, PEF2256_WID);
switch (vstr) {
case PEF2256_VSTR_VERSION_12:
if ((wid & PEF2256_12_WID_MASK) == PEF2256_12_WID_VERSION_12)
version = PEF2256_VERSION_1_2;
break;
case PEF2256_VSTR_VERSION_2x:
switch (wid & PEF2256_2X_WID_MASK) {
case PEF2256_2X_WID_VERSION_21:
version = PEF2256_VERSION_2_1;
break;
case PEF2256_2X_WID_VERSION_22:
version = PEF2256_VERSION_2_2;
break;
}
break;
case PEF2256_VSTR_VERSION_21:
version = PEF2256_VERSION_2_1;
break;
}
if (version == PEF2256_VERSION_UNKNOWN)
dev_err(pef2256->dev, "Unknown version (0x%02x, 0x%02x)\n", vstr, wid);
return version;
}
EXPORT_SYMBOL_GPL(pef2256_get_version);
static ssize_t version_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct pef2256 *pef2256 = dev_get_drvdata(dev);
return sysfs_emit(buf, "%s\n", pef2256->version_txt);
}
Annotation
- Immediate include surface: `linux/framer/pef2256.h`, `linux/clk.h`, `linux/framer/framer-provider.h`, `linux/gpio/consumer.h`, `linux/interrupt.h`, `linux/io.h`, `linux/mfd/core.h`, `linux/module.h`.
- Detected declarations: `struct pef2256`, `struct pef2256_gcm_config`, `enum pef2256_frame_type`, `enum pef2256_gcm_config_item`, `function pef2256_read8`, `function pef2256_write8`, `function pef2256_clrbits8`, `function pef2256_setbits8`, `function pef2256_clrsetbits8`, `function pef2256_get_version`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.