linux/drivers/power/supply/da9150-fg.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * DA9150 Fuel-Gauge Driver
 *
 * Copyright (c) 2015 Dialog Semiconductor
 *
 * Author: Adam Thomson <[email protected]>
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/of.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/power_supply.h>
#include <linux/list.h>
#include <asm/div64.h>
#include <linux/mfd/da9150/core.h>
#include <linux/mfd/da9150/registers.h>
#include <linux/devm-helpers.h>

/* Core2Wire */
#define DA9150_QIF_READ
#define DA9150_QIF_WRITE
#define DA9150_QIF_CODE_MASK

#define DA9150_QIF_BYTE_SIZE
#define DA9150_QIF_BYTE_MASK
#define DA9150_QIF_SHORT_SIZE
#define DA9150_QIF_LONG_SIZE

/* QIF Codes */
#define DA9150_QIF_UAVG
#define DA9150_QIF_UAVG_SIZE
#define DA9150_QIF_IAVG
#define DA9150_QIF_IAVG_SIZE
#define DA9150_QIF_NTCAVG
#define DA9150_QIF_NTCAVG_SIZE
#define DA9150_QIF_SHUNT_VAL
#define DA9150_QIF_SHUNT_VAL_SIZE
#define DA9150_QIF_SD_GAIN
#define DA9150_QIF_SD_GAIN_SIZE
#define DA9150_QIF_FCC_MAH
#define DA9150_QIF_FCC_MAH_SIZE
#define DA9150_QIF_SOC_PCT
#define DA9150_QIF_SOC_PCT_SIZE
#define DA9150_QIF_CHARGE_LIMIT
#define DA9150_QIF_CHARGE_LIMIT_SIZE
#define DA9150_QIF_DISCHARGE_LIMIT
#define DA9150_QIF_DISCHARGE_LIMIT_SIZE
#define DA9150_QIF_FW_MAIN_VER
#define DA9150_QIF_FW_MAIN_VER_SIZE
#define DA9150_QIF_E_FG_STATUS
#define DA9150_QIF_E_FG_STATUS_SIZE
#define DA9150_QIF_SYNC
#define DA9150_QIF_SYNC_SIZE
#define DA9150_QIF_MAX_CODES

/* QIF Sync Timeout */
#define DA9150_QIF_SYNC_TIMEOUT
#define DA9150_QIF_SYNC_RETRIES

/* QIF E_FG_STATUS */
#define DA9150_FG_IRQ_LOW_SOC_MASK
#define DA9150_FG_IRQ_HIGH_SOC_MASK
#define DA9150_FG_IRQ_SOC_MASK

/* Private data */
struct da9150_fg {};

/* Battery Properties */
static u32 da9150_fg_read_attr(struct da9150_fg *fg, u8 code, u8 size)

{}

static void da9150_fg_write_attr(struct da9150_fg *fg, u8 code, u8 size,
				 u32 val)

{}

/* Trigger QIF Sync to update QIF readable data */
static void da9150_fg_read_sync_start(struct da9150_fg *fg)
{}

/*
 * Should always be called after QIF sync read has been performed, and all
 * attributes required have been accessed.
 */
static inline void da9150_fg_read_sync_end(struct da9150_fg *fg)
{}

/* Sync read of single QIF attribute */
static u32 da9150_fg_read_attr_sync(struct da9150_fg *fg, u8 code, u8 size)
{}

/* Wait for QIF Sync, write QIF data and wait for ack */
static void da9150_fg_write_attr_sync(struct da9150_fg *fg, u8 code, u8 size,
				      u32 val)
{}

/* Power Supply attributes */
static int da9150_fg_capacity(struct da9150_fg *fg,
			      union power_supply_propval *val)
{}

static int da9150_fg_current_avg(struct da9150_fg *fg,
				 union power_supply_propval *val)
{}

static int da9150_fg_voltage_avg(struct da9150_fg *fg,
				 union power_supply_propval *val)
{}

static int da9150_fg_charge_full(struct da9150_fg *fg,
				 union power_supply_propval *val)
{}

/*
 * Temperature reading from device is only valid if battery/system provides
 * valid NTC to associated pin of DA9150 chip.
 */
static int da9150_fg_temp(struct da9150_fg *fg,
			  union power_supply_propval *val)
{}

static enum power_supply_property da9150_fg_props[] =;

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

/* Repeated SOC check */
static bool da9150_fg_soc_changed(struct da9150_fg *fg)
{}

static void da9150_fg_work(struct work_struct *work)
{}

/* SOC level event configuration */
static void da9150_fg_soc_event_config(struct da9150_fg *fg)
{}

static irqreturn_t da9150_fg_irq(int irq, void *data)
{}

static struct da9150_fg_pdata *da9150_fg_dt_pdata(struct device *dev)
{}

static const struct power_supply_desc fg_desc =;

static int da9150_fg_probe(struct platform_device *pdev)
{}

static int da9150_fg_resume(struct platform_device *pdev)
{}

static struct platform_driver da9150_fg_driver =;

module_platform_driver();

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