Lines Matching +full:6 +full:- +full:axis

1 // SPDX-License-Identifier: GPL-2.0
3 * FXOS8700 - NXP IMU (accelerometer plus magnetometer)
161 #define FXOS8700_ACTIVE_MIN_USLEEP 4000 /* from table 6 in datasheet */
304 {0x06, 6, 250000},
326 return -EINVAL; in fxos8700_to_sensor()
335 ret = regmap_write(data->regmap, FXOS8700_CTRL_REG1, mode); in fxos8700_set_active_mode()
351 struct device *dev = regmap_get_device(data->regmap); in fxos8700_set_scale()
355 return -EINVAL; in fxos8700_set_scale()
360 * full-scale range(2g/4g/8g) in FXOS8700_XYZ_DATA_CFG. in fxos8700_set_scale()
363 * an ACCEL full-scale range. in fxos8700_set_scale()
365 ret = regmap_read(data->regmap, FXOS8700_CTRL_REG1, &val); in fxos8700_set_scale()
371 ret = regmap_write(data->regmap, FXOS8700_CTRL_REG1, in fxos8700_set_scale()
382 return -EINVAL; in fxos8700_set_scale()
384 ret = regmap_write(data->regmap, FXOS8700_XYZ_DATA_CFG, in fxos8700_set_scale()
388 return regmap_write(data->regmap, FXOS8700_CTRL_REG1, in fxos8700_set_scale()
403 ret = regmap_read(data->regmap, FXOS8700_XYZ_DATA_CFG, &val); in fxos8700_get_scale()
414 return -EINVAL; in fxos8700_get_scale()
418 int axis, int *val) in fxos8700_get_data() argument
437 return -EINVAL; in fxos8700_get_data()
440 /* Block read 6 bytes of device output registers to avoid data loss */ in fxos8700_get_data()
441 ret = regmap_bulk_read(data->regmap, base, data->buf, in fxos8700_get_data()
442 sizeof(data->buf)); in fxos8700_get_data()
446 /* Convert axis to buffer index */ in fxos8700_get_data()
447 reg = axis - IIO_MOD_X; in fxos8700_get_data()
453 tmp = be16_to_cpu(data->buf[reg]); in fxos8700_get_data()
456 * ACCEL output data registers contain the X-axis, Y-axis, and Z-axis in fxos8700_get_data()
457 * 14-bit left-justified sample data and MAGN output data registers in fxos8700_get_data()
458 * contain the X-axis, Y-axis, and Z-axis 16-bit sample data. Apply in fxos8700_get_data()
471 return -EINVAL; in fxos8700_get_data()
487 ret = regmap_read(data->regmap, FXOS8700_CTRL_REG1, &val); in fxos8700_set_odr()
498 ret = regmap_write(data->regmap, FXOS8700_CTRL_REG1, in fxos8700_set_odr()
509 return -EINVAL; in fxos8700_set_odr()
513 return regmap_write(data->regmap, FXOS8700_CTRL_REG1, val); in fxos8700_set_odr()
522 ret = regmap_read(data->regmap, FXOS8700_CTRL_REG1, &val); in fxos8700_get_odr()
533 return -EINVAL; in fxos8700_get_odr()
550 ret = fxos8700_get_data(data, chan->type, chan->channel2, val); in fxos8700_read_raw()
556 ret = fxos8700_get_scale(data, fxos8700_to_sensor(chan->type), in fxos8700_read_raw()
560 ret = fxos8700_get_odr(data, fxos8700_to_sensor(chan->type), in fxos8700_read_raw()
564 return -EINVAL; in fxos8700_read_raw()
576 return fxos8700_set_scale(data, fxos8700_to_sensor(chan->type), in fxos8700_write_raw()
579 return fxos8700_set_odr(data, fxos8700_to_sensor(chan->type), in fxos8700_write_raw()
582 return -EINVAL; in fxos8700_write_raw()
615 struct device *dev = regmap_get_device(data->regmap); in fxos8700_chip_init()
617 ret = regmap_read(data->regmap, FXOS8700_WHO_AM_I, &val); in fxos8700_chip_init()
625 return -ENODEV; in fxos8700_chip_init()
640 ret = regmap_write(data->regmap, FXOS8700_CTRL_REG1, 0x00); in fxos8700_chip_init()
645 ret = regmap_write(data->regmap, FXOS8700_M_CTRL_REG1, in fxos8700_chip_init()
651 ret = regmap_write(data->regmap, FXOS8700_M_CTRL_REG2, in fxos8700_chip_init()
658 * Set max full-scale range (+/-8G) for ACCEL sensor in chip in fxos8700_chip_init()
661 ret = regmap_write(data->regmap, FXOS8700_XYZ_DATA_CFG, MODE_8G); in fxos8700_chip_init()
666 return regmap_update_bits(data->regmap, FXOS8700_CTRL_REG1, in fxos8700_chip_init()
689 return -ENOMEM; in fxos8700_core_probe()
693 data->regmap = regmap; in fxos8700_core_probe()
703 indio_dev->channels = fxos8700_channels; in fxos8700_core_probe()
704 indio_dev->num_channels = ARRAY_SIZE(fxos8700_channels); in fxos8700_core_probe()
705 indio_dev->name = name ? name : "fxos8700"; in fxos8700_core_probe()
706 indio_dev->modes = INDIO_DIRECT_MODE; in fxos8700_core_probe()
707 indio_dev->info = &fxos8700_info; in fxos8700_core_probe()
714 MODULE_DESCRIPTION("FXOS8700 6-Axis Acc and Mag Combo Sensor driver");