linux/drivers/power/supply/axp20x_battery.c

/*
 * Battery power supply driver for X-Powers AXP20X and AXP22X PMICs
 *
 * Copyright 2016 Free Electrons NextThing Co.
 *	Quentin Schulz <[email protected]>
 *
 * This driver is based on a previous upstreaming attempt by:
 *	Bruno Prémont <[email protected]>
 *
 * This file is subject to the terms and conditions of the GNU General
 * Public License. See the file "COPYING" in the main directory of this
 * archive for more details.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 */

#include <linux/bitfield.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/time.h>
#include <linux/iio/iio.h>
#include <linux/iio/consumer.h>
#include <linux/mfd/axp20x.h>

#define AXP20X_PWR_STATUS_BAT_CHARGING
#define AXP717_PWR_STATUS_MASK
#define AXP717_PWR_STATUS_BAT_STANDBY
#define AXP717_PWR_STATUS_BAT_CHRG
#define AXP717_PWR_STATUS_BAT_DISCHRG

#define AXP20X_PWR_OP_BATT_PRESENT
#define AXP20X_PWR_OP_BATT_ACTIVATED
#define AXP717_PWR_OP_BATT_PRESENT

#define AXP717_BATT_PMU_FAULT_MASK
#define AXP717_BATT_UVLO_2_5V
#define AXP717_BATT_OVER_TEMP
#define AXP717_BATT_UNDER_TEMP

#define AXP209_FG_PERCENT
#define AXP22X_FG_VALID

#define AXP20X_CHRG_CTRL1_ENABLE
#define AXP20X_CHRG_CTRL1_TGT_VOLT
#define AXP20X_CHRG_CTRL1_TGT_4_1V
#define AXP20X_CHRG_CTRL1_TGT_4_15V
#define AXP20X_CHRG_CTRL1_TGT_4_2V
#define AXP20X_CHRG_CTRL1_TGT_4_36V

#define AXP22X_CHRG_CTRL1_TGT_4_22V
#define AXP22X_CHRG_CTRL1_TGT_4_24V

#define AXP717_CHRG_ENABLE
#define AXP717_CHRG_CV_VOLT_MASK
#define AXP717_CHRG_CV_4_0V
#define AXP717_CHRG_CV_4_1V
#define AXP717_CHRG_CV_4_2V
#define AXP717_CHRG_CV_4_35V
#define AXP717_CHRG_CV_4_4V
/* Values 5 and 6 reserved. */
#define AXP717_CHRG_CV_5_0V

#define AXP813_CHRG_CTRL1_TGT_4_35V

#define AXP20X_CHRG_CTRL1_TGT_CURR
#define AXP717_ICC_CHARGER_LIM_MASK

#define AXP717_ITERM_CHG_LIM_MASK
#define AXP717_ITERM_CC_STEP

#define AXP20X_V_OFF_MASK
#define AXP717_V_OFF_MASK

#define AXP717_BAT_VMIN_MIN_UV
#define AXP717_BAT_VMIN_MAX_UV
#define AXP717_BAT_VMIN_STEP
#define AXP717_BAT_CV_MIN_UV
#define AXP717_BAT_CV_MAX_UV
#define AXP717_BAT_CC_MIN_UA
#define AXP717_BAT_CC_MAX_UA

struct axp20x_batt_ps;

struct axp_data {};

struct axp20x_batt_ps {};

static int axp20x_battery_get_max_voltage(struct axp20x_batt_ps *axp20x_batt,
					  int *val)
{}

static int axp22x_battery_get_max_voltage(struct axp20x_batt_ps *axp20x_batt,
					  int *val)
{}

static int axp717_battery_get_max_voltage(struct axp20x_batt_ps *axp20x_batt,
					  int *val)
{}

static int axp813_battery_get_max_voltage(struct axp20x_batt_ps *axp20x_batt,
					  int *val)
{}

static int axp20x_get_constant_charge_current(struct axp20x_batt_ps *axp,
					      int *val)
{}

static int axp717_get_constant_charge_current(struct axp20x_batt_ps *axp,
					      int *val)
{}

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

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

static int axp22x_battery_set_max_voltage(struct axp20x_batt_ps *axp20x_batt,
					  int val)
{}

static int axp20x_battery_set_max_voltage(struct axp20x_batt_ps *axp20x_batt,
					  int val)
{}

static int axp717_battery_set_max_voltage(struct axp20x_batt_ps *axp20x_batt,
					  int val)
{}

static int axp20x_set_constant_charge_current(struct axp20x_batt_ps *axp_batt,
					      int charge_current)
{}

static int axp717_set_constant_charge_current(struct axp20x_batt_ps *axp,
					      int charge_current)
{}

static int axp20x_set_max_constant_charge_current(struct axp20x_batt_ps *axp,
						  int charge_current)
{}
static int axp20x_set_voltage_min_design(struct axp20x_batt_ps *axp_batt,
					 int min_voltage)
{}

static int axp717_set_voltage_min_design(struct axp20x_batt_ps *axp_batt,
					 int min_voltage)
{}

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

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

static enum power_supply_property axp20x_battery_props[] =;

static enum power_supply_property axp717_battery_props[] =;

static int axp20x_battery_prop_writeable(struct power_supply *psy,
					 enum power_supply_property psp)
{}

static int axp717_battery_prop_writeable(struct power_supply *psy,
					 enum power_supply_property psp)
{}

static const struct power_supply_desc axp209_batt_ps_desc =;

static const struct power_supply_desc axp717_batt_ps_desc =;

static int axp209_bat_cfg_iio_channels(struct platform_device *pdev,
				       struct axp20x_batt_ps *axp_batt)
{}

static int axp717_bat_cfg_iio_channels(struct platform_device *pdev,
				       struct axp20x_batt_ps *axp_batt)
{}

static void axp209_set_battery_info(struct platform_device *pdev,
				    struct axp20x_batt_ps *axp_batt,
				    struct power_supply_battery_info *info)
{}

static void axp717_set_battery_info(struct platform_device *pdev,
				    struct axp20x_batt_ps *axp_batt,
				    struct power_supply_battery_info *info)
{}

static const struct axp_data axp209_data =;

static const struct axp_data axp221_data =;

static const struct axp_data axp717_data =;

static const struct axp_data axp813_data =;

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

static int axp20x_power_probe(struct platform_device *pdev)
{}

static struct platform_driver axp20x_batt_driver =;

module_platform_driver();

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