#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>
enum rk817_charge_status { … };
enum rk817_chg_cur { … };
struct rk817_charger { … };
#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)
{ … }
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(…) …;