#include <linux/bitfield.h>
#include <linux/completion.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/iio/iio.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/spi/spi.h>
#include <asm/byteorder.h>
#include <linux/unaligned.h>
#define LTC2983_STATUS_REG …
#define LTC2983_TEMP_RES_START_REG …
#define LTC2983_TEMP_RES_END_REG …
#define LTC2983_EEPROM_KEY_REG …
#define LTC2983_EEPROM_READ_STATUS_REG …
#define LTC2983_GLOBAL_CONFIG_REG …
#define LTC2983_MULT_CHANNEL_START_REG …
#define LTC2983_MULT_CHANNEL_END_REG …
#define LTC2986_EEPROM_STATUS_REG …
#define LTC2983_MUX_CONFIG_REG …
#define LTC2983_CHAN_ASSIGN_START_REG …
#define LTC2983_CHAN_ASSIGN_END_REG …
#define LTC2983_CUST_SENS_TBL_START_REG …
#define LTC2983_CUST_SENS_TBL_END_REG …
#define LTC2983_DIFFERENTIAL_CHAN_MIN …
#define LTC2983_MIN_CHANNELS_NR …
#define LTC2983_SLEEP …
#define LTC2983_CUSTOM_STEINHART_SIZE …
#define LTC2983_CUSTOM_SENSOR_ENTRY_SZ …
#define LTC2983_CUSTOM_STEINHART_ENTRY_SZ …
#define LTC2983_EEPROM_KEY …
#define LTC2983_EEPROM_WRITE_CMD …
#define LTC2983_EEPROM_READ_CMD …
#define LTC2983_EEPROM_STATUS_FAILURE_MASK …
#define LTC2983_EEPROM_READ_FAILURE_MASK …
#define LTC2983_EEPROM_WRITE_TIME_MS …
#define LTC2983_EEPROM_READ_TIME_MS …
#define LTC2983_CHAN_START_ADDR(chan) …
#define LTC2983_CHAN_RES_ADDR(chan) …
#define LTC2983_THERMOCOUPLE_DIFF_MASK …
#define LTC2983_THERMOCOUPLE_SGL(x) …
#define LTC2983_THERMOCOUPLE_OC_CURR_MASK …
#define LTC2983_THERMOCOUPLE_OC_CURR(x) …
#define LTC2983_THERMOCOUPLE_OC_CHECK_MASK …
#define LTC2983_THERMOCOUPLE_OC_CHECK(x) …
#define LTC2983_THERMISTOR_DIFF_MASK …
#define LTC2983_THERMISTOR_SGL(x) …
#define LTC2983_THERMISTOR_R_SHARE_MASK …
#define LTC2983_THERMISTOR_R_SHARE(x) …
#define LTC2983_THERMISTOR_C_ROTATE_MASK …
#define LTC2983_THERMISTOR_C_ROTATE(x) …
#define LTC2983_DIODE_DIFF_MASK …
#define LTC2983_DIODE_SGL(x) …
#define LTC2983_DIODE_3_CONV_CYCLE_MASK …
#define LTC2983_DIODE_3_CONV_CYCLE(x) …
#define LTC2983_DIODE_AVERAGE_ON_MASK …
#define LTC2983_DIODE_AVERAGE_ON(x) …
#define LTC2983_RTD_4_WIRE_MASK …
#define LTC2983_RTD_ROTATION_MASK …
#define LTC2983_RTD_C_ROTATE(x) …
#define LTC2983_RTD_KELVIN_R_SENSE_MASK …
#define LTC2983_RTD_N_WIRES_MASK …
#define LTC2983_RTD_N_WIRES(x) …
#define LTC2983_RTD_R_SHARE_MASK …
#define LTC2983_RTD_R_SHARE(x) …
#define LTC2983_COMMON_HARD_FAULT_MASK …
#define LTC2983_COMMON_SOFT_FAULT_MASK …
#define LTC2983_STATUS_START_MASK …
#define LTC2983_STATUS_START(x) …
#define LTC2983_STATUS_UP_MASK …
#define LTC2983_STATUS_UP(reg) …
#define LTC2983_STATUS_CHAN_SEL_MASK …
#define LTC2983_STATUS_CHAN_SEL(x) …
#define LTC2983_TEMP_UNITS_MASK …
#define LTC2983_TEMP_UNITS(x) …
#define LTC2983_NOTCH_FREQ_MASK …
#define LTC2983_NOTCH_FREQ(x) …
#define LTC2983_RES_VALID_MASK …
#define LTC2983_DATA_MASK …
#define LTC2983_DATA_SIGN_BIT …
#define LTC2983_CHAN_TYPE_MASK …
#define LTC2983_CHAN_TYPE(x) …
#define LTC2983_CHAN_ASSIGN_MASK …
#define LTC2983_CHAN_ASSIGN(x) …
#define LTC2983_CUSTOM_LEN_MASK …
#define LTC2983_CUSTOM_LEN(x) …
#define LTC2983_CUSTOM_ADDR_MASK …
#define LTC2983_CUSTOM_ADDR(x) …
#define LTC2983_THERMOCOUPLE_CFG_MASK …
#define LTC2983_THERMOCOUPLE_CFG(x) …
#define LTC2983_THERMOCOUPLE_HARD_FAULT_MASK …
#define LTC2983_THERMOCOUPLE_SOFT_FAULT_MASK …
#define LTC2983_RTD_CFG_MASK …
#define LTC2983_RTD_CFG(x) …
#define LTC2983_RTD_EXC_CURRENT_MASK …
#define LTC2983_RTD_EXC_CURRENT(x) …
#define LTC2983_RTD_CURVE_MASK …
#define LTC2983_RTD_CURVE(x) …
#define LTC2983_THERMISTOR_CFG_MASK …
#define LTC2983_THERMISTOR_CFG(x) …
#define LTC2983_THERMISTOR_EXC_CURRENT_MASK …
#define LTC2983_THERMISTOR_EXC_CURRENT(x) …
#define LTC2983_DIODE_CFG_MASK …
#define LTC2983_DIODE_CFG(x) …
#define LTC2983_DIODE_EXC_CURRENT_MASK …
#define LTC2983_DIODE_EXC_CURRENT(x) …
#define LTC2983_DIODE_IDEAL_FACTOR_MASK …
#define LTC2983_DIODE_IDEAL_FACTOR(x) …
#define LTC2983_R_SENSE_VAL_MASK …
#define LTC2983_R_SENSE_VAL(x) …
#define LTC2983_ADC_SINGLE_ENDED_MASK …
#define LTC2983_ADC_SINGLE_ENDED(x) …
enum { … };
#define to_thermocouple(_sensor) …
#define to_rtd(_sensor) …
#define to_thermistor(_sensor) …
#define to_diode(_sensor) …
#define to_rsense(_sensor) …
#define to_adc(_sensor) …
#define to_temp(_sensor) …
struct ltc2983_chip_info { … };
struct ltc2983_data { … };
struct ltc2983_sensor { … };
struct ltc2983_custom_sensor { … };
struct ltc2983_thermocouple { … };
struct ltc2983_rtd { … };
struct ltc2983_thermistor { … };
struct ltc2983_diode { … };
struct ltc2983_rsense { … };
struct ltc2983_adc { … };
struct ltc2983_temp { … };
static u32 __convert_to_raw(const u64 val, const u32 resolution)
{ … }
static u32 __convert_to_raw_sign(const u64 val, const u32 resolution)
{ … }
static int __ltc2983_fault_handler(const struct ltc2983_data *st,
const u32 result, const u32 hard_mask,
const u32 soft_mask)
{ … }
static int __ltc2983_chan_assign_common(struct ltc2983_data *st,
const struct ltc2983_sensor *sensor,
u32 chan_val)
{ … }
static int __ltc2983_chan_custom_sensor_assign(struct ltc2983_data *st,
struct ltc2983_custom_sensor *custom,
u32 *chan_val)
{ … }
static struct ltc2983_custom_sensor *
__ltc2983_custom_sensor_new(struct ltc2983_data *st, const struct fwnode_handle *fn,
const char *propname, const bool is_steinhart,
const u32 resolution, const bool has_signed)
{ … }
static int ltc2983_thermocouple_fault_handler(const struct ltc2983_data *st,
const u32 result)
{ … }
static int ltc2983_common_fault_handler(const struct ltc2983_data *st,
const u32 result)
{ … }
static int ltc2983_thermocouple_assign_chan(struct ltc2983_data *st,
const struct ltc2983_sensor *sensor)
{ … }
static int ltc2983_rtd_assign_chan(struct ltc2983_data *st,
const struct ltc2983_sensor *sensor)
{ … }
static int ltc2983_thermistor_assign_chan(struct ltc2983_data *st,
const struct ltc2983_sensor *sensor)
{ … }
static int ltc2983_diode_assign_chan(struct ltc2983_data *st,
const struct ltc2983_sensor *sensor)
{ … }
static int ltc2983_r_sense_assign_chan(struct ltc2983_data *st,
const struct ltc2983_sensor *sensor)
{ … }
static int ltc2983_adc_assign_chan(struct ltc2983_data *st,
const struct ltc2983_sensor *sensor)
{ … }
static int ltc2983_temp_assign_chan(struct ltc2983_data *st,
const struct ltc2983_sensor *sensor)
{ … }
static struct ltc2983_sensor *
ltc2983_thermocouple_new(const struct fwnode_handle *child, struct ltc2983_data *st,
const struct ltc2983_sensor *sensor)
{ … }
static struct ltc2983_sensor *
ltc2983_rtd_new(const struct fwnode_handle *child, struct ltc2983_data *st,
const struct ltc2983_sensor *sensor)
{ … }
static struct ltc2983_sensor *
ltc2983_thermistor_new(const struct fwnode_handle *child, struct ltc2983_data *st,
const struct ltc2983_sensor *sensor)
{ … }
static struct ltc2983_sensor *
ltc2983_diode_new(const struct fwnode_handle *child, const struct ltc2983_data *st,
const struct ltc2983_sensor *sensor)
{ … }
static struct ltc2983_sensor *ltc2983_r_sense_new(struct fwnode_handle *child,
struct ltc2983_data *st,
const struct ltc2983_sensor *sensor)
{ … }
static struct ltc2983_sensor *ltc2983_adc_new(struct fwnode_handle *child,
struct ltc2983_data *st,
const struct ltc2983_sensor *sensor)
{ … }
static struct ltc2983_sensor *ltc2983_temp_new(struct fwnode_handle *child,
struct ltc2983_data *st,
const struct ltc2983_sensor *sensor)
{ … }
static int ltc2983_chan_read(struct ltc2983_data *st,
const struct ltc2983_sensor *sensor, int *val)
{ … }
static int ltc2983_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2, long mask)
{ … }
static int ltc2983_reg_access(struct iio_dev *indio_dev,
unsigned int reg,
unsigned int writeval,
unsigned int *readval)
{ … }
static irqreturn_t ltc2983_irq_handler(int irq, void *data)
{ … }
#define LTC2983_CHAN(__type, index, __address) …
static int ltc2983_parse_fw(struct ltc2983_data *st)
{ … }
static int ltc2983_eeprom_cmd(struct ltc2983_data *st, unsigned int cmd,
unsigned int wait_time, unsigned int status_reg,
unsigned long status_fail_mask)
{ … }
static int ltc2983_setup(struct ltc2983_data *st, bool assign_iio)
{ … }
static const struct regmap_range ltc2983_reg_ranges[] = …;
static const struct regmap_access_table ltc2983_reg_table = …;
static const struct regmap_config ltc2983_regmap_config = …;
static const struct iio_info ltc2983_iio_info = …;
static int ltc2983_probe(struct spi_device *spi)
{ … }
static int ltc2983_resume(struct device *dev)
{ … }
static int ltc2983_suspend(struct device *dev)
{ … }
static DEFINE_SIMPLE_DEV_PM_OPS(ltc2983_pm_ops, ltc2983_suspend,
ltc2983_resume);
static const struct ltc2983_chip_info ltc2983_chip_info_data = …;
static const struct ltc2983_chip_info ltc2984_chip_info_data = …;
static const struct ltc2983_chip_info ltc2986_chip_info_data = …;
static const struct ltc2983_chip_info ltm2985_chip_info_data = …;
static const struct spi_device_id ltc2983_id_table[] = …;
MODULE_DEVICE_TABLE(spi, ltc2983_id_table);
static const struct of_device_id ltc2983_of_match[] = …;
MODULE_DEVICE_TABLE(of, ltc2983_of_match);
static struct spi_driver ltc2983_driver = …;
module_spi_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;