Example #1
0
#define ST_ACCEL_6_FS_AVL_400_VAL		0x03
#define ST_ACCEL_6_FS_AVL_100_GAIN		IIO_G_TO_M_S_2(49000)
#define ST_ACCEL_6_FS_AVL_200_GAIN		IIO_G_TO_M_S_2(98000)
#define ST_ACCEL_6_FS_AVL_400_GAIN		IIO_G_TO_M_S_2(195000)
#define ST_ACCEL_6_BDU_ADDR			0x23
#define ST_ACCEL_6_BDU_MASK			0x80
#define ST_ACCEL_6_DRDY_IRQ_ADDR		0x22
#define ST_ACCEL_6_DRDY_IRQ_INT1_MASK		0x02
#define ST_ACCEL_6_DRDY_IRQ_INT2_MASK		0x10
#define ST_ACCEL_6_IHL_IRQ_ADDR			0x22
#define ST_ACCEL_6_IHL_IRQ_MASK			0x80
#define ST_ACCEL_6_MULTIREAD_BIT		true

static const struct iio_chan_spec st_accel_8bit_channels[] = {
	ST_SENSORS_LSM_CHANNELS(IIO_ACCEL,
			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
			ST_SENSORS_SCAN_X, 1, IIO_MOD_X, 's', IIO_LE, 8, 8,
			ST_ACCEL_DEFAULT_OUT_X_L_ADDR+1),
	ST_SENSORS_LSM_CHANNELS(IIO_ACCEL,
			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
			ST_SENSORS_SCAN_Y, 1, IIO_MOD_Y, 's', IIO_LE, 8, 8,
			ST_ACCEL_DEFAULT_OUT_Y_L_ADDR+1),
	ST_SENSORS_LSM_CHANNELS(IIO_ACCEL,
			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
			ST_SENSORS_SCAN_Z, 1, IIO_MOD_Z, 's', IIO_LE, 8, 8,
			ST_ACCEL_DEFAULT_OUT_Z_L_ADDR+1),
	IIO_CHAN_SOFT_TIMESTAMP(3)
};

