linux/drivers/iio/proximity/aw96103.c

// SPDX-License-Identifier: GPL-2.0
/*
 * AWINIC aw96103 proximity sensor driver
 *
 * Author: Wang Shuaijie <[email protected]>
 *
 * Copyright (c) 2024 awinic Technology CO., LTD
 */
#include <linux/bits.h>
#include <linux/bitfield.h>
#include <linux/delay.h>
#include <linux/firmware.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/iio/events.h>
#include <linux/iio/iio.h>
#include <linux/regulator/consumer.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/unaligned.h>

#define AW_DATA_PROCESS_FACTOR
#define AW96103_CHIP_ID
#define AW96103_BIN_VALID_DATA_OFFSET
#define AW96103_BIN_DATA_LEN_OFFSET
#define AW96103_BIN_DATA_REG_NUM_SIZE
#define AW96103_BIN_CHIP_TYPE_SIZE
#define AW96103_BIN_CHIP_TYPE_OFFSET

#define AW96103_REG_SCANCTRL0
#define AW96103_REG_STAT0
#define AW96103_REG_BLFILT_CH0
#define AW96103_REG_BLRSTRNG_CH0
#define AW96103_REG_DIFF_CH0
#define AW96103_REG_FWVER2
#define AW96103_REG_CMD
#define AW96103_REG_IRQSRC
#define AW96103_REG_IRQEN
#define AW96103_REG_RESET
#define AW96103_REG_CHIPID
#define AW96103_REG_EEDA0
#define AW96103_REG_EEDA1
#define AW96103_REG_PROXCTRL_CH0
#define AW96103_REG_PROXTH0_CH0
#define AW96103_PROXTH_CH_STEP
#define AW96103_THHYST_MASK
#define AW96103_INDEB_MASK
#define AW96103_OUTDEB_MASK
#define AW96103_INITOVERIRQ_MASK
#define AW96103_BLFILT_CH_STEP
#define AW96103_BLRSTRNG_MASK
#define AW96103_CHIPID_MASK
#define AW96103_BLERRTRIG_MASK
#define AW96103_CHAN_EN_MASK
#define AW96103_REG_PROXCTRL_CH(x)

#define AW96103_REG_PROXTH0_CH(x)

/**
 * struct aw_bin - Store the data obtained from parsing the configuration file.
 * @chip_type: Frame header information-chip type
 * @valid_data_len: Length of valid data obtained after parsing
 * @valid_data_addr: The offset address of the valid data obtained
 *		     after parsing relative to info
 * @len: The size of the bin file obtained from the firmware
 * @data: Store the bin file obtained from the firmware
 */
struct aw_bin {};

enum aw96103_sar_vers {};

enum aw96103_operation_mode {};

enum aw96103_sensor_type {};

struct aw_channels_info {};

struct aw_chip_info {};

struct aw96103 {};

static const unsigned int aw96103_reg_default[] =;

static const struct iio_event_spec aw_common_events[3] =;

#define AW_IIO_CHANNEL(idx)							\

static const struct iio_chan_spec aw96103_channels[] =;

static const struct iio_chan_spec aw96105_channels[] =;

static const struct aw_chip_info aw_chip_info_tbl[] =;

static void aw96103_parsing_bin_file(struct aw_bin *bin)
{}

static const struct regmap_config aw96103_regmap_confg =;

static int aw96103_get_diff_raw(struct aw96103 *aw96103, unsigned int chan,
				int *buf)
{}

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

static int aw96103_read_thresh(struct aw96103 *aw96103,
			       const struct iio_chan_spec *chan, int *val)
{}

static int aw96103_read_out_debounce(struct aw96103 *aw96103,
				     const struct iio_chan_spec *chan,
				     int *val)
{}

static int aw96103_read_in_debounce(struct aw96103 *aw96103,
				    const struct iio_chan_spec *chan, int *val)
{}

static int aw96103_read_hysteresis(struct aw96103 *aw96103,
				   const struct iio_chan_spec *chan, int *val)
{}

static int aw96103_read_event_val(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 aw96103_write_event_val(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 aw96103_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 aw96103_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 struct iio_info iio_info =;

static int aw96103_channel_scan_start(struct aw96103 *aw96103)
{}

static int aw96103_reg_version_comp(struct aw96103 *aw96103,
				    struct aw_bin *aw_bin)
{}

static int aw96103_bin_valid_loaded(struct aw96103 *aw96103,
				    struct aw_bin *aw_bin_data_s)
{}

static int aw96103_para_loaded(struct aw96103 *aw96103)
{}

static int aw96103_cfg_all_loaded(const struct firmware *cont,
				  struct aw96103 *aw96103)
{}

static void aw96103_cfg_update(const struct firmware *fw, void *data)
{}

static int aw96103_sw_reset(struct aw96103 *aw96103)
{}

enum aw96103_irq_trigger_position {};

static irqreturn_t aw96103_irq(int irq, void *data)
{}

static int aw96103_interrupt_init(struct iio_dev *indio_dev,
				  struct i2c_client *i2c)
{}

static int aw96103_wait_chip_init(struct aw96103 *aw96103)
{}

static int aw96103_read_chipid(struct aw96103 *aw96103)
{}

static int aw96103_i2c_probe(struct i2c_client *i2c)
{}

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

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

static struct i2c_driver aw96103_i2c_driver =;
module_i2c_driver();

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