linux/drivers/iio/proximity/sx9500.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2014 Intel Corporation
 *
 * Driver for Semtech's SX9500 capacitive proximity/button solution.
 * Datasheet available at
 * <http://www.semtech.com/images/datasheet/sx9500.pdf>.
 */

#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/irq.h>
#include <linux/acpi.h>
#include <linux/gpio/consumer.h>
#include <linux/regmap.h>
#include <linux/pm.h>
#include <linux/delay.h>

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

#define SX9500_DRIVER_NAME
#define SX9500_IRQ_NAME

/* Register definitions. */
#define SX9500_REG_IRQ_SRC
#define SX9500_REG_STAT
#define SX9500_REG_IRQ_MSK

#define SX9500_REG_PROX_CTRL0
#define SX9500_REG_PROX_CTRL1
#define SX9500_REG_PROX_CTRL2
#define SX9500_REG_PROX_CTRL3
#define SX9500_REG_PROX_CTRL4
#define SX9500_REG_PROX_CTRL5
#define SX9500_REG_PROX_CTRL6
#define SX9500_REG_PROX_CTRL7
#define SX9500_REG_PROX_CTRL8

#define SX9500_REG_SENSOR_SEL
#define SX9500_REG_USE_MSB
#define SX9500_REG_USE_LSB
#define SX9500_REG_AVG_MSB
#define SX9500_REG_AVG_LSB
#define SX9500_REG_DIFF_MSB
#define SX9500_REG_DIFF_LSB
#define SX9500_REG_OFFSET_MSB
#define SX9500_REG_OFFSET_LSB

#define SX9500_REG_RESET

/* Write this to REG_RESET to do a soft reset. */
#define SX9500_SOFT_RESET

#define SX9500_SCAN_PERIOD_MASK
#define SX9500_SCAN_PERIOD_SHIFT

/*
 * These serve for identifying IRQ source in the IRQ_SRC register, and
 * also for masking the IRQs in the IRQ_MSK register.
 */
#define SX9500_CLOSE_IRQ
#define SX9500_FAR_IRQ
#define SX9500_CONVDONE_IRQ

#define SX9500_PROXSTAT_SHIFT
#define SX9500_COMPSTAT_MASK

#define SX9500_NUM_CHANNELS
#define SX9500_CHAN_MASK

struct sx9500_data {};

static const struct iio_event_spec sx9500_events[] =;

#define SX9500_CHANNEL(idx)

static const struct iio_chan_spec sx9500_channels[] =;

static const struct {} sx9500_samp_freq_table[] =;

static const unsigned int sx9500_scan_period_table[] =;

static const struct regmap_range sx9500_writable_reg_ranges[] =;

static const struct regmap_access_table sx9500_writeable_regs =;

/*
 * All allocated registers are readable, so we just list unallocated
 * ones.
 */
static const struct regmap_range sx9500_non_readable_reg_ranges[] =;

static const struct regmap_access_table sx9500_readable_regs =;

static const struct regmap_range sx9500_volatile_reg_ranges[] =;

static const struct regmap_access_table sx9500_volatile_regs =;

static const struct regmap_config sx9500_regmap_config =;

static int sx9500_inc_users(struct sx9500_data *data, int *counter,
			    unsigned int reg, unsigned int bitmask)
{}

static int sx9500_dec_users(struct sx9500_data *data, int *counter,
			    unsigned int reg, unsigned int bitmask)
{}

static int sx9500_inc_chan_users(struct sx9500_data *data, int chan)
{}

static int sx9500_dec_chan_users(struct sx9500_data *data, int chan)
{}

static int sx9500_inc_data_rdy_users(struct sx9500_data *data)
{}

static int sx9500_dec_data_rdy_users(struct sx9500_data *data)
{}

static int sx9500_inc_close_far_users(struct sx9500_data *data)
{}

static int sx9500_dec_close_far_users(struct sx9500_data *data)
{}

static int sx9500_read_prox_data(struct sx9500_data *data,
				 const struct iio_chan_spec *chan,
				 int *val)
{}

/*
 * If we have no interrupt support, we have to wait for a scan period
 * after enabling a channel to get a result.
 */
static int sx9500_wait_for_sample(struct sx9500_data *data)
{}

static int sx9500_read_proximity(struct sx9500_data *data,
				 const struct iio_chan_spec *chan,
				 int *val)
{}

static int sx9500_read_samp_freq(struct sx9500_data *data,
				 int *val, int *val2)
{}

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

static int sx9500_set_samp_freq(struct sx9500_data *data,
				int val, int val2)
{}

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

static irqreturn_t sx9500_irq_handler(int irq, void *private)
{}

static void sx9500_push_events(struct iio_dev *indio_dev)
{}

static irqreturn_t sx9500_irq_thread_handler(int irq, void *private)
{}

static int sx9500_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 sx9500_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 int sx9500_update_scan_mode(struct iio_dev *indio_dev,
				   const unsigned long *scan_mask)
{}

static IIO_CONST_ATTR_SAMP_FREQ_AVAIL(
	"2.500000 3.333333 5 6.666666 8.333333 11.111111 16.666666 33.333333");

static struct attribute *sx9500_attributes[] =;

static const struct attribute_group sx9500_attribute_group =;

static const struct iio_info sx9500_info =;

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

static const struct iio_trigger_ops sx9500_trigger_ops =;

static irqreturn_t sx9500_trigger_handler(int irq, void *private)
{}

static int sx9500_buffer_postenable(struct iio_dev *indio_dev)
{}

static int sx9500_buffer_predisable(struct iio_dev *indio_dev)
{}

static const struct iio_buffer_setup_ops sx9500_buffer_setup_ops =;

struct sx9500_reg_default {};

static const struct sx9500_reg_default sx9500_default_regs[] =;

/* Activate all channels and perform an initial compensation. */
static int sx9500_init_compensation(struct iio_dev *indio_dev)
{}

static int sx9500_init_device(struct iio_dev *indio_dev)
{}

static const struct acpi_gpio_params reset_gpios =;
static const struct acpi_gpio_params interrupt_gpios =;

static const struct acpi_gpio_mapping acpi_sx9500_gpios[] =;

static void sx9500_gpio_probe(struct i2c_client *client,
			      struct sx9500_data *data)
{}

static int sx9500_probe(struct i2c_client *client)
{}

static void sx9500_remove(struct i2c_client *client)
{}

static int sx9500_suspend(struct device *dev)
{}

static int sx9500_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(sx9500_pm_ops, sx9500_suspend, sx9500_resume);

static const struct acpi_device_id sx9500_acpi_match[] =;
MODULE_DEVICE_TABLE(acpi, sx9500_acpi_match);

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

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

static struct i2c_driver sx9500_driver =;
module_i2c_driver();

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