ksz_drive_strength_to_reg(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… ksz_drive_strength_to_reg(9) β€” from the Kernel API Manual, bestie πŸŽ€

okay so picture this: you're deep in the kernel, the ksz_drive_strength_to_reg function is right there in the Kernel API Manual, and you're like "what does this even dooo" β€” don't worry, I got you. This is literally the function that takes your cute little drive strength number and turns it into the register value the hardware actually wants. iconic behavior tbh ✨


🌸 SYNOPSIS 🌸

int ksz_drive_strength_to_reg (const struct ksz_drive_strength *array ,
size_t array_size , int microamp );

like, that's the whole signature. no cap. 🫢


✨ ARGUMENTS ✨

  • array β€” the array of drive strength values you want to search through. it's the lookup table, bestie, and it's const so hands off πŸ”₯
  • array_size β€” how big that array is. yes you have to tell it. it's not psychic πŸ’€
  • microamp β€” the drive strength value, in microamp, that you wanna convert. this is the number you're hunting for πŸ”

πŸ¦‹ DESCRIPTION πŸ¦‹

so the way this works: ksz_drive_strength_to_reg searches through the array of drive strength values looking for the microamp value you passed in, and then it returns the corresponding register value for that drive. that's it. that's the whole vibe. it's giving "translator between the human-friendly number and the hardware-friendly number" πŸ’–

literally just a lookup. matching your microamp to a register value. slay πŸ’…


πŸ‘‘ RETURN πŸ‘‘

  • if it finds it β€” you get the corresponding register value for that drive strength back. win. πŸŽ‰
  • otherwise β€” -EINVAL comes back, which is the fancy way of saying "invalid value, bestie, that one's not in the list" 😭
ngl, -EINVAL is like the group chat when you send a message nobody can react to. it means your value wasn't valid for this lookup. don't take it personally πŸ’€

🧚 SEE ALSO 🧚

kernel file ./drivers/net/dsa/microchip/ksz_common.c β€” that's the source file, go look at it if you're curious πŸ‘€

and the whole friend group of related functions, all of them, no skips:


okay and before I go β€” little sign-off moment 🫢 this one lives in ./drivers/net/dsa/microchip, dated October 2026, and the page itself is ksz_drive_strength_to_reg(9). go forth and convert those drive strengths, bestie, you're gonna ate πŸ’œπŸŒˆ

πŸ“¦ where this page comes from