#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/irq_work.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/mutex.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <asm/unaligned.h>
#include <linux/iio/buffer.h>
#include <linux/iio/events.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/trigger.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
#define GP2A_I2C_NAME …
#define GP2AP020A00F_OP_REG …
#define GP2AP020A00F_ALS_REG …
#define GP2AP020A00F_PS_REG …
#define GP2AP020A00F_LED_REG …
#define GP2AP020A00F_TL_L_REG …
#define GP2AP020A00F_TL_H_REG …
#define GP2AP020A00F_TH_L_REG …
#define GP2AP020A00F_TH_H_REG …
#define GP2AP020A00F_PL_L_REG …
#define GP2AP020A00F_PL_H_REG …
#define GP2AP020A00F_PH_L_REG …
#define GP2AP020A00F_PH_H_REG …
#define GP2AP020A00F_D0_L_REG …
#define GP2AP020A00F_D0_H_REG …
#define GP2AP020A00F_D1_L_REG …
#define GP2AP020A00F_D1_H_REG …
#define GP2AP020A00F_D2_L_REG …
#define GP2AP020A00F_D2_H_REG …
#define GP2AP020A00F_NUM_REGS …
#define GP2AP020A00F_OP3_MASK …
#define GP2AP020A00F_OP3_SHUTDOWN …
#define GP2AP020A00F_OP3_OPERATION …
#define GP2AP020A00F_OP2_MASK …
#define GP2AP020A00F_OP2_AUTO_SHUTDOWN …
#define GP2AP020A00F_OP2_CONT_OPERATION …
#define GP2AP020A00F_OP_MASK …
#define GP2AP020A00F_OP_ALS_AND_PS …
#define GP2AP020A00F_OP_ALS …
#define GP2AP020A00F_OP_PS …
#define GP2AP020A00F_OP_DEBUG …
#define GP2AP020A00F_PROX_MASK …
#define GP2AP020A00F_PROX_NON_DETECT …
#define GP2AP020A00F_PROX_DETECT …
#define GP2AP020A00F_FLAG_P …
#define GP2AP020A00F_FLAG_A …
#define GP2AP020A00F_TYPE_MASK …
#define GP2AP020A00F_TYPE_MANUAL_CALC …
#define GP2AP020A00F_TYPE_AUTO_CALC …
#define GP2AP020A00F_PRST_MASK …
#define GP2AP020A00F_PRST_ONCE …
#define GP2AP020A00F_PRST_4_CYCLES …
#define GP2AP020A00F_PRST_8_CYCLES …
#define GP2AP020A00F_PRST_16_CYCLES …
#define GP2AP020A00F_RES_A_MASK …
#define GP2AP020A00F_RES_A_800ms …
#define GP2AP020A00F_RES_A_400ms …
#define GP2AP020A00F_RES_A_200ms …
#define GP2AP020A00F_RES_A_100ms …
#define GP2AP020A00F_RES_A_25ms …
#define GP2AP020A00F_RES_A_6_25ms …
#define GP2AP020A00F_RES_A_1_56ms …
#define GP2AP020A00F_RES_A_0_39ms …
#define GP2AP020A00F_RANGE_A_MASK …
#define GP2AP020A00F_RANGE_A_x1 …
#define GP2AP020A00F_RANGE_A_x2 …
#define GP2AP020A00F_RANGE_A_x4 …
#define GP2AP020A00F_RANGE_A_x8 …
#define GP2AP020A00F_RANGE_A_x16 …
#define GP2AP020A00F_RANGE_A_x32 …
#define GP2AP020A00F_RANGE_A_x64 …
#define GP2AP020A00F_RANGE_A_x128 …
#define GP2AP020A00F_ALC_MASK …
#define GP2AP020A00F_ALC_ON …
#define GP2AP020A00F_ALC_OFF …
#define GP2AP020A00F_INTTYPE_MASK …
#define GP2AP020A00F_INTTYPE_LEVEL …
#define GP2AP020A00F_INTTYPE_PULSE …
#define GP2AP020A00F_RES_P_MASK …
#define GP2AP020A00F_RES_P_800ms_x2 …
#define GP2AP020A00F_RES_P_400ms_x2 …
#define GP2AP020A00F_RES_P_200ms_x2 …
#define GP2AP020A00F_RES_P_100ms_x2 …
#define GP2AP020A00F_RES_P_25ms_x2 …
#define GP2AP020A00F_RES_P_6_25ms_x2 …
#define GP2AP020A00F_RES_P_1_56ms_x2 …
#define GP2AP020A00F_RES_P_0_39ms_x2 …
#define GP2AP020A00F_RANGE_P_MASK …
#define GP2AP020A00F_RANGE_P_x1 …
#define GP2AP020A00F_RANGE_P_x2 …
#define GP2AP020A00F_RANGE_P_x4 …
#define GP2AP020A00F_RANGE_P_x8 …
#define GP2AP020A00F_RANGE_P_x16 …
#define GP2AP020A00F_RANGE_P_x32 …
#define GP2AP020A00F_RANGE_P_x64 …
#define GP2AP020A00F_RANGE_P_x128 …
#define GP2AP020A00F_INTVAL_MASK …
#define GP2AP020A00F_INTVAL_0 …
#define GP2AP020A00F_INTVAL_4 …
#define GP2AP020A00F_INTVAL_8 …
#define GP2AP020A00F_INTVAL_16 …
#define GP2AP020A00F_IS_MASK …
#define GP2AP020A00F_IS_13_8mA …
#define GP2AP020A00F_IS_27_5mA …
#define GP2AP020A00F_IS_55mA …
#define GP2AP020A00F_IS_110mA …
#define GP2AP020A00F_PIN_MASK …
#define GP2AP020A00F_PIN_ALS_OR_PS …
#define GP2AP020A00F_PIN_ALS …
#define GP2AP020A00F_PIN_PS …
#define GP2AP020A00F_PIN_PS_DETECT …
#define GP2AP020A00F_FREQ_MASK …
#define GP2AP020A00F_FREQ_327_5kHz …
#define GP2AP020A00F_FREQ_81_8kHz …
#define GP2AP020A00F_RST …
#define GP2AP020A00F_SCAN_MODE_LIGHT_CLEAR …
#define GP2AP020A00F_SCAN_MODE_LIGHT_IR …
#define GP2AP020A00F_SCAN_MODE_PROXIMITY …
#define GP2AP020A00F_CHAN_TIMESTAMP …
#define GP2AP020A00F_DATA_READY_TIMEOUT …
#define GP2AP020A00F_DATA_REG(chan) …
#define GP2AP020A00F_THRESH_REG(th_val_id) …
#define GP2AP020A00F_THRESH_VAL_ID(reg_addr) …
#define GP2AP020A00F_SUBTRACT_MODE …
#define GP2AP020A00F_ADD_MODE …
#define GP2AP020A00F_MAX_CHANNELS …
enum gp2ap020a00f_opmode { … };
enum gp2ap020a00f_cmd { … };
enum gp2ap020a00f_flags { … };
enum gp2ap020a00f_thresh_val_id { … };
struct gp2ap020a00f_data { … };
static const u8 gp2ap020a00f_reg_init_tab[] = …;
static bool gp2ap020a00f_is_volatile_reg(struct device *dev, unsigned int reg)
{ … }
static const struct regmap_config gp2ap020a00f_regmap_config = …;
static const struct gp2ap020a00f_mutable_config_regs { … } opmode_regs_settings[GP2AP020A00F_NUM_OPMODES] = …;
static int gp2ap020a00f_set_operation_mode(struct gp2ap020a00f_data *data,
enum gp2ap020a00f_opmode op)
{ … }
static bool gp2ap020a00f_als_enabled(struct gp2ap020a00f_data *data)
{ … }
static bool gp2ap020a00f_prox_detect_enabled(struct gp2ap020a00f_data *data)
{ … }
static int gp2ap020a00f_write_event_threshold(struct gp2ap020a00f_data *data,
enum gp2ap020a00f_thresh_val_id th_val_id,
bool enable)
{ … }
static int gp2ap020a00f_alter_opmode(struct gp2ap020a00f_data *data,
enum gp2ap020a00f_opmode diff_mode, int add_sub)
{ … }
static int gp2ap020a00f_exec_cmd(struct gp2ap020a00f_data *data,
enum gp2ap020a00f_cmd cmd)
{ … }
static int wait_conversion_complete_irq(struct gp2ap020a00f_data *data)
{ … }
static int gp2ap020a00f_read_output(struct gp2ap020a00f_data *data,
unsigned int output_reg, int *val)
{ … }
static bool gp2ap020a00f_adjust_lux_mode(struct gp2ap020a00f_data *data,
int output_val)
{ … }
static void gp2ap020a00f_output_to_lux(struct gp2ap020a00f_data *data,
int *output_val)
{ … }
static void gp2ap020a00f_iio_trigger_work(struct irq_work *work)
{ … }
static irqreturn_t gp2ap020a00f_prox_sensing_handler(int irq, void *data)
{ … }
static irqreturn_t gp2ap020a00f_thresh_event_handler(int irq, void *data)
{ … }
static irqreturn_t gp2ap020a00f_trigger_handler(int irq, void *data)
{ … }
static u8 gp2ap020a00f_get_thresh_reg(const struct iio_chan_spec *chan,
enum iio_event_direction event_dir)
{ … }
static int gp2ap020a00f_write_event_val(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan,
enum iio_event_type type,
enum iio_event_direction dir,
enum iio_event_info info,
int val, int val2)
{ … }
static int gp2ap020a00f_read_event_val(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan,
enum iio_event_type type,
enum iio_event_direction dir,
enum iio_event_info info,
int *val, int *val2)
{ … }
static int gp2ap020a00f_write_prox_event_config(struct iio_dev *indio_dev,
int state)
{ … }
static int gp2ap020a00f_write_event_config(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan,
enum iio_event_type type,
enum iio_event_direction dir,
int state)
{ … }
static int gp2ap020a00f_read_event_config(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan,
enum iio_event_type type,
enum iio_event_direction dir)
{ … }
static int gp2ap020a00f_read_channel(struct gp2ap020a00f_data *data,
struct iio_chan_spec const *chan, int *val)
{ … }
static int gp2ap020a00f_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2,
long mask)
{ … }
static const struct iio_event_spec gp2ap020a00f_event_spec_light[] = …;
static const struct iio_event_spec gp2ap020a00f_event_spec_prox[] = …;
static const struct iio_chan_spec gp2ap020a00f_channels[] = …;
static const struct iio_info gp2ap020a00f_info = …;
static int gp2ap020a00f_buffer_postenable(struct iio_dev *indio_dev)
{ … }
static int gp2ap020a00f_buffer_predisable(struct iio_dev *indio_dev)
{ … }
static const struct iio_buffer_setup_ops gp2ap020a00f_buffer_setup_ops = …;
static int gp2ap020a00f_probe(struct i2c_client *client)
{ … }
static void gp2ap020a00f_remove(struct i2c_client *client)
{ … }
static const struct i2c_device_id gp2ap020a00f_id[] = …;
MODULE_DEVICE_TABLE(i2c, gp2ap020a00f_id);
static const struct of_device_id gp2ap020a00f_of_match[] = …;
MODULE_DEVICE_TABLE(of, gp2ap020a00f_of_match);
static struct i2c_driver gp2ap020a00f_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;