STRUCT ATMEL_TC(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’œ struct atmel_tc β€” the whole tea on your Timer/Counter Block

okay so bestie, welcome to the struct atmel_tc(9) page from the Kernel API Manual ✨ this one's a lil struct that holds literally everything you need to know about a Timer/Counter Block, and I'm gonna walk you through it field by field, no cap 🫢


🌸 SYNOPSIS 🌸

here's the whole vibe, in code, untouched, exactly as it lives:

struct atmel_tc {
    struct platform_device  *pdev;
    void __iomem            *regs;
    int id;
    const struct atmel_tcb_config *tcb_config;
    int irq[3];
    struct clk              *clk[3];
    struct clk              *slow_clk;
    struct list_head        node;
    bool allocated;
 };

look at her. iconic. πŸ‘‘


πŸ’… Members (the cast of characters) πŸ’…

  • pdev β€” the physical device. that's her, the actual hardware babe πŸ”Œ
  • regs β€” the mapping you go through to reach the I/O registers. it's giving backstage pass 🎟️
  • id β€” the block id. her little name tag πŸ’–
  • tcb_config β€” configuration data coming straight from the SoC. the SoC is the source of truth, periodt ✨
  • irq β€” the irq for each of the three channels. yes bestie, all three, one slot each πŸ“¬
  • clk β€” the internal clock source for each of the three channels. three channels, three clock slots, we love a symmetrical queen πŸ•
  • node β€” list node, and it's for tclib internal use. hands off, that's her private business πŸ™ˆ
  • allocated β€” tells you if it's already used, also for tclib internal use. same deal, don't touch πŸ’€

πŸ¦‹ Description πŸ¦‹

okay so here's the situation and it's honestly kind of a plot twist:

on some platforms, each TC channel has its own clocks and IRQs. but on others, all TC channels share the same clock and IRQ. same clock!! same irq!! sharing is caring ig 😭

so what do drivers do? listen up, this is the important part:

  • Drivers should clk_enable all the clocks they need β€” even though all the entries in clk may point to the same physical clock. yeah, even the duplicates. enable them anyway. the way that clk entries can literally all be the same physical clock and you still gotta enable each one… it's giving "yes ma'am, all of them" πŸ’…
  • Likewise, drivers should request irqs independently for each channel β€” but they must use IRQF_SHARED in case some of the entries in irq are actually the same IRQ.
⚠️ bestie please do not skip the IRQF_SHARED part. if the irq entries happen to be the same IRQ and you didn't share, that's a bad time. fr fr, it's right there in the docs πŸ”₯

🌈 SEE ALSO 🌈

  • Kernel file ./include/soc/at91/atmel_tcb.h
  • struct atmel_tcb_config(9)

⭐ and that's the whole page!! this was pulled from ./include/soc/at91, dated October 2026, and it's literally the struct atmel_tc(9) manpage from the Kernel API Manual β€” go forth and enable your clocks, request your irqs independently, and always, always use IRQF_SHARED. slay πŸ’–πŸŽ€πŸ§š

πŸ“¦ where this page comes from