devm_iio_init_iio_gts(9)
β¨ devm_iio_init_iio_gts β¨
okay so bestie, this is the function that sets up your gain-time-scale helper for you, in the Kernel API Manual (that's the manual name, slay). it's called devm_iio_init_iio_gts and it's literally here to make your life easier before you go off and do scale stuff. no cap.
πΈ SYNOPSIS πΈ
int devm_iio_init_iio_gts (struct device *dev , int max_scale_int , int
max_scale_nano , const struct iio_gain_sel_pair *gain_tbl , int num_gain
, const struct iio_itime_sel_mul *tim_tbl , int num_times , struct
iio_gts *gts );
π ARGUMENTS π
devβ pointer to the device whose lifetime thegtsresources are bound to π«Ά like they're literally tied to this device's whole existencemax_scale_intβ the integer part of the maximum scale value, the big whole number vibemax_scale_nanoβ the fraction part of the maximum scale value, the tiny little nano detail β¨gain_tblβ table describing supported gains, it's giving lookup table realnessnum_gainβ number of gains in the gain table, like how many entries we're working withtim_tblβ table describing supported integration times. π important: provide the integration time table sorted so that the preferred integration time is in the first array index. the search functions (likeiio_gts_find_time_and_gain_sel_for_scale) start searching from the first provided time. so yeah, put your fave first, periodt.num_timesβ number of times in the time table, counting them all bestiegtsβ pointer to the helper struct, the main character itself π
π¦ DESCRIPTION π¦
okay so this initializes the gain-time-scale helper for use. literally just set it up and let it work. note some things that are non-negotiable:
gains, times, selectors, and multipliers must be positive. negative values are reserved for error checking, so don't come in here with negatives, that's not the vibe π.
also, the total gain (maximum gain * maximum time multiplier) must not overflow int. no overflow, no accidental chaos, handle it.
the allocated resources will be released upon device detach β so when the device dips, the resources go too. automatic cleanup, iconic π.
β RETURN β
0 on success. that's it, plain and simple, 0 and you're golden π
π SEE ALSO π
bestie the whole friend group:
- Kernel file
./drivers/iio/industrialio-gts-helper.c 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)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_find_closest_gain_low(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)
./drivers/iio Β· October 2026 Β· devm_iio_init_iio_gts(9) β mwah, that's the page bestie, go slay your IIO init π
π«Άβ¨
π¦ 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