#include <linux/bits.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/gfp.h>
#include <linux/gpio/consumer.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/power_supply.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/time.h>
#include <linux/workqueue.h>
#include <linux/devm-helpers.h>
#define CW2015_SIZE_BATINFO …
#define CW2015_RESET_TRIES …
#define CW2015_REG_VERSION …
#define CW2015_REG_VCELL …
#define CW2015_REG_SOC …
#define CW2015_REG_RRT_ALERT …
#define CW2015_REG_CONFIG …
#define CW2015_REG_MODE …
#define CW2015_REG_BATINFO …
#define CW2015_MODE_SLEEP_MASK …
#define CW2015_MODE_SLEEP …
#define CW2015_MODE_NORMAL …
#define CW2015_MODE_QUICK_START …
#define CW2015_MODE_RESTART …
#define CW2015_CONFIG_UPDATE_FLG …
#define CW2015_ATHD(x) …
#define CW2015_MASK_ATHD …
#define CW2015_MASK_SOC …
#define CW2015_BAT_SOC_ERROR_MS …
#define CW2015_BAT_CHARGING_STUCK_MS …
#define CW2015_DEFAULT_POLL_INTERVAL_MS …
#define CW2015_AVERAGING_SAMPLES …
struct cw_battery { … };
static int cw_read_word(struct cw_battery *cw_bat, u8 reg, u16 *val)
{ … }
static int cw_update_profile(struct cw_battery *cw_bat)
{ … }
static int cw_init(struct cw_battery *cw_bat)
{ … }
static int cw_power_on_reset(struct cw_battery *cw_bat)
{ … }
#define HYSTERESIS(current, previous, up, down) …
static int cw_get_soc(struct cw_battery *cw_bat)
{ … }
static int cw_get_voltage(struct cw_battery *cw_bat)
{ … }
static int cw_get_time_to_empty(struct cw_battery *cw_bat)
{ … }
static void cw_update_charge_status(struct cw_battery *cw_bat)
{ … }
static void cw_update_soc(struct cw_battery *cw_bat)
{ … }
static void cw_update_voltage(struct cw_battery *cw_bat)
{ … }
static void cw_update_status(struct cw_battery *cw_bat)
{ … }
static void cw_update_time_to_empty(struct cw_battery *cw_bat)
{ … }
static void cw_bat_work(struct work_struct *work)
{ … }
static bool cw_battery_valid_time_to_empty(struct cw_battery *cw_bat)
{ … }
static int cw_battery_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
static enum power_supply_property cw_battery_properties[] = …;
static const struct power_supply_desc cw2015_bat_desc = …;
static int cw2015_parse_properties(struct cw_battery *cw_bat)
{ … }
static const struct regmap_range regmap_ranges_rd_yes[] = …;
static const struct regmap_access_table regmap_rd_table = …;
static const struct regmap_range regmap_ranges_wr_yes[] = …;
static const struct regmap_access_table regmap_wr_table = …;
static const struct regmap_range regmap_ranges_vol_yes[] = …;
static const struct regmap_access_table regmap_vol_table = …;
static const struct regmap_config cw2015_regmap_config = …;
static int cw_bat_probe(struct i2c_client *client)
{ … }
static int __maybe_unused cw_bat_suspend(struct device *dev)
{ … }
static int __maybe_unused cw_bat_resume(struct device *dev)
{ … }
static SIMPLE_DEV_PM_OPS(cw_bat_pm_ops, cw_bat_suspend, cw_bat_resume);
static const struct i2c_device_id cw_bat_id_table[] = …;
static const struct of_device_id cw2015_of_match[] = …;
MODULE_DEVICE_TABLE(of, cw2015_of_match);
static struct i2c_driver cw_bat_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;