linux/drivers/iio/accel/sca3300.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Murata SCA3300 3-axis industrial accelerometer
 *
 * Copyright (c) 2021 Vaisala Oyj. All rights reserved.
 */

#include <linux/bitops.h>
#include <linux/crc8.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/spi/spi.h>

#include <asm/unaligned.h>

#include <linux/iio/buffer.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>

#define SCA3300_ALIAS

#define SCA3300_CRC8_POLYNOMIAL

/* Device mode register */
#define SCA3300_REG_MODE
#define SCA3300_MODE_SW_RESET

/* Last register in map */
#define SCA3300_REG_SELBANK

/* Device status and mask */
#define SCA3300_REG_STATUS
#define SCA3300_STATUS_MASK

/* Device ID */
#define SCA3300_REG_WHOAMI
#define SCA3300_WHOAMI_ID
#define SCL3300_WHOAMI_ID

/* Device return status and mask */
#define SCA3300_VALUE_RS_ERROR
#define SCA3300_MASK_RS_STATUS

#define SCL3300_REG_ANG_CTRL
#define SCL3300_ANG_ENABLE

enum sca3300_scan_indexes {};

/*
 * Buffer size max case:
 * Three accel channels, two bytes per channel.
 * Temperature channel, two bytes.
 * Three incli channels, two bytes per channel.
 * Timestamp channel, eight bytes.
 */
#define SCA3300_MAX_BUFFER_SIZE

#define SCA3300_ACCEL_CHANNEL(index, reg, axis)

#define SCA3300_INCLI_CHANNEL(index, reg, axis)

#define SCA3300_TEMP_CHANNEL(index, reg)

static const struct iio_chan_spec sca3300_channels[] =;

static const int sca3300_lp_freq[] =;
static const int sca3300_lp_freq_map[] =;

static const int scl3300_lp_freq[] =;
static const int scl3300_lp_freq_map[] =;

static const int sca3300_accel_scale[][2] =;
static const int sca3300_accel_scale_map[] =;

static const int scl3300_accel_scale[][2] =;
static const int scl3300_accel_scale_map[] =;

static const int scl3300_incli_scale[][2] =;
static const int scl3300_incli_scale_map[] =;

static const int sca3300_avail_modes_map[] =;
static const int scl3300_avail_modes_map[] =;

static const struct iio_chan_spec scl3300_channels[] =;

static const unsigned long sca3300_scan_masks[] =;

static const unsigned long scl3300_scan_masks[] =;

struct sca3300_chip_info {};

/**
 * struct sca3300_data - device data
 * @spi: SPI device structure
 * @lock: Data buffer lock
 * @chip: Sensor chip specific information
 * @buffer: Triggered buffer:
 *          -SCA3300: 4 channel 16-bit data + 64-bit timestamp
 *          -SCL3300: 7 channel 16-bit data + 64-bit timestamp
 * @txbuf: Transmit buffer
 * @rxbuf: Receive buffer
 */
struct sca3300_data {};

static const struct sca3300_chip_info sca3300_chip_tbl[] =;

DECLARE_CRC8_TABLE(sca3300_crc_table);

static int sca3300_transfer(struct sca3300_data *sca_data, int *val)
{}

static int sca3300_error_handler(struct sca3300_data *sca_data)
{}

static int sca3300_read_reg(struct sca3300_data *sca_data, u8 reg, int *val)
{}

static int sca3300_write_reg(struct sca3300_data *sca_data, u8 reg, int val)
{}

static int sca3300_set_op_mode(struct sca3300_data *sca_data, int index)
{}

static int sca3300_get_op_mode(struct sca3300_data *sca_data, int *index)
{}

static int sca3300_set_frequency(struct sca3300_data *data, int val)
{}

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

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

static irqreturn_t sca3300_trigger_handler(int irq, void *p)
{}

/*
 * sca3300_init - Device init sequence. See datasheet rev 2 section
 * 4.2 Start-Up Sequence for details.
 */
static int sca3300_init(struct sca3300_data *sca_data,
			struct iio_dev *indio_dev)
{}

static int sca3300_debugfs_reg_access(struct iio_dev *indio_dev,
				      unsigned int reg, unsigned int writeval,
				      unsigned int *readval)
{}

static int sca3300_read_avail(struct iio_dev *indio_dev,
			      struct iio_chan_spec const *chan,
			      const int **vals, int *type, int *length,
			      long mask)
{}

static const struct iio_info sca3300_info =;

static int sca3300_probe(struct spi_device *spi)
{}

static const struct of_device_id sca3300_dt_ids[] =;
MODULE_DEVICE_TABLE(of, sca3300_dt_ids);

static const struct spi_device_id sca3300_ids[] =;
MODULE_DEVICE_TABLE(spi, sca3300_ids);

static struct spi_driver sca3300_driver =;
module_spi_driver();

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