#include <linux/module.h>
#include <linux/param.h>
#include <linux/jiffies.h>
#include <linux/workqueue.h>
#include <linux/pm.h>
#include <linux/slab.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#include <linux/suspend.h>
#include <linux/w1.h>
#include <linux/of.h>
static unsigned int cache_time = …;
module_param(cache_time, uint, 0644);
MODULE_PARM_DESC(…) …;
static bool pmod_enabled;
module_param(pmod_enabled, bool, 0644);
MODULE_PARM_DESC(…) …;
static unsigned int rated_capacity;
module_param(rated_capacity, uint, 0644);
MODULE_PARM_DESC(…) …;
static unsigned int current_accum;
module_param(current_accum, uint, 0644);
MODULE_PARM_DESC(…) …;
#define W1_FAMILY_DS2760 …
#define W1_DS2760_SWAP …
#define W1_DS2760_READ_DATA …
#define W1_DS2760_WRITE_DATA …
#define W1_DS2760_COPY_DATA …
#define W1_DS2760_RECALL_DATA …
#define W1_DS2760_LOCK …
#define DS2760_DATA_SIZE …
#define DS2760_PROTECTION_REG …
#define DS2760_STATUS_REG …
#define DS2760_STATUS_IE …
#define DS2760_STATUS_SWEN …
#define DS2760_STATUS_RNAOP …
#define DS2760_STATUS_PMOD …
#define DS2760_EEPROM_REG …
#define DS2760_SPECIAL_FEATURE_REG …
#define DS2760_VOLTAGE_MSB …
#define DS2760_VOLTAGE_LSB …
#define DS2760_CURRENT_MSB …
#define DS2760_CURRENT_LSB …
#define DS2760_CURRENT_ACCUM_MSB …
#define DS2760_CURRENT_ACCUM_LSB …
#define DS2760_TEMP_MSB …
#define DS2760_TEMP_LSB …
#define DS2760_EEPROM_BLOCK0 …
#define DS2760_ACTIVE_FULL …
#define DS2760_EEPROM_BLOCK1 …
#define DS2760_STATUS_WRITE_REG …
#define DS2760_RATED_CAPACITY …
#define DS2760_CURRENT_OFFSET_BIAS …
#define DS2760_ACTIVE_EMPTY …
struct ds2760_device_info { … };
static int w1_ds2760_io(struct device *dev, char *buf, int addr, size_t count,
int io)
{ … }
static int w1_ds2760_read(struct device *dev,
char *buf, int addr,
size_t count)
{ … }
static int w1_ds2760_write(struct device *dev,
char *buf,
int addr, size_t count)
{ … }
static int w1_ds2760_eeprom_cmd(struct device *dev, int addr, int cmd)
{ … }
static int w1_ds2760_store_eeprom(struct device *dev, int addr)
{ … }
static int w1_ds2760_recall_eeprom(struct device *dev, int addr)
{ … }
static ssize_t w1_slave_read(struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr, char *buf,
loff_t off, size_t count)
{ … }
static BIN_ATTR_RO(w1_slave, DS2760_DATA_SIZE);
static struct bin_attribute *w1_ds2760_bin_attrs[] = …;
static const struct attribute_group w1_ds2760_group = …;
static const struct attribute_group *w1_ds2760_groups[] = …;
static int rated_capacities[] = …;
static int battery_interpolate(int array[], int temp)
{ … }
static int ds2760_battery_read_status(struct ds2760_device_info *di)
{ … }
static void ds2760_battery_set_current_accum(struct ds2760_device_info *di,
unsigned int acr_val)
{ … }
static void ds2760_battery_update_status(struct ds2760_device_info *di)
{ … }
static void ds2760_battery_write_status(struct ds2760_device_info *di,
char status)
{ … }
static void ds2760_battery_write_rated_capacity(struct ds2760_device_info *di,
unsigned char rated_capacity)
{ … }
static void ds2760_battery_write_active_full(struct ds2760_device_info *di,
int active_full)
{ … }
static void ds2760_battery_work(struct work_struct *work)
{ … }
static void ds2760_battery_external_power_changed(struct power_supply *psy)
{ … }
static void ds2760_battery_set_charged_work(struct work_struct *work)
{ … }
static void ds2760_battery_set_charged(struct power_supply *psy)
{ … }
static int ds2760_battery_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
static int ds2760_battery_set_property(struct power_supply *psy,
enum power_supply_property psp,
const union power_supply_propval *val)
{ … }
static int ds2760_battery_property_is_writeable(struct power_supply *psy,
enum power_supply_property psp)
{ … }
static enum power_supply_property ds2760_battery_props[] = …;
static int ds2760_pm_notifier(struct notifier_block *notifier,
unsigned long pm_event,
void *unused)
{ … }
static int w1_ds2760_add_slave(struct w1_slave *sl)
{ … }
static void w1_ds2760_remove_slave(struct w1_slave *sl)
{ … }
#ifdef CONFIG_OF
static const struct of_device_id w1_ds2760_of_ids[] = …;
#endif
static const struct w1_family_ops w1_ds2760_fops = …;
static struct w1_family w1_ds2760_family = …;
module_w1_family(…);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_ALIAS(…) …;