#include <linux/delay.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/iio/buffer.h>
#include <linux/iio/driver.h>
#include <linux/iio/iio.h>
#include <linux/iio/kfifo_buf.h>
#include <linux/mfd/motorola-cpcap.h>
#define CPCAP_BIT_ADEN_AUTO_CLR …
#define CPCAP_BIT_CAL_MODE …
#define CPCAP_BIT_ADC_CLK_SEL1 …
#define CPCAP_BIT_ADC_CLK_SEL0 …
#define CPCAP_BIT_ATOX …
#define CPCAP_BIT_ATO3 …
#define CPCAP_BIT_ATO2 …
#define CPCAP_BIT_ATO1 …
#define CPCAP_BIT_ATO0 …
#define CPCAP_BIT_ADA2 …
#define CPCAP_BIT_ADA1 …
#define CPCAP_BIT_ADA0 …
#define CPCAP_BIT_AD_SEL1 …
#define CPCAP_BIT_RAND1 …
#define CPCAP_BIT_RAND0 …
#define CPCAP_BIT_ADEN …
#define CPCAP_REG_ADCC1_DEFAULTS …
#define CPCAP_BIT_CAL_FACTOR_ENABLE …
#define CPCAP_BIT_BATDETB_EN …
#define CPCAP_BIT_ADTRIG_ONESHOT …
#define CPCAP_BIT_ASC …
#define CPCAP_BIT_ATOX_PS_FACTOR …
#define CPCAP_BIT_ADC_PS_FACTOR1 …
#define CPCAP_BIT_ADC_PS_FACTOR0 …
#define CPCAP_BIT_AD4_SELECT …
#define CPCAP_BIT_ADC_BUSY …
#define CPCAP_BIT_THERMBIAS_EN …
#define CPCAP_BIT_ADTRIG_DIS …
#define CPCAP_BIT_LIADC …
#define CPCAP_BIT_TS_REFEN …
#define CPCAP_BIT_TS_M2 …
#define CPCAP_BIT_TS_M1 …
#define CPCAP_BIT_TS_M0 …
#define CPCAP_REG_ADCC2_DEFAULTS …
#define CPCAP_MAX_TEMP_LVL …
#define CPCAP_FOUR_POINT_TWO_ADC …
#define ST_ADC_CAL_CHRGI_HIGH_THRESHOLD …
#define ST_ADC_CAL_CHRGI_LOW_THRESHOLD …
#define ST_ADC_CAL_BATTI_HIGH_THRESHOLD …
#define ST_ADC_CAL_BATTI_LOW_THRESHOLD …
#define ST_ADC_CALIBRATE_DIFF_THRESHOLD …
#define CPCAP_ADC_MAX_RETRIES …
struct cpcap_adc_ato { … };
struct cpcap_adc { … };
enum cpcap_adc_channel { … };
enum cpcap_adc_timing { … };
struct cpcap_adc_phasing_tbl { … };
struct cpcap_adc_conversion_tbl { … };
struct cpcap_adc_request { … };
static const struct cpcap_adc_phasing_tbl bank_phasing[] = …;
static struct cpcap_adc_conversion_tbl bank_conversion[] = …;
static const int temp_map[CPCAP_MAX_TEMP_LVL][2] = …;
#define CPCAP_CHAN(_type, _index, _address, _datasheet_name) …
static const struct iio_chan_spec cpcap_adc_channels[] = …;
static irqreturn_t cpcap_adc_irq_thread(int irq, void *data)
{ … }
static void cpcap_adc_setup_calibrate(struct cpcap_adc *ddata,
enum cpcap_adc_channel chan)
{ … }
static int cpcap_adc_calibrate_one(struct cpcap_adc *ddata,
int channel,
u16 calibration_register,
int lower_threshold,
int upper_threshold)
{ … }
static int cpcap_adc_calibrate(struct cpcap_adc *ddata)
{ … }
static void cpcap_adc_setup_bank(struct cpcap_adc *ddata,
struct cpcap_adc_request *req)
{ … }
static int cpcap_adc_start_bank(struct cpcap_adc *ddata,
struct cpcap_adc_request *req)
{ … }
static int cpcap_adc_stop_bank(struct cpcap_adc *ddata)
{ … }
static void cpcap_adc_phase(struct cpcap_adc_request *req)
{ … }
static int cpcap_adc_table_to_millicelcius(unsigned short value)
{ … }
static void cpcap_adc_convert(struct cpcap_adc_request *req)
{ … }
static int cpcap_adc_read_bank_scaled(struct cpcap_adc *ddata,
struct cpcap_adc_request *req)
{ … }
static int cpcap_adc_init_request(struct cpcap_adc_request *req,
int channel)
{ … }
static int cpcap_adc_read_st_die_temp(struct cpcap_adc *ddata,
int addr, int *val)
{ … }
static int cpcap_adc_read(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2, long mask)
{ … }
static const struct iio_info cpcap_adc_info = …;
static const struct cpcap_adc_ato mapphone_adc = …;
static const struct of_device_id cpcap_adc_id_table[] = …;
MODULE_DEVICE_TABLE(of, cpcap_adc_id_table);
static int cpcap_adc_probe(struct platform_device *pdev)
{ … }
static struct platform_driver cpcap_adc_driver = …;
module_platform_driver(…) …;
MODULE_ALIAS(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;