iio_find_closest_gain_low(9)
π
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β abool *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:
iio_gts_get_gain(9)gain_get_scale_fraction(9)iio_gts_total_gain_to_scale(9)iio_gts_purge_avail_scale_table(9)iio_gts_build_avail_scale_table(9)iio_gts_build_avail_time_table(9)iio_gts_purge_avail_time_table(9)iio_gts_build_avail_tables(9)iio_gts_purge_avail_tables(9)devm_iio_gts_build_avail_tables(9)devm_iio_init_iio_gts(9)iio_gts_all_avail_scales(9)iio_gts_avail_scales_for_time(9)iio_gts_avail_times(9)iio_gts_find_sel_by_gain(9)iio_gts_find_gain_by_sel(9)iio_gts_get_min_gain(9)iio_gts_find_gain_for_scale_using_time(9)iio_gts_find_gain_sel_for_scale_using_time(9)iio_gts_find_gain_time_sel_for_scale(9)iio_gts_get_total_gain(9)iio_gts_get_scale(9)iio_gts_find_new_gain_sel_by_old_gain_time(9)iio_gts_find_new_gain_by_old_gain_time(9)iio_gts_find_new_gain_by_gain_time_min(9)
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
- 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