include/linux/iio/imu/adis.h

Source file repositories/reference/linux-study-clean/include/linux/iio/imu/adis.h

File Facts

System
Linux kernel
Corpus path
include/linux/iio/imu/adis.h
Extension
.h
Size
17433 bytes
Lines
586
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct adis_timeout {
	u16 reset_ms;
	u16 sw_reset_ms;
	u16 self_test_ms;
};

/**
 * struct adis_data - ADIS chip variant specific data
 * @read_delay: SPI delay for read operations in us
 * @write_delay: SPI delay for write operations in us
 * @cs_change_delay: SPI delay between CS changes in us
 * @glob_cmd_reg: Register address of the GLOB_CMD register
 * @msc_ctrl_reg: Register address of the MSC_CTRL register
 * @diag_stat_reg: Register address of the DIAG_STAT register
 * @diag_stat_size:	Length (in bytes) of the DIAG_STAT register. If 0 the
 *			default length is 2 bytes long.
 * @prod_id_reg: Register address of the PROD_ID register
 * @prod_id: Product ID code that should be expected when reading @prod_id_reg
 * @self_test_mask: Bitmask of supported self-test operations
 * @self_test_reg: Register address to request self test command
 * @self_test_no_autoclear: True if device's self-test needs clear of ctrl reg
 * @status_error_msgs: Array of error messages
 * @status_error_mask: Bitmask of errors supported by the device
 * @timeouts: Chip specific delays
 * @enable_irq: Hook for ADIS devices that have a special IRQ enable/disable
 * @unmasked_drdy: True for devices that cannot mask/unmask the data ready pin
 * @has_paging: True if ADIS device has paged registers
 * @has_fifo: True if ADIS device has a hardware FIFO
 * @burst_reg_cmd:	Register command that triggers burst
 * @burst_len:		Burst size in the SPI RX buffer. If @burst_max_len is defined,
 *			this should be the minimum size supported by the device.
 * @burst_max_len:	Holds the maximum burst size when the device supports
 *			more than one burst mode with different sizes
 * @burst_max_speed_hz:	Maximum spi speed that can be used in burst mode
 */
struct adis_data {
	unsigned int read_delay;
	unsigned int write_delay;
	unsigned int cs_change_delay;

	unsigned int glob_cmd_reg;
	unsigned int msc_ctrl_reg;
	unsigned int diag_stat_reg;
	unsigned int diag_stat_size;
	unsigned int prod_id_reg;

	unsigned int prod_id;

	unsigned int self_test_mask;
	unsigned int self_test_reg;
	bool self_test_no_autoclear;
	const struct adis_timeout *timeouts;

	const char * const *status_error_msgs;
	unsigned int status_error_mask;

	int (*enable_irq)(struct adis *adis, bool enable);
	bool unmasked_drdy;

	bool has_paging;
	bool has_fifo;

	unsigned int burst_reg_cmd;
	unsigned int burst_len;
	unsigned int burst_max_len;
	unsigned int burst_max_speed_hz;
};

/**
 * struct adis_ops: Custom ops for adis devices.
 * @write: Custom spi write implementation.
 * @read: Custom spi read implementation.
 * @reset: Custom sw reset implementation. The custom implementation does not
 *	   need to sleep after the reset. It's done by the library already.
 */
struct adis_ops {
	int (*write)(struct adis *adis, unsigned int reg, unsigned int value,
		     unsigned int size);
	int (*read)(struct adis *adis, unsigned int reg, unsigned int *value,
		    unsigned int size);
	int (*reset)(struct adis *adis);
};

/**
 * struct adis - ADIS device instance data
 * @spi: Reference to SPI device which owns this ADIS IIO device
 * @trig: IIO trigger object data
 * @data: ADIS chip variant specific data
 * @burst_extra_len: Burst extra length. Should only be used by devices that can
 *		     dynamically change their burst mode length.

Annotation

Implementation Notes