drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c
Source file repositories/reference/linux-study-clean/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c- Extension
.c- Size
- 22237 bytes
- Lines
- 923
- Domain
- Driver Families
- Bucket
- drivers/iio
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/regmap.hlinux/iio/iio.hlinux/iio/sysfs.hlinux/bitfield.hst_lsm6dsx.h
Detected Declarations
function st_lsm6dsx_shub_wait_completefunction st_lsm6dsx_shub_read_outputfunction st_lsm6dsx_shub_write_regfunction st_lsm6dsx_shub_write_reg_with_maskfunction st_lsm6dsx_shub_master_enablefunction st_lsm6dsx_shub_readfunction st_lsm6dsx_shub_writefunction st_lsm6dsx_shub_write_with_maskfunction st_lsm6dsx_shub_get_odr_valfunction st_lsm6dsx_shub_set_odrfunction st_lsm6dsx_shub_config_channelsfunction st_lsm6dsx_shub_set_enablefunction st_lsm6dsx_shub_read_oneshotfunction st_lsm6dsx_shub_read_rawfunction st_lsm6dsx_shub_set_full_scalefunction __st_lsm6dsx_shub_write_rawfunction st_lsm6dsx_shub_write_rawfunction st_lsm6dsx_shub_sampling_freq_availfunction st_lsm6dsx_shub_scale_availfunction st_lsm6dsx_shub_alloc_iiodevfunction st_lsm6dsx_shub_init_devicefunction st_lsm6dsx_shub_check_waifunction st_lsm6dsx_shub_probe
Annotated Snippet
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/bitfield.h>
#include "st_lsm6dsx.h"
#define ST_LSM6DSX_SLV_ADDR(n, base) ((base) + (n) * 3)
#define ST_LSM6DSX_SLV_SUB_ADDR(n, base) ((base) + 1 + (n) * 3)
#define ST_LSM6DSX_SLV_CONFIG(n, base) ((base) + 2 + (n) * 3)
#define ST_LS6DSX_READ_OP_MASK GENMASK(2, 0)
static const struct st_lsm6dsx_ext_dev_settings st_lsm6dsx_ext_dev_table[] = {
/* LIS2MDL */
{
.i2c_addr = { 0x1e },
.wai = {
.addr = 0x4f,
.val = 0x40,
},
.id = ST_LSM6DSX_ID_MAGN,
.odr_table = {
.reg = {
.addr = 0x60,
.mask = GENMASK(3, 2),
},
.odr_avl[0] = { 10000, 0x0 },
.odr_avl[1] = { 20000, 0x1 },
.odr_avl[2] = { 50000, 0x2 },
.odr_avl[3] = { 100000, 0x3 },
.odr_len = 4,
},
.fs_table = {
.fs_avl[0] = {
.gain = 1500,
.val = 0x0,
}, /* 1500 uG/LSB */
.fs_len = 1,
},
.temp_comp = {
.addr = 0x60,
.mask = BIT(7),
},
.pwr_table = {
.reg = {
.addr = 0x60,
.mask = GENMASK(1, 0),
},
.off_val = 0x2,
.on_val = 0x0,
},
.off_canc = {
.addr = 0x61,
.mask = BIT(1),
},
.bdu = {
.addr = 0x62,
.mask = BIT(4),
},
.out = {
.addr = 0x68,
.len = 6,
},
},
/* LIS3MDL */
{
.i2c_addr = { 0x1e },
.wai = {
.addr = 0x0f,
.val = 0x3d,
},
.id = ST_LSM6DSX_ID_MAGN,
.odr_table = {
.reg = {
.addr = 0x20,
.mask = GENMASK(4, 2),
},
.odr_avl[0] = { 1000, 0x0 },
.odr_avl[1] = { 2000, 0x1 },
.odr_avl[2] = { 3000, 0x2 },
.odr_avl[3] = { 5000, 0x3 },
.odr_avl[4] = { 10000, 0x4 },
.odr_avl[5] = { 20000, 0x5 },
.odr_avl[6] = { 40000, 0x6 },
.odr_avl[7] = { 80000, 0x7 },
.odr_len = 8,
},
.fs_table = {
Annotation
- Immediate include surface: `linux/module.h`, `linux/regmap.h`, `linux/iio/iio.h`, `linux/iio/sysfs.h`, `linux/bitfield.h`, `st_lsm6dsx.h`.
- Detected declarations: `function st_lsm6dsx_shub_wait_complete`, `function st_lsm6dsx_shub_read_output`, `function st_lsm6dsx_shub_write_reg`, `function st_lsm6dsx_shub_write_reg_with_mask`, `function st_lsm6dsx_shub_master_enable`, `function st_lsm6dsx_shub_read`, `function st_lsm6dsx_shub_write`, `function st_lsm6dsx_shub_write_with_mask`, `function st_lsm6dsx_shub_get_odr_val`, `function st_lsm6dsx_shub_set_odr`.
- Atlas domain: Driver Families / drivers/iio.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.