iio_gts_find...ld_gain_time(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… iio_gts_find...ld_gain_time(9) β€” the manual πŸ’…

okay bestie, this is the kernel API manual page for iio_gts_find...ld_gain_time(9), and it's literally about compensating for time change. ✨ No cap, the function name is giving "long-distance relationship," but the actual job is cute and specific. We're gonna get through it together. 🫢

🌸 NAME 🌸

iio_gts_find_new_gain_sel_by_old_gain_time β€” compensate for time change.

✨ SYNOPSIS ✨

int iio_gts_find_new_gain_sel_by_old_gain_time (struct iio_gts *gts ,
int old_gain , int old_time_sel , int new_time_sel , int *new_gain );

πŸŽ€ ARGUMENTS πŸŽ€

  • gts β€” Gain time scale descriptor. That's the descriptor, bestie.
  • old_gain β€” Previously set gain.
  • old_time_sel β€” Selector corresponding previously set time.
  • new_time_sel β€” Selector corresponding new time to be set.
  • new_gain β€” Pointer to value where new gain is to be written. It's literally where the new gain gets written. πŸ’–

πŸ’– DESCRIPTION πŸ’–

We may want to mitigate the scale change caused by setting a new integration time (for a light sensor) by also updating the (HW)gain. This helper computes new gain value to maintain the scale with new integration time. Periodt. πŸ’…

It's giving "keep the scale cute while the integration time changes," and honestly? Obsessed. ✨

πŸ”₯ RETURN πŸ”₯

0 if an exactly matching supported new gain was found.

When a non-zero value is returned, the new_gain will be set to a negative or positive value.

  • Negative value means that no gain could be computed. 😭
  • Positive value will be the "best possible new gain there could be". πŸ‘‘

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 this case, the "best possible" new gain will be a floored optimal gain, which may or may not be supported by the hardware. So yeah, it's best-effort energy, not a guarantee. πŸ’€

πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file ./drivers/iio/industrialio-gts-helper.c and this whole friend group:


πŸ’Œ source/version vibe check: this page comes from ./drivers/iio, dated October 2026, and it's literally the iio_gts_find...ld_gain_time(9) manual. Bye bestie! πŸ’–πŸŽ€

πŸ“¦ where this page comes from