include/linux/iio/iio-gts-helper.h
Source file repositories/reference/linux-study-clean/include/linux/iio/iio-gts-helper.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/iio/iio-gts-helper.h- Extension
.h- Size
- 6701 bytes
- Lines
- 214
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.h
Detected Declarations
struct devicestruct iio_gain_sel_pairstruct iio_itime_sel_mulstruct iio_gtsfunction iio_gts_find_itime_by_timefunction iio_gts_find_itime_by_selfunction iio_gts_find_int_time_by_selfunction iio_gts_find_sel_by_int_timefunction iio_gts_valid_timefunction iio_gts_valid_gain
Annotated Snippet
struct iio_gain_sel_pair {
int gain;
int sel;
};
/**
* struct iio_itime_sel_mul - integration time description
*
* In many cases devices like light sensors allow setting the duration of
* collecting data. Typically this duration has also an impact to the magnitude
* of measured values (gain). This structure describes the relation of
* integration time and amplification as well as corresponding selector
* (register value).
*
* An example could be a sensor allowing 50, 100, 200 and 400 mS times. The
* respective multiplication values could be 50 mS => 1, 100 mS => 2,
* 200 mS => 4 and 400 mS => 8 assuming the impact of integration time would be
* linear in a way that when collecting data for 50 mS caused value X, doubling
* the data collection time caused value 2X etc.
*
* @time_us: Integration time in microseconds. Time values must be positive,
* negative values are reserved for error handling.
* @sel: Selector (usually register value) used to indicate this time
* NOTE: Only selectors >= 0 supported.
* @mul: Multiplication to the values caused by this time.
* NOTE: Only multipliers > 0 supported.
*/
struct iio_itime_sel_mul {
int time_us;
int sel;
int mul;
};
struct iio_gts {
u64 max_scale;
const struct iio_gain_sel_pair *hwgain_table;
int num_hwgain;
const struct iio_itime_sel_mul *itime_table;
int num_itime;
int **per_time_avail_scale_tables;
int *avail_all_scales_table;
int num_avail_all_scales;
int *avail_time_tables;
int num_avail_time_tables;
};
#define GAIN_SCALE_GAIN(_gain, _sel) \
{ \
.gain = (_gain), \
.sel = (_sel), \
}
#define GAIN_SCALE_ITIME_US(_itime, _sel, _mul) \
{ \
.time_us = (_itime), \
.sel = (_sel), \
.mul = (_mul), \
}
static inline const struct iio_itime_sel_mul *
iio_gts_find_itime_by_time(struct iio_gts *gts, int time)
{
int i;
if (!gts->num_itime)
return NULL;
for (i = 0; i < gts->num_itime; i++)
if (gts->itime_table[i].time_us == time)
return >s->itime_table[i];
return NULL;
}
static inline const struct iio_itime_sel_mul *
iio_gts_find_itime_by_sel(struct iio_gts *gts, int sel)
{
int i;
for (i = 0; i < gts->num_itime; i++)
if (gts->itime_table[i].sel == sel)
return >s->itime_table[i];
return NULL;
}
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);
Annotation
- Immediate include surface: `linux/types.h`.
- Detected declarations: `struct device`, `struct iio_gain_sel_pair`, `struct iio_itime_sel_mul`, `struct iio_gts`, `function iio_gts_find_itime_by_time`, `function iio_gts_find_itime_by_sel`, `function iio_gts_find_int_time_by_sel`, `function iio_gts_find_sel_by_int_time`, `function iio_gts_valid_time`, `function iio_gts_valid_gain`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.