linux/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * STMicroelectronics st_lsm6dsx sensor driver
 *
 * The ST LSM6DSx IMU MEMS series consists of 3D digital accelerometer
 * and 3D digital gyroscope system-in-package with a digital I2C/SPI serial
 * interface standard output.
 * LSM6DSx IMU MEMS series has a dynamic user-selectable full-scale
 * acceleration range of +-2/+-4/+-8/+-16 g and an angular rate range of
 * +-125/+-245/+-500/+-1000/+-2000 dps
 * LSM6DSx series has an integrated First-In-First-Out (FIFO) buffer
 * allowing dynamic batching of sensor data.
 * LSM9DSx series is similar but includes an additional magnetometer, handled
 * by a different driver.
 *
 * Supported sensors:
 *
 * - LSM6DS3
 *   - Accelerometer/Gyroscope supported ODR [Hz]: 12.5, 26, 52, 104, 208, 416
 *   - Accelerometer supported full-scale [g]: +-2/+-4/+-8/+-16
 *   - Gyroscope supported full-scale [dps]: +-125/+-245/+-500/+-1000/+-2000
 *   - FIFO size: 8KB
 *
 * - ISM330DLC
 * - LSM6DS3H
 * - LSM6DS3TR-C
 * - LSM6DSL
 * - LSM6DSM
 *   - Accelerometer/Gyroscope supported ODR [Hz]: 12.5, 26, 52, 104, 208, 416
 *   - Accelerometer supported full-scale [g]: +-2/+-4/+-8/+-16
 *   - Gyroscope supported full-scale [dps]: +-125/+-245/+-500/+-1000/+-2000
 *   - FIFO size: 4KB
 *
 * - ASM330LHH
 * - ASM330LHHX
 * - ASM330LHHXG1
 * - ISM330DHCX
 * - ISM330IS
 * - LSM6DSO
 * - LSM6DSO16IS
 * - LSM6DSOP
 * - LSM6DSOX
 * - LSM6DSR
 * - LSM6DST
 * - LSM6DSTX
 *   - Accelerometer/Gyroscope supported ODR [Hz]: 12.5, 26, 52, 104, 208, 416,
 *     833
 *   - Accelerometer supported full-scale [g]: +-2/+-4/+-8/+-16
 *   - Gyroscope supported full-scale [dps]: +-125/+-245/+-500/+-1000/+-2000
 *   - FIFO size: 3KB
 *
 * - LSM6DSV
 * - LSM6DSV16X
 *   - Accelerometer/Gyroscope supported ODR [Hz]: 7.5, 15, 30, 60, 120, 240,
 *     480, 960
 *   - Accelerometer supported full-scale [g]: +-2/+-4/+-8/+-16
 *   - Gyroscope supported full-scale [dps]: +-125/+-250/+-500/+-1000/+-2000
 *   - FIFO size: 3KB
 *
 * - LSM6DS0
 * - LSM9DS1
 *   - Accelerometer supported ODR [Hz]: 10, 50, 119, 238, 476, 952
 *   - Accelerometer supported full-scale [g]: +-2/+-4/+-8/+-16
 *   - Gyroscope supported ODR [Hz]: 15, 60, 119, 238, 476, 952
 *   - Gyroscope supported full-scale [dps]: +-245/+-500/+-2000
 *   - FIFO size: 32
 *
 * Copyright 2016 STMicroelectronics Inc.
 *
 * Lorenzo Bianconi <[email protected]>
 * Denis Ciocca <[email protected]>
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/iio/events.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/minmax.h>
#include <linux/pm.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/bitfield.h>

#include <linux/platform_data/st_sensors_pdata.h>

#include "st_lsm6dsx.h"

#define ST_LSM6DSX_REG_WHOAMI_ADDR

#define ST_LSM6DSX_TS_SENSITIVITY

static const struct iio_chan_spec st_lsm6dsx_acc_channels[] =;

static const struct iio_chan_spec st_lsm6dsx_gyro_channels[] =;

static const struct iio_chan_spec st_lsm6ds0_gyro_channels[] =;

static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] =;

int st_lsm6dsx_set_page(struct st_lsm6dsx_hw *hw, bool enable)
{}

static int st_lsm6dsx_check_whoami(struct st_lsm6dsx_hw *hw, int id,
				   const char **name)
{}

static int st_lsm6dsx_set_full_scale(struct st_lsm6dsx_sensor *sensor,
				     u32 gain)
{}

int st_lsm6dsx_check_odr(struct st_lsm6dsx_sensor *sensor, u32 odr, u8 *val)
{}

static int
st_lsm6dsx_check_odr_dependency(struct st_lsm6dsx_hw *hw, u32 odr,
				enum st_lsm6dsx_sensor_id id)
{}

static int
st_lsm6dsx_set_odr(struct st_lsm6dsx_sensor *sensor, u32 req_odr)
{}

static int
__st_lsm6dsx_sensor_set_enable(struct st_lsm6dsx_sensor *sensor,
			       bool enable)
{}

static int
st_lsm6dsx_check_events(struct st_lsm6dsx_sensor *sensor, bool enable)
{}

int st_lsm6dsx_sensor_set_enable(struct st_lsm6dsx_sensor *sensor,
				 bool enable)
{}

static int st_lsm6dsx_read_oneshot(struct st_lsm6dsx_sensor *sensor,
				   u8 addr, int *val)
{}

