#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/err.h>
#include <linux/delay.h>
#include <linux/mutex.h>
#include <linux/sysfs.h>
#include <linux/pm_runtime.h>
#define ALS_MIN_RANGE_VAL …
#define ALS_MAX_RANGE_VAL …
#define POWER_STA_ENABLE …
#define POWER_STA_DISABLE …
#define DRIVER_NAME …
struct als_data { … };
static ssize_t als_sensing_range_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static int als_wait_for_data_ready(struct device *dev)
{ … }
static ssize_t als_lux0_input_data_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t als_sensing_range_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{ … }
static int als_set_power_state(struct i2c_client *client, bool on_off)
{ … }
static DEVICE_ATTR(lux0_sensor_range, S_IRUGO | S_IWUSR,
als_sensing_range_show, als_sensing_range_store);
static DEVICE_ATTR(lux0_input, S_IRUGO, als_lux0_input_data_show, NULL);
static struct attribute *mid_att_als[] = …;
static const struct attribute_group m_als_gr = …;
static int als_set_default_config(struct i2c_client *client)
{ … }
static int apds9802als_probe(struct i2c_client *client)
{ … }
static void apds9802als_remove(struct i2c_client *client)
{ … }
#ifdef CONFIG_PM
static int apds9802als_suspend(struct device *dev)
{ … }
static int apds9802als_resume(struct device *dev)
{ … }
static UNIVERSAL_DEV_PM_OPS(apds9802als_pm_ops, apds9802als_suspend,
apds9802als_resume, NULL);
#define APDS9802ALS_PM_OPS …
#else
#define APDS9802ALS_PM_OPS …
#endif
static const struct i2c_device_id apds9802als_id[] = …;
MODULE_DEVICE_TABLE(i2c, apds9802als_id);
static struct i2c_driver apds9802als_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;