#include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/mod_devicetable.h>
#include <linux/power_supply.h>
#include <linux/platform_device.h>
#include <linux/of.h>
#include <linux/regmap.h>
#define ADP5061_ID …
#define ADP5061_REV …
#define ADP5061_VINX_SET …
#define ADP5061_TERM_SET …
#define ADP5061_CHG_CURR …
#define ADP5061_VOLTAGE_TH …
#define ADP5061_TIMER_SET …
#define ADP5061_FUNC_SET_1 …
#define ADP5061_FUNC_SET_2 …
#define ADP5061_INT_EN …
#define ADP5061_INT_ACT …
#define ADP5061_CHG_STATUS_1 …
#define ADP5061_CHG_STATUS_2 …
#define ADP5061_FAULT …
#define ADP5061_BATTERY_SHORT …
#define ADP5061_IEND …
#define ADP5061_VINX_SET_ILIM_MSK …
#define ADP5061_VINX_SET_ILIM_MODE(x) …
#define ADP5061_TERM_SET_VTRM_MSK …
#define ADP5061_TERM_SET_VTRM_MODE(x) …
#define ADP5061_TERM_SET_CHG_VLIM_MSK …
#define ADP5061_TERM_SET_CHG_VLIM_MODE(x) …
#define ADP5061_CHG_CURR_ICHG_MSK …
#define ADP5061_CHG_CURR_ICHG_MODE(x) …
#define ADP5061_CHG_CURR_ITRK_DEAD_MSK …
#define ADP5061_CHG_CURR_ITRK_DEAD_MODE(x) …
#define ADP5061_VOLTAGE_TH_DIS_RCH_MSK …
#define ADP5061_VOLTAGE_TH_DIS_RCH_MODE(x) …
#define ADP5061_VOLTAGE_TH_VRCH_MSK …
#define ADP5061_VOLTAGE_TH_VRCH_MODE(x) …
#define ADP5061_VOLTAGE_TH_VTRK_DEAD_MSK …
#define ADP5061_VOLTAGE_TH_VTRK_DEAD_MODE(x) …
#define ADP5061_VOLTAGE_TH_VWEAK_MSK …
#define ADP5061_VOLTAGE_TH_VWEAK_MODE(x) …
#define ADP5061_CHG_STATUS_1_VIN_OV(x) …
#define ADP5061_CHG_STATUS_1_VIN_OK(x) …
#define ADP5061_CHG_STATUS_1_VIN_ILIM(x) …
#define ADP5061_CHG_STATUS_1_THERM_LIM(x) …
#define ADP5061_CHG_STATUS_1_CHDONE(x) …
#define ADP5061_CHG_STATUS_1_CHG_STATUS(x) …
#define ADP5061_CHG_STATUS_2_THR_STATUS(x) …
#define ADP5061_CHG_STATUS_2_RCH_LIM_INFO(x) …
#define ADP5061_CHG_STATUS_2_BAT_STATUS(x) …
#define ADP5061_IEND_IEND_MSK …
#define ADP5061_IEND_IEND_MODE(x) …
#define ADP5061_NO_BATTERY …
#define ADP5061_ICHG_MAX …
enum adp5061_chg_status { … };
static const int adp5061_chg_type[4] = …;
static const int adp5061_vweak_th[8] = …;
static const int adp5061_prechg_current[4] = …;
static const int adp5061_vmin[4] = …;
static const int adp5061_const_chg_vmax[4] = …;
static const int adp5061_const_ichg[24] = …;
static const int adp5061_vmax[36] = …;
static const int adp5061_in_current_lim[16] = …;
static const int adp5061_iend[8] = …;
struct adp5061_state { … };
static int adp5061_get_array_index(const int *array, u8 size, int val)
{ … }
static int adp5061_get_status(struct adp5061_state *st,
u8 *status1, u8 *status2)
{ … }
static int adp5061_get_input_current_limit(struct adp5061_state *st,
union power_supply_propval *val)
{ … }
static int adp5061_set_input_current_limit(struct adp5061_state *st, int val)
{ … }
static int adp5061_set_min_voltage(struct adp5061_state *st, int val)
{ … }
static int adp5061_get_min_voltage(struct adp5061_state *st,
union power_supply_propval *val)
{ … }
static int adp5061_get_chg_volt_lim(struct adp5061_state *st,
union power_supply_propval *val)
{ … }
static int adp5061_get_max_voltage(struct adp5061_state *st,
union power_supply_propval *val)
{ … }
static int adp5061_set_max_voltage(struct adp5061_state *st, int val)
{ … }
static int adp5061_set_const_chg_vmax(struct adp5061_state *st, int val)
{ … }
static int adp5061_set_const_chg_current(struct adp5061_state *st, int val)
{ … }
static int adp5061_get_const_chg_current(struct adp5061_state *st,
union power_supply_propval *val)
{ … }
static int adp5061_get_prechg_current(struct adp5061_state *st,
union power_supply_propval *val)
{ … }
static int adp5061_set_prechg_current(struct adp5061_state *st, int val)
{ … }
static int adp5061_get_vweak_th(struct adp5061_state *st,
union power_supply_propval *val)
{ … }
static int adp5061_set_vweak_th(struct adp5061_state *st, int val)
{ … }
static int adp5061_get_chg_type(struct adp5061_state *st,
union power_supply_propval *val)
{ … }
static int adp5061_get_charger_status(struct adp5061_state *st,
union power_supply_propval *val)
{ … }
static int adp5061_get_battery_status(struct adp5061_state *st,
union power_supply_propval *val)
{ … }
static int adp5061_get_termination_current(struct adp5061_state *st,
union power_supply_propval *val)
{ … }
static int adp5061_set_termination_current(struct adp5061_state *st, int val)
{ … }
static int adp5061_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
static int adp5061_set_property(struct power_supply *psy,
enum power_supply_property psp,
const union power_supply_propval *val)
{ … }
static int adp5061_prop_writeable(struct power_supply *psy,
enum power_supply_property psp)
{ … }
static enum power_supply_property adp5061_props[] = …;
static const struct regmap_config adp5061_regmap_config = …;
static const struct power_supply_desc adp5061_desc = …;
static int adp5061_probe(struct i2c_client *client)
{ … }
static const struct i2c_device_id adp5061_id[] = …;
MODULE_DEVICE_TABLE(i2c, adp5061_id);
static struct i2c_driver adp5061_driver = …;
module_i2c_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;