#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/time.h>
#include <linux/iio/iio.h>
#include <linux/iio/consumer.h>
#include <linux/mfd/axp20x.h>
#define AXP20X_PWR_STATUS_BAT_CHARGING …
#define AXP20X_PWR_OP_BATT_PRESENT …
#define AXP20X_PWR_OP_BATT_ACTIVATED …
#define AXP209_FG_PERCENT …
#define AXP22X_FG_VALID …
#define AXP20X_CHRG_CTRL1_ENABLE …
#define AXP20X_CHRG_CTRL1_TGT_VOLT …
#define AXP20X_CHRG_CTRL1_TGT_4_1V …
#define AXP20X_CHRG_CTRL1_TGT_4_15V …
#define AXP20X_CHRG_CTRL1_TGT_4_2V …
#define AXP20X_CHRG_CTRL1_TGT_4_36V …
#define AXP22X_CHRG_CTRL1_TGT_4_22V …
#define AXP22X_CHRG_CTRL1_TGT_4_24V …
#define AXP813_CHRG_CTRL1_TGT_4_35V …
#define AXP20X_CHRG_CTRL1_TGT_CURR …
#define AXP20X_V_OFF_MASK …
struct axp20x_batt_ps;
struct axp_data { … };
struct axp20x_batt_ps { … };
static int axp20x_battery_get_max_voltage(struct axp20x_batt_ps *axp20x_batt,
int *val)
{ … }
static int axp22x_battery_get_max_voltage(struct axp20x_batt_ps *axp20x_batt,
int *val)
{ … }
static int axp813_battery_get_max_voltage(struct axp20x_batt_ps *axp20x_batt,
int *val)
{ … }
static int axp20x_get_constant_charge_current(struct axp20x_batt_ps *axp,
int *val)
{ … }
static int axp20x_battery_get_prop(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
static int axp22x_battery_set_max_voltage(struct axp20x_batt_ps *axp20x_batt,
int val)
{ … }
static int axp20x_battery_set_max_voltage(struct axp20x_batt_ps *axp20x_batt,
int val)
{ … }
static int axp20x_set_constant_charge_current(struct axp20x_batt_ps *axp_batt,
int charge_current)
{ … }
static int axp20x_set_max_constant_charge_current(struct axp20x_batt_ps *axp,
int charge_current)
{ … }
static int axp20x_set_voltage_min_design(struct axp20x_batt_ps *axp_batt,
int min_voltage)
{ … }
static int axp20x_battery_set_prop(struct power_supply *psy,
enum power_supply_property psp,
const union power_supply_propval *val)
{ … }
static enum power_supply_property axp20x_battery_props[] = …;
static int axp20x_battery_prop_writeable(struct power_supply *psy,
enum power_supply_property psp)
{ … }
static const struct power_supply_desc axp20x_batt_ps_desc = …;
static const struct axp_data axp209_data = …;
static const struct axp_data axp221_data = …;
static const struct axp_data axp813_data = …;
static const struct of_device_id axp20x_battery_ps_id[] = …;
MODULE_DEVICE_TABLE(of, axp20x_battery_ps_id);
static int axp20x_power_probe(struct platform_device *pdev)
{ … }
static struct platform_driver axp20x_batt_driver = …;
module_platform_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;