drivers/ptp/ptp_idt82p33.c
Source file repositories/reference/linux-study-clean/drivers/ptp/ptp_idt82p33.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/ptp/ptp_idt82p33.c- Extension
.c- Size
- 32986 bytes
- Lines
- 1459
- Domain
- Driver Families
- Bucket
- drivers/ptp
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/firmware.hlinux/platform_device.hlinux/module.hlinux/ptp_clock_kernel.hlinux/delay.hlinux/jiffies.hlinux/kernel.hlinux/timekeeping.hlinux/bitops.hlinux/of.hlinux/mfd/rsmu.hlinux/mfd/idt82p33_reg.hptp_private.hptp_idt82p33.h
Detected Declarations
function idt82p33_readfunction idt82p33_writefunction idt82p33_byte_array_to_timespecfunction idt82p33_timespec_to_byte_arrayfunction idt82p33_dpll_set_modefunction idt82p33_set_tod_triggerfunction idt82p33_get_exttsfunction map_ref_to_tod_trig_selfunction is_one_shotfunction arm_tod_read_with_triggerfunction idt82p33_extts_enablefunction idt82p33_extts_check_channelfunction idt82p33_extts_enable_maskfunction _idt82p33_gettimefunction _idt82p33_settimefunction _idt82p33_adjtime_immediatefunction _idt82p33_adjtime_internal_triggeredfunction idt82p33_adjtime_workaroundfunction _idt82p33_adjfinefunction idt82p33_ddco_scaled_ppmfunction idt82p33_stop_ddcofunction idt82p33_start_ddcofunction idt82p33_measure_one_byte_write_overheadfunction idt82p33_measure_one_byte_read_overheadfunction idt82p33_measure_tod_write_9_byte_overheadfunction idt82p33_measure_settime_gettime_gap_overheadfunction idt82p33_measure_tod_write_overheadfunction idt82p33_check_and_set_masksfunction idt82p33_display_masksfunction idt82p33_sync_todfunction idt82p33_work_handlerfunction idt82p33_output_enablefunction idt82p33_perout_enablefunction idt82p33_enable_todfunction idt82p33_ptp_clock_unregister_allfunction idt82p33_enablefunction idt82p33_getmaxphasefunction idt82p33_adjwritephasefunction idt82p33_adjfinefunction idt82p33_adjtimefunction idt82p33_gettimefunction idt82p33_settimefunction idt82p33_channel_initfunction idt82p33_verify_pinfunction idt82p33_caps_initfunction idt82p33_enable_channelfunction idt82p33_resetfunction idt82p33_load_firmware
Annotated Snippet
if (ref < 0) {
dev_err(idt82p33->dev, "%s: No valid pin found for Pll%d!\n",
__func__, channel->plln);
return -EBUSY;
}
err = map_ref_to_tod_trig_sel(ref, &trigger);
if (err) {
dev_err(idt82p33->dev,
"%s: Unsupported ref %d!\n", __func__, ref);
return err;
}
err = arm_tod_read_with_trigger(&idt82p33->channel[index], trigger);
if (err == 0) {
idt82p33->extts_mask |= mask;
idt82p33->channel[index].tod_trigger = trigger;
idt82p33->event_channel[index] = channel;
idt82p33->extts_single_shot = is_one_shot(idt82p33->extts_mask);
if (old_mask)
return 0;
schedule_delayed_work(&idt82p33->extts_work,
msecs_to_jiffies(EXTTS_PERIOD_MS));
}
} else {
idt82p33->extts_mask &= ~mask;
idt82p33->extts_single_shot = is_one_shot(idt82p33->extts_mask);
if (idt82p33->extts_mask == 0)
cancel_delayed_work(&idt82p33->extts_work);
}
return err;
}
static int idt82p33_extts_check_channel(struct idt82p33 *idt82p33, u8 todn)
{
struct idt82p33_channel *event_channel;
struct ptp_clock_event event;
struct timespec64 ts;
int err;
err = idt82p33_get_extts(&idt82p33->channel[todn], &ts);
if (err == 0) {
event_channel = idt82p33->event_channel[todn];
event.type = PTP_CLOCK_EXTTS;
event.index = todn;
event.timestamp = timespec64_to_ns(&ts);
ptp_clock_event(event_channel->ptp_clock,
&event);
}
return err;
}
static u8 idt82p33_extts_enable_mask(struct idt82p33_channel *channel,
u8 extts_mask, bool enable)
{
struct idt82p33 *idt82p33 = channel->idt82p33;
u8 trigger = channel->tod_trigger;
u8 mask;
int err;
int i;
if (extts_mask == 0)
return 0;
if (enable == false)
cancel_delayed_work_sync(&idt82p33->extts_work);
for (i = 0; i < MAX_PHC_PLL; i++) {
mask = 1 << i;
if ((extts_mask & mask) == 0)
continue;
if (enable) {
err = arm_tod_read_with_trigger(&idt82p33->channel[i], trigger);
if (err)
dev_err(idt82p33->dev,
"%s: Arm ToD read trigger failed, err = %d",
__func__, err);
} else {
err = idt82p33_extts_check_channel(idt82p33, i);
if (err == 0 && idt82p33->extts_single_shot)
/* trigger happened so we won't re-enable it */
extts_mask &= ~mask;
Annotation
- Immediate include surface: `linux/firmware.h`, `linux/platform_device.h`, `linux/module.h`, `linux/ptp_clock_kernel.h`, `linux/delay.h`, `linux/jiffies.h`, `linux/kernel.h`, `linux/timekeeping.h`.
- Detected declarations: `function idt82p33_read`, `function idt82p33_write`, `function idt82p33_byte_array_to_timespec`, `function idt82p33_timespec_to_byte_array`, `function idt82p33_dpll_set_mode`, `function idt82p33_set_tod_trigger`, `function idt82p33_get_extts`, `function map_ref_to_tod_trig_sel`, `function is_one_shot`, `function arm_tod_read_with_trigger`.
- Atlas domain: Driver Families / drivers/ptp.
- 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.