drivers/iio/proximity/sx_common.h
Source file repositories/reference/linux-study-clean/drivers/iio/proximity/sx_common.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/iio/proximity/sx_common.h- Extension
.h- Size
- 4827 bytes
- Lines
- 156
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/iio/iio.hlinux/iio/types.hlinux/regulator/consumer.hlinux/types.h
Detected Declarations
struct devicestruct i2c_clientstruct regmap_configstruct sx_common_datastruct sx_common_reg_defaultstruct sx_common_opsstruct sx_common_chip_infostruct sx_common_data
Annotated Snippet
struct sx_common_reg_default {
u8 reg;
u8 def;
const char *property;
};
/**
* struct sx_common_ops: function pointers needed by common code
*
* List functions needed by common code to gather information or configure
* the sensor.
*
* @read_prox_data: Function to read raw proximity data.
* @check_whoami: Set device name based on whoami register.
* @init_compensation: Function to set initial compensation.
* @wait_for_sample: When there are no physical IRQ, function to wait for a
* sample to be ready.
* @get_default_reg: Populate the initial value for a given register.
*/
struct sx_common_ops {
int (*read_prox_data)(struct sx_common_data *data,
const struct iio_chan_spec *chan, __be16 *val);
int (*check_whoami)(struct device *dev, struct iio_dev *indio_dev);
int (*init_compensation)(struct iio_dev *indio_dev);
int (*wait_for_sample)(struct sx_common_data *data);
const struct sx_common_reg_default *
(*get_default_reg)(struct device *dev, int idx,
struct sx_common_reg_default *reg_def);
};
/**
* struct sx_common_chip_info: Semtech Sensor private chip information
*
* @reg_stat: Main status register address.
* @reg_irq_msk: IRQ mask register address.
* @reg_enable_chan: Address to enable/disable channels.
* Each phase presented by the sensor is an IIO channel..
* @reg_reset: Reset register address.
* @mask_enable_chan: Mask over the channels bits in the enable channel
* register.
* @stat_offset: Offset to check phase status.
* @irq_msk_offset: Offset to enable interrupt in the IRQ mask
* register.
* @num_channels: Number of channels.
* @num_default_regs: Number of internal registers that can be configured.
*
* @ops: Private functions pointers.
* @iio_channels: Description of exposed iio channels.
* @num_iio_channels: Number of iio_channels.
* @iio_info: iio_info structure for this driver.
*/
struct sx_common_chip_info {
unsigned int reg_stat;
unsigned int reg_irq_msk;
unsigned int reg_enable_chan;
unsigned int reg_reset;
unsigned int mask_enable_chan;
unsigned int stat_offset;
unsigned int irq_msk_offset;
unsigned int num_channels;
int num_default_regs;
struct sx_common_ops ops;
const struct iio_chan_spec *iio_channels;
int num_iio_channels;
struct iio_info iio_info;
};
/**
* struct sx_common_data: Semtech Sensor private data structure.
*
* @chip_info: Structure defining sensor internals.
* @mutex: Serialize access to registers and channel configuration.
* @completion: completion object to wait for data acquisition.
* @client: I2C client structure.
* @trig: IIO trigger object.
* @regmap: Register map.
* @chan_prox_stat: Last reading of the proximity status for each channel.
* We only send an event to user space when this changes.
* @trigger_enabled: True when the device trigger is enabled.
* @buffer: Buffer to store raw samples.
* @suspend_ctrl: Remember enabled channels and sample rate during suspend.
* @chan_read: Bit field for each raw channel enabled.
* @chan_event: Bit field for each event enabled.
*/
struct sx_common_data {
const struct sx_common_chip_info *chip_info;
Annotation
- Immediate include surface: `linux/iio/iio.h`, `linux/iio/types.h`, `linux/regulator/consumer.h`, `linux/types.h`.
- Detected declarations: `struct device`, `struct i2c_client`, `struct regmap_config`, `struct sx_common_data`, `struct sx_common_reg_default`, `struct sx_common_ops`, `struct sx_common_chip_info`, `struct sx_common_data`.
- Atlas domain: Driver Families / drivers/iio.
- 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.