#include <linux/devm-helpers.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/linear_range.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/regulator/driver.h>
#define MT6360_PMU_CHG_CTRL1 …
#define MT6360_PMU_CHG_CTRL2 …
#define MT6360_PMU_CHG_CTRL3 …
#define MT6360_PMU_CHG_CTRL4 …
#define MT6360_PMU_CHG_CTRL5 …
#define MT6360_PMU_CHG_CTRL6 …
#define MT6360_PMU_CHG_CTRL7 …
#define MT6360_PMU_CHG_CTRL8 …
#define MT6360_PMU_CHG_CTRL9 …
#define MT6360_PMU_CHG_CTRL10 …
#define MT6360_PMU_DEVICE_TYPE …
#define MT6360_PMU_USB_STATUS1 …
#define MT6360_PMU_CHG_STAT …
#define MT6360_PMU_CHG_CTRL19 …
#define MT6360_PMU_FOD_STAT …
#define MT6360_FSLP_SHFT …
#define MT6360_FSLP_MASK …
#define MT6360_OPA_MODE_SHFT …
#define MT6360_OPA_MODE_MASK …
#define MT6360_IINLMTSEL_SHFT …
#define MT6360_IINLMTSEL_MASK …
#define MT6360_IAICR_SHFT …
#define MT6360_IAICR_MASK …
#define MT6360_ILIM_EN_MASK …
#define MT6360_VOREG_SHFT …
#define MT6360_VOREG_MASK …
#define MT6360_VOBST_MASK …
#define MT6360_VMIVR_SHFT …
#define MT6360_VMIVR_MASK …
#define MT6360_ICHG_SHFT …
#define MT6360_ICHG_MASK …
#define MT6360_IPREC_SHFT …
#define MT6360_IPREC_MASK …
#define MT6360_IEOC_SHFT …
#define MT6360_IEOC_MASK …
#define MT6360_OTG_OC_MASK …
#define MT6360_USBCHGEN_MASK …
#define MT6360_USB_STATUS_SHFT …
#define MT6360_USB_STATUS_MASK …
#define MT6360_CHG_STAT_SHFT …
#define MT6360_CHG_STAT_MASK …
#define MT6360_VBAT_LVL_MASK …
#define MT6360_VINOVP_SHFT …
#define MT6360_VINOVP_MASK …
#define MT6360_CHRDET_EXT_MASK …
#define MT6360_VMIVR_MIN …
#define MT6360_VMIVR_MAX …
#define MT6360_VMIVR_STEP …
#define MT6360_ICHG_MIN …
#define MT6360_ICHG_MAX …
#define MT6360_ICHG_STEP …
#define MT6360_VOREG_MIN …
#define MT6360_VOREG_MAX …
#define MT6360_VOREG_STEP …
#define MT6360_AICR_MIN …
#define MT6360_AICR_MAX …
#define MT6360_AICR_STEP …
#define MT6360_IPREC_MIN …
#define MT6360_IPREC_MAX …
#define MT6360_IPREC_STEP …
#define MT6360_IEOC_MIN …
#define MT6360_IEOC_MAX …
#define MT6360_IEOC_STEP …
enum { … };
static const struct linear_range mt6360_chg_range[MT6360_RANGE_MAX] = …;
struct mt6360_chg_info { … };
enum mt6360_iinlmtsel { … };
enum mt6360_pmu_chg_type { … };
static enum power_supply_usb_type mt6360_charger_usb_types[] = …;
static int mt6360_get_chrdet_ext_stat(struct mt6360_chg_info *mci,
bool *pwr_rdy)
{ … }
static int mt6360_charger_get_online(struct mt6360_chg_info *mci,
union power_supply_propval *val)
{ … }
static int mt6360_charger_get_status(struct mt6360_chg_info *mci,
union power_supply_propval *val)
{ … }
static int mt6360_charger_get_charge_type(struct mt6360_chg_info *mci,
union power_supply_propval *val)
{ … }
static int mt6360_charger_get_ichg(struct mt6360_chg_info *mci,
union power_supply_propval *val)
{ … }
static int mt6360_charger_get_max_ichg(struct mt6360_chg_info *mci,
union power_supply_propval *val)
{ … }
static int mt6360_charger_get_cv(struct mt6360_chg_info *mci,
union power_supply_propval *val)
{ … }
static int mt6360_charger_get_max_cv(struct mt6360_chg_info *mci,
union power_supply_propval *val)
{ … }
static int mt6360_charger_get_aicr(struct mt6360_chg_info *mci,
union power_supply_propval *val)
{ … }
static int mt6360_charger_get_mivr(struct mt6360_chg_info *mci,
union power_supply_propval *val)
{ … }
static int mt6360_charger_get_iprechg(struct mt6360_chg_info *mci,
union power_supply_propval *val)
{ … }
static int mt6360_charger_get_ieoc(struct mt6360_chg_info *mci,
union power_supply_propval *val)
{ … }
static int mt6360_charger_set_online(struct mt6360_chg_info *mci,
const union power_supply_propval *val)
{ … }
static int mt6360_charger_set_ichg(struct mt6360_chg_info *mci,
const union power_supply_propval *val)
{ … }
static int mt6360_charger_set_cv(struct mt6360_chg_info *mci,
const union power_supply_propval *val)
{ … }
static int mt6360_charger_set_aicr(struct mt6360_chg_info *mci,
const union power_supply_propval *val)
{ … }
static int mt6360_charger_set_mivr(struct mt6360_chg_info *mci,
const union power_supply_propval *val)
{ … }
static int mt6360_charger_set_iprechg(struct mt6360_chg_info *mci,
const union power_supply_propval *val)
{ … }
static int mt6360_charger_set_ieoc(struct mt6360_chg_info *mci,
const union power_supply_propval *val)
{ … }
static int mt6360_charger_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
static int mt6360_charger_set_property(struct power_supply *psy,
enum power_supply_property psp,
const union power_supply_propval *val)
{ … }
static int mt6360_charger_property_is_writeable(struct power_supply *psy,
enum power_supply_property psp)
{ … }
static enum power_supply_property mt6360_charger_properties[] = …;
static const struct power_supply_desc mt6360_charger_desc = …;
static const struct regulator_ops mt6360_chg_otg_ops = …;
static const struct regulator_desc mt6360_otg_rdesc = …;
static irqreturn_t mt6360_pmu_attach_i_handler(int irq, void *data)
{ … }
static void mt6360_handle_chrdet_ext_evt(struct mt6360_chg_info *mci)
{ … }
static void mt6360_chrdet_work(struct work_struct *work)
{ … }
static irqreturn_t mt6360_pmu_chrdet_ext_evt_handler(int irq, void *data)
{ … }
static int mt6360_chg_irq_register(struct platform_device *pdev)
{ … }
static u32 mt6360_vinovp_trans_to_sel(u32 val)
{ … }
static int mt6360_chg_init_setting(struct mt6360_chg_info *mci)
{ … }
static int mt6360_charger_probe(struct platform_device *pdev)
{ … }
static const struct of_device_id __maybe_unused mt6360_charger_of_id[] = …;
MODULE_DEVICE_TABLE(of, mt6360_charger_of_id);
static const struct platform_device_id mt6360_charger_id[] = …;
MODULE_DEVICE_TABLE(platform, mt6360_charger_id);
static struct platform_driver mt6360_charger_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;