iio_gts_find...ld_gain_time(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ iio_gts_find_new_gain_by_old_gain_time(9) ✨

Okay so bestie, welcome to the Kernel API Manual πŸ’– β€” this one's a helper in the IIO gain-time-scale (gts) cinematic universe, and honestly it's giving "quietly doing the most important math in the room." Let's get into it 🫢


🌸 NAME 🌸

iio_gts_find_new_gain_by_old_gain_time β€” compensate for time change πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

int iio_gts_find_new_gain_by_old_gain_time (struct iio_gts *gts , int
old_gain , int old_time , int new_time , int *new_gain );

πŸŽ€ ARGUMENTS πŸŽ€

  • gts β€” the Gain time scale descriptor. This is the main character fr, it holds the whole scale situation πŸ‘‘
  • old_gain β€” the gain that was previously set. The "before" pic πŸ“Έ
  • old_time β€” the selector that corresponds to the previously set time
  • new_time β€” the selector that corresponds to the new time you're about to set
  • new_gain β€” pointer to the value where the new gain is gonna get written ✍️

πŸ’œ DESCRIPTION πŸ’œ

So here's the vibe: when you set a new integration time on a light sensor, the scale can shift on you, and that's lowkey not the moment. The glow-up move is to also update the (HW)gain so the scale stays put 🧚

This helper does exactly that β€” it computes the new gain value needed to maintain the scale with the new integration time. No cap, that's the whole job. It's the friend who fixes your outfit after you changed one piece and everything else suddenly clashed πŸ’…βœ¨


πŸ”₯ RETURN πŸ”₯

It returns 0 if an exactly matching supported new gain was found. Slay, perfect match, we love to see it πŸ’–

When a non-zero value comes back, new_gain will be set to a negative or positive value:

  • A negative value means no gain could be computed at all. 😭 It's giving "we tried, bestie."
  • A positive value is the "best possible new gain there could be" β€” the consolation prize, but make it math.

There can be two reasons why finding the "best possible" new gain is not deemed successful:

  1. This new value cannot be supported by the hardware πŸ’€
  2. The new gain required to maintain the scale would not be an integer 😬
In that second case, the "best possible" new gain will be a floored optimal gain β€” which may or may not be supported by the hardware. So like… don't assume it's valid just because it came back positive, okay? Do a vibe check on it first πŸ™ˆ

🌈 SEE ALSO 🌈

Kernel file ./drivers/iio/industrialio-gts-helper.c β€” and the whole extended friend group πŸ’œ:


That's the whole page, bestie β€” go forth and compensate those time changes 🌟

Sign-off szn: this one lives in ./drivers/iio and the page is dated October 2026 πŸ—“οΈπŸ’« mwah, ily, read your manpages πŸ«ΆπŸŽ€

πŸ“¦ where this page comes from