#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/init.h>
#define CM3232_REG_ADDR_CMD …
#define CM3232_REG_ADDR_ALS …
#define CM3232_REG_ADDR_ID …
#define CM3232_CMD_ALS_DISABLE …
#define CM3232_CMD_ALS_IT_SHIFT …
#define CM3232_CMD_ALS_IT_MASK …
#define CM3232_CMD_ALS_IT_DEFAULT …
#define CM3232_CMD_ALS_RESET …
#define CM3232_CMD_DEFAULT …
#define CM3232_HW_ID …
#define CM3232_CALIBSCALE_DEFAULT …
#define CM3232_CALIBSCALE_RESOLUTION …
#define CM3232_MLUX_PER_LUX …
#define CM3232_MLUX_PER_BIT_DEFAULT …
#define CM3232_MLUX_PER_BIT_BASE_IT …
static const struct { … } cm3232_als_it_scales[] = …;
struct cm3232_als_info { … };
static struct cm3232_als_info cm3232_als_info_default = …;
struct cm3232_chip { … };
static int cm3232_reg_init(struct cm3232_chip *chip)
{ … }
static int cm3232_read_als_it(struct cm3232_chip *chip, int *val, int *val2)
{ … }
static int cm3232_write_als_it(struct cm3232_chip *chip, int val, int val2)
{ … }
static int cm3232_get_lux(struct cm3232_chip *chip)
{ … }
static int cm3232_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2, long mask)
{ … }
static int cm3232_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int val, int val2, long mask)
{ … }
static ssize_t cm3232_get_it_available(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static const struct iio_chan_spec cm3232_channels[] = …;
static IIO_DEVICE_ATTR(in_illuminance_integration_time_available,
S_IRUGO, cm3232_get_it_available, NULL, 0);
static struct attribute *cm3232_attributes[] = …;
static const struct attribute_group cm3232_attribute_group = …;
static const struct iio_info cm3232_info = …;
static int cm3232_probe(struct i2c_client *client)
{ … }
static void cm3232_remove(struct i2c_client *client)
{ … }
static const struct i2c_device_id cm3232_id[] = …;
static int cm3232_suspend(struct device *dev)
{ … }
static int cm3232_resume(struct device *dev)
{ … }
static DEFINE_SIMPLE_DEV_PM_OPS(cm3232_pm_ops, cm3232_suspend, cm3232_resume);
MODULE_DEVICE_TABLE(i2c, cm3232_id);
static const struct of_device_id cm3232_of_match[] = …;
MODULE_DEVICE_TABLE(of, cm3232_of_match);
static struct i2c_driver cm3232_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;