#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/gpio/consumer.h>
#include <linux/power_supply.h>
#include <linux/regmap.h>
#include <linux/types.h>
#include <linux/usb/phy.h>
#include <linux/device.h>
#include <linux/moduleparam.h>
#include <linux/slab.h>
#include <linux/acpi.h>
#define BQ256XX_MANUFACTURER …
#define BQ256XX_INPUT_CURRENT_LIMIT …
#define BQ256XX_CHARGER_CONTROL_0 …
#define BQ256XX_CHARGE_CURRENT_LIMIT …
#define BQ256XX_PRECHG_AND_TERM_CURR_LIM …
#define BQ256XX_BATTERY_VOLTAGE_LIMIT …
#define BQ256XX_CHARGER_CONTROL_1 …
#define BQ256XX_CHARGER_CONTROL_2 …
#define BQ256XX_CHARGER_CONTROL_3 …
#define BQ256XX_CHARGER_STATUS_0 …
#define BQ256XX_CHARGER_STATUS_1 …
#define BQ256XX_CHARGER_STATUS_2 …
#define BQ256XX_PART_INFORMATION …
#define BQ256XX_CHARGER_CONTROL_4 …
#define BQ256XX_IINDPM_MASK …
#define BQ256XX_IINDPM_STEP_uA …
#define BQ256XX_IINDPM_OFFSET_uA …
#define BQ256XX_IINDPM_MIN_uA …
#define BQ256XX_IINDPM_MAX_uA …
#define BQ256XX_IINDPM_DEF_uA …
#define BQ256XX_TS_IGNORE …
#define BQ256XX_TS_IGNORE_SHIFT …
#define BQ256XX_VINDPM_MASK …
#define BQ256XX_VINDPM_STEP_uV …
#define BQ256XX_VINDPM_OFFSET_uV …
#define BQ256XX_VINDPM_MIN_uV …
#define BQ256XX_VINDPM_MAX_uV …
#define BQ256XX_VINDPM_DEF_uV …
#define BQ256XX_VBATREG_MASK …
#define BQ2560X_VBATREG_STEP_uV …
#define BQ2560X_VBATREG_OFFSET_uV …
#define BQ2560X_VBATREG_MIN_uV …
#define BQ2560X_VBATREG_MAX_uV …
#define BQ2560X_VBATREG_DEF_uV …
#define BQ25601D_VBATREG_OFFSET_uV …
#define BQ25601D_VBATREG_MIN_uV …
#define BQ25601D_VBATREG_MAX_uV …
#define BQ25601D_VBATREG_DEF_uV …
#define BQ2561X_VBATREG_STEP_uV …
#define BQ25611D_VBATREG_MIN_uV …
#define BQ25611D_VBATREG_MAX_uV …
#define BQ25611D_VBATREG_DEF_uV …
#define BQ25618_VBATREG_MIN_uV …
#define BQ25618_VBATREG_MAX_uV …
#define BQ25618_VBATREG_DEF_uV …
#define BQ256XX_VBATREG_BIT_SHIFT …
#define BQ2561X_VBATREG_THRESH …
#define BQ25611D_VBATREG_THRESH_uV …
#define BQ25618_VBATREG_THRESH_uV …
#define BQ256XX_CHG_CONFIG_MASK …
#define BQ256XX_CHG_CONFIG_BIT_SHIFT …
#define BQ256XX_ITERM_MASK …
#define BQ256XX_ITERM_STEP_uA …
#define BQ256XX_ITERM_OFFSET_uA …
#define BQ256XX_ITERM_MIN_uA …
#define BQ256XX_ITERM_MAX_uA …
#define BQ256XX_ITERM_DEF_uA …
#define BQ25618_ITERM_STEP_uA …
#define BQ25618_ITERM_OFFSET_uA …
#define BQ25618_ITERM_MIN_uA …
#define BQ25618_ITERM_MAX_uA …
#define BQ25618_ITERM_DEF_uA …
#define BQ256XX_IPRECHG_MASK …
#define BQ256XX_IPRECHG_STEP_uA …
#define BQ256XX_IPRECHG_OFFSET_uA …
#define BQ256XX_IPRECHG_MIN_uA …
#define BQ256XX_IPRECHG_MAX_uA …
#define BQ256XX_IPRECHG_DEF_uA …
#define BQ25618_IPRECHG_STEP_uA …
#define BQ25618_IPRECHG_OFFSET_uA …
#define BQ25618_IPRECHG_MIN_uA …
#define BQ25618_IPRECHG_MAX_uA …
#define BQ25618_IPRECHG_DEF_uA …
#define BQ256XX_IPRECHG_BIT_SHIFT …
#define BQ256XX_ICHG_MASK …
#define BQ256XX_ICHG_STEP_uA …
#define BQ256XX_ICHG_MIN_uA …
#define BQ256XX_ICHG_MAX_uA …
#define BQ2560X_ICHG_DEF_uA …
#define BQ25611D_ICHG_DEF_uA …
#define BQ25618_ICHG_STEP_uA …
#define BQ25618_ICHG_MIN_uA …
#define BQ25618_ICHG_MAX_uA …
#define BQ25618_ICHG_DEF_uA …
#define BQ25618_ICHG_THRESH …
#define BQ25618_ICHG_THRESH_uA …
#define BQ256XX_VBUS_STAT_MASK …
#define BQ256XX_VBUS_STAT_NO_INPUT …
#define BQ256XX_VBUS_STAT_USB_SDP …
#define BQ256XX_VBUS_STAT_USB_CDP …
#define BQ256XX_VBUS_STAT_USB_DCP …
#define BQ256XX_VBUS_STAT_USB_OTG …
#define BQ256XX_CHRG_STAT_MASK …
#define BQ256XX_CHRG_STAT_NOT_CHRGING …
#define BQ256XX_CHRG_STAT_PRECHRGING …
#define BQ256XX_CHRG_STAT_FAST_CHRGING …
#define BQ256XX_CHRG_STAT_CHRG_TERM …
#define BQ256XX_PG_STAT_MASK …
#define BQ256XX_WDT_FAULT_MASK …
#define BQ256XX_CHRG_FAULT_MASK …
#define BQ256XX_CHRG_FAULT_NORMAL …
#define BQ256XX_CHRG_FAULT_INPUT …
#define BQ256XX_CHRG_FAULT_THERM …
#define BQ256XX_CHRG_FAULT_CST_EXPIRE …
#define BQ256XX_BAT_FAULT_MASK …
#define BQ256XX_NTC_FAULT_MASK …
#define BQ256XX_NTC_FAULT_WARM …
#define BQ256XX_NTC_FAULT_COOL …
#define BQ256XX_NTC_FAULT_COLD …
#define BQ256XX_NTC_FAULT_HOT …
#define BQ256XX_NUM_WD_VAL …
#define BQ256XX_WATCHDOG_MASK …
#define BQ256XX_WATCHDOG_MAX …
#define BQ256XX_WATCHDOG_DIS …
#define BQ256XX_WDT_BIT_SHIFT …
#define BQ256XX_REG_RST …
struct bq256xx_init_data { … };
struct bq256xx_state { … };
enum bq256xx_id { … };
struct bq256xx_device { … };
struct bq256xx_chip_info { … };
static int bq256xx_watchdog_time[BQ256XX_NUM_WD_VAL] = …;
static const int bq25611d_vbatreg_values[] = …;
static const int bq25618_619_vbatreg_values[] = …;
static const int bq25618_619_ichg_values[] = …;
static enum power_supply_usb_type bq256xx_usb_type[] = …;
static int bq256xx_array_parse(int array_size, int val, const int array[])
{ … }
static int bq256xx_usb_notifier(struct notifier_block *nb, unsigned long val,
void *priv)
{ … }
static void bq256xx_usb_work(struct work_struct *data)
{ … }
static struct reg_default bq2560x_reg_defs[] = …;
static struct reg_default bq25611d_reg_defs[] = …;
static struct reg_default bq25618_619_reg_defs[] = …;
static int bq256xx_get_state(struct bq256xx_device *bq,
struct bq256xx_state *state)
{ … }
static int bq256xx_set_charge_type(struct bq256xx_device *bq, int type)
{ … }
static int bq256xx_get_ichg_curr(struct bq256xx_device *bq)
{ … }
static int bq25618_619_get_ichg_curr(struct bq256xx_device *bq)
{ … }
static int bq256xx_set_ichg_curr(struct bq256xx_device *bq, int ichg)
{ … }
static int bq25618_619_set_ichg_curr(struct bq256xx_device *bq, int ichg)
{ … }
static int bq25618_619_get_chrg_volt(struct bq256xx_device *bq)
{ … }
static int bq25611d_get_chrg_volt(struct bq256xx_device *bq)
{ … }
static int bq2560x_get_chrg_volt(struct bq256xx_device *bq)
{ … }
static int bq25601d_get_chrg_volt(struct bq256xx_device *bq)
{ … }
static int bq25618_619_set_chrg_volt(struct bq256xx_device *bq, int vbatreg)
{ … }
static int bq25611d_set_chrg_volt(struct bq256xx_device *bq, int vbatreg)
{ … }
static int bq2560x_set_chrg_volt(struct bq256xx_device *bq, int vbatreg)
{ … }
static int bq25601d_set_chrg_volt(struct bq256xx_device *bq, int vbatreg)
{ … }
static int bq256xx_set_ts_ignore(struct bq256xx_device *bq, bool ts_ignore)
{ … }
static int bq256xx_get_prechrg_curr(struct bq256xx_device *bq)
{ … }
static int bq256xx_set_prechrg_curr(struct bq256xx_device *bq, int iprechg)
{ … }
static int bq25618_619_get_prechrg_curr(struct bq256xx_device *bq)
{ … }
static int bq25618_619_set_prechrg_curr(struct bq256xx_device *bq, int iprechg)
{ … }
static int bq256xx_get_term_curr(struct bq256xx_device *bq)
{ … }
static int bq256xx_set_term_curr(struct bq256xx_device *bq, int iterm)
{ … }
static int bq25618_619_get_term_curr(struct bq256xx_device *bq)
{ … }
static int bq25618_619_set_term_curr(struct bq256xx_device *bq, int iterm)
{ … }
static int bq256xx_get_input_volt_lim(struct bq256xx_device *bq)
{ … }
static int bq256xx_set_input_volt_lim(struct bq256xx_device *bq, int vindpm)
{ … }
static int bq256xx_get_input_curr_lim(struct bq256xx_device *bq)
{ … }
static int bq256xx_set_input_curr_lim(struct bq256xx_device *bq, int iindpm)
{ … }
static void bq256xx_charger_reset(void *data)
{ … }
static int bq256xx_set_charger_property(struct power_supply *psy,
enum power_supply_property prop,
const union power_supply_propval *val)
{ … }
static int bq256xx_get_battery_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
static int bq256xx_get_charger_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
static bool bq256xx_state_changed(struct bq256xx_device *bq,
struct bq256xx_state *new_state)
{ … }
static irqreturn_t bq256xx_irq_handler_thread(int irq, void *private)
{ … }
static enum power_supply_property bq256xx_power_supply_props[] = …;
static enum power_supply_property bq256xx_battery_props[] = …;
static int bq256xx_property_is_writeable(struct power_supply *psy,
enum power_supply_property prop)
{ … }
static const struct power_supply_desc bq256xx_power_supply_desc = …;
static struct power_supply_desc bq256xx_battery_desc = …;
static bool bq256xx_is_volatile_reg(struct device *dev, unsigned int reg)
{ … }
static const struct regmap_config bq25600_regmap_config = …;
static const struct regmap_config bq25611d_regmap_config = …;
static const struct regmap_config bq25618_619_regmap_config = …;
static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = …;
static int bq256xx_power_supply_init(struct bq256xx_device *bq,
struct power_supply_config *psy_cfg, struct device *dev)
{ … }
static int bq256xx_hw_init(struct bq256xx_device *bq)
{ … }
static int bq256xx_parse_dt(struct bq256xx_device *bq,
struct power_supply_config *psy_cfg, struct device *dev)
{ … }
static int bq256xx_probe(struct i2c_client *client)
{ … }
static const struct i2c_device_id bq256xx_i2c_ids[] = …;
MODULE_DEVICE_TABLE(i2c, bq256xx_i2c_ids);
static const struct of_device_id bq256xx_of_match[] = …;
MODULE_DEVICE_TABLE(of, bq256xx_of_match);
static const struct acpi_device_id bq256xx_acpi_match[] = …;
MODULE_DEVICE_TABLE(acpi, bq256xx_acpi_match);
static struct i2c_driver bq256xx_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;