#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/power_supply.h>
#include <linux/regmap.h>
#define IP5XXX_SYS_CTL0 …
#define IP5XXX_SYS_CTL0_WLED_DET_EN …
#define IP5XXX_SYS_CTL0_WLED_EN …
#define IP5XXX_SYS_CTL0_BOOST_EN …
#define IP5XXX_SYS_CTL0_CHARGER_EN …
#define IP5XXX_SYS_CTL1 …
#define IP5XXX_SYS_CTL1_LIGHT_SHDN_EN …
#define IP5XXX_SYS_CTL1_LOAD_PWRUP_EN …
#define IP5XXX_SYS_CTL2 …
#define IP5XXX_SYS_CTL2_LIGHT_SHDN_TH …
#define IP5XXX_SYS_CTL3 …
#define IP5XXX_SYS_CTL3_LONG_PRESS_TIME_SEL …
#define IP5XXX_SYS_CTL3_BTN_SHDN_EN …
#define IP5XXX_SYS_CTL4 …
#define IP5XXX_SYS_CTL4_SHDN_TIME_SEL …
#define IP5XXX_SYS_CTL4_VIN_PULLOUT_BOOST_EN …
#define IP5XXX_SYS_CTL5 …
#define IP5XXX_SYS_CTL5_NTC_DIS …
#define IP5XXX_SYS_CTL5_WLED_MODE_SEL …
#define IP5XXX_SYS_CTL5_BTN_SHDN_SEL …
#define IP5XXX_CHG_CTL1 …
#define IP5XXX_CHG_CTL1_BOOST_UVP_SEL …
#define IP5XXX_CHG_CTL2 …
#define IP5XXX_CHG_CTL2_BAT_TYPE_SEL …
#define IP5XXX_CHG_CTL2_BAT_TYPE_SEL_4_2V …
#define IP5XXX_CHG_CTL2_BAT_TYPE_SEL_4_3V …
#define IP5XXX_CHG_CTL2_BAT_TYPE_SEL_4_35V …
#define IP5XXX_CHG_CTL2_CONST_VOLT_SEL …
#define IP5XXX_CHG_CTL4 …
#define IP5XXX_CHG_CTL4_BAT_TYPE_SEL_EN …
#define IP5XXX_CHG_CTL4A …
#define IP5XXX_CHG_CTL4A_CONST_CUR_SEL …
#define IP5XXX_MFP_CTL0 …
#define IP5XXX_MFP_CTL1 …
#define IP5XXX_GPIO_CTL2 …
#define IP5XXX_GPIO_CTL2A …
#define IP5XXX_GPIO_CTL3 …
#define IP5XXX_READ0 …
#define IP5XXX_READ0_CHG_STAT …
#define IP5XXX_READ0_CHG_STAT_IDLE …
#define IP5XXX_READ0_CHG_STAT_TRICKLE …
#define IP5XXX_READ0_CHG_STAT_CONST_VOLT …
#define IP5XXX_READ0_CHG_STAT_CONST_CUR …
#define IP5XXX_READ0_CHG_STAT_CONST_VOLT_STOP …
#define IP5XXX_READ0_CHG_STAT_FULL …
#define IP5XXX_READ0_CHG_STAT_TIMEOUT …
#define IP5XXX_READ0_CHG_OP …
#define IP5XXX_READ0_CHG_END …
#define IP5XXX_READ0_CONST_VOLT_TIMEOUT …
#define IP5XXX_READ0_CHG_TIMEOUT …
#define IP5XXX_READ0_TRICKLE_TIMEOUT …
#define IP5XXX_READ0_TIMEOUT …
#define IP5XXX_READ1 …
#define IP5XXX_READ1_WLED_PRESENT …
#define IP5XXX_READ1_LIGHT_LOAD …
#define IP5XXX_READ1_VIN_OVERVOLT …
#define IP5XXX_READ2 …
#define IP5XXX_READ2_BTN_PRESS …
#define IP5XXX_READ2_BTN_LONG_PRESS …
#define IP5XXX_READ2_BTN_SHORT_PRESS …
#define IP5XXX_BATVADC_DAT0 …
#define IP5XXX_BATVADC_DAT1 …
#define IP5XXX_BATIADC_DAT0 …
#define IP5XXX_BATIADC_DAT1 …
#define IP5XXX_BATOCV_DAT0 …
#define IP5XXX_BATOCV_DAT1 …
struct ip5xxx { … };
static int ip5xxx_read(struct ip5xxx *ip5xxx, unsigned int reg,
unsigned int *val)
{ … }
static int ip5xxx_update_bits(struct ip5xxx *ip5xxx, unsigned int reg,
unsigned int mask, unsigned int val)
{ … }
static int ip5xxx_initialize(struct power_supply *psy)
{ … }
static const enum power_supply_property ip5xxx_battery_properties[] = …;
static int ip5xxx_battery_get_status(struct ip5xxx *ip5xxx, int *val)
{ … }
static int ip5xxx_battery_get_charge_type(struct ip5xxx *ip5xxx, int *val)
{ … }
static int ip5xxx_battery_get_health(struct ip5xxx *ip5xxx, int *val)
{ … }
static int ip5xxx_battery_get_voltage_max(struct ip5xxx *ip5xxx, int *val)
{ … }
static int ip5xxx_battery_read_adc(struct ip5xxx *ip5xxx,
u8 lo_reg, u8 hi_reg, int *val)
{ … }
static int ip5xxx_battery_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
static int ip5xxx_battery_set_voltage_max(struct ip5xxx *ip5xxx, int val)
{ … }
static int ip5xxx_battery_set_property(struct power_supply *psy,
enum power_supply_property psp,
const union power_supply_propval *val)
{ … }
static int ip5xxx_battery_property_is_writeable(struct power_supply *psy,
enum power_supply_property psp)
{ … }
static const struct power_supply_desc ip5xxx_battery_desc = …;
static const enum power_supply_property ip5xxx_boost_properties[] = …;
static int ip5xxx_boost_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
static int ip5xxx_boost_set_property(struct power_supply *psy,
enum power_supply_property psp,
const union power_supply_propval *val)
{ … }
static int ip5xxx_boost_property_is_writeable(struct power_supply *psy,
enum power_supply_property psp)
{ … }
static const struct power_supply_desc ip5xxx_boost_desc = …;
static const struct regmap_config ip5xxx_regmap_config = …;
static int ip5xxx_power_probe(struct i2c_client *client)
{ … }
static const struct of_device_id ip5xxx_power_of_match[] = …;
MODULE_DEVICE_TABLE(of, ip5xxx_power_of_match);
static struct i2c_driver ip5xxx_power_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;