#include <linux/devm-helpers.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/swab.h>
#include <linux/i2c.h>
#include <linux/delay.h>
#include <linux/power_supply.h>
#include <linux/slab.h>
#define I16_MSB(x) …
#define I16_LSB(x) …
#define LTC294X_WORK_DELAY …
#define LTC294X_MAX_VALUE …
#define LTC294X_MID_SUPPLY …
#define LTC2941_MAX_PRESCALER_EXP …
#define LTC2943_MAX_PRESCALER_EXP …
enum ltc294x_reg { … };
enum ltc294x_id { … };
#define LTC2941_REG_STATUS_CHIP_ID …
#define LTC2942_REG_CONTROL_MODE_SCAN …
#define LTC2943_REG_CONTROL_MODE_SCAN …
#define LTC294X_REG_CONTROL_PRESCALER_MASK …
#define LTC294X_REG_CONTROL_SHUTDOWN_MASK …
#define LTC294X_REG_CONTROL_PRESCALER_SET(x) …
#define LTC294X_REG_CONTROL_ALCC_CONFIG_DISABLED …
#define LTC294X_REG_CONTROL_ADC_DISABLE(x) …
struct ltc294x_info { … };
static inline int convert_bin_to_uAh(
const struct ltc294x_info *info, int Q)
{ … }
static inline int convert_uAh_to_bin(
const struct ltc294x_info *info, int uAh)
{ … }
static int ltc294x_read_regs(struct i2c_client *client,
enum ltc294x_reg reg, u8 *buf, int num_regs)
{ … }
static int ltc294x_write_regs(struct i2c_client *client,
enum ltc294x_reg reg, const u8 *buf, int num_regs)
{ … }
static int ltc294x_reset(const struct ltc294x_info *info, int prescaler_exp)
{ … }
static int ltc294x_read_charge_register(const struct ltc294x_info *info,
enum ltc294x_reg reg)
{ … }
static int ltc294x_get_charge(const struct ltc294x_info *info,
enum ltc294x_reg reg, int *val)
{ … }
static int ltc294x_set_charge_now(const struct ltc294x_info *info, int val)
{ … }
static int ltc294x_set_charge_thr(const struct ltc294x_info *info,
enum ltc294x_reg reg, int val)
{ … }
static int ltc294x_get_charge_counter(
const struct ltc294x_info *info, int *val)
{ … }
static int ltc294x_get_voltage(const struct ltc294x_info *info, int *val)
{ … }
static int ltc294x_get_current(const struct ltc294x_info *info, int *val)
{ … }
static int ltc294x_get_temperature(const struct ltc294x_info *info, int *val)
{ … }
static int ltc294x_get_property(struct power_supply *psy,
enum power_supply_property prop,
union power_supply_propval *val)
{ … }
static int ltc294x_set_property(struct power_supply *psy,
enum power_supply_property psp,
const union power_supply_propval *val)
{ … }
static int ltc294x_property_is_writeable(
struct power_supply *psy, enum power_supply_property psp)
{ … }
static void ltc294x_update(struct ltc294x_info *info)
{ … }
static void ltc294x_work(struct work_struct *work)
{ … }
static enum power_supply_property ltc294x_properties[] = …;
static int ltc294x_i2c_probe(struct i2c_client *client)
{ … }
static void ltc294x_i2c_shutdown(struct i2c_client *client)
{ … }
#ifdef CONFIG_PM_SLEEP
static int ltc294x_suspend(struct device *dev)
{ … }
static int ltc294x_resume(struct device *dev)
{ … }
static SIMPLE_DEV_PM_OPS(ltc294x_pm_ops, ltc294x_suspend, ltc294x_resume);
#define LTC294X_PM_OPS …
#else
#define LTC294X_PM_OPS …
#endif
static const struct i2c_device_id ltc294x_i2c_id[] = …;
MODULE_DEVICE_TABLE(i2c, ltc294x_i2c_id);
static const struct of_device_id ltc294x_i2c_of_match[] = …;
MODULE_DEVICE_TABLE(of, ltc294x_i2c_of_match);
static struct i2c_driver ltc294x_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;