linux/drivers/iio/adc/max34408.c

// SPDX-License-Identifier: GPL-2.0
/*
 * IIO driver for Maxim MAX34409/34408 ADC, 4-Channels/2-Channels, 8bits, I2C
 *
 * Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/MAX34408-MAX34409.pdf
 *
 * TODO: ALERT interrupt, Overcurrent delay, Shutdown delay
 */

#include <linux/bitfield.h>
#include <linux/init.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/property.h>
#include <linux/regmap.h>

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

#define MAX34408_STATUS_REG
#define MAX34408_CONTROL_REG
#define MAX34408_OCDELAY_REG
#define MAX34408_SDDELAY_REG

#define MAX34408_ADC1_REG
#define MAX34408_ADC2_REG
/* ADC3 & ADC4 always returns 0x0 on 34408 */
#define MAX34409_ADC3_REG
#define MAX34409_ADC4_REG

#define MAX34408_OCT1_REG
#define MAX34408_OCT2_REG
#define MAX34409_OCT3_REG
#define MAX34409_OCT4_REG

#define MAX34408_DID_REG
#define MAX34408_DCYY_REG
#define MAX34408_DCWW_REG

/* Bit masks for status register */
#define MAX34408_STATUS_OC_MSK
#define MAX34409_STATUS_OC_MSK
#define MAX34408_STATUS_SHTDN
#define MAX34408_STATUS_ENA

/* Bit masks for control register */
#define MAX34408_CONTROL_AVG0
#define MAX34408_CONTROL_AVG1
#define MAX34408_CONTROL_AVG2
#define MAX34408_CONTROL_ALERT

#define MAX34408_DEFAULT_AVG

/* Bit masks for over current delay */
#define MAX34408_OCDELAY_OCD_MSK
#define MAX34408_OCDELAY_RESET

/* Bit masks for shutdown delay */
#define MAX34408_SDDELAY_SHD_MSK
#define MAX34408_SDDELAY_RESET

#define MAX34408_DEFAULT_RSENSE

/**
 * struct max34408_data - max34408/max34409 specific data.
 * @regmap:	device register map.
 * @dev:	max34408 device.
 * @lock:	lock for protecting access to device hardware registers, mostly
 *		for read modify write cycles for control registers.
 * @input_rsense:	Rsense values in uOhm, will be overwritten by
 *			values from channel nodes.
 */
struct max34408_data {};

static const struct regmap_config max34408_regmap_config =;

struct max34408_adc_model_data {};

#define MAX34008_CHANNEL(_index, _address)

static const struct iio_chan_spec max34408_channels[] =;

static const struct iio_chan_spec max34409_channels[] =;

static int max34408_read_adc_avg(struct max34408_data *max34408,
				 const struct iio_chan_spec *chan, int *val)
{}

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

static const struct iio_info max34408_info =;

static const struct max34408_adc_model_data max34408_model_data =;

static const struct max34408_adc_model_data max34409_model_data =;

static int max34408_probe(struct i2c_client *client)
{}

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

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

static struct i2c_driver max34408_driver =;
module_i2c_driver();

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