#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/delay.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/acpi.h>
#define ISL29018_CONV_TIME_MS …
#define ISL29018_REG_ADD_COMMAND1 …
#define ISL29018_CMD1_OPMODE_SHIFT …
#define ISL29018_CMD1_OPMODE_MASK …
#define ISL29018_CMD1_OPMODE_POWER_DOWN …
#define ISL29018_CMD1_OPMODE_ALS_ONCE …
#define ISL29018_CMD1_OPMODE_IR_ONCE …
#define ISL29018_CMD1_OPMODE_PROX_ONCE …
#define ISL29018_REG_ADD_COMMAND2 …
#define ISL29018_CMD2_RESOLUTION_SHIFT …
#define ISL29018_CMD2_RESOLUTION_MASK …
#define ISL29018_CMD2_RANGE_SHIFT …
#define ISL29018_CMD2_RANGE_MASK …
#define ISL29018_CMD2_SCHEME_SHIFT …
#define ISL29018_CMD2_SCHEME_MASK …
#define ISL29018_REG_ADD_DATA_LSB …
#define ISL29018_REG_ADD_DATA_MSB …
#define ISL29018_REG_TEST …
#define ISL29018_TEST_SHIFT …
#define ISL29018_TEST_MASK …
#define ISL29035_REG_DEVICE_ID …
#define ISL29035_DEVICE_ID_SHIFT …
#define ISL29035_DEVICE_ID_MASK …
#define ISL29035_DEVICE_ID …
#define ISL29035_BOUT_SHIFT …
#define ISL29035_BOUT_MASK …
enum isl29018_int_time { … };
static const unsigned int isl29018_int_utimes[3][4] = …;
static const struct isl29018_scale { … } isl29018_scales[4][4] = …;
struct isl29018_chip { … };
static int isl29018_set_integration_time(struct isl29018_chip *chip,
unsigned int utime)
{ … }
static int isl29018_set_scale(struct isl29018_chip *chip, int scale, int uscale)
{ … }
static int isl29018_read_sensor_input(struct isl29018_chip *chip, int mode)
{ … }
static int isl29018_read_lux(struct isl29018_chip *chip, int *lux)
{ … }
static int isl29018_read_ir(struct isl29018_chip *chip, int *ir)
{ … }
static int isl29018_read_proximity_ir(struct isl29018_chip *chip, int scheme,
int *near_ir)
{ … }
static ssize_t in_illuminance_scale_available_show
(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t in_illuminance_integration_time_available_show
(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t proximity_on_chip_ambient_infrared_suppression_show
(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t proximity_on_chip_ambient_infrared_suppression_store
(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static int isl29018_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int val,
int val2,
long mask)
{ … }
static int isl29018_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val,
int *val2,
long mask)
{ … }
#define ISL29018_LIGHT_CHANNEL …
#define ISL29018_IR_CHANNEL …
#define ISL29018_PROXIMITY_CHANNEL …
static const struct iio_chan_spec isl29018_channels[] = …;
static const struct iio_chan_spec isl29023_channels[] = …;
static IIO_DEVICE_ATTR_RO(in_illuminance_integration_time_available, 0);
static IIO_DEVICE_ATTR_RO(in_illuminance_scale_available, 0);
static IIO_DEVICE_ATTR_RW(proximity_on_chip_ambient_infrared_suppression, 0);
#define ISL29018_DEV_ATTR(name) …
static struct attribute *isl29018_attributes[] = …;
static struct attribute *isl29023_attributes[] = …;
static const struct attribute_group isl29018_group = …;
static const struct attribute_group isl29023_group = …;
enum { … };
static int isl29018_chip_init(struct isl29018_chip *chip)
{ … }
static const struct iio_info isl29018_info = …;
static const struct iio_info isl29023_info = …;
static bool isl29018_is_volatile_reg(struct device *dev, unsigned int reg)
{ … }
static const struct regmap_config isl29018_regmap_config = …;
static const struct regmap_config isl29035_regmap_config = …;
struct isl29018_chip_info { … };
static const struct isl29018_chip_info isl29018_chip_info_tbl[] = …;
static const char *isl29018_match_acpi_device(struct device *dev, int *data)
{ … }
static void isl29018_disable_regulator_action(void *_data)
{ … }
static int isl29018_probe(struct i2c_client *client)
{ … }
static int isl29018_suspend(struct device *dev)
{ … }
static int isl29018_resume(struct device *dev)
{ … }
static DEFINE_SIMPLE_DEV_PM_OPS(isl29018_pm_ops, isl29018_suspend,
isl29018_resume);
#ifdef CONFIG_ACPI
static const struct acpi_device_id isl29018_acpi_match[] = …;
MODULE_DEVICE_TABLE(acpi, isl29018_acpi_match);
#endif
static const struct i2c_device_id isl29018_id[] = …;
MODULE_DEVICE_TABLE(i2c, isl29018_id);
static const struct of_device_id isl29018_of_match[] = …;
MODULE_DEVICE_TABLE(of, isl29018_of_match);
static struct i2c_driver isl29018_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;