#include <linux/module.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/pm.h>
#include <linux/platform_device.h>
#include <linux/i2c.h>
#include <linux/fb.h>
#include <linux/backlight.h>
#include <linux/leds.h>
#include <linux/workqueue.h>
#include <linux/slab.h>
#include <linux/platform_data/adp8870.h>
#define ADP8870_EXT_FEATURES
#define ADP8870_USE_LEDS
#define ADP8870_MFDVID …
#define ADP8870_MDCR …
#define ADP8870_INT_STAT …
#define ADP8870_INT_EN …
#define ADP8870_CFGR …
#define ADP8870_BLSEL …
#define ADP8870_PWMLED …
#define ADP8870_BLOFF …
#define ADP8870_BLDIM …
#define ADP8870_BLFR …
#define ADP8870_BLMX1 …
#define ADP8870_BLDM1 …
#define ADP8870_BLMX2 …
#define ADP8870_BLDM2 …
#define ADP8870_BLMX3 …
#define ADP8870_BLDM3 …
#define ADP8870_BLMX4 …
#define ADP8870_BLDM4 …
#define ADP8870_BLMX5 …
#define ADP8870_BLDM5 …
#define ADP8870_ISCLAW …
#define ADP8870_ISCC …
#define ADP8870_ISCT1 …
#define ADP8870_ISCT2 …
#define ADP8870_ISCF …
#define ADP8870_ISC1 …
#define ADP8870_ISC2 …
#define ADP8870_ISC3 …
#define ADP8870_ISC4 …
#define ADP8870_ISC5 …
#define ADP8870_ISC6 …
#define ADP8870_ISC7 …
#define ADP8870_ISC7_L2 …
#define ADP8870_ISC7_L3 …
#define ADP8870_ISC7_L4 …
#define ADP8870_ISC7_L5 …
#define ADP8870_CMP_CTL …
#define ADP8870_ALS1_EN …
#define ADP8870_ALS2_EN …
#define ADP8870_ALS1_STAT …
#define ADP8870_ALS2_STAT …
#define ADP8870_L2TRP …
#define ADP8870_L2HYS …
#define ADP8870_L3TRP …
#define ADP8870_L3HYS …
#define ADP8870_L4TRP …
#define ADP8870_L4HYS …
#define ADP8870_L5TRP …
#define ADP8870_L5HYS …
#define ADP8870_PH1LEVL …
#define ADP8870_PH1LEVH …
#define ADP8870_PH2LEVL …
#define ADP8870_PH2LEVH …
#define ADP8870_MANUFID …
#define ADP8870_DEVID(x) …
#define ADP8870_MANID(x) …
#define D7ALSEN …
#define INT_CFG …
#define NSTBY …
#define DIM_EN …
#define GDWN_DIS …
#define SIS_EN …
#define CMP_AUTOEN …
#define BLEN …
#define L5_EN …
#define L4_EN …
#define L3_EN …
#define L2_EN …
#define CFGR_BLV_SHIFT …
#define CFGR_BLV_MASK …
#define ADP8870_FLAG_LED_MASK …
#define FADE_VAL(in, out) …
#define BL_CFGR_VAL(law, blv) …
#define ALS_CMPR_CFG_VAL(filt) …
struct adp8870_bl { … };
struct adp8870_led { … };
static int adp8870_read(struct i2c_client *client, int reg, uint8_t *val)
{ … }
static int adp8870_write(struct i2c_client *client, u8 reg, u8 val)
{ … }
static int adp8870_set_bits(struct i2c_client *client, int reg, uint8_t bit_mask)
{ … }
static int adp8870_clr_bits(struct i2c_client *client, int reg, uint8_t bit_mask)
{ … }
#if defined(ADP8870_USE_LEDS)
static void adp8870_led_work(struct work_struct *work)
{ … }
static void adp8870_led_set(struct led_classdev *led_cdev,
enum led_brightness value)
{ … }
static int adp8870_led_setup(struct adp8870_led *led)
{ … }
static int adp8870_led_probe(struct i2c_client *client)
{ … }
static int adp8870_led_remove(struct i2c_client *client)
{ … }
#else
static int adp8870_led_probe(struct i2c_client *client)
{
return 0;
}
static int adp8870_led_remove(struct i2c_client *client)
{
return 0;
}
#endif
static int adp8870_bl_set(struct backlight_device *bl, int brightness)
{ … }
static int adp8870_bl_update_status(struct backlight_device *bl)
{ … }
static int adp8870_bl_get_brightness(struct backlight_device *bl)
{ … }
static const struct backlight_ops adp8870_bl_ops = …;
static int adp8870_bl_setup(struct backlight_device *bl)
{ … }
static ssize_t adp8870_show(struct device *dev, char *buf, int reg)
{ … }
static ssize_t adp8870_store(struct device *dev, const char *buf,
size_t count, int reg)
{ … }
static ssize_t adp8870_bl_l5_dark_max_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t adp8870_bl_l5_dark_max_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{ … }
static DEVICE_ATTR(l5_dark_max, 0664, adp8870_bl_l5_dark_max_show,
adp8870_bl_l5_dark_max_store);
static ssize_t adp8870_bl_l4_indoor_max_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t adp8870_bl_l4_indoor_max_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{ … }
static DEVICE_ATTR(l4_indoor_max, 0664, adp8870_bl_l4_indoor_max_show,
adp8870_bl_l4_indoor_max_store);
static ssize_t adp8870_bl_l3_office_max_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t adp8870_bl_l3_office_max_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{ … }
static DEVICE_ATTR(l3_office_max, 0664, adp8870_bl_l3_office_max_show,
adp8870_bl_l3_office_max_store);
static ssize_t adp8870_bl_l2_bright_max_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t adp8870_bl_l2_bright_max_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{ … }
static DEVICE_ATTR(l2_bright_max, 0664, adp8870_bl_l2_bright_max_show,
adp8870_bl_l2_bright_max_store);
static ssize_t adp8870_bl_l1_daylight_max_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t adp8870_bl_l1_daylight_max_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{ … }
static DEVICE_ATTR(l1_daylight_max, 0664, adp8870_bl_l1_daylight_max_show,
adp8870_bl_l1_daylight_max_store);
static ssize_t adp8870_bl_l5_dark_dim_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t adp8870_bl_l5_dark_dim_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static DEVICE_ATTR(l5_dark_dim, 0664, adp8870_bl_l5_dark_dim_show,
adp8870_bl_l5_dark_dim_store);
static ssize_t adp8870_bl_l4_indoor_dim_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t adp8870_bl_l4_indoor_dim_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static DEVICE_ATTR(l4_indoor_dim, 0664, adp8870_bl_l4_indoor_dim_show,
adp8870_bl_l4_indoor_dim_store);
static ssize_t adp8870_bl_l3_office_dim_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t adp8870_bl_l3_office_dim_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static DEVICE_ATTR(l3_office_dim, 0664, adp8870_bl_l3_office_dim_show,
adp8870_bl_l3_office_dim_store);
static ssize_t adp8870_bl_l2_bright_dim_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t adp8870_bl_l2_bright_dim_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static DEVICE_ATTR(l2_bright_dim, 0664, adp8870_bl_l2_bright_dim_show,
adp8870_bl_l2_bright_dim_store);
static ssize_t adp8870_bl_l1_daylight_dim_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t adp8870_bl_l1_daylight_dim_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static DEVICE_ATTR(l1_daylight_dim, 0664, adp8870_bl_l1_daylight_dim_show,
adp8870_bl_l1_daylight_dim_store);
#ifdef ADP8870_EXT_FEATURES
static ssize_t adp8870_bl_ambient_light_level_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR(ambient_light_level, 0444,
adp8870_bl_ambient_light_level_show, NULL);
static ssize_t adp8870_bl_ambient_light_zone_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t adp8870_bl_ambient_light_zone_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static DEVICE_ATTR(ambient_light_zone, 0664,
adp8870_bl_ambient_light_zone_show,
adp8870_bl_ambient_light_zone_store);
#endif
static struct attribute *adp8870_bl_attributes[] = …;
static const struct attribute_group adp8870_bl_attr_group = …;
static int adp8870_probe(struct i2c_client *client)
{ … }
static void adp8870_remove(struct i2c_client *client)
{ … }
#ifdef CONFIG_PM_SLEEP
static int adp8870_i2c_suspend(struct device *dev)
{ … }
static int adp8870_i2c_resume(struct device *dev)
{ … }
#endif
static SIMPLE_DEV_PM_OPS(adp8870_i2c_pm_ops, adp8870_i2c_suspend,
adp8870_i2c_resume);
static const struct i2c_device_id adp8870_id[] = …;
MODULE_DEVICE_TABLE(i2c, adp8870_id);
static struct i2c_driver adp8870_driver = …;
module_i2c_driver(…) …;
MODULE_LICENSE(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;