linux/drivers/iio/humidity/hdc3020.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * hdc3020.c - Support for the TI HDC3020,HDC3021 and HDC3022
 * temperature + relative humidity sensors
 *
 * Copyright (C) 2023
 *
 * Copyright (C) 2024 Liebherr-Electronics and Drives GmbH
 *
 * Datasheet: https://www.ti.com/lit/ds/symlink/hdc3020.pdf
 */

#include <linux/bitfield.h>
#include <linux/bitops.h>
#include <linux/cleanup.h>
#include <linux/crc8.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/math64.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/pm.h>
#include <linux/regulator/consumer.h>
#include <linux/units.h>

#include <asm/unaligned.h>

#include <linux/iio/events.h>
#include <linux/iio/iio.h>

#define HDC3020_S_AUTO_10HZ_MOD0
#define HDC3020_S_STATUS
#define HDC3020_HEATER_DISABLE
#define HDC3020_HEATER_ENABLE
#define HDC3020_HEATER_CONFIG
#define HDC3020_EXIT_AUTO
#define HDC3020_S_T_RH_THRESH_LOW
#define HDC3020_S_T_RH_THRESH_LOW_CLR
#define HDC3020_S_T_RH_THRESH_HIGH_CLR
#define HDC3020_S_T_RH_THRESH_HIGH
#define HDC3020_R_T_RH_AUTO
#define HDC3020_R_T_LOW_AUTO
#define HDC3020_R_T_HIGH_AUTO
#define HDC3020_R_RH_LOW_AUTO
#define HDC3020_R_RH_HIGH_AUTO
#define HDC3020_R_T_RH_THRESH_LOW
#define HDC3020_R_T_RH_THRESH_LOW_CLR
#define HDC3020_R_T_RH_THRESH_HIGH_CLR
#define HDC3020_R_T_RH_THRESH_HIGH
#define HDC3020_R_STATUS

#define HDC3020_THRESH_TEMP_MASK
#define HDC3020_THRESH_TEMP_TRUNC_SHIFT
#define HDC3020_THRESH_HUM_MASK
#define HDC3020_THRESH_HUM_TRUNC_SHIFT

#define HDC3020_STATUS_T_LOW_ALERT
#define HDC3020_STATUS_T_HIGH_ALERT
#define HDC3020_STATUS_RH_LOW_ALERT
#define HDC3020_STATUS_RH_HIGH_ALERT

#define HDC3020_READ_RETRY_TIMES
#define HDC3020_BUSY_DELAY_MS

#define HDC3020_CRC8_POLYNOMIAL

#define HDC3020_MIN_TEMP_MICRO
#define HDC3020_MAX_TEMP_MICRO
#define HDC3020_MAX_TEMP_HYST_MICRO
#define HDC3020_MAX_HUM_MICRO

struct hdc3020_data {};

static const int hdc3020_heater_vals[] =;

static const struct iio_event_spec hdc3020_t_rh_event[] =;

static const struct iio_chan_spec hdc3020_channels[] =;

DECLARE_CRC8_TABLE(hdc3020_crc8_table);

static int hdc3020_write_bytes(struct hdc3020_data *data, u8 *buf, u8 len)
{}

static
int hdc3020_read_bytes(struct hdc3020_data *data, u16 reg, u8 *buf, int len)
{}

static int hdc3020_read_be16(struct hdc3020_data *data, u16 reg)
{}

static int hdc3020_exec_cmd(struct hdc3020_data *data, u16 reg)
{}

static int hdc3020_read_measurement(struct hdc3020_data *data,
				    enum iio_chan_type type, int *val)
{}

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

static int hdc3020_read_available(struct iio_dev *indio_dev,
				  struct iio_chan_spec const *chan,
				  const int **vals,
				  int *type, int *length, long mask)
{}

static int hdc3020_update_heater(struct hdc3020_data *data, int val)
{}

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

static int hdc3020_thresh_get_temp(u16 thresh)
{}

static int hdc3020_thresh_get_hum(u16 thresh)
{}

static u16 hdc3020_thresh_set_temp(int s_temp, u16 curr_thresh)
{}

static u16 hdc3020_thresh_set_hum(int s_hum, u16 curr_thresh)
{}

static
int hdc3020_thresh_clr(s64 s_thresh, s64 s_hyst, enum iio_event_direction dir)
{}

static int _hdc3020_write_thresh(struct hdc3020_data *data, u16 reg, u16 val)
{}

static int hdc3020_write_thresh(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 hdc3020_read_thresh(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 irqreturn_t hdc3020_interrupt_handler(int irq, void *private)
{}

static const struct iio_info hdc3020_info =;

static int hdc3020_power_off(struct hdc3020_data *data)
{}

static int hdc3020_power_on(struct hdc3020_data *data)
{}

static void hdc3020_exit(void *data)
{}

static int hdc3020_probe(struct i2c_client *client)
{}

static int hdc3020_suspend(struct device *dev)
{}

static int hdc3020_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(hdc3020_pm_ops, hdc3020_suspend, hdc3020_resume);

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

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

static struct i2c_driver hdc3020_driver =;
module_i2c_driver();

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