linux/drivers/power/supply/88pm860x_charger.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Battery driver for Marvell 88PM860x PMIC
 *
 * Copyright (c) 2012 Marvell International Ltd.
 * Author:	Jett Zhou <[email protected]>
 *		Haojian Zhuang <[email protected]>
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/power_supply.h>
#include <linux/mfd/88pm860x.h>
#include <linux/delay.h>
#include <linux/uaccess.h>
#include <asm/div64.h>

/* bit definitions of Status Query Interface 2 */
#define STATUS2_CHG

/* bit definitions of Reset Out Register */
#define RESET_SW_PD

/* bit definitions of PreReg 1 */
#define PREREG1_90MA
#define PREREG1_180MA
#define PREREG1_450MA
#define PREREG1_540MA
#define PREREG1_1350MA
#define PREREG1_VSYS_4_5V

/* bit definitions of Charger Control 1 Register */
#define CC1_MODE_OFF
#define CC1_MODE_PRECHARGE
#define CC1_MODE_FASTCHARGE
#define CC1_MODE_PULSECHARGE
#define CC1_ITERM_20MA
#define CC1_ITERM_60MA
#define CC1_VFCHG_4_2V

/* bit definitions of Charger Control 2 Register */
#define CC2_ICHG_100MA
#define CC2_ICHG_500MA
#define CC2_ICHG_1000MA

/* bit definitions of Charger Control 3 Register */
#define CC3_180MIN_TIMEOUT
#define CC3_270MIN_TIMEOUT
#define CC3_360MIN_TIMEOUT
#define CC3_DISABLE_TIMEOUT

/* bit definitions of Charger Control 4 Register */
#define CC4_IPRE_40MA
#define CC4_VPCHG_3_2V
#define CC4_IFCHG_MON_EN
#define CC4_BTEMP_MON_EN

/* bit definitions of Charger Control 6 Register */
#define CC6_BAT_OV_EN
#define CC6_BAT_UV_EN
#define CC6_UV_VBAT_SET

/* bit definitions of Charger Control 7 Register */
#define CC7_BAT_REM_EN
#define CC7_IFSM_EN

/* bit definitions of Measurement Enable 1 Register */
#define MEAS1_VBAT

/* bit definitions of Measurement Enable 3 Register */
#define MEAS3_IBAT_EN
#define MEAS3_CC_EN

#define FSM_INIT
#define FSM_DISCHARGE
#define FSM_PRECHARGE
#define FSM_FASTCHARGE

#define PRECHARGE_THRESHOLD
#define POWEROFF_THRESHOLD
#define CHARGE_THRESHOLD
#define DISCHARGE_THRESHOLD

/* over-temperature on PM8606 setting */
#define OVER_TEMP_FLAG
#define OVTEMP_AUTORECOVER

/* over-voltage protect on vchg setting mv */
#define VCHG_NORMAL_LOW
#define VCHG_NORMAL_CHECK
#define VCHG_NORMAL_HIGH
#define VCHG_OVP_LOW

struct pm860x_charger_info {};

static char *pm860x_supplied_to[] =;

static int measure_vchg(struct pm860x_charger_info *info, int *data)
{}

static void set_vchg_threshold(struct pm860x_charger_info *info,
			       int min, int max)
{}

static void set_vbatt_threshold(struct pm860x_charger_info *info,
				int min, int max)
{}

static int start_precharge(struct pm860x_charger_info *info)
{}

static int start_fastcharge(struct pm860x_charger_info *info)
{}

static void stop_charge(struct pm860x_charger_info *info, int vbatt)
{}

static void power_off_notification(struct pm860x_charger_info *info)
{}

static int set_charging_fsm(struct pm860x_charger_info *info)
{}

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

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

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

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

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

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

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

static enum power_supply_property pm860x_usb_props[] =;

static int pm860x_init_charger(struct pm860x_charger_info *info)
{}

static struct pm860x_irq_desc {} pm860x_irq_descs[] =;

static const struct power_supply_desc pm860x_charger_desc =;

static int pm860x_charger_probe(struct platform_device *pdev)
{}

static struct platform_driver pm860x_charger_driver =;
module_platform_driver();

MODULE_DESCRIPTION();
MODULE_LICENSE();