#include <linux/module.h>
#include <linux/slab.h>
#include <linux/pm.h>
#include <linux/i2c.h>
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/interrupt.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/events.h>
#define APDS9300_DRV_NAME …
#define APDS9300_IRQ_NAME …
#define APDS9300_CMD …
#define APDS9300_WORD …
#define APDS9300_CLEAR …
#define APDS9300_CONTROL …
#define APDS9300_THRESHLOWLOW …
#define APDS9300_THRESHHIGHLOW …
#define APDS9300_INTERRUPT …
#define APDS9300_DATA0LOW …
#define APDS9300_DATA1LOW …
#define APDS9300_POWER_ON …
#define APDS9300_POWER_OFF …
#define APDS9300_INTR_ENABLE …
#define APDS9300_THRESH_INTR …
#define APDS9300_THRESH_MAX …
struct apds9300_data { … };
static const u16 apds9300_lux_ratio[] = …;
static unsigned long apds9300_calculate_lux(u16 ch0, u16 ch1)
{ … }
static int apds9300_get_adc_val(struct apds9300_data *data, int adc_number)
{ … }
static int apds9300_set_thresh_low(struct apds9300_data *data, int value)
{ … }
static int apds9300_set_thresh_hi(struct apds9300_data *data, int value)
{ … }
static int apds9300_set_intr_state(struct apds9300_data *data, int state)
{ … }
static int apds9300_set_power_state(struct apds9300_data *data, int state)
{ … }
static void apds9300_clear_intr(struct apds9300_data *data)
{ … }
static int apds9300_chip_init(struct apds9300_data *data)
{ … }
static int apds9300_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int *val, int *val2,
long mask)
{ … }
static int apds9300_read_thresh(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 apds9300_write_thresh(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 apds9300_read_interrupt_config(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan,
enum iio_event_type type,
enum iio_event_direction dir)
{ … }
static int apds9300_write_interrupt_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 const struct iio_info apds9300_info_no_irq = …;
static const struct iio_info apds9300_info = …;
static const struct iio_event_spec apds9300_event_spec[] = …;
static const struct iio_chan_spec apds9300_channels[] = …;
static irqreturn_t apds9300_interrupt_handler(int irq, void *private)
{ … }
static int apds9300_probe(struct i2c_client *client)
{ … }
static void apds9300_remove(struct i2c_client *client)
{ … }
static int apds9300_suspend(struct device *dev)
{ … }
static int apds9300_resume(struct device *dev)
{ … }
static DEFINE_SIMPLE_DEV_PM_OPS(apds9300_pm_ops, apds9300_suspend,
apds9300_resume);
static const struct i2c_device_id apds9300_id[] = …;
MODULE_DEVICE_TABLE(i2c, apds9300_id);
static struct i2c_driver apds9300_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;