ar9003_hw_set_channel(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

โœจ ar9003_hw_set_channel(9) โœจ

okay bestie, welcome to the Kernel API Manual โ€” yes that's the manual name, and yes we're reading it together, grab a boba ๐Ÿง‹ because this one's about setting channels on a single-chip device and it's honestly kinda iconic ๐Ÿ’…


๐ŸŽ€ NAME ๐ŸŽ€

ar9003_hw_set_channel โ€” set channel on single-chip device. that's it, that's the whole vibe, short and slay โœจ


๐ŸŒธ SYNOPSIS ๐ŸŒธ

int ar9003_hw_set_channel (struct ath_hw *ah , struct ath9k_channel
*chan );

not me pasting this exactly as-is because we do not touch the signatures in this house ๐Ÿซถ


๐Ÿฆ‹ ARGUMENTS ๐Ÿฆ‹

  • ah โ€” the atheros hardware structure, your main character struct fr fr ๐Ÿ‘‘
  • chan โ€” literally just here existing ๐Ÿ˜ญ the original gives it no description at all, so no cap, we're not inventing one. it's the struct ath9k_channel *, bestie, that's all we know from the signature ๐Ÿ’€

๐Ÿ’– DESCRIPTION ๐Ÿ’–

so this is the function for changing the channel on single-chip devices โ€” meaning the AR9300 family of chipsets, iykyk ๐Ÿ”ฅ

it takes the channel value in MHz and sets the hardware channel value. oh and important caveat: it assumes writes have been enabled to the analog bus โ€” like, that's a prerequisite, not a suggestion, so make sure that's already handled before you come calling ๐Ÿ™ˆ

now the actual expressions, and these are giving math class but make it hardware ๐Ÿงฎโœจ

for a 2GHz channel, the channel frequency is:

Channel Frequency = (3/4) * freq_ref * (chansel[8:0] + chanfrac[16:0]/2^17)

with (freq_ref = 40MHz) โญ

for a 5GHz channel, the channel frequency is:

Channel Frequency = (3/2) * freq_ref * (chansel[8:0] + chanfrac[16:0]/2^10)

with (freq_ref = 40MHz/(24>>amodeRefSel)) โ€” yes that bit-shift is in there, it's not a typo, we keep it exactly as the page says ๐Ÿ’œ

and for 5GHz channels which are 5MHz spaced, the channel frequency is:

Channel Frequency = (3/2) * freq_ref * (chansel[8:0] + chanfrac[16:0]/2^17)

with (freq_ref = 40MHz) ๐ŸŒˆ

heads up bestie, notice the 5MHz-spaced one uses /2^17 like the 2GHz formula, while the regular 5GHz one uses /2^10 โ€” that's not me being chaotic, that's literally what the page says, so copy it carefully ๐Ÿ‘€

๐Ÿ” SEE ALSO ๐Ÿ”

  • the kernel file ./drivers/net/wireless/ath/ath9k/ar9003_phy.c โ€” go read the source, it ate ๐Ÿ’…
  • ar9003_hw_spur_mitigate_mrc_cck(9) โ€” the friend of a friend, also important ๐Ÿซถ

and that's the whole page, bestie ๐ŸŽ€๐Ÿ’– this gem comes from ./drivers/net/wireless/ath/ath9k, dated October 2026, and its title is of course ar9003_hw_set_channel(9) โ€” slay, periodt, go set some channels responsibly โœจ๐Ÿ‘‘๐ŸŒธ

๐Ÿ“ฆ where this page comes from