#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/device.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/units.h>
#include <linux/iio/buffer.h>
#include <linux/iio/iio.h>
#include <linux/iio/iio-gts-helper.h>
#include <linux/iio/kfifo_buf.h>
#define BU27034_REG_SYSTEM_CONTROL …
#define BU27034_MASK_SW_RESET …
#define BU27034_MASK_PART_ID …
#define BU27034_ID …
#define BU27034_REG_MODE_CONTROL1 …
#define BU27034_MASK_MEAS_MODE …
#define BU27034_REG_MODE_CONTROL2 …
#define BU27034_MASK_D01_GAIN …
#define BU27034_REG_MODE_CONTROL3 …
#define BU27034_REG_MODE_CONTROL4 …
#define BU27034_MASK_MEAS_EN …
#define BU27034_MASK_VALID …
#define BU27034_NUM_HW_DATA_CHANS …
#define BU27034_REG_DATA0_LO …
#define BU27034_REG_DATA1_LO …
#define BU27034_REG_DATA1_HI …
#define BU27034_REG_MANUFACTURER_ID …
#define BU27034_REG_MAX …
#define BU27034_MEAS_WAIT_PREMATURE_MS …
#define BU27034_DATA_WAIT_TIME_US …
#define BU27034_TOTAL_DATA_WAIT_TIME_US …
#define BU27034_RETRY_LIMIT …
enum { … };
static const unsigned long bu27034_scan_masks[] = …;
#define BU27034_SCALE_1X …
#define BU27034_GSEL_1X …
#define BU27034_GSEL_4X …
#define BU27034_GSEL_32X …
#define BU27034_GSEL_256X …
#define BU27034_GSEL_512X …
#define BU27034_GSEL_1024X …
static const struct iio_gain_sel_pair bu27034_gains[] = …;
#define BU27034_MEAS_MODE_100MS …
#define BU27034_MEAS_MODE_55MS …
#define BU27034_MEAS_MODE_200MS …
#define BU27034_MEAS_MODE_400MS …
static const struct iio_itime_sel_mul bu27034_itimes[] = …;
#define BU27034_CHAN_DATA(_name) …
static const struct iio_chan_spec bu27034_channels[] = …;
struct bu27034_data { … };
static const struct regmap_range bu27034_volatile_ranges[] = …;
static const struct regmap_access_table bu27034_volatile_regs = …;
static const struct regmap_range bu27034_read_only_ranges[] = …;
static const struct regmap_access_table bu27034_ro_regs = …;
static const struct regmap_config bu27034_regmap = …;
struct bu27034_gain_check { … };
static int bu27034_get_gain_sel(struct bu27034_data *data, int chan)
{ … }
static int bu27034_get_gain(struct bu27034_data *data, int chan, int *gain)
{ … }
static int bu27034_get_int_time(struct bu27034_data *data)
{ … }
static int _bu27034_get_scale(struct bu27034_data *data, int channel, int *val,
int *val2)
{ … }
static int bu27034_get_scale(struct bu27034_data *data, int channel, int *val,
int *val2)
{ … }
static int bu27034_write_gain_sel(struct bu27034_data *data, int chan, int sel)
{ … }
static int bu27034_set_gain(struct bu27034_data *data, int chan, int gain)
{ … }
static int bu27034_set_int_time(struct bu27034_data *data, int time)
{ … }
static int bu27034_try_set_int_time(struct bu27034_data *data, int time_us)
{ … }
static int bu27034_set_scale(struct bu27034_data *data, int chan,
int val, int val2)
{ … }
struct bu27034_lx_coeff { … };
static inline u64 gain_mul_div_helper(u64 val, unsigned int gain,
unsigned int div)
{ … }
static u64 bu27034_fixp_calc_t1_64bit(unsigned int coeff, unsigned int ch0,
unsigned int ch1, unsigned int gain0,
unsigned int gain1)
{ … }
static u64 bu27034_fixp_calc_t1(unsigned int coeff, unsigned int ch0,
unsigned int ch1, unsigned int gain0,
unsigned int gain1)
{ … }
static u64 bu27034_fixp_calc_t23(unsigned int coeff, unsigned int ch,
unsigned int gain)
{ … }
static int bu27034_fixp_calc_lx(unsigned int ch0, unsigned int ch1,
unsigned int gain0, unsigned int gain1,
unsigned int meastime, int coeff_idx)
{ … }
static bool bu27034_has_valid_sample(struct bu27034_data *data)
{ … }
static void bu27034_invalidate_read_data(struct bu27034_data *data)
{ … }
static int bu27034_read_result(struct bu27034_data *data, int chan, int *res)
{ … }
static int bu27034_get_result_unlocked(struct bu27034_data *data, __le16 *res,
int size)
{ … }
static int bu27034_meas_set(struct bu27034_data *data, bool en)
{ … }
static int bu27034_get_single_result(struct bu27034_data *data, int chan,
int *val)
{ … }
static int bu27034_calc_mlux(struct bu27034_data *data, __le16 *res, int *val)
{ … }
static int bu27034_get_mlux(struct bu27034_data *data, int chan, int *val)
{ … }
static int bu27034_read_raw(struct iio_dev *idev,
struct iio_chan_spec const *chan,
int *val, int *val2, long mask)
{ … }
static int bu27034_write_raw_get_fmt(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
long mask)
{ … }
static int bu27034_write_raw(struct iio_dev *idev,
struct iio_chan_spec const *chan,
int val, int val2, long mask)
{ … }
static int bu27034_read_avail(struct iio_dev *idev,
struct iio_chan_spec const *chan, const int **vals,
int *type, int *length, long mask)
{ … }
static const struct iio_info bu27034_info = …;
static int bu27034_chip_init(struct bu27034_data *data)
{ … }
static int bu27034_wait_for_data(struct bu27034_data *data)
{ … }
static int bu27034_buffer_thread(void *arg)
{ … }
static int bu27034_buffer_enable(struct iio_dev *idev)
{ … }
static int bu27034_buffer_disable(struct iio_dev *idev)
{ … }
static const struct iio_buffer_setup_ops bu27034_buffer_ops = …;
static int bu27034_probe(struct i2c_client *i2c)
{ … }
static const struct of_device_id bu27034_of_match[] = …;
MODULE_DEVICE_TABLE(of, bu27034_of_match);
static struct i2c_driver bu27034_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_LICENSE(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_IMPORT_NS(…);