linux/drivers/power/supply/axp288_fuel_gauge.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * axp288_fuel_gauge.c - Xpower AXP288 PMIC Fuel Gauge Driver
 *
 * Copyright (C) 2020-2021 Andrejus Basovas <[email protected]>
 * Copyright (C) 2016-2021 Hans de Goede <[email protected]>
 * Copyright (C) 2014 Intel Corporation
 *
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */

#include <linux/acpi.h>
#include <linux/dmi.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/regmap.h>
#include <linux/jiffies.h>
#include <linux/interrupt.h>
#include <linux/mfd/axp20x.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#include <linux/iio/consumer.h>
#include <asm/unaligned.h>
#include <asm/iosf_mbi.h>

#define PS_STAT_VBUS_TRIGGER
#define PS_STAT_BAT_CHRG_DIR
#define PS_STAT_VBAT_ABOVE_VHOLD
#define PS_STAT_VBUS_VALID
#define PS_STAT_VBUS_PRESENT

#define CHRG_STAT_BAT_SAFE_MODE
#define CHRG_STAT_BAT_VALID
#define CHRG_STAT_BAT_PRESENT
#define CHRG_STAT_CHARGING
#define CHRG_STAT_PMIC_OTP

#define CHRG_CCCV_CC_MASK
#define CHRG_CCCV_CC_BIT_POS
#define CHRG_CCCV_CC_OFFSET
#define CHRG_CCCV_CC_LSB_RES
#define CHRG_CCCV_ITERM_20P
#define CHRG_CCCV_CV_MASK
#define CHRG_CCCV_CV_BIT_POS
#define CHRG_CCCV_CV_4100MV
#define CHRG_CCCV_CV_4150MV
#define CHRG_CCCV_CV_4200MV
#define CHRG_CCCV_CV_4350MV
#define CHRG_CCCV_CHG_EN

#define FG_CNTL_OCV_ADJ_STAT
#define FG_CNTL_OCV_ADJ_EN
#define FG_CNTL_CAP_ADJ_STAT
#define FG_CNTL_CAP_ADJ_EN
#define FG_CNTL_CC_EN
#define FG_CNTL_GAUGE_EN

#define FG_15BIT_WORD_VALID
#define FG_15BIT_VAL_MASK

#define FG_REP_CAP_VALID
#define FG_REP_CAP_VAL_MASK

#define FG_DES_CAP1_VALID
#define FG_DES_CAP_RES_LSB

#define FG_DES_CC_RES_LSB

#define FG_OCV_CAP_VALID
#define FG_OCV_CAP_VAL_MASK
#define FG_CC_CAP_VALID
#define FG_CC_CAP_VAL_MASK

#define FG_LOW_CAP_THR1_MASK
#define FG_LOW_CAP_THR1_VAL
#define FG_LOW_CAP_THR2_MASK
#define FG_LOW_CAP_WARN_THR
#define FG_LOW_CAP_CRIT_THR
#define FG_LOW_CAP_SHDN_THR

#define DEV_NAME

/* 1.1mV per LSB expressed in uV */
#define VOLTAGE_FROM_ADC(a)
/* properties converted to uV, uA */
#define PROP_VOLT(a)
#define PROP_CURR(a)

#define AXP288_REG_UPDATE_INTERVAL
#define AXP288_FG_INTR_NUM

#define AXP288_QUIRK_NO_BATTERY

static bool no_current_sense_res;
module_param(no_current_sense_res, bool, 0444);
MODULE_PARM_DESC();

enum {};

enum {};

struct axp288_fg_info {};

static enum power_supply_property fuel_gauge_props[] =;

static int fuel_gauge_reg_readb(struct axp288_fg_info *info, int reg)
{}

static int fuel_gauge_reg_writeb(struct axp288_fg_info *info, int reg, u8 val)
{}

static int fuel_gauge_read_15bit_word(struct axp288_fg_info *info, int reg)
{}

static int fuel_gauge_read_12bit_word(struct axp288_fg_info *info, int reg)
{}

static int fuel_gauge_update_registers(struct axp288_fg_info *info)
{}

static void fuel_gauge_get_status(struct axp288_fg_info *info)
{}

static int fuel_gauge_battery_health(struct axp288_fg_info *info)
{}

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

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

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

static irqreturn_t fuel_gauge_thread_handler(int irq, void *dev)
{}

static void fuel_gauge_external_power_changed(struct power_supply *psy)
{}

static struct power_supply_desc fuel_gauge_desc =;

/*
 * Some devices have no battery (HDMI sticks) and the axp288 battery's
 * detection reports one despite it not being there.
 * Please keep this listed sorted alphabetically.
 */
static const struct dmi_system_id axp288_quirks[] =;

static int axp288_fuel_gauge_read_initial_regs(struct axp288_fg_info *info)
{}

static void axp288_fuel_gauge_release_iio_chans(void *data)
{}

static int axp288_fuel_gauge_probe(struct platform_device *pdev)
{}

static const struct platform_device_id axp288_fg_id_table[] =;
MODULE_DEVICE_TABLE(platform, axp288_fg_id_table);

static struct platform_driver axp288_fuel_gauge_driver =;

module_platform_driver();

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