static int st_lsm6dsx_read_raw(struct iio_dev *iio_dev,
			       struct iio_chan_spec const *ch,
			       int *val, int *val2, long mask)
{}

static int st_lsm6dsx_write_raw(struct iio_dev *iio_dev,
				struct iio_chan_spec const *chan,
				int val, int val2, long mask)
{}

static int st_lsm6dsx_event_setup(struct st_lsm6dsx_hw *hw, int state)
{}

static int st_lsm6dsx_read_event(struct iio_dev *iio_dev,
				 const struct iio_chan_spec *chan,
				 enum iio_event_type type,
				 enum iio_event_direction dir,
				 enum iio_event_info info,
				 int *val, int *val2)
{}

static int
st_lsm6dsx_write_event(struct iio_dev *iio_dev,
		       const struct iio_chan_spec *chan,
		       enum iio_event_type type,
		       enum iio_event_direction dir,
		       enum iio_event_info info,
		       int val, int val2)
{}

static int
st_lsm6dsx_read_event_config(struct iio_dev *iio_dev,
			     const struct iio_chan_spec *chan,
			     enum iio_event_type type,
			     enum iio_event_direction dir)
{}

static int
st_lsm6dsx_write_event_config(struct iio_dev *iio_dev,
			      const struct iio_chan_spec *chan,
			      enum iio_event_type type,
			      enum iio_event_direction dir, int state)
{}

int st_lsm6dsx_set_watermark(struct iio_dev *iio_dev, unsigned int val)
{}

static ssize_t
st_lsm6dsx_sysfs_sampling_frequency_avail(struct device *dev,
					  struct device_attribute *attr,
					  char *buf)
{}

static ssize_t st_lsm6dsx_sysfs_scale_avail(struct device *dev,
					    struct device_attribute *attr,
					    char *buf)
{}

static int st_lsm6dsx_write_raw_get_fmt(struct iio_dev *indio_dev,
					struct iio_chan_spec const *chan,
					long mask)
{}

static IIO_DEV_ATTR_SAMP_FREQ_AVAIL(st_lsm6dsx_sysfs_sampling_frequency_avail);
static IIO_DEVICE_ATTR(in_accel_scale_available, 0444,
		       st_lsm6dsx_sysfs_scale_avail, NULL, 0);
static IIO_DEVICE_ATTR(in_anglvel_scale_available, 0444,
		       st_lsm6dsx_sysfs_scale_avail, NULL, 0);

static struct attribute *st_lsm6dsx_acc_attributes[] =;

static const struct attribute_group st_lsm6dsx_acc_attribute_group =;

static const struct iio_info st_lsm6dsx_acc_info =;

static struct attribute *st_lsm6dsx_gyro_attributes[] =;

static const struct attribute_group st_lsm6dsx_gyro_attribute_group =;

static const struct iio_info st_lsm6dsx_gyro_info =;

static int st_lsm6dsx_get_drdy_pin(struct st_lsm6dsx_hw *hw, int *drdy_pin)
{}

static int
st_lsm6dsx_get_drdy_reg(struct st_lsm6dsx_hw *hw,
			const struct st_lsm6dsx_reg **drdy_reg)
{}

static int st_lsm6dsx_init_shub(struct st_lsm6dsx_hw *hw)
{}

static int st_lsm6dsx_init_hw_timer(struct st_lsm6dsx_hw *hw)
{}

static int st_lsm6dsx_reset_device(struct st_lsm6dsx_hw *hw)
{}

static int st_lsm6dsx_init_device(struct st_lsm6dsx_hw *hw)
{}

static struct iio_dev *st_lsm6dsx_alloc_iiodev(struct st_lsm6dsx_hw *hw,
					       enum st_lsm6dsx_sensor_id id,
					       const char *name)
{}

static bool
st_lsm6dsx_report_motion_event(struct st_lsm6dsx_hw *hw)
{}

static irqreturn_t st_lsm6dsx_handler_thread(int irq, void *private)
{}

static irqreturn_t st_lsm6dsx_sw_trigger_handler_thread(int irq,
							void *private)
{}

static int st_lsm6dsx_irq_setup(struct st_lsm6dsx_hw *hw)
{}

static int st_lsm6dsx_sw_buffer_preenable(struct iio_dev *iio_dev)
{}

static int st_lsm6dsx_sw_buffer_postdisable(struct iio_dev *iio_dev)
{}

static const struct iio_buffer_setup_ops st_lsm6dsx_sw_buffer_ops =;

static int st_lsm6dsx_sw_buffers_setup(struct st_lsm6dsx_hw *hw)
{}

static int st_lsm6dsx_init_regulators(struct device *dev)
{}

#ifdef CONFIG_ACPI

static int lsm6dsx_get_acpi_mount_matrix(struct device *dev,
					 struct iio_mount_matrix *orientation)
{}

#else

static int lsm6dsx_get_acpi_mount_matrix(struct device *dev,
					  struct iio_mount_matrix *orientation)
{
	return -EOPNOTSUPP;
}

#endif

int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
		     struct regmap *regmap)
{}
EXPORT_SYMBOL_NS();

static int st_lsm6dsx_suspend(struct device *dev)
{}

static int st_lsm6dsx_resume(struct device *dev)
{}

EXPORT_NS_SIMPLE_DEV_PM_OPS(st_lsm6dsx_pm_ops, st_lsm6dsx_suspend,
			    st_lsm6dsx_resume, IIO_LSM6DSX);

MODULE_AUTHOR();
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();