static const struct iio_chan_spec st_accel_12bit_channels[] = {
	ST_SENSORS_LSM_CHANNELS(IIO_ACCEL,
			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
Example #2
0
#define ST_PRESS_1_PW_MASK			0x80
#define ST_PRESS_1_FS_ADDR			0x23
#define ST_PRESS_1_FS_MASK			0x30
#define ST_PRESS_1_FS_AVL_1260_VAL		0x00
#define ST_PRESS_1_FS_AVL_TEMP_GAIN		2083000
#define ST_PRESS_1_FS_AVL_1260_GAIN		ST_PRESS_KPASCAL_NANO_SCALE
#define ST_PRESS_1_BDU_ADDR			0x20
#define ST_PRESS_1_BDU_MASK			0x04
#define ST_PRESS_1_DRDY_IRQ_ADDR		0x22
#define ST_PRESS_1_DRDY_IRQ_MASK		0x04
#define ST_PRESS_1_MULTIREAD_BIT		true
#define ST_PRESS_1_TEMP_OFFSET			42500

static const struct iio_chan_spec st_press_channels[] = {
	ST_SENSORS_LSM_CHANNELS(IIO_PRESSURE,
			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
			ST_SENSORS_SCAN_X, 0, IIO_NO_MOD, 'u', IIO_LE, 24, 24,
			ST_PRESS_DEFAULT_OUT_XL_ADDR),
	ST_SENSORS_LSM_CHANNELS(IIO_TEMP,
			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE) |
						BIT(IIO_CHAN_INFO_OFFSET),
			-1, 0, IIO_NO_MOD, 's', IIO_LE, 16, 16,
			ST_TEMP_DEFAULT_OUT_L_ADDR),
	IIO_CHAN_SOFT_TIMESTAMP(1)
};

static const struct st_sensors st_press_sensors[] = {
	{
		.wai = ST_PRESS_1_WAI_EXP,
		.sensors_supported = {
			[0] = LPS331AP_PRESS_DEV_NAME,
		},
#define ST_GYRO_2_FS_MASK			0x30
#define ST_GYRO_2_FS_AVL_250_VAL		0x00
#define ST_GYRO_2_FS_AVL_500_VAL		0x01
#define ST_GYRO_2_FS_AVL_2000_VAL		0x02
#define ST_GYRO_2_FS_AVL_250_GAIN		IIO_DEGREE_TO_RAD(8750)
#define ST_GYRO_2_FS_AVL_500_GAIN		IIO_DEGREE_TO_RAD(17500)
#define ST_GYRO_2_FS_AVL_2000_GAIN		IIO_DEGREE_TO_RAD(70000)
#define ST_GYRO_2_BDU_ADDR			0x23
#define ST_GYRO_2_BDU_MASK			0x80
#define ST_GYRO_2_DRDY_IRQ_ADDR			0x22
#define ST_GYRO_2_DRDY_IRQ_MASK			0x08
#define ST_GYRO_2_MULTIREAD_BIT			true

static const struct iio_chan_spec st_gyro_16bit_channels[] = {
	ST_SENSORS_LSM_CHANNELS(IIO_ANGL_VEL, ST_SENSORS_SCAN_X,
		IIO_MOD_X, IIO_LE, ST_SENSORS_DEFAULT_16_REALBITS,
						ST_GYRO_DEFAULT_OUT_X_L_ADDR),
	ST_SENSORS_LSM_CHANNELS(IIO_ANGL_VEL, ST_SENSORS_SCAN_Y,
		IIO_MOD_Y, IIO_LE, ST_SENSORS_DEFAULT_16_REALBITS,
						ST_GYRO_DEFAULT_OUT_Y_L_ADDR),
	ST_SENSORS_LSM_CHANNELS(IIO_ANGL_VEL, ST_SENSORS_SCAN_Z,
		IIO_MOD_Z, IIO_LE, ST_SENSORS_DEFAULT_16_REALBITS,
						ST_GYRO_DEFAULT_OUT_Z_L_ADDR),
	IIO_CHAN_SOFT_TIMESTAMP(3)
};

static const struct st_sensors st_gyro_sensors[] = {
	{
		.wai = ST_GYRO_1_WAI_EXP,
		.sensors_supported = {
			[0] = L3G4200D_GYRO_DEV_NAME,
Example #4
0
#define ST_GYRO_3_FS_AVL_250_VAL		0x00
#define ST_GYRO_3_FS_AVL_500_VAL		0x01
#define ST_GYRO_3_FS_AVL_2000_VAL		0x02
#define ST_GYRO_3_FS_AVL_250_GAIN		IIO_DEGREE_TO_RAD(8750)
#define ST_GYRO_3_FS_AVL_500_GAIN		IIO_DEGREE_TO_RAD(17500)
#define ST_GYRO_3_FS_AVL_2000_GAIN		IIO_DEGREE_TO_RAD(70000)
#define ST_GYRO_3_BDU_ADDR			0x23
#define ST_GYRO_3_BDU_MASK			0x80
#define ST_GYRO_3_DRDY_IRQ_ADDR			0x22
#define ST_GYRO_3_DRDY_IRQ_INT2_MASK		0x08
#define ST_GYRO_3_MULTIREAD_BIT			true


static const struct iio_chan_spec st_gyro_16bit_channels[] = {
	ST_SENSORS_LSM_CHANNELS(IIO_ANGL_VEL,
			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
			ST_SENSORS_SCAN_X, 1, IIO_MOD_X, 's', IIO_LE, 16, 16,
			ST_GYRO_DEFAULT_OUT_X_L_ADDR),
	ST_SENSORS_LSM_CHANNELS(IIO_ANGL_VEL,
			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
			ST_SENSORS_SCAN_Y, 1, IIO_MOD_Y, 's', IIO_LE, 16, 16,
			ST_GYRO_DEFAULT_OUT_Y_L_ADDR),
	ST_SENSORS_LSM_CHANNELS(IIO_ANGL_VEL,
			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
			ST_SENSORS_SCAN_Z, 1, IIO_MOD_Z, 's', IIO_LE, 16, 16,
			ST_GYRO_DEFAULT_OUT_Z_L_ADDR),
	IIO_CHAN_SOFT_TIMESTAMP(3)
};

static const struct st_sensor_settings st_gyro_sensors_settings[] = {
	{
		.wai = ST_GYRO_1_WAI_EXP,
Example #5
0
#define ST_MAGN_2_FS_AVL_4000_VAL		0x00
#define ST_MAGN_2_FS_AVL_8000_VAL		0x01
#define ST_MAGN_2_FS_AVL_12000_VAL		0x02
#define ST_MAGN_2_FS_AVL_16000_VAL		0x03
#define ST_MAGN_2_FS_AVL_4000_GAIN		146
#define ST_MAGN_2_FS_AVL_8000_GAIN		292
#define ST_MAGN_2_FS_AVL_12000_GAIN		438
#define ST_MAGN_2_FS_AVL_16000_GAIN		584
#define ST_MAGN_2_MULTIREAD_BIT			false
#define ST_MAGN_2_OUT_X_L_ADDR			0x28
#define ST_MAGN_2_OUT_Y_L_ADDR			0x2a
#define ST_MAGN_2_OUT_Z_L_ADDR			0x2c

static const struct iio_chan_spec st_magn_16bit_channels[] = {
    ST_SENSORS_LSM_CHANNELS(IIO_MAGN,
    BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
    ST_SENSORS_SCAN_X, 1, IIO_MOD_X, 's', IIO_BE, 16, 16,
    ST_MAGN_DEFAULT_OUT_X_H_ADDR),
    ST_SENSORS_LSM_CHANNELS(IIO_MAGN,
    BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
    ST_SENSORS_SCAN_Y, 1, IIO_MOD_Y, 's', IIO_BE, 16, 16,
    ST_MAGN_DEFAULT_OUT_Y_H_ADDR),
    ST_SENSORS_LSM_CHANNELS(IIO_MAGN,
    BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
    ST_SENSORS_SCAN_Z, 1, IIO_MOD_Z, 's', IIO_BE, 16, 16,
    ST_MAGN_DEFAULT_OUT_Z_H_ADDR),
    IIO_CHAN_SOFT_TIMESTAMP(3)
};

static const struct iio_chan_spec st_magn_2_16bit_channels[] = {
    ST_SENSORS_LSM_CHANNELS(IIO_MAGN,
    BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
#define ST_MAGN_2_PW_OFF			0x03
#define ST_MAGN_2_FS_ADDR			0x21
#define ST_MAGN_2_FS_MASK			0x60
#define ST_MAGN_2_FS_AVL_4000_VAL		0x00
#define ST_MAGN_2_FS_AVL_8000_VAL		0x01
#define ST_MAGN_2_FS_AVL_10000_VAL		0x02
#define ST_MAGN_2_FS_AVL_4000_GAIN		430
#define ST_MAGN_2_FS_AVL_8000_GAIN		230
#define ST_MAGN_2_FS_AVL_10000_GAIN		230
#define ST_MAGN_2_MULTIREAD_BIT			false
#define ST_MAGN_2_OUT_X_L_ADDR			0x28
#define ST_MAGN_2_OUT_Y_L_ADDR			0x2a
#define ST_MAGN_2_OUT_Z_L_ADDR			0x2c

static const struct iio_chan_spec st_magn_16bit_channels[] = {
	ST_SENSORS_LSM_CHANNELS(IIO_MAGN, ST_SENSORS_SCAN_X, IIO_MOD_X, IIO_LE,
		ST_SENSORS_DEFAULT_16_REALBITS, ST_MAGN_DEFAULT_OUT_X_L_ADDR),
	ST_SENSORS_LSM_CHANNELS(IIO_MAGN, ST_SENSORS_SCAN_Y, IIO_MOD_Y, IIO_LE,
		ST_SENSORS_DEFAULT_16_REALBITS, ST_MAGN_DEFAULT_OUT_Y_L_ADDR),
	ST_SENSORS_LSM_CHANNELS(IIO_MAGN, ST_SENSORS_SCAN_Z, IIO_MOD_Z, IIO_LE,
		ST_SENSORS_DEFAULT_16_REALBITS, ST_MAGN_DEFAULT_OUT_Z_L_ADDR),
	IIO_CHAN_SOFT_TIMESTAMP(3)
};

static const struct iio_chan_spec st_magn_2_16bit_channels[] = {
	ST_SENSORS_LSM_CHANNELS(IIO_MAGN, ST_SENSORS_SCAN_X, IIO_MOD_X, IIO_LE,
		ST_SENSORS_DEFAULT_16_REALBITS, ST_MAGN_2_OUT_X_L_ADDR),
	ST_SENSORS_LSM_CHANNELS(IIO_MAGN, ST_SENSORS_SCAN_Y, IIO_MOD_Y, IIO_LE,
		ST_SENSORS_DEFAULT_16_REALBITS, ST_MAGN_2_OUT_Y_L_ADDR),
	ST_SENSORS_LSM_CHANNELS(IIO_MAGN, ST_SENSORS_SCAN_Z, IIO_MOD_Z, IIO_LE,
		ST_SENSORS_DEFAULT_16_REALBITS, ST_MAGN_2_OUT_Z_L_ADDR),
	IIO_CHAN_SOFT_TIMESTAMP(3)