#include <linux/bitfield.h>
#include <linux/iio/adc/qcom-vadc-common.h>
#include <linux/iio/consumer.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/thermal.h>
#include <linux/unaligned.h>
#include "../thermal_hwmon.h"
#define ADC5_MAX_CHANNEL …
#define ADC_TM5_NUM_CHANNELS …
#define ADC_TM5_STATUS_LOW …
#define ADC_TM5_STATUS_HIGH …
#define ADC_TM5_NUM_BTM …
#define ADC_TM5_ADC_DIG_PARAM …
#define ADC_TM5_FAST_AVG_CTL …
#define ADC_TM5_FAST_AVG_EN …
#define ADC_TM5_MEAS_INTERVAL_CTL …
#define ADC_TM5_TIMER1 …
#define ADC_TM5_MEAS_INTERVAL_CTL2 …
#define ADC_TM5_MEAS_INTERVAL_CTL2_MASK …
#define ADC_TM5_TIMER2 …
#define ADC_TM5_MEAS_INTERVAL_CTL3_MASK …
#define ADC_TM5_TIMER3 …
#define ADC_TM_EN_CTL1 …
#define ADC_TM_EN …
#define ADC_TM_CONV_REQ …
#define ADC_TM_CONV_REQ_EN …
#define ADC_TM5_M_CHAN_BASE …
#define ADC_TM5_M_ADC_CH_SEL_CTL(n) …
#define ADC_TM5_M_LOW_THR0(n) …
#define ADC_TM5_M_LOW_THR1(n) …
#define ADC_TM5_M_HIGH_THR0(n) …
#define ADC_TM5_M_HIGH_THR1(n) …
#define ADC_TM5_M_MEAS_INTERVAL_CTL(n) …
#define ADC_TM5_M_CTL(n) …
#define ADC_TM5_M_CTL_HW_SETTLE_DELAY_MASK …
#define ADC_TM5_M_CTL_CAL_SEL_MASK …
#define ADC_TM5_M_CTL_CAL_VAL …
#define ADC_TM5_M_EN(n) …
#define ADC_TM5_M_MEAS_EN …
#define ADC_TM5_M_HIGH_THR_INT_EN …
#define ADC_TM5_M_LOW_THR_INT_EN …
#define ADC_TM_GEN2_STATUS1 …
#define ADC_TM_GEN2_STATUS_LOW_SET …
#define ADC_TM_GEN2_STATUS_LOW_CLR …
#define ADC_TM_GEN2_STATUS_HIGH_SET …
#define ADC_TM_GEN2_STATUS_HIGH_CLR …
#define ADC_TM_GEN2_CFG_HS_SET …
#define ADC_TM_GEN2_CFG_HS_FLAG …
#define ADC_TM_GEN2_CFG_HS_CLR …
#define ADC_TM_GEN2_SID …
#define ADC_TM_GEN2_CH_CTL …
#define ADC_TM_GEN2_TM_CH_SEL …
#define ADC_TM_GEN2_MEAS_INT_SEL …
#define ADC_TM_GEN2_ADC_DIG_PARAM …
#define ADC_TM_GEN2_CTL_CAL_SEL …
#define ADC_TM_GEN2_CTL_DEC_RATIO_MASK …
#define ADC_TM_GEN2_FAST_AVG_CTL …
#define ADC_TM_GEN2_FAST_AVG_EN …
#define ADC_TM_GEN2_ADC_CH_SEL_CTL …
#define ADC_TM_GEN2_DELAY_CTL …
#define ADC_TM_GEN2_HW_SETTLE_DELAY …
#define ADC_TM_GEN2_EN_CTL1 …
#define ADC_TM_GEN2_EN …
#define ADC_TM_GEN2_CONV_REQ …
#define ADC_TM_GEN2_CONV_REQ_EN …
#define ADC_TM_GEN2_LOW_THR0 …
#define ADC_TM_GEN2_LOW_THR1 …
#define ADC_TM_GEN2_HIGH_THR0 …
#define ADC_TM_GEN2_HIGH_THR1 …
#define ADC_TM_GEN2_LOWER_MASK(n) …
#define ADC_TM_GEN2_UPPER_MASK(n) …
#define ADC_TM_GEN2_MEAS_IRQ_EN …
#define ADC_TM_GEN2_MEAS_EN …
#define ADC_TM5_GEN2_HIGH_THR_INT_EN …
#define ADC_TM5_GEN2_LOW_THR_INT_EN …
#define ADC_TM_GEN2_MEAS_INT_LSB …
#define ADC_TM_GEN2_MEAS_INT_MSB …
#define ADC_TM_GEN2_MEAS_INT_MODE …
#define ADC_TM_GEN2_Mn_DATA0(n) …
#define ADC_TM_GEN2_Mn_DATA1(n) …
#define ADC_TM_GEN2_DATA_SHIFT …
enum adc5_timer_select { … };
enum adc5_gen { … };
enum adc_tm5_cal_method { … };
enum adc_tm_gen2_time_select { … };
struct adc_tm5_chip;
struct adc_tm5_channel;
struct adc_tm5_data { … };
struct adc_tm5_channel { … };
struct adc_tm5_chip { … };
static int adc_tm5_read(struct adc_tm5_chip *adc_tm, u16 offset, u8 *data, int len)
{ … }
static int adc_tm5_write(struct adc_tm5_chip *adc_tm, u16 offset, u8 *data, int len)
{ … }
static int adc_tm5_reg_update(struct adc_tm5_chip *adc_tm, u16 offset, u8 mask, u8 val)
{ … }
static irqreturn_t adc_tm5_isr(int irq, void *data)
{ … }
static irqreturn_t adc_tm5_gen2_isr(int irq, void *data)
{ … }
static int adc_tm5_get_temp(struct thermal_zone_device *tz, int *temp)
{ … }
static int adc_tm5_disable_channel(struct adc_tm5_channel *channel)
{ … }
#define ADC_TM_GEN2_POLL_DELAY_MIN_US …
#define ADC_TM_GEN2_POLL_DELAY_MAX_US …
#define ADC_TM_GEN2_POLL_RETRY_COUNT …
static int32_t adc_tm5_gen2_conv_req(struct adc_tm5_chip *chip)
{ … }
static int adc_tm5_gen2_disable_channel(struct adc_tm5_channel *channel)
{ … }
static int adc_tm5_enable(struct adc_tm5_chip *chip)
{ … }
static int adc_tm5_configure(struct adc_tm5_channel *channel, int low, int high)
{ … }
static int adc_tm5_gen2_configure(struct adc_tm5_channel *channel, int low, int high)
{ … }
static int adc_tm5_set_trips(struct thermal_zone_device *tz, int low, int high)
{ … }
static const struct thermal_zone_device_ops adc_tm5_thermal_ops = …;
static int adc_tm5_register_tzd(struct adc_tm5_chip *adc_tm)
{ … }
static int adc_tm_hc_init(struct adc_tm5_chip *chip)
{ … }
static int adc_tm5_init(struct adc_tm5_chip *chip)
{ … }
static int adc_tm5_gen2_init(struct adc_tm5_chip *chip)
{ … }
static int adc_tm5_get_dt_channel_data(struct adc_tm5_chip *adc_tm,
struct adc_tm5_channel *channel,
struct device_node *node)
{ … }
static const struct adc_tm5_data adc_tm5_data_pmic = …;
static const struct adc_tm5_data adc_tm_hc_data_pmic = …;
static const struct adc_tm5_data adc_tm5_gen2_data_pmic = …;
static int adc_tm5_get_dt_data(struct adc_tm5_chip *adc_tm, struct device_node *node)
{ … }
static int adc_tm5_probe(struct platform_device *pdev)
{ … }
static const struct of_device_id adc_tm5_match_table[] = …;
MODULE_DEVICE_TABLE(of, adc_tm5_match_table);
static struct platform_driver adc_tm5_driver = …;
module_platform_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;