linux/drivers/iio/proximity/vl53l0x-i2c.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Support for ST VL53L0X FlightSense ToF Ranging Sensor on a i2c bus.
 *
 * Copyright (C) 2016 STMicroelectronics Imaging Division.
 * Copyright (C) 2018 Song Qiang <[email protected]>
 * Copyright (C) 2020 Ivan Drobyshevskyi <[email protected]>
 *
 * Datasheet available at
 * <https://www.st.com/resource/en/datasheet/vl53l0x.pdf>
 *
 * Default 7-bit i2c slave address 0x29.
 *
 * TODO: FIFO buffer, continuous mode, range selection, sensor ID check.
 */

#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
#include <linux/module.h>

#include <linux/iio/iio.h>

#define VL_REG_SYSRANGE_START

#define VL_REG_SYSRANGE_MODE_MASK
#define VL_REG_SYSRANGE_MODE_SINGLESHOT
#define VL_REG_SYSRANGE_MODE_START_STOP
#define VL_REG_SYSRANGE_MODE_BACKTOBACK
#define VL_REG_SYSRANGE_MODE_TIMED
#define VL_REG_SYSRANGE_MODE_HISTOGRAM

#define VL_REG_SYSTEM_INTERRUPT_CONFIG_GPIO
#define VL_REG_SYSTEM_INTERRUPT_GPIO_NEW_SAMPLE_READY

#define VL_REG_SYSTEM_INTERRUPT_CLEAR

#define VL_REG_RESULT_INT_STATUS
#define VL_REG_RESULT_RANGE_STATUS
#define VL_REG_RESULT_RANGE_STATUS_COMPLETE

struct vl53l0x_data {};

static irqreturn_t vl53l0x_handle_irq(int irq, void *priv)
{}

static int vl53l0x_configure_irq(struct i2c_client *client,
				 struct iio_dev *indio_dev)
{}

static void vl53l0x_clear_irq(struct vl53l0x_data *data)
{}

static int vl53l0x_read_proximity(struct vl53l0x_data *data,
				  const struct iio_chan_spec *chan,
				  int *val)
{}

static const struct iio_chan_spec vl53l0x_channels[] =;

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

static const struct iio_info vl53l0x_info =;

static void vl53l0x_power_off(void *_data)
{}

static int vl53l0x_power_on(struct vl53l0x_data *data)
{}

static int vl53l0x_probe(struct i2c_client *client)
{}

static const struct i2c_device_id vl53l0x_id[] =;
MODULE_DEVICE_TABLE(i2c, vl53l0x_id);

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

static struct i2c_driver vl53l0x_driver =;
module_i2c_driver();

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