#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/mutex.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/interrupt.h>
#include <linux/regulator/consumer.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/events.h>
#include <linux/init.h>
#define CM32181_REG_ADDR_CMD …
#define CM32181_REG_ADDR_WH …
#define CM32181_REG_ADDR_WL …
#define CM32181_REG_ADDR_TEST …
#define CM32181_REG_ADDR_ALS …
#define CM32181_REG_ADDR_STATUS …
#define CM32181_REG_ADDR_ID …
#define CM32181_CONF_REG_NUM …
#define CM32181_CMD_ALS_DISABLE …
#define CM32181_CMD_ALS_INT_EN …
#define CM32181_CMD_ALS_THRES_WINDOW …
#define CM32181_CMD_ALS_PERS_SHIFT …
#define CM32181_CMD_ALS_PERS_MASK …
#define CM32181_CMD_ALS_PERS_DEFAULT …
#define CM32181_CMD_ALS_IT_SHIFT …
#define CM32181_CMD_ALS_IT_MASK …
#define CM32181_CMD_ALS_IT_DEFAULT …
#define CM32181_CMD_ALS_SM_SHIFT …
#define CM32181_CMD_ALS_SM_MASK …
#define CM32181_CMD_ALS_SM_DEFAULT …
#define CM32181_LUX_PER_BIT …
#define CM32181_LUX_PER_BIT_RESOLUTION …
#define CM32181_LUX_PER_BIT_BASE_IT …
#define CM32181_CALIBSCALE_DEFAULT …
#define CM32181_CALIBSCALE_RESOLUTION …
#define SMBUS_ALERT_RESPONSE_ADDRESS …
#define CPM0_REGS_BITMAP …
#define CPM0_HEADER_SIZE …
#define CPM1_LUX_PER_BIT …
#define CPM1_CALIBSCALE …
#define CPM1_SIZE …
static const int cm3218_als_it_bits[] = …;
static const int cm3218_als_it_values[] = …;
static const int cm32181_als_it_bits[] = …;
static const int cm32181_als_it_values[] = …;
struct cm32181_chip { … };
static int cm32181_read_als_it(struct cm32181_chip *cm32181, int *val2);
#ifdef CONFIG_ACPI
static int cm32181_acpi_get_cpm(struct device *dev, char *obj_name,
u64 *values, int count)
{ … }
static void cm32181_acpi_parse_cpm_tables(struct cm32181_chip *cm32181)
{ … }
#else
static void cm32181_acpi_parse_cpm_tables(struct cm32181_chip *cm32181)
{
}
#endif
static int cm32181_reg_init(struct cm32181_chip *cm32181)
{ … }
static int cm32181_read_als_it(struct cm32181_chip *cm32181, int *val2)
{ … }
static int cm32181_write_als_it(struct cm32181_chip *cm32181, int val)
{ … }
static int cm32181_get_lux(struct cm32181_chip *cm32181)
{ … }
static int cm32181_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2, long mask)
{ … }
static int cm32181_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int val, int val2, long mask)
{ … }
static ssize_t cm32181_get_it_available(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static const struct iio_chan_spec cm32181_channels[] = …;
static IIO_DEVICE_ATTR(in_illuminance_integration_time_available,
S_IRUGO, cm32181_get_it_available, NULL, 0);
static struct attribute *cm32181_attributes[] = …;
static const struct attribute_group cm32181_attribute_group = …;
static const struct iio_info cm32181_info = …;
static void cm32181_unregister_dummy_client(void *data)
{ … }
static int cm32181_probe(struct i2c_client *client)
{ … }
static int cm32181_suspend(struct device *dev)
{ … }
static int cm32181_resume(struct device *dev)
{ … }
static DEFINE_SIMPLE_DEV_PM_OPS(cm32181_pm_ops, cm32181_suspend, cm32181_resume);
static const struct of_device_id cm32181_of_match[] = …;
MODULE_DEVICE_TABLE(of, cm32181_of_match);
#ifdef CONFIG_ACPI
static const struct acpi_device_id cm32181_acpi_match[] = …;
MODULE_DEVICE_TABLE(acpi, cm32181_acpi_match);
#endif
static struct i2c_driver cm32181_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;