linux/drivers/iio/proximity/hx9023s.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 2024 NanjingTianyihexin Electronics Ltd.
 * http://www.tianyihexin.com
 *
 * Driver for NanjingTianyihexin HX9023S Cap Sensor.
 * Datasheet available at:
 * http://www.tianyihexin.com/ueditor/php/upload/file/20240614/1718336303992081.pdf
 */

#include <linux/array_size.h>
#include <linux/bitfield.h>
#include <linux/bitops.h>
#include <linux/cleanup.h>
#include <linux/device.h>
#include <linux/errno.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/irqreturn.h>
#include <linux/math64.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/pm.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/types.h>
#include <linux/units.h>

#include <asm/byteorder.h>
#include <linux/unaligned.h>

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

#define HX9023S_CHIP_ID
#define HX9023S_CH_NUM
#define HX9023S_POS
#define HX9023S_NEG
#define HX9023S_NOT_CONNECTED

#define HX9023S_GLOBAL_CTRL0
#define HX9023S_PRF_CFG
#define HX9023S_CH0_CFG_7_0
#define HX9023S_CH4_CFG_9_8
#define HX9023S_RANGE_7_0
#define HX9023S_RANGE_9_8
#define HX9023S_RANGE_18_16
#define HX9023S_AVG0_NOSR0_CFG
#define HX9023S_NOSR12_CFG
#define HX9023S_NOSR34_CFG
#define HX9023S_AVG12_CFG
#define HX9023S_AVG34_CFG
#define HX9023S_OFFSET_DAC0_7_0
#define HX9023S_OFFSET_DAC4_9_8
#define HX9023S_SAMPLE_NUM_7_0
#define HX9023S_INTEGRATION_NUM_7_0
#define HX9023S_CH_NUM_CFG
#define HX9023S_LP_ALP_4_CFG
#define HX9023S_LP_ALP_1_0_CFG
#define HX9023S_LP_ALP_3_2_CFG
#define HX9023S_UP_ALP_1_0_CFG
#define HX9023S_UP_ALP_3_2_CFG
#define HX9023S_DN_UP_ALP_0_4_CFG
#define HX9023S_DN_ALP_2_1_CFG
#define HX9023S_DN_ALP_4_3_CFG
#define HX9023S_RAW_BL_RD_CFG
#define HX9023S_INTERRUPT_CFG
#define HX9023S_INTERRUPT_CFG1
#define HX9023S_CALI_DIFF_CFG
#define HX9023S_DITHER_CFG
#define HX9023S_DEVICE_ID
#define HX9023S_PROX_STATUS
#define HX9023S_PROX_INT_HIGH_CFG
#define HX9023S_PROX_INT_LOW_CFG
#define HX9023S_PROX_HIGH_DIFF_CFG_CH0_0
#define HX9023S_PROX_LOW_DIFF_CFG_CH0_0
#define HX9023S_PROX_LOW_DIFF_CFG_CH3_1
#define HX9023S_PROX_HIGH_DIFF_CFG_CH4_0
#define HX9023S_PROX_HIGH_DIFF_CFG_CH4_1
#define HX9023S_PROX_LOW_DIFF_CFG_CH4_0
#define HX9023S_PROX_LOW_DIFF_CFG_CH4_1
#define HX9023S_CAP_INI_CH4_0
#define HX9023S_LP_DIFF_CH4_2
#define HX9023S_RAW_BL_CH4_0
#define HX9023S_LP_DIFF_CH4_0
#define HX9023S_DSP_CONFIG_CTRL1
#define HX9023S_CAP_INI_CH0_0
#define HX9023S_RAW_BL_CH0_0
#define HX9023S_LP_DIFF_CH0_0
#define HX9023S_LP_DIFF_CH3_2

#define HX9023S_DATA_LOCK_MASK
#define HX9023S_INTERRUPT_MASK
#define HX9023S_PROX_DEBOUNCE_MASK

struct hx9023s_ch_data {};

struct hx9023s_data {};

static const struct reg_sequence hx9023s_reg_init_list[] =;

static const struct iio_event_spec hx9023s_events[] =;

#define HX9023S_CHANNEL(idx)

static const struct iio_chan_spec hx9023s_channels[] =;

static const unsigned int hx9023s_samp_freq_table[] =;

static const struct regmap_range hx9023s_rd_reg_ranges[] =;

static const struct regmap_range hx9023s_wr_reg_ranges[] =;

static const struct regmap_range hx9023s_volatile_reg_ranges[] =;

static const struct regmap_access_table hx9023s_rd_regs =;

static const struct regmap_access_table hx9023s_wr_regs =;

static const struct regmap_access_table hx9023s_volatile_regs =;

static const struct regmap_config hx9023s_regmap_config =;

static int hx9023s_interrupt_enable(struct hx9023s_data *data)
{}

static int hx9023s_interrupt_disable(struct hx9023s_data *data)
{}

static int hx9023s_data_lock(struct hx9023s_data *data, bool locked)
{}

static int hx9023s_ch_cfg(struct hx9023s_data *data)
{}

static int hx9023s_write_far_debounce(struct hx9023s_data *data, int val)
{}

static int hx9023s_write_near_debounce(struct hx9023s_data *data, int val)
{}

static int hx9023s_read_far_debounce(struct hx9023s_data *data, int *val)
{}

static int hx9023s_read_near_debounce(struct hx9023s_data *data, int *val)
{}

static int hx9023s_get_thres_near(struct hx9023s_data *data, u8 ch, int *val)
{}

static int hx9023s_get_thres_far(struct hx9023s_data *data, u8 ch, int *val)
{}

static int hx9023s_set_thres_near(struct hx9023s_data *data, u8 ch, int val)
{}

static int hx9023s_set_thres_far(struct hx9023s_data *data, u8 ch, int val)
{}

static int hx9023s_get_prox_state(struct hx9023s_data *data)
{}

static int hx9023s_data_select(struct hx9023s_data *data)
{}

static int hx9023s_sample(struct hx9023s_data *data)
{}

static int hx9023s_ch_en(struct hx9023s_data *data, u8 ch_id, bool en)
{}

static int hx9023s_property_get(struct hx9023s_data *data)
{}

static int hx9023s_update_chan_en(struct hx9023s_data *data,
				  unsigned long chan_read,
				  unsigned long chan_event)
{}

static int hx9023s_get_proximity(struct hx9023s_data *data,
				 const struct iio_chan_spec *chan,
				 int *val)
{}

static int hx9023s_get_samp_freq(struct hx9023s_data *data, int *val, int *val2)
{}

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

static int hx9023s_set_samp_freq(struct hx9023s_data *data, int val, int val2)
{}

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

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

static void hx9023s_push_events(struct iio_dev *indio_dev)
{}

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

static int hx9023s_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 hx9023s_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 hx9023s_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 hx9023s_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 const struct iio_info hx9023s_info =;

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

static const struct iio_trigger_ops hx9023s_trigger_ops =;

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

static int hx9023s_buffer_preenable(struct iio_dev *indio_dev)
{}

static int hx9023s_buffer_postdisable(struct iio_dev *indio_dev)
{}

static const struct iio_buffer_setup_ops hx9023s_buffer_setup_ops =;

static int hx9023s_id_check(struct iio_dev *indio_dev)
{}

static int hx9023s_probe(struct i2c_client *client)
{}

static int hx9023s_suspend(struct device *dev)
{}

static int hx9023s_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(hx9023s_pm_ops, hx9023s_suspend,
				hx9023s_resume);

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

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

static struct i2c_driver hx9023s_driver =;
module_i2c_driver();

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