#include <linux/bitfield.h>
#include <linux/bitops.h>
#include <linux/device.h>
#include <linux/i2c.h>
#include <linux/interrupt.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/iio.h>
#include <linux/iio/iio-gts-helper.h>
#include <linux/iio/trigger.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
#define BU27008_REG_SYSTEM_CONTROL …
#define BU27008_MASK_SW_RESET …
#define BU27008_MASK_PART_ID …
#define BU27008_ID …
#define BU27008_REG_MODE_CONTROL1 …
#define BU27008_MASK_MEAS_MODE …
#define BU27008_MASK_CHAN_SEL …
#define BU27008_REG_MODE_CONTROL2 …
#define BU27008_MASK_RGBC_GAIN …
#define BU27008_MASK_IR_GAIN_LO …
#define BU27008_SHIFT_IR_GAIN …
#define BU27008_REG_MODE_CONTROL3 …
#define BU27008_MASK_VALID …
#define BU27008_MASK_INT_EN …
#define BU27008_INT_EN …
#define BU27008_INT_DIS …
#define BU27008_MASK_MEAS_EN …
#define BU27008_MEAS_EN …
#define BU27008_MEAS_DIS …
#define BU27008_REG_DATA0_LO …
#define BU27008_REG_DATA1_LO …
#define BU27008_REG_DATA2_LO …
#define BU27008_REG_DATA3_LO …
#define BU27008_REG_DATA3_HI …
#define BU27008_REG_MANUFACTURER_ID …
#define BU27008_REG_MAX …
#define BU27010_MASK_SW_RESET …
#define BU27010_ID …
#define BU27010_REG_POWER …
#define BU27010_MASK_POWER …
#define BU27010_REG_RESET …
#define BU27010_MASK_RESET …
#define BU27010_RESET_RELEASE …
#define BU27010_MASK_MEAS_EN …
#define BU27010_MASK_CHAN_SEL …
#define BU27010_MASK_MEAS_MODE …
#define BU27010_MASK_RGBC_GAIN …
#define BU27010_MASK_DATA3_GAIN …
#define BU27010_MASK_DATA2_GAIN …
#define BU27010_MASK_DATA1_GAIN …
#define BU27010_MASK_DATA0_GAIN …
#define BU27010_MASK_FLC_MODE …
#define BU27010_MASK_FLC_GAIN …
#define BU27010_REG_MODE_CONTROL4 …
#define BU27010_IRQ_DIS_ALL …
#define BU27010_DRDY_EN …
#define BU27010_MASK_INT_SEL …
#define BU27010_REG_MODE_CONTROL5 …
#define BU27010_MASK_RGB_VALID …
#define BU27010_MASK_FLC_VALID …
#define BU27010_MASK_WAIT_EN …
#define BU27010_MASK_FIFO_EN …
#define BU27010_MASK_RGB_EN …
#define BU27010_MASK_FLC_EN …
#define BU27010_REG_DATA_FLICKER_LO …
#define BU27010_MASK_DATA_FLICKER_HI …
#define BU27010_REG_FLICKER_COUNT …
#define BU27010_REG_FIFO_LEVEL_LO …
#define BU27010_MASK_FIFO_LEVEL_HI …
#define BU27010_REG_FIFO_DATA_LO …
#define BU27010_REG_FIFO_DATA_HI …
#define BU27010_MASK_FIFO_DATA_HI …
#define BU27010_REG_MANUFACTURER_ID …
#define BU27010_REG_MAX …
enum bu27008_chan_type { … };
enum bu27008_chan { … };
#define ALWAYS_SCANNABLE …
#define BU27008_BLUE2_CLEAR3 …
#define BU27008_CLEAR2_IR3 …
#define BU27008_BLUE2_IR3 …
static const unsigned long bu27008_scan_masks[] = …;
#define BU27008_SCALE_1X …
#define BU27010_SCALE_1X …
#define BU27008_GSEL_1X …
#define BU27008_GSEL_4X …
#define BU27008_GSEL_8X …
#define BU27008_GSEL_16X …
#define BU27008_GSEL_32X …
#define BU27008_GSEL_64X …
#define BU27008_GSEL_256X …
#define BU27008_GSEL_512X …
#define BU27008_GSEL_1024X …
static const struct iio_gain_sel_pair bu27008_gains[] = …;
static const struct iio_gain_sel_pair bu27008_gains_ir[] = …;
#define BU27010_GSEL_1X …
#define BU27010_GSEL_4X …
#define BU27010_GSEL_16X …
#define BU27010_GSEL_64X …
#define BU27010_GSEL_256X …
#define BU27010_GSEL_1024X …
#define BU27010_GSEL_4096X …
static const struct iio_gain_sel_pair bu27010_gains[] = …;
static const struct iio_gain_sel_pair bu27010_gains_ir[] = …;
#define BU27008_MEAS_MODE_100MS …
#define BU27008_MEAS_MODE_55MS …
#define BU27008_MEAS_MODE_200MS …
#define BU27008_MEAS_MODE_400MS …
#define BU27010_MEAS_MODE_100MS …
#define BU27010_MEAS_MODE_55MS …
#define BU27010_MEAS_MODE_200MS …
#define BU27010_MEAS_MODE_400MS …
#define BU27008_MEAS_TIME_MAX_MS …
static const struct iio_itime_sel_mul bu27008_itimes[] = …;
static const struct iio_itime_sel_mul bu27010_itimes[] = …;
#define BU27008_CHAN(color, data, separate_avail) …
static const struct iio_chan_spec bu27008_channels[] = …;
struct bu27008_data;
struct bu27_chip_data { … };
struct bu27008_data { … };
static const struct regmap_range bu27008_volatile_ranges[] = …;
static const struct regmap_range bu27010_volatile_ranges[] = …;
static const struct regmap_access_table bu27008_volatile_regs = …;
static const struct regmap_access_table bu27010_volatile_regs = …;
static const struct regmap_range bu27008_read_only_ranges[] = …;
static const struct regmap_range bu27010_read_only_ranges[] = …;
static const struct regmap_access_table bu27008_ro_regs = …;
static const struct regmap_access_table bu27010_ro_regs = …;
static const struct regmap_config bu27008_regmap = …;
static const struct regmap_config bu27010_regmap = …;
static int bu27008_write_gain_sel(struct bu27008_data *data, int sel)
{ … }
static int bu27010_write_gain_sel(struct bu27008_data *data, int sel)
{ … }
static int bu27008_get_gain_sel(struct bu27008_data *data, int *sel)
{ … }
static int bu27010_get_gain_sel(struct bu27008_data *data, int *sel)
{ … }
static int bu27008_chip_init(struct bu27008_data *data)
{ … }
static int bu27010_chip_init(struct bu27008_data *data)
{ … }
static const struct bu27_chip_data bu27010_chip = …;
static const struct bu27_chip_data bu27008_chip = …;
#define BU27008_MAX_VALID_RESULT_WAIT_US …
#define BU27008_VALID_RESULT_WAIT_QUANTA_US …
static int bu27008_chan_read_data(struct bu27008_data *data, int reg, int *val)
{ … }
static int bu27008_get_gain(struct bu27008_data *data, struct iio_gts *gts, int *gain)
{ … }
static int bu27008_set_gain(struct bu27008_data *data, int gain)
{ … }
static int bu27008_get_int_time_sel(struct bu27008_data *data, int *sel)
{ … }
static int bu27008_set_int_time_sel(struct bu27008_data *data, int sel)
{ … }
static int bu27008_get_int_time_us(struct bu27008_data *data)
{ … }
static int _bu27008_get_scale(struct bu27008_data *data, bool ir, int *val,
int *val2)
{ … }
static int bu27008_get_scale(struct bu27008_data *data, bool ir, int *val,
int *val2)
{ … }
static int bu27008_set_int_time(struct bu27008_data *data, int time)
{ … }
static int bu27008_try_set_int_time(struct bu27008_data *data, int int_time_new)
{ … }
static int bu27008_meas_set(struct bu27008_data *data, bool enable)
{ … }
static int bu27008_chan_cfg(struct bu27008_data *data,
struct iio_chan_spec const *chan)
{ … }
static int bu27008_read_one(struct bu27008_data *data, struct iio_dev *idev,
struct iio_chan_spec const *chan, int *val, int *val2)
{ … }
#define BU27008_LUX_DATA_RED …
#define BU27008_LUX_DATA_GREEN …
#define BU27008_LUX_DATA_BLUE …
#define BU27008_LUX_DATA_IR …
#define LUX_DATA_SIZE …
static int bu27008_read_lux_chans(struct bu27008_data *data, unsigned int time,
__le16 *chan_data)
{ … }
#define NORM_CHAN_DATA_FOR_LX_CALC(chan, gain, time) …
static u64 bu27008_calc_nlux(struct bu27008_data *data, __le16 *lux_data,
unsigned int gain, unsigned int gain_ir, unsigned int time)
{ … }
static int bu27008_get_time_n_gains(struct bu27008_data *data,
unsigned int *gain, unsigned int *gain_ir, unsigned int *time)
{ … }
struct bu27008_buf { … };
static int bu27008_buffer_fill_lux(struct bu27008_data *data,
struct bu27008_buf *raw)
{ … }
static int bu27008_read_lux(struct bu27008_data *data, struct iio_dev *idev,
struct iio_chan_spec const *chan,
int *val, int *val2)
{ … }
static int bu27008_read_raw(struct iio_dev *idev,
struct iio_chan_spec const *chan,
int *val, int *val2, long mask)
{ … }
static int bu27008_try_find_new_time_gain(struct bu27008_data *data, int val,
int val2, int *gain_sel)
{ … }
static int bu27008_set_scale(struct bu27008_data *data,
struct iio_chan_spec const *chan,
int val, int val2)
{ … }
static int bu27008_write_raw_get_fmt(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
long mask)
{ … }
static int bu27008_write_raw(struct iio_dev *idev,
struct iio_chan_spec const *chan,
int val, int val2, long mask)
{ … }
static int bu27008_read_avail(struct iio_dev *idev,
struct iio_chan_spec const *chan, const int **vals,
int *type, int *length, long mask)
{ … }
static int bu27008_update_scan_mode(struct iio_dev *idev,
const unsigned long *scan_mask)
{ … }
static const struct iio_info bu27008_info = …;
static int bu27008_trigger_set_state(struct iio_trigger *trig, bool state)
{ … }
static void bu27008_trigger_reenable(struct iio_trigger *trig)
{ … }
static const struct iio_trigger_ops bu27008_trigger_ops = …;
static irqreturn_t bu27008_trigger_handler(int irq, void *p)
{ … }
static int bu27008_buffer_preenable(struct iio_dev *idev)
{ … }
static int bu27008_buffer_postdisable(struct iio_dev *idev)
{ … }
static const struct iio_buffer_setup_ops bu27008_buffer_ops = …;
static irqreturn_t bu27008_data_rdy_poll(int irq, void *private)
{ … }
static int bu27008_setup_trigger(struct bu27008_data *data, struct iio_dev *idev)
{ … }
static int bu27008_probe(struct i2c_client *i2c)
{ … }
static const struct of_device_id bu27008_of_match[] = …;
MODULE_DEVICE_TABLE(of, bu27008_of_match);
static struct i2c_driver bu27008_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;
MODULE_IMPORT_NS(…);