iio_find_closest_gain_low(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… iio_find_closest_gain_low(9) β€” the iio_find_closest_gain_low page from the Kernel API Manual, bestie ✨

okay so picture this: you're in the kernel, you've got a gain, and you need the closest one that doesn't go over. That's literally this whole function. Welcome to the group chat 🫢


🌸 NAME 🌸

iio_find_closest_gain_low β€” find the closest lower matching gain. yes that's the whole vibe. lowkey iconic πŸ’–


✨ SYNOPSIS ✨

int iio_find_closest_gain_low (struct iio_gts *gts , int gain , bool
*in_range );

she takes three things and returns an int, periodt πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • gts β€” the gain time scale descriptor. like, the whole menu of what gains are even possible πŸ“
  • gain β€” the HW-gain you're hunting a match for. this is the one you're trying to place πŸ‘‘
  • in_range β€” a bool * that gets flagged to indicate if the gain was actually in the range of supported gains. so you know if she found a real one or if it's giving "we tried" πŸ’€

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so hear me out. This function searches for the closest supported gain that is lower than or equal to the gain you passed in. Not higher. Never higher. We stay humble over here πŸ™ˆ

Who's this for? Drivers which do not require the user to request an exact matching gain β€” instead they just want to round down to a supported gain value which is equal or lower. And ngl, setting a lower gain is typical for avoiding saturation. So if you're out here maxing out your signal and getting clipped, this is your bestie. Slay πŸ”₯


πŸ’œ RETURN πŸ’œ

She gives you the closest matching supported gain ✨ β€” or -EINVAL if gain was smaller than the smallest supported gain. yeah, if you go below the floor there's literally nothing for her to round down to, so she's out 😭


🌈 SEE ALSO 🌈

The kernel file is ./drivers/iio/industrialio-gts-helper.c β€” that's the mothership, go look πŸ‘€ And here's the whole friend group, no cap:

like, twenty-five whole functions. she's got a huge social circle πŸ§šπŸ’«


that's the whole page, bestie!! this one lives under ./drivers/iio, it's from October 2026, and it's the iio_find_closest_gain_low(9) entry in the Kernel API Manual. go forth and round down responsibly πŸŽ€βœ¨πŸ’–

πŸ“¦ where this page comes from