#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(…) …;