linux/drivers/power/supply/rk817_charger.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * Charger Driver for Rockchip rk817
 *
 * Copyright (c) 2021 Maya Matuszczyk <[email protected]>
 *
 * Authors: Maya Matuszczyk <[email protected]>
 *	    Chris Morgan <[email protected]>
 */

#include <asm/unaligned.h>
#include <linux/devm-helpers.h>
#include <linux/mfd/rk808.h>
#include <linux/irq.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#include <linux/regmap.h>

/* Charging statuses reported by hardware register */
enum rk817_charge_status {};

/*
 * Max charging current read to/written from hardware register.
 * Note how highest value corresponding to 0x7 is the lowest
 * current, this is per the datasheet.
 */
enum rk817_chg_cur {};

struct rk817_charger {};

/* ADC coefficients extracted from BSP kernel */
#define ADC_TO_CURRENT(adc_value, res_div)

#define CURRENT_TO_ADC(current, samp_res)

#define CHARGE_TO_ADC(capacity, res_div)

#define ADC_TO_CHARGE_UAH(adc_value, res_div)

static int rk817_chg_cur_to_reg(u32 chg_cur_ma)
{}

static int rk817_chg_cur_from_reg(u8 reg)
{}

static void rk817_bat_calib_vol(struct rk817_charger *charger)
{}

static void rk817_bat_calib_cur(struct rk817_charger *charger)
{}

/*
 * note that only the fcc_mah is really used by this driver, the other values
 * are to ensure we can remain backwards compatible with the BSP kernel.
 */
static int rk817_record_battery_nvram_values(struct rk817_charger *charger)
{}

static int rk817_bat_calib_cap(struct rk817_charger *charger)
{}

static void rk817_read_props(struct rk817_charger *charger)
{}

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

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

static irqreturn_t rk817_plug_in_isr(int irq, void *cg)
{}

static irqreturn_t rk817_plug_out_isr(int irq, void *cg)
{}

static enum power_supply_property rk817_bat_props[] =;

static enum power_supply_property rk817_chg_props[] =;

static enum power_supply_usb_type rk817_usb_type[] =;

static const struct power_supply_desc rk817_bat_desc =;

static const struct power_supply_desc rk817_chg_desc =;

static int rk817_read_battery_nvram_values(struct rk817_charger *charger)
{}

static int
rk817_read_or_set_full_charge_on_boot(struct rk817_charger *charger,
				struct power_supply_battery_info *bat_info)
{}

static int rk817_battery_init(struct rk817_charger *charger,
			      struct power_supply_battery_info *bat_info)
{}

static void rk817_charging_monitor(struct work_struct *work)
{}

static void rk817_cleanup_node(void *data)
{}

static int rk817_charger_probe(struct platform_device *pdev)
{}

static int __maybe_unused rk817_resume(struct device *dev)
{}

static SIMPLE_DEV_PM_OPS(rk817_charger_pm, NULL, rk817_resume);

static struct platform_driver rk817_charger_driver =;
module_platform_driver();

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