#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/swab.h>
#include <linux/i2c.h>
#include <linux/delay.h>
#include <linux/idr.h>
#include <linux/power_supply.h>
#include <linux/slab.h>
#include <linux/ds2782_battery.h>
#define DS2782_REG_RARC …
#define DS278x_REG_VOLT_MSB …
#define DS278x_REG_TEMP_MSB …
#define DS278x_REG_CURRENT_MSB …
#define DS2782_REG_RSNSP …
#define DS2782_CURRENT_UNITS …
#define DS2786_REG_RARC …
#define DS2786_CURRENT_UNITS …
#define DS278x_DELAY …
struct ds278x_info;
struct ds278x_battery_ops { … };
#define to_ds278x_info(x) …
struct ds278x_info { … };
static DEFINE_IDR(battery_id);
static DEFINE_MUTEX(battery_lock);
static inline int ds278x_read_reg(struct ds278x_info *info, int reg, u8 *val)
{ … }
static inline int ds278x_read_reg16(struct ds278x_info *info, int reg_msb,
s16 *val)
{ … }
static int ds278x_get_temp(struct ds278x_info *info, int *temp)
{ … }
static int ds2782_get_current(struct ds278x_info *info, int *current_uA)
{ … }
static int ds2782_get_voltage(struct ds278x_info *info, int *voltage_uV)
{ … }
static int ds2782_get_capacity(struct ds278x_info *info, int *capacity)
{ … }
static int ds2786_get_current(struct ds278x_info *info, int *current_uA)
{ … }
static int ds2786_get_voltage(struct ds278x_info *info, int *voltage_uV)
{ … }
static int ds2786_get_capacity(struct ds278x_info *info, int *capacity)
{ … }
static int ds278x_get_status(struct ds278x_info *info, int *status)
{ … }
static int ds278x_battery_get_property(struct power_supply *psy,
enum power_supply_property prop,
union power_supply_propval *val)
{ … }
static void ds278x_bat_update(struct ds278x_info *info)
{ … }
static void ds278x_bat_work(struct work_struct *work)
{ … }
static enum power_supply_property ds278x_battery_props[] = …;
static void ds278x_power_supply_init(struct power_supply_desc *battery)
{ … }
static void ds278x_battery_remove(struct i2c_client *client)
{ … }
#ifdef CONFIG_PM_SLEEP
static int ds278x_suspend(struct device *dev)
{ … }
static int ds278x_resume(struct device *dev)
{ … }
#endif
static SIMPLE_DEV_PM_OPS(ds278x_battery_pm_ops, ds278x_suspend, ds278x_resume);
enum ds278x_num_id { … };
static const struct ds278x_battery_ops ds278x_ops[] = …;
static int ds278x_battery_probe(struct i2c_client *client)
{ … }
static const struct i2c_device_id ds278x_id[] = …;
MODULE_DEVICE_TABLE(i2c, ds278x_id);
static struct i2c_driver ds278x_battery_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;