linux/drivers/power/supply/bq2515x_charger.c

// SPDX-License-Identifier: GPL-2.0
// BQ2515X Battery Charger Driver
// Copyright (C) 2020 Texas Instruments Incorporated - https://www.ti.com/

#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/init.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>

#define BQ2515X_MANUFACTURER

#define BQ2515X_STAT0
#define BQ2515X_STAT1
#define BQ2515X_STAT2
#define BQ2515X_FLAG0
#define BQ2515X_FLAG1
#define BQ2515X_FLAG2
#define BQ2515X_FLAG3
#define BQ2515X_MASK0
#define BQ2515X_MASK1
#define BQ2515X_MASK2
#define BQ2515X_MASK3
#define BQ2515X_VBAT_CTRL
#define BQ2515X_ICHG_CTRL
#define BQ2515X_PCHRGCTRL
#define BQ2515X_TERMCTRL
#define BQ2515X_BUVLO
#define BQ2515X_CHARGERCTRL0
#define BQ2515X_CHARGERCTRL1
#define BQ2515X_ILIMCTRL
#define BQ2515X_LDOCTRL
#define BQ2515X_MRCTRL
#define BQ2515X_ICCTRL0
#define BQ2515X_ICCTRL1
#define BQ2515X_ICCTRL2
#define BQ2515X_ADCCTRL0
#define BQ2515X_ADCCTRL1
#define BQ2515X_ADC_VBAT_M
#define BQ2515X_ADC_VBAT_L
#define BQ2515X_ADC_TS_M
#define BQ2515X_ADC_TS_L
#define BQ2515X_ADC_ICHG_M
#define BQ2515X_ADC_ICHG_L
#define BQ2515X_ADC_ADCIN_M
#define BQ2515X_ADC_ADCIN_L
#define BQ2515X_ADC_VIN_M
#define BQ2515X_ADC_VIN_L
#define BQ2515X_ADC_PMID_M
#define BQ2515X_ADC_PMID_L
#define BQ2515X_ADC_IIN_M
#define BQ2515X_ADC_IIN_L
#define BQ2515X_ADC_COMP1_M
#define BQ2515X_ADC_COMP1_L
#define BQ2515X_ADC_COMP2_M
#define BQ2515X_ADC_COMP2_L
#define BQ2515X_ADC_COMP3_M
#define BQ2515X_ADC_COMP3_L
#define BQ2515X_ADC_READ_EN
#define BQ2515X_TS_FASTCHGCTRL
#define BQ2515X_TS_COLD
#define BQ2515X_TS_COOL
#define BQ2515X_TS_WARM
#define BQ2515X_TS_HOT
#define BQ2515X_DEVICE_ID

#define BQ2515X_DEFAULT_ICHG_UA
#define BQ25150_DEFAULT_ILIM_UA
#define BQ25155_DEFAULT_ILIM_UA
#define BQ2515X_DEFAULT_VBAT_REG_UV
#define BQ2515X_DEFAULT_IPRECHARGE_UA

#define BQ2515X_DIVISOR
#define BQ2515X_VBAT_BASE_VOLT
#define BQ2515X_VBAT_REG_MAX
#define BQ2515X_VBAT_REG_MIN
#define BQ2515X_VBAT_STEP_UV
#define BQ2515X_UV_FACTOR
#define BQ2515X_VBAT_MULTIPLIER
#define BQ2515X_ICHG_DIVISOR
#define BQ2515X_ICHG_CURR_STEP_THRESH_UA
#define BQ2515X_ICHG_MIN_UA
#define BQ2515X_ICHG_MAX_UA
#define BQ2515X_ICHG_RNG_1B0_UA
#define BQ2515X_ICHG_RNG_1B1_UA
#define BQ2515X_VLOWV_SEL_1B0_UV
#define BQ2515X_VLOWV_SEL_1B1_UV
#define BQ2515X_PRECHRG_ICHRG_RNGE_1875_UA
#define BQ2515X_PRECHRG_ICHRG_RNGE_3750_UA
#define BQ2515X_TWAKE2_MIN_US
#define BQ2515X_TWAKE2_MAX_US

#define BQ2515X_ILIM_150MA
#define BQ2515X_ILIM_MASK
#define BQ2515X_ILIM_MIN
#define BQ2515X_ILIM_MAX
#define BQ2515X_HEALTH_MASK
#define BQ2515X_ICHGRNG_MASK
#define BQ2515X_STAT0_MASK
#define BQ2515X_STAT1_MASK
#define BQ2515X_PRECHARGE_MASK

#define BQ2515X_TS_HOT_STAT
#define BQ2515X_TS_WARM_STAT
#define BQ2515X_TS_COOL_STAT
#define BQ2515X_TS_COLD_STAT
#define BQ2515X_SAFETY_TIMER_EXP

#define BQ2515X_EN_VBAT_READ
#define BQ2515X_EN_ICHG_READ

#define BQ2515X_VIN_GOOD
#define BQ2515X_CHRG_DONE
#define BQ2515X_CV_CHRG_MODE

