#include <linux/acpi.h>
#include <linux/devm-helpers.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/pm.h>
#include <linux/mod_devicetable.h>
#include <linux/power_supply.h>
#include <linux/power/max17042_battery.h>
#include <linux/of.h>
#include <linux/regmap.h>
#define STATUS_POR_BIT …
#define STATUS_BST_BIT …
#define STATUS_VMN_BIT …
#define STATUS_TMN_BIT …
#define STATUS_SMN_BIT …
#define STATUS_BI_BIT …
#define STATUS_VMX_BIT …
#define STATUS_TMX_BIT …
#define STATUS_SMX_BIT …
#define STATUS_BR_BIT …
#define CFG_ALRT_BIT_ENBL …
#define VFSOC0_LOCK …
#define VFSOC0_UNLOCK …
#define MODEL_UNLOCK1 …
#define MODEL_UNLOCK2 …
#define MODEL_LOCK1 …
#define MODEL_LOCK2 …
#define dQ_ACC_DIV …
#define dP_ACC_100 …
#define dP_ACC_200 …
#define MAX17042_VMAX_TOLERANCE …
struct max17042_chip { … };
static enum power_supply_property max17042_battery_props[] = …;
static int max17042_get_temperature(struct max17042_chip *chip, int *temp)
{ … }
static int max17042_get_status(struct max17042_chip *chip, int *status)
{ … }
static int max17042_get_battery_health(struct max17042_chip *chip, int *health)
{ … }
static int max17042_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
static int max17042_set_property(struct power_supply *psy,
enum power_supply_property psp,
const union power_supply_propval *val)
{ … }
static int max17042_property_is_writeable(struct power_supply *psy,
enum power_supply_property psp)
{ … }
static int max17042_write_verify_reg(struct regmap *map, u8 reg, u32 value)
{ … }
static inline void max17042_override_por(struct regmap *map,
u8 reg, u16 value)
{ … }
static inline void max17042_unlock_model(struct max17042_chip *chip)
{ … }
static inline void max17042_lock_model(struct max17042_chip *chip)
{ … }
static inline void max17042_write_model_data(struct max17042_chip *chip,
u8 addr, int size)
{ … }
static inline void max17042_read_model_data(struct max17042_chip *chip,
u8 addr, u16 *data, int size)
{ … }
static inline int max17042_model_data_compare(struct max17042_chip *chip,
u16 *data1, u16 *data2, int size)
{ … }
static int max17042_init_model(struct max17042_chip *chip)
{ … }
static int max17042_verify_model_lock(struct max17042_chip *chip)
{ … }
static void max17042_write_config_regs(struct max17042_chip *chip)
{ … }
static void max17042_write_custom_regs(struct max17042_chip *chip)
{ … }
static void max17042_update_capacity_regs(struct max17042_chip *chip)
{ … }
static void max17042_reset_vfsoc0_reg(struct max17042_chip *chip)
{ … }
static void max17042_load_new_capacity_params(struct max17042_chip *chip)
{ … }
static inline void max17042_override_por_values(struct max17042_chip *chip)
{ … }
static int max17042_init_chip(struct max17042_chip *chip)
{ … }
static void max17042_set_soc_threshold(struct max17042_chip *chip, u16 off)
{ … }
static irqreturn_t max17042_thread_handler(int id, void *dev)
{ … }
static void max17042_init_worker(struct work_struct *work)
{ … }
#ifdef CONFIG_OF
static struct max17042_platform_data *
max17042_get_of_pdata(struct max17042_chip *chip)
{ … }
#endif
static struct max17042_reg_data max17047_default_pdata_init_regs[] = …;
static struct max17042_platform_data *
max17042_get_default_pdata(struct max17042_chip *chip)
{ … }
static struct max17042_platform_data *
max17042_get_pdata(struct max17042_chip *chip)
{ … }
static const struct regmap_config max17042_regmap_config = …;
static const struct power_supply_desc max17042_psy_desc = …;
static const struct power_supply_desc max17042_no_current_sense_psy_desc = …;
static int max17042_probe(struct i2c_client *client)
{ … }
#ifdef CONFIG_PM_SLEEP
static int max17042_suspend(struct device *dev)
{ … }
static int max17042_resume(struct device *dev)
{ … }
#endif
static SIMPLE_DEV_PM_OPS(max17042_pm_ops, max17042_suspend,
max17042_resume);
#ifdef CONFIG_ACPI
static const struct acpi_device_id max17042_acpi_match[] = …;
MODULE_DEVICE_TABLE(acpi, max17042_acpi_match);
#endif
#ifdef CONFIG_OF
static const struct of_device_id max17042_dt_match[] = …;
MODULE_DEVICE_TABLE(of, max17042_dt_match);
#endif
static const struct i2c_device_id max17042_id[] = …;
MODULE_DEVICE_TABLE(i2c, max17042_id);
static struct i2c_driver max17042_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;