#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/power_supply.h>
#include <linux/regmap.h>
#include <linux/types.h>
#include <linux/gpio/consumer.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/acpi.h>
#include <linux/of.h>
#define BQ24257_REG_1 …
#define BQ24257_REG_2 …
#define BQ24257_REG_3 …
#define BQ24257_REG_4 …
#define BQ24257_REG_5 …
#define BQ24257_REG_6 …
#define BQ24257_REG_7 …
#define BQ24257_MANUFACTURER …
#define BQ24257_PG_GPIO …
#define BQ24257_ILIM_SET_DELAY …
enum bq2425x_chip { … };
struct bq2425x_chip_info { … };
enum bq24257_fields { … };
struct bq24257_init_data { … };
struct bq24257_state { … };
struct bq24257_device { … };
static bool bq24257_is_volatile_reg(struct device *dev, unsigned int reg)
{ … }
static const struct regmap_config bq24257_regmap_config = …;
static const struct reg_field bq24257_reg_fields[] = …;
static const u32 bq24257_vbat_map[] = …;
#define BQ24257_VBAT_MAP_SIZE …
static const u32 bq24257_ichg_map[] = …;
#define BQ24257_ICHG_MAP_SIZE …
static const u32 bq24257_iterm_map[] = …;
#define BQ24257_ITERM_MAP_SIZE …
static const u32 bq24257_iilimit_map[] = …;
#define BQ24257_IILIMIT_MAP_SIZE …
static const u32 bq24257_vovp_map[] = …;
#define BQ24257_VOVP_MAP_SIZE …
static const u32 bq24257_vindpm_map[] = …;
#define BQ24257_VINDPM_MAP_SIZE …
static int bq24257_field_read(struct bq24257_device *bq,
enum bq24257_fields field_id)
{ … }
static int bq24257_field_write(struct bq24257_device *bq,
enum bq24257_fields field_id, u8 val)
{ … }
static u8 bq24257_find_idx(u32 value, const u32 *map, u8 map_size)
{ … }
enum bq24257_status { … };
enum bq24257_fault { … };
static int bq24257_get_input_current_limit(struct bq24257_device *bq,
union power_supply_propval *val)
{ … }
static int bq24257_set_input_current_limit(struct bq24257_device *bq,
const union power_supply_propval *val)
{ … }
static int bq24257_power_supply_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
static int bq24257_power_supply_set_property(struct power_supply *psy,
enum power_supply_property prop,
const union power_supply_propval *val)
{ … }
static int bq24257_power_supply_property_is_writeable(struct power_supply *psy,
enum power_supply_property psp)
{ … }
static int bq24257_get_chip_state(struct bq24257_device *bq,
struct bq24257_state *state)
{ … }
static bool bq24257_state_changed(struct bq24257_device *bq,
struct bq24257_state *new_state)
{ … }
enum bq24257_loop_status { … };
enum bq24257_in_ilimit { … };
enum bq24257_vovp { … };
enum bq24257_vindpm { … };
enum bq24257_port_type { … };
enum bq24257_safety_timer { … };
static int bq24257_iilimit_autoset(struct bq24257_device *bq)
{ … }
static void bq24257_iilimit_setup_work(struct work_struct *work)
{ … }
static void bq24257_handle_state_change(struct bq24257_device *bq,
struct bq24257_state *new_state)
{ … }
static irqreturn_t bq24257_irq_handler_thread(int irq, void *private)
{ … }
static int bq24257_hw_init(struct bq24257_device *bq)
{ … }
static enum power_supply_property bq24257_power_supply_props[] = …;
static char *bq24257_charger_supplied_to[] = …;
static const struct power_supply_desc bq24257_power_supply_desc = …;
static ssize_t bq24257_show_ovp_voltage(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t bq24257_show_in_dpm_voltage(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t bq24257_sysfs_show_enable(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t bq24257_sysfs_set_enable(struct device *dev,
struct device_attribute *attr,
const char *buf,
size_t count)
{ … }
static DEVICE_ATTR(ovp_voltage, S_IRUGO, bq24257_show_ovp_voltage, NULL);
static DEVICE_ATTR(in_dpm_voltage, S_IRUGO, bq24257_show_in_dpm_voltage, NULL);
static DEVICE_ATTR(high_impedance_enable, S_IWUSR | S_IRUGO,
bq24257_sysfs_show_enable, bq24257_sysfs_set_enable);
static DEVICE_ATTR(sysoff_enable, S_IWUSR | S_IRUGO,
bq24257_sysfs_show_enable, bq24257_sysfs_set_enable);
static struct attribute *bq24257_charger_sysfs_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static int bq24257_power_supply_init(struct bq24257_device *bq)
{ … }
static void bq24257_pg_gpio_probe(struct bq24257_device *bq)
{ … }
static int bq24257_fw_probe(struct bq24257_device *bq)
{ … }
static int bq24257_probe(struct i2c_client *client)
{ … }
static void bq24257_remove(struct i2c_client *client)
{ … }
#ifdef CONFIG_PM_SLEEP
static int bq24257_suspend(struct device *dev)
{ … }
static int bq24257_resume(struct device *dev)
{ … }
#endif
static const struct dev_pm_ops bq24257_pm = …;
static const struct bq2425x_chip_info bq24250_info = …;
static const struct bq2425x_chip_info bq24251_info = …;
static const struct bq2425x_chip_info bq24257_info = …;
static const struct i2c_device_id bq24257_i2c_ids[] = …;
MODULE_DEVICE_TABLE(i2c, bq24257_i2c_ids);
static const struct of_device_id bq24257_of_match[] __maybe_unused = …;
MODULE_DEVICE_TABLE(of, bq24257_of_match);
#ifdef CONFIG_ACPI
static const struct acpi_device_id bq24257_acpi_match[] = …;
MODULE_DEVICE_TABLE(acpi, bq24257_acpi_match);
#endif
static struct i2c_driver bq24257_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;