#define BQ2515X_VIN_OVP_FAULT_STAT

#define BQ2515X_WATCHDOG_DISABLE

#define BQ2515X_ICHARGE_RANGE

#define BQ2515X_VLOWV_SEL

#define BQ2515X_CHARGER_DISABLE

#define BQ2515X_HWRESET_14S_WD

static const int bq2515x_ilim_lvl_values[] =;

/**
 * struct bq2515x_init_data -
 * @ilim: input current limit
 * @ichg: fast charge current
 * @vbatreg: battery regulation voltage
 * @iprechg: precharge current
 */
struct bq2515x_init_data {};

/**
 * struct bq2515x_info -
 * @regmap_config: register map config
 * @ilim: input current limit
 */
struct bq2515x_info {};

/**
 * struct bq2515x_device -
 * @mains: mains properties
 * @battery: battery properties
 * @regmap: register map structure
 * @dev: device structure
 *
 * @reset_gpio: manual reset (MR) pin
 * @powerdown_gpio: low power mode pin
 * @ac_detect_gpio: power good (PG) pin
 * @ce_gpio: charge enable (CE) pin
 *
 * @info: device info
 * @model_name: string value describing device model
 * @mains_online: boolean value indicating power supply online
 *
 * @init_data: charger initialization data structure
 */
struct bq2515x_device {};

static const struct reg_default bq25150_reg_defaults[] =;

static const struct reg_default bq25155_reg_defaults[] =;

static int bq2515x_wake_up(struct bq2515x_device *bq2515x)
{}

static int bq2515x_update_ps_status(struct bq2515x_device *bq2515x)
{}

static int bq2515x_disable_watchdog_timers(struct bq2515x_device *bq2515x)
{}

static int bq2515x_get_battery_voltage_now(struct bq2515x_device *bq2515x)
{}

static int bq2515x_get_battery_current_now(struct bq2515x_device *bq2515x)
{}

static bool bq2515x_get_charge_disable(struct bq2515x_device *bq2515x)
{}

static int bq2515x_set_charge_disable(struct bq2515x_device *bq2515x, int val)
{}

static int bq2515x_get_const_charge_current(struct bq2515x_device *bq2515x)
{}

static int bq2515x_set_const_charge_current(struct bq2515x_device *bq2515x,
								int val)
{}

static int bq2515x_get_precharge_current(struct bq2515x_device *bq2515x)
{}

static int bq2515x_set_precharge_current(struct bq2515x_device *bq2515x,
					int val)
{}

static int bq2515x_charging_status(struct bq2515x_device *bq2515x,
				   union power_supply_propval *val)
{}

static int bq2515x_get_batt_reg(struct bq2515x_device *bq2515x)
{}

static int bq2515x_set_batt_reg(struct bq2515x_device *bq2515x, int val)
{}

static int bq2515x_get_ilim_lvl(struct bq2515x_device *bq2515x)
{}

static int bq2515x_set_ilim_lvl(struct bq2515x_device *bq2515x, int val)
{}

static int bq2515x_power_supply_property_is_writeable(struct power_supply *psy,
					enum power_supply_property prop)
{}

static int bq2515x_charger_get_health(struct bq2515x_device *bq2515x,
				      union power_supply_propval *val)
{}

static int bq2515x_mains_set_property(struct power_supply *psy,
		enum power_supply_property prop,
		const union power_supply_propval *val)
{}

static int bq2515x_mains_get_property(struct power_supply *psy,
				     enum power_supply_property prop,
				     union power_supply_propval *val)
{}

static int bq2515x_battery_get_property(struct power_supply *psy,
				       enum power_supply_property prop,
				       union power_supply_propval *val)
{}

static const enum power_supply_property bq2515x_battery_properties[] =;

static const enum power_supply_property bq2515x_mains_properties[] =;

static const struct power_supply_desc bq2515x_mains_desc =;

static const struct power_supply_desc bq2515x_battery_desc =;

static int bq2515x_power_supply_register(struct bq2515x_device *bq2515x,
		struct device *dev, struct power_supply_config psy_cfg)
{}

static int bq2515x_hw_init(struct bq2515x_device *bq2515x)
{}

static int bq2515x_read_properties(struct bq2515x_device *bq2515x)
{}

static bool bq2515x_volatile_register(struct device *dev, unsigned int reg)
{}

static const struct regmap_config bq25150_regmap_config =;

static const struct regmap_config bq25155_regmap_config =;

static int bq2515x_probe(struct i2c_client *client)
{}

static const struct bq2515x_info bq25150 =;

static const struct bq2515x_info bq25155 =;

static const struct i2c_device_id bq2515x_i2c_ids[] =;
MODULE_DEVICE_TABLE(i2c, bq2515x_i2c_ids);

static const struct of_device_id bq2515x_of_match[] =;
MODULE_DEVICE_TABLE(of, bq2515x_of_match);

static struct i2c_driver bq2515x_driver =;
module_i2c_driver();

MODULE_AUTHOR();
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();