#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/devm-helpers.h>
#include <linux/gpio/consumer.h>
#include <linux/iio/consumer.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/regmap.h>
#include <linux/regulator/driver.h>
#include <linux/workqueue.h>
#define MT6370_REG_CHG_CTRL1 …
#define MT6370_REG_CHG_CTRL2 …
#define MT6370_REG_CHG_CTRL3 …
#define MT6370_REG_CHG_CTRL4 …
#define MT6370_REG_CHG_CTRL5 …
#define MT6370_REG_CHG_CTRL6 …
#define MT6370_REG_CHG_CTRL7 …
#define MT6370_REG_CHG_CTRL8 …
#define MT6370_REG_CHG_CTRL9 …
#define MT6370_REG_CHG_CTRL10 …
#define MT6370_REG_DEVICE_TYPE …
#define MT6370_REG_USB_STATUS1 …
#define MT6370_REG_CHG_STAT …
#define MT6370_REG_FLED_EN …
#define MT6370_REG_CHG_STAT1 …
#define MT6370_REG_OVPCTRL_STAT …
#define MT6370_VOBST_MASK …
#define MT6370_OTG_PIN_EN_MASK …
#define MT6370_OPA_MODE_MASK …
#define MT6370_OTG_OC_MASK …
#define MT6370_MIVR_IBUS_TH_100_mA …
#define MT6370_ADC_CHAN_IBUS …
#define MT6370_ADC_CHAN_MAX …
enum mt6370_chg_reg_field { … };
enum mt6370_irq { … };
struct mt6370_priv { … };
enum mt6370_usb_status { … };
struct mt6370_chg_field { … };
enum { … };
static const struct linear_range mt6370_chg_ranges[MT6370_RANGE_F_MAX] = …;
#define MT6370_CHG_FIELD(_fd, _reg, _lsb, _msb) …
#define MT6370_CHG_FIELD_RANGE(_fd, _reg, _lsb, _msb) …
static const struct mt6370_chg_field mt6370_chg_fields[F_MAX] = …;
static inline int mt6370_chg_field_get(struct mt6370_priv *priv,
enum mt6370_chg_reg_field fd,
unsigned int *val)
{ … }
static inline int mt6370_chg_field_set(struct mt6370_priv *priv,
enum mt6370_chg_reg_field fd,
unsigned int val)
{ … }
enum { … };
enum { … };
static int mt6370_chg_otg_of_parse_cb(struct device_node *of,
const struct regulator_desc *rdesc,
struct regulator_config *rcfg)
{ … }
static void mt6370_chg_bc12_work_func(struct work_struct *work)
{ … }
static int mt6370_chg_toggle_cfo(struct mt6370_priv *priv)
{ … }
static int mt6370_chg_read_adc_chan(struct mt6370_priv *priv, unsigned int chan,
int *val)
{ … }
static void mt6370_chg_mivr_dwork_func(struct work_struct *work)
{ … }
static void mt6370_chg_pwr_rdy_check(struct mt6370_priv *priv)
{ … }
static int mt6370_chg_get_online(struct mt6370_priv *priv,
union power_supply_propval *val)
{ … }
static int mt6370_chg_get_status(struct mt6370_priv *priv,
union power_supply_propval *val)
{ … }
static int mt6370_chg_get_charge_type(struct mt6370_priv *priv,
union power_supply_propval *val)
{ … }
static int mt6370_chg_set_online(struct mt6370_priv *priv,
const union power_supply_propval *val)
{ … }
static int mt6370_chg_get_property(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val)
{ … }
static int mt6370_chg_set_property(struct power_supply *psy,
enum power_supply_property psp,
const union power_supply_propval *val)
{ … }
static int mt6370_chg_property_is_writeable(struct power_supply *psy,
enum power_supply_property psp)
{ … }
static enum power_supply_property mt6370_chg_properties[] = …;
static enum power_supply_usb_type mt6370_chg_usb_types[] = …;
static const struct power_supply_desc mt6370_chg_psy_desc = …;
static const struct regulator_ops mt6370_chg_otg_ops = …;
static const u32 mt6370_chg_otg_oc_ma[] = …;
static const struct regulator_desc mt6370_chg_otg_rdesc = …;
static int mt6370_chg_init_rmap_fields(struct mt6370_priv *priv)
{ … }
static int mt6370_chg_init_setting(struct mt6370_priv *priv)
{ … }
#define MT6370_CHG_DT_PROP_DECL(_name, _type, _field) …
static int mt6370_chg_init_otg_regulator(struct mt6370_priv *priv)
{ … }
static int mt6370_chg_init_psy(struct mt6370_priv *priv)
{ … }
static void mt6370_chg_destroy_attach_lock(void *data)
{ … }
static void mt6370_chg_destroy_wq(void *data)
{ … }
static irqreturn_t mt6370_attach_i_handler(int irq, void *data)
{ … }
static irqreturn_t mt6370_uvp_d_evt_handler(int irq, void *data)
{ … }
static irqreturn_t mt6370_mivr_handler(int irq, void *data)
{ … }
#define MT6370_CHG_IRQ(_name) …
static int mt6370_chg_init_irq(struct mt6370_priv *priv)
{ … }
static int mt6370_chg_probe(struct platform_device *pdev)
{ … }
static const struct of_device_id mt6370_chg_of_match[] = …;
MODULE_DEVICE_TABLE(of, mt6370_chg_of_match);
static struct platform_driver mt6370_chg_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;