#include <linux/errno.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/extcon-provider.h>
#include <linux/regulator/driver.h>
#define SMBB_CHG_VMAX …
#define SMBB_CHG_VSAFE …
#define SMBB_CHG_CFG …
#define SMBB_CHG_IMAX …
#define SMBB_CHG_ISAFE …
#define SMBB_CHG_VIN_MIN …
#define SMBB_CHG_CTRL …
#define CTRL_EN …
#define SMBB_CHG_VBAT_WEAK …
#define SMBB_CHG_IBAT_TERM_CHG …
#define IBAT_TERM_CHG_IEOC …
#define IBAT_TERM_CHG_IEOC_BMS …
#define IBAT_TERM_CHG_IEOC_CHG …
#define SMBB_CHG_VBAT_DET …
#define SMBB_CHG_TCHG_MAX_EN …
#define TCHG_MAX_EN …
#define SMBB_CHG_WDOG_TIME …
#define SMBB_CHG_WDOG_EN …
#define WDOG_EN …
#define SMBB_BUCK_REG_MODE …
#define BUCK_REG_MODE …
#define BUCK_REG_MODE_VBAT …
#define BUCK_REG_MODE_VSYS …
#define SMBB_BAT_PRES_STATUS …
#define PRES_STATUS_BAT_PRES …
#define SMBB_BAT_TEMP_STATUS …
#define TEMP_STATUS_OK …
#define TEMP_STATUS_HOT …
#define SMBB_BAT_BTC_CTRL …
#define BTC_CTRL_COMP_EN …
#define BTC_CTRL_COLD_EXT …
#define BTC_CTRL_HOT_EXT_N …
#define SMBB_USB_IMAX …
#define SMBB_USB_OTG_CTL …
#define OTG_CTL_EN …
#define SMBB_USB_ENUM_TIMER_STOP …
#define ENUM_TIMER_STOP …
#define SMBB_USB_SEC_ACCESS …
#define SEC_ACCESS_MAGIC …
#define SMBB_USB_REV_BST …
#define REV_BST_CHG_GONE …
#define SMBB_DC_IMAX …
#define SMBB_MISC_REV2 …
#define SMBB_MISC_BOOT_DONE …
#define BOOT_DONE …
#define STATUS_USBIN_VALID …
#define STATUS_DCIN_VALID …
#define STATUS_BAT_HOT …
#define STATUS_BAT_OK …
#define STATUS_BAT_PRESENT …
#define STATUS_CHG_DONE …
#define STATUS_CHG_TRKL …
#define STATUS_CHG_FAST …
#define STATUS_CHG_GONE …
enum smbb_attr { … };
struct smbb_charger { … };
static const unsigned int smbb_usb_extcon_cable[] = …;
static int smbb_vbat_weak_fn(unsigned int index)
{ … }
static int smbb_vin_fn(unsigned int index)
{ … }
static int smbb_vmax_fn(unsigned int index)
{ … }
static int smbb_vbat_det_fn(unsigned int index)
{ … }
static int smbb_imax_fn(unsigned int index)
{ … }
static int smbb_bat_imax_fn(unsigned int index)
{ … }
static unsigned int smbb_hw_lookup(unsigned int val, int (*fn)(unsigned int))
{ … }
static const struct smbb_charger_attr { … } smbb_charger_attrs[] = …;
static int smbb_charger_attr_write(struct smbb_charger *chg,
enum smbb_attr which, unsigned int val)
{ … }
static int smbb_charger_attr_read(struct smbb_charger *chg,
enum smbb_attr which)
{ … }
static int smbb_charger_attr_parse(struct smbb_charger *chg,
enum smbb_attr which)
{ … }
static void smbb_set_line_flag(struct smbb_charger *chg, int irq, int flag)
{ … }
static irqreturn_t smbb_usb_valid_handler(int irq, void *_data)
{ … }
static irqreturn_t smbb_dc_valid_handler(int irq, void *_data)
{ … }
static irqreturn_t smbb_bat_temp_handler(int irq, void *_data)
{ … }
static irqreturn_t smbb_bat_present_handler(int irq, void *_data)
{ … }
static irqreturn_t smbb_chg_done_handler(int irq, void *_data)
{ … }
static irqreturn_t smbb_chg_gone_handler(int irq, void *_data)
{ … }
static irqreturn_t smbb_chg_fast_handler(int irq, void *_data)
{ … }
static irqreturn_t smbb_chg_trkl_handler(int irq, void *_data)
{ … }
static const struct smbb_irq { … } smbb_charger_irqs[] = …;
static int smbb_usbin_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
static int smbb_usbin_set_property(struct power_supply *psy,
enum power_supply_property psp,
const union power_supply_propval *val)
{ … }
static int smbb_dcin_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
static int smbb_dcin_set_property(struct power_supply *psy,
enum power_supply_property psp,
const union power_supply_propval *val)
{ … }
static int smbb_charger_writable_property(struct power_supply *psy,
enum power_supply_property psp)
{ … }
static int smbb_battery_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
static int smbb_battery_set_property(struct power_supply *psy,
enum power_supply_property psp,
const union power_supply_propval *val)
{ … }
static int smbb_battery_writable_property(struct power_supply *psy,
enum power_supply_property psp)
{ … }
static enum power_supply_property smbb_charger_properties[] = …;
static enum power_supply_property smbb_battery_properties[] = …;
static const struct reg_off_mask_default { … } smbb_charger_setup[] = …;
static char *smbb_bif[] = …;
static const struct power_supply_desc bat_psy_desc = …;
static const struct power_supply_desc usb_psy_desc = …;
static const struct power_supply_desc dc_psy_desc = …;
static int smbb_chg_otg_enable(struct regulator_dev *rdev)
{ … }
static int smbb_chg_otg_disable(struct regulator_dev *rdev)
{ … }
static int smbb_chg_otg_is_enabled(struct regulator_dev *rdev)
{ … }
static const struct regulator_ops smbb_chg_otg_ops = …;
static int smbb_charger_probe(struct platform_device *pdev)
{ … }
static void smbb_charger_remove(struct platform_device *pdev)
{ … }
static const struct of_device_id smbb_charger_id_table[] = …;
MODULE_DEVICE_TABLE(of, smbb_charger_id_table);
static struct platform_driver smbb_charger_driver = …;
module_platform_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;