STRUCT ATMEL_TC(9)
π 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_enableall the clocks they need β even though all the entries inclkmay point to the same physical clock. yeah, even the duplicates. enable them anyway. the way thatclkentries 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_SHAREDin case some of the entries inirqare actually the same IRQ.
β οΈ bestie please do not skip theIRQF_SHAREDpart. if theirqentries 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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms