linux/drivers/iio/proximity/isl29501.c

// SPDX-License-Identifier: GPL-2.0
/*
 * isl29501.c: ISL29501 Time of Flight sensor driver.
 *
 * Copyright (C) 2018
 * Author: Mathieu Othacehe <[email protected]>
 *
 * 7-bit I2C slave address: 0x57
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/err.h>
#include <linux/mod_devicetable.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>

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

/* Control, setting and status registers */
#define ISL29501_DEVICE_ID
#define ISL29501_ID

/* Sampling control registers */
#define ISL29501_INTEGRATION_PERIOD
#define ISL29501_SAMPLE_PERIOD

/* Closed loop calibration registers */
#define ISL29501_CROSSTALK_I_MSB
#define ISL29501_CROSSTALK_I_LSB
#define ISL29501_CROSSTALK_I_EXPONENT
#define ISL29501_CROSSTALK_Q_MSB
#define ISL29501_CROSSTALK_Q_LSB
#define ISL29501_CROSSTALK_Q_EXPONENT
#define ISL29501_CROSSTALK_GAIN_MSB
#define ISL29501_CROSSTALK_GAIN_LSB
#define ISL29501_MAGNITUDE_REF_EXP
#define ISL29501_MAGNITUDE_REF_MSB
#define ISL29501_MAGNITUDE_REF_LSB
#define ISL29501_PHASE_OFFSET_MSB
#define ISL29501_PHASE_OFFSET_LSB

/* Analog control registers */
#define ISL29501_DRIVER_RANGE
#define ISL29501_EMITTER_DAC

#define ISL29501_COMMAND_REGISTER

/* Commands */
#define ISL29501_EMUL_SAMPLE_START_PIN
#define ISL29501_RESET_ALL_REGISTERS
#define ISL29501_RESET_INT_SM

/* Ambiant light and temperature corrections */
#define ISL29501_TEMP_REFERENCE
#define ISL29501_PHASE_EXPONENT
#define ISL29501_TEMP_COEFF_A
#define ISL29501_TEMP_COEFF_B
#define ISL29501_AMBIANT_COEFF_A
#define ISL29501_AMBIANT_COEFF_B

/* Data output registers */
#define ISL29501_DISTANCE_MSB_DATA
#define ISL29501_DISTANCE_LSB_DATA
#define ISL29501_PRECISION_MSB
#define ISL29501_PRECISION_LSB
#define ISL29501_MAGNITUDE_EXPONENT
#define ISL29501_MAGNITUDE_MSB
#define ISL29501_MAGNITUDE_LSB
#define ISL29501_PHASE_MSB
#define ISL29501_PHASE_LSB
#define ISL29501_I_RAW_EXPONENT
#define ISL29501_I_RAW_MSB
#define ISL29501_I_RAW_LSB
#define ISL29501_Q_RAW_EXPONENT
#define ISL29501_Q_RAW_MSB
#define ISL29501_Q_RAW_LSB
#define ISL29501_DIE_TEMPERATURE
#define ISL29501_AMBIENT_LIGHT
#define ISL29501_GAIN_MSB
#define ISL29501_GAIN_LSB

#define ISL29501_MAX_EXP_VAL

#define ISL29501_INT_TIME_AVAILABLE

#define ISL29501_CURRENT_SCALE_AVAILABLE

enum isl29501_correction_coeff {};

struct isl29501_private {};

enum isl29501_register_name {};

struct isl29501_register_desc {};

static const struct isl29501_register_desc isl29501_registers[] =;

static int isl29501_register_read(struct isl29501_private *isl29501,
				  enum isl29501_register_name name,
				  u32 *val)
{}

static u32 isl29501_register_write(struct isl29501_private *isl29501,
				   enum isl29501_register_name name,
				   u32 value)
{}

static ssize_t isl29501_read_ext(struct iio_dev *indio_dev,
				 uintptr_t private,
				 const struct iio_chan_spec *chan,
				 char *buf)
{}

static int isl29501_set_shadow_coeff(struct isl29501_private *isl29501,
				     enum isl29501_register_name reg,
				     unsigned int val)
{}

static int isl29501_write_coeff(struct isl29501_private *isl29501,
				enum isl29501_correction_coeff coeff,
				int val)
{}

static unsigned int isl29501_find_corr_exp(unsigned int val,
					   unsigned int max_exp,
					   unsigned int max_mantissa)
{}

static ssize_t isl29501_write_ext(struct iio_dev *indio_dev,
				  uintptr_t private,
				  const struct iio_chan_spec *chan,
				  const char *buf, size_t len)
{}

#define _ISL29501_EXT_INFO(_name, _ident)

static const struct iio_chan_spec_ext_info isl29501_ext_info[] =;

#define ISL29501_DISTANCE_SCAN_INDEX
#define ISL29501_TIMESTAMP_SCAN_INDEX

static const struct iio_chan_spec isl29501_channels[] =;

static int isl29501_reset_registers(struct isl29501_private *isl29501)
{}

static int isl29501_begin_acquisition(struct isl29501_private *isl29501)
{}

static IIO_CONST_ATTR_INT_TIME_AVAIL(ISL29501_INT_TIME_AVAILABLE);
static IIO_CONST_ATTR(out_current_scale_available,
		      ISL29501_CURRENT_SCALE_AVAILABLE);

static struct attribute *isl29501_attributes[] =;

static const struct attribute_group isl29501_attribute_group =;

static const int isl29501_current_scale_table[][2] =;

static const int isl29501_int_time[][2] =;

static int isl29501_get_raw(struct isl29501_private *isl29501,
			    const struct iio_chan_spec *chan,
			    int *raw)
{}

static int isl29501_get_scale(struct isl29501_private *isl29501,
			      const struct iio_chan_spec *chan,
			      int *val, int *val2)
{}

static int isl29501_get_calibbias(struct isl29501_private *isl29501,
				  const struct iio_chan_spec *chan,
				  int *bias)
{}

static int isl29501_get_inttime(struct isl29501_private *isl29501,
				int *val, int *val2)
{}

static int isl29501_get_freq(struct isl29501_private *isl29501,
			     int *val, int *val2)
{}

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

static int isl29501_set_raw(struct isl29501_private *isl29501,
			    const struct iio_chan_spec *chan,
			    int raw)
{}

static int isl29501_set_inttime(struct isl29501_private *isl29501,
				int val, int val2)
{}

static int isl29501_set_scale(struct isl29501_private *isl29501,
			      const struct iio_chan_spec *chan,
			      int val, int val2)
{}

static int isl29501_set_calibbias(struct isl29501_private *isl29501,
				  const struct iio_chan_spec *chan,
				  int bias)
{}

static int isl29501_set_freq(struct isl29501_private *isl29501,
			     int val, int val2)
{}

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

static const struct iio_info isl29501_info =;

static int isl29501_init_chip(struct isl29501_private *isl29501)
{}

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

static int isl29501_probe(struct i2c_client *client)
{}

static const struct i2c_device_id isl29501_id[] =;

MODULE_DEVICE_TABLE(i2c, isl29501_id);

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

static struct i2c_driver isl29501_driver =;
module_i2c_driver();

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