#include <linux/acpi.h>
#include <linux/bitops.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/regmap.h>
#include <linux/workqueue.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/usb/otg.h>
#include <linux/notifier.h>
#include <linux/power_supply.h>
#include <linux/property.h>
#include <linux/mfd/axp20x.h>
#include <linux/extcon.h>
#include <linux/dmi.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 VBUS_ISPOUT_CUR_LIM_MASK …
#define VBUS_ISPOUT_CUR_LIM_BIT_POS …
#define VBUS_ISPOUT_CUR_LIM_900MA …
#define VBUS_ISPOUT_CUR_LIM_1500MA …
#define VBUS_ISPOUT_CUR_LIM_2000MA …
#define VBUS_ISPOUT_CUR_NO_LIM …
#define VBUS_ISPOUT_VHOLD_SET_MASK …
#define VBUS_ISPOUT_VHOLD_SET_BIT_POS …
#define VBUS_ISPOUT_VHOLD_SET_OFFSET …
#define VBUS_ISPOUT_VHOLD_SET_LSB_RES …
#define VBUS_ISPOUT_VHOLD_SET_4400MV …
#define VBUS_ISPOUT_VBUS_PATH_DIS …
#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 CNTL2_CC_TIMEOUT_MASK …
#define CNTL2_CC_TIMEOUT_OFFSET …
#define CNTL2_CC_TIMEOUT_LSB_RES …
#define CNTL2_CC_TIMEOUT_12HRS …
#define CNTL2_CHGLED_TYPEB …
#define CNTL2_CHG_OUT_TURNON …
#define CNTL2_PC_TIMEOUT_MASK …
#define CNTL2_PC_TIMEOUT_OFFSET …
#define CNTL2_PC_TIMEOUT_LSB_RES …
#define CNTL2_PC_TIMEOUT_70MINS …
#define CHRG_ILIM_TEMP_LOOP_EN …
#define CHRG_VBUS_ILIM_MASK …
#define CHRG_VBUS_ILIM_BIT_POS …
#define CHRG_VBUS_ILIM_100MA …
#define CHRG_VBUS_ILIM_500MA …
#define CHRG_VBUS_ILIM_900MA …
#define CHRG_VBUS_ILIM_1500MA …
#define CHRG_VBUS_ILIM_2000MA …
#define CHRG_VBUS_ILIM_2500MA …
#define CHRG_VBUS_ILIM_3000MA …
#define CHRG_VBUS_ILIM_3500MA …
#define CHRG_VBUS_ILIM_4000MA …
#define CHRG_VLTFC_0C …
#define CHRG_VHTFC_45C …
#define FG_CNTL_OCV_ADJ_EN …
#define CV_4100MV …
#define CV_4150MV …
#define CV_4200MV …
#define CV_4350MV …
#define AXP288_REG_UPDATE_INTERVAL …
#define AXP288_EXTCON_DEV_NAME …
#define USB_HOST_EXTCON_HID …
#define USB_HOST_EXTCON_NAME …
enum { … };
struct axp288_chrg_info { … };
static inline int axp288_charger_set_cc(struct axp288_chrg_info *info, int cc)
{ … }
static inline int axp288_charger_set_cv(struct axp288_chrg_info *info, int cv)
{ … }
static int axp288_charger_get_vbus_inlmt(struct axp288_chrg_info *info)
{ … }
static inline int axp288_charger_set_vbus_inlmt(struct axp288_chrg_info *info,
int inlmt)
{ … }
static int axp288_charger_vbus_path_select(struct axp288_chrg_info *info,
bool enable)
{ … }
static int axp288_charger_enable_charger(struct axp288_chrg_info *info,
bool enable)
{ … }
static int axp288_get_charger_health(struct axp288_chrg_info *info)
{ … }
static int axp288_charger_usb_set_property(struct power_supply *psy,
enum power_supply_property psp,
const union power_supply_propval *val)
{ … }
static int axp288_charger_reg_readb(struct axp288_chrg_info *info, int reg, unsigned int *ret_val)
{ … }
static int axp288_charger_usb_update_property(struct axp288_chrg_info *info)
{ … }
static int axp288_charger_usb_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
static int axp288_charger_property_is_writeable(struct power_supply *psy,
enum power_supply_property psp)
{ … }
static enum power_supply_property axp288_usb_props[] = …;
static const struct power_supply_desc axp288_charger_desc = …;
static irqreturn_t axp288_charger_irq_thread_handler(int irq, void *dev)
{ … }
static const struct dmi_system_id axp288_hp_x2_dmi_ids[] = …;
static void axp288_charger_extcon_evt_worker(struct work_struct *work)
{ … }
static int axp288_charger_handle_cable_evt(struct notifier_block *nb,
unsigned long event, void *param)
{ … }
static void axp288_charger_otg_evt_worker(struct work_struct *work)
{ … }
static int axp288_charger_handle_otg_evt(struct notifier_block *nb,
unsigned long event, void *param)
{ … }
static int charger_init_hw_regs(struct axp288_chrg_info *info)
{ … }
static void axp288_charger_cancel_work(void *data)
{ … }
static int axp288_charger_probe(struct platform_device *pdev)
{ … }
static const struct platform_device_id axp288_charger_id_table[] = …;
MODULE_DEVICE_TABLE(platform, axp288_charger_id_table);
static struct platform_driver axp288_charger_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;