#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/delay.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#define LV0104CS_REGVAL_MEASURE …
#define LV0104CS_REGVAL_SLEEP …
#define LV0104CS_SCALE_0_25X …
#define LV0104CS_SCALE_1X …
#define LV0104CS_SCALE_2X …
#define LV0104CS_SCALE_8X …
#define LV0104CS_SCALE_SHIFT …
#define LV0104CS_INTEG_12_5MS …
#define LV0104CS_INTEG_100MS …
#define LV0104CS_INTEG_200MS …
#define LV0104CS_INTEG_SHIFT …
#define LV0104CS_CALIBSCALE_UNITY …
struct lv0104cs_private { … };
struct lv0104cs_mapping { … };
static const struct lv0104cs_mapping lv0104cs_calibscales[] = …;
static const struct lv0104cs_mapping lv0104cs_scales[] = …;
static const struct lv0104cs_mapping lv0104cs_int_times[] = …;
static int lv0104cs_write_reg(struct i2c_client *client, u8 regval)
{ … }
static int lv0104cs_read_adc(struct i2c_client *client, u16 *adc_output)
{ … }
static int lv0104cs_get_lux(struct lv0104cs_private *lv0104cs,
int *val, int *val2)
{ … }
static int lv0104cs_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2, long mask)
{ … }
static int lv0104cs_set_calibscale(struct lv0104cs_private *lv0104cs,
int val, int val2)
{ … }
static int lv0104cs_set_scale(struct lv0104cs_private *lv0104cs,
int val, int val2)
{ … }
static int lv0104cs_set_int_time(struct lv0104cs_private *lv0104cs,
int val, int val2)
{ … }
static int lv0104cs_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int val, int val2, long mask)
{ … }
static ssize_t lv0104cs_show_calibscale_avail(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t lv0104cs_show_scale_avail(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t lv0104cs_show_int_time_avail(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static IIO_DEVICE_ATTR(calibscale_available, 0444,
lv0104cs_show_calibscale_avail, NULL, 0);
static IIO_DEVICE_ATTR(scale_available, 0444,
lv0104cs_show_scale_avail, NULL, 0);
static IIO_DEV_ATTR_INT_TIME_AVAIL(lv0104cs_show_int_time_avail);
static struct attribute *lv0104cs_attributes[] = …;
static const struct attribute_group lv0104cs_attribute_group = …;
static const struct iio_info lv0104cs_info = …;
static const struct iio_chan_spec lv0104cs_channels[] = …;
static int lv0104cs_probe(struct i2c_client *client)
{ … }
static const struct i2c_device_id lv0104cs_id[] = …;
MODULE_DEVICE_TABLE(i2c, lv0104cs_id);
static struct i2c_driver lv0104cs_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;