linux/drivers/iio/proximity/irsd200.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Driver for Murata IRS-D200 PIR sensor.
 *
 * Copyright (C) 2023 Axis Communications AB
 */

#include <asm/unaligned.h>
#include <linux/bitfield.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/regmap.h>

#include <linux/iio/buffer.h>
#include <linux/iio/events.h>
#include <linux/iio/iio.h>
#include <linux/iio/trigger.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/iio/types.h>

#define IRS_DRV_NAME

/* Registers. */
#define IRS_REG_OP
#define IRS_REG_DATA_LO
#define IRS_REG_DATA_HI
#define IRS_REG_STATUS
#define IRS_REG_COUNT
#define IRS_REG_DATA_RATE
#define IRS_REG_FILTER
#define IRS_REG_INTR
#define IRS_REG_NR_COUNT
#define IRS_REG_THR_HI
#define IRS_REG_THR_LO
#define IRS_REG_TIMER_LO
#define IRS_REG_TIMER_HI

/* Interrupt status bits. */
#define IRS_INTR_DATA
#define IRS_INTR_TIMER
#define IRS_INTR_COUNT_THR_AND
#define IRS_INTR_COUNT_THR_OR

/* Operation states. */
#define IRS_OP_ACTIVE
#define IRS_OP_SLEEP

/*
 * Quantization scale value for threshold. Used for conversion from/to register
 * value.
 */
#define IRS_THR_QUANT_SCALE

#define IRS_UPPER_COUNT(count)
#define IRS_LOWER_COUNT(count)

/* Index corresponds to the value of IRS_REG_DATA_RATE register. */
static const int irsd200_data_rates[] =;

/* Index corresponds to the (field) value of IRS_REG_FILTER register. */
static const unsigned int irsd200_lp_filter_freq[] =;

/*
 * Index corresponds to the (field) value of IRS_REG_FILTER register. Note that
 * this represents a fractional value (e.g the first value corresponds to 3 / 10
 * = 0.3 Hz).
 */
static const unsigned int irsd200_hp_filter_freq[][2] =;

/* Register fields. */
enum irsd200_regfield {};

static const struct reg_field irsd200_regfields[] =;

static const struct regmap_config irsd200_regmap_config =;

struct irsd200_data {};

static int irsd200_setup(struct irsd200_data *data)
{}

static int irsd200_read_threshold(struct irsd200_data *data,
				  enum iio_event_direction dir, int *val)
{}

static int irsd200_write_threshold(struct irsd200_data *data,
				   enum iio_event_direction dir, int val)
{}

static int irsd200_read_data(struct irsd200_data *data, s16 *val)
{}

static int irsd200_read_data_rate(struct irsd200_data *data, int *val)
{}

static int irsd200_write_data_rate(struct irsd200_data *data, int val)
{}

static int irsd200_read_timer(struct irsd200_data *data, int *val, int *val2)
{}

static int irsd200_write_timer(struct irsd200_data *data, int val, int val2)
{}

static int irsd200_read_nr_count(struct irsd200_data *data, int *val)
{}

static int irsd200_write_nr_count(struct irsd200_data *data, int val)
{}

static int irsd200_read_lp_filter(struct irsd200_data *data, int *val)
{}

static int irsd200_write_lp_filter(struct irsd200_data *data, int val)
{}

static int irsd200_read_hp_filter(struct irsd200_data *data, int *val,
				  int *val2)
{}

static int irsd200_write_hp_filter(struct irsd200_data *data, int val, int val2)
{}

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

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

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

static int irsd200_read_event(struct iio_dev *indio_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 irsd200_write_event(struct iio_dev *indio_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 irsd200_read_event_config(struct iio_dev *indio_dev,
				     const struct iio_chan_spec *chan,
				     enum iio_event_type type,
				     enum iio_event_direction dir)
{}

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

static irqreturn_t irsd200_irq_thread(int irq, void *dev_id)
{}

static irqreturn_t irsd200_trigger_handler(int irq, void *pollf)
{}

static int irsd200_set_trigger_state(struct iio_trigger *trig, bool state)
{}

static const struct iio_info irsd200_info =;

static const struct iio_trigger_ops irsd200_trigger_ops =;

static const struct iio_event_spec irsd200_event_spec[] =;

static const struct iio_chan_spec irsd200_channels[] =;

static int irsd200_probe(struct i2c_client *client)
{}

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

static struct i2c_driver irsd200_driver =;
module_i2c_driver